Skip to content

Commit 2bdc0d6

Browse files
authored
Scripts/Arcatraz: Update Dalliah & Soccothrates (TrinityCore#31124)
* update timers, update combat AI, codestyle changes, reorder AI hooks
1 parent 3744d6b commit 2bdc0d6

File tree

3 files changed

+193
-124
lines changed

3 files changed

+193
-124
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--
2+
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_dalliah_the_doomsayer_whirlwind';
3+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
4+
(36142, 'spell_dalliah_the_doomsayer_whirlwind');

src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp

Lines changed: 107 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/*
19+
* Whirlwind gets interrupted in lots of cases
20+
* Conversation between creatures requires rechecks and improvements
21+
*/
22+
1823
#include "ScriptMgr.h"
1924
#include "arcatraz.h"
2025
#include "InstanceScript.h"
2126
#include "ObjectAccessor.h"
2227
#include "ScriptedCreature.h"
28+
#include "SpellInfo.h"
29+
#include "SpellMgr.h"
30+
#include "SpellScript.h"
2331

24-
enum Say
32+
enum DalliahTexts
2533
{
2634
// Dalliah the Doomsayer
2735
SAY_AGGRO = 1,
@@ -36,83 +44,112 @@ enum Say
3644
SAY_DALLIAH_25_PERCENT = 5
3745
};
3846

39-
enum Spells
47+
enum DalliahSpells
4048
{
4149
SPELL_GIFT_OF_THE_DOOMSAYER = 36173,
4250
SPELL_WHIRLWIND = 36142,
4351
SPELL_HEAL = 36144,
44-
SPELL_SHADOW_WAVE = 39016 // Heroic only
52+
SPELL_SHADOW_WAVE = 39016, // Heroic only
53+
54+
SPELL_DUMMY = 36177
4555
};
4656

47-
enum Events
57+
enum DalliahEvents
4858
{
4959
EVENT_GIFT_OF_THE_DOOMSAYER = 1,
50-
EVENT_WHIRLWIND = 2,
51-
EVENT_HEAL = 3,
52-
EVENT_SHADOW_WAVE = 4, // Heroic only
53-
EVENT_ME_FIRST = 5,
54-
EVENT_SOCCOTHRATES_DEATH = 6
60+
EVENT_WHIRLWIND,
61+
EVENT_HEAL,
62+
EVENT_SHADOW_WAVE,
63+
64+
EVENT_ME_FIRST,
65+
EVENT_SOCCOTHRATES_DEATH
5566
};
5667

68+
// 20885 - Dalliah the Doomsayer
5769
struct boss_dalliah_the_doomsayer : public BossAI
5870
{
59-
boss_dalliah_the_doomsayer(Creature* creature) : BossAI(creature, DATA_DALLIAH)
60-
{
61-
soccothratesTaunt = false;
62-
soccothratesDeath = false;
63-
}
71+
boss_dalliah_the_doomsayer(Creature* creature) : BossAI(creature, DATA_DALLIAH),
72+
_soccothratesTaunt(false), _soccothratesDeath(false) { }
6473

6574
void Reset() override
6675
{
6776
_Reset();
68-
soccothratesTaunt = false;
69-
soccothratesDeath = false;
70-
}
71-
72-
void JustDied(Unit* /*killer*/) override
73-
{
74-
_JustDied();
75-
Talk(SAY_DEATH);
76-
77-
if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
78-
if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
79-
soccothrates->AI()->SetData(1, 1);
77+
_soccothratesTaunt = false;
78+
_soccothratesDeath = false;
8079
}
8180

8281
void JustEngagedWith(Unit* who) override
8382
{
8483
BossAI::JustEngagedWith(who);
85-
events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, 1s, 4s);
86-
events.ScheduleEvent(EVENT_WHIRLWIND, 7s, 9s);
84+
events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, 0s, 10s);
85+
events.ScheduleEvent(EVENT_WHIRLWIND, 5s, 10s);
8786
if (IsHeroic())
88-
events.ScheduleEvent(EVENT_SHADOW_WAVE, 11s, 16s);
87+
events.ScheduleEvent(EVENT_SHADOW_WAVE, 10s, 15s);
8988
events.ScheduleEvent(EVENT_ME_FIRST, 6s);
9089
Talk(SAY_AGGRO);
9190
}
9291

