Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. enum Spells
  4. {
  5. SPELL_FLAMEBREATH = 119420,
  6. SPELL_INFERNOCHARGE = 119405,
  7. };
  8.  
  9. enum Events
  10. {
  11. EVENT_FLAMEBREATH = 1,
  12. EVENT_INFERNOCHARGE = 2,
  13. };
  14.  
  15. class example : public CreatureScript
  16. {
  17. public:
  18. example() : CreatureScript("example") { }
  19.  
  20. struct exampleAI : public BossAI
  21. {
  22. exampleAI(Creature* creature) : BossAI(creature, 0)
  23. {
  24. }
  25.  
  26. void Reset() OVERRIDE
  27. {
  28. _Reset();
  29. }
  30.  
  31. void EnterCombat(Unit* /*who*/) OVERRIDE
  32. {
  33. me->MonsterYell("Vei muri!", LAND_UNIVERSAL, NULL);
  34. events.ScheduleEvent(EVENT_FLAMEBREATH, 6000);
  35. events.ScheduleEvent(EVENT_INFERNOCHARGE, 12000);
  36. }
  37.  
  38. void KilledUnit(Unit * /*victim*/) OVERRIDE
  39. {
  40. me->MonsterYell("You killed the You You!", LAND_UNIVERSAL, NULL);
  41. }
  42.  
  43. void JustDied(Unit * /*victim*/) OVERRIDE
  44. {
  45. }
  46.  
  47. void UpdateAI(uint32 diff) OVERRIDE
  48. {
  49. if (!UpdateVictim())
  50. return;
  51.  
  52. events.Update(diff);
  53.  
  54. if (me->HasUnitState(UNIT_STATE_CASTING))
  55. return;
  56.  
  57. while (uint32 eventId = events.ExecuteEvent())
  58. {
  59. switch (eventId)
  60. {
  61. case EVENT_FLAMEBREATH:
  62. if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0))
  63. DoCast(target, SPELL_FLAMEBREATH);
  64. events.ScheduleEvent(EVENT_FLAMEBREATH, 6000);
  65. break;
  66. case EVENT_INFERNOCHARGE:
  67. me->MonsterYell("MUIE RAGELESS", LAND_UNIVERSAL, NULL);
  68. if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 2))
  69. DoCast(target, SPELL_INFERNOCHARGE);
  70. events.ScheduleEvent(EVENT_INFERNOCHARGE, 12000);
  71. break;
  72. default:
  73. break;
  74. }
  75. }
  76.  
  77. DoMeleeAttackIfReady();
  78. }
  79. };
  80.  
  81. CreatureAI* GetAI(Creature* creature) const OVERRIDE
  82. {
  83. return new exampleAI(creature);
  84. }
  85. };
  86.  
  87. void AddSC_example()
  88. {
  89. new example();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement