From f78820e9d58e9cd8a8f7b6234d94bce5d8a0c1d5 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Tue, 21 May 2024 03:05:56 +0200 Subject: [PATCH] fix(Scripts/Hyjal): Air Burst should not be cast on MT (#18933) * fix movement of doomfire * fix air burst * conditions * movechase random target * Update boss_archimonde.cpp * update movement * Update boss_archimonde.cpp * Update boss_archimonde.cpp --- .../pending_db_world/doomfire_movement.sql | 8 ++ .../BattleForMountHyjal/boss_archimonde.cpp | 99 ++++--------------- 2 files changed, 26 insertions(+), 81 deletions(-) create mode 100644 data/sql/updates/pending_db_world/doomfire_movement.sql diff --git a/data/sql/updates/pending_db_world/doomfire_movement.sql b/data/sql/updates/pending_db_world/doomfire_movement.sql new file mode 100644 index 000000000..2ee0da150 --- /dev/null +++ b/data/sql/updates/pending_db_world/doomfire_movement.sql @@ -0,0 +1,8 @@ +-- +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 18104; +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 18095; + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 18104); +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 +(18104, 0, 0, 0, 60, 0, 100, 512, 1600, 1600, 1600, 1600, 0, 0, 89, 40, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Doomfire Spirit - Update - move to random near position in 40 yards'), +(18104, 0, 1, 0, 60, 0, 100, 512, 1550, 1550, 1600, 1600, 0, 0, 212, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Doomfire Spirit - Update - stop moving'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 20bd45ad0..36b6a393f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -144,79 +144,10 @@ struct npc_ancient_wisp : public ScriptedAI return; } - private: InstanceScript* _instance; }; -//TODO: move to db? -struct npc_doomfire : public ScriptedAI -{ - npc_doomfire(Creature* creature) : ScriptedAI(creature), _summons(me) { } - - void Reset() override - { - _summons.DespawnAll(); - } - - void MoveInLineOfSight(Unit* /*who*/) override { } - - void JustEngagedWith(Unit* /*who*/) override { } - - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override - { - damage = 0; - } - - void JustSummoned(Creature* summoned) override - { - _summons.Summon(summoned); - if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) - { - me->GetMotionMaster()->MoveFollow(summoned, 0.0f, 0.0f); - } - } -private: - SummonList _summons; -}; - -struct npc_doomfire_targetting : public ScriptedAI -{ - npc_doomfire_targetting(Creature* creature) : ScriptedAI(creature) { } - - void Reset() override - { - _chaseTarget = nullptr; - ScheduleTimedEvent(5s, [&] - { - if (_chaseTarget) - { - me->GetMotionMaster()->MoveFollow(_chaseTarget, 0.0f, 0.0f); - } - else - { - Position randomPosition = me->GetRandomNearPosition(40.0f); - me->GetMotionMaster()->MovePoint(0, randomPosition); - } - }, 5s); - } - - void MoveInLineOfSight(Unit* who) override - { - if (who->IsPlayer()) - { - _chaseTarget = who; - } - } - - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override - { - damage = 0; - } -private: - Unit* _chaseTarget; -}; - struct boss_archimonde : public BossAI { boss_archimonde(Creature* creature) : BossAI(creature, DATA_ARCHIMONDE) @@ -327,11 +258,11 @@ struct boss_archimonde : public BossAI ScheduleTimedEvent(25s, 35s, [&] { Talk(SAY_AIR_BURST); - DoCastRandomTarget(SPELL_AIR_BURST); + DoCastRandomTarget(SPELL_AIR_BURST, 0, 0.0f, true, false, false); }, 25s, 40s); ScheduleTimedEvent(25s, 35s, [&] { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, false)) { DoCastDoomFire(target); } @@ -442,18 +373,22 @@ struct boss_archimonde : public BossAI { summoned->AI()->AttackStart(me); } + else if (summoned->GetEntry() == CREATURE_DOOMFIRE) + { + summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN); + summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID()); + } + else if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) + { + Position randomPosition = summoned->GetRandomNearPosition(40.0f); + summoned->GetMotionMaster()->MovePoint(0, randomPosition); + } else { summoned->SetFaction(me->GetFaction()); //remove? summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); } - - if (summoned->GetEntry() == CREATURE_DOOMFIRE) - { - summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN); - summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID()); - } } void DoCastDoomFire(Unit* target) @@ -462,12 +397,16 @@ struct boss_archimonde : public BossAI Talk(SAY_DOOMFIRE); Position spiritPosition = { target->GetPositionX() + DOOMFIRE_OFFSET, target->GetPositionY() + DOOMFIRE_OFFSET, target->GetPositionZ(), 0.0f }; Position doomfirePosition = { target->GetPositionX() - DOOMFIRE_OFFSET, target->GetPositionY() - DOOMFIRE_OFFSET, target->GetPositionZ(), 0.0f }; - if (Unit* doomfireSpirit = me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, spiritPosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) + if (Creature* doomfireSpirit = me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, spiritPosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) { - if (Unit* doomfire = me->SummonCreature(CREATURE_DOOMFIRE, doomfirePosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) + if (Creature* doomfire = me->SummonCreature(CREATURE_DOOMFIRE, doomfirePosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) { doomfireSpirit->SetVisible(false); doomfire->SetVisible(false); + doomfireSpirit->SetWalk(false); + doomfireSpirit->SetReactState(REACT_PASSIVE); + doomfire->SetReactState(REACT_PASSIVE); + doomfire->GetMotionMaster()->MoveFollow(doomfireSpirit, 0.0f, 0.0f); } } } @@ -568,8 +507,6 @@ void AddSC_boss_archimonde() RegisterSpellScript(spell_hand_of_death); RegisterSpellScript(spell_finger_of_death); RegisterHyjalAI(boss_archimonde); - RegisterHyjalAI(npc_doomfire); - RegisterHyjalAI(npc_doomfire_targetting); RegisterHyjalAI(npc_ancient_wisp); }