Core/Spells: rework part 4: iterate over effects first
Port From (https://github.com/TrinityCore/TrinityCore/commit/65dca120d34febdaa84a63e17f638ab0fa59b3df)
This commit is contained in:
@@ -541,7 +541,7 @@ namespace Game.Chat
|
||||
if (selected.IsEmpty())
|
||||
return _session.GetPlayer();
|
||||
|
||||
return Global.ObjAccessor.FindPlayer(selected);
|
||||
return Global.ObjAccessor.FindConnectedPlayer(selected);
|
||||
}
|
||||
public Unit GetSelectedUnit()
|
||||
{
|
||||
|
||||
@@ -2836,8 +2836,16 @@ namespace Game.Maps
|
||||
return _toggledSpawnGroupIds.Contains(groupId) != !data.flags.HasAnyFlag(SpawnGroupFlags.ManualSpawn);
|
||||
}
|
||||
|
||||
public void AddFarSpellCallback(FarSpellCallback callback)
|
||||
{
|
||||
_farSpellCallbacks.Enqueue(new FarSpellCallback(callback));
|
||||
}
|
||||
|
||||
public virtual void DelayedUpdate(uint diff)
|
||||
{
|
||||
while (_farSpellCallbacks.TryDequeue(out FarSpellCallback callback))
|
||||
callback(this);
|
||||
|
||||
for (var i = 0; i < _transports.Count; ++i)
|
||||
{
|
||||
Transport transport = _transports[i];
|
||||
@@ -4985,6 +4993,9 @@ namespace Game.Maps
|
||||
List<Corpse> _corpseBones = new();
|
||||
|
||||
List<WorldObject> _updateObjects = new();
|
||||
|
||||
delegate void FarSpellCallback(Map map);
|
||||
Queue<FarSpellCallback> _farSpellCallbacks = new();
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
+676
-639
File diff suppressed because it is too large
Load Diff
@@ -909,7 +909,7 @@ namespace Game.Spells
|
||||
if (unitTarget.HasAura(48920) && ((uint)(unitTarget.GetHealth() + (ulong)addhealth) >= unitTarget.GetMaxHealth()))
|
||||
unitTarget.RemoveAura(48920);
|
||||
|
||||
m_damage -= addhealth;
|
||||
m_healing -= addhealth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2657,14 +2657,16 @@ namespace Game.Spells
|
||||
public int GetDuration()
|
||||
{
|
||||
if (DurationEntry == null)
|
||||
return 0;
|
||||
return IsPassive() ? -1 : 0;
|
||||
|
||||
return (DurationEntry.Duration == -1) ? -1 : Math.Abs(DurationEntry.Duration);
|
||||
}
|
||||
|
||||
public int GetMaxDuration()
|
||||
{
|
||||
if (DurationEntry == null)
|
||||
return 0;
|
||||
return IsPassive() ? -1 : 0;
|
||||
|
||||
return (DurationEntry.MaxDuration == -1) ? -1 : Math.Abs(DurationEntry.MaxDuration);
|
||||
}
|
||||
|
||||
@@ -4021,18 +4023,6 @@ namespace Game.Spells
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsFarUnitTargetEffect()
|
||||
{
|
||||
return (Effect == SpellEffectName.SummonPlayer)
|
||||
|| (Effect == SpellEffectName.SummonRafFriend)
|
||||
|| (Effect == SpellEffectName.Resurrect);
|
||||
}
|
||||
|
||||
bool IsFarDestTargetEffect()
|
||||
{
|
||||
return Effect == SpellEffectName.TeleportUnits;
|
||||
}
|
||||
|
||||
public bool IsUnitOwnedAuraEffect()
|
||||
{
|
||||
return IsAreaAuraEffect() || Effect == SpellEffectName.ApplyAura || Effect == SpellEffectName.ApplyAuraOnPet;
|
||||
|
||||
@@ -3304,14 +3304,6 @@ namespace Game.Entities
|
||||
case 64234: // Gravity Bomb (25m) (XT-002)
|
||||
spellInfo.MaxAffectedTargets = 1;
|
||||
break;
|
||||
case 62834: // Boom (XT-002)
|
||||
// This hack is here because we suspect our implementation of spell effect execution on targets
|
||||
// is done in the wrong order. We suspect that 0 needs to be applied on all targets,
|
||||
// then 1, etc - instead of applying each effect on target1, then target2, etc.
|
||||
// The above situation causes the visual for this spell to be bugged, so we remove the instakill
|
||||
// effect and implement a script hack for that.
|
||||
spellInfo.GetEffect(1).Effect = 0;
|
||||
break;
|
||||
case 64386: // Terrifying Screech (Auriaya)
|
||||
case 64389: // Sentinel Blast (Auriaya)
|
||||
case 64678: // Sentinel Blast (Auriaya)
|
||||
|
||||
Reference in New Issue
Block a user