#include "StdAfx.h" #include "Setup.h" #include "WorldSession.h" #include "LogonCommHandler.h" #include "AIInterface.h" #include "Unit.h" /************************************************************************/ /* GuardAI.cpp Script */ /************************************************************************/ // Undercity GuardianAI #define CN_UNDERCITY_GUARDIAN 78021 //#define DISEASE_CLOUD 12187 //12188 class CCGUARDIANAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(CCGUARDIANAI); //SP_AI_Spell spells[1]; //bool m_spellcheck[1]; CCGUARDIANAI(Creature* pCreature) : CreatureAIScript(pCreature) { /*nrspells = 1; for(int i=0;iCastSpell(_unit, spells[0].info, spells[0].instant);*/ } void CheckPvP(Unit* mTarget) { Unit * Target = FindTarget(); if(Target == hasStateFlag(UF_ATTACKING)) { AttackReaction(Target, 1, 0); } } void OnCombatStart(Unit* mTarget) { //CastTime(); //RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); } /*void CastTime() { for(int i=0;iGetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { //CastTime(); RemoveAIUpdateEvent(); } void AIUpdate() { /*float val = sRand.rand(100.0f); SpellCast(val);*/ } protected: //int nrspells; }; void SetupGuardAI(ScriptMgr * mgr) { mgr->register_creature_script(CN_UNDERCITY_GUARDIAN, &CCGUARDIANAI::Create); }