summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battlemap/reply/bm_add_char.erl7
-rw-r--r--src/battlemap/struct/bm_attack.erl9
-rw-r--r--src/battlemap/struct/bm_character.erl4
3 files changed, 7 insertions, 13 deletions
diff --git a/src/battlemap/reply/bm_add_char.erl b/src/battlemap/reply/bm_add_char.erl
index 227c93a..d7b76c3 100644
--- a/src/battlemap/reply/bm_add_char.erl
+++ b/src/battlemap/reply/bm_add_char.erl
@@ -40,15 +40,10 @@ attributes_as_json (Attributes) ->
)
-> {list(any())}.
generate (IX, Character, PlayerID) ->
- IsAlive = bm_character:get_is_alive(Character),
Attributes = bm_character:get_attributes(Character),
{ActiveWeapon, SecondaryWeapon} = bm_character:get_weapon_ids(Character),
OwnerID = bm_character:get_owner_id(Character),
- Location =
- case IsAlive of
- true -> bm_character:get_location(Character);
- _ -> bm_location:get_nowhere()
- end,
+ Location = bm_character:get_location(Character),
{
[
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.