diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 1e2dad673..72ccaf81a 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -207,7 +207,7 @@ namespace Framework.Constants public const int MaxActivePets = 5; public const int MaxPetStables = 200; public const uint CallPetSpellId = 883; - public const uint PetSummoningDisorientation = 32752; + public const uint SpellPetSummoningDisorientation = 32752; public const float PetFollowDist = 1.0f; public const float PetFollowAngle = MathF.PI; public const int MaxSpellCharm = 4; diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 243527277..72bac5a0c 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -2423,25 +2423,9 @@ namespace Game.Entities return my_faction.IsNeutralToAll(); } - public SpellCastResult CastSpell(WorldObject target, uint spellId, bool triggered = false) + public SpellCastResult CastSpell(CastSpellTargetArg targets, uint spellId) { - CastSpellExtraArgs args = new(triggered); - return CastSpell(target, spellId, args); - } - - public SpellCastResult CastSpell(SpellCastTargets targets, uint spellId, CastSpellExtraArgs args) - { - return CastSpell(new CastSpellTargetArg(targets), spellId, args); - } - - public SpellCastResult CastSpell(WorldObject target, uint spellId, CastSpellExtraArgs args) - { - return CastSpell(new CastSpellTargetArg(target), spellId, args); - } - - public SpellCastResult CastSpell(Position dest, uint spellId, CastSpellExtraArgs args) - { - return CastSpell(new CastSpellTargetArg(dest), spellId, args); + return CastSpell(targets, spellId, new CastSpellExtraArgs()); } public SpellCastResult CastSpell(CastSpellTargetArg targets, uint spellId, CastSpellExtraArgs args) @@ -3366,7 +3350,8 @@ namespace Game.Entities { return obj1 && obj2 && IsInBetween(obj1.GetPosition(), obj2.GetPosition(), size); } - bool IsInBetween(Position pos1, Position pos2, float size) + + public bool IsInBetween(Position pos1, Position pos2, float size) { float dist = GetExactDist2d(pos1); diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 9b4c585fc..12eeadc52 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -1131,7 +1131,7 @@ namespace Game.Entities SetUpdateFieldStatValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.MaxDamage), maxdamage); } - void SetBonusDamage(int damage) + public void SetBonusDamage(int damage) { m_bonusSpellDamage = damage; Player playerOwner = GetOwner().ToPlayer(); diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index 54142526e..7241cfcb5 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -39,7 +39,7 @@ namespace Game.Entities protected float[][] m_weaponDamage = new float[(int)WeaponAttackType.Max][]; uint[] m_baseAttackSpeed = new uint[(int)WeaponAttackType.Max]; - internal float[] m_modAttackSpeedPct = new float[(int)WeaponAttackType.Max]; + public float[] m_modAttackSpeedPct = new float[(int)WeaponAttackType.Max]; protected uint[] m_attackTimer = new uint[(int)WeaponAttackType.Max]; bool _isCombatDisallowed; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 5bd29a11f..66bac1d49 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -2823,7 +2823,7 @@ namespace Game.Entities return aurApp?.GetBase(); } - AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null) + public AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null) { uint rankSpell = Global.SpellMgr.GetFirstSpellInChain(spellId); while (rankSpell != 0) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index c13c01acc..0b7faa81e 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -5366,7 +5366,7 @@ namespace Game.Spells Pet pet = unitCaster.ToPlayer().GetPet(); if (pet != null) { - pet.CastSpell(pet, SharedConst.PetSummoningDisorientation, new CastSpellExtraArgs(TriggerCastFlags.FullMask) + pet.CastSpell(pet, SharedConst.SpellPetSummoningDisorientation, new CastSpellExtraArgs(TriggerCastFlags.FullMask) .SetOriginalCaster(pet.GetGUID()) .SetTriggeringSpell(this)); } @@ -9339,6 +9339,31 @@ namespace Game.Spells Targets = new(); Targets = targets; } + + public static implicit operator CastSpellTargetArg(WorldObject target) + { + return new CastSpellTargetArg(target); + } + + public static implicit operator CastSpellTargetArg(Item itemTarget) + { + return new CastSpellTargetArg(itemTarget); + } + + public static implicit operator CastSpellTargetArg(Position dest) + { + return new CastSpellTargetArg(dest); + } + + public static implicit operator CastSpellTargetArg(SpellDestination dest) + { + return new CastSpellTargetArg(dest); + } + + public static implicit operator CastSpellTargetArg(SpellCastTargets targets) + { + return new CastSpellTargetArg(targets); + } } public class CastSpellExtraArgs @@ -9455,6 +9480,18 @@ namespace Game.Spells CustomArg = customArg; return this; } + + public static implicit operator CastSpellExtraArgs(bool triggered) => new CastSpellExtraArgs(triggered); + + public static implicit operator CastSpellExtraArgs(TriggerCastFlags trigger) => new CastSpellExtraArgs(trigger); + + public static implicit operator CastSpellExtraArgs(Item item) => new CastSpellExtraArgs(item); + + public static implicit operator CastSpellExtraArgs(Spell triggeringSpell) => new CastSpellExtraArgs(triggeringSpell); + + public static implicit operator CastSpellExtraArgs(AuraEffect eff) => new CastSpellExtraArgs(eff); + + public static implicit operator CastSpellExtraArgs(Difficulty castDifficulty) => new CastSpellExtraArgs(castDifficulty); } public class SpellLogEffect