Core/Scripts: Archmage Arugal event script (#17922)

Implement boss script for Archmage Arugal
- add yells used in boss event to DB
- use proper spells instead of only melee fighting
- add DataType in shadowfang_keep.h
- add event scheduling in the script

By Riztazz
Closes issue #17916

(cherry picked from commit 2b26894eb1)
This commit is contained in:
tkrokli
2016-11-03 06:50:03 +01:00
committed by joschiwald
parent eee5a4f248
commit b74eba72f6
3 changed files with 132 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
-- Archmage Arugal, NPC entry 4275
SET @Arugal := 4275;
UPDATE `creature_template` SET `ScriptName` = 'boss_archmage_arugal' WHERE `entry`= @Arugal;
UPDATE `creature_text` SET `comment`= 'Archmage Arugal - Fenrus the Devourer dies' WHERE `CreatureID`= @Arugal AND `GroupID`= 0;
DELETE FROM `creature_text` WHERE `CreatureID` = @Arugal AND `GroupID` IN (1,2,3);
INSERT INTO `creature_text` (`CreatureID`,`GroupID`,`ID`,`Text`,`Type`,`Language`,`Probability`,`Emote`,`Duration`,`Sound`,`BroadcastTextId`,`TextRange`, `comment`) VALUES
(@Arugal,1,0,'You, too, shall serve!', 14,0,100,0,0,0,6115,0,'Archmage Arugal - Aggro'),
(@Arugal,2,0,'Release your rage!', 14,0,100,0,0,0,6535,0,'Archmage Arugal - Transforms player into a Worgen'),
(@Arugal,3,0,'Another falls!', 14,0,100,0,0,0,6116,0,'Archmage Arugal - Killing a player');

View File

@@ -54,7 +54,6 @@ enum Yells
enum Spells
{
SPELL_UNLOCK = 6421,
SPELL_DARK_OFFERING = 7154
};
@@ -205,6 +204,123 @@ public:
};
enum ArugalSpells
{
SPELL_TELE_UPPER = 7587,
SPELL_TELE_SPAWN = 7586,
SPELL_TELE_STAIRS = 7136,
NUM_TELEPORT_SPELLS = 3,
SPELL_ARUGAL_CURSE = 7621,
SPELL_THUNDERSHOCK = 7803,
SPELL_VOIDBOLT = 7588
};
enum ArugalTexts
{
SAY_AGGRO = 1, // You, too, shall serve!
SAY_TRANSFORM = 2, // Release your rage!
SAY_SLAY = 3 // Another falls!
};
enum ArugalEvents
{
EVENT_VOID_BOLT = 1,
EVENT_TELEPORT,
EVENT_THUNDERSHOCK,
EVENT_CURSE
};
class boss_archmage_arugal : public CreatureScript
{
public:
boss_archmage_arugal() : CreatureScript("boss_archmage_arugal") { }
struct boss_archmage_arugalAI : public BossAI
{
boss_archmage_arugalAI(Creature* creature) : BossAI(creature, BOSS_ARUGAL) { }
uint32 teleportSpells[NUM_TELEPORT_SPELLS] =
{
SPELL_TELE_SPAWN,
SPELL_TELE_UPPER,
SPELL_TELE_STAIRS
};
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
Talk(SAY_SLAY);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ARUGAL_CURSE)
Talk(SAY_TRANSFORM);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_CURSE, Seconds(7));
events.ScheduleEvent(EVENT_TELEPORT, Seconds(15));
events.ScheduleEvent(EVENT_VOID_BOLT, Seconds(1));
events.ScheduleEvent(EVENT_THUNDERSHOCK, Seconds(10));
}
void AttackStart(Unit* who) override
{
AttackStartCaster(who, 100.0f); // void bolt range is 100.f
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CURSE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f, true))
DoCast(target, SPELL_ARUGAL_CURSE);
events.Repeat(Seconds(15));
break;
case EVENT_TELEPORT:
{
// ensure we never cast the same teleport twice in a row
uint8 spellIndex = urand(1, NUM_TELEPORT_SPELLS-1);
std::swap(teleportSpells[0], teleportSpells[spellIndex]);
DoCast(teleportSpells[0]);
events.Repeat(Seconds(20));
break;
}
case EVENT_THUNDERSHOCK:
DoCastAOE(SPELL_THUNDERSHOCK);
events.Repeat(Seconds(30));
break;
case EVENT_VOID_BOLT:
DoCastVictim(SPELL_VOIDBOLT);
events.Repeat(Seconds(5));
break;
}
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetShadowfangKeepAI<boss_archmage_arugalAI>(creature);
}
};
class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader
{
public:
@@ -248,5 +364,6 @@ void AddSC_shadowfang_keep()
{
new npc_shadowfang_prisoner();
new npc_arugal_voidwalker();
new boss_archmage_arugal();
new spell_shadowfang_keep_haunting_spirits();
}

View File

@@ -29,7 +29,8 @@ enum SKDataTypes
TYPE_FREE_NPC = 1,
TYPE_RETHILGORE = 2,
TYPE_FENRUS = 3,
TYPE_NANDOS = 4
TYPE_NANDOS = 4,
BOSS_ARUGAL = 5
};
template<typename AI>