Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "precompiled.h"
- #include "gundrak.h"
- //Eck the Ferocious
- #define POINT_X 1643.877930
- #define POINT_Y 936.278015
- #define POINT_Z 107.204948
- #define POINT_O 0.668432
- enum Spells
- {
- EMOTE_ECK_BERSERK = -1533021,
- SPELL_ECK_BERSERK = 55816,
- SPELL_ECK_BITE = 55813,
- SPELL_ECK_SPIT = 55814,
- SPELL_ECK_SPRING_1 = 55815,
- SPELL_ECK_SPRING_2 = 55837
- };
- struct MANGOS_DLL_DECL boss_EckAI : public ScriptedAI
- {
- boss_EckAI(Creature* pCreature) : ScriptedAI(pCreature)
- {
- m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
- m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
- Reset();
- }
- ScriptedInstance* m_pInstance;
- bool m_bIsRegularMode;
- uint32 m_uiSPELL_ECK_BERSERK_TIMER;
- uint32 m_uiSPELL_ECK_BITE_TIMER;
- uint32 m_uiSPELL_ECK_SPIT_TIMER;
- uint32 m_uiSPELL_ECK_SPRING_TIMER;
- bool m_bBerserk;
- void Reset()
- {
- m_uiSPELL_ECK_BERSERK_TIMER = urand(60000, 90000);
- m_uiSPELL_ECK_BITE_TIMER = 5000;
- m_uiSPELL_ECK_SPIT_TIMER = 15000;
- m_uiSPELL_ECK_SPRING_TIMER = 8000;
- m_bBerserk = false;
- if (m_pInstance)
- m_pInstance->SetData(TYPE_ECK, NOT_STARTED);
- }
- void Aggro(Unit* who)
- {
- if(m_pInstance)
- m_pInstance->SetData(TYPE_ECK, IN_PROGRESS);
- }
- void DeleteFromThreatList(uint64 TargetGUID)
- {
- for (std::list<HostileReference*>::const_iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
- {
- if ((*itr)->getUnitGuid() == TargetGUID)
- {
- (*itr)->removeReference();
- break;
- }
- }
- }
- void UpdateAI(const uint32 uidiff)
- {
- if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
- return;
- if(m_bIsRegularMode)
- {
- m_creature->SetVisibility(VISIBILITY_ON);
- m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- }
- if(m_uiSPELL_ECK_BITE_TIMER <= uidiff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), SPELL_ECK_BITE);
- m_uiSPELL_ECK_BITE_TIMER = urand(8000, 12000);
- }else m_uiSPELL_ECK_BITE_TIMER -= uidiff;
- if (m_uiSPELL_ECK_SPIT_TIMER <= uidiff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), SPELL_ECK_SPIT);
- m_uiSPELL_ECK_SPIT_TIMER = urand(12000, 14000);
- }else m_uiSPELL_ECK_SPIT_TIMER -= uidiff;
- if (m_uiSPELL_ECK_SPRING_TIMER <= uidiff)
- {
- if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
- {
- pTarget=pTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
- if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
- {
- DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_ECK_SPRING_1 : SPELL_ECK_SPRING_2);
- m_creature->getThreatManager().modifyThreatPercent(pTarget, -100);
- m_uiSPELL_ECK_SPRING_TIMER = urand(5000, 10000);
- }
- }
- }else m_uiSPELL_ECK_SPRING_TIMER -= uidiff;
- //Berserk on timer
- if (!m_bBerserk)
- {
- if (m_uiSPELL_ECK_BERSERK_TIMER <= uidiff)
- {
- DoCastSpellIfCan(m_creature, SPELL_ECK_BERSERK);
- DoScriptText(EMOTE_ECK_BERSERK, m_creature);
- m_bBerserk = true;
- m_uiSPELL_ECK_BERSERK_TIMER = urand(60000, 90000);
- }
- else
- {
- m_uiSPELL_ECK_BERSERK_TIMER -= uidiff;
- }
- }
- DoMeleeAttackIfReady();
- }
- void JustDied(Unit* killer)
- {
- if (m_pInstance)
- m_pInstance->SetData(TYPE_ECK, DONE);
- }
- };
- CreatureAI* GetAI_boss_Eck(Creature* pCreature)
- {
- return new boss_EckAI (pCreature);
- }
- void AddSC_boss_Eck()
- {
- Script *newScript;
- newScript = new Script;
- newScript->Name = "boss_Eck";
- newScript->GetAI = &GetAI_boss_Eck;
- newScript->RegisterSelf();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement