Guest User

Untitled

a guest
Dec 15th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.28 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "ScriptedEscortAI.h"
  3.  
  4. int repair;
  5.  
  6. enum eEnums
  7. {
  8.     //Yell
  9.     SAY_AGGRO                   = -1550000,
  10.     SAY_SLAY1                   = -1550001,
  11.     SAY_SLAY2                   = -1550002,
  12.     SAY_SLAY3                   = -1550003,
  13.     SAY_DEATH                   = -1550004,
  14. };
  15.  
  16.  
  17. enum ePhases
  18. {
  19.     PHASE_1    = 1,
  20.     PHASE_2    = 2,
  21.     PHASE_3    = 3
  22. };
  23.  
  24.  
  25. enum eSpells
  26. {
  27.     SPELL_CRUSH_ARMOR         = 33661,
  28.     SPELL_ARCANE_SHOCK        = 60073,
  29.     SPELL_GROUND_TREMOR       = 62932
  30.     SPELL_STOMP               = 45185,
  31.     SPELL_SHOCKWAVE           = 73795,
  32.     SPELL_SHOCK_BLAST         = 63631,
  33.     SPELL_SELF_REPAIR         = 64383,
  34.     SPELL_LIGHTNING_NOVA      = 65279,
  35. };
  36.  
  37. class Shadow_Of_Xolitude : public CreatureScript
  38. {
  39.     public:
  40.         Shadow_Of_Xolitude(): CreatureScript("Shadow_Of_Xolitude") {}
  41.  
  42.     struct Shadow_Of_XolitudeAI : public BossAI
  43.     {
  44.         Shadow_Of_XolitudeAI(Creature* creature) : BossAI(creature , 50016)
  45.         {
  46.         }
  47.  
  48.         uint8 uiPhase;
  49.         uint32 uiCrushArmor;
  50.         uint32 uiStomp;
  51.         uint32 uiArcaneShock;
  52.         uint32 uiGroundTremor;
  53.         uint32 uiShockwave;
  54.         uint32 uiShockBlast;
  55.         uint32 uiLightningNova;
  56.  
  57.         void Reset()
  58.         {
  59.             _Reset();
  60.             me->SetDisplayId(me->GetNativeDisplayId());
  61.             me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);    
  62.  
  63.             uiPhase = PHASE_1;
  64.             uiCrushArmor = urand(8000,10000);
  65.             uiStomp = urand(35000,45000);
  66.             uiGroundTremor = urand(20000,25000);
  67.             uiArcaneShock = urand(9000,10000);
  68.             uiShockwave = urand(14000,18000);
  69.             uiShockBlast = urand(60000, 75000);
  70.             uiLightningNova = urand(25000,30000);
  71.             repair = 0;
  72.         }
  73.  
  74.         void UpdateAI(const uint32 uiDiff)
  75.         {
  76.             if (!UpdateVictim())
  77.                 return;
  78.            
  79.             if (me->GetHealth()*100 / me->GetMaxHealth() < 70)
  80.             {
  81.               uiPhase = PHASE_2;
  82.             }
  83.  
  84.             if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
  85.             {
  86.               uiPhase = PHASE_3;
  87.             }
  88.  
  89.             if (me->GetHealth()*100 / me->GetMaxHealth() < 10)
  90.             {
  91.               if(!repair)
  92.               {
  93.               me->AttackStop();
  94.               me->CombatStop();
  95.               DoCastVictim(23312);
  96.               DoCast(me , SPELL_SELF_REPAIR);
  97.               repair = 1;
  98.               }
  99.             }
  100.  
  101.             if (uiCrushArmor <= uiDiff)
  102.                     {
  103.                         DoCastVictim(SPELL_CRUSH_ARMOR);                       
  104.                         uiCrushArmor = urand(8000,10000);
  105.                     } else uiCrushArmor -= uiDiff;
  106.  
  107.             if (uiArcaneShock <= uiDiff)
  108.                     {  
  109.                         if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
  110.                         {
  111.                             if (target && target->isAlive())
  112.                             DoCast(target, SPELL_ARCANE_SHOCK);
  113.                         }
  114.                         uiArcaneShock = urand(9000,10000);
  115.                     } else uiArcaneShock -= uiDiff;
  116.  
  117.             if (uiStomp <= uiDiff)
  118.                     {  
  119.                         DoCastVictim(SPELL_STOMP);                 
  120.                         uiStomp = urand(35000,45000);
  121.                     } else uiStomp -= uiDiff;
  122.  
  123.              switch(uiPhase)
  124.             {
  125.                 case PHASE_1:
  126.                 {
  127.                     if (uiGroundTremor <= uiDiff)
  128.                     {  
  129.                         DoCastVictim(SPELL_GROUND_TREMOR);
  130.                         uiGroundTremor = urand(20000,25000);
  131.                     } else uiGroundTremor -= uiDiff;
  132.  
  133.                     if (uiShockwave <= uiDiff)
  134.                     {  
  135.                         DoCastVictim(SPELL_SHOCKWAVE);
  136.                         uiShockwave = urand(12000,13000);
  137.                     } else uiShockwave -= uiDiff;
  138.                    
  139.                 } break;
  140.  
  141.                 case PHASE_2:
  142.                 {
  143.  
  144.                     if (uiLightningNova <= uiDiff)
  145.                     {
  146.                         me->AttackStop();
  147.                         me->CombatStop();
  148.                         DoCastVictim(SPELL_LIGHTNING_NOVA);                    
  149.                         uiLightningNova = urand(25000,30000);
  150.                     } else uiLightningNova -= uiDiff;
  151.  
  152.                     if (uiShockBlast <= uiDiff)
  153.                     {
  154.                         me->AttackStop();
  155.                         me->CombatStop();
  156.                         DoCastVictim(SPELL_SHOCK_BLAST);                       
  157.                         uiShockBlast = urand(60000,75000);
  158.                     } else uiShockBlast -= uiDiff;
  159.  
  160.                    
  161.                 } break;
  162.  
  163.                 case PHASE_3:
  164.                 {  
  165.                    
  166.                 } break;
  167.             }
  168.  
  169.             if (!me->HasUnitState(UNIT_STAT_ROOT) && !me->HealthBelowPct(1))
  170.                 DoMeleeAttackIfReady();
  171.         }
  172.  
  173.         void EnterCombat(Unit* pWho)
  174.         {
  175.             DoScriptText(SAY_AGGRO, me);
  176.         }
  177.                  
  178.         void JustDied(Unit* killer)
  179.         {
  180.             DoScriptText(SAY_DEATH, me);
  181.             repair = 0;
  182.         }
  183.  
  184.         void KilledUnit(Unit* /*victim*/)
  185.         {
  186.             DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
  187.         }
  188.     };
  189.  
  190.     CreatureAI* GetAI(Creature *creature) const
  191.     {
  192.         return new Shadow_Of_XolitudeAI (creature);
  193.     };
  194. };
  195.  
  196. void AddSC_Shadow_Of_Xolitude()
  197. {              
  198.     new Shadow_Of_Xolitude();
  199. }
Add Comment
Please, Sign In to add comment