Files
tbd-station-14/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.Fighter.cs
2023-06-15 21:25:25 +10:00

69 lines
1.8 KiB
C#

namespace Content.Server.Arcade.SpaceVillain;
public sealed partial class SpaceVillainGame
{
/// <summary>
/// A state holder for the fighters in the SpaceVillain game.
/// </summary>
public sealed class Fighter
{
/// <summary>
/// The current hit point total of the fighter.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public int Hp
{
get => _hp;
set => _hp = MathHelper.Clamp(value, 0, HpMax);
}
private int _hp;
/// <summary>
/// The maximum hit point total of the fighter.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public int HpMax
{
get => _hpMax;
set
{
_hpMax = Math.Max(value, 0);
Hp = MathHelper.Clamp(Hp, 0, HpMax);
}
}
private int _hpMax;
/// <summary>
/// The current mana total of the fighter.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public int Mp
{
get => _mp;
set => _mp = MathHelper.Clamp(value, 0, MpMax);
}
private int _mp;
/// <summary>
/// The maximum mana total of the fighter.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public int MpMax
{
get => _mpMax;
set
{
_mpMax = Math.Max(value, 0);
Mp = MathHelper.Clamp(Mp, 0, MpMax);
}
}
private int _mpMax;
/// <summary>
/// Whether the given fighter can take damage/lose mana.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool Invincible = false;
}
}