summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-05-26 12:07:33 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-05-26 12:07:33 +0200
commit8b0c3fbc2ff79e2223a28d2fbdf4ffe8b8ff1887 (patch)
treebbf3be71b70091aeb245fd9efd3f4ef5a34b0542 /src/battle/struct/btl_character.erl
parent421de60ec7e969705bef68780507f1fc384f179c (diff)
...
Diffstat (limited to 'src/battle/struct/btl_character.erl')
-rw-r--r--src/battle/struct/btl_character.erl29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/battle/struct/btl_character.erl b/src/battle/struct/btl_character.erl
index 41f5535..15f9987 100644
--- a/src/battle/struct/btl_character.erl
+++ b/src/battle/struct/btl_character.erl
@@ -635,8 +635,13 @@ get_conditions_field () -> #btl_char_ref.conditions.
-spec get_status_indicators_field() -> non_neg_integer().
get_status_indicators_field () -> #btl_char_ref.status_indicators.
--spec encode_for (non_neg_integer(), unresolved()) -> {list({binary(), any()})}.
-encode_for (RequestingPlayerIX, CharRef) ->
+-spec encode_for (non_neg_integer(), either()) -> {list({binary(), any()})}.
+encode_for
+ (
+ RequestingPlayerIX,
+ CharRef
+ )
+ when is_record(CharRef, btl_char_ref) ->
{
[
{?PLAYER_IX_FIELD, CharRef#btl_char_ref.player_ix},
@@ -655,4 +660,24 @@ encode_for (RequestingPlayerIX, CharRef) ->
)
}
]
+ };
+encode_for (RequestingPlayerIX, Char) ->
+ {
+ [
+ {?PLAYER_IX_FIELD, Char#btl_char.player_ix},
+ {?LOCATION_FIELD, shr_location:encode(Char#btl_char.location)},
+ {?CURRENT_HEALTH_FIELD, Char#btl_char.current_health},
+ {?SKILL_POINTS_FIELD, Char#btl_char.skill_points},
+ {?IS_ACTIVE_FIELD, Char#btl_char.is_active},
+ {?IS_DEFEATED_FIELD, Char#btl_char.is_defeated},
+ {?BASE_CHAR_FIELD, shr_character:encode(Char#btl_char.base)},
+ {
+ ?STATUS_INDICATORS,
+ btl_status_indicators:encode_for
+ (
+ RequestingPlayerIX,
+ Char#btl_char.status_indicators
+ )
+ }
+ ]
}.