Dungeon/The Stockade: Randolph Moloch is now 100% Scripted

This commit is contained in:
Flameshot
2017-02-17 16:40:20 +02:00
parent b5a7e9f1a5
commit 267d2805d7
5 changed files with 355 additions and 26 deletions

View File

@@ -0,0 +1,14 @@
-- Randolph Moloch
UPDATE `creature_template` set `ScriptName` = 'boss_randolph_moloch' WHERE `entry` = 46383;
DELETE FROM `creature_text` WHERE entry = 46383;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(46383, 0, 0, 'Allow me to introduce myself. I am Randolph Moloch and I will be killing you all today.', 14, 0, 100, 0, 0, 0, 0, 3, 'Randolph Moloch - Stockades - SAY_PULL'),
(46383, 1, 0, '%s vanishes!', 41, 0, 100, 0, 0, 0, 0, 3, 'Randolph Moloch - Stockades - SAY_VANISH'),
(46383, 2, 0, 'My epic schemes, my great plans! Gone!', 14, 0, 100, 0, 0, 0, 0, 3, 'Randolph Moloch - Stockades - SAY_DEATH');
-- Mortimer Moloch
UPDATE `creature_template` set `ScriptName` = 'npc_mortimer_moloch' WHERE `entry` = 46482;
DELETE FROM `creature_text` WHERE entry = 46382;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(46482, 0, 0, '%s collapses from a heart attack!', 16, 0, 100, 0, 0, 0, 0, 3, 'MORTIMER MOLOCH - Stockades - MORTIMER_MOLOCH_EMOTE'),
(46482, 1, 0, 'Egad! My sophisticated heart!', 14, 0, 100, 0, 0, 0, 0, 3, 'MORTIMER MOLOCH - Stockades - MORTIMER_MOLOCH_EMOTE');

View File

