Scripts/Black Temple: Fixed Reliquary of Souls after combat rewrite changes.

Closes #23879
* Fixed combat start/evade issue
* Fixed visual issue in Soul Release spell
* Fixed some timers issue
* Fixed some codestyle issues

PS: Please, stop break my black temple babys.
This commit is contained in:
Keader
2020-04-24 13:52:28 -03:00
parent 48c700347c
commit d8e726de58
4 changed files with 114 additions and 65 deletions

View File

@@ -0,0 +1,2 @@
-- Reliquary of Souls Combat Trigger
UPDATE `creature_template` SET `flags_extra`=`flags_extra`&~128, `ScriptName` = 'npc_reliquary_combat_trigger' WHERE `entry`=23417;

View File

@@ -55,7 +55,8 @@ enum BTDataTypes
DATA_ESSENCE_OF_ANGER = 22,
DATA_ILLIDAN_MUSIC_CONTROLLER = 23,
DATA_TERON_GOREFIEND_INTRO = 24,
DATA_AKAMA_ILLIDAN_INTRO = 25
DATA_AKAMA_ILLIDAN_INTRO = 25,
DATA_RELIQUARY_COMBAT_TRIGGER = 26
};
enum TriggerEmotes
@@ -108,7 +109,8 @@ enum BTCreatureIds
NPC_DEMON_FIRE = 23069,
NPC_PARASITIC_SHADOWFIEND = 23498,
NPC_BLAZE = 23259,
NPC_FLAME_CRASH = 23336
NPC_FLAME_CRASH = 23336,
NPC_RELIQUARY_COMBAT_TRIGGER = 23417
};
enum BTGameObjectIds

View File

