TrinityCore
Loading...
Searching...
No Matches
boss_kormok.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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "scholomance.h"
24#include "ScriptedCreature.h"
25#include "SpellInfo.h"
26#include "SpellScript.h"
27
35
57
73
74// 16118 - Kormok
75struct boss_kormok : public ScriptedAI
76{
77 boss_kormok(Creature* creature) : ScriptedAI(creature), _frenzied(false) { }
78
79 void JustAppeared() override
80 {
82 }
83
84 void Reset() override
85 {
86 _events.Reset();
87 _frenzied = false;
88 }
89
100
101 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
102 {
103 if (!_frenzied && me->HealthBelowPctDamaged(20, damage))
104 {
105 _frenzied = true;
107 }
108 }
109
110 void OnSpellCast(SpellInfo const* spell) override
111 {
112 if (spell->Id == SPELL_FRENZY)
114 }
115
116 void JustDied(Unit* /*killer*/) override
117 {
119 }
120
121 void UpdateAI(uint32 diff) override
122 {
123 if (!UpdateVictim())
124 {
125 _events.Update(diff);
126
127 while (uint32 eventId = _events.ExecuteEvent())
128 {
129 switch (eventId)
130 {
131 case EVENT_INTRO_1:
132 me->SetImmuneToPC(true);
134 break;
135 case EVENT_INTRO_2:
138 break;
139 case EVENT_INTRO_3:
140 me->SetImmuneToPC(false);
141 break;
142 default:
143 break;
144 }
145 }
146 return;
147 }
148
149 _events.Update(diff);
150
152 return;
153
154 while (uint32 eventId = _events.ExecuteEvent())
155 {
156 switch (eventId)
157 {
160 _events.Repeat(15s, 20s);
161 break;
164 _events.Repeat(45s);
165 break;
166 case EVENT_BLOODLUST:
168 _events.Repeat(30s, 40s);
169 break;
172 _events.Repeat(10s, 15s);
173 break;
176 _events.Repeat(20s, 25s);
177 break;
178 case EVENT_FRENZY:
180 break;
181 default:
182 break;
183 }
184
186 return;
187 }
188
190 }
191
192private:
195};
196
197// 27695 - Summon Bone Mages
199{
201
212
213 void HandleScript(SpellEffIndex /*effIndex*/)
214 {
215 Unit* caster = GetCaster();
216 switch (urand(0, 1))
217 {
218 case 0:
221 break;
222 case 1:
225 break;
226 }
227 }
228
233};
234
235// 27687 - Summon Bone Minions
265
uint32_t uint32
Definition Define.h:133
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
KormokTexts
@ SAY_DEATH
@ SAY_AGGRO
@ EMOTE_FRENZY
@ SAY_SPAWN
KormokSpells
@ SPELL_SHADOW_BOLT_VOLLEY
@ SPELL_BLOODLUST
@ SPELL_SUMMON_BONE_MAGES
@ SPELL_BONE_SHIELD
@ SPELL_SUMMON_BONE_MAGE_BACK_LEFT
@ SPELL_SUMMON_BONE_MINIONS
@ SPELL_SUMMON_BONE_MINION_LEFT
@ SPELL_SUMMON_BONE_MAGE_FRONT_LEFT
@ SPELL_SUMMON_BONE_MAGE_BACK_RIGHT
@ SPELL_FRENZY
@ SPELL_SUMMON_BONE_MINION_RIGHT
@ SPELL_SUMMON_BONE_MINION_FRONT
@ SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT
@ SPELL_SUMMON_BONE_MINION_BACK
void AddSC_boss_kormok()
KormokEvents
@ EVENT_SUMMON_MINIONS
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_SUMMON_MAGES
@ EVENT_SHADOWBOLT_VOLLEY
@ EVENT_BONE_SHIELD
@ EVENT_FRENZY
@ EVENT_INTRO_3
@ EVENT_BLOODLUST
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
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 Reset()
Definition EventMap.cpp:21
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
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
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void HandleScript(SpellEffIndex)
PrepareSpellScript(spell_kormok_summon_bone_mages)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_kormok_summon_bone_minions)
bool Validate(SpellInfo const *) override
#define RegisterScholomanceCreatureAI(ai_name)
Definition scholomance.h:65
void JustDied(Unit *) override
boss_kormok(Creature *creature)
void Reset() override
void JustEngagedWith(Unit *) override
void JustAppeared() override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void OnSpellCast(SpellInfo const *spell) override
void UpdateAI(uint32 diff) override
EventMap _events