diff --git a/sql/migrations/20250813174400_world.sql b/sql/migrations/20250813174400_world.sql new file mode 100644 index 00000000000..baa21a539bf --- /dev/null +++ b/sql/migrations/20250813174400_world.sql @@ -0,0 +1,21 @@ +DROP PROCEDURE IF EXISTS add_migration; +DELIMITER ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20250813174400'); +IF v = 0 THEN +INSERT INTO `migrations` VALUES ('20250813174400'); +-- Add your query below. + + +UPDATE spell_template SET `script_name` = 'spell_rogue_sap' +WHERE entry IN (6770, 2070, 11297); + + +-- End of migration. +END IF; +END?? +DELIMITER ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; \ No newline at end of file diff --git a/src/game/PlayerBots/BattleBotAI.cpp b/src/game/PlayerBots/BattleBotAI.cpp index 49922f398a7..997bcec0aee 100644 --- a/src/game/PlayerBots/BattleBotAI.cpp +++ b/src/game/PlayerBots/BattleBotAI.cpp @@ -838,6 +838,17 @@ void BattleBotAI::UpdateAI(uint32 const diff) me->ClearTarget(); Unit* pVictim = me->GetVictim(); + + // Prevent battelbot from chasing target entered stealth mode + if (pVictim && !pVictim->IsVisibleForOrDetect(me, me, false)) + { + me->AttackStop(); + me->ClearTarget(); + me->StopMoving(); + if (pVictim = SelectAttackTarget(pVictim)) + AttackStart(pVictim); + return; + } if (!me->IsInCombat()) { diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index c4ef4b17828..ccb2d9fcb9f 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -3598,7 +3598,8 @@ SpellCastResult Spell::prepare(Aura* triggeredByAura, uint32 chance) // set timer base at cast time ReSetTimer(); - if (!m_IsTriggeredSpell && m_casterUnit) + // rogue's sap will be handled in spell script 'OnSuccessfulFinish' + if (!m_IsTriggeredSpell && m_casterUnit && m_spellInfo->SpellIconID != 249) { uint32 interruptFlags = AURA_INTERRUPT_ACTION_CANCELS; @@ -3932,7 +3933,8 @@ void Spell::cast(bool skipCheck) SendSpellCooldown(); // Remove any remaining invis auras on cast completion, should only be gnomish cloaking device - if (!m_IsTriggeredSpell && m_casterUnit) + // excepting rogue's sap which will be handled in 'OnSuccessfulFinish' spell script + if (!m_IsTriggeredSpell && m_casterUnit && m_spellInfo->SpellIconID != 249) { uint32 interruptFlags = AURA_INTERRUPT_ACTION_CANCELS_LATE; diff --git a/src/scripts/spells/spell_rogue.cpp b/src/scripts/spells/spell_rogue.cpp index f4678832d98..d0d3a735735 100644 --- a/src/scripts/spells/spell_rogue.cpp +++ b/src/scripts/spells/spell_rogue.cpp @@ -77,6 +77,31 @@ SpellScript* GetScript_RogueVanish(SpellEntry const*) return new RogueVanishScript(); } +// 6770, 2070, 11297 - Sap +struct RogueSapScript : SpellScript +{ + void OnSuccessfulFinish(Spell* spell) const + { + Unit* pTarget = spell->GetUnitTarget(); + if (pTarget) + { + if (spell->ShouldRemoveStealthAuras()) + { + spell->GetCaster()->ToUnit()->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + if (pTarget->AI()) + pTarget->AI()->AttackStart(spell->GetCaster()->ToUnit()); + } + + } + + } +}; + +SpellScript* GetScript_RogueSap(SpellEntry const*) +{ + return new RogueSapScript(); +} + void AddSC_rogue_spell_scripts() { Script* newscript; @@ -90,4 +115,9 @@ void AddSC_rogue_spell_scripts() newscript->Name = "spell_rogue_vanish"; newscript->GetSpellScript = &GetScript_RogueVanish; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_rogue_sap"; + newscript->GetSpellScript = &GetScript_RogueSap; + newscript->RegisterSelf(); }