| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-03-12 17:55:25 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-03-12 17:55:25 +0100 | 
| commit | 68cfa3b73e6f7def9641b08c4acf2f0f96685843 (patch) | |
| tree | 5d6bbe4b6f1e777235fcc1235060b5101ca46c4d /src/struct/battle.erl | |
| parent | 11a7a03a0088b2c4b8edc394469396d54190dc53 (diff) | |
Stores and sends entire turn timelines.
Diffstat (limited to 'src/struct/battle.erl')
| -rw-r--r-- | src/struct/battle.erl | 23 | 
1 files changed, 20 insertions, 3 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) -> | 


