diff options
| author | megamage <none@none> | 2009-08-17 22:34:18 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-08-17 22:34:18 -0500 |
| commit | 6701d3d24f80e876aecca9b2086e06464f67fce8 (patch) | |
| tree | 1b10a7e69d49643b5b586be78b3095e4bd885604 /src/bindings/scripts | |
| parent | 7c2db4f2a9c55869c44b848fef9daf43091e981e (diff) | |
*Script for quest "An End To All Things..."
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts')
| -rw-r--r-- | src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 0bc4966dc33..cfbc9bc0597 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -100,6 +100,54 @@ CreatureAI* GetAI_npc_valkyr_battle_maiden(Creature* pCreature) return new npc_valkyr_battle_maidenAI (pCreature); } +struct TRINITY_DLL_DECL mob_anti_airAI : public ScriptedAI +{ + mob_anti_airAI(Creature *c) : ScriptedAI(c) + { + assert(me->m_spells[0]); + range = DoGetSpellMaxRange(me->m_spells[0]); + } + + float range; + + void MoveInLineOfSight(Unit *who) + { + if(!me->getVictim() && me->canAttack(who) + && me->IsWithinCombatRange(who, range) + && me->IsWithinLOSInMap(who)) + AttackStart(who); + } + + void AttackStart(Unit *who) + { + if(who->IsFlying() || !me->IsWithinMeleeRange(who)) + { + if(me->Attack(who, false)) + me->GetMotionMaster()->MoveIdle(); + } + else if(me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who); + } + + void UpdateAI(const uint32 diff) + { + if(!UpdateVictim()) + return; + + if(me->getVictim()->IsFlying() || !me->IsWithinMeleeRange(me->getVictim())) + { + if(!DoSpellAttackIfReady(me->m_spells[0])) + EnterEvadeMode(); + } + else + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_anti_air(Creature* pCreature) +{ + return new mob_anti_airAI (pCreature); +} void AddSC_the_scarlet_enclave() { @@ -109,4 +157,9 @@ void AddSC_the_scarlet_enclave() newscript->Name="npc_valkyr_battle_maiden"; newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_anti_air"; + newscript->GetAI = &GetAI_mob_anti_air; + newscript->RegisterSelf(); } |
