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 commit2eaeb78bde. * Revert "Fix spell 35329 (Vibrant Blood)" This reverts commit0e7ee59588. * Revert "Revert "Fix spell 35329 (Vibrant Blood)"" This reverts commit5e4424b4d8. * Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)"" This reverts commitb3a9553a45. * Revert "Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)""" This reverts commit0ced477c76. * Revert "Revert "Revert "Fix spell 35329 (Vibrant Blood)""" This reverts commita8da732cfb. * Revert "Revert "Fix spell 35329 (Vibrant Blood)"" This reverts commit5e4424b4d8. * Revert "Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)"" This reverts commitb3a9553a45. * Revert "[PATCH] Flight of the Wintergarde Defender fix (https://forums.wow.sumy.ua/viewtopic.php?p=35#p35)" This reverts commit2eaeb78bde. * Revert "Fix spell 35329 (Vibrant Blood)" This reverts commit0e7ee59588. * FIX LOS SAI
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user