123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- float IsExplosionDamage;
- void() T_MissileTouch;
- void() info_player_start;
- void(entity targ, entity attacker) ClientObituary;
- void() monster_death_use;
- float(entity targ, entity inflictor) CanDamage =
- {
- if (targ.movetype == MOVETYPE_PUSH)
- {
- traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- if (trace_ent == targ)
- return TRUE;
- return FALSE;
- }
-
- traceline(inflictor.origin, targ.origin, TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
- if (trace_fraction == 1)
- return TRUE;
- return FALSE;
- };
- void(entity targ, entity attacker) Killed =
- {
- local entity oself;
- oself = self;
- self = targ;
-
- if (self.health < -99)
- self.health = -99;
- if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
- {
- self.th_die ();
- self = oself;
- return;
- }
- self.enemy = attacker;
- if (self.flags & FL_MONSTER)
- {
- killed_monsters = killed_monsters + 1;
- WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
- if (attacker.classname == "player")
- {
- attacker.frags = attacker.frags + 1;
- }
-
- if (attacker != self && attacker.flags & FL_MONSTER)
- {
- WriteByte (MSG_ALL, SVC_ACHIEVEMENT);
- WriteString(MSG_ALL, "ACH_FRIENDLY_FIRE");
- }
- }
- if (attacker.classname == "buzzsaw" ||
- attacker.classname == "Vengeance" ||
- attacker.classname == "pendulum")
- self.health = -99;
- self.gravity = 1.0;
- ClientObituary(self, attacker);
-
- self.takedamage = DAMAGE_NO;
- self.touch = SUB_Null;
- monster_death_use();
- self.th_die ();
-
- self = oself;
- };
- float(entity targ, entity inflictor, entity attacker, float damage) shield_hit;
- void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
- {
- local vector dir;
- local entity oldself;
- local float save;
- local float take;
-
- if (!targ.takedamage)
- return;
-
- if ( coop && targ != attacker && targ.classname == "player" && attacker.classname == "player" ) {
- if ( attacker.flags & FL_ISBOT && !( targ.flags & FL_ISBOT ) ) {
- return;
- }
- }
- if (targ.classname == "trigger_explosion")
- {
- if ( IsExplosionDamage != 1)
- return;
- }
- IsExplosionDamage = 0;
- if (targ.items2 & IT2_SHIELD)
- {
-
- damage = shield_hit(targ, inflictor, attacker, damage);
- if (damage == 0)
- return;
- }
- damage_attacker = attacker;
- if (attacker.super_damage_finished > time)
- damage = damage * 4;
- if (deathmatch)
- damage = RuneApplyBlack(damage, attacker);
- if (TeamArmorDam(targ, inflictor, attacker, damage))
- save = ceil(targ.armortype*damage);
- else
- save = 0;
- if (save >= targ.armorvalue)
- {
- save = targ.armorvalue;
- targ.armortype = 0;
- targ.items2 = targ.items2 -
- (targ.items2 & (IT2_ARMOR1 | IT2_ARMOR2 | IT2_ARMOR3));
- }
-
- targ.armorvalue = targ.armorvalue - save;
- take = ceil(damage-save);
- if (targ.flags & FL_CLIENT)
- {
- targ.dmg_take = targ.dmg_take + take;
- targ.dmg_save = targ.dmg_save + save;
- targ.dmg_inflictor = inflictor;
- }
- if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
- {
- dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
- dir = normalize(dir);
- targ.velocity = targ.velocity + dir*damage*8;
- }
-
- if (targ.flags & FL_GODMODE)
- return;
- if (targ.invincible_finished >= time)
- {
- if (targ.invincible_sound < time)
- {
- sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
- targ.invincible_sound = time + 2;
- }
- return;
- }
- if (!TeamHealthDam(targ, inflictor, attacker, damage))
- return;
- if (deathmatch)
- take = RuneApplyEarth(take, targ);
-
- targ.health = targ.health - take;
-
- if (targ.health <= 0)
- {
- Killed (targ, attacker);
- return;
- }
- oldself = self;
- self = targ;
- if ( (self.flags & FL_MONSTER) && attacker != world)
- {
-
- if (self != attacker && attacker != self.enemy)
- {
- if ( (self.classname != attacker.classname)
- || (self.classname == "monster_army" ) )
- {
- if ( self.classname != "monster_dragon")
- {
- if (self.enemy.classname == "player")
- self.oldenemy = self.enemy;
- self.enemy = attacker;
- FoundTarget ();
- }
- }
- }
- }
-
- if (self.th_pain)
- {
- self.th_pain (attacker, take);
-
- if (skill == 3)
- self.pain_finished = time + 5;
- }
- self = oldself;
- };
- void(entity inflictor, entity attacker, float damage) T_EELZap =
- {
- local float points;
- local entity head;
- local vector org;
- head = findradius(inflictor.origin, damage+40);
-
- while (head)
- {
- if (head.takedamage)
- {
- org = head.origin + (head.mins + head.maxs)*0.5;
- points = 0.5*vlen (inflictor.origin - org);
- if (points < 0)
- points = 0;
- points = damage - points;
- if (head == attacker)
- points = points * 0.5;
- if (points > 0)
- {
- if (CanDamage (head, inflictor))
- {
- if (head.classname != "monster_eel" &&
- (head.flags & FL_INWATER))
- T_Damage (head, inflictor, attacker, points);
- }
- }
- }
- head = head.chain;
- }
- };
- void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage =
- {
- local float points;
- local entity head;
- local vector org;
- IsExplosionDamage = 1;
- head = findradius(inflictor.origin, damage+40);
-
- while (head)
- {
- if (head != ignore)
- {
- if (head.takedamage)
- {
- org = head.origin + (head.mins + head.maxs)*0.5;
- points = 0.5*vlen (inflictor.origin - org);
- if (points < 0)
- points = 0;
- points = damage - points;
- if (head == attacker)
- points = points * 0.5;
- if (points > 0)
- {
- if (CanDamage (head, inflictor))
- {
- if (head.classname == "monster_shambler")
- T_Damage (head, inflictor, attacker, points*0.5);
- else
- T_Damage (head, inflictor, attacker, points);
- }
- }
- }
- }
- head = head.chain;
- }
- };
- void(entity attacker, float damage) T_BeamDamage =
- {
- local float points;
- local entity head;
-
- head = findradius(attacker.origin, damage+40);
-
- while (head)
- {
- if (head.takedamage)
- {
- points = 0.5*vlen (attacker.origin - head.origin);
- if (points < 0)
- points = 0;
- points = damage - points;
- if (head == attacker)
- points = points * 0.5;
- if (points > 0)
- {
- if (CanDamage (head, attacker))
- {
- if (head.classname == "monster_shambler")
- T_Damage (head, attacker, attacker, points*0.5);
- else
- T_Damage (head, attacker, attacker, points);
- }
- }
- }
- head = head.chain;
- }
- };
|