@@ -93,6 +93,7 @@ enum Misc
ACTION_ESSENCE_OF_SUFFERING_DEAD,
ACTION_ESSENCE_OF_DESIRE_DEAD,
ACTION_KILL_SELF,
ACTION_START_COMBAT,
ANGER_SOUND_ID_DEATH = 11401
};
@@ -138,10 +139,7 @@ class EnslavedSoulEvent : public BasicEvent
struct boss_reliquary_of_souls : public BossAI
{
boss_reliquary_of_souls(Creature* creature) : BossAI(creature, DATA_RELIQUARY_OF_SOULS), _inCombat(false)
{
creature->m_SightDistance = 70.0f;
}
boss_reliquary_of_souls(Creature* creature) : BossAI(creature, DATA_RELIQUARY_OF_SOULS), _inCombat(false) { }
void Reset() override
{
@@ -151,15 +149,10 @@ struct boss_reliquary_of_souls : public BossAI
events.SetPhase(PHASE_ESSENCE_OF_SUFFERING);
}
void MoveInLineOfSight(Unit* who) override
void JustSummoned(Creature* summon) override
{
if (!_inCombat && who->GetTypeId() == TYPEID_PLAYER && !who->ToPlayer()->IsGameMaster() && CanAIAttack(who))
{
_inCombat = true;
DoZoneInCombat();
me->SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_STAND_STATE, UNIT_STAND_STATE_STAND);
events.ScheduleEvent(EVENT_SUBMERGE, 10s);
}
summons.Summon(summon);
summon->AI()->DoZoneInCombat();
}
uint32 GetSummonSpell()
@@ -192,6 +185,15 @@ struct boss_reliquary_of_souls : public BossAI
break;
case ACTION_KILL_SELF:
me->KillSelf();
if (Creature* combatTrigger = instance->GetCreature(DATA_RELIQUARY_COMBAT_TRIGGER))
combatTrigger->AI()->DoAction(ACTION_KILL_SELF);
break;
case ACTION_START_COMBAT:
_inCombat = true;
me->SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_STAND_STATE, UNIT_STAND_STATE_STAND);
events.ScheduleEvent(EVENT_SUBMERGE, 10s);
break;
default:
break;
}
}
@@ -212,19 +214,19 @@ struct boss_reliquary_of_souls : public BossAI
{
Creature* wTrigger = _worldTriggerList[i];
if (i < 3)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(4000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 4s);
else if (i < 6)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(8000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 8s);
else if (i < 9)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(12000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 12s);
else if (i < 12)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(16000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 16s);
else if (i < 15)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(20000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 20s);
else if (i < 18)
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(24000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 24s);
else
wTrigger->m_Events.AddEvent(new EnslavedSoulEvent(wTrigger), wTrigger->m_Events.CalculateTime(28000));
wTrigger->m_Events.AddEventAtOffset(new EnslavedSoulEvent(wTrigger), 28s);
}
}
@@ -256,7 +258,7 @@ struct boss_reliquary_of_souls : public BossAI
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
if (!_inCombat)
return;
events.Update(diff);
@@ -266,25 +268,13 @@ struct boss_reliquary_of_souls : public BossAI
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
if (eventId == EVENT_SUBMERGE)
{
case EVENT_SUBMERGE:
DoCastSelf(SPELL_SUBMERGE_VISUAL, true);
events.ScheduleEvent(EVENT_SUMMON_ESSENCE, 3s);
break;
case EVENT_SUMMON_ESSENCE:
{
EntryCheckPredicate pred(NPC_ENSLAVED_SOUL);
summons.DoAction(ACTION_KILL_SELF, pred);
DoCastSelf(GetSummonSpell());
break;
}
default:
break;
DoCastSelf(SPELL_SUBMERGE_VISUAL, true);
EntryCheckPredicate pred(NPC_ENSLAVED_SOUL);
summons.DoAction(ACTION_KILL_SELF, pred);
DoCastSelf(GetSummonSpell());
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
}
@@ -343,7 +333,6 @@ struct boss_essence_of_suffering : public BossAI
{
me->SetCombatPulseDelay(5);
me->setActive(true);
DoZoneInCombat();
events.ScheduleEvent(EVENT_SOUL_DRAIN, 20s);
events.ScheduleEvent(EVENT_FRENZY, 45s);
@@ -356,12 +345,6 @@ struct boss_essence_of_suffering : public BossAI
Talk(SUFF_SAY_SLAY);
}
void EnterEvadeMode(EvadeReason /*why*/) override
{
if (Creature* reliquary = instance->GetCreature(DATA_RELIQUARY_OF_SOULS))
reliquary->AI()->EnterEvadeMode(EVADE_REASON_OTHER);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
@@ -421,7 +404,6 @@ struct boss_essence_of_desire : public BossAI
me->SetCombatPulseDelay(5);
me->setActive(true);
DoZoneInCombat();
Talk(DESI_SAY_FREED);
}
@@ -464,12 +446,6 @@ struct boss_essence_of_desire : public BossAI
Talk(DESI_SAY_SLAY);
}
void EnterEvadeMode(EvadeReason /*why*/) override
{
if (Creature* reliquary = instance->GetCreature(DATA_RELIQUARY_OF_SOULS))
reliquary->AI()->EnterEvadeMode(EVADE_REASON_OTHER);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
@@ -536,7 +512,6 @@ struct boss_essence_of_anger : public BossAI
me->SetCombatPulseDelay(5);
me->setActive(true);
DoZoneInCombat();
}
void JustDied(Unit* /*killer*/) override
@@ -607,19 +582,13 @@ struct boss_essence_of_anger : public BossAI
DoMeleeAttackIfReady();
}
void EnterEvadeMode(EvadeReason /*why*/) override
{
if (Creature* reliquary = instance->GetCreature(DATA_RELIQUARY_OF_SOULS))
reliquary->AI()->EnterEvadeMode(EVADE_REASON_OTHER);
}
private:
ObjectGuid _targetGUID;
};
struct npc_enslaved_soul : public ScriptedAI
{
npc_enslaved_soul(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
npc_enslaved_soul(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _dead(false) { }
void Reset() override
{
@@ -634,12 +603,35 @@ struct npc_enslaved_soul : public ScriptedAI
me->SetReactState(REACT_AGGRESSIVE);
DoZoneInCombat();
});
_dead = false;
}
void DoAction(int32 actionId) override
{
if (actionId == ACTION_KILL_SELF)
me->KillSelf();
HandleSoulRelease();
}
void HandleSoulRelease()
{
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
me->GetMotionMaster()->Clear();
DoCastSelf(SPELL_SOUL_RELEASE);
me->m_Events.AddEventAtOffset([this]() { me->KillSelf(); }, 500ms);
}
void DamageTaken(Unit* /*done_by*/, uint32& damage) override
{
if (damage >= me->GetHealth())
{
damage = 0;
if (!_dead)
{
_dead = true;
HandleSoulRelease();
}
}
}
void UpdateAI(uint32 diff) override
@@ -652,14 +644,65 @@ struct npc_enslaved_soul : public ScriptedAI
DoMeleeAttackIfReady();
}
void JustDied(Unit* /*killer*/) override
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
bool _dead;
};
struct npc_reliquary_combat_trigger : public ScriptedAI
{
npc_reliquary_combat_trigger(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
{
DoCastSelf(SPELL_SOUL_RELEASE, true);
SetCombatMovement(false);
creature->m_SightDistance = 70.0f;
}
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
if (_instance->GetBossState(DATA_RELIQUARY_OF_SOULS) == DONE)
me->DespawnOrUnsummon();
}
void MoveInLineOfSight(Unit* who) override
{
if (!me->IsEngaged() && who->GetTypeId() == TYPEID_PLAYER && !who->ToPlayer()->IsGameMaster() && CanAIAttack(who))
{
if (Creature* reliquary = _instance->GetCreature(DATA_RELIQUARY_OF_SOULS))
{
DoZoneInCombat();
reliquary->AI()->DoAction(ACTION_START_COMBAT);
}
}
}
void DamageTaken(Unit* /*done_by*/, uint32& damage) override
{
damage = 0;
}
void EnterEvadeMode(EvadeReason why) override
{
ScriptedAI::EnterEvadeMode(why);
if (Creature* reliquary = _instance->GetCreature(DATA_RELIQUARY_OF_SOULS))
reliquary->AI()->EnterEvadeMode(why);
}
void DoAction(int32 actionId) override
{
if (actionId == ACTION_KILL_SELF)
me->KillSelf();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
}
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
};
// 41350 - Aura of Desire
@@ -765,6 +808,7 @@ void AddSC_boss_reliquary_of_souls()
RegisterBlackTempleCreatureAI(boss_essence_of_desire);
RegisterBlackTempleCreatureAI(boss_essence_of_anger);
RegisterBlackTempleCreatureAI(npc_enslaved_soul);
RegisterBlackTempleCreatureAI(npc_reliquary_combat_trigger);
RegisterAuraScript(spell_reliquary_of_souls_aura_of_desire);
RegisterAuraScript(spell_reliquary_of_souls_submerge);
RegisterAuraScript(spell_reliquary_of_souls_spite);

View File

@@ -76,6 +76,7 @@ ObjectData const creatureData[] =
{ NPC_BLOOD_ELF_COUNCIL_VOICE, DATA_BLOOD_ELF_COUNCIL_VOICE },
{ NPC_BLACK_TEMPLE_TRIGGER, DATA_BLACK_TEMPLE_TRIGGER },
{ NPC_MAIEV_SHADOWSONG, DATA_MAIEV },
{ NPC_RELIQUARY_COMBAT_TRIGGER, DATA_RELIQUARY_COMBAT_TRIGGER },
{ 0, 0 } // END
};