#include "StdAfx.h" #include "Setup.h" /************************************************************************/ /* Instance_Steam Vaults.cpp Script */ /************************************************************************/ // Coilfang Engineer AI #define CN_COILFANG_ENGINEER 17721 #define BOMB 40332 // AOE #define NET 38338 // Should stay for 5 or 8 sec? class COILFANGENGINEERAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(COILFANGENGINEERAI); COILFANGENGINEERAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 2; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Coilfang Oracle AI #define CN_COILFANG_ORACLE 17803 #define FROST_SHOCK 34353 #define SONIC_BURST 39052 // Should make dmg? #define HEAL 39378 // Hmm... no idea if this is correct id (and how much should heal) class COILFANGORACLEAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(COILFANGORACLEAI); COILFANGORACLEAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 3; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Coilfang Warrior AI #define CN_COILFANG_WARRIOR 17802 #define MORTAL_STRIKE 29572 class COILFANGWARRIORAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(COILFANGWARRIORAI); COILFANGWARRIORAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 1; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Coilfang Siren AI #define CN_COILFANG_SIREN 17801 #define FEAR 27641 // Little bugged, target stands in place instead of running away and still not sure to id #define LIGHTNING_BOLT 36152 // 1 target class COILFANGSIRENAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(COILFANGSIRENAI); COILFANGSIRENAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 2; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Bog OverlordAI #define CN_BOG_OVERLORD 21694 #define FUNGAL_DECAY 32065 class BOGOVERLORDAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(BOGOVERLORDAI); BOGOVERLORDAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 1; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Coilfang water elemental #define CN_COILFANG_WATER_ELEMENTAL 17917 #define FROSTBOLT_VOLLEY 36741 class COILFANGWATERELEMENTALAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(COILFANGWATERELEMENTALAI); COILFANGWATERELEMENTALAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 1; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iGetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; //Mekgineer Steamrigger #define CN_MEKGINEER_STEAMRIGGER 17796 #define SUPER_SHRINK_RAY 31485 #define SAW_BLADE 31486 // Or this: 35318 #define ELECTRIFIED_NET 35107 #define ENRAGE 41447 // No idea if these are good ids // Must spawn 3 Steamrigger Mechanics when his health is on 75%, 50% and 25% class MEKGINEERSTEAMRIGGERAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(MEKGINEERSTEAMRIGGERAI); MEKGINEERSTEAMRIGGERAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 4; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iSendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Your in for a World-O-Hurt !"); _unit->PlaySoundToSet(10368); RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnTargetDied(Unit* mTarget) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You just got served, Punk !"); _unit->PlaySoundToSet(10372); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Mommy"); _unit->PlaySoundToSet(10375); RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Hydromancer ThespiaAI #define CN_HYDROMANCER_THESPIA 17797 #define ENVELOPING_WINDS 31718 // 1 target #define LIGHTNING_CLOUD 25033 // various targets on not attacked. #define LUNG_BURST 31481 class HYDROMANCERTHESPIAAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(HYDROMANCERTHESPIAAI); HYDROMANCERTHESPIAAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 3; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iSendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The depts will consume you !"); _unit->PlaySoundToSet(10361); RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnTargetDied(Unit* mTarget) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "To the depts of oblivion with you !"); _unit->PlaySoundToSet(10364); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Our matron will be ... The end of you all"); _unit->PlaySoundToSet(10366); RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; // Warlord Kalitresh AI #define CN_WARLORD_KALITRESH 17798 #define IMPALE 24049 // 1 target Correct spell id? Maybe 34451 or ... correct #define HEAD_CRACK 16172 // 1 target <--- does he really has that spell? He does #define WARLORDS_RAGE 36453 #define SPELL_REFLECTION 33961 //more spells to add , nop that's it class WARLORDKALITRESHAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(WARLORDKALITRESHAI); WARLORDKALITRESHAI(Creature* pCreature) : CreatureAIScript(pCreature) { nrspells = 4; m_spellcheck = new bool[nrspells]; spells = new SP_AI_Spell[nrspells]; for(int i=0;iSendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Your head will roll !"); _unit->PlaySoundToSet(10392); RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } void OnTargetDied(Unit* mTarget) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Squirm , Surface filth !"); _unit->PlaySoundToSet(10395); } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "For her exelencty , For Vash..."); _unit->PlaySoundToSet(10397); RemoveAIUpdateEvent(); delete[] spells; delete[] m_spellcheck; spells = NULL; m_spellcheck = NULL; } void AIUpdate() { float val = sRand.rand(100.0f); SpellCast(val); } void SpellCast(float val) { if(m_spellcheck && spells && _unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit *target = NULL; for(int i=0;iGetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; } m_spellcheck[i] = false; return; } if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } } protected: bool *m_spellcheck; SP_AI_Spell *spells; int nrspells; }; void SetupSteamVaults(ScriptMgr * mgr) { mgr->register_creature_script(CN_COILFANG_ORACLE, &COILFANGORACLEAI::Create); mgr->register_creature_script(CN_COILFANG_ENGINEER, &COILFANGENGINEERAI::Create); //mgr->register_creature_script(CN_Coilfang_sorceress, &CoilfangsorceressAI::Create); mgr->register_creature_script(CN_COILFANG_WARRIOR, &COILFANGWARRIORAI::Create); mgr->register_creature_script(CN_COILFANG_SIREN, &COILFANGSIRENAI::Create); mgr->register_creature_script(CN_HYDROMANCER_THESPIA, &HYDROMANCERTHESPIAAI::Create); mgr->register_creature_script(CN_WARLORD_KALITRESH, &WARLORDKALITRESHAI::Create); mgr->register_creature_script(CN_BOG_OVERLORD, &BOGOVERLORDAI::Create); mgr->register_creature_script(CN_COILFANG_WATER_ELEMENTAL, &COILFANGWATERELEMENTALAI::Create); mgr->register_creature_script(CN_MEKGINEER_STEAMRIGGER, &MEKGINEERSTEAMRIGGERAI::Create); }