Spell scrolls (#571)
* scroll spells * refactor magic system * Update spawners.yml * safe use * Update magic-spells.ftl
This commit is contained in:
@@ -29,16 +29,18 @@ public abstract partial class CP14SharedMagicSystem
|
||||
if (args is not ICP14DelayedMagicEffect delayedEffect)
|
||||
return;
|
||||
|
||||
if (!CanCastSpell(args.Action, args.Performer))
|
||||
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
|
||||
Entity<CP14MagicEffectComponent> spell = (args.Action, magicEffect);
|
||||
|
||||
if (!CanCastSpell(spell, args.Performer))
|
||||
return;
|
||||
|
||||
if (args.CastDelay > 0)
|
||||
{
|
||||
var doAfter = new CP14DelayedInstantActionDoAfterEvent(args.Cooldown);
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, args.Action, args.Performer))
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, (args.Action, magicEffect), args.Performer))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,12 +69,15 @@ public abstract partial class CP14SharedMagicSystem
|
||||
if (args is not ICP14DelayedMagicEffect delayedEffect)
|
||||
return;
|
||||
|
||||
if (!CanCastSpell(args.Action, args.Performer))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
|
||||
return;
|
||||
|
||||
Entity<CP14MagicEffectComponent> spell = (args.Action, magicEffect);
|
||||
|
||||
if (!CanCastSpell(spell, args.Performer))
|
||||
return;
|
||||
|
||||
|
||||
if (args.CastDelay > 0)
|
||||
{
|
||||
var doAfter = new CP14DelayedEntityWorldTargetActionDoAfterEvent(
|
||||
@@ -80,7 +85,7 @@ public abstract partial class CP14SharedMagicSystem
|
||||
EntityManager.GetNetEntity(args.Entity),
|
||||
args.Cooldown);
|
||||
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, args.Action, args.Performer))
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, (args.Action, magicEffect), args.Performer))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,10 +114,12 @@ public abstract partial class CP14SharedMagicSystem
|
||||
if (args is not ICP14DelayedMagicEffect delayedEffect)
|
||||
return;
|
||||
|
||||
if (!CanCastSpell(args.Action, args.Performer))
|
||||
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
|
||||
Entity<CP14MagicEffectComponent> spell = (args.Action, magicEffect);
|
||||
|
||||
if (!CanCastSpell(spell, args.Performer))
|
||||
return;
|
||||
|
||||
if (args.CastDelay > 0)
|
||||
@@ -121,7 +128,7 @@ public abstract partial class CP14SharedMagicSystem
|
||||
EntityManager.GetNetEntity(args.Target),
|
||||
args.Cooldown);
|
||||
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, args.Action, args.Performer))
|
||||
if (!TryCastSpellDelayed(delayedEffect, doAfter, (args.Action, magicEffect), args.Performer))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user