diff options
author | linencloth <none@none> | 2010-11-13 20:24:20 +0100 |
---|---|---|
committer | linencloth <none@none> | 2010-11-13 20:24:20 +0100 |
commit | a312e7b337e9de1f09f4b8fb58838864db5f926e (patch) | |
tree | ce8f3201e4fddb9a3e5ba0d30f4b9bbe42cf72f2 | |
parent | bb9336ca27020d4e50a5f6da07d85327fd11b4c3 (diff) |
Scripts/Misc: Cleanup and fix victim handling of the snakes of Snake Trap
--HG--
branch : trunk
-rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index c2994777fc2..412626d29c8 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1673,13 +1673,11 @@ public: uint32 SpellTimer; bool IsViper; - bool Spawn; void EnterCombat(Unit * /*who*/) {} void Reset() { - Spawn = true; SpellTimer = 0; CreatureInfo const *Info = me->GetCreatureInfo(); @@ -1694,6 +1692,12 @@ public: uint32 delta = (rand() % 7) * 100; me->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, float(Info->baseattacktime + delta)); me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , float(Info->attackpower)); + + // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target + if (!me->getVictim() && me->isSummon()) + if (Unit * Owner = CAST_SUM(me)->GetSummoner()) + if (Owner->getAttackerForHelper()) + AttackStart(Owner->getAttackerForHelper()); } //Redefined for random target selection: @@ -1719,22 +1723,8 @@ public: void UpdateAI(const uint32 diff) { - if (Spawn) - { - Spawn = false; - // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target - if (!me->getVictim() && me->isSummon()) - if (Unit * Owner = CAST_SUM(me)->GetSummoner()) - if (Owner->getAttackerForHelper()) - AttackStart(Owner->getAttackerForHelper()); - } - - if (!me->getVictim()) - { - if (me->isInCombat()) - DoStopAttack(); + if (!UpdateVictim()) return; - } if (SpellTimer <= diff) { |