| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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;
- }
- }
|