Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- #include "ScriptedPch.h"
- struct Memory of HoggerAI : public ScriptedAI
- {
- Memory of HoggerAI(Creature *c) : ScriptedAI(c)
- {
- }
- uint32 spell1_phase1_Timer;
- uint32 spell1_phase2_Timer;
- uint32 spell2_phase2_Timer;
- uint32 spell3_phase2_Timer;
- uint32 spell1_phase3_Timer;
- uint32 spell1_phase4_Timer;
- uint32 spell1_phase5_Timer;
- uint32 phase1_Percent;
- uint32 phase2_Percent;
- uint32 phase3_Percent;
- uint32 phase4_Percent;
- uint32 phase5_Percent;
- uint32 phase;
- bool enraged;
- void EnterCombat(Unit *who)
- {
- }
- void KilledUnit(Unit* victim)
- {
- }
- void JustDied(Unit* Killer)
- {
- m_creature->MonsterYell("I...will....be back!", LANG_UNIVERSAL, NULL);
- DoCast(m_creature, 67729);
- }
- void Reset()
- {
- spell1_phase1_Timer = 15000+rand()%5000;
- spell1_phase2_Timer = 15000+rand()%5000;
- spell2_phase2_Timer = 10000+rand()%5000;
- spell3_phase2_Timer = 10000+rand()%10000;
- spell1_phase3_Timer = 10000+rand()%5000;
- spell1_phase4_Timer = 3000+rand()%1000;
- spell1_phase5_Timer = 1000+rand()%1000;
- phase1_Percent = 100;
- phase2_Percent = 75;
- phase3_Percent = 50;
- phase4_Percent = 25;
- phase5_Percent = 0;
- phase = 0;
- enraged = false;
- }
- void UpdateAI(const uint32 diff)
- {
- if (!UpdateVictim())
- return;
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 30) && !enraged)
- {
- enraged = true;
- DoCast(m_creature, 78722);
- m_creature->MonsterYell("Raaaaaaaaaaaaaaaaaaaa", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 100) && phase == 0)
- {
- phase = 1;
- m_creature->MonsterYell("Die!", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 75) && phase == 1)
- {
- phase = 2;
- m_creature->MonsterYell("Worthless Maggots!", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 50) && phase == 2)
- {
- phase = 3;
- m_creature->MonsterYell("You...will....die!", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 25) && phase == 3)
- {
- phase = 4;
- m_creature->MonsterYell("Scrubs!!", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 0) && phase == 4)
- {
- phase = 5;
- m_creature->MonsterYell("Impossible!....", LANG_UNIVERSAL, NULL);
- }
- if (phase == 1)
- {
- if (spell1_phase1_Timer <= diff)
- {
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 71504);
- spell1_phase1_Timer = 15000+rand()%5000;
- } else spell1_phase1_Timer -= diff;
- }
- if (phase == 2)
- {
- if (spell1_phase2_Timer <= diff)
- {
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 67994);
- spell1_phase2_Timer = 15000+rand()%5000;
- } else spell1_phase2_Timer -= diff;
- if (spell2_phase2_Timer <= diff)
- {
- DoCast(m_creature->getVictim(), 71130);
- spell2_phase2_Timer = 10000+rand()%5000;
- } else spell2_phase2_Timer -= diff;
- if (spell3_phase2_Timer <= diff)
- {
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 71504);
- spell3_phase2_Timer = 10000+rand()%10000;
- } else spell3_phase2_Timer -= diff;
- }
- if (phase == 3)
- {
- if (spell1_phase3_Timer <= diff)
- {
- DoCast(m_creature->getVictim(), 71130);
- spell1_phase3_Timer = 10000+rand()%5000;
- } else spell1_phase3_Timer -= diff;
- }
- if (phase == 4)
- {
- if (spell1_phase4_Timer <= diff)
- {
- DoCast(m_creature, 75382);
- spell1_phase4_Timer = 3000+rand()%1000;
- } else spell1_phase4_Timer -= diff;
- }
- if (phase == 5)
- {
- if (spell1_phase5_Timer <= diff)
- {
- DoCast(m_creature, 75382);
- spell1_phase5_Timer = 1000+rand()%1000;
- } else spell1_phase5_Timer -= diff;
- }
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAIMemory of Hogger(Creature* pCreature)
- {
- return new Memory of HoggerAI (pCreature);
- }
- void AddSC_Memory of Hogger()
- {
- Script *newscript;
- newscript = new Script;
- newscript->Name = "npc_Memory of Hogger";
- newscript->GetAI = &GetAIMemory of Hogger;
- newscript->RegisterSelf();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement