feat: change death logic

This commit is contained in:
Иванов Иван
2024-08-21 15:00:17 +02:00
parent ad7a4c3074
commit 4e2e108076
8 changed files with 64 additions and 12 deletions

View File

@@ -11,13 +11,15 @@ namespace Client.Domain.ValueObjects
private uint maxMp;
private uint cp;
private uint maxCp;
private bool isDead;
public uint Hp { get => hp; set { if (value != hp) { hp = value; OnPropertyChanged(); OnPropertyChanged("MaxHp"); OnPropertyChanged("IsDead"); } } }
public uint MaxHp { get => Math.Max(hp, maxHp); set { if (value != maxHp) { maxHp = value; OnPropertyChanged(); OnPropertyChanged("IsDead"); } } }
public uint Hp { get => hp; set { if (value != hp) { hp = value; OnPropertyChanged(); OnPropertyChanged("MaxHp"); } } }
public uint MaxHp { get => Math.Max(hp, maxHp); set { if (value != maxHp) { maxHp = value; OnPropertyChanged(); } } }
public uint Mp { get => mp; set { if (value != mp) { mp = value; OnPropertyChanged(); } } }
public uint MaxMp { get => maxMp; set { if (value != maxMp) { maxMp = value; OnPropertyChanged(); } } }
public uint Cp { get => cp; set { if (value != cp) { cp = value; OnPropertyChanged(); } } }
public uint MaxCp { get => maxCp; set { if (value != maxCp) { maxCp = value; OnPropertyChanged(); } } }
public bool IsDead { get => isDead; set { if (value != isDead) { isDead = value; OnPropertyChanged(); } } }
public double HpPercent
{
@@ -41,9 +43,7 @@ namespace Client.Domain.ValueObjects
}
}
public bool IsDead => MaxHp > 0 && hp == 0;
public VitalStats(uint hp, uint maxHp, uint mp, uint maxMp, uint cp, uint maxCp)
public VitalStats(uint hp, uint maxHp, uint mp, uint maxMp, uint cp, uint maxCp, bool isDead)
{
this.hp = hp;
this.maxHp = maxHp;
@@ -51,6 +51,7 @@ namespace Client.Domain.ValueObjects
this.maxMp = maxMp;
this.cp = cp;
this.maxCp = maxCp;
this.isDead = isDead;
}
}
}