* 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 * some funny shit * fix problems 1 * FIX * more funny broken shit * predict slowdown, fixes funny * EntityTarget action * fixes * Update T1_sphere_of_light.yml * fix demiplan loot centering * predict movement!
100 lines
2.8 KiB
C#
100 lines
2.8 KiB
C#
using Content.Shared._CP14.MagicRitual.Prototypes;
|
|
using Content.Shared.FixedPoint;
|
|
using Content.Shared.Inventory;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared._CP14.MagicSpell.Events;
|
|
|
|
/// <summary>
|
|
/// Called first to verify that all conditions are met and the spell can be performed.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public sealed class CP14CastMagicEffectAttemptEvent : CancellableEntityEventArgs
|
|
{
|
|
/// <summary>
|
|
/// The Performer of the event, to check if they meet the requirements.
|
|
/// </summary>
|
|
public EntityUid Performer { get; init; }
|
|
|
|
public string Reason = string.Empty;
|
|
|
|
public CP14CastMagicEffectAttemptEvent(EntityUid performer)
|
|
{
|
|
Performer = performer;
|
|
}
|
|
|
|
public void PushReason(string reason)
|
|
{
|
|
Reason += $"{reason}\n";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// An event that checks all sorts of conditions, and calculates the total cost of casting a spell. Called before the spell is cast.
|
|
/// </summary>
|
|
/// <remarks>TODO: This call is duplicated at the beginning of the cast for checks, and at the end of the cast for mana subtraction.</remarks>
|
|
public sealed class CP14CalculateManacostEvent : EntityEventArgs, IInventoryRelayEvent
|
|
{
|
|
public FixedPoint2 Manacost = 0f;
|
|
|
|
public float Multiplier = 1f;
|
|
public EntityUid Performer;
|
|
public ProtoId<CP14MagicTypePrototype>? MagicType;
|
|
|
|
public CP14CalculateManacostEvent(EntityUid performer, FixedPoint2 initialManacost, ProtoId<CP14MagicTypePrototype>? magicType)
|
|
{
|
|
Performer = performer;
|
|
Manacost = initialManacost;
|
|
MagicType = magicType;
|
|
}
|
|
|
|
public float GetManacost()
|
|
{
|
|
return (float)Manacost * Multiplier;
|
|
}
|
|
|
|
public SlotFlags TargetSlots { get; } = SlotFlags.All;
|
|
}
|
|
|
|
/// <summary>
|
|
/// is invoked if all conditions are met and the spell has begun to be cast (doAfter start moment)
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public sealed class CP14StartCastMagicEffectEvent : EntityEventArgs
|
|
{
|
|
public EntityUid Performer { get; init; }
|
|
|
|
public CP14StartCastMagicEffectEvent(EntityUid performer)
|
|
{
|
|
Performer = performer;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// is invoked on the spell itself when the spell process has been completed or interrupted (doAfter end moment)
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public sealed class CP14EndCastMagicEffectEvent : EntityEventArgs
|
|
{
|
|
public EntityUid Performer { get; init; }
|
|
|
|
public CP14EndCastMagicEffectEvent(EntityUid performer)
|
|
{
|
|
Performer = performer;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// is invoked only if the spell has been successfully cast
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public sealed class CP14AfterCastMagicEffectEvent : EntityEventArgs
|
|
{
|
|
public EntityUid? Performer { get; init; }
|
|
|
|
public CP14AfterCastMagicEffectEvent(EntityUid? performer)
|
|
{
|
|
Performer = performer;
|
|
}
|
|
}
|