2 float checkrules_firstblood;
6 void announce(entity player, string msg)
8 if(time > player.announcetime)
9 if(clienttype(player) == CLIENTTYPE_REAL)
11 player.announcetime = time + 0.3;
16 float IsDifferentTeam(entity a, entity b)
31 float IsFlying(entity a)
33 if(a.flags & FL_ONGROUND)
37 traceline(a.origin, a.origin - '0 0 48', MOVE_NORMAL, a);
38 if(trace_fraction < 1)
43 void UpdateFrags(entity player, float f)
45 PlayerTeamScore_AddScore(player, f);
48 void GiveFrags (entity attacker, entity targ, float f)
50 // TODO route through PlayerScores instead
54 if(cvar("g_arena_roundbased"))
57 // FIXME fix the mess this is (we have REAL points now!)
60 if(cvar("g_domination_disable_frags"))
67 f = RunematchHandleFrags(attacker, targ, f);
71 f = kh_HandleFrags(attacker, targ, f);
75 // FIXME fix LMS mode for new scoreboard
76 // count remaining lives, not frags in lms
78 // keep track of the worst players lives
79 if(targ.frags < lms_lowest_lives)
80 lms_lowest_lives = targ.frags;
81 // player has no more lives left
85 lms_next_place = player_count;
86 targ.frags = -lms_next_place;
93 UpdateFrags(attacker, f);
96 string AppendItemcodes(string s, entity player)
101 // w = player.switchweapon;
103 w = player.cnt; // previous weapon!
104 s = strcat(s, ftos(W_ItemCode(w)));
105 if(time < player.strength_finished)
107 if(time < player.invincible_finished)
109 if(player.flagcarried != world)
111 if(player.BUTTON_CHAT)
116 s = strcat(s, "|", ftos(player.runes));
120 void LogDeath(string mode, float deathtype, entity killer, entity killed)
123 if(!cvar("sv_eventlog"))
125 s = strcat(":kill:", mode);
126 s = strcat(s, ":", ftos(killer.playerid));
127 s = strcat(s, ":", ftos(killed.playerid));
128 s = strcat(s, ":type=", ftos(deathtype));
129 s = strcat(s, ":items=");
130 s = AppendItemcodes(s, killer);
133 s = strcat(s, ":victimitems=");
134 s = AppendItemcodes(s, killed);
136 GameLogEcho(s, FALSE);
139 void Obituary (entity attacker, entity targ, float deathtype)
143 if (targ.classname == "player" || targ.classname == "corpse")
145 if (targ.classname == "corpse")
149 a = attacker.netname;
151 if (targ == attacker)
153 if (deathtype == DEATH_TEAMCHANGE) {
154 centerprint(targ, strcat("You are now on: ", ColoredTeamName(targ.team)));
155 } else if (deathtype == DEATH_AUTOTEAMCHANGE) {
156 centerprint(targ, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(targ.team)));
158 } else if (deathtype == DEATH_CAMP) {
160 centerprint(targ, "^1Reconsider your tactics, camper!\n\n\n");
162 centerprint(targ, "^1Die camper!\n\n\n");
163 } else if (deathtype == DEATH_NOAMMO) {
165 centerprint(targ, "^1You are reinserted into the game for running out of ammo...\n\n\n");
167 centerprint(targ, "^1You were killed for running out of ammo...\n\n\n");
168 } else if (deathtype == DEATH_ROT) {
170 centerprint(targ, "^1You need to preserve your health\n\n\n");
172 centerprint(targ, "^1You grew too old without taking your medicine\n\n\n");
173 } else if (deathtype == DEATH_MIRRORDAMAGE) {
175 centerprint(targ, "^1Don't go against team mates!\n\n\n");
177 centerprint(targ, "^1Don't shoot your team mates!\n\n\n");
180 centerprint(targ, "^1You need to be more careful!\n\n\n");
182 centerprint(targ, "^1You killed your own dumb self!\n\n\n");
186 if (deathtype == DEATH_CAMP)
187 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
188 else if (deathtype == DEATH_MIRRORDAMAGE)
189 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
191 bprint ("^1",s, "^1 will be reinserted into the game due to his own actions\n");
193 if(deathtype != DEATH_TEAMCHANGE)
195 LogDeath("suicide", deathtype, targ, targ);
196 PlayerScore_Add(targ, SP_SUICIDES, 1);
197 PlayerScore_Add(targ, SP_DEATHS, 1);
198 GiveFrags(attacker, targ, -1);
200 if (targ.killcount > 2)
201 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," scoring spree\n");
204 if (deathtype == IT_GRENADE_LAUNCHER)
205 bprint ("^1",s, "^1 detonated\n");
206 else if (deathtype == IT_ELECTRO)
207 bprint ("^1",s, "^1 played with plasma\n");
208 else if (deathtype == IT_ROCKET_LAUNCHER)
209 bprint ("^1",s, "^1 exploded\n");
210 else if (deathtype == DEATH_KILL)
211 bprint ("^1",s, "^1 couldn't take it anymore\n");
212 else if (deathtype == DEATH_ROT)
213 bprint ("^1",s, "^1 died\n");
214 else if (deathtype == DEATH_NOAMMO)
216 bprint ("^7",s, " ^7committed suicide. What's the point of living without ammo?\n");
217 //sound (self, CHAN_BODY, "minstagib/mockery.wav", 1, ATTN_NONE);
219 else if (deathtype == DEATH_CAMP)
220 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
221 else if (deathtype == DEATH_MIRRORDAMAGE)
222 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
223 else if (deathtype != DEATH_TEAMCHANGE)
224 bprint ("^1",s, "^1 couldn't resist the urge to self-destruct\n");
226 if(deathtype != DEATH_TEAMCHANGE)
228 LogDeath("suicide", deathtype, targ, targ);
229 PlayerScore_Add(targ, SP_SUICIDES, 1);
230 PlayerScore_Add(targ, SP_DEATHS, 1);
231 GiveFrags(attacker, targ, -1);
233 if (targ.killcount > 2)
234 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," kill spree\n");
237 else if (attacker.classname == "player" || attacker.classname == "gib")
239 if(teamplay && attacker.team == targ.team)
242 centerprint(attacker, "^1Moron! You went against a teammate!\n\n\n");
243 bprint ("^1", a, "^1 took action against a teammate\n");
245 centerprint(attacker, "^1Moron! You fragged a teammate!\n\n\n");
246 bprint ("^1", a, "^1 mows down a teammate\n");
248 GiveFrags(attacker, targ, -1);
249 PlayerScore_Add(attacker, SP_KILLS, -1); // teamkills DO cound as -1 kill right? or make separate teamkill counter?
250 PlayerScore_Add(targ, SP_DEATHS, 1);
251 if (targ.killcount > 2) {
253 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," scoring spree was ended by a teammate!\n");
255 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," kill spree was ended by a teammate!\n");
257 if (attacker.killcount > 2) {
259 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," scoring spree by going against a teammate\n");
261 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n");
263 attacker.killcount = 0;
265 LogDeath("tk", deathtype, attacker, targ);
269 if (!checkrules_firstblood)
271 checkrules_firstblood = TRUE;
272 //sound(world, CHAN_AUTO, "announcer/firstblood.wav", 1, ATTN_NONE);
274 //sound(world, CHAN_AUTO, "announce/male/mapkill1.wav", 1, ATTN_NONE);
276 bprint("^1",a, "^1 was the first to score", "\n");
278 bprint("^1",a, "^1 drew first blood", "\n");
282 centerprint(attacker, strcat("^4You scored against ^7", s, "\n\n\n"));
283 centerprint(targ, strcat(a,"^1 scored against you ^7\n\n\n"));
285 centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
286 centerprint(targ, strcat("^1You were fragged by ^7", a, "\n\n\n"));
290 bprint ("^1",s, "^1 needs a restart thanks to ", a, "\n");
292 if (deathtype == IT_LASER)
293 bprint ("^1",s, "^1 was blasted by ", a, "\n");
294 else if (deathtype == IT_UZI)
295 bprint ("^1",s, "^1 was riddled full of holes by ", a, "\n");
296 else if (deathtype == IT_SHOTGUN)
297 bprint ("^1",s, "^1 was gunned by ", a, "\n");
298 else if (deathtype == IT_GRENADE_LAUNCHER)
299 bprint ("^1", s, "^1 was blasted by ", a, "\n");
300 else if (deathtype == IT_ELECTRO)
301 bprint ("^1",s, "^1 was blasted by ", a, "\n");
302 else if (deathtype == IT_CRYLINK)
303 bprint ("^1",s, "^1 was blasted by ", a, "\n");
304 else if (deathtype == IT_NEX)
305 bprint ("^1",s, "^1 has been vaporized by ", a, "\n");
306 else if (deathtype == IT_HAGAR)
307 bprint ("^1",s, "^1 was pummeled by ", a, "\n");
308 else if (deathtype == IT_ROCKET_LAUNCHER)
309 bprint ("^1",s, "^1 was blasted by ", a, "\n");
310 else if (deathtype == DEATH_TELEFRAG)
311 bprint ("^1",s, "^1 was telefragged by ", a, "\n");
312 else if (deathtype == DEATH_DROWN)
313 bprint ("^1",s, "^1 was drowned by ", a, "\n");
314 else if (deathtype == DEATH_SLIME)
315 bprint ("^1",s, "^1 was slimed by ", a, "\n");
316 else if (deathtype == DEATH_LAVA)
317 bprint ("^1",s, "^1 was cooked by ", a, "\n");
318 else if (deathtype == DEATH_FALL)
319 bprint ("^1",s, "^1 was grounded by ", a, "\n");
320 else if (deathtype == DEATH_SHOOTING_STAR)
321 bprint ("^1",s, "^1 was shot into space by ", a, "\n");
322 else if (deathtype == DEATH_SWAMP)
323 bprint ("^1",s, "^1 was conserved by ", a, "\n");
324 else if (deathtype == DEATH_HURTTRIGGER)
325 bprint ("^1",s, "^1 was thrown into a world of hurt by ", a, "\n");
326 else if(deathtype == DEATH_TURRET)
327 bprint ("^1",s, "^1 was pushed into the line of fire by ^1", a, "\n");
329 bprint ("^1",s, "^1 was fragged by ", a, "\n");
331 if(g_ctf && targ.flagcarried)
333 GiveFrags(attacker, targ, cvar("g_ctf_flagscore_kill"));
334 PlayerScore_Add(attacker, SP_CTF_CARRIERKILLS, 1);
337 GiveFrags(attacker, targ, 1);
338 PlayerScore_Add(attacker, SP_KILLS, 1);
339 PlayerScore_Add(targ, SP_DEATHS, 1);
340 if (targ.killcount > 2) {
342 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " scoring spree was ended by ", a, "\n");
344 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " kill spree was ended by ", a, "\n");
346 attacker.killcount = attacker.killcount + 1;
347 if (attacker.killcount > 2) {
349 bprint ("^1",a,"^1 made ",ftos(attacker.killcount)," scores in a row\n");
351 bprint ("^1",a,"^1 has ",ftos(attacker.killcount)," frags in a row\n");
354 LogDeath("frag", deathtype, attacker, targ);
356 if (attacker.killcount == 3)
359 bprint (a,"^7 made a ^1TRIPLE SCORE\n");
361 bprint (a,"^7 made a ^1TRIPLE FRAG\n");
362 announce(attacker, "announcer/male/03kills.ogg");
365 else if (attacker.killcount == 5)
368 bprint (a,"^7 unleashes ^1SCORING RAGE\n");
370 bprint (a,"^7 unleashes ^1RAGE\n");
371 announce(attacker, "announcer/male/05kills.ogg");
374 else if (attacker.killcount == 10)
377 bprint (a,"^7 made ^1TEN SCORES IN A ROW!\n");
379 bprint (a,"^7 starts the ^1MASSACRE!\n");
380 announce(attacker, "announcer/male/10kills.ogg");
383 else if (attacker.killcount == 15)
386 bprint (a,"^7 made ^1FIFTEEN SCORES IN A ROW!\n");
388 bprint (a,"^7 executes ^1MAYHEM!\n");
389 announce(attacker, "announcer/male/15kills.ogg");
392 else if (attacker.killcount == 20)
395 bprint (a,"^7 made ^1TWENTY SCORES IN A ROW!\n");
397 bprint (a,"^7 is a ^1BERSERKER!\n");
398 announce(attacker, "announcer/male/20kills.ogg");
401 else if (attacker.killcount == 25)
404 bprint (a,"^7 made ^1TWENTY FIFE SCORES IN A ROW!\n");
406 bprint (a,"^7 inflicts ^1CARNAGE!\n");
407 announce(attacker, "announcer/male/25kills.ogg");
410 else if (attacker.killcount == 30)
413 bprint (a,"^7 made ^1THIRTY SCORES IN A ROW!\n");
415 bprint (a,"^7 unleashes ^1ARMAGEDDON!\n");
416 announce(attacker, "announcer/male/30kills.ogg");
423 centerprint(targ, "^1Watch your step!\n\n\n");
424 if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
425 bprint ("^1",s, "^1 ", attacker.message, "\n");
426 else if (deathtype == DEATH_DROWN)
428 bprint ("^1",s, "^1 was in the water for too long\n");
430 bprint ("^1",s, "^1 drowned\n");
431 else if (deathtype == DEATH_SLIME)
432 bprint ("^1",s, "^1 was slimed\n");
433 else if (deathtype == DEATH_LAVA)
435 bprint ("^1",s, "^1 found a hot place\n");
437 bprint ("^1",s, "^1 turned into hot slag\n");
438 else if (deathtype == DEATH_FALL)
440 bprint ("^1",s, "^1 tested gravity (and it worked)\n");
442 bprint ("^1",s, "^1 hit the ground with a crunch\n");
443 else if (deathtype == DEATH_SHOOTING_STAR)
444 bprint ("^1",s, "^1 became a shooting star\n");
445 else if (deathtype == DEATH_SWAMP)
447 bprint ("^1",s, "^1 discovered a swamp\n");
449 bprint ("^1",s, "^1 is now conserved for centuries to come\n");
450 else if(deathtype == DEATH_TURRET)
451 bprint ("^1",s, "^1 was mowed down by a turret \n");
454 bprint ("^1",s, "^1 needs a restart\n");
456 bprint ("^1",s, "^1 died\n");
457 GiveFrags(targ, targ, -1);
458 PlayerScore_Add(targ, SP_SUICIDES, 1);
459 PlayerScore_Add(targ, SP_DEATHS, 1);
460 // FIXME move this into winning condition checking? or allow READING of the scores?
461 if(targ.frags == -5) {
462 announce(targ, "announcer/male/botlike.ogg");
465 if (targ.killcount > 2)
467 bprint ("^1",s,"^1 needs a restart after a ",ftos(targ.killcount)," scoring spree\n");
469 bprint ("^1",s,"^1 died with a ",ftos(targ.killcount)," kill spree\n");
471 LogDeath("accident", deathtype, targ, targ);
473 targ.death_origin = targ.origin;
475 targ.killer_origin = attacker.origin;
476 // FIXME: this should go in PutClientInServer
482 // these are updated by each Damage call for use in button triggering and such
484 entity damage_inflictor;
485 entity damage_attacker;
487 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
491 entity attacker_save;
495 if (gameover || targ.killcount == -666)
498 local entity oldself;
502 damage_inflictor = inflictor;
503 damage_attacker = attacker;
504 attacker_save = attacker;
506 if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
508 // These are ALWAYS lethal
509 // No damage modification here
510 // Instead, prepare the victim for his death...
512 targ.spawnshieldtime = 0;
513 targ.health = 0.9; // this is < 1
514 targ.flags -= targ.flags & FL_GODMODE;
519 if (targ.classname == "player")
520 if (attacker.classname == "player")
523 damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
525 // nullify damage if teamplay is on
526 if(deathtype != DEATH_TELEFRAG)
527 if(attacker.team == targ.team)
528 if(attacker.classname == "player")
532 else if(attacker != targ)
536 else if(teamplay == 4)
538 if(targ.classname == "player" && targ.deadflag == DEAD_NO)
540 mirrordamage = cvar("g_mirrordamage") * damage;
541 mirrorforce = cvar("g_mirrordamage") * vlen(force);
544 if(cvar("g_friendlyfire") == 0)
548 damage = cvar("g_friendlyfire") * damage;
549 // mirrordamage will be used LATER
558 if(targ.classname == "player")
559 if(attacker.classname == "player")
562 targ.lms_traveled_distance = cvar("g_lms_campcheck_distance");
563 attacker.lms_traveled_distance = cvar("g_lms_campcheck_distance");
569 if(targ.classname == "player")
571 attacker.hitsound += 1;
575 if ((deathtype == DEATH_FALL) ||
576 (deathtype == DEATH_DROWN) ||
577 (deathtype == DEATH_SLIME) ||
578 (deathtype == DEATH_LAVA))
580 if (targ.armorvalue && (deathtype == IT_NEX) && damage)
582 targ.armorvalue -= 1;
583 centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue),"\n"));
587 else if (deathtype == IT_NEX && targ.items & IT_STRENGTH)
589 if(clienttype(attacker) == CLIENTTYPE_REAL)
590 if(IsDifferentTeam(targ, attacker))
593 if (deathtype == IT_LASER)
596 if (targ != attacker)
598 if (targ.classname == "player")
599 centerprint(attacker, "Secondary fire inflicts no damage!\n");
609 if(targ.takedamage == DAMAGE_AIM)
611 if(IsDifferentTeam(targ, attacker))
615 // apply strength multiplier
616 if (attacker.items & IT_STRENGTH && !g_minstagib)
618 damage = damage * cvar("g_balance_powerup_strength_damage");
619 force = force * cvar("g_balance_powerup_strength_force");
621 // apply invincibility multiplier
622 if (targ.items & IT_INVINCIBLE && !g_minstagib)
623 damage = damage * cvar("g_balance_powerup_invincible_takedamage");
628 // apply strength rune
629 if (attacker.runes & RUNE_STRENGTH)
631 if(attacker.runes & CURSE_WEAK) // have both curse & rune
633 damage = damage * cvar("g_balance_rune_strength_combo_damage");
634 force = force * cvar("g_balance_rune_strength_combo_force");
638 damage = damage * cvar("g_balance_rune_strength_damage");
639 force = force * cvar("g_balance_rune_strength_force");
642 else if (attacker.runes & CURSE_WEAK)
644 damage = damage * cvar("g_balance_curse_weak_damage");
645 force = force * cvar("g_balance_curse_weak_force");
648 // apply defense rune
649 if (targ.runes & RUNE_DEFENSE)
651 if (targ.runes & CURSE_VULNER) // have both curse & rune
652 damage = damage * cvar("g_balance_rune_defense_combo_takedamage");
654 damage = damage * cvar("g_balance_rune_defense_takedamage");
656 else if (targ.runes & CURSE_VULNER)
657 damage = damage * cvar("g_balance_curse_vulner_takedamage");
662 if (self.damageforcescale)
665 self.velocity = self.velocity + self.damageforcescale * force;
666 self.flags = self.flags - (self.flags & FL_ONGROUND);
669 if (self.event_damage)
670 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
673 if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
675 // Savage: vampire mode
679 if (time > self.spawnshieldtime)
681 attacker.health += damage;
685 if (attacker.runes & RUNE_VAMPIRE)
687 // apply vampire rune
688 if (attacker.runes & CURSE_EMPATHY) // have the curse too
690 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb");
691 attacker.health = bound(
692 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 40
693 attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"),
694 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
698 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb");
699 attacker.health = bound(
700 attacker.health, // LA: was 3, but changed so that you can't lose health
701 // empathy won't let you gain health in the same way...
702 attacker.health + damage * cvar("g_balance_rune_vampire_absorb"),
703 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
706 // apply empathy curse
707 else if (attacker.runes & CURSE_EMPATHY)
709 attacker.health = bound(
710 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 20
711 attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"),
717 // apply mirror damage if any
718 if(mirrordamage > 0 || mirrorforce > 0)
720 attacker = attacker_save;
724 // just lose extra LIVES, don't kill the player for mirror damage
725 if(attacker.armorvalue > 0)
727 attacker.armorvalue = attacker.armorvalue - 1;
728 centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue),"\n"));
729 attacker.hitsound += 1;
733 force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
734 Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
738 vector NearestPointOnBox(entity box, vector org)
740 vector m1, m2, nearest;
742 m1 = box.mins + box.origin;
743 m2 = box.maxs + box.origin;
745 nearest_x = bound(m1_x, org_x, m2_x);
746 nearest_y = bound(m1_y, org_y, m2_y);
747 nearest_z = bound(m1_z, org_z, m2_z);
752 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype)
753 // Returns total damage applies to creatures
763 float total_damage_to_creatures;
765 blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
766 total_damage_to_creatures = 0;
768 targ = findradius (blastorigin, rad);
771 if (targ != inflictor)
774 // LordHavoc: measure distance to nearest point on target (not origin)
775 // (this guarentees 100% damage on a touch impact)
776 nearest = NearestPointOnBox(targ, blastorigin);
777 diff = nearest - blastorigin;
778 // round up a little on the damage to ensure full damage on impacts
779 // and turn the distance into a fraction of the radius
780 power = 1 - ((vlen (diff) - 2) / rad);
782 //bprint(ftos(power));
787 finaldmg = coredamage * power + edgedamage * (1 - power);
790 center = targ.origin + (targ.mins + targ.maxs) * 0.5;
791 // if it's a player, use the view origin as reference
792 if (targ.classname == "player")
793 center = targ.origin + targ.view_ofs;
794 force = normalize(center - blastorigin) * (finaldmg / coredamage) * forceintensity;
795 if (targ == attacker)
796 finaldmg = finaldmg * cvar("g_balance_selfdamagepercent"); // Partial damage if the attacker hits himself
797 // test line of sight to multiple positions on box,
798 // and do damage if any of them hit
800 c = ceil(finaldmg / 10);
806 traceline(blastorigin, nearest, TRUE, inflictor);
807 if (trace_fraction == 1 || trace_ent == targ
808 || cvar("g_throughfloor"))
811 total_damage_to_creatures += finaldmg;
812 Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
815 nearest_x = targ.mins_x + random() * targ.size_x;
816 nearest_y = targ.mins_y + random() * targ.size_y;
817 nearest_z = targ.mins_z + random() * targ.size_z;
825 return total_damage_to_creatures;