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#include "ScriptMgr.h"
19#include "scholomance.h"
20#include "ScriptedCreature.h"
21#include "SpellScript.h"
22
37
44
46{
47public:
48 boss_kormok() : CreatureScript("boss_kormok") { }
49
50 struct boss_kormokAI : public ScriptedAI
51 {
52 boss_kormokAI(Creature* creature) : ScriptedAI(creature)
53 {
54 Initialize();
55 }
56
58 {
59 Mages = false;
60 }
61
62 void Reset() override
63 {
64 Initialize();
65 events.Reset();
66 }
67
74
75 void JustSummoned(Creature* summoned) override
76 {
77 summoned->AI()->AttackStart(me->GetVictim());
78 }
79
80 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
81 {
82 if (me->HealthBelowPctDamaged(25, damage) && !Mages)
83 {
85 Mages = true;
86 }
87 }
88
89 void UpdateAI(uint32 diff) override
90 {
91 if (!UpdateVictim())
92 return;
93
94 events.Update(diff);
95
97 return;
98
99 while (uint32 eventId = events.ExecuteEvent())
100 {
101 switch (eventId)
102 {
106 break;
110 break;
114 break;
115 default:
116 break;
117 }
118
120 return;
121 }
122 }
123
124 private:
126 bool Mages;
127 };
128
129 CreatureAI* GetAI(Creature* creature) const override
130 {
131 return GetScholomanceAI<boss_kormokAI>(creature);
132 }
133};
134
142
143// 27695 - Summon Bone Mages
145{
146 public:
147 spell_kormok_summon_bone_mages() : SpellScriptLoader("spell_kormok_summon_bone_mages") { }
148
150 {
151 bool Validate(SpellInfo const* /*spell*/) override
152 {
154 }
155
157 {
158 PreventHitDefaultEffect(effIndex);
159 for (uint32 i = 0; i < 2; ++i)
161 }
162
167 };
168
169 SpellScript* GetSpellScript() const override
170 {
172 }
173};
174
175// 27687 - Summon Bone Minions
177{
178 public:
179 spell_kormok_summon_bone_minions() : SpellScriptLoader("spell_kormok_summon_bone_minions") { }
180
182 {
183 bool Validate(SpellInfo const* /*spell*/) override
184 {
186 }
187
189 {
190 PreventHitDefaultEffect(effIndex);
191
192 // Possible spells to handle this not found.
193 for (uint32 i = 0; i < 4; ++i)
194 GetCaster()->SummonCreature(NPC_BONE_MINION, GetCaster()->GetPositionX() + float(irand(-7, 7)), GetCaster()->GetPositionY() + float(irand(-7, 7)), GetCaster()->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 2min);
195 }
196
201 };
202
203 SpellScript* GetSpellScript() const override
204 {
206 }
207};
208
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Spells
Definition PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ SPELL_SUMMON_BONE_MAGES
@ SPELL_BONE_SHIELD
@ SPELL_SUMMON_BONE_MAGE_BACK_LEFT
@ SPELL_SUMMON_BONE_MINIONS
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_SUMMON_BONE_MAGE_FRONT_LEFT
@ SPELL_SUMMON_BONE_MAGE_BACK_RIGHT
@ SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT
void AddSC_boss_kormok()
@ EVENT_SUMMON_MINIONS
@ EVENT_SHADOWBOLT_VOLLEY
@ EVENT_BONE_SHIELD
uint32 const SummonMageSpells[4]
bool UpdateVictim()
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
void PreventHitDefaultEffect(SpellEffIndex effIndex)
HookList< EffectHandler > OnEffectHitTarget
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
Unit * GetVictim() const
Definition Unit.h:726
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
@ NPC_BONE_MINION
Definition scholomance.h:50
void JustSummoned(Creature *summoned) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_kormokAI(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override