summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battlemap/struct')
-rw-r--r-- | src/battlemap/struct/bm_attack.erl | 9 | ||||
-rw-r--r-- | src/battlemap/struct/bm_character.erl | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/battlemap/struct/bm_attack.erl b/src/battlemap/struct/bm_attack.erl index af55606..ce3af53 100644 --- a/src/battlemap/struct/bm_attack.erl +++ b/src/battlemap/struct/bm_attack.erl @@ -201,14 +201,14 @@ when Damage = Attack#attack.damage, case AttackerHealth of - 0 -> + N when (N =< 0) -> {nothing, AttackerHealth, DefenderHealth}; _ -> { Attack, AttackerHealth, - max(0, (DefenderHealth - Damage)) + (DefenderHealth - Damage) } end; apply_to_healths @@ -228,14 +228,15 @@ when ) -> Damage = Attack#attack.damage, + %% This actually allows you to parry the counter of a dead character. case DefenderHealth of - 0 -> + N when (N =< 0) -> {nothing, AttackerHealth, DefenderHealth}; _ -> { Attack, - max(0, (AttackerHealth - Damage)), + (AttackerHealth - Damage), DefenderHealth } end. diff --git a/src/battlemap/struct/bm_character.erl b/src/battlemap/struct/bm_character.erl index d3a762c..1fbd3b1 100644 --- a/src/battlemap/struct/bm_character.erl +++ b/src/battlemap/struct/bm_character.erl @@ -130,9 +130,7 @@ get_weapon_ids (Char) -> Char#character.weapon_ids. get_statistics (Char) -> Char#character.statistics. -spec get_location (type()) -> {non_neg_integer(), non_neg_integer()}. -get_location (Char) -> - true = get_is_alive(Char), - Char#character.location. +get_location (Char) -> Char#character.location. -spec get_current_health (type()) -> integer(). get_current_health (Char) -> Char#character.current_health. |