From 6a91cb4afa645ca0c1712433e212fb654a68da06 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Tue, 16 Feb 2021 01:57:13 +0100 Subject: Fix copy-guild move (points are now counted properly) Resolves: https://github.com/joffrey-bion/seven-wonders/issues/126 --- .../src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sw-engine/src/main/kotlin/org') diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt index 3a3521ee..2fb5e36c 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt @@ -87,7 +87,7 @@ internal class Board( ScoreCategory.MILITARY to military.totalPoints, ScoreCategory.SCIENCE to science.computePoints(), ScoreCategory.TRADE to computePointsForCards(player, Color.YELLOW), - ScoreCategory.GUILD to computePointsForCards(player, Color.PURPLE), + ScoreCategory.GUILD to computePointsForCards(player, Color.PURPLE) + copiedGuildPoints(player), ScoreCategory.WONDER to wonder.computePoints(player), ScoreCategory.GOLD to computeGoldPoints(), ), @@ -96,6 +96,10 @@ internal class Board( private fun computePointsForCards(player: Player, color: Color): Int = playedCards.filter { it.color === color }.flatMap { it.effects }.sumBy { it.computePoints(player) } + private fun copiedGuildPoints(player: Player): Int = copiedGuild?.computePoints(player) ?: 0 + + private fun Card.computePoints(player: Player): Int = effects.sumBy { it.computePoints(player) } + private fun computeGoldPoints(): Int = gold / 3 * pointsPer3Gold internal class InsufficientFundsException(current: Int, required: Int) : -- cgit