Core/SAI: add action_param3 to SMART_ACTION_REMOVEAURASFROMSPELL to allow it to remove only auras from spells that were cast by the entity itself.

Port From (https://github.com/TrinityCore/TrinityCore/commit/d037c6b08634c5d0d4cc0462ae28e15baf8498bb)
This commit is contained in:
hondacrx
2021-12-17 17:15:30 -05:00
parent da41af6279
commit 8858e58f46
2 changed files with 21 additions and 3 deletions
@@ -2682,6 +2682,8 @@ namespace Game.AI
public struct RemoveAura
{
public uint spell;
public uint charges;
public uint onlyOwnedAuras;
}
public struct Follow
{
+19 -3
View File
@@ -779,10 +779,26 @@ namespace Game.AI
if (!IsUnit(target))
continue;
if (e.Action.removeAura.spell == 0)
target.ToUnit().RemoveAllAuras();
else
if (e.Action.removeAura.spell != 0)
{
ObjectGuid casterGUID = default;
if (e.Action.removeAura.onlyOwnedAuras != 0)
{
if (_me == null)
break;
casterGUID = _me.GetGUID();
}
if (e.Action.removeAura.charges != 0)
{
Aura aur = target.ToUnit().GetAura(e.Action.removeAura.spell, casterGUID);
if (aur != null)
aur.ModCharges(-(int)e.Action.removeAura.charges, AuraRemoveMode.Expire);
}
target.ToUnit().RemoveAurasDueToSpell(e.Action.removeAura.spell);
}
else
target.ToUnit().RemoveAllAuras();
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit {0}, spell {1}",
target.GetGUID().ToString(), e.Action.removeAura.spell);