summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-08-28 23:29:55 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-08-28 23:29:55 +0200
commit9b424b11dbea33a41b2129daf232557515de9db1 (patch)
tree97cbe449c02e4273c79448859ceac722a06524b1 /src/battle/reply/btl_add_char.erl
parent68d3f1d7fd3703a8aef68bd6e9f89a84eab5e539 (diff)
Still propagating the changes...
It'll require the attributes and statistics being recalculated every time a character is used, which isn't great. Can't exactly avoid it though: moving and changing weapon are both likely to alter them, and people rarely attack without doing one or the other.
Diffstat (limited to 'src/battle/reply/btl_add_char.erl')
-rw-r--r--src/battle/reply/btl_add_char.erl25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/battle/reply/btl_add_char.erl b/src/battle/reply/btl_add_char.erl
index f0b70e9..a6fb60c 100644
--- a/src/battle/reply/btl_add_char.erl
+++ b/src/battle/reply/btl_add_char.erl
@@ -20,23 +20,6 @@ rank_to_string (Rank) ->
commander -> <<"c">>
end.
--spec attributes_as_json
- (
- shr_attributes:type()
- ) ->
- {list({binary(), non_neg_integer()})}.
-attributes_as_json (Attributes) ->
- {
- [
- {<<"con">>, shr_attributes:get_constitution(Attributes)},
- {<<"dex">>, shr_attributes:get_dexterity(Attributes)},
- {<<"int">>, shr_attributes:get_intelligence(Attributes)},
- {<<"min">>, shr_attributes:get_mind(Attributes)},
- {<<"spe">>, shr_attributes:get_speed(Attributes)},
- {<<"str">>, shr_attributes:get_strength(Attributes)}
- ]
- }.
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -48,7 +31,6 @@ attributes_as_json (Attributes) ->
)
-> {list(any())}.
generate (IX, Character, PlayerIX) ->
- Attributes = btl_character:get_attributes(Character),
{ActiveWeapon, SecondaryWeapon} = btl_character:get_weapon_ids(Character),
CharacterPlayerIX = btl_character:get_player_index(Character),
Location = btl_character:get_location(Character),
@@ -75,9 +57,12 @@ generate (IX, Character, PlayerIX) ->
)
},
{<<"dea">>, btl_character:get_is_defeated(Character)},
- {<<"att">>, attributes_as_json(Attributes)},
{<<"awp">>, ActiveWeapon},
{<<"swp">>, SecondaryWeapon},
- {<<"ar">>, btl_character:get_armor_id(Character)}
+ {<<"ar">>, btl_character:get_armor_id(Character)},
+ {
+ <<"pomni">>,
+ shr_omnimods:encode(btl_character:get_permanent_omnimods(Character))
+ }
]
}.