Skip to content

Commit e8debb4

Browse files
committed
Scripts/Zul'Aman: Update Nalorakk
1 parent 4ccebff commit e8debb4

3 files changed

Lines changed: 77 additions & 49 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--
2+
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_nalorakk_shape';
3+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
4+
(42377, 'spell_nalorakk_shape');
5+
6+
DELETE FROM `creature_text` WHERE `CreatureID` = 23576 AND `GroupID` > 11;
7+
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
8+
(23576,12,0,"What could be better than servin' da bear spirit for eternity? Come closer now. Bring your souls to me!",14,0,100,0,0,12078,23305,1,"Nalorakk - SAY_EVENT_1"),
9+
(23576,12,1,"I smell you, strangers. Don't be delayin' your fate. Come to me now. I make your sacrifice quick.",14,0,100,0,0,12079,23306,1,"Nalorakk - SAY_EVENT_2"),
10+
(23576,13,0,"%s transforms into a bear!",41,0,100,0,0,0,24263,0,"Nalorakk - EMOTE_TRANSFORM");

src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717

1818
/*
1919
* Creatures in waves should load waypoints, not engage immediately
20-
* Surge implementation requires additional research
2120
* Combat timers requires to be revisited
21+
* SAY_EVENT is NYI
2222
*/
2323

2424
#include "ScriptMgr.h"
2525
#include "Containers.h"
2626
#include "Map.h"
2727
#include "MotionMaster.h"
2828
#include "ScriptedCreature.h"
29+
#include "SpellAuraEffects.h"
2930
#include "SpellInfo.h"
3031
#include "SpellScript.h"
3132
#include "zulaman.h"
@@ -44,9 +45,8 @@ enum NalorakkTexts
4445
SAY_BERSERK = 9,
4546
SAY_SLAY = 10,
4647
SAY_DEATH = 11,
47-
SAY_EVENT_1 = 12, // NYI
48-
SAY_EVENT_2 = 13, // NYI
49-
EMOTE_TRANSFORM = 14
48+
SAY_EVENT = 12,
49+
EMOTE_TRANSFORM = 13
5050
};
5151

5252
enum NalorakkSpells
@@ -93,6 +93,12 @@ enum NalorakkEvents
9393
EVENT_BERSERK
9494
};
9595

