summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/struct')
-rw-r--r-- | src/struct/battle.erl | 23 | ||||
-rw-r--r-- | src/struct/player.erl | 2 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/struct/battle.erl b/src/struct/battle.erl index d668bbb..bf2b010 100644 --- a/src/struct/battle.erl +++ b/src/struct/battle.erl @@ -56,6 +56,18 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +get_all_timelines (Result, CurrentIndex, EndPoint, ArraySize, Players) -> + Player = array:get(CurrentIndex, Players), + Timeline = player:get_timeline(Player), + NextIndex = ((CurrentIndex + 1) rem ArraySize), + NextResult = (Result ++ Timeline), + case CurrentIndex of + EndPoint -> + NextResult; + + _ -> + get_all_timelines(NextResult, NextIndex, EndPoint, ArraySize, Players) + end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -91,9 +103,14 @@ get_current_player_turn (Battle) -> Battle#battle.current_player_turn. -spec get_encoded_last_turns_effects (struct()) -> list(any()). -get_encoded_last_turns_effects (_Battle) -> - % TODO - []. +get_encoded_last_turns_effects (Battle) -> + CurrentPlayerTurn = Battle#battle.current_player_turn, + Players = Battle#battle.players, + CurrentPlayerIX = player_turn:get_player_ix(CurrentPlayerTurn), + + PlayersCount = array:size(Players), + StartingPoint = ((CurrentPlayerIX + 1) rem PlayersCount), + get_all_timelines([], StartingPoint, CurrentPlayerIX, PlayersCount, Players). -spec set_battlemap (battlemap:struct(), struct()) -> struct(). set_battlemap (Battlemap, Battle) -> diff --git a/src/struct/player.erl b/src/struct/player.erl index 824e474..857906e 100644 --- a/src/struct/player.erl +++ b/src/struct/player.erl @@ -3,7 +3,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --type id() :: string(). +-type id() :: binary(). -record ( |