TrinityCore
boss_razorgore.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "blackwing_lair.h"
20#include "GameObject.h"
21#include "GameObjectAI.h"
22#include "InstanceScript.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25#include "SpellScript.h"
26
27enum Say
28{
33};
34
36{
37 // @todo orb uses the wrong spell, this needs sniffs
41
42 SPELL_CLEAVE = 22540,
46};
47
49{
52 NPC_WARRIOR = 12416,
53 NPC_MAGE = 12420,
54 NPC_WARLOCK = 12459,
55
56 GO_EGG = 177807
57};
58
60{
65};
66
67struct boss_razorgore : public BossAI
68{
70 {
71 Initialize();
72 }
73
75 {
76 secondPhase = false;
77 }
78
79 void Reset() override
80 {
81 _Reset();
82
83 Initialize();
85 }
86
87 void JustDied(Unit* /*killer*/) override
88 {
89 _JustDied();
91
93 }
94
96 {
101
102 secondPhase = true;
104 me->SetFullHealth();
105 }
106
107 void DoAction(int32 action) override
108 {
109 if (action == ACTION_PHASE_TWO)
111 }
112
113 void DamageTaken(Unit* /*who*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
114 {
115 // @todo this is wrong - razorgore should still take damage, he should just nuke the whole room and respawn if he dies during P1
116 if (!secondPhase)
117 damage = 0;
118 }
119
120 void UpdateAI(uint32 diff) override
121 {
122 if (!UpdateVictim())
123 return;
124
125 events.Update(diff);
126
128 return;
129
130 while (uint32 eventId = events.ExecuteEvent())
131 {
132 switch (eventId)
133 {
134 case EVENT_CLEAVE:
137 break;
138 case EVENT_STOMP:
141 break;
142 case EVENT_FIREBALL:
145 break;
149 break;
150 }
151
153 return;
154 }
155 }
156
157private:
159};
160
162{
163 go_orb_of_domination(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
164
166
167 bool OnGossipHello(Player* player) override
168 {
170 {
172 {
173 razorgore->Attack(player, true);
174 player->CastSpell(razorgore, SPELL_MINDCONTROL);
175 }
176 }
177 return true;
178 }
179};
180
181// 19873 - Destroy Egg
183{
185 {
186 if (InstanceScript* instance = GetCaster()->GetInstanceScript())
187 instance->SetData(DATA_EGG_EVENT, SPECIAL);
188 }
189
190 void Register() override
191 {
193 }
194};
195
197{
201}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ DONE
@ SPECIAL
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
#define SpellHitFn(F)
Definition: SpellScript.h:854
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ DATA_EGG_EVENT
@ ACTION_PHASE_TWO
#define RegisterBlackwingLairCreatureAI(ai_name)
#define RegisterBlackwingLairGameObjectAI(ai_name)
@ DATA_RAZORGORE_THE_UNTAMED
EVENTS
@ EVENT_FIREBALL
@ EVENT_CONFLAGRATION
@ EVENT_STOMP
@ EVENT_CLEAVE
@ SPELL_CLEAVE
@ SPELL_CONFLAGRATION
@ SPELL_MINDCONTROL
@ SPELL_CHANNEL
@ SPELL_FIREBALLVOLLEY
@ SPELL_WARSTOMP
@ SPELL_EGG_DESTROY
@ SAY_DEATH
@ SAY_EGGS_BROKEN1
@ SAY_EGGS_BROKEN3
@ SAY_EGGS_BROKEN2
@ GO_EGG
@ NPC_MAGE
@ NPC_WARLOCK
@ NPC_WARRIOR
@ NPC_ELITE_WARRIOR
@ NPC_ELITE_DRACHKIN
void AddSC_boss_razorgore()
InstanceScript *const instance
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
Creature * GetCreature(uint32 type)
Unit * GetCaster() const
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
void SetFullHealth()
Definition: Unit.h:790
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAllAuras()
Definition: Unit.cpp:4242
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
void Register() override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void Reset() override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void DoAction(int32 action) override
boss_razorgore(Creature *creature)
InstanceScript * instance
bool OnGossipHello(Player *player) override
go_orb_of_domination(GameObject *go)