Scripts/Ulduar/Flame Leviathan: Properly cast spell Battering Ram. TODO: Fix spell immunity on target vehicles.

This commit is contained in:
Machiavelli
2011-09-27 19:41:56 +02:00
parent 7fa2a64290
commit a7d0b62195

View File

@@ -235,6 +235,7 @@ class boss_flame_leviathan : public CreatureScript
ASSERT(vehicle);
if (!me->isDead())
Reset();
ActiveTowersCount = 4;
Shutdown = 0;
ActiveTowers = false;
@@ -245,6 +246,8 @@ class boss_flame_leviathan : public CreatureScript
Shutout = true;
Unbroken = true;
_pursueTarget = NULL;
DoCast(SPELL_INVIS_AND_STEALTH_DETECT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
@@ -460,10 +463,14 @@ class boss_flame_leviathan : public CreatureScript
break;
}
}
//TODO: Fix this spell, gets applied on players who are on leviathan should be excluded?
/*if (me->IsWithinMeleeRange(me->getVictim())) //bugged spell casts on units that are boarded on leviathan
DoSpellAttackIfReady(SPELL_BATTERING_RAM);*/
//DoMeleeAttackIfReady();
DoBatteringRamIfReady();
}
void SpellHitTarget(Unit* target , SpellInfo const* spell)
{
if (spell->Id == SPELL_PURSUED)
_pursueTarget = target;
}
void DoAction(int32 const action)
@@ -529,7 +536,25 @@ class boss_flame_leviathan : public CreatureScript
}
}
//Unit* SelectTarget()
private:
//! Copypasta from DoSpellAttackIfReady, only difference is the target - it cannot be selected trough getVictim this way -
//! I also removed the spellInfo check
void DoBatteringRamIfReady()
{
if (me->HasUnitState(UNIT_STAT_CASTING))
return;
if (me->isAttackReady())
{
if (me->IsWithinCombatRange(_pursueTarget, 30.0f))
{
DoCast(_pursueTarget, SPELL_BATTERING_RAM);
me->resetAttackTimer();
}
}
}
Unit* _pursueTarget;
};
CreatureAI* GetAI(Creature* creature) const