fix(Scripts/SSC): Improve Tainted Elemental combat behaviour (#20505)

* fix(Scripts/SSC): Improve Tainted Elemental combat behaviour

* Update boss_lady_vashj.cpp
This commit is contained in:
Andrew
2024-11-10 15:45:17 -03:00
committed by GitHub
parent bf925eda3c
commit b16a610789
2 changed files with 18 additions and 62 deletions
@@ -0,0 +1,8 @@
--
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 22009;
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 22009) AND (`source_type` = 0) AND (`id` IN (0, 1, 2));
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
(22009, 0, 0, 1, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tainted Elemental - On Reset - Set In Combat With Zone'),
(22009, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 41, 15000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tainted Elemental - On Reset - Despawn In 15000 ms'),
(22009, 0, 2, 0, 0, 0, 100, 0, 1000, 2000, 2350, 2650, 0, 0, 11, 38253, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Tainted Elemental - In Combat - Cast \'Poison Bolt\'');
@@ -58,17 +58,13 @@ enum Spells
SPELL_SUMMON_SPOREBAT2 = 38490, SPELL_SUMMON_SPOREBAT2 = 38490,
SPELL_SUMMON_SPOREBAT3 = 38492, SPELL_SUMMON_SPOREBAT3 = 38492,
SPELL_SUMMON_SPOREBAT4 = 38493, SPELL_SUMMON_SPOREBAT4 = 38493,
SPELL_TOXIC_SPORES = 38574, SPELL_TOXIC_SPORES = 38574
SPELL_POISON_BOLT = 38253
}; };
enum Misc enum Misc
{ {
ITEM_TAINTED_CORE = 31088, ITEM_TAINTED_CORE = 31088,
POINT_HOME = 1, POINT_HOME = 1,
NPC_TRIGGER = 15384 NPC_TRIGGER = 15384
}; };
@@ -125,29 +121,29 @@ struct boss_lady_vashj : public BossAI
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
DoCastSelf(SPELL_REMOVE_TAINTED_CORES, true); DoCastSelf(SPELL_REMOVE_TAINTED_CORES, true);
ScheduleSpells(); ScheduleSpells();
} }
void JustSummoned(Creature* summon) override void JustSummoned(Creature* summon) override
{ {
summons.Summon(summon); summons.Summon(summon);
switch (summon->GetEntry()) { switch (summon->GetEntry())
case(WORLD_TRIGGER): {
case WORLD_TRIGGER:
summon->CastSpell(summon, SPELL_MAGIC_BARRIER); summon->CastSpell(summon, SPELL_MAGIC_BARRIER);
break; break;
case(NPC_ENCHANTED_ELEMENTAL): case NPC_ENCHANTED_ELEMENTAL:
summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f, MOTION_SLOT_ACTIVE, false); summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f, MOTION_SLOT_ACTIVE, false);
summon->SetWalk(true); summon->SetWalk(true);
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
break; break;
case(NPC_TAINTED_ELEMENTAL): case NPC_TAINTED_ELEMENTAL:
break; break;
case(NPC_TOXIC_SPOREBAT): case NPC_TOXIC_SPOREBAT:
summon->GetMotionMaster()->MoveRandom(30.0f); summon->GetMotionMaster()->MoveRandom(30.0f);
break; break;
default: default:
summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, true); summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPosition());
} }
} }
@@ -182,9 +178,8 @@ struct boss_lady_vashj : public BossAI
void MovementInform(uint32 type, uint32 id) override void MovementInform(uint32 type, uint32 id) override
{ {
if (type != POINT_MOTION_TYPE || id != POINT_HOME) if (type != POINT_MOTION_TYPE || id != POINT_HOME)
{
return; return;
}
me->AddUnitState(UNIT_STATE_ROOT); me->AddUnitState(UNIT_STATE_ROOT);
me->SetFacingTo(me->GetHomePosition().GetOrientation()); me->SetFacingTo(me->GetHomePosition().GetOrientation());
instance->SetData(DATA_ACTIVATE_SHIELD, 0); instance->SetData(DATA_ACTIVATE_SHIELD, 0);
@@ -232,9 +227,7 @@ struct boss_lady_vashj : public BossAI
}); });
} }
else else
{
context.Repeat(1s); context.Repeat(1s);
}
}); });
} }
@@ -246,20 +239,16 @@ struct boss_lady_vashj : public BossAI
scheduler.Update(diff); scheduler.Update(diff);
if (me->GetReactState() != REACT_AGGRESSIVE || !me->isAttackReady()) if (me->GetReactState() != REACT_AGGRESSIVE || !me->isAttackReady())
{
return; return;
}
if (!me->IsWithinMeleeRange(me->GetVictim())) if (!me->IsWithinMeleeRange(me->GetVictim()))
{ {
me->resetAttackTimer(); me->resetAttackTimer();
me->SetSheath(SHEATH_STATE_RANGED); me->SetSheath(SHEATH_STATE_RANGED);
me->CastSpell(me->GetVictim(), roll_chance_i(33) ? SPELL_MULTI_SHOT : SPELL_SHOOT, false); DoCastVictim(roll_chance_i(33) ? SPELL_MULTI_SHOT : SPELL_SHOOT);
if (roll_chance_i(15)) if (roll_chance_i(15))
{
Talk(SAY_BOWSHOT); Talk(SAY_BOWSHOT);
} }
}
else else
{ {
me->SetSheath(SHEATH_STATE_MELEE); me->SetSheath(SHEATH_STATE_MELEE);
@@ -280,42 +269,6 @@ private:
std::chrono::seconds _batTimer; std::chrono::seconds _batTimer;
}; };
struct npc_tainted_elemental : public ScriptedAI
{
npc_tainted_elemental(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
scheduler.CancelAll();
me->SetInCombatWithZone();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->AddThreat(target, 1000.0f);
}
}
void JustEngagedWith(Unit* /*who*/) override
{
scheduler.Schedule(100ms, 500ms, [this](TaskContext context)
{
DoCastVictim(SPELL_POISON_BOLT);
context.Repeat(2350ms, 2650ms);
}).Schedule(15s, [this](TaskContext)
{
me->DespawnOrUnsummon();
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
}
};
class spell_lady_vashj_magic_barrier : public AuraScript class spell_lady_vashj_magic_barrier : public AuraScript
{ {
PrepareAuraScript(spell_lady_vashj_magic_barrier); PrepareAuraScript(spell_lady_vashj_magic_barrier);
@@ -339,10 +292,8 @@ class spell_lady_vashj_remove_tainted_cores : public SpellScript
{ {
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Player* target = GetHitPlayer()) if (Player* target = GetHitPlayer())
{
target->DestroyItemCount(ITEM_TAINTED_CORE, -1, true); target->DestroyItemCount(ITEM_TAINTED_CORE, -1, true);
} }
}
void Register() override void Register() override
{ {
@@ -374,10 +325,8 @@ class spell_lady_vashj_spore_drop_effect : public SpellScript
{ {
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_TOXIC_SPORES, true, nullptr, nullptr, GetCaster()->GetGUID()); target->CastSpell(target, SPELL_TOXIC_SPORES, true, nullptr, nullptr, GetCaster()->GetGUID());
} }
}
void Register() override void Register() override
{ {
@@ -455,7 +404,6 @@ class spell_lady_vashj_summons : public SpellScript
void AddSC_boss_lady_vashj() void AddSC_boss_lady_vashj()
{ {
RegisterSerpentShrineAI(boss_lady_vashj); RegisterSerpentShrineAI(boss_lady_vashj);
RegisterSerpentShrineAI(npc_tainted_elemental);
RegisterSpellScript(spell_lady_vashj_magic_barrier); RegisterSpellScript(spell_lady_vashj_magic_barrier);
RegisterSpellScript(spell_lady_vashj_remove_tainted_cores); RegisterSpellScript(spell_lady_vashj_remove_tainted_cores);
RegisterSpellScript(spell_lady_vashj_summon_sporebat); RegisterSpellScript(spell_lady_vashj_summon_sporebat);