TrinityCore
Loading...
Searching...
No Matches
boss_drakos.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 "InstanceScript.h"
19#include "ScriptedCreature.h"
20#include "ScriptMgr.h"
21#include "SpellScript.h"
22#include "SpellInfo.h"
23#include "SpellMgr.h"
24#include "oculus.h"
25
35
44
51
52enum Misc
53{
55};
56
57struct boss_drakos : public BossAI
58{
59 boss_drakos(Creature* creature) : BossAI(creature, DATA_DRAKOS) { }
60
70
71 void OnSpellStart(SpellInfo const* spell) override
72 {
73 if (spell->Id == SPELL_MAGIC_PULL)
74 {
77 }
78 }
79
80 void OnSpellCast(SpellInfo const* spell) override
81 {
82 if (spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_THUNDERING_STOMP, me))
83 if (roll_chance_i(50))
85 }
86
87 void KilledUnit(Unit* /*victim*/) override
88 {
90 }
91
92 void JustDied(Unit* /*killer*/) override
93 {
94 _JustDied();
96
97 // start achievement timer (kill Eregos within 20 min)
99 }
100
101 void UpdateAI(uint32 diff) override
102 {
103 if (!UpdateVictim())
104 return;
105
106 events.Update(diff);
107
109 return;
110
111 while (uint32 eventId = events.ExecuteEvent())
112 {
113 switch (eventId)
114 {
117 events.Repeat(2s);
118 break;
119 case EVENT_MAGIC_PULL:
121 events.Repeat(6s, 14s);
122 break;
123 case EVENT_STOMP:
125 events.Repeat(10s, 20s);
126 break;
127 default:
128 break;
129 }
130
132 return;
133 }
134
136 }
137};
138
139// 51336 - Magic Pull
141{
143
144 bool Validate(SpellInfo const* /*spellInfo*/) override
145 {
147 }
148
149 void HandleDummy(SpellEffIndex /*effIndex*/)
150 {
152 }
153
155 {
156 Unit* caster = GetCaster();
157 for (uint8 i = 0; i < 5; i++)
158 caster->CastSpell(caster, SPELL_SUMMON_UNSTABLE_SPHERE, true);
159 }
160
166};
167
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:122
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
#define sSpellMgr
Definition SpellMgr.h:738
#define SpellEffectFn(F, I, N)
#define SpellCastFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ ACHIEV_TIMED_START_EVENT
@ SPELL_THUNDERING_STOMP
@ SPELL_SUMMON_UNSTABLE_SPHERE
@ SPELL_MAGIC_PULL_EFFECT
@ SPELL_MAGIC_PULL
void AddSC_boss_drakos()
@ SAY_DEATH
@ SAY_AGGRO
@ EMOTE_PULL
@ SAY_KILL
@ SAY_STOMP
@ SAY_PULL
@ EVENT_MAGIC_PULL
@ EVENT_BOMB_SUMMON
@ EVENT_STOMP
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
uint32 Id
Definition SpellInfo.h:289
HookList< CastHandler > AfterCast
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_drakos_magic_pull)
void Register() override
@ DATA_DRAKOS
Definition oculus.h:31
#define RegisterOculusCreatureAI(ai_name)
Definition oculus.h:116
boss_drakos(Creature *creature)
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void OnSpellStart(SpellInfo const *spell) override
void OnSpellCast(SpellInfo const *spell) override
void KilledUnit(Unit *) override