Krinolin

Boss

Mar 13th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. /*
  2.  
  3. Made by Krinolin
  4.  
  5. */
  6.  
  7.  
  8. #include "ScriptPCH.h"
  9.  
  10. enum eNums
  11. {
  12.     SPELL_ICEARMOR = 36881,
  13.     SPELL_FROSTBOLT = 59251,
  14.     SPELL_FIREBOLT = 57628,
  15.         SPELL_REINCARNATION = 20608
  16. };
  17.  
  18. class CREATURE_NAME : public CreatureScript
  19. {
  20. public:
  21.     CREATURE_NAME() : CreatureScript("CREATURE_NAME"){}
  22.  
  23.     CreaturenameAI* GetAI_Example(Creature* pCreature) const
  24.     {
  25.         return new CreaturenameAI(pCreature);
  26.     }
  27.  
  28.     struct CreaturenameAI : public ScriptedAI
  29.     {
  30.         CreaturenameAI(Creature *c) : ScriptedAI(c) {}
  31.  
  32.         uint32 Icearmor_Timer;
  33.         uint32 Frostbolt_Timer;
  34.         uint32 Firebolt_Timer;
  35.  
  36.         uint32 Phase;
  37.  
  38.         void Reset()
  39.         {
  40.           Icearmor_Timer = 0;
  41.           Frostbolt_Timer = 0;
  42.           Firebolt_Timer = 5000;
  43.  
  44.           Phase = 1;
  45.         }
  46.        
  47.         void KilledUnit(Unit *)
  48.         {
  49.             me->MonsterYell("Hahaha, one down!", LANG_UNIVERSAL, NULL)
  50.         }
  51.  
  52.         void JustDied(Unit *)
  53.         {
  54.             me->MonsterYell("This ain't over yet!", LANG_UNIVERSAL, NULL)
  55.                         me->GetMaxHealth()*100 / me->GetMaxHealth()) <= 0)
  56.             if GetMaxHealth = 0 DoCast(me, SPELL_REINCARNATION);
  57.         }
  58.  
  59.         void EnterCombat(Unit *)
  60.         {
  61.             me->MonsterYell("How dare you defile my sleep?!", LANG_UNIVERSAL, NULL)
  62.         }
  63.  
  64.         void UpdateAI(const uint32 uiDiff)
  65.         {
  66.             if (!me->getVictim())
  67.             {
  68.                 if (Icearmor_Timer <= uidiff)
  69.                 {
  70.                     DoCast(me, SPELL_ICEARMOR);
  71.                     IceArmor_Timer = 18000000;
  72.                 }
  73.                 else
  74.                     IceArmor_Timer -= uiDiff;
  75.             }
  76.            
  77.  
  78.             if(!UpdateVictim())
  79.                 return;
  80.  
  81.             if (((me->GetMaxHealth()*100 / me->GetMaxHealth()) < 55) && (Phase == 1))
  82.             {
  83.                 Phase = 2;
  84.             }
  85.  
  86.             if (Phase == 1)
  87.             {
  88.  
  89.             if(Frostbolt_Timer <= uiDiff)
  90.             {
  91.                 DoCast(me->getVictim(), SPELL_FROSTBOLT);
  92.                 Frostbolt_Timer = 3000;
  93.             }
  94.             else
  95.                 Frostbolt_Timer -= uiDiff;
  96.            
  97.             if(Fireball_Timer <= uiDiff)
  98.             {
  99.                 if (Unit * pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
  100.                                      DoCast(pTarget, SPELL_FIREBAlL);
  101.            
  102.                 Fireball_Timer = 10000;
  103.             }
  104.             else
  105.                 Fireball_Timer -= uiDiff
  106.             }
  107.  
  108.             if (Phase == 2)
  109.             {
  110.                 if(Fireball_Timer <= uiDiff)
  111.                 {
  112.                     DoCast(me->getVictim(), SPELL_FIREBALL);
  113.                     Fireball_Timer = 3000;
  114.  
  115.                 }
  116.                 else
  117.                     Fireball_Timer -= uiDiff;
  118.             }
  119.             DoMeleeAttackIfReady();
  120.         }
  121.     };
  122. };
  123.  
  124. void AddSC_CREATURENAME()
  125. {
  126.     new CREATURENAME();
  127. }
Advertisement
Add Comment
Please, Sign In to add comment