summaryrefslogtreecommitdiff
path: root/sw-engine/src
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-26 02:39:20 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-26 02:40:44 +0200
commitd26ecccf690d33c3cf71412395a257ebb40d29e7 (patch)
tree70349cd50bd5812e0895af11c536fb096472e2da /sw-engine/src
parentFix player positions in lobby (diff)
downloadseven-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/src')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt8
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>> {
bgstack15