Core/Spells: Implemented new trigger flag to cause spells to be instant without also causing other behavior of TRIGGERED_CAST_DIRECTLY (skipping SMSG_SPELL_START, skipping starting GCD)

Port From (https://github.com/TrinityCore/TrinityCore/commit/a885a1fc3c6b894f546b7aee70b5a67932a94486)
This commit is contained in:
Hondacrx
2024-08-26 18:11:28 -04:00
parent 585949a9cf
commit b38668c7cb
4 changed files with 6 additions and 4 deletions
@@ -1542,7 +1542,7 @@ namespace Framework.Constants
IgnoreCastItem = 0x08, //! Will Not Take Away Cast Item Or Update Related Achievement Criteria IgnoreCastItem = 0x08, //! Will Not Take Away Cast Item Or Update Related Achievement Criteria
IgnoreAuraScaling = 0x10, //! Will Ignore Aura Scaling IgnoreAuraScaling = 0x10, //! Will Ignore Aura Scaling
IgnoreCastInProgress = 0x20, //! Will Not Check If A Current Cast Is In Progress IgnoreCastInProgress = 0x20, //! Will Not Check If A Current Cast Is In Progress
// reuse = 0x40, // IgnoreCastTime = 0x40, //! Will always be instantly cast
CastDirectly = 0x80, //! In Spell.Prepare, Will Be Cast Directly Without Setting Containers For Executed Spell CastDirectly = 0x80, //! In Spell.Prepare, Will Be Cast Directly Without Setting Containers For Executed Spell
// reuse = 0x100, // // reuse = 0x100, //
IgnoreSetFacing = 0x200, //! Will Not Adjust Facing To Target (If Any) IgnoreSetFacing = 0x200, //! Will Not Adjust Facing To Target (If Any)
+3 -1
View File
@@ -2630,7 +2630,9 @@ namespace Game.Spells
// Prepare data for triggers // Prepare data for triggers
PrepareDataForTriggerSystem(); PrepareDataForTriggerSystem();
m_casttime = CallScriptCalcCastTimeHandlers(m_spellInfo.CalcCastTime(this)); if (!_triggeredCastFlags.HasFlag(TriggerCastFlags.IgnoreCastTime))
m_casttime = m_spellInfo.CalcCastTime(this);
m_casttime = CallScriptCalcCastTimeHandlers(m_casttime);
SpellCastResult movementResult = SpellCastResult.SpellCastOk; SpellCastResult movementResult = SpellCastResult.SpellCastOk;
if (m_caster.IsUnit() && m_caster.ToUnit().IsMoving()) if (m_caster.IsUnit() && m_caster.ToUnit().IsMoving())
+1 -1
View File
@@ -4841,7 +4841,7 @@ namespace Game.Spells
if (!spellInfo.HasAttribute(SpellAttr7.CanBeMultiCast)) if (!spellInfo.HasAttribute(SpellAttr7.CanBeMultiCast))
continue; continue;
CastSpellExtraArgs args = new(TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.CastDirectly | TriggerCastFlags.DontReportCastError); CastSpellExtraArgs args = new(TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.IgnoreCastTime | TriggerCastFlags.CastDirectly | TriggerCastFlags.DontReportCastError);
args.OriginalCastId = m_castId; args.OriginalCastId = m_castId;
args.CastDifficulty = GetCastDifficulty(); args.CastDifficulty = GetCastDifficulty();
m_caster.CastSpell(m_caster, spellInfo.Id, args); m_caster.CastSpell(m_caster, spellInfo.Id, args);
+1 -1
View File
@@ -3420,7 +3420,7 @@ namespace Scripts.Spells.Priest
{ {
GetCaster().CastSpell(GetHitUnit(), SpellIds.VampiricTouch, new CastSpellExtraArgs() GetCaster().CastSpell(GetHitUnit(), SpellIds.VampiricTouch, new CastSpellExtraArgs()
.SetTriggeringSpell(GetSpell()) .SetTriggeringSpell(GetSpell())
.SetTriggerFlags(TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreSpellAndCategoryCD | TriggerCastFlags.IgnorePowerAndReagentCost | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.CastDirectly | TriggerCastFlags.DontReportCastError)); .SetTriggerFlags(TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreSpellAndCategoryCD | TriggerCastFlags.IgnorePowerAndReagentCost | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.IgnoreCastTime | TriggerCastFlags.DontReportCastError));
} }
public override void Register() public override void Register()