summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
+ )
+ }
+ ]
}.