Implemented NPC special ability 40 'NPC_CHASE_DISTANCE'

Param 0: Sets max distance you need to be away from an npc for it to chase you.
Param 1: Sets min distance you need to be from npc for it to chase you.
Usage: Ideally used with ranged attack npcs / casters who you DO NOT WANT
to chase you unless you get too close or too far or out of sight.
This commit is contained in:
KayenEQ
2014-08-23 03:21:36 -04:00
parent 16d47a2c47
commit 85df09b3f2
5 changed files with 42 additions and 3 deletions
+6
View File
@@ -965,6 +965,9 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
void NPC::RangedAttack(Mob* other)
{
if (!other)
return;
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))
@@ -973,6 +976,9 @@ void NPC::RangedAttack(Mob* other)
return;
}
if(!CheckLosFN(other))
return;
int attacks = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 0);
attacks = attacks > 0 ? attacks : 1;
for(int i = 0; i < attacks; ++i) {