DealDamageEffect know how much was really dealt
This commit is contained in:
parent
8423a2a87a
commit
169210efbe
4 changed files with 15 additions and 7 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue