diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-26 02:39:20 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-26 02:40:44 +0200 |
commit | d26ecccf690d33c3cf71412395a257ebb40d29e7 (patch) | |
tree | 70349cd50bd5812e0895af11c536fb096472e2da /sw-engine | |
parent | Fix player positions in lobby (diff) | |
download | seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.tar.gz seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.tar.bz2 seven-wonders-d26ecccf690d33c3cf71412395a257ebb40d29e7.zip |
Add other players' board summary
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/21
Diffstat (limited to 'sw-engine')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt index efb2613e..c974c25f 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt @@ -2,9 +2,11 @@ package org.luxons.sevenwonders.engine.converters import org.luxons.sevenwonders.engine.Player import org.luxons.sevenwonders.engine.boards.ScienceType +import org.luxons.sevenwonders.engine.effects.RawPointsIncrease import org.luxons.sevenwonders.engine.moves.Move import org.luxons.sevenwonders.engine.resources.Resources import org.luxons.sevenwonders.model.MoveType +import org.luxons.sevenwonders.model.cards.Color import org.luxons.sevenwonders.model.cards.TableCard import org.luxons.sevenwonders.model.resources.CountedResource import org.luxons.sevenwonders.engine.boards.Board as InternalBoard @@ -31,7 +33,11 @@ internal fun InternalBoard.toApiBoard(player: Player, lastMove: Move?): ApiBoard science = science.toApiScience(), military = military.toApiMilitary(), playedCards = getPlayedCards().map { it.toTableCard(lastMove) }.toColumns(), - gold = gold + gold = gold, + bluePoints = getPlayedCards() + .filter { it.color == Color.BLUE } + .flatMap { it.effects.filterIsInstance<RawPointsIncrease>() } + .sumBy { it.points } ) internal fun List<TableCard>.toColumns(): List<List<TableCard>> { |