Core/Spells: SpellAttr8 fixups - use creator instead of owner for SPELL_ATTR8_ONLY_TARGET_IF_SAME_CREATOR and removed cast time requirement for channelled spell predicted healing
Port From (https://github.com/TrinityCore/TrinityCore/commit/930a08fe03a033a6bb30fb8c94a8490c4b77fe91)
This commit is contained in:
@@ -1467,6 +1467,7 @@ namespace Game.Entities
|
||||
|
||||
public AreaTriggerCreateProperties GetCreateProperties() { return _areaTriggerCreateProperties; }
|
||||
|
||||
public override ObjectGuid GetCreatorGUID() { return GetCasterGuid(); }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCasterGuid(); }
|
||||
public ObjectGuid GetCasterGuid() { return m_areaTriggerData.Caster; }
|
||||
|
||||
|
||||
@@ -341,8 +341,8 @@ namespace Game.Entities
|
||||
TimeSpan GetDuration() { return _duration; }
|
||||
public uint GetTextureKitId() { return _textureKitId; }
|
||||
|
||||
public ObjectGuid GetCreatorGuid() { return _creatorGuid; }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCreatorGuid(); }
|
||||
public override ObjectGuid GetCreatorGUID() { return _creatorGuid; }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCreatorGUID(); }
|
||||
public override uint GetFaction() { return 0; }
|
||||
|
||||
public override float GetStationaryX() { return _stationaryPosition.GetPositionX(); }
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Game.Entities
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
base.Update(diff);
|
||||
|
||||
|
||||
loot?.Update();
|
||||
}
|
||||
|
||||
@@ -284,6 +284,7 @@ namespace Game.Entities
|
||||
public void SetCorpseDynamicFlag(CorpseDynFlags dynamicFlags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); }
|
||||
public void RemoveCorpseDynamicFlag(CorpseDynFlags dynamicFlags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); }
|
||||
public void ReplaceAllCorpseDynamicFlags(CorpseDynFlags dynamicFlags) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); }
|
||||
public override ObjectGuid GetCreatorGUID() { return m_corpseData.Owner; }
|
||||
public override ObjectGuid GetOwnerGUID() { return m_corpseData.Owner; }
|
||||
public void SetOwnerGUID(ObjectGuid owner) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.Owner), owner); }
|
||||
public void SetPartyGUID(ObjectGuid partyGuid) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.PartyGUID), partyGuid); }
|
||||
@@ -317,8 +318,8 @@ namespace Game.Entities
|
||||
public CellCoord GetCellCoord() { return _cellCoord; }
|
||||
public void SetCellCoord(CellCoord cellCoord) { _cellCoord = cellCoord; }
|
||||
|
||||
public override Loot GetLootForPlayer(Player player) { return loot; }
|
||||
|
||||
public override Loot GetLootForPlayer(Player player) { return loot; }
|
||||
|
||||
public CorpseData m_corpseData;
|
||||
|
||||
public Loot loot;
|
||||
|
||||
@@ -305,6 +305,7 @@ namespace Game.Entities
|
||||
public Unit GetCaster() { return _caster; }
|
||||
public uint GetSpellId() { return m_dynamicObjectData.SpellID; }
|
||||
public ObjectGuid GetCasterGUID() { return m_dynamicObjectData.Caster; }
|
||||
public override ObjectGuid GetCreatorGUID() { return GetCasterGUID(); }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCasterGUID(); }
|
||||
public float GetRadius() { return m_dynamicObjectData.Radius; }
|
||||
|
||||
|
||||
@@ -3678,6 +3678,7 @@ namespace Game.Entities
|
||||
public Quaternion GetLocalRotation() { return m_localRotation; }
|
||||
public long GetPackedLocalRotation() { return m_packedRotation; }
|
||||
|
||||
public override ObjectGuid GetCreatorGUID() { return m_gameObjectData.CreatedBy; }
|
||||
public void SetOwnerGUID(ObjectGuid owner)
|
||||
{
|
||||
// Owner already found and different than expected owner - remove object from old owner
|
||||
|
||||
@@ -3121,6 +3121,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual bool LoadFromDB(ulong spawnId, Map map, bool addToMap, bool allowDuplicate) { return true; }
|
||||
|
||||
public virtual ObjectGuid GetCreatorGUID() { return default; }
|
||||
public virtual ObjectGuid GetOwnerGUID() { return default; }
|
||||
public virtual ObjectGuid GetCharmerOrOwnerGUID() { return GetOwnerGUID(); }
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ namespace Game.Entities
|
||||
base.ClearUpdateMask(remove);
|
||||
}
|
||||
|
||||
public override ObjectGuid GetCreatorGUID() { return m_sceneObjectData.CreatedBy; }
|
||||
public override ObjectGuid GetOwnerGUID() { return m_sceneObjectData.CreatedBy; }
|
||||
public override uint GetFaction() { return 0; }
|
||||
|
||||
|
||||
@@ -2077,7 +2077,7 @@ namespace Game.Entities
|
||||
udata.BuildPacket(out packet);
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
public ObjectGuid GetCreatorGUID() { return m_unitData.CreatedBy; }
|
||||
public override ObjectGuid GetCreatorGUID() { return m_unitData.CreatedBy; }
|
||||
public void SetCreatorGUID(ObjectGuid creator) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CreatedBy), creator); }
|
||||
public ObjectGuid GetMinionGUID() { return m_unitData.Summon; }
|
||||
public void SetMinionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Summon), guid); }
|
||||
|
||||
@@ -4403,7 +4403,7 @@ namespace Game.Spells
|
||||
spellChannelStart.InterruptImmunities = interruptImmunities;
|
||||
}
|
||||
|
||||
if (m_spellInfo.HasAttribute(SpellAttr8.HealPrediction) && m_casttime != 0 && m_caster.IsUnit())
|
||||
if (m_spellInfo.HasAttribute(SpellAttr8.HealPrediction) && m_caster.IsUnit())
|
||||
{
|
||||
SpellTargetedHealPrediction healPrediction = new();
|
||||
if (unitCaster.m_unitData.ChannelObjects.Size() == 1 && unitCaster.m_unitData.ChannelObjects[0].IsUnit())
|
||||
|
||||
@@ -1006,8 +1006,19 @@ namespace Game.Spells
|
||||
Unit unitTarget = target.ToUnit();
|
||||
|
||||
if (HasAttribute(SpellAttr8.OnlyTargetIfSameCreator))
|
||||
if (caster != target && caster.GetGUID() != target.GetOwnerGUID())
|
||||
{
|
||||
ObjectGuid getCreatorOrSelf(WorldObject obj)
|
||||
{
|
||||
ObjectGuid creator = obj.GetCreatorGUID();
|
||||
if (creator.IsEmpty())
|
||||
creator = obj.GetGUID();
|
||||
|
||||
return creator;
|
||||
};
|
||||
|
||||
if (getCreatorOrSelf(caster) != getCreatorOrSelf(target))
|
||||
return SpellCastResult.BadTargets;
|
||||
}
|
||||
|
||||
// creature/player specific target checks
|
||||
if (unitTarget != null)
|
||||
@@ -4109,7 +4120,7 @@ namespace Game.Spells
|
||||
{
|
||||
public int MaxTargets; // The amount of targets after the damage decreases by the Square Root AOE formula
|
||||
public int NumNonDiminishedTargets; // The amount of targets that still take the full amount before the damage decreases by the Square Root AOE formula
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpellEffectInfo
|
||||
|
||||
Reference in New Issue
Block a user