Advertisement
Rochet2

ScriptTest

Jul 23rd, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ScriptPCH.h"
  2.  
  3. #define spell_cleave 845
  4. #define spell_death_coil 6789
  5.  
  6. class my_patchwerk : public CreatureScript
  7. {
  8. public:
  9.     my_patchwerk() : CreatureScript("my_patchwerk") { }
  10.  
  11.     struct my_patchwerkAI : public ScriptedAI
  12.     {
  13.         my_patchwerkAI(Creature *c) : ScriptedAI(c) {}
  14.  
  15.         uint32 tcleave;
  16.         uint32 tdeathcoil;
  17.  
  18.         void Reset()
  19.         {
  20.             tcleave = 15000;
  21.             tdeathcoil = 30000;
  22.         }
  23.  
  24.         void EnterCombat(Unit* /*who*/)
  25.         {
  26.         me->MonsterYell("I yelled on combat", LANG_UNIVERSAL, NULL);
  27.         }
  28.  
  29.         void JustDied(Unit* /*killer*/)
  30.         {
  31.         me->MonsterYell("I yelled on death", LANG_UNIVERSAL, NULL);
  32.         }
  33.  
  34.         void KilledUnit(Unit* /*victim*/)
  35.         {
  36.         me->MonsterYell("I yelled when killing someone", LANG_UNIVERSAL, NULL);
  37.         }
  38.  
  39.         void UpdateAI(const uint32 diff)
  40.         {
  41.                 if (!UpdateVictim())
  42.                     return;
  43.  
  44.             if (tcleave <= diff)
  45.             {
  46.                 DoCast(me->getVictim(), spell_cleave, true);
  47.                 tcleave = 15000;
  48.             }
  49.             else
  50.                 tcleave -= diff;
  51.  
  52.             if (tdeathcoil <= diff)
  53.             {
  54.                 DoCast(me->getVictim(), spell_death_coil, true);
  55.                 me->MonsterYell("Eat This !", LANG_UNIVERSAL, NULL);
  56.                 tdeathcoil = 30000;
  57.             }
  58.             else
  59.                 tdeathcoil -= diff;    
  60.  
  61.             DoMeleeAttackIfReady();
  62.         }
  63.     };
  64.  
  65.     CreatureAI* GetAI(Creature* pCreature) const
  66.     {
  67.         return new my_patchwerkAI (pCreature);
  68.     }
  69.  
  70. };
  71.  
  72. void AddSC_my_patchwerk()
  73. {
  74.     new my_patchwerk();
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement