Core/Spells: Delay combat flagging for spell targets until spell missile lands

Port From (https://github.com/TrinityCore/TrinityCore/commit/ff99952dfb7d2b532de2d1aedc825fb96038f4c2)
This commit is contained in:
hondacrx
2022-09-07 13:14:36 -04:00
parent 1d1456b0bb
commit df33c48826
3 changed files with 64 additions and 12 deletions
+8 -3
View File
@@ -113,7 +113,7 @@ namespace Game.Combat
return null;
}
public bool SetInCombatWith(Unit who)
public bool SetInCombatWith(Unit who, bool suppressPvpSecond = false)
{
// Are we already in combat? If yes, refresh pvp combat
var pvpRefe = _pvpRefs.LookupByKey(who.GetGUID());
@@ -126,13 +126,18 @@ namespace Game.Combat
return true;
// Otherwise, check validity...
if (!CombatManager.CanBeginCombat(_owner, who))
if (!CanBeginCombat(_owner, who))
return false;
// ...then create new reference
CombatReference refe;
if (_owner.IsControlledByPlayer() && who.IsControlledByPlayer())
refe = new PvPCombatReference(_owner, who);
{
PvPCombatReference refPvp = new PvPCombatReference(_owner, who);
if (suppressPvpSecond)
refPvp.SuppressFor(who);
refe = refPvp;
}
else
refe = new CombatReference(_owner, who);