96+
enum NalorakkActions
97+
{
98+
ACTION_SHAPE_APPLIED = 0,
99+
ACTION_SHAPE_REMOVED = 1
100+
};
101+
96102
enum NalorakkSpawnGroups
97103
{
98104
SPAWN_GROUP_NALORAKK_WAVE_1 = 329,
@@ -128,13 +134,12 @@ static constexpr std::array<std::string_view, 4> NalorakkWave =
128134
struct boss_nalorakk : public BossAI
129135
{
130136
boss_nalorakk(Creature* creature) : BossAI(creature, BOSS_NALORAKK),
131-
_waveEventInProgress(true), _isMovingToLocation(false), _isWaiting(false), _isInBearForm(false), _currentWaveCount(0) { }
137+
_waveEventInProgress(true), _isMovingToLocation(false), _isWaiting(false), _currentWaveCount(0) { }
132138

133139
void Reset() override
134140
{
135141
_Reset();
136142
SetEquipmentSlots(true);
137-
_isInBearForm = false;
138143

139144
if (_waveEventInProgress)
140145
{
@@ -160,11 +165,6 @@ struct boss_nalorakk : public BossAI
160165
{
161166
switch (spellInfo->Id)
162167
{
163-
case SPELL_SHAPE_OF_THE_BEAR:
164-
Talk(SAY_TO_BEAR);
165-
Talk(EMOTE_TRANSFORM);
166-
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
167-
break;
168168
case SPELL_SURGE:
169169
Talk(SAY_SURGE);
170170
break;
@@ -237,6 +237,27 @@ struct boss_nalorakk : public BossAI
237237
{
238238
switch (action)
239239
{
240+
case ACTION_SHAPE_APPLIED:
241+
Talk(SAY_TO_BEAR);
242+
Talk(EMOTE_TRANSFORM);
243+
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
244+
events.CancelEvent(EVENT_BRUTAL_SWIPE);
245+
events.CancelEvent(EVENT_MANGLE);
246+
events.CancelEvent(EVENT_SURGE);
247+
events.ScheduleEvent(EVENT_LACERATING_SLASH, 5s, 10s);
248+
events.ScheduleEvent(EVENT_REND_FLESH, 10s, 20s);
249+
events.ScheduleEvent(EVENT_DEAFENING_ROAR, 15s, 20s);
250+
break;
251+
case ACTION_SHAPE_REMOVED:
252+
Talk(SAY_TO_TROLL);
253+
SetEquipmentSlots(true);
254+
events.CancelEvent(EVENT_LACERATING_SLASH);
255+
events.CancelEvent(EVENT_REND_FLESH);
256+
events.CancelEvent(EVENT_DEAFENING_ROAR);
257+
events.ScheduleEvent(EVENT_BRUTAL_SWIPE, 10s, 20s);
258+
events.ScheduleEvent(EVENT_MANGLE, 5s, 15s);
259+
events.ScheduleEvent(EVENT_SURGE, 20s, 25s);
260+
break;
240261
case ACTION_WAVE_DONE_1:
241262
Talk(SAY_WAVE_DONE);
242263
_isMovingToLocation = true;
@@ -353,34 +374,9 @@ struct boss_nalorakk : public BossAI
353374
break;
354375

355376
case EVENT_SHAPESHIFT:
356-
{
357-
if (_isInBearForm)
358-
{
359-
Talk(SAY_TO_TROLL);
360-
SetEquipmentSlots(true);
361-
events.CancelEvent(EVENT_LACERATING_SLASH);
362-
events.CancelEvent(EVENT_REND_FLESH);
363-
events.CancelEvent(EVENT_DEAFENING_ROAR);
364-
events.ScheduleEvent(EVENT_BRUTAL_SWIPE, 10s, 20s);
365-
events.ScheduleEvent(EVENT_MANGLE, 5s, 15s);
366-
events.ScheduleEvent(EVENT_SURGE, 20s, 25s);
367-
events.Repeat(45s);
368-
_isInBearForm = false;
369-
}
370-
else
371-
{
372-
DoCastSelf(SPELL_SHAPE_OF_THE_BEAR);
373-
events.CancelEvent(EVENT_BRUTAL_SWIPE);
374-
events.CancelEvent(EVENT_MANGLE);
375-
events.CancelEvent(EVENT_SURGE);
376-
events.ScheduleEvent(EVENT_LACERATING_SLASH, 5s, 10s);
377-
events.ScheduleEvent(EVENT_REND_FLESH, 10s, 20s);
378-
events.ScheduleEvent(EVENT_DEAFENING_ROAR, 15s, 20s);
379-
events.Repeat(30s);
380-
_isInBearForm = true;
381-
}
377+
DoCastSelf(SPELL_SHAPE_OF_THE_BEAR);
378+
events.Repeat(75s);
382379
break;
383-
}
384380

385381
case EVENT_BERSERK:
386382
DoCastSelf(SPELL_BERSERK);
@@ -400,7 +396,6 @@ struct boss_nalorakk : public BossAI
400396
bool _waveEventInProgress;
401397
bool _isMovingToLocation;
402398
bool _isWaiting;
403-
bool _isInBearForm;
404399
uint32 _currentWaveCount;
405400
};
406401

@@ -416,12 +411,7 @@ class spell_nalorakk_surge : public SpellScript
416411

417412
void FilterTargets(std::list<WorldObject*>& targets)
418413
{
419-
if (targets.empty())
420-
return;
421-
422-
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
423-
targets.clear();
424-
targets.push_back(target);
414+
Trinity::Containers::RandomResize(targets, 1);
425415
}
426416

427417
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -440,8 +430,36 @@ class spell_nalorakk_surge : public SpellScript
440430
}
441431
};
442432

433+
// 42377 - Shape of the Bear
434+
class spell_nalorakk_shape : public AuraScript
435+
{
436+
PrepareAuraScript(spell_nalorakk_shape);
437+
438+
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
439+
{
440+
if (Creature* target = GetTarget()->ToCreature())
441+
target->AI()->DoAction(ACTION_SHAPE_APPLIED);
442+
}
443+
444+
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
445+
{
446+
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
447+
return;
448+
449+
if (Creature* target = GetTarget()->ToCreature())
450+
target->AI()->DoAction(ACTION_SHAPE_REMOVED);
451+
}
452+
453+
void Register() override
454+
{
455+
AfterEffectApply += AuraEffectApplyFn(spell_nalorakk_shape::AfterApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
456+
AfterEffectRemove += AuraEffectRemoveFn(spell_nalorakk_shape::AfterRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
457+
}
458+
};
459+
443460
void AddSC_boss_nalorakk()
444461
{
445462
RegisterZulAmanCreatureAI(boss_nalorakk);
446463
RegisterSpellScript(spell_nalorakk_surge);
464+
RegisterSpellScript(spell_nalorakk_shape);
447465
}

src/server/scripts/EasternKingdoms/ZulAman/zulaman.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ enum ZAGameObjectIds
7979

8080
enum ZAActionIds
8181
{
82-
ACTION_WAVE_DONE_1 = 0,
83-
ACTION_WAVE_DONE_2 = 1,
84-
ACTION_WAVE_DONE_3 = 2,
85-
ACTION_WAVE_DONE_4 = 3
82+
ACTION_WAVE_DONE_1 = 2357600,
83+
ACTION_WAVE_DONE_2 = 2357601,
84+
ACTION_WAVE_DONE_3 = 2357602,
85+
ACTION_WAVE_DONE_4 = 2357603
8686
};
8787

8888
template <class AI, class T>

0 commit comments

Comments
 (0)