DealDamageEffect know how much was really dealt

This commit is contained in:
henriquenakashima 2020-09-19 22:58:23 -04:00
parent 8423a2a87a
commit 169210efbe
4 changed files with 15 additions and 7 deletions

View file

@ -31,14 +31,15 @@ public class BattleParticipant
return this.maxHP;
}
public void DealDamage(int damage) {
public int DealDamage(int damage) {
int blockedDamage = Math.Min(damage, this.block);
if (blockedDamage > 0) {
this.block -= blockedDamage;
damage -= blockedDamage;
}
damage = Math.Min(this.hp, damage);
this.hp -= damage;
if (this.hp < 0) this.hp = 0;
return damage;
}
public void AddBlock(int block) {