using Content.Shared.Ninja.Systems;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Ninja.Components;
///
/// Component for stunning mobs on click outside of harm mode.
/// Knocks them down for a bit and deals shock damage.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedStunProviderSystem))]
public sealed partial class StunProviderComponent : Component
{
///
/// The powercell entity to take power from.
/// Determines whether stunning is possible.
///
[DataField("batteryUid"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public EntityUid? BatteryUid;
///
/// Sound played when stunning someone.
///
[DataField("sound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier Sound = new SoundCollectionSpecifier("sparks");
///
/// Joules required in the battery to stun someone. Defaults to 10 uses on a small battery.
///
[DataField("stunCharge"), ViewVariables(VVAccess.ReadWrite)]
public float StunCharge = 36.0f;
///
/// Shock damage dealt when stunning someone
///
[DataField("stunDamage"), ViewVariables(VVAccess.ReadWrite)]
public int StunDamage = 5;
///
/// Time that someone is stunned for, stacks if done multiple times.
///
[DataField("stunTime"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan StunTime = TimeSpan.FromSeconds(5);
///
/// How long stunning is disabled after stunning something.
///
[DataField("cooldown"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Cooldown = TimeSpan.FromSeconds(2);
///
/// Locale string to popup when there is no power
///
[DataField("noPowerPopup", required: true), ViewVariables(VVAccess.ReadWrite)]
public string NoPowerPopup = string.Empty;
///
/// Whitelist for what counts as a mob.
///
[DataField("whitelist")]
public EntityWhitelist Whitelist = new()
{
Components = new[] {"Stamina"}
};
///
/// When someone can next be stunned.
/// Essentially a UseDelay unique to this component.
///
[DataField("nextStun", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextStun = TimeSpan.Zero;
}