*Add DoCastAOE for script to cast AOE spells. Because AOE spells do not require any target.
*Corresponding update of Kalecgos script. --HG-- branch : trunk
This commit is contained in:
@@ -203,13 +203,21 @@ void ScriptedAI::DoStopAttack()
|
|||||||
|
|
||||||
void ScriptedAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
|
void ScriptedAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
|
||||||
{
|
{
|
||||||
if (!victim || m_creature->hasUnitState(UNIT_STAT_CASTING))
|
if (!victim || m_creature->hasUnitState(UNIT_STAT_CASTING) && !triggered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//m_creature->StopMoving();
|
//m_creature->StopMoving();
|
||||||
m_creature->CastSpell(victim, spellId, triggered);
|
m_creature->CastSpell(victim, spellId, triggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptedAI::DoCastAOE(uint32 spellId, bool triggered)
|
||||||
|
{
|
||||||
|
if(!triggered && m_creature->hasUnitState(UNIT_STAT_CASTING))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_creature->CastSpell((Unit*)NULL, spellId, triggered);
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptedAI::DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered)
|
void ScriptedAI::DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered)
|
||||||
{
|
{
|
||||||
if (!who || m_creature->IsNonMeleeSpellCasted(false))
|
if (!who || m_creature->IsNonMeleeSpellCasted(false))
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
|||||||
|
|
||||||
//Cast spell by Id
|
//Cast spell by Id
|
||||||
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
|
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
|
||||||
|
void DoCastAOE(uint32 spellId, bool triggered = false);
|
||||||
|
|
||||||
//Cast spell by spell info
|
//Cast spell by spell info
|
||||||
void DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered = false);
|
void DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered = false);
|
||||||
|
|||||||
@@ -586,32 +586,31 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
|
|||||||
|
|
||||||
if(ArcaneBuffetTimer < diff)
|
if(ArcaneBuffetTimer < diff)
|
||||||
{
|
{
|
||||||
DoCast(m_creature->getVictim(), SPELL_ARCANE_BUFFET);
|
DoCastAOE(SPELL_ARCANE_BUFFET);
|
||||||
ArcaneBuffetTimer = 8000;
|
ArcaneBuffetTimer = 8000;
|
||||||
}else ArcaneBuffetTimer -= diff;
|
}else ArcaneBuffetTimer -= diff;
|
||||||
|
|
||||||
if(FrostBreathTimer < diff)
|
if(FrostBreathTimer < diff)
|
||||||
{
|
{
|
||||||
DoCast(m_creature->getVictim(), SPELL_FROST_BREATH);
|
DoCastAOE(SPELL_FROST_BREATH);
|
||||||
FrostBreathTimer = 15000;
|
FrostBreathTimer = 15000;
|
||||||
}else FrostBreathTimer -= diff;
|
}else FrostBreathTimer -= diff;
|
||||||
|
|
||||||
if(TailLashTimer < diff)
|
if(TailLashTimer < diff)
|
||||||
{
|
{
|
||||||
DoCast(m_creature->getVictim(), SPELL_TAIL_LASH);
|
DoCastAOE(SPELL_TAIL_LASH);
|
||||||
TailLashTimer = 15000;
|
TailLashTimer = 15000;
|
||||||
}else TailLashTimer -= diff;
|
}else TailLashTimer -= diff;
|
||||||
|
|
||||||
if(WildMagicTimer < diff)
|
if(WildMagicTimer < diff)
|
||||||
{
|
{
|
||||||
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
|
DoCastAOE(WildMagic[rand()%6]);
|
||||||
if(target && target->isAlive())
|
|
||||||
DoCast(target, WildMagic[rand()%6]);
|
|
||||||
WildMagicTimer = 20000;
|
WildMagicTimer = 20000;
|
||||||
}else WildMagicTimer -= diff;
|
}else WildMagicTimer -= diff;
|
||||||
|
|
||||||
if(SpectralBlastTimer < diff)
|
if(SpectralBlastTimer < diff)
|
||||||
{
|
{
|
||||||
|
//this is a hack. we need to find a victim without aura in core
|
||||||
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
|
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
|
||||||
if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) )
|
if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user