diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-29 20:41:21 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-29 20:48:17 +0100 |
commit | 0fc3ff817cf4691a521df0b35a8d60cbb7cb947c (patch) | |
tree | 0aa62a2977bd0ebabec22a9e15cb4c4969d2986c /sw-engine/src/main/kotlin/org/luxons | |
parent | Add rotation to "best price indicator" (diff) | |
download | seven-wonders-0fc3ff817cf4691a521df0b35a8d60cbb7cb947c.tar.gz seven-wonders-0fc3ff817cf4691a521df0b35a8d60cbb7cb947c.tar.bz2 seven-wonders-0fc3ff817cf4691a521df0b35a8d60cbb7cb947c.zip |
Allow the COPY_GUILD ability to yield 0 points
If the neighbours don't have guild cards, we can't copy them, so it's normal not to have one.
Diffstat (limited to 'sw-engine/src/main/kotlin/org/luxons')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt index dfc69a41..82c23a72 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt @@ -27,9 +27,8 @@ enum class SpecialAbility { */ COPY_GUILD { override fun computePoints(player: Player): Int { - val copiedGuild = player.board.copiedGuild - ?: throw IllegalStateException("The copied Guild has not been chosen, cannot compute points") - return copiedGuild.effects.sumBy { it.computePoints(player) } + // there can be no copiedGuild if no neighbour had any guild cards + return player.board.copiedGuild?.effects?.sumBy { it.computePoints(player) } ?: 0 } }; |