const float MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
const float MONSTER_MOVE_ENEMY = 5; // used only as a movestate
-float enemy_range () { return vlen(self.enemy.origin - self.origin); }
-
float MONSTER_STATE_ATTACK_LEAP = 1; // the start of something big?
if (time < self.attack_finished_single)
return FALSE;
- if (enemy_range() > 2000) // long traces are slow
+ if (vlen(self.enemy.origin - self.origin) > 2000) // long traces are slow
return FALSE;
if(self.attack_melee)
- if(enemy_range() <= 100 * self.scale)
+ if(vlen(self.enemy.origin - self.origin) <= 100 * self.scale)
{
monster_sound(self.msound_attack_melee, 0, FALSE); // no delay for attack sounds
self.attack_melee(); // don't wait for nextthink - too slow
traceline((self.absmin + self.absmax) * 0.5, (self.enemy.absmin + self.enemy.absmax) * 0.5, TRUE, world);
if (trace_fraction != 1)
return; // not visible
- if(enemy_range() <= 2000)
+ if(vlen(self.enemy.origin - self.origin) <= 2000)
Fire_AddDamage(self.enemy, self, autocvar_g_monster_hellknight_inferno_damage * monster_skill, autocvar_g_monster_hellknight_inferno_damagetime, DEATH_MONSTER_HKNIGHT_INFERNO);
}
RandomSelection_Add(world, 0, "inferno", autocvar_g_monster_hellknight_inferno_chance, 1);
RandomSelection_Add(world, 0, "spikes", autocvar_g_monster_hellknight_spike_chance, 1);
if(self.health >= 100)
- RandomSelection_Add(world, 0, "jump", ((enemy_range() > autocvar_g_monster_hellknight_jump_dist * self.scale) ? 1 : autocvar_g_monster_hellknight_jump_chance), 1);
+ RandomSelection_Add(world, 0, "jump", ((vlen(self.enemy.origin - self.origin) > autocvar_g_monster_hellknight_jump_dist * self.scale) ? 1 : autocvar_g_monster_hellknight_jump_chance), 1);
switch(RandomSelection_chosen_string)
{
}
case "jump":
{
- if (enemy_range() >= 400)
+ if (vlen(self.enemy.origin - self.origin) >= 400)
if (findtrajectorywithleading(self.origin, self.mins, self.maxs, self.enemy, 1000, 0, 10, 0, self))
{
self.velocity = findtrajectory_velocity;
if (!self.enemy)
return;
- if (enemy_range() > 100 * self.scale)
+ if (vlen(self.enemy.origin - self.origin) > 100 * self.scale)
return;
Damage(self.enemy, self, self, autocvar_g_monster_ogre_chainsaw_damage * monster_skill, DEATH_MONSTER_OGRE_CHAINSAW, self.enemy.origin, normalize(self.enemy.origin - self.origin));
{
// don't throw if it is blocked
traceline(self.origin + '0 0 10', self.enemy.origin + '0 0 10', FALSE, self);
- if (enemy_range() > 1000)
+ if (vlen(self.enemy.origin - self.origin) > 1000)
return FALSE;
if (trace_ent != self.enemy)
return FALSE;
if (!self.enemy)
return;
- if (enemy_range() > 100 * self.scale)
+ if (vlen(self.enemy.origin - self.origin) > 100 * self.scale)
return;
Damage(self.enemy, self, self, bigdmg * monster_skill, DEATH_MONSTER_SHAMBLER_SMASH, self.enemy.origin, normalize(self.enemy.origin - self.origin));
if (time < self.attack_finished_single)
return FALSE;
- if (enemy_range() >= 2000)
+ if (vlen(self.enemy.origin - self.origin) >= 2000)
return FALSE;
- if (enemy_range() <= 120)
+ if (vlen(self.enemy.origin - self.origin) <= 120)
chance = 0.9;
- else if (enemy_range() <= 500)
+ else if (vlen(self.enemy.origin - self.origin) <= 500)
chance = 0.6; // was 0.4
- else if (enemy_range() <= 1000)
+ else if (vlen(self.enemy.origin - self.origin) <= 1000)
chance = 0.3; // was 0.05
else
chance = 0;
if (chance > random())
return FALSE;
- if(self.currentammo <= 0 && enemy_range() <= 120)
+ if(self.currentammo <= 0 && vlen(self.enemy.origin - self.origin) <= 120)
{
monster_sound(self.msound_attack_melee, 0, FALSE); // no delay for attack sounds
self.attack_melee();