diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-16 01:57:13 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-16 02:24:33 +0100 |
commit | 6a91cb4afa645ca0c1712433e212fb654a68da06 (patch) | |
tree | 219f71111c733f35e6c17329bb871a87fea13c99 /sw-engine/src/main/kotlin/org | |
parent | Fix PLAY_LAST effect at end of age (Babylon B) (diff) | |
download | seven-wonders-6a91cb4afa645ca0c1712433e212fb654a68da06.tar.gz seven-wonders-6a91cb4afa645ca0c1712433e212fb654a68da06.tar.bz2 seven-wonders-6a91cb4afa645ca0c1712433e212fb654a68da06.zip |
Fix copy-guild move (points are now counted properly)
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/126
Diffstat (limited to 'sw-engine/src/main/kotlin/org')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt | 6 |
1 files changed, 5 insertions, 1 deletions
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) : |