Spell T0 traits, recategorize magic (#540)
* move to gurps magic types * spell traits, categorize spells * Update TraitSystem.cs * magic spells item provider * Update twoHandedStaffs.yml * Update CP14MagicManacostModifySystem.cs * Update CP14SpellStorageSystem.cs
This commit is contained in:
@@ -4,7 +4,9 @@ using Content.Shared._CP14.MagicEnergy.Components;
|
||||
using Content.Shared._CP14.MagicSpell.Components;
|
||||
using Content.Shared._CP14.MagicSpell.Events;
|
||||
using Content.Shared._CP14.MagicSpell.Spells;
|
||||
using Content.Shared._CP14.MagicSpellStorage;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Speech.Muting;
|
||||
@@ -50,7 +52,6 @@ public partial class CP14SharedMagicSystem : EntitySystem
|
||||
|
||||
private void OnMagicEffectInit(Entity<CP14MagicEffectComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
|
||||
var meta = MetaData(ent);
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -62,6 +63,16 @@ public partial class CP14SharedMagicSystem : EntitySystem
|
||||
sb.Append($"\n {Loc.GetString("cp14-magic-magic-type")}: [color={indexedMagic.Color.ToHex()}]{Loc.GetString(indexedMagic.Name)}[/color]");
|
||||
}
|
||||
|
||||
if (TryComp<CP14MagicEffectVerbalAspectComponent>(ent, out var verbal))
|
||||
{
|
||||
sb.Append("\n" + Loc.GetString("cp14-magic-verbal-aspect"));
|
||||
}
|
||||
|
||||
if (TryComp<CP14MagicEffectSomaticAspectComponent>(ent, out var somatic))
|
||||
{
|
||||
sb.Append("\n" + Loc.GetString("cp14-magic-somatic-aspect") + " " + somatic.FreeHandRequired);
|
||||
}
|
||||
|
||||
_meta.SetEntityDescription(ent, sb.ToString());
|
||||
}
|
||||
|
||||
@@ -73,14 +84,7 @@ public partial class CP14SharedMagicSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var manaCost = ent.Comp.ManaCost;
|
||||
|
||||
if (ent.Comp.CanModifyManacost)
|
||||
{
|
||||
var manaEv = new CP14CalculateManacostEvent(args.Caster, ent.Comp.ManaCost, ent.Comp.MagicType);
|
||||
RaiseLocalEvent(args.Caster, manaEv);
|
||||
manaCost = manaEv.GetManacost();
|
||||
}
|
||||
var manaCost = CalculateManacost(ent, args.Caster);
|
||||
|
||||
if (!_magicEnergy.HasEnergy(args.Caster, manaCost, magicContainer, ent.Comp.Safe))
|
||||
{
|
||||
@@ -283,15 +287,25 @@ public partial class CP14SharedMagicSystem : EntitySystem
|
||||
return;
|
||||
|
||||
|
||||
var manaCost = CalculateManacost(ent, args.Caster.Value);
|
||||
_magicEnergy.TryConsumeEnergy(args.Caster.Value, manaCost, safe: ent.Comp.Safe);
|
||||
}
|
||||
|
||||
private FixedPoint2 CalculateManacost(Entity<CP14MagicEffectComponent> ent, EntityUid caster)
|
||||
{
|
||||
var manaCost = ent.Comp.ManaCost;
|
||||
|
||||
if (ent.Comp.CanModifyManacost)
|
||||
{
|
||||
var manaEv = new CP14CalculateManacostEvent(args.Caster.Value, ent.Comp.ManaCost, ent.Comp.MagicType);
|
||||
RaiseLocalEvent(args.Caster.Value, manaEv);
|
||||
var manaEv = new CP14CalculateManacostEvent(caster, ent.Comp.ManaCost, ent.Comp.MagicType);
|
||||
RaiseLocalEvent(caster, manaEv);
|
||||
|
||||
if (TryComp<CP14ProvidedBySpellStorageComponent>(ent, out var provided) && provided.SpellStorage is not null)
|
||||
RaiseLocalEvent(provided.SpellStorage.Value, manaEv);
|
||||
|
||||
manaCost = manaEv.GetManacost();
|
||||
}
|
||||
|
||||
_magicEnergy.TryConsumeEnergy(args.Caster.Value, manaCost, safe: ent.Comp.Safe);
|
||||
return manaCost;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user