Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_razorgore.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#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "SpellScript.h"
9#include "blackwing_lair.h"
10#include "Player.h"
11
19
31
33{
36 NPC_WARRIOR = 12416,
37 NPC_MAGE = 12420,
38 NPC_WARLOCK = 12459,
39
40 GO_EGG = 177807
41};
42
50
52{
53public:
54 boss_razorgore() : CreatureScript("boss_razorgore") { }
55
56 struct boss_razorgoreAI : public BossAI
57 {
58 boss_razorgoreAI(Creature* creature) : BossAI(creature, BOSS_RAZORGORE) { }
59
61 {
62 _Reset();
63
64 secondPhase = false;
65 if (instance)
67 }
68
69 void JustDied(Unit* /*killer*/) OVERRIDE
70 {
71 _JustDied();
73
74 if (instance)
76 }
77
79 {
80 events.ScheduleEvent(EVENT_CLEAVE, 15000);
81 events.ScheduleEvent(EVENT_STOMP, 35000);
82 events.ScheduleEvent(EVENT_FIREBALL, 7000);
83 events.ScheduleEvent(EVENT_CONFLAGRATION, 12000);
84
85 secondPhase = true;
86 me->RemoveAllAuras();
87 me->SetHealth(me->GetMaxHealth());
88 }
89
90 void DoAction(int32 action) OVERRIDE
91 {
92 if (action == ACTION_PHASE_TWO)
94 }
95
96 void DamageTaken(Unit* /*who*/, uint32& damage) OVERRIDE
97 {
98 if (!secondPhase)
99 damage = 0;
100 }
101
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
109 if (me->HasUnitState(UNIT_STATE_CASTING))
110 return;
111
112 while (uint32 eventId = events.ExecuteEvent())
113 {
114 switch (eventId)
115 {
116 case EVENT_CLEAVE:
118 events.ScheduleEvent(EVENT_CLEAVE, std::rand() % 10000 + 7000);
119 break;
120 case EVENT_STOMP:
122 events.ScheduleEvent(EVENT_STOMP, std::rand() % 25000 + 15000);
123 break;
124 case EVENT_FIREBALL:
126 events.ScheduleEvent(EVENT_FIREBALL, std::rand() % 15000 + 12000);
127 break;
130 if (me->GetVictim() && me->GetVictim()->HasAura(SPELL_CONFLAGRATION))
131 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
132 me->TauntApply(target);
133 events.ScheduleEvent(EVENT_CONFLAGRATION, 30000);
134 break;
135 }
136 }
138 }
139
140 private:
142 };
143
145 {
146 return new boss_razorgoreAI(creature);
147 }
148};
149
151{
152public:
153 go_orb_of_domination() : GameObjectScript("go_orb_of_domination") { }
154
156 {
157 if (InstanceScript* instance = go->GetInstanceScript())
158 if (instance->GetData(DATA_EGG_EVENT) != DONE)
159 if (Creature* razor = Unit::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED)))
160 {
161 razor->Attack(player, true);
162 player->CastSpell(razor, SPELL_MINDCONTROL);
163 }
164 return true;
165 }
166};
167
169{
170 public:
171 spell_egg_event() : SpellScriptLoader("spell_egg_event") { }
172
174 {
176
178 {
179 if (InstanceScript* instance = GetCaster()->GetInstanceScript())
180 instance->SetData(DATA_EGG_EVENT, SPECIAL);
181 }
182
187 };
188
190 {
191 return new spell_egg_eventSpellScript();
192 }
193};
194
196{
197 new boss_razorgore();
199 new spell_egg_event();
200}
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ DONE
@ SPECIAL
@ NOT_STARTED
#define SpellHitFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_CLEAVE
@ EVENT_CLEAVE
@ SPELL_FIREBALLVOLLEY
@ DATA_EGG_EVENT
@ ACTION_PHASE_TWO
@ DATA_RAZORGORE_THE_UNTAMED
@ BOSS_RAZORGORE
#define SAY_DEATH
@ SPELL_WARSTOMP
@ 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
BossAI(Creature *creature, uint32 bossId)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
GameObjectScript(const char *name)
HookList< HitHandler > OnHit
Unit * GetCaster()
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
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
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, GameObject *go) OVERRIDE
PrepareSpellScript(spell_egg_eventSpellScript)
SpellScript * GetSpellScript() const OVERRIDE
Creature * me
void DoAction(int32 action) OVERRIDE
void DamageTaken(Unit *, uint32 &damage) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================