Advertisement
Easelm

Updated C++ Script

Apr 26th, 2012
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. enum Spells
  4. {
  5.     HARVESTSOUL = 74325,
  6.     ICEARMOR = 74272,
  7. };
  8.      
  9. class IceMan : public CreatureScript
  10. {
  11.     public:
  12.         IceMan() : CreatureScript("IceMan"){}
  13.            
  14.         CreatureAI* GetAI(Creature* pCreature) const
  15.         {
  16.             return new IceManAI(pCreature);
  17.         }
  18.      
  19.         struct IceManAI : public ScriptedAI
  20.         {
  21.             IceManAI(Creature *c) : ScriptedAI(c) {}
  22.                
  23.             uint32 Harvestsoul_timer;
  24.             uint32 Armor_timer;
  25.      
  26.             void Reset()
  27.             {
  28.                 Armor_timer = 7000;
  29.                 Harvestsoul_timer = 300000;
  30.             }
  31.      
  32.             void JustDied(Unit * victim)
  33.             {
  34.                 me->MonsterSay("Oh No i Died",LANG_UNIVERSAL,NULL);
  35.             }
  36.      
  37.             void KilledUnit(Unit * victim)
  38.             {
  39.                 me->MonsterSay("Haha i killed you",LANG_UNIVERSAL,NULL);  
  40.             }
  41.      
  42.             void EnterCombat(Unit * /*who*/)
  43.             {
  44.                 me->MonsterSay("You think you can kill me",LANG_UNIVERSAL,NULL);
  45.             }
  46.                
  47.             void UpdateAI(const uint32 uiDiff)
  48.             {
  49.                 // This will run without any targets
  50.                 if (Armor_timer -uiDiff <= 0)
  51.                 {      
  52.                     DoCast(me, ICEARMOR);
  53.                     Armor_timer = 300000;
  54.                 }
  55.                 else
  56.                     Armor_timer -= uiDiff;
  57.  
  58.                 if(!UpdateVictim())
  59.                     return;
  60.  
  61.                if (Harvestsoul_timer <= uiDiff)
  62.                {
  63.                    Unit * target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true);
  64.                    DoCast(target, HARVESTSOUL);
  65.                    Harvestsoul_timer = 300000;
  66.                }
  67.                else
  68.                    Harvestsoul_timer -= uiDiff;
  69.      
  70.                DoMeleeAttackIfReady();
  71.             }
  72.         };
  73. };
  74.      
  75. void AddSC_IceMan()
  76. {
  77.     new IceMan();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement