Core/Scripts Rework boss Terestian Illhoof (Karazhan) (#19057)

This commit is contained in:
Gustavo
2017-02-10 00:01:39 -02:00
committed by Keader
parent 8f00aa92de
commit 87f2cb04ca
2 changed files with 256 additions and 363 deletions

View File

@@ -0,0 +1,7 @@
UPDATE `creature_template` SET `unit_flags`=33555200 WHERe `entry`=17265;
UPDATE `spell_target_position` SET `PositionX`=-11240.5, `PositionY`=-1717.25, `PositionZ`=179.238, `Orientation`=1.32986 WHERE `ID`=30171 AND `EffectIndex`=0;
UPDATE `spell_target_position` SET `PositionX`=-11251.6, `PositionY`=-1703.42, `PositionZ`=179.238, `Orientation`=6.1522 WHERE `ID`=30179 and`EffectIndex`=0;
DELETE FROM `spell_target_position` WHERE `ID`=30120;
INSERT INTO `spell_target_position` (`ID`,`EffectIndex`,`MapID`,`PositionX`,`PositionY`,`PositionZ`,`Orientation`,`VerifiedBuild`)VALUES
(30120, 0, 532, -11234.2, -1698.46, 179.24, 0.67621, 0)

View File

@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* 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
@@ -16,242 +15,51 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Terestian_Illhoof
SD%Complete: 95
SDComment: Complete! Needs adjustments to use spell though.
SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "karazhan.h"
#include "PassiveAI.h"
#include "SpellInfo.h"
enum TerestianIllhoof
enum TerestianSays
{
SAY_SLAY = 1,
SAY_DEATH = 2,
SAY_AGGRO = 3,
SAY_SACRIFICE = 4,
SAY_SUMMON = 5
SAY_SLAY = 0,
SAY_DEATH = 1,
SAY_AGGRO = 2,
SAY_SACRIFICE = 3,
SAY_SUMMON_PORTAL = 4
};
enum Spells
enum TerestianSpells
{
SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice.
SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect
SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min.
SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage.
SPELL_SACRIFICE = 30115, // Teleports and adds the debuff
SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley.
SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp.
SPELL_SUMMON_IMP = 30066, // Summons Kil'rek
SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast
SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast
SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage.
SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%.
SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec.
SPELL_SHADOW_BOLT = 30055,
SPELL_SUMMON_IMP = 30066,
SPELL_FIENDISH_PORTAL_1 = 30171,
SPELL_FIENDISH_PORTAL_2 = 30179,
SPELL_BERSERK = 32965,
SPELL_SUMMON_FIENDISH_IMP = 30184,
SPELL_BROKEN_PACT = 30065,
SPELL_AMPLIFY_FLAMES = 30053,
SPELL_FIREBOLT = 30050,
SPELL_SUMMON_DEMONCHAINS = 30120,
SPELL_DEMON_CHAINS = 30206,
SPELL_SACRIFICE = 30115
};
enum Creatures
enum TerestianMisc
{
NPC_DEMONCHAINS = 17248,
NPC_FIENDISHIMP = 17267,
NPC_PORTAL = 17265,
NPC_FIENDISH_PORTAL = 17265,
ACTION_DESPAWN_IMPS = 1
};
class npc_kilrek : public CreatureScript
enum TerestianEvents
{
public:
npc_kilrek() : CreatureScript("npc_kilrek") { }
CreatureAI* GetAI(Creature* creature) const override
{
return GetInstanceAI<npc_kilrekAI>(creature);
}
struct npc_kilrekAI : public ScriptedAI
{
npc_kilrekAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
}
void Initialize()
{
AmplifyTimer = 2000;
}
InstanceScript* instance;
uint32 AmplifyTimer;
void Reset() override
{
Initialize();
}
void EnterCombat(Unit* /*who*/) override { }
void JustDied(Unit* /*killer*/) override
{
Creature* Terestian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TERESTIAN));
if (Terestian && Terestian->IsAlive())
DoCast(Terestian, SPELL_BROKEN_PACT, true);
}
void UpdateAI(uint32 diff) override
{
//Return since we have no target
if (!UpdateVictim())
return;
if (AmplifyTimer <= diff)
{
me->InterruptNonMeleeSpells(false);
DoCastVictim(SPELL_AMPLIFY_FLAMES);
AmplifyTimer = urand(10000, 20000);
} else AmplifyTimer -= diff;
DoMeleeAttackIfReady();
}
};
};
class npc_demon_chain : public CreatureScript
{
public:
npc_demon_chain() : CreatureScript("npc_demon_chain") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_demon_chainAI(creature);
}
struct npc_demon_chainAI : public ScriptedAI
{
npc_demon_chainAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
}
void Initialize()
{
SacrificeGUID.Clear();
}
ObjectGuid SacrificeGUID;
void Reset() override
{
Initialize();
}
void EnterCombat(Unit* /*who*/) override { }
void AttackStart(Unit* /*who*/) override { }
void MoveInLineOfSight(Unit* /*who*/) override { }
void JustDied(Unit* /*killer*/) override
{
if (SacrificeGUID)
{
Unit* Sacrifice = ObjectAccessor::GetUnit(*me, SacrificeGUID);
if (Sacrifice)
Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
}
}
};
};
class npc_fiendish_portal : public CreatureScript
{
public:
npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_fiendish_portalAI(creature);
}
struct npc_fiendish_portalAI : public PassiveAI
{
npc_fiendish_portalAI(Creature* creature) : PassiveAI(creature), summons(me){ }
SummonList summons;
void Reset() override
{
DespawnAllImp();
}
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
DoZoneInCombat(summon);
}
void DespawnAllImp()
{
summons.DespawnAll();
}
};
};
class npc_fiendish_imp : public CreatureScript
{
public:
npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_fiendish_impAI(creature);
}
struct npc_fiendish_impAI : public ScriptedAI
{
npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
}
void Initialize()
{
FireboltTimer = 2000;
}
uint32 FireboltTimer;
void Reset() override
{
Initialize();
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
}
void EnterCombat(Unit* /*who*/) override { }
void UpdateAI(uint32 diff) override
{
//Return since we have no target
if (!UpdateVictim())
return;
if (FireboltTimer <= diff)
{
DoCastVictim(SPELL_FIREBOLT);
FireboltTimer = 2200;
} else FireboltTimer -= diff;
DoMeleeAttackIfReady();
}
};
EVENT_SACRIFICE = 1,
EVENT_SHADOWBOLT,
EVENT_SUMMON_PORTAL_1,
EVENT_SUMMON_PORTAL_2,
EVENT_SUMMON_KILREK,
EVENT_ENRAGE
};
class boss_terestian_illhoof : public CreatureScript
@@ -259,118 +67,116 @@ class boss_terestian_illhoof : public CreatureScript
public:
boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { }
CreatureAI* GetAI(Creature* creature) const override
struct boss_terestianAI : public BossAI
{
return GetInstanceAI<boss_terestianAI>(creature);
}
struct boss_terestianAI : public ScriptedAI
{
boss_terestianAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
Initialize();
}
void Initialize()
{
PortalsCount = 0;
SacrificeTimer = 30000;
ShadowboltTimer = 5000;
SummonTimer = 10000;
BerserkTimer = 600000;
SummonedPortals = false;
Berserk = false;
}
InstanceScript* instance;
ObjectGuid PortalGUID[2];
uint8 PortalsCount;
uint32 SacrificeTimer;
uint32 ShadowboltTimer;
uint32 SummonTimer;
uint32 BerserkTimer;
bool SummonedPortals;
bool Berserk;
boss_terestianAI(Creature* creature) : BossAI(creature, DATA_TERESTIAN) { }
void Reset() override
{
for (uint8 i = 0; i < 2; ++i)
{
if (PortalGUID[i])
{
if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[i]))
{
ENSURE_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp();
pPortal->DespawnOrUnsummon();
}
EntryCheckPredicate pred(NPC_FIENDISH_PORTAL);
summons.DoAction(ACTION_DESPAWN_IMPS, pred);
_Reset();
PortalGUID[i].Clear();
}
}
Initialize();
instance->SetBossState(DATA_TERESTIAN, NOT_STARTED);
me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
if (Minion* Kilrek = me->GetFirstMinion())
{
if (!Kilrek->IsAlive())
{
Kilrek->UnSummon();
DoCast(me, SPELL_SUMMON_IMP, true);
}
}
else DoCast(me, SPELL_SUMMON_IMP, true);
events.ScheduleEvent(EVENT_SHADOWBOLT, Seconds(1));
events.ScheduleEvent(EVENT_SUMMON_KILREK, Seconds(3));
events.ScheduleEvent(EVENT_SACRIFICE, Seconds(30));
events.ScheduleEvent(EVENT_SUMMON_PORTAL_1, Seconds(10));
events.ScheduleEvent(EVENT_SUMMON_PORTAL_2, Seconds(11));
events.ScheduleEvent(EVENT_ENRAGE, Minutes(10));
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned) override
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (summoned->GetEntry() == NPC_PORTAL)
{
PortalGUID[PortalsCount] = summoned->GetGUID();
++PortalsCount;
if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1)
{
Talk(SAY_SUMMON);
SummonedPortals = true;
}
}
if (spell->Id == SPELL_BROKEN_PACT)
events.ScheduleEvent(EVENT_SUMMON_KILREK, Seconds(32));
}
void KilledUnit(Unit* /*victim*/) override
void KilledUnit(Unit* victim) override
{
Talk(SAY_SLAY);
if (victim->GetTypeId() == TYPEID_PLAYER)
Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/) override
{
for (uint8 i = 0; i < 2; ++i)
{
if (PortalGUID[i])
{
if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i]))
pPortal->DespawnOrUnsummon();
PortalGUID[i].Clear();
}
}
Talk(SAY_DEATH);
EntryCheckPredicate pred(NPC_FIENDISH_PORTAL);
summons.DoAction(ACTION_DESPAWN_IMPS, pred);
_JustDied();
}
instance->SetBossState(DATA_TERESTIAN, DONE);
void ExecuteEvent(uint32 eventId) override
{
switch (eventId)
{
case EVENT_SACRIFICE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
{
DoCast(target, SPELL_SACRIFICE, true);
target->CastSpell(target, SPELL_SUMMON_DEMONCHAINS, true);
Talk(SAY_SACRIFICE);
}
events.Repeat(Seconds(42));
break;
case EVENT_SHADOWBOLT:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
DoCast(target, SPELL_SHADOW_BOLT);
events.Repeat(Seconds(4), Seconds(10));
break;
case EVENT_SUMMON_KILREK:
me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
DoCastAOE(SPELL_SUMMON_IMP, true);
break;
case EVENT_SUMMON_PORTAL_1:
Talk(SAY_SUMMON_PORTAL);
DoCastAOE(SPELL_FIENDISH_PORTAL_1);
break;
case EVENT_SUMMON_PORTAL_2:
DoCastAOE(SPELL_FIENDISH_PORTAL_2, true);
break;
case EVENT_ENRAGE:
DoCastSelf(SPELL_BERSERK, true);
break;
default:
break;
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetKarazhanAI<boss_terestianAI>(creature);
}
};
class npc_kilrek : public CreatureScript
{
public:
npc_kilrek() : CreatureScript("npc_kilrek") { }
struct npc_kilrekAI : public ScriptedAI
{
npc_kilrekAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
_scheduler.Schedule(Seconds(8), [this](TaskContext amplify)
{
DoCastVictim(SPELL_AMPLIFY_FLAMES);
amplify.Repeat(Seconds(9));
});
}
void JustDied(Unit* /*killer*/) override
{
DoCastAOE(SPELL_BROKEN_PACT, true);
me->DespawnOrUnsummon(Seconds(15));
}
void UpdateAI(uint32 diff) override
@@ -378,65 +184,145 @@ public:
if (!UpdateVictim())
return;
if (SacrificeTimer <= diff)
_scheduler.Update(diff, [this]
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
if (target && target->IsAlive())
{
DoCast(target, SPELL_SACRIFICE, true);
DoCast(target, SPELL_SUMMON_DEMONCHAINS, true);
if (Creature* Chains = me->FindNearestCreature(NPC_DEMONCHAINS, 5000))
{
ENSURE_AI(npc_demon_chain::npc_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
Talk(SAY_SACRIFICE);
SacrificeTimer = 30000;
}
}
} else SacrificeTimer -= diff;
if (ShadowboltTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT);
ShadowboltTimer = 10000;
} else ShadowboltTimer -= diff;
if (SummonTimer <= diff)
{
if (!PortalGUID[0])
DoCastVictim(SPELL_FIENDISH_PORTAL, false);
if (!PortalGUID[1])
DoCastVictim(SPELL_FIENDISH_PORTAL_1, false);
if (PortalGUID[0] && PortalGUID[1])
{
if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[urand(0, 1)]))
pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP, false);
SummonTimer = 5000;
}
} else SummonTimer -= diff;
if (!Berserk)
{
if (BerserkTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
Berserk = true;
} else BerserkTimer -= diff;
}
DoMeleeAttackIfReady();
DoMeleeAttackIfReady();
});
}
private:
TaskScheduler _scheduler;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetKarazhanAI<npc_kilrekAI>(creature);
}
};
class npc_demon_chain : public CreatureScript
{
public:
npc_demon_chain() : CreatureScript("npc_demon_chain") { }
struct npc_demon_chainAI : public PassiveAI
{
npc_demon_chainAI(Creature* creature) : PassiveAI(creature) { }
void IsSummonedBy(Unit* summoner) override
{
_sacrificeGUID = summoner->GetGUID();
DoCastSelf(SPELL_DEMON_CHAINS, true);
}
void JustDied(Unit* /*killer*/) override
{
if (Unit* sacrifice = ObjectAccessor::GetUnit(*me, _sacrificeGUID))
sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
}
private:
ObjectGuid _sacrificeGUID;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetKarazhanAI<npc_demon_chainAI>(creature);
}
};
class npc_fiendish_portal : public CreatureScript
{
public:
npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { }
struct npc_fiendish_portalAI : public PassiveAI
{
npc_fiendish_portalAI(Creature* creature) : PassiveAI(creature), _summons(me) { }
void Reset() override
{
_scheduler.Schedule(Milliseconds(2400), Seconds(8), [this](TaskContext summonImp)
{
DoCastAOE(SPELL_SUMMON_FIENDISH_IMP, true);
summonImp.Repeat();
});
}
void DoAction(int32 action) override
{
if (action == ACTION_DESPAWN_IMPS)
_summons.DespawnAll();
}
void JustSummoned(Creature* summon) override
{
_summons.Summon(summon);
DoZoneInCombat(summon);
}
void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
}
private:
SummonList _summons;
TaskScheduler _scheduler;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetKarazhanAI<npc_fiendish_portalAI>(creature);
}
};
class npc_fiendish_imp : public CreatureScript
{
public:
npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { }
struct npc_fiendish_impAI : public ScriptedAI
{
npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
_scheduler.Schedule(Seconds(2), [this](TaskContext firebolt)
{
DoCastVictim(SPELL_FIREBOLT);
firebolt.Repeat(Milliseconds(2400));
});
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
});
}
private:
TaskScheduler _scheduler;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetKarazhanAI<npc_fiendish_impAI>(creature);
}
};
void AddSC_boss_terestian_illhoof()
{
new boss_terestian_illhoof();
new npc_fiendish_imp();
new npc_fiendish_portal();
new npc_kilrek();
new npc_demon_chain();
new npc_fiendish_portal();
new npc_fiendish_imp();
}