using Content.Shared.Disease; using Content.Shared.Revenant; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using System.Threading; using Content.Shared.FixedPoint; using Content.Shared.Store; namespace Content.Server.Revenant; [RegisterComponent] public sealed class RevenantComponent : SharedRevenantComponent { /// /// The total amount of Essence the revenant has. Functions /// as health and is regenerated. /// [ViewVariables(VVAccess.ReadWrite)] public FixedPoint2 Essence = 75; [DataField("stolenEssenceCurrencyPrototype", customTypeSerializer: typeof(PrototypeIdSerializer))] public string StolenEssenceCurrencyPrototype = "StolenEssence"; /// /// The entity's current max amount of essence. Can be increased /// through harvesting player souls. /// [ViewVariables(VVAccess.ReadWrite), DataField("maxEssence")] public FixedPoint2 EssenceRegenCap = 75; /// /// The coefficient of damage taken to actual health lost. /// [ViewVariables(VVAccess.ReadWrite), DataField("damageToEssenceCoefficient")] public float DamageToEssenceCoefficient = 1f; /// /// The amount of essence passively generated per second. /// [ViewVariables(VVAccess.ReadWrite), DataField("essencePerSecond")] public FixedPoint2 EssencePerSecond = 0.25f; [ViewVariables] public float Accumulator = 0; // Here's the gist of the harvest ability: // Step 1: The revenant clicks on an entity to "search" for it's soul, which creates a doafter. // Step 2: After the doafter is completed, the soul is "found" and can be harvested. // Step 3: Clicking the entity again begins to harvest the soul, which causes the revenant to become vulnerable // Step 4: The second doafter for the harvest completes, killing the target and granting the revenant essence. #region Harvest Ability /// /// The duration of the soul search /// [ViewVariables, DataField("soulSearchDuration")] public float SoulSearchDuration = 2.5f; /// /// The status effects applied after the ability /// the first float corresponds to amount of time the entity is stunned. /// the second corresponds to the amount of time the entity is made solid. /// [ViewVariables, DataField("harvestDebuffs")] public Vector2 HarvestDebuffs = (5, 5); /// /// The amount that is given to the revenant each time it's max essence is upgraded. /// [ViewVariables(VVAccess.ReadWrite), DataField("maxEssenceUpgradeAmount")] public float MaxEssenceUpgradeAmount = 10; public CancellationTokenSource? SoulSearchCancelToken; public CancellationTokenSource? HarvestCancelToken; #endregion //In the nearby radius, causes various objects to be thrown, messed with, and containers opened //Generally just causes a mess #region Defile Ability /// /// The amount of essence that is needed to use the ability. /// [ViewVariables(VVAccess.ReadWrite), DataField("defileCost")] public FixedPoint2 DefileCost = -30; /// /// The status effects applied after the ability /// the first float corresponds to amount of time the entity is stunned. /// the second corresponds to the amount of time the entity is made solid. /// [ViewVariables, DataField("defileDebuffs")] public Vector2 DefileDebuffs = (1, 4); /// /// The radius around the user that this ability affects /// [ViewVariables(VVAccess.ReadWrite), DataField("defileRadius")] public float DefileRadius = 3.5f; /// /// The amount of tiles that are uprooted by the ability /// [ViewVariables(VVAccess.ReadWrite), DataField("defileTilePryAmount")] public int DefileTilePryAmount = 15; /// /// The chance that an individual entity will have any of the effects /// happen to it. /// [ViewVariables(VVAccess.ReadWrite), DataField("defileEffectChance")] public float DefileEffectChance = 0.5f; #endregion #region Overload Lights Ability /// /// The amount of essence that is needed to use the ability. /// [ViewVariables(VVAccess.ReadWrite), DataField("overloadCost")] public FixedPoint2 OverloadCost = -40; /// /// The status effects applied after the ability /// the first float corresponds to amount of time the entity is stunned. /// the second corresponds to the amount of time the entity is made solid. /// [ViewVariables, DataField("overloadDebuffs")] public Vector2 OverloadDebuffs = (3, 8); /// /// The radius around the user that this ability affects /// [ViewVariables(VVAccess.ReadWrite), DataField("overloadRadius")] public float OverloadRadius = 3.5f; /// /// The chance that each light in the radius of the ability will break and explode. /// [ViewVariables(VVAccess.ReadWrite), DataField("overloadBreakChance")] public float OverloadBreakChance = 0.5f; #endregion #region Blight Ability /// /// The amount of essence that is needed to use the ability. /// [ViewVariables(VVAccess.ReadWrite), DataField("blightCost")] public float BlightCost = -50; /// /// The status effects applied after the ability /// the first float corresponds to amount of time the entity is stunned. /// the second corresponds to the amount of time the entity is made solid. /// [ViewVariables, DataField("blightDebuffs")] public Vector2 BlightDebuffs = (2, 5); /// /// The radius around the user that this ability affects /// [ViewVariables(VVAccess.ReadWrite), DataField("blightRadius")] public float BlightRadius = 3.5f; /// /// The disease that is given to the victims of the ability. /// [ViewVariables(VVAccess.ReadWrite), DataField("blightDiseasePrototypeId", customTypeSerializer: typeof(PrototypeIdSerializer))] public string BlightDiseasePrototypeId = "SpectralTiredness"; #endregion #region Malfunction Ability /// /// The amount of essence that is needed to use the ability. /// [ViewVariables(VVAccess.ReadWrite), DataField("malfunctionCost")] public FixedPoint2 MalfunctionCost = -60; /// /// The status effects applied after the ability /// the first float corresponds to amount of time the entity is stunned. /// the second corresponds to the amount of time the entity is made solid. /// [ViewVariables, DataField("malfunctionDebuffs")] public Vector2 MalfunctionDebuffs = (2, 8); /// /// The radius around the user that this ability affects /// [ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")] public float MalfunctionRadius = 3.5f; #endregion } public sealed class SoulSearchDoAfterComplete : EntityEventArgs { public readonly EntityUid Target; public SoulSearchDoAfterComplete(EntityUid target) { Target = target; } } public sealed class SoulSearchDoAfterCancelled : EntityEventArgs { } public sealed class HarvestDoAfterComplete : EntityEventArgs { public readonly EntityUid Target; public HarvestDoAfterComplete(EntityUid target) { Target = target; } } public sealed class HarvestDoAfterCancelled : EntityEventArgs { }