93-
void KilledUnit(Unit* /*victim*/) override
94-
{
95-
Talk(SAY_SLAY);
96-
}
97-
9892
void SetData(uint32 /*type*/, uint32 data) override
9993
{
10094
switch (data)
10195
{
10296
case 1:
10397
events.ScheduleEvent(EVENT_SOCCOTHRATES_DEATH, 6s);
104-
soccothratesDeath = true;
98+
_soccothratesDeath = true;
10599
break;
106100
default:
107101
break;
108102
}
109103
}
110104

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+
111+
if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
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)
119+
events.ScheduleEvent(EVENT_HEAL, 0s);
120+
}
121+
122+
void OnSpellCast(SpellInfo const* spell) override
123+
{
124+
if (spell->Id == SPELL_WHIRLWIND)
125+
if (roll_chance_i(30))
126+
Talk(SAY_WHIRLWIND);
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();
141+
Talk(SAY_DEATH);
142+
143+
if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
144+
if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
145+
soccothrates->AI()->SetData(1, 1);
146+
}
147+
111148
void UpdateAI(uint32 diff) override
112149
{
113150
if (!UpdateVictim())
114151
{
115-
if (soccothratesDeath)
152+
if (_soccothratesDeath)
116153
{
117154
events.Update(diff);
118155

@@ -142,23 +179,21 @@ struct boss_dalliah_the_doomsayer : public BossAI
142179
switch (eventId)
143180
{
144181
case EVENT_GIFT_OF_THE_DOOMSAYER:
145-
DoCastVictim(SPELL_GIFT_OF_THE_DOOMSAYER, true);
146-
events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, 16s, 21s);
182+
DoCastVictim(SPELL_GIFT_OF_THE_DOOMSAYER);
183+
events.Repeat(10s, 20s);
147184
break;
148185
case EVENT_WHIRLWIND:
149-
DoCast(me, SPELL_WHIRLWIND);
150-
Talk(SAY_WHIRLWIND);
151-
events.ScheduleEvent(EVENT_WHIRLWIND, 19s, 21s);
152-
events.ScheduleEvent(EVENT_HEAL, 6s);
186+
DoCastSelf(SPELL_WHIRLWIND);
187+
events.Repeat(15s, 25s);
153188
break;
154189
case EVENT_HEAL:
155-
DoCast(me, SPELL_HEAL);
156-
Talk(SAY_HEAL);
190+
DoCastSelf(SPELL_HEAL);
157191
break;
158192
case EVENT_SHADOW_WAVE:
159-
DoCastVictim(SPELL_SHADOW_WAVE, true);
160-
events.ScheduleEvent(EVENT_SHADOW_WAVE, 11s, 16s);
193+
DoCastVictim(SPELL_SHADOW_WAVE);
194+
events.Repeat(10s, 15s);
161195
break;
196+
162197
case EVENT_ME_FIRST:
163198
if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
164199
if (soccothrates->IsAlive() && !soccothrates->IsInCombat())
@@ -172,22 +207,39 @@ struct boss_dalliah_the_doomsayer : public BossAI
172207
return;
173208
}
174209

175-
if (HealthBelowPct(25) && !soccothratesTaunt)
176-
{
177-
if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SOCCOTHRATES)))
178-
soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT);
179-
soccothratesTaunt = true;
180-
}
181-
182210
DoMeleeAttackIfReady();
183211
}
184212

185213
private:
186-
bool soccothratesTaunt;
187-
bool soccothratesDeath;
214+
bool _soccothratesTaunt;
215+
bool _soccothratesDeath;
216+
};
217+
218+
// 36142 - Whirlwind
219+
class spell_dalliah_the_doomsayer_whirlwind : public AuraScript
220+
{
221+
PrepareAuraScript(spell_dalliah_the_doomsayer_whirlwind);
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
232+
GetTarget()->CastSpell(GetTarget(), SPELL_DUMMY, true);
233+
}
234+
235+
void Register() override
236+
{
237+
AfterEffectRemove += AuraEffectRemoveFn(spell_dalliah_the_doomsayer_whirlwind::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
238+
}
188239
};
189240

190241
void AddSC_boss_dalliah_the_doomsayer()
191242
{
192243
RegisterArcatrazCreatureAI(boss_dalliah_the_doomsayer);
244+
RegisterSpellScript(spell_dalliah_the_doomsayer_whirlwind);
193245
}

0 commit comments

Comments
 (0)