TrinityCore
Loading...
Searching...
No Matches
boss_dalliah_the_doomsayer.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 * Whirlwind gets interrupted in lots of cases
20 * Conversation between creatures requires rechecks and improvements
21 */
22
23#include "ScriptMgr.h"
24#include "arcatraz.h"
25#include "InstanceScript.h"
26#include "ObjectAccessor.h"
27#include "ScriptedCreature.h"
28#include "SpellInfo.h"
29#include "SpellMgr.h"
30#include "SpellScript.h"
31
33{
34 // Dalliah the Doomsayer
41
42 // Wrath-Scryer Soccothrates
45};
46
48{
51 SPELL_HEAL = 36144,
52 SPELL_SHADOW_WAVE = 39016, // Heroic only
53
54 SPELL_DUMMY = 36177
55};
56
67
68// 20885 - Dalliah the Doomsayer
70{
73
74 void Reset() override
75 {
76 _Reset();
77 _soccothratesTaunt = false;
78 _soccothratesDeath = false;
79 }
80
91
92 void SetData(uint32 /*type*/, uint32 data) override
93 {
94 switch (data)
95 {
96 case 1:
98 _soccothratesDeath = true;
99 break;
100 default:
101 break;
102 }
103 }
104
105 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
106 {
107 if (!_soccothratesTaunt && me->HealthBelowPctDamaged(25, damage))
108 {
109 _soccothratesTaunt = true;
110
112 soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT);
113 }
114 }
115
116 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
117 {
118 if (spellInfo->Id == SPELL_DUMMY)
120 }
121
122 void OnSpellCast(SpellInfo const* spell) override
123 {
124 if (spell->Id == SPELL_WHIRLWIND)
125 if (roll_chance_i(30))
127
128 if (spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_HEAL, me))
129 if (roll_chance_i(50))
130 Talk(SAY_HEAL);
131 }
132
133 void KilledUnit(Unit* /*victim*/) override
134 {
135 Talk(SAY_SLAY);
136 }
137
138 void JustDied(Unit* /*killer*/) override
139 {
140 _JustDied();
142
144 if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
145 soccothrates->AI()->SetData(1, 1);
146 }
147
148 void UpdateAI(uint32 diff) override
149 {
150 if (!UpdateVictim())
151 {
153 {
154 events.Update(diff);
155
156 while (uint32 eventId = events.ExecuteEvent())
157 {
158 switch (eventId)
159 {
162 break;
163 default:
164 break;
165 }
166 }
167 }
168
169 return;
170 }
171
172 events.Update(diff);
173
175 return;
176
177 while (uint32 eventId = events.ExecuteEvent())
178 {
179 switch (eventId)
180 {
183 events.Repeat(10s, 20s);
184 break;
185 case EVENT_WHIRLWIND:
187 events.Repeat(15s, 25s);
188 break;
189 case EVENT_HEAL:
191 break;
194 events.Repeat(10s, 15s);
195 break;
196
197 case EVENT_ME_FIRST:
199 if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
200 soccothrates->AI()->Talk(SAY_AGGRO_DALLIAH_FIRST);
201 break;
202 default:
203 break;
204 }
205
207 return;
208 }
209
211 }
212
213private:
216};
217
218// 36142 - Whirlwind
220{
222
223 bool Validate(SpellInfo const* /*spellInfo*/) override
224 {
225 return ValidateSpellInfo({ SPELL_DUMMY });
226 }
227
228 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
229 {
230 // When Whirlwind ends, creature casts Dummy spell. When Dummy spell hits,
231 // creature casts Heal spell and this is how Heal after Whirlwind is handled
233 }
234
239};
240
uint32_t uint32
Definition Define.h:133
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define sSpellMgr
Definition SpellMgr.h:738
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
#define RegisterArcatrazCreatureAI(ai_name)
Definition arcatraz.h:88
@ DATA_SOCCOTHRATES
Definition arcatraz.h:33
@ DATA_DALLIAH
Definition arcatraz.h:32
@ SPELL_GIFT_OF_THE_DOOMSAYER
@ EVENT_GIFT_OF_THE_DOOMSAYER
void AddSC_boss_dalliah_the_doomsayer()
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetTarget() const
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
virtual ObjectGuid GetGuidData(uint32 type) const override
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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 AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_dalliah_the_doomsayer_whirlwind)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
bool IsHeroic() const
void JustEngagedWith(Unit *who) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void OnSpellCast(SpellInfo const *spell) override
void SetData(uint32, uint32 data) override