Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: C++  |  size: 1.13 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "ScriptPCH.h"
  2.  
  3. enum Spells
  4. {
  5.     SPELL_FROSTBOLT = 1337,
  6. };
  7.  
  8. enum Yells
  9. {
  10.     SAY_RAWR = -1337;
  11. };
  12.  
  13. class boss_terminator : public CreatureScript
  14. {
  15. public:
  16.     boss_terminator() : CreatureScript("boss_terminator") {}
  17.  
  18.     CreatureAI* GetAI(Creature* creature) const
  19.     {
  20.         return new boss_terminatorAI (creature);
  21.     }
  22.  
  23.     struct boss_terminatorAI : public ScriptedAI
  24.     {
  25.         boss_terminatorAI(Creature* creature) : ScriptedAI(creature), frostbolt(false) {}
  26.  
  27.         bool frostbolt;
  28.  
  29.         void Reset()
  30.         {
  31.             frostbolt = false;
  32.         }
  33.  
  34.         void JustDied(Unit* /*blabla*/)
  35.         {
  36.             me->MonsterYell(SAY_RAWR, 0, 0);
  37.         }
  38.  
  39.         void UpdateAI(const uint32 diff)
  40.         {
  41.             if (!UpdateVictim())
  42.                 return;
  43.  
  44.             if (!frostbolt && HealthBelowPct(50))
  45.             {
  46.                 if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
  47.                     me->CastSpell(target, SPELL_FROSTBOLT, true);
  48.  
  49.                 frostbolt = true;
  50.             }
  51.  
  52.             DoMeleeAttackIfReady();
  53.         }
  54.     };
  55. };