summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt5
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt8
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt6
3 files changed, 11 insertions, 8 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
index 238e2612..16cd6ca1 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
@@ -63,7 +63,8 @@ enum class PlayabilityLevel(val message: String) {
MISSING_REQUIRED_GOLD("not enough gold"),
MISSING_GOLD_FOR_RES("not enough gold to buy resources"),
UNAVAILABLE_RESOURCES("missing resources that even neighbours don't have"),
- INCOMPATIBLE_WITH_BOARD("card already on the board")
+ ALREADY_PLAYED("card already played"),
+ WONDER_FULLY_BUILT("all wonder levels are already built"),
}
enum class Color(val isResource: Boolean) {
@@ -73,7 +74,7 @@ enum class Color(val isResource: Boolean) {
BLUE(false),
GREEN(false),
RED(false),
- PURPLE(false)
+ PURPLE(false),
}
@Serializable
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt
index 438798bf..d5468283 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt
@@ -21,7 +21,7 @@ internal data class Card(
val back: CardBack,
) {
fun computePlayabilityBy(player: Player, forceSpecialFree: Boolean = false): CardPlayability = when {
- isAlreadyOnBoard(player.board) -> Playability.incompatibleWithBoard() // cannot play twice the same card
+ isAlreadyOnBoard(player.board) -> Playability.alreadyPlayed() // cannot play twice the same card
forceSpecialFree -> Playability.specialFree()
isParentOnBoard(player.board) -> Playability.chainable()
else -> Playability.requirementDependent(requirements.assess(player))
@@ -46,8 +46,10 @@ internal data class Card(
private object Playability {
- fun incompatibleWithBoard(): CardPlayability =
- CardPlayability(isPlayable = false, playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD)
+ fun alreadyPlayed(): CardPlayability = CardPlayability(
+ isPlayable = false,
+ playabilityLevel = PlayabilityLevel.ALREADY_PLAYED,
+ )
fun chainable(): CardPlayability = CardPlayability(
isPlayable = true,
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt
index 81c23160..4a99b9e9 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt
@@ -31,7 +31,7 @@ internal class Wonder(
fun computeBuildabilityBy(player: Player): WonderBuildability {
if (nbBuiltStages == stages.size) {
- return Buildability.alreadyBuilt()
+ return Buildability.wonderFullyBuilt()
}
return Buildability.requirementDependent(nextStage.requirements.assess(player))
}
@@ -50,11 +50,11 @@ internal class Wonder(
private object Buildability {
- fun alreadyBuilt() = WonderBuildability(
+ fun wonderFullyBuilt() = WonderBuildability(
isBuildable = false,
minPrice = Int.MAX_VALUE,
cheapestTransactions = emptySet(),
- playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD,
+ playabilityLevel = PlayabilityLevel.WONDER_FULLY_BUILT,
)
fun requirementDependent(satisfaction: RequirementsSatisfaction) = WonderBuildability(
bgstack15