Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_garr.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss_Garr
8SD%Complete: 50
9SDComment: Adds NYI
10SDCategory: Molten Core
11EndScriptData */
12
13#include "ObjectMgr.h"
14#include "ScriptMgr.h"
15#include "ScriptedCreature.h"
16#include "molten_core.h"
17
19{
20 // Garr
23 SPELL_ENRAGE = 19516,
24
25 // Adds
28};
29
35
37{
38 public:
39 boss_garr() : CreatureScript("boss_garr") { }
40
41 struct boss_garrAI : public BossAI
42 {
43 boss_garrAI(Creature* creature) : BossAI(creature, BOSS_GARR)
44 {
45 }
46
48 {
49 BossAI::EnterCombat(victim);
50 events.ScheduleEvent(EVENT_ANTIMAGIC_PULSE, 25000);
51 events.ScheduleEvent(EVENT_MAGMA_SHACKLES, 15000);
52 }
53
55 {
56 if (!UpdateVictim())
57 return;
58
59 events.Update(diff);
60
61 if (me->HasUnitState(UNIT_STATE_CASTING))
62 return;
63
64 while (uint32 eventId = events.ExecuteEvent())
65 {
66 switch (eventId)
67 {
70 events.ScheduleEvent(EVENT_ANTIMAGIC_PULSE, std::rand() % 15000 + 10000);
71 break;
74 events.ScheduleEvent(EVENT_MAGMA_SHACKLES, std::rand() % 12000 + 8000);
75 break;
76 default:
77 break;
78 }
79 }
80
82 }
83 };
84
86 {
87 return new boss_garrAI(creature);
88 }
89};
90
92{
93 public:
94 npc_firesworn() : CreatureScript("npc_firesworn") { }
95
97 {
98 npc_fireswornAI(Creature* creature) : ScriptedAI(creature) { }
99
101
103 {
104 immolateTimer = 4000; //These times are probably wrong
105 }
106
107 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
108 {
109 uint32 const health10pct = me->CountPctFromMaxHealth(10);
110 uint32 health = me->GetHealth();
111 if (int32(health) - int32(damage) < int32(health10pct))
112 {
113 damage = 0;
115 me->DespawnOrUnsummon();
116 }
117 }
118
120 {
121 if (!UpdateVictim())
122 return;
123
124 if (immolateTimer <= diff)
125 {
126 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
127 DoCast(target, SPELL_IMMOLATE);
128 immolateTimer = std::rand() % 10000 + 5000;
129 }
130 else
131 immolateTimer -= diff;
132
134 }
135 };
136
138 {
139 return new npc_fireswornAI(creature);
140 }
141};
142
144{
145 new boss_garr();
146 new npc_firesworn();
147}
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ SPELL_ANTIMAGIC_PULSE
Definition boss_garr.cpp:21
@ SPELL_MAGMA_SHACKLES
Definition boss_garr.cpp:22
@ SPELL_IMMOLATE
Definition boss_garr.cpp:27
@ SPELL_ERUPTION
Definition boss_garr.cpp:26
void AddSC_boss_garr()
@ EVENT_MAGMA_SHACKLES
Definition boss_garr.cpp:33
@ EVENT_ANTIMAGIC_PULSE
Definition boss_garr.cpp:32
@ SPELL_IMMOLATE
EventMap events
BossAI(Creature *creature, uint32 bossId)
void EnterCombat(Unit *) OVERRIDE
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition boss_garr.cpp:85
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ BOSS_GARR
Definition molten_core.h:14
Creature * me
ScriptedAI(Creature *creature)
void EnterCombat(Unit *victim) OVERRIDE
Definition boss_garr.cpp:47
boss_garrAI(Creature *creature)
Definition boss_garr.cpp:43
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition boss_garr.cpp:54
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_fireswornAI(Creature *creature)
Definition boss_garr.cpp:98
void DamageTaken(Unit *, uint32 &damage) OVERRIDE