Skip to content

Commit

Permalink
fix(Scripts/SSC): Script Hydross OOC event (#17804)
Browse files Browse the repository at this point in the history
* fix(Scripts/SSC): Script Hydross OOC event

* Update rev_1700448248255858600.sql

* Update boss_hydross_the_unstable.cpp

* Update rev_1700448248255858600.sql
  • Loading branch information
Nyeriah authored Nov 20, 2023
1 parent 1670ce4 commit 7795dc4
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 11 deletions.
27 changes: 27 additions & 0 deletions data/sql/updates/pending_db_world/rev_1700448248255858600.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--
DELETE FROM `spell_target_position` WHERE `id` = 36459;
INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`, `VerifiedBuild`) VALUES
(36459, 0, 548, -347.518, -350.367, 1.07459, 0, 52188);

DELETE FROM `creature` WHERE `id1` IN (21260, 21253);

SET @NPC := 21253;
SET @PATH := @NPC * 10;
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,-323.41907,-329.45224,-1.5974255,0,0,0,0,100,0),
(@PATH,2,-304.07327,-324.3901,-1.6223572,0,0,0,0,100,0),
(@PATH,3,-285.72675,-317.75647,-1.6231745,0,0,0,0,100,0),
(@PATH,4,-268.1212,-317.92252,-1.6231549,0,0,0,0,100,0),
(@PATH,5,-250.01706,-326.13535,-1.6231577,0,0,0,0,100,0),
(@PATH,6,-232.28586,-345.37613,-0.82795566,0,3000,0,0,100,0),
(@PATH,7,-207.17967,-340.97714,-1.6231886,0,0,0,0,100,0),
(@PATH,8,-191.20467,-342.70514,-1.6231867,0,0,0,0,100,0),
(@PATH,9,-179.45354,-352.66028,-1.6231802,0,0,0,0,100,0),
(@PATH,10,-168.25655,-366.4079,-1.6235477,0,0,0,0,100,0),
(@PATH,11,-157.60028,-380.57797,-1.618623,0,0,0,0,100,0),
(@PATH,12,-142.09798,-404.16937,0.4633386,0,0,0,0,100,0),
(@PATH,13,-146.7672,-423.9643,1.0743836,0,0,0,0,100,0);

DELETE FROM `creature_addon` WHERE `guid` IN (81027, 82865, 82967, 93788);
DELETE FROM `linked_respawn` WHERE `guid` IN (81027, 82865, 82967, 93788);
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,19 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
AI->SummonMovementInform(creature, WAYPOINT_MOTION_TYPE, i_currentNode);
}
}
else
{
if (TempSummon* tempSummon = creature->ToTempSummon())
{
if (Unit* owner = tempSummon->GetSummonerUnit())
{
if (UnitAI* AI = owner->GetAI())
{
AI->SummonMovementInform(creature, WAYPOINT_MOTION_TYPE, i_currentNode);
}
}
}
}
}

//----------------------------------------------------//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ enum Spells
SPELL_CLEANSING_FIELD = 37934,
SPELL_BLUE_BEAM = 38015,
SPELL_ELEMENTAL_SPAWNIN = 25035,
SPELL_PURIFY_ELEMENTAL = 36461,
SPELL_SUMMON_ELEMENTAL = 36459,

SPELL_SUMMON_CORRUPTED1 = 38188,
SPELL_SUMMON_CORRUPTED2 = 38189,
Expand Down Expand Up @@ -68,24 +70,36 @@ enum Spells
enum Misc
{
GROUP_ABILITIES = 1,
GROUP_OOC_PURIFY_ELEMENTALS = 2,

NPC_PURIFIED_WATER_ELEMENTAL = 21260,
NPC_PURE_SPAWN_OF_HYDROSS = 22035,
NPC_TAINTED_HYDROSS_ELEMENTAL = 21253
};

enum WaterElementalPathIds
{
PATH_CENTER = 5,
PATH_END = 12
};

struct boss_hydross_the_unstable : public BossAI
{
boss_hydross_the_unstable(Creature* creature) : BossAI(creature, DATA_HYDROSS_THE_UNSTABLE)
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
boss_hydross_the_unstable(Creature* creature) : BossAI(creature, DATA_HYDROSS_THE_UNSTABLE), _recentlySpoken(false) { }

void Reset() override
{
BossAI::Reset();

_Reset();
_recentlySpoken = false;
SummonTaintedElementalOOC();
}

void SummonTaintedElementalOOC()
{
me->m_Events.AddEventAtOffset([this] {
DoCastAOE(SPELL_SUMMON_ELEMENTAL);
SummonTaintedElementalOOC();
}, 12s, 12s, GROUP_OOC_PURIFY_ELEMENTALS);
}

void JustReachedHome() override
Expand All @@ -97,6 +111,27 @@ struct boss_hydross_the_unstable : public BossAI
}
}

void SummonMovementInform(Creature* summon, uint32 movementType, uint32 pathId) override
{
if (movementType == WAYPOINT_MOTION_TYPE)
{
if (pathId == PATH_CENTER)
{
summon->SetFacingToObject(me);
DoCast(summon, SPELL_PURIFY_ELEMENTAL);

// Happens even if Hydross is dead, so completely detached to the spell, which is nothing but a dummy anyways.
summon->m_Events.AddEventAtOffset([summon] {
summon->UpdateEntry(NPC_PURIFIED_WATER_ELEMENTAL);
}, 1s);
}
else if (pathId == PATH_END)
{
summon->DespawnOrUnsummon();
}
}
}

void SetForm(bool corrupt, bool initial)
{
scheduler.CancelGroup(GROUP_ABILITIES);
Expand Down Expand Up @@ -193,6 +228,7 @@ struct boss_hydross_the_unstable : public BossAI
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
SetForm(false, true);
me->m_Events.CancelEventGroup(GROUP_OOC_PURIFY_ELEMENTALS);

scheduler.Schedule(1s, [this](TaskContext context)
{
Expand Down Expand Up @@ -222,14 +258,19 @@ struct boss_hydross_the_unstable : public BossAI

void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
BossAI::JustSummoned(summon);

summon->CastSpell(summon, SPELL_ELEMENTAL_SPAWNIN, true);
summon->SetInCombatWithZone();

if (summon->GetEntry() == NPC_PURE_SPAWN_OF_HYDROSS)
{
summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
}
else if (summon->GetEntry() == NPC_TAINTED_HYDROSS_ELEMENTAL)
{
summon->SetOwnerGUID(me->GetGUID());
summon->GetMotionMaster()->MovePath(summon->GetEntry() * 10, false);
}
else
{
summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
Expand Down

0 comments on commit 7795dc4

Please sign in to comment.