fix(Scripts/SSC): Respawn Leotheras and fix last phase transition (#17720)

This commit is contained in:
Andrew
2023-11-15 18:59:03 -03:00
committed by GitHub
parent 03612e8bff
commit b0cf308be2
3 changed files with 75 additions and 59 deletions
@@ -0,0 +1,24 @@
--
SET @CGUID := 15013;
DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+3;
INSERT INTO `creature` (`guid`, `id1`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `unit_flags`, `dynamicflags`, `CreateObject`, `VerifiedBuild`) VALUES
(@CGUID+0, 21806, 548, 3607, 3607, 1, 1, 0, 369.23431396484375, -446.472564697265625, 29.6020355224609375, 0.820574045181274414, 7200, 0, 0, 29470, 0, 0, 0, 0, 1, 52148), -- 21806 (Area: 3607 - Difficulty: 4) CreateObject1
(@CGUID+1, 21806, 548, 3607, 3607, 1, 1, 0, 385.1583251953125, -441.596710205078125, 29.61212921142578125, 2.810055494308471679, 7200, 0, 0, 29470, 0, 0, 0, 0, 1, 52148), -- 21806 (Area: 3607 - Difficulty: 4) CreateObject1
(@CGUID+2, 21806, 548, 3607, 3607, 1, 1, 0, 373.21923828125, -429.14776611328125, 29.60641860961914062, 5.049488067626953125, 7200, 0, 0, 29470, 0, 0, 0, 0, 1, 52148), -- 21806 (Area: 3607 - Difficulty: 4) CreateObject1
(@CGUID+3, 21215, 548, 3607, 3607, 1, 1, 0, 376.5428466796875, -438.630889892578125, 29.60830116271972656, 2.670353651046752929, 7200, 0, 0, 0, 0, 0, 0, 0, 1, 52148); -- 21215 (Area: 3607 - Difficulty: 4) CreateObject1 (Auras: 37546 - 37546)
DELETE FROM `creature_addon` WHERE `guid` = @CGUID+3;
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES
(@CGUID+3, 0, 0, 8, 1, '37546'); -- 21215 - 37546 - 37546
DELETE FROM `creature_formations` WHERE `leaderGUID` = @CGUID+3;
INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES
(@CGUID+3, @CGUID+3, 0, 0, 24, 0, 0),
(@CGUID+3, @CGUID+0, 0, 0, 24, 0, 0),
(@CGUID+3, @CGUID+1, 0, 0, 24, 0, 0),
(@CGUID+3, @CGUID+2, 0, 0, 24, 0, 0);
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 21806) AND (`source_type` = 0) AND (`id` IN (4));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(21806, 0, 4, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 0, 205, 2, 1, 0, 0, 0, 0, 0, 0, 'Greyheart Spellbinder - On Just Died - Do Action ID 1 (ACTION_CHECK_SPELLBINDERS)');
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "CreatureGroups.h"
#include "Player.h" #include "Player.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
@@ -56,10 +57,10 @@ enum Spells
enum Misc enum Misc
{ {
MAX_CHANNELERS = 3,
NPC_GREYHEART_SPELLBINDER = 21806,
NPC_SHADOW_OF_LEOTHERAS = 21875, NPC_SHADOW_OF_LEOTHERAS = 21875,
NPC_GREYHEART_SPELLBINDER = 21806,
ACTION_CHECK_SPELLBINDERS = 1
}; };
enum Groups enum Groups
@@ -68,35 +69,21 @@ enum Groups
GROUP_DEMON = 2 GROUP_DEMON = 2
}; };
const Position channelersPos[MAX_CHANNELERS] =
{
{367.11f, -421.48f, 29.52f, 5.0f},
{380.11f, -435.48f, 29.52f, 2.5f},
{362.11f, -437.48f, 29.52f, 0.9f}
};
struct boss_leotheras_the_blind : public BossAI struct boss_leotheras_the_blind : public BossAI
{ {
boss_leotheras_the_blind(Creature* creature) : BossAI(creature, DATA_LEOTHERAS_THE_BLIND) boss_leotheras_the_blind(Creature* creature) : BossAI(creature, DATA_LEOTHERAS_THE_BLIND) { }
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override void Reset() override
{ {
BossAI::Reset(); BossAI::Reset();
DoCastSelf(SPELL_CLEAR_CONSUMING_MADNESS, true); DoCastSelf(SPELL_CLEAR_CONSUMING_MADNESS, true);
DoCastSelf(SPELL_DUAL_WIELD, true); DoCastSelf(SPELL_DUAL_WIELD, true);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->LoadEquipment(0, true);
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
_recentlySpoken = false; _recentlySpoken = false;
SummonChannelers();
ScheduleHealthCheckEvent(15, [&]{ ScheduleHealthCheckEvent(15, [&]{
me->RemoveAurasDueToSpell(SPELL_WHIRLWIND);
if (me->GetDisplayId() != me->GetNativeDisplayId()) if (me->GetDisplayId() != me->GetNativeDisplayId())
{ {
//is currently in metamorphosis //is currently in metamorphosis
@@ -104,12 +91,17 @@ struct boss_leotheras_the_blind : public BossAI
me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS);
scheduler.RescheduleGroup(GROUP_COMBAT, 10s); scheduler.RescheduleGroup(GROUP_COMBAT, 10s);
} }
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoResetThreatList(); DoResetThreatList();
me->ClearTarget();
me->SendMeleeAttackStop();
scheduler.CancelGroup(GROUP_DEMON); scheduler.CancelGroup(GROUP_DEMON);
scheduler.DelayAll(10s); scheduler.DelayAll(10s);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->GetMotionMaster()->Clear(); me->GetMotionMaster()->Clear();
me->StopMoving(); me->StopMoving();
Talk(SAY_FINAL_FORM); Talk(SAY_FINAL_FORM);
@@ -119,39 +111,27 @@ struct boss_leotheras_the_blind : public BossAI
DoCastSelf(SPELL_SUMMON_SHADOW_OF_LEOTHERAS); DoCastSelf(SPELL_SUMMON_SHADOW_OF_LEOTHERAS);
}).Schedule(6s, [this](TaskContext) }).Schedule(6s, [this](TaskContext)
{ {
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND); me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetReactState(REACT_AGGRESSIVE); me->SetReactState(REACT_AGGRESSIVE);
me->GetMotionMaster()->MoveChase(me->GetVictim()); me->ResumeChasingVictim();
if (me->GetVictim())
{
me->SetTarget(me->GetVictim()->GetGUID());
me->SendMeleeAttackStart(me->GetVictim());
}
}); });
}); });
} }
void SummonChannelers() void DoAction(int32 actionId) override
{ {
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); if (actionId == ACTION_CHECK_SPELLBINDERS)
DoCastSelf(SPELL_BANISH);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true);
//probably needs a spell instead
summons.DespawnAll();
for (uint8 i = 0; i < MAX_CHANNELERS; ++i)
{ {
me->SummonCreature(NPC_GREYHEART_SPELLBINDER, channelersPos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); if (CreatureGroup* formation = me->GetFormation())
}
}
void JustSummoned(Creature* summon) override
{ {
summons.Summon(summon); if (!formation->IsAnyMemberAlive(true))
}
void SummonedCreatureDies(Creature* summon, Unit*) override
{
me->SetInCombatWithZone();
summons.Despawn(summon);
if (summon->GetEntry() == NPC_GREYHEART_SPELLBINDER)
{
if (!summons.HasEntry(NPC_GREYHEART_SPELLBINDER))
{ {
me->RemoveAllAuras(); me->RemoveAllAuras();
me->LoadEquipment(); me->LoadEquipment();
@@ -168,6 +148,7 @@ struct boss_leotheras_the_blind : public BossAI
} }
} }
} }
}
void ElfTime() void ElfTime()
{ {
@@ -218,15 +199,25 @@ struct boss_leotheras_the_blind : public BossAI
return; return;
if (me->GetDisplayId() == me->GetNativeDisplayId()) if (me->GetDisplayId() == me->GetNativeDisplayId())
{
if (me->GetReactState() != REACT_PASSIVE)
{ {
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
}
else if (me->isAttackReady(BASE_ATTACK)) else if (me->isAttackReady(BASE_ATTACK))
{ {
me->CastSpell(me->GetVictim(), SPELL_CHAOS_BLAST, false); if (DoCastVictim(SPELL_CHAOS_BLAST) != SPELL_CAST_OK)
{
// Auto-attacks if there are no valid targets to cast his spell on f.e pet taunted.
DoMeleeAttackIfReady();
}
else
{
me->setAttackTimer(BASE_ATTACK, 2000); me->setAttackTimer(BASE_ATTACK, 2000);
} }
} }
}
private: private:
bool _recentlySpoken; bool _recentlySpoken;
}; };
@@ -31,6 +31,7 @@ DoorData const doorData[] =
ObjectData const creatureData[] = ObjectData const creatureData[] =
{ {
{ NPC_LEOTHERAS_THE_BLIND, DATA_LEOTHERAS_THE_BLIND },
{ NPC_FATHOM_LORD_KARATHRESS, DATA_FATHOM_LORD_KARATHRESS }, { NPC_FATHOM_LORD_KARATHRESS, DATA_FATHOM_LORD_KARATHRESS },
{ 0, 0 } { 0, 0 }
}; };