summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-03-03 20:28:46 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-03-03 20:28:46 +0100
commit99fcad8cbe31ba23d9c079b62e8a174c5b3ddf1b (patch)
tree440318ff35360271f32708afab0c3ee696053c66 /src/struct/battle_action.erl
parentdc119102df0076e45ee6c484e361c3fff3e6e2dd (diff)
Fixing stuff that made Dialyzer output warnings.
Diffstat (limited to 'src/struct/battle_action.erl')
-rw-r--r--src/struct/battle_action.erl22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/struct/battle_action.erl b/src/struct/battle_action.erl
index c1bccc7..755b771 100644
--- a/src/struct/battle_action.erl
+++ b/src/struct/battle_action.erl
@@ -63,7 +63,13 @@ decode_atk_action (JSONMap) ->
decode_swp_action (_JSONMap) ->
#switch_weapon{}.
-
+-spec handle_attack_sequence
+ (
+ character_instance:struct(),
+ character_instance:struct(),
+ list(attack:attack_order_with_pary())
+ )
+ -> {list(attack:attack_desc()), non_neg_integer(), non_neg_integer()}.
handle_attack_sequence
(
CharacterInstance,
@@ -124,7 +130,7 @@ handle_attack_sequence
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec decode (binary()) -> struct().
+-spec decode (map()) -> struct().
decode (EncodedAction) ->
JSONActionMap = EncodedAction, %jiffy:decode(EncodedAction, [return_maps]),
ActionType = maps:get(<<"t">>, JSONActionMap),
@@ -185,8 +191,8 @@ when is_record(BattleAction, switch_weapon) ->
[
{switched_weapons, CharacterInstanceIX}
],
- UpdatedCharacterInstance,
- Battle
+ Battle,
+ UpdatedCharacterInstance
};
handle (Battle, CharacterInstance, CharacterInstanceIX, BattleAction)
when is_record(BattleAction, move) ->
@@ -231,8 +237,8 @@ when is_record(BattleAction, move) ->
[
{moved, Path, NewLocation}
],
- UpdatedCharacterInstance,
- Battle
+ Battle,
+ UpdatedCharacterInstance
};
handle (Battle, CharacterInstance, _CharacterInstanceIX, BattleAction)
when is_record(BattleAction, attack) ->
@@ -288,6 +294,6 @@ when is_record(BattleAction, attack) ->
[], % TODO
% TODO: hide that into turn_result structs.
AttackEffects,
- UpdatedCharacterInstance,
- UpdatedBattle
+ UpdatedBattle,
+ UpdatedCharacterInstance
}.