fix(Core/SAI): rooted check blocks vehicles from casting quest credit (#20283)

spell

The quest SteamTank Surprise has a SmartAI entry in the db that causes
the tank to cast the kill credit spell on the player when they
successfully destroy a plague wagon. Currently, this spell cast is being
blocked by the rooted check handler for SMART_ACTION_CAST. The change
proposes that this rooted check should not apply to vehicles.

Closes AzerothCore issue #20237

Co-authored-by: cgrahamseven <chris.graham@protonmail.com>
This commit is contained in:
@cgrahamseven
2024-10-24 04:57:52 -05:00
committed by GitHub
parent 8852c38cd4
commit 1c1a281eda

View File

@@ -693,7 +693,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
bool isSpellIgnoreLOS = spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT);
// If target is rooted we move out of melee range before casting, but not further than spell max range.
if (isWithinLOSInMap && isWithinMeleeRange && isRangedAttack && isTargetRooted && canCastSpell)
if (isWithinLOSInMap && isWithinMeleeRange && isRangedAttack && isTargetRooted && canCastSpell && !me->IsVehicle())
{
failedSpellCast = true; // Mark spellcast as failed so we can retry it later
float minDistance = std::max(meleeRange, spellMinRange) - distanceToTarget + NOMINAL_MELEE_RANGE;