using System.Numerics;
using Content.Shared.Alert;
using Content.Shared.FixedPoint;
using Content.Shared.Store;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Revenant.Components;
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState]
public sealed partial class RevenantComponent : Component
{
///
/// The total amount of Essence the revenant has. Functions
/// as health and is regenerated.
///
[DataField, AutoNetworkedField]
public FixedPoint2 Essence = 75;
[DataField]
public ProtoId StolenEssenceCurrencyPrototype = "StolenEssence";
///
/// Prototype to spawn when the entity dies.
///
[DataField]
public EntProtoId SpawnOnDeathPrototype = "Ectoplasm";
///
/// The entity's current max amount of essence. Can be increased
/// through harvesting player souls.
///
[DataField("maxEssence")]
public FixedPoint2 EssenceRegenCap = 75;
///
/// The coefficient of damage taken to actual health lost.
///
[DataField]
public float DamageToEssenceCoefficient = 0.75f;
///
/// The amount of essence passively generated per second.
///
[DataField]
public FixedPoint2 EssencePerSecond = 0.5f;
[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
///
[DataField]
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.
///
[DataField]
public Vector2 HarvestDebuffs = new(5, 5);
///
/// The amount that is given to the revenant each time it's max essence is upgraded.
///
[DataField]
public float MaxEssenceUpgradeAmount = 10;
#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.
///
[DataField]
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.
///
[DataField]
public Vector2 DefileDebuffs = new(1, 4);
///
/// The radius around the user that this ability affects
///
[DataField]
public float DefileRadius = 3.5f;
///
/// The amount of tiles that are uprooted by the ability
///
[DataField]
public int DefileTilePryAmount = 15;
///
/// The chance that an individual entity will have any of the effects
/// happen to it.
///
[DataField]
public float DefileEffectChance = 0.5f;
#endregion
#region Overload Lights Ability
///
/// The amount of essence that is needed to use the ability.
///
[DataField]
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.
///
[DataField]
public Vector2 OverloadDebuffs = new(3, 8);
///
/// The radius around the user that this ability affects
///
[DataField]
public float OverloadRadius = 5f;
///
/// How close to the light the entity has to be in order to be zapped.
///
[DataField]
public float OverloadZapRadius = 2f;
#endregion
#region Blight Ability
///
/// The amount of essence that is needed to use the ability.
///
[DataField]
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.
///
[DataField]
public Vector2 BlightDebuffs = new(2, 5);
///
/// The radius around the user that this ability affects
///
[DataField]
public float BlightRadius = 3.5f;
#endregion
#region Malfunction Ability
///
/// The amount of essence that is needed to use the ability.
///
[DataField]
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.
///
[DataField]
public Vector2 MalfunctionDebuffs = new(2, 8);
///
/// The radius around the user that this ability affects
///
[DataField]
public float MalfunctionRadius = 3.5f;
///
/// Whitelist for entities that can be emagged by malfunction.
/// Used to prevent ultra gamer things like ghost emagging chem or instantly launching the shuttle.
///
[DataField]
public EntityWhitelist? MalfunctionWhitelist;
///
/// Whitelist for entities that can never be emagged by malfunction.
///
[DataField]
public EntityWhitelist? MalfunctionBlacklist;
#endregion
[DataField]
public ProtoId EssenceAlert = "Essence";
#region Visualizer
[DataField]
public string State = "idle";
[DataField]
public string CorporealState = "active";
[DataField]
public string StunnedState = "stunned";
[DataField]
public string HarvestingState = "harvesting";
#endregion
///
/// The scaling for passively chilling surroundings.
///
[DataField]
public FixedPoint2 ChillScaling = 7000;
///
/// The upper limit for essence when passively chilling surroundings.
/// Beyond this point, more essence will not cause more chilling.
///
[DataField]
public FixedPoint2 ChillUpperBound = 500;
}