fix(Core/SmartScripts): LOS check spell for SmartScipts (#18501)

* Fix spell 35329 (Vibrant Blood)

* [PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)

* Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)"

This reverts commit 2eaeb78bdee5b09f1ea5685a9b039f9221df4abe.

* Revert "Fix spell 35329 (Vibrant Blood)"

This reverts commit 0e7ee59588709050e2af9cc15e8ff1ed358936b2.

* Revert "Revert "Fix spell 35329 (Vibrant Blood)""

This reverts commit 5e4424b4d81ec3c1de1d6f73e48d848e63e92b79.

* Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)""

This reverts commit b3a9553a45e81f65b2eb15f127c5ca9eb99b6d1e.

* Revert "Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)"""

This reverts commit 0ced477c767b9087eefdf516d0e0fccf1567e6e3.

* Revert "Revert "Revert "Fix spell 35329 (Vibrant Blood)"""

This reverts commit a8da732cfb4369f218e96175fc8f33eafc1e69c9.

* Revert "Revert "Fix spell 35329 (Vibrant Blood)""

This reverts commit 5e4424b4d81ec3c1de1d6f73e48d848e63e92b79.

* Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)""

This reverts commit b3a9553a45e81f65b2eb15f127c5ca9eb99b6d1e.

* Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)"

This reverts commit 2eaeb78bdee5b09f1ea5685a9b039f9221df4abe.

* Revert "Fix spell 35329 (Vibrant Blood)"

This reverts commit 0e7ee59588709050e2af9cc15e8ff1ed358936b2.

* FIX LOS SAI
This commit is contained in:
skelUA
2024-03-08 16:15:45 +02:00
committed by GitHub
parent 98d0626a81
commit da453b2a8d

View File

@@ -634,6 +634,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
bool isTargetRooted = target->ToUnit()->HasUnitState(UNIT_STATE_ROOT);
// To prevent running back and forth when OOM, we must have more than 10% mana.
bool canCastSpell = me->GetPowerPct(POWER_MANA) > 10.0f && spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) < (int32)me->GetPower(POWER_MANA) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
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)
@@ -651,7 +652,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
CAST_AI(SmartAI, me->AI())->SetCombatMove(true, std::max(spellMaxRange - NOMINAL_MELEE_RANGE, 0.0f));
continue;
}
else if (distanceToTarget < spellMinRange || !isWithinLOSInMap)
else if (distanceToTarget < spellMinRange || !(isWithinLOSInMap || isSpellIgnoreLOS))
{
failedSpellCast = true;
CAST_AI(SmartAI, me->AI())->SetCombatMove(true);