Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Script : 2010-03-29 14:11:20
- // Run this query on your world database
- // UPDATE `creature_template` SET ScriptName='npc_The Lich King' WHERE `entry`=36597;
- #include "precompiled.h"
- struct MANGOS_DLL_DECL The Lich KingAI : public ScriptedAI
- {
- The Lich KingAI(Creature* pCreature) : ScriptedAI(pCreature)
- {
- Reset();
- SetCombatMovement(false);
- }
- uint32 spell1_phase1_Timer;
- uint32 spell2_phase1_Timer;
- uint32 spell3_phase1_Timer;
- uint32 spell4_phase1_Timer;
- uint32 spell5_phase1_Timer;
- uint32 spell6_phase1_Timer;
- uint32 spell1_phase2_Timer;
- uint32 spell2_phase2_Timer;
- uint32 spell3_phase2_Timer;
- uint32 spell4_phase2_Timer;
- uint32 spell5_phase2_Timer;
- uint32 spell1_phase3_Timer;
- uint32 spell2_phase3_Timer;
- uint32 spell1_phase4_Timer;
- uint32 spell2_phase4_Timer;
- uint32 spell3_phase4_Timer;
- uint32 phase1_Percent;
- uint32 phase;
- bool enraged;
- void Aggro(Unit* pWho)
- {
- }
- void KilledUnit(Unit* pVictim)
- {
- }
- void JustDied(Unit* pKiller)
- {
- }
- void Reset()
- {
- spell1_phase1_Timer = 60000+rand()%40000;
- spell2_phase1_Timer = 30000+rand()%20000;
- spell3_phase1_Timer = 90000+rand()%10000;
- spell4_phase1_Timer = 20000+rand()%20000;
- spell5_phase1_Timer = 40000+rand()%60000;
- spell6_phase1_Timer = 20000+rand()%20000;
- spell1_phase2_Timer = 80000+rand()%20000;
- spell2_phase2_Timer = 50000+rand()%50000;
- spell3_phase2_Timer = 50000+rand()%50000;
- spell4_phase2_Timer = 80000+rand()%20000;
- spell5_phase2_Timer = 40000+rand()%20000;
- spell1_phase3_Timer = 40000+rand()%20000;
- spell2_phase3_Timer = 40000+rand()%20000;
- spell1_phase4_Timer = 20000+rand()%40000;
- spell2_phase4_Timer = 20000+rand()%20000;
- spell3_phase4_Timer = 50000+rand()%10000;
- phase1_Percent = 100;
- phase = 0;
- enraged = false;
- }
- void UpdateAI(const uint32 diff)
- {
- if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
- return;
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 20) && !enraged)
- {
- enraged = true;
- DoCastSpellIfCan(m_creature, 72143);
- m_creature->MonsterYell("You Shall die!", LANG_UNIVERSAL, NULL);
- }
- if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 100) && phase == 0)
- {
- phase = 1;
- m_creature->MonsterYell("You will regret this!", LANG_UNIVERSAL, NULL);
- }
- if (phase == 1)
- {
- if (spell1_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70372);
- spell1_phase1_Timer = 60000+rand()%40000;
- } else spell1_phase1_Timer -= diff;
- if (spell2_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 72149);
- spell2_phase1_Timer = 30000+rand()%20000;
- } else spell2_phase1_Timer -= diff;
- if (spell3_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70358);
- spell3_phase1_Timer = 90000+rand()%10000;
- } else spell3_phase1_Timer -= diff;
- if (spell4_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70541);
- spell4_phase1_Timer = 20000+rand()%20000;
- } else spell4_phase1_Timer -= diff;
- if (spell5_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70337);
- spell5_phase1_Timer = 40000+rand()%60000;
- } else spell5_phase1_Timer -= diff;
- if (spell6_phase1_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 74074);
- spell6_phase1_Timer = 20000+rand()%20000;
- } else spell6_phase1_Timer -= diff;
- }
- if (phase == 2)
- {
- if (spell1_phase2_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 69037);
- spell1_phase2_Timer = 80000+rand()%20000;
- } else spell1_phase2_Timer -= diff;
- if (spell2_phase2_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 74352);
- spell2_phase2_Timer = 50000+rand()%50000;
- } else spell2_phase2_Timer -= diff;
- if (spell3_phase2_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70541);
- spell3_phase2_Timer = 50000+rand()%50000;
- } else spell3_phase2_Timer -= diff;
- if (spell4_phase2_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 69409);
- spell4_phase2_Timer = 80000+rand()%20000;
- } else spell4_phase2_Timer -= diff;
- if (spell5_phase2_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 72754);
- spell5_phase2_Timer = 40000+rand()%20000;
- } else spell5_phase2_Timer -= diff;
- }
- if (phase == 3)
- {
- if (spell1_phase3_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 72754);
- spell1_phase3_Timer = 40000+rand()%20000;
- } else spell1_phase3_Timer -= diff;
- if (spell2_phase3_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 69409);
- spell2_phase3_Timer = 40000+rand()%20000;
- } else spell2_phase3_Timer -= diff;
- }
- if (phase == 4)
- {
- if (spell1_phase4_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 68980);
- spell1_phase4_Timer = 20000+rand()%40000;
- } else spell1_phase4_Timer -= diff;
- if (spell2_phase4_Timer <= diff)
- {
- DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM, 0), 70498);
- spell2_phase4_Timer = 20000+rand()%20000;
- } else spell2_phase4_Timer -= diff;
- if (spell3_phase4_Timer <= diff)
- {
- DoCastSpellIfCan(m_creature->getVictim(), 70503);
- spell3_phase4_Timer = 50000+rand()%10000;
- } else spell3_phase4_Timer -= diff;
- }
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAIThe Lich King(Creature* pCreature)
- {
- return new The Lich KingAI (pCreature);
- }
- void AddSC_The Lich King()
- {
- Script *newscript;
- newscript = new Script;
- newscript->Name = "npc_The Lich King";
- newscript->GetAI = &GetAIThe Lich King;
- newscript->RegisterSelf();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement