summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-03-03 20:28:46 +0100 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-03-03 20:28:46 +0100 |
commit | 99fcad8cbe31ba23d9c079b62e8a174c5b3ddf1b (patch) | |
tree | 440318ff35360271f32708afab0c3ee696053c66 /src/struct | |
parent | dc119102df0076e45ee6c484e361c3fff3e6e2dd (diff) |
Fixing stuff that made Dialyzer output warnings.
Diffstat (limited to 'src/struct')
-rw-r--r-- | src/struct/battle.erl | 2 | ||||
-rw-r--r-- | src/struct/battle_action.erl | 22 | ||||
-rw-r--r-- | src/struct/battlemap.erl | 2 | ||||
-rw-r--r-- | src/struct/character.erl | 2 | ||||
-rw-r--r-- | src/struct/statistics.erl | 2 |
5 files changed, 18 insertions, 12 deletions
diff --git a/src/struct/battle.erl b/src/struct/battle.erl index bfa0e8d..4ee3b51 100644 --- a/src/struct/battle.erl +++ b/src/struct/battle.erl @@ -3,7 +3,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --opaque id() :: binary(). +-type id() :: binary(). -record ( 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 }. diff --git a/src/struct/battlemap.erl b/src/struct/battlemap.erl index 9204084..59e0639 100644 --- a/src/struct/battlemap.erl +++ b/src/struct/battlemap.erl @@ -3,7 +3,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --opaque id() :: binary(). +-type id() :: binary(). -record ( diff --git a/src/struct/character.erl b/src/struct/character.erl index 96660ee..8e1099e 100644 --- a/src/struct/character.erl +++ b/src/struct/character.erl @@ -3,7 +3,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --opaque id() :: non_neg_integer(). +-type id() :: non_neg_integer(). -record ( diff --git a/src/struct/statistics.erl b/src/struct/statistics.erl index f3d78a8..6e29ea4 100644 --- a/src/struct/statistics.erl +++ b/src/struct/statistics.erl @@ -69,7 +69,7 @@ float_to_int (F) -> ceil(F). min_max (Min, Max, V) -> min(Max, max(Min, V)). -spec average (list(number())) -> number(). -average ([]) -> 0; +%average ([]) -> 0; average (L) -> lists:sum(L) / length(L). % V | 010 | 030 | 050 | 070 | 100 | |