From d26ecccf690d33c3cf71412395a257ebb40d29e7 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Tue, 26 May 2020 02:39:20 +0200 Subject: Add other players' board summary Resolves: https://github.com/joffrey-bion/seven-wonders/issues/21 --- .../kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sw-engine') 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() } + .sumBy { it.points } ) internal fun List.toColumns(): List> { -- cgit