From 956b8f5c8249834af3f27e120344889351595041 Mon Sep 17 00:00:00 2001 From: henriquenakashima Date: Sat, 26 Sep 2020 18:28:08 -0400 Subject: [PATCH] Dead participants don't get block --- Assets/Battle/BattleParticipant.cs | 20 ++++++++++++++++++++ TODO.txt | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Assets/Battle/BattleParticipant.cs b/Assets/Battle/BattleParticipant.cs index 977b6b9..2255095 100644 --- a/Assets/Battle/BattleParticipant.cs +++ b/Assets/Battle/BattleParticipant.cs @@ -44,6 +44,10 @@ public class BattleParticipant } public int DealDamage(int damage) { + if (!IsAlive()) { + return 0; + } + int blockedDamage = Math.Min(damage, this.block); if (blockedDamage > 0) { this.block -= blockedDamage; @@ -56,6 +60,10 @@ public class BattleParticipant } public void CheckState() { + if (!IsAlive()) { + return; + } + if (this.hp <= 0) { this.dead = true; WipeStatus(); @@ -74,10 +82,18 @@ public class BattleParticipant } public void AddBlock(int block) { + if (!IsAlive()) { + return; + } + this.block += block; } public void ResetBlock() { + if (!IsAlive()) { + return; + } + this.block = 0; } @@ -90,6 +106,10 @@ public class BattleParticipant } public void IncreaseMaxHP(int amount) { + if (!IsAlive()) { + return; + } + this.maxHP += amount; if (this.hp > 0) { this.hp += amount; diff --git a/TODO.txt b/TODO.txt index d09279a..0b576fb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -5,5 +5,5 @@ - Show on who enemies will use the cards - Extend BattleState to be more than hero turn true/false - Remove UI from dead participants -- Dead participants do not get block -- GolemCharge art \ No newline at end of file +- GolemCharge art +- Create BattleInput \ No newline at end of file