Scripts/Ulduar/Flame Leviathan: Use GUID in script instead of pointer

This commit is contained in:
Machiavelli
2011-09-27 19:56:45 +02:00
parent 5bc2b4d8fd
commit 6d4a7b3930
@@ -246,8 +246,6 @@ class boss_flame_leviathan : public CreatureScript
Shutout = true; Shutout = true;
Unbroken = true; Unbroken = true;
_pursueTarget = NULL;
DoCast(SPELL_INVIS_AND_STEALTH_DETECT); DoCast(SPELL_INVIS_AND_STEALTH_DETECT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
@@ -270,6 +268,8 @@ class boss_flame_leviathan : public CreatureScript
_Reset(); _Reset();
//resets shutdown counter to 0. 2 or 4 depending on raid mode //resets shutdown counter to 0. 2 or 4 depending on raid mode
Shutdown = 0; Shutdown = 0;
_pursueTarget = 0;
me->SetReactState(REACT_DEFENSIVE); me->SetReactState(REACT_DEFENSIVE);
} }
@@ -470,7 +470,7 @@ class boss_flame_leviathan : public CreatureScript
void SpellHitTarget(Unit* target, SpellInfo const* spell) void SpellHitTarget(Unit* target, SpellInfo const* spell)
{ {
if (spell->Id == SPELL_PURSUED) if (spell->Id == SPELL_PURSUED)
_pursueTarget = target; _pursueTarget = target->GetGUID();
} }
void DoAction(int32 const action) void DoAction(int32 const action)
@@ -546,15 +546,16 @@ class boss_flame_leviathan : public CreatureScript
if (me->isAttackReady()) if (me->isAttackReady())
{ {
if (me->IsWithinCombatRange(_pursueTarget, 30.0f)) Unit* target = ObjectAccessor::GetUnit(*me, _pursueTarget);
if (me->IsWithinCombatRange(target, 30.0f))
{ {
DoCast(_pursueTarget, SPELL_BATTERING_RAM); DoCast(target, SPELL_BATTERING_RAM);
me->resetAttackTimer(); me->resetAttackTimer();
} }
} }
} }
Unit* _pursueTarget; uint64 _pursueTarget;
}; };
CreatureAI* GetAI(Creature* creature) const CreatureAI* GetAI(Creature* creature) const