Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "ScriptedEscortAI.h"
- int repair;
- enum eEnums
- {
- //Yell
- SAY_AGGRO = -1550000,
- SAY_SLAY1 = -1550001,
- SAY_SLAY2 = -1550002,
- SAY_SLAY3 = -1550003,
- SAY_DEATH = -1550004,
- };
- enum ePhases
- {
- PHASE_1 = 1,
- PHASE_2 = 2,
- PHASE_3 = 3
- };
- enum eSpells
- {
- SPELL_CRUSH_ARMOR = 33661,
- SPELL_ARCANE_SHOCK = 60073,
- SPELL_GROUND_TREMOR = 62932,
- SPELL_STOMP = 45185,
- SPELL_SHOCKWAVE = 73795,
- SPELL_SHOCK_BLAST = 63631,
- SPELL_SELF_REPAIR = 64383,
- SPELL_LIGHTNING_NOVA = 65279,
- };
- class Shadow_Of_Xolitude : public CreatureScript
- {
- public:
- Shadow_Of_Xolitude(): CreatureScript("Shadow_Of_Xolitude") {}
- struct Shadow_Of_XolitudeAI : public BossAI
- {
- Shadow_Of_XolitudeAI(Creature* creature) : BossAI(creature , 50016)
- {
- }
- uint8 uiPhase;
- uint32 uiCrushArmor;
- uint32 uiStomp;
- uint32 uiArcaneShock;
- uint32 uiGroundTremor;
- uint32 uiShockwave;
- uint32 uiShockBlast;
- uint32 uiLightningNova;
- void Reset()
- {
- _Reset();
- me->SetDisplayId(me->GetNativeDisplayId());
- me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);
- uiPhase = PHASE_1;
- uiCrushArmor = urand(8000,10000);
- uiStomp = urand(35000,45000);
- uiGroundTremor = urand(20000,25000);
- uiArcaneShock = urand(9000,10000);
- uiShockwave = urand(14000,18000);
- uiShockBlast = urand(60000, 75000);
- uiLightningNova = urand(25000,30000);
- repair = 0;
- }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
- if (me->GetHealth()*100 / me->GetMaxHealth() < 70)
- {
- uiPhase = PHASE_2;
- }
- if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
- {
- uiPhase = PHASE_3;
- }
- if (me->GetHealth()*100 / me->GetMaxHealth() < 10)
- {
- if(!repair)
- {
- me->AttackStop();
- me->CombatStop();
- DoCastVictim(23312);
- DoCast(me , SPELL_SELF_REPAIR);
- repair = 1;
- }
- }
- if (uiCrushArmor <= uiDiff)
- {
- DoCastVictim(SPELL_CRUSH_ARMOR);
- uiCrushArmor = urand(8000,10000);
- } else uiCrushArmor -= uiDiff;
- if (uiArcaneShock <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- {
- if (target && target->isAlive())
- DoCast(target, SPELL_ARCANE_SHOCK);
- }
- uiArcaneShock = urand(9000,10000);
- } else uiArcaneShock -= uiDiff;
- if (uiStomp <= uiDiff)
- {
- DoCastVictim(SPELL_STOMP);
- uiStomp = urand(35000,45000);
- } else uiStomp -= uiDiff;
- switch(uiPhase)
- {
- case PHASE_1:
- {
- if (uiGroundTremor <= uiDiff)
- {
- DoCastVictim(SPELL_GROUND_TREMOR);
- uiGroundTremor = urand(20000,25000);
- } else uiGroundTremor -= uiDiff;
- if (uiShockwave <= uiDiff)
- {
- DoCastVictim(SPELL_SHOCKWAVE);
- uiShockwave = urand(12000,13000);
- } else uiShockwave -= uiDiff;
- } break;
- case PHASE_2:
- {
- if (uiLightningNova <= uiDiff)
- {
- me->AttackStop();
- me->CombatStop();
- DoCastVictim(SPELL_LIGHTNING_NOVA);
- uiLightningNova = urand(25000,30000);
- } else uiLightningNova -= uiDiff;
- if (uiShockBlast <= uiDiff)
- {
- me->AttackStop();
- me->CombatStop();
- DoCastVictim(SPELL_SHOCK_BLAST);
- uiShockBlast = urand(60000,75000);
- } else uiShockBlast -= uiDiff;
- } break;
- case PHASE_3:
- {
- } break;
- }
- if (!me->HasUnitState(UNIT_STAT_ROOT) && !me->HealthBelowPct(1))
- DoMeleeAttackIfReady();
- }
- void EnterCombat(Unit* pWho)
- {
- DoScriptText(SAY_AGGRO, me);
- }
- void JustDied(Unit* killer)
- {
- DoScriptText(SAY_DEATH, me);
- repair = 0;
- }
- void KilledUnit(Unit* /*victim*/)
- {
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
- }
- };
- CreatureAI* GetAI(Creature *creature) const
- {
- return new Shadow_Of_XolitudeAI (creature);
- };
- };
- void AddSC_Shadow_Of_Xolitude()
- {
- new Shadow_Of_Xolitude();
- }
Add Comment
Please, Sign In to add comment