@@ -0,0 +1,236 @@
/*
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2017-2017 SharpCore <http://emusharpers.tk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "the_stockade.h"
enum Spells
{
SPELL_WILDLY_STABBING = 86726,
SPELL_SWEEP = 86729,
SPELL_VANISH = 55964,
SPELL_SHADOWSTEP = 55966
};
enum Events
{
EVENT_WILDLY_STABBING = 1,
EVENT_SWEEP,
EVENT_VANISH,
EVENT_JUST_VANISHED,
EVENT_ATTACK_RANDOM,
EVENT_MORTIMER_MOLOCH_EMOTE,
EVENT_MORTIMER_MOLOCH_DEATH
};
enum Says
{
SAY_PULL = 0, //Allow me to introduce myself. I am Randolph Moloch and I will be killing you all today.
SAY_VANISH = 1, // Area Trigger: %s vanishes!
SAY_DEATH = 2, //My epic schemes, my great plans! Gone!
MORTIMER_MOLOCH_EMOTE = 0, // %s collapses from a heart attack!
MORTIMER_MOLOCH_DEATH = 1, //Egad! My sophisticated heart!
};
enum Points
{
POINT_FINISH =0,
};
Position const mortimerMolochPos = { 145.5811f, 0.7059f, -25.606f, 6.2f };
class boss_randolph_moloch : public CreatureScript
{
public:
boss_randolph_moloch() : CreatureScript("boss_randolph_moloch") {}
struct boss_randolph_molochAI : public BossAI
{
boss_randolph_molochAI(Creature* creature) : BossAI(creature, DATA_RANDOLPH_MOLOCH) {}
void Reset() override
{
_Reset();
firstVanish = false;
secondVanish = false;
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
Talk(SAY_PULL);
events.ScheduleEvent(EVENT_WILDLY_STABBING, randtime(Seconds(4), Seconds(5)));
events.ScheduleEvent(EVENT_SWEEP, randtime(Seconds(2), Seconds(3)));
}
void JustSummoned(Creature* summon) override
{
BossAI::JustSummoned(summon);
if (summon->GetEntry() == NPC_MORTIMER_MOLOCH)
summon->GetMotionMaster()->MovePoint(POINT_FINISH, me->GetPosition());
summons.Summon(summon);
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
me->SummonCreature(NPC_MORTIMER_MOLOCH, mortimerMolochPos);
}
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_WILDLY_STABBING:
DoCastVictim(SPELL_WILDLY_STABBING);
events.Repeat(randtime(Seconds(8), Seconds(12)));
break;
case EVENT_SWEEP:
DoCastVictim(SPELL_SWEEP);
events.ScheduleEvent(EVENT_SWEEP, randtime(Seconds(6), Seconds(7)));
break;
case EVENT_VANISH:
Talk(SAY_VANISH);
me->RemoveAllAuras();
DoCastSelf(SPELL_VANISH);
me->SetReactState(REACT_PASSIVE);
me->SetInCombatState(true); // Prevents the boss from resetting
events.ScheduleEvent(EVENT_JUST_VANISHED, Seconds(2));
break;
case EVENT_JUST_VANISHED:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
DoCast(target, SPELL_SHADOWSTEP,true);
me->SetReactState(REACT_AGGRESSIVE);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
if (me->HealthBelowPct(71) && me->HealthAbovePct(59) && !firstVanish)
{
firstVanish = true;
events.ScheduleEvent(EVENT_VANISH, Seconds(1));
}
if (me->HealthBelowPct(41) && me->HealthAbovePct(29) && !secondVanish)
{
secondVanish = true;
events.ScheduleEvent(EVENT_VANISH, Seconds(1));
}
}
private:
bool firstVanish,secondVanish;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<boss_randolph_molochAI>(creature);
}
};
class npc_mortimer_moloch : public CreatureScript
{
public:
npc_mortimer_moloch() : CreatureScript("npc_mortimer_moloch") {}
struct npc_mortimer_molochAI : public ScriptedAI
{
npc_mortimer_molochAI(Creature* creature) : ScriptedAI(creature) {}
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
}
void MovementInform(uint32 type, uint32 id) override
{
if (type == POINT_MOTION_TYPE)
{
switch (id)
{
case POINT_FINISH:
events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_EMOTE, Seconds(1));
break;
}
}
}
void JustRespawned() override
{
ScriptedAI::Reset();
}
void UpdateAI(uint32 diff) override
{
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_MORTIMER_MOLOCH_EMOTE:
Talk(MORTIMER_MOLOCH_EMOTE);
events.ScheduleEvent(EVENT_MORTIMER_MOLOCH_DEATH, 100);
break;
case EVENT_MORTIMER_MOLOCH_DEATH:
Talk(MORTIMER_MOLOCH_DEATH);
me->setDeathState(DEAD);
break;
default:
break;
}
}
}
private:
EventMap events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetStormwindStockadeAI<npc_mortimer_molochAI>(creature);
}
};
void AddSC_boss_randolph_moloch()
{
new boss_randolph_moloch();
new npc_mortimer_moloch();
}

View File

@@ -1,47 +1,71 @@
/*
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
This placeholder for the instance is needed for dungeon finding to be able
to give credit after the boss defined in lastEncounterDungeon is killed.
Without it, the party doing random dungeon won't get satchel of spoils and
gets instead the deserter debuff.
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2017-2017 SharpCore <http://emusharpers.tk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "the_stockade.h"
class instance_the_stockade : public InstanceMapScript
{
public:
instance_the_stockade() : InstanceMapScript("instance_the_stockade", 34) { }
struct instance_the_stockade_InstanceMapScript : public InstanceScript
{
instance_the_stockade_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
}
void OnCreatureCreate(Creature* creature) override
{
switch (creature->GetEntry())
{
case NPC_RANDOLPH_MOLOCH:
RandolphMolochGuid = creature->GetGUID();
break;
case NPC_LORD_OVERHEAT:
LordOverheatGuid = creature->GetGUID();
break;
case NPC_HOGGER:
HoggerGUID = creature->GetGUID();
break;
default:
break;
}
}
protected:
EventMap events;
ObjectGuid RandolphMolochGuid;
ObjectGuid LordOverheatGuid;
ObjectGuid HoggerGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
return new instance_the_stockade_InstanceMapScript(map);
}
struct instance_the_stockade_InstanceMapScript : public InstanceScript
{
instance_the_stockade_InstanceMapScript(Map* map) : InstanceScript(map) { }
};
};
void AddSC_instance_the_stockade()
{
new instance_the_stockade();
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2017-2017 SharpCore <http://emusharpers.tk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef THE_STOCKADE_H
#define THE_STOCKADE_H
#define StormwindStockadeScriptName "instance_the_stockade"
#define DataHeader "SS"
uint32 const EncounterCount = 3;
enum SSDataTypes
{
DATA_RANDOLPH_MOLOCH = 0,
DATA_LORD_OVERHEAT = 1,
DATA_HOGGER = 2
};
enum SSCreatureIds
{
NPC_RANDOLPH_MOLOCH = 46383,
NPC_LORD_OVERHEAT = 46264,
NPC_HOGGER = 46254,
NPC_WARDEN_THELWATER = 46409,
NPC_MORTIMER_MOLOCH = 46482
};
template<class AI>
CreatureAI* GetStormwindStockadeAI(Creature* creature)
{
if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
if (instance->GetInstanceScript())
if (instance->GetScriptId() == sObjectMgr->GetScriptId(StormwindStockadeScriptName))
return new AI(creature);
return NULL;
}
#endif

View File

@@ -160,6 +160,7 @@ void AddSC_boss_ironaya();
void AddSC_uldaman();
void AddSC_instance_uldaman();
void AddSC_instance_the_stockade(); //The Stockade
void AddSC_boss_randolph_moloch();
void AddSC_boss_akilzon(); //Zul'Aman
void AddSC_boss_halazzi();
void AddSC_boss_hex_lord_malacrass();
@@ -341,6 +342,7 @@ void AddEasternKingdomsScripts()
AddSC_boss_kiljaeden();
AddSC_sunwell_plateau();
AddSC_instance_the_stockade(); //The Stockade
AddSC_boss_randolph_moloch();
AddSC_boss_archaedas(); //Uldaman
AddSC_boss_ironaya();
AddSC_uldaman();