summaryrefslogtreecommitdiff
path: root/sw-engine/src/main/kotlin
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-09-07 23:36:44 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-09-08 00:39:01 +0200
commit9cb098df0ad5978b0e9aac78b4c68c9d16759f0f (patch)
treeb7c4829c163a004a012a3da13183753fe4ee32e6 /sw-engine/src/main/kotlin
parentUse port 80 in docker image (diff)
downloadseven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.gz
seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.bz2
seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.zip
Format with trailing comma
Diffstat (limited to 'sw-engine/src/main/kotlin')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt11
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Player.kt4
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Board.kt15
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Table.kt4
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Cards.kt52
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Decks.kt6
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Requirements.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt67
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Cards.kt42
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt8
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt18
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/CardDefinition.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/DecksDefinition.kt8
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/EffectsDefinition.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt6
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializer.kt6
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourceTypesSerializer.kt4
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ScienceProgressSerializer.kt11
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElement.kt8
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/Discount.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt3
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt7
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Production.kt4
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactions.kt6
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Resources.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/Wonder.kt17
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/WonderStage.kt2
31 files changed, 166 insertions, 161 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
index 34a8dd99..60dc505b 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
@@ -12,7 +12,12 @@ import org.luxons.sevenwonders.engine.data.LAST_AGE
import org.luxons.sevenwonders.engine.effects.SpecialAbility
import org.luxons.sevenwonders.engine.moves.Move
import org.luxons.sevenwonders.engine.moves.resolve
-import org.luxons.sevenwonders.model.*
+import org.luxons.sevenwonders.model.Action
+import org.luxons.sevenwonders.model.MoveType
+import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.PlayerTurnInfo
+import org.luxons.sevenwonders.model.Settings
+import org.luxons.sevenwonders.model.TableState
import org.luxons.sevenwonders.model.cards.CardBack
import org.luxons.sevenwonders.model.cards.HandCard
import org.luxons.sevenwonders.model.score.ScoreBoard
@@ -21,7 +26,7 @@ class Game internal constructor(
val id: Long,
private val settings: Settings,
boards: List<Board>,
- private val decks: Decks
+ private val decks: Decks,
) {
private val table: Table = Table(boards)
private val players: List<Player> = boards.map { SimplePlayer(it.playerIndex, table) }
@@ -86,7 +91,7 @@ class Game internal constructor(
hand = hand,
preparedMove = preparedMoves[player.index]?.toPlayedMove(),
discardedCards = exposedDiscardedCards,
- neighbourGuildCards = neighbourGuildCards
+ neighbourGuildCards = neighbourGuildCards,
)
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Player.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Player.kt
index e28fa7bf..75e7c9ec 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Player.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Player.kt
@@ -13,7 +13,7 @@ internal interface Player {
internal data class SimplePlayer(
override val index: Int,
- private val table: Table
+ private val table: Table,
) : Player {
override val board = table.getBoard(index)
override fun getBoard(relativePosition: RelativeBoardPosition) = table.getBoard(index, relativePosition)
@@ -22,7 +22,7 @@ internal data class SimplePlayer(
internal data class PlayerContext(
override val index: Int,
private val table: Table,
- val hand: List<Card>
+ val hand: List<Card>,
) : Player by SimplePlayer(index, table) {
val currentAge = table.currentAge
}
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 a78d6d4b..3a3521ee 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
@@ -13,8 +13,11 @@ import org.luxons.sevenwonders.model.cards.Color
import org.luxons.sevenwonders.model.score.PlayerScore
import org.luxons.sevenwonders.model.score.ScoreCategory
-internal class Board(val wonder: Wonder, val playerIndex: Int, settings: Settings) {
-
+internal class Board(
+ val wonder: Wonder,
+ val playerIndex: Int,
+ settings: Settings,
+) {
val production = Production(mutableResourcesOf(wonder.initialResource))
val publicProduction = Production(mutableResourcesOf(wonder.initialResource))
val science = Science()
@@ -86,14 +89,12 @@ internal class Board(val wonder: Wonder, val playerIndex: Int, settings: Setting
ScoreCategory.TRADE to computePointsForCards(player, Color.YELLOW),
ScoreCategory.GUILD to computePointsForCards(player, Color.PURPLE),
ScoreCategory.WONDER to wonder.computePoints(player),
- ScoreCategory.GOLD to computeGoldPoints()
- )
+ ScoreCategory.GOLD to computeGoldPoints(),
+ ),
)
private fun computePointsForCards(player: Player, color: Color): Int =
- playedCards.filter { it.color === color }
- .flatMap { it.effects }
- .sumBy { it.computePoints(player) }
+ playedCards.filter { it.color === color }.flatMap { it.effects }.sumBy { it.computePoints(player) }
private fun computeGoldPoints(): Int = gold / 3 * pointsPer3Gold
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt
index ea008e4c..a449268a 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Military.kt
@@ -4,7 +4,7 @@ import org.luxons.sevenwonders.model.Age
internal class Military(
private val lostPointsPerDefeat: Int,
- private val wonPointsPerVictoryPerAge: Map<Age, Int>
+ private val wonPointsPerVictoryPerAge: Map<Age, Int>,
) {
var nbShields = 0
private set
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Table.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Table.kt
index b8da6ae7..62554492 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Table.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/boards/Table.kt
@@ -54,7 +54,7 @@ internal class Table(val boards: List<Board>) {
}
}
- fun getNeighbourGuildCards(playerIndex: Int): List<Card> = neighboursPositions()
- .flatMap { getBoard(playerIndex, it).getPlayedCards() }
+ fun getNeighbourGuildCards(playerIndex: Int): List<Card> = neighboursPositions() //
+ .flatMap { getBoard(playerIndex, it).getPlayedCards() } //
.filter { it.color == Color.PURPLE }
}
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 cc00123e..438798bf 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
@@ -18,7 +18,7 @@ internal data class Card(
val chainParent: String?,
val chainChildren: List<String>,
val image: String,
- val back: CardBack
+ val back: CardBack,
) {
fun computePlayabilityBy(player: Player, forceSpecialFree: Boolean = false): CardPlayability = when {
isAlreadyOnBoard(player.board) -> Playability.incompatibleWithBoard() // cannot play twice the same card
@@ -47,35 +47,29 @@ internal data class Card(
private object Playability {
fun incompatibleWithBoard(): CardPlayability =
- CardPlayability(
- isPlayable = false,
- playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD
- )
+ CardPlayability(isPlayable = false, playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD)
- fun chainable(): CardPlayability =
- CardPlayability(
- isPlayable = true,
- isChainable = true,
- minPrice = 0,
- cheapestTransactions = setOf(noTransactions()),
- playabilityLevel = PlayabilityLevel.CHAINABLE
- )
+ fun chainable(): CardPlayability = CardPlayability(
+ isPlayable = true,
+ isChainable = true,
+ minPrice = 0,
+ cheapestTransactions = setOf(noTransactions()),
+ playabilityLevel = PlayabilityLevel.CHAINABLE,
+ )
- fun requirementDependent(satisfaction: RequirementsSatisfaction): CardPlayability =
- CardPlayability(
- isPlayable = satisfaction.satisfied,
- isChainable = false,
- minPrice = satisfaction.minPrice,
- cheapestTransactions = satisfaction.cheapestTransactions,
- playabilityLevel = satisfaction.level
- )
+ fun requirementDependent(satisfaction: RequirementsSatisfaction): CardPlayability = CardPlayability(
+ isPlayable = satisfaction.satisfied,
+ isChainable = false,
+ minPrice = satisfaction.minPrice,
+ cheapestTransactions = satisfaction.cheapestTransactions,
+ playabilityLevel = satisfaction.level,
+ )
- fun specialFree(): CardPlayability =
- CardPlayability(
- isPlayable = true,
- isChainable = false,
- minPrice = 0,
- cheapestTransactions = setOf(noTransactions()),
- playabilityLevel = PlayabilityLevel.SPECIAL_FREE
- )
+ fun specialFree(): CardPlayability = CardPlayability(
+ isPlayable = true,
+ isChainable = false,
+ minPrice = 0,
+ cheapestTransactions = setOf(noTransactions()),
+ playabilityLevel = PlayabilityLevel.SPECIAL_FREE,
+ )
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Decks.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Decks.kt
index e8d9ab40..ac36a72f 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Decks.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Decks.kt
@@ -1,8 +1,8 @@
package org.luxons.sevenwonders.engine.cards
internal fun List<Card>.deal(nbPlayers: Int): Hands {
- val hands: Map<Int, List<Card>> = this.withIndex()
- .groupBy { (index, _) -> index % nbPlayers }
+ val hands: Map<Int, List<Card>> = this.withIndex() //
+ .groupBy { (index, _) -> index % nbPlayers } //
.mapValues { it.value.map { (_, cards) -> cards } }
val allHands = List(nbPlayers) { i -> hands[i] ?: emptyList() }
@@ -33,5 +33,5 @@ internal class Decks(private val cardsPerAge: Map<Int, List<Card>>) {
}
}
- inner class CardNotFoundException(message: String) : RuntimeException(message)
+ class CardNotFoundException(message: String) : RuntimeException(message)
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Requirements.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Requirements.kt
index b9ffe247..945f4463 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Requirements.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/Requirements.kt
@@ -11,7 +11,7 @@ import org.luxons.sevenwonders.model.resources.ResourceTransactions
data class Requirements internal constructor(
val gold: Int = 0,
- val resources: Resources = emptyResources()
+ val resources: Resources = emptyResources(),
) {
/**
* Returns information about the extent to which the given [player] meets these requirements, either on its own or
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt
index e010c6aa..3a1ac5ce 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt
@@ -8,7 +8,7 @@ internal data class RequirementsSatisfaction(
val satisfied: Boolean,
val level: PlayabilityLevel,
val minPrice: Int,
- val cheapestTransactions: Set<ResourceTransactions>
+ val cheapestTransactions: Set<ResourceTransactions>,
) {
companion object {
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 df321952..2ddce8a8 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
@@ -25,22 +25,20 @@ import org.luxons.sevenwonders.model.boards.Production as ApiProduction
import org.luxons.sevenwonders.model.boards.Requirements as ApiRequirements
import org.luxons.sevenwonders.model.boards.Science as ApiScience
-internal fun InternalBoard.toApiBoard(player: Player, lastMove: Move?, currentAge: Age): ApiBoard =
- ApiBoard(
- playerIndex = playerIndex,
- wonder = wonder.toApiWonder(player, lastMove),
- production = production.toApiProduction(),
- publicProduction = publicProduction.toApiProduction(),
- science = science.toApiScience(),
- military = military.toApiMilitary(),
- playedCards = getPlayedCards().map { it.toTableCard(lastMove) }.toColumns(),
- gold = gold,
- bluePoints = getPlayedCards()
- .filter { it.color == Color.BLUE }
- .flatMap { it.effects.filterIsInstance<RawPointsIncrease>() }
- .sumBy { it.points },
- canPlayAnyCardForFree = canPlayFreeCard(currentAge)
- )
+internal fun InternalBoard.toApiBoard(player: Player, lastMove: Move?, currentAge: Age): ApiBoard = ApiBoard(
+ playerIndex = playerIndex,
+ wonder = wonder.toApiWonder(player, lastMove),
+ production = production.toApiProduction(),
+ publicProduction = publicProduction.toApiProduction(),
+ science = science.toApiScience(),
+ military = military.toApiMilitary(),
+ playedCards = getPlayedCards().map { it.toTableCard(lastMove) }.toColumns(),
+ gold = gold,
+ bluePoints = getPlayedCards().filter { it.color == Color.BLUE }
+ .flatMap { it.effects.filterIsInstance<RawPointsIncrease>() }
+ .sumBy { it.points },
+ canPlayAnyCardForFree = canPlayFreeCard(currentAge),
+)
internal fun List<TableCard>.toColumns(): List<List<TableCard>> {
val cardsByColor = this.groupBy { it.color }
@@ -59,7 +57,7 @@ internal fun InternalWonder.toApiWonder(player: Player, lastMove: Move?): ApiWon
stages = stages.map { it.toApiWonderStage(lastBuiltStage == it, lastMove) },
image = image,
nbBuiltStages = nbBuiltStages,
- buildability = computeBuildabilityBy(player)
+ buildability = computeBuildabilityBy(player),
)
internal fun InternalWonderStage.toApiWonderStage(isLastBuiltStage: Boolean, lastMove: Move?): ApiWonderStage =
@@ -67,33 +65,28 @@ internal fun InternalWonderStage.toApiWonderStage(isLastBuiltStage: Boolean, las
cardBack = cardBack,
isBuilt = isBuilt,
requirements = requirements.toApiRequirements(),
- builtDuringLastMove = lastMove?.type == MoveType.UPGRADE_WONDER && isLastBuiltStage
+ builtDuringLastMove = lastMove?.type == MoveType.UPGRADE_WONDER && isLastBuiltStage,
)
-internal fun InternalProduction.toApiProduction(): ApiProduction =
- ApiProduction(
- fixedResources = getFixedResources().toCountedResourcesList(),
- alternativeResources = getAlternativeResources().sortedBy { it.size }
- )
+internal fun InternalProduction.toApiProduction(): ApiProduction = ApiProduction(
+ fixedResources = getFixedResources().toCountedResourcesList(),
+ alternativeResources = getAlternativeResources().sortedBy { it.size },
+)
internal fun InternalRequirements.toApiRequirements(): ApiRequirements =
- ApiRequirements(
- gold = gold,
- resources = resources.toCountedResourcesList()
- )
+ ApiRequirements(gold = gold, resources = resources.toCountedResourcesList())
-internal fun Resources.toCountedResourcesList(): List<CountedResource> =
- quantities.filterValues { it > 0 }
- .map { (type, count) -> CountedResource(count, type) }
+internal fun Resources.toCountedResourcesList(): List<CountedResource> = //
+ quantities.filterValues { it > 0 } //
+ .map { (type, count) -> CountedResource(count, type) } //
.sortedBy { it.type }
internal fun InternalMilitary.toApiMilitary(): ApiMilitary =
ApiMilitary(nbShields, victoryPoints, totalPoints, nbDefeatTokens)
-internal fun InternalScience.toApiScience(): ApiScience =
- ApiScience(
- jokers = jokers,
- nbWheels = getQuantity(ScienceType.WHEEL),
- nbCompasses = getQuantity(ScienceType.COMPASS),
- nbTablets = getQuantity(ScienceType.TABLET)
- )
+internal fun InternalScience.toApiScience(): ApiScience = ApiScience(
+ jokers = jokers,
+ nbWheels = getQuantity(ScienceType.WHEEL),
+ nbCompasses = getQuantity(ScienceType.COMPASS),
+ nbTablets = getQuantity(ScienceType.TABLET),
+)
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Cards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Cards.kt
index f0e17515..7c9c5d32 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Cards.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Cards.kt
@@ -6,26 +6,24 @@ import org.luxons.sevenwonders.engine.moves.Move
import org.luxons.sevenwonders.model.cards.HandCard
import org.luxons.sevenwonders.model.cards.TableCard
-internal fun Card.toTableCard(lastMove: Move? = null): TableCard =
- TableCard(
- name = name,
- color = color,
- requirements = requirements.toApiRequirements(),
- chainParent = chainParent,
- chainChildren = chainChildren,
- image = image,
- back = back,
- playedDuringLastMove = lastMove != null && this.name == lastMove.card.name
- )
+internal fun Card.toTableCard(lastMove: Move? = null): TableCard = TableCard(
+ name = name,
+ color = color,
+ requirements = requirements.toApiRequirements(),
+ chainParent = chainParent,
+ chainChildren = chainChildren,
+ image = image,
+ back = back,
+ playedDuringLastMove = lastMove != null && this.name == lastMove.card.name,
+)
-internal fun Card.toHandCard(player: Player, forceSpecialFree: Boolean): HandCard =
- HandCard(
- name = name,
- color = color,
- requirements = requirements.toApiRequirements(),
- chainParent = chainParent,
- chainChildren = chainChildren,
- image = image,
- back = back,
- playability = computePlayabilityBy(player, forceSpecialFree)
- )
+internal fun Card.toHandCard(player: Player, forceSpecialFree: Boolean): HandCard = HandCard(
+ name = name,
+ color = color,
+ requirements = requirements.toApiRequirements(),
+ chainParent = chainParent,
+ chainChildren = chainChildren,
+ image = image,
+ back = back,
+ playability = computePlayabilityBy(player, forceSpecialFree),
+)
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
index 60ee5b21..ec61b42f 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
@@ -7,15 +7,17 @@ import org.luxons.sevenwonders.model.PlayedMove
import org.luxons.sevenwonders.model.TableState
internal fun Table.toTableState(): TableState = TableState(
- boards = boards.mapIndexed { i, b -> b.toApiBoard(SimplePlayer(i, this), lastPlayedMoves.getOrNull(i), currentAge) },
+ boards = boards.mapIndexed { i, b ->
+ b.toApiBoard(SimplePlayer(i, this), lastPlayedMoves.getOrNull(i), currentAge)
+ },
currentAge = currentAge,
handRotationDirection = handRotationDirection,
- lastPlayedMoves = lastPlayedMoves.map { it.toPlayedMove() }
+ lastPlayedMoves = lastPlayedMoves.map { it.toPlayedMove() },
)
internal fun Move.toPlayedMove(): PlayedMove = PlayedMove(
playerIndex = playerContext.index,
type = type,
card = card.toTableCard(this),
- transactions = transactions
+ transactions = transactions,
)
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt
index 4228f6af..07c101e6 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt
@@ -7,8 +7,18 @@ import org.luxons.sevenwonders.engine.Game
import org.luxons.sevenwonders.engine.boards.Board
import org.luxons.sevenwonders.engine.data.definitions.DecksDefinition
import org.luxons.sevenwonders.engine.data.definitions.WonderDefinition
-import org.luxons.sevenwonders.engine.data.serializers.*
-import org.luxons.sevenwonders.engine.effects.*
+import org.luxons.sevenwonders.engine.data.serializers.NumericEffectSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ProductionIncreaseSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ProductionSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ResourceTypeSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ResourceTypesSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ResourcesSerializer
+import org.luxons.sevenwonders.engine.data.serializers.ScienceProgressSerializer
+import org.luxons.sevenwonders.engine.effects.GoldIncrease
+import org.luxons.sevenwonders.engine.effects.MilitaryReinforcements
+import org.luxons.sevenwonders.engine.effects.ProductionIncrease
+import org.luxons.sevenwonders.engine.effects.RawPointsIncrease
+import org.luxons.sevenwonders.engine.effects.ScienceProgress
import org.luxons.sevenwonders.engine.resources.Production
import org.luxons.sevenwonders.engine.resources.Resources
import org.luxons.sevenwonders.model.Age
@@ -21,13 +31,13 @@ internal const val LAST_AGE: Age = 3
internal data class GlobalRules(
val minPlayers: Int,
- val maxPlayers: Int
+ val maxPlayers: Int,
)
class GameDefinition internal constructor(
rules: GlobalRules,
wonderDefinitions: List<WonderDefinition>,
- private val decksDefinition: DecksDefinition
+ private val decksDefinition: DecksDefinition,
) {
val minPlayers: Int = rules.minPlayers
val maxPlayers: Int = rules.maxPlayers
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/CardDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/CardDefinition.kt
index 1785ad49..cc42641a 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/CardDefinition.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/CardDefinition.kt
@@ -13,7 +13,7 @@ internal class CardDefinition(
private val chainParent: String?,
private val chainChildren: List<String>?,
private val image: String,
- private val countPerNbPlayer: Map<Int, Int>
+ private val countPerNbPlayer: Map<Int, Int>,
) {
fun create(back: CardBack, nbPlayers: Int): List<Card> = List(countPerNbPlayer[nbPlayers] ?: 0) { create(back) }
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/DecksDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/DecksDefinition.kt
index e4dfb8fd..f3dc42f4 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/DecksDefinition.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/DecksDefinition.kt
@@ -7,7 +7,7 @@ import kotlin.random.Random
internal class DeckDefinition(
val cards: List<CardDefinition>,
- val backImage: String
+ val backImage: String,
) {
fun create(nbPlayers: Int): List<Card> = cards.flatMap { it.create(CardBack(backImage), nbPlayers) }
}
@@ -16,14 +16,14 @@ internal class DecksDefinition(
private val age1: DeckDefinition,
private val age2: DeckDefinition,
private val age3: DeckDefinition,
- private val guildCards: List<CardDefinition>
+ private val guildCards: List<CardDefinition>,
) {
fun prepareDecks(nbPlayers: Int, random: Random) = Decks(
mapOf(
1 to age1.create(nbPlayers).shuffled(random),
2 to age2.create(nbPlayers).shuffled(random),
- 3 to (age3.create(nbPlayers) + pickGuildCards(nbPlayers, random)).shuffled(random)
- )
+ 3 to (age3.create(nbPlayers) + pickGuildCards(nbPlayers, random)).shuffled(random),
+ ),
)
private fun pickGuildCards(nbPlayers: Int, random: Random): List<Card> {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/EffectsDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/EffectsDefinition.kt
index 0322d657..86829eca 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/EffectsDefinition.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/EffectsDefinition.kt
@@ -19,7 +19,7 @@ internal class EffectsDefinition(
private val perBoardElement: BonusPerBoardElement? = null,
private val production: ProductionIncrease? = null,
private val points: RawPointsIncrease? = null,
- private val action: SpecialAbility? = null
+ private val action: SpecialAbility? = null,
) {
fun create(): List<Effect> = mutableListOf<Effect>().apply {
gold?.let { add(it) }
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt
index e7f1e0fc..2a59f6dc 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt
@@ -9,7 +9,7 @@ import org.luxons.sevenwonders.model.wonders.WonderSide
internal class WonderDefinition(
val name: WonderName,
- val sides: Map<WonderSide, WonderSideDefinition>
+ val sides: Map<WonderSide, WonderSideDefinition>,
) {
fun create(wonderSide: WonderSide): Wonder = sides[wonderSide]!!.createWonder(name)
}
@@ -17,14 +17,14 @@ internal class WonderDefinition(
internal class WonderSideDefinition(
private val initialResource: ResourceType,
private val stages: List<WonderStageDefinition>,
- val image: String
+ val image: String,
) {
fun createWonder(name: String): Wonder = Wonder(name, initialResource, stages.map { it.create() }, image)
}
internal class WonderStageDefinition(
private val requirements: Requirements,
- private val effects: EffectsDefinition
+ private val effects: EffectsDefinition,
) {
fun create(): WonderStage = WonderStage(requirements, effects.create())
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializer.kt
index 5115649f..dc340578 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializer.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializer.kt
@@ -16,18 +16,18 @@ internal class ProductionIncreaseSerializer : JsonSerializer<ProductionIncrease>
override fun serialize(
productionIncrease: ProductionIncrease,
typeOfSrc: Type,
- context: JsonSerializationContext
+ context: JsonSerializationContext,
): JsonElement {
val production = productionIncrease.production
val json = context.serialize(production)
- return if (!json.isJsonNull && !productionIncrease.isSellable) { JsonPrimitive("(${json.asString})") } else json
+ return if (!json.isJsonNull && !productionIncrease.isSellable) JsonPrimitive("(${json.asString})") else json
}
@Throws(JsonParseException::class)
override fun deserialize(
json: JsonElement,
typeOfT: Type,
- context: JsonDeserializationContext
+ context: JsonDeserializationContext,
): ProductionIncrease {
var prodJson = json
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourceTypesSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourceTypesSerializer.kt
index 2383685c..ebbee8fd 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourceTypesSerializer.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourceTypesSerializer.kt
@@ -15,7 +15,7 @@ internal class ResourceTypesSerializer : JsonSerializer<List<ResourceType>>, Jso
override fun serialize(
resources: List<ResourceType>,
typeOfSrc: Type,
- context: JsonSerializationContext
+ context: JsonSerializationContext,
): JsonElement {
val s = resources.map { it.symbol }.joinToString("")
return JsonPrimitive(s)
@@ -25,6 +25,6 @@ internal class ResourceTypesSerializer : JsonSerializer<List<ResourceType>>, Jso
override fun deserialize(
json: JsonElement,
typeOfT: Type,
- context: JsonDeserializationContext
+ context: JsonDeserializationContext,
): List<ResourceType> = json.asString.map { ResourceType.fromSymbol(it) }
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ScienceProgressSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ScienceProgressSerializer.kt
index 1d9f8349..1193c94b 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ScienceProgressSerializer.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/serializers/ScienceProgressSerializer.kt
@@ -1,6 +1,13 @@
package org.luxons.sevenwonders.engine.data.serializers
-import com.google.gson.*
+import com.google.gson.JsonDeserializationContext
+import com.google.gson.JsonDeserializer
+import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import org.luxons.sevenwonders.engine.boards.Science
import org.luxons.sevenwonders.engine.boards.ScienceType
import org.luxons.sevenwonders.engine.effects.ScienceProgress
@@ -11,7 +18,7 @@ internal class ScienceProgressSerializer : JsonSerializer<ScienceProgress>, Json
override fun serialize(
scienceProgress: ScienceProgress,
typeOfSrc: Type,
- context: JsonSerializationContext
+ context: JsonSerializationContext,
): JsonElement {
val science = scienceProgress.science
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElement.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElement.kt
index 95eaae99..41dbd937 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElement.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElement.kt
@@ -8,7 +8,7 @@ import org.luxons.sevenwonders.model.cards.Color
enum class BoardElementType {
CARD,
BUILT_WONDER_STAGES,
- DEFEAT_TOKEN
+ DEFEAT_TOKEN,
}
internal data class BonusPerBoardElement(
@@ -16,16 +16,14 @@ internal data class BonusPerBoardElement(
val type: BoardElementType,
val gold: Int = 0,
val points: Int = 0,
- val colors: List<Color>? = null // only relevant if type=CARD
+ val colors: List<Color>? = null, // only relevant if type=CARD
) : Effect {
override fun applyTo(player: Player) = player.board.addGold(gold * nbMatchingElementsFor(player))
override fun computePoints(player: Player): Int = points * nbMatchingElementsFor(player)
- private fun nbMatchingElementsFor(player: Player): Int = boards
- .map(player::getBoard)
- .sumBy { nbMatchingElementsIn(it) }
+ private fun nbMatchingElementsFor(player: Player): Int = boards.sumBy { nbMatchingElementsIn(player.getBoard(it)) }
private fun nbMatchingElementsIn(board: Board): Int = when (type) {
BoardElementType.CARD -> board.getNbCardsOfColor(colors!!)
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/Discount.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/Discount.kt
index 28ffb49d..83a45e28 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/Discount.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/Discount.kt
@@ -7,7 +7,7 @@ import org.luxons.sevenwonders.model.resources.ResourceType
internal data class Discount(
val resourceTypes: List<ResourceType> = emptyList(),
val providers: List<Provider> = emptyList(),
- val discountedPrice: Int = 1
+ val discountedPrice: Int = 1,
) : InstantOwnBoardEffect() {
public override fun applyTo(board: Board) {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt
index 6637cc6c..7635e1a3 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt
@@ -5,8 +5,7 @@ import org.luxons.sevenwonders.engine.cards.Card
import org.luxons.sevenwonders.model.PlayerMove
import org.luxons.sevenwonders.model.Settings
-internal class DiscardMove(move: PlayerMove, card: Card, player: PlayerContext) :
- CardFromHandMove(move, card, player) {
+internal class DiscardMove(move: PlayerMove, card: Card, player: PlayerContext) : CardFromHandMove(move, card, player) {
override fun place(discardedCards: MutableList<Card>, settings: Settings) {
discardedCards.add(card)
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt
index 2841d0c0..b0035f63 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt
@@ -10,7 +10,7 @@ import org.luxons.sevenwonders.model.resources.ResourceTransactions
internal abstract class Move(
val move: PlayerMove,
val card: Card,
- val playerContext: PlayerContext
+ val playerContext: PlayerContext,
) {
val type: MoveType = move.type
@@ -21,9 +21,8 @@ internal abstract class Move(
abstract fun activate(discardedCards: List<Card>, settings: Settings)
}
-class InvalidMoveException internal constructor(move: Move, message: String) : IllegalArgumentException(
- "Player ${move.playerContext.index} cannot perform move ${move.type}: $message"
-)
+class InvalidMoveException internal constructor(move: Move, message: String) :
+ IllegalArgumentException("Player ${move.playerContext.index} cannot perform move ${move.type}: $message")
internal fun MoveType.resolve(move: PlayerMove, card: Card, context: PlayerContext, discardedCards: List<Card>): Move =
when (this) {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt
index 9a15349d..bd2eeb86 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt
@@ -10,7 +10,7 @@ internal class PlayFreeDiscardedCardMove(
move: PlayerMove,
card: Card,
playerContext: PlayerContext,
- discardedCards: List<Card>
+ discardedCards: List<Card>,
) : Move(move, card, playerContext) {
init {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt
index dd2d2cae..e5f27c05 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculator.kt
@@ -15,7 +15,7 @@ data class TransactionPlan(val price: Int, val possibleTransactions: Set<Resourc
private class ResourcePool(
val provider: Provider?,
private val rules: TradingRules,
- choices: List<Set<ResourceType>>
+ choices: List<Set<ResourceType>>,
) {
val choices: Set<MutableSet<ResourceType>> = choices.mapTo(HashSet()) { it.toMutableSet() }
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Production.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Production.kt
index 4f9bbe90..3eb59bd5 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Production.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Production.kt
@@ -6,7 +6,7 @@ import java.util.EnumSet
data class Production internal constructor(
private val fixedResources: MutableResources = mutableResourcesOf(),
// cannot be a Set because the same choices can be there multiple times
- private val alternativeResources: MutableList<Set<ResourceType>> = mutableListOf()
+ private val alternativeResources: MutableList<Set<ResourceType>> = mutableListOf(),
) {
fun getFixedResources(): Resources = fixedResources
@@ -43,7 +43,7 @@ data class Production internal constructor(
private fun containedInAlternatives(
resources: MutableResources,
- alternatives: MutableList<Set<ResourceType>>
+ alternatives: MutableList<Set<ResourceType>>,
): Boolean {
if (resources.isEmpty()) {
return true
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactions.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactions.kt
index be9b9e76..c3e0fefa 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactions.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactions.kt
@@ -7,9 +7,9 @@ import org.luxons.sevenwonders.model.resources.Provider
import org.luxons.sevenwonders.model.resources.ResourceTransaction
import org.luxons.sevenwonders.model.resources.ResourceTransactions
-fun Map<Provider, Resources>.toTransactions(): ResourceTransactions =
- filterValues { !it.isEmpty() }
- .map { (p, res) -> ResourceTransaction(p, res.toCountedResourcesList()) }
+fun Map<Provider, Resources>.toTransactions(): ResourceTransactions = //
+ filterValues { !it.isEmpty() } //
+ .map { (p, res) -> ResourceTransaction(p, res.toCountedResourcesList()) } //
.toSet()
fun ResourceTransactions.asResources(): Resources = flatMap { it.resources }.asResources()
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Resources.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Resources.kt
index 3d9654ed..b2dfc964 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Resources.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/Resources.kt
@@ -64,7 +64,7 @@ interface Resources {
}
class MutableResources(
- override val quantities: MutableMap<ResourceType, Int> = mutableMapOf()
+ override val quantities: MutableMap<ResourceType, Int> = mutableMapOf(),
) : Resources {
fun add(type: ResourceType, quantity: Int) {
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 0e1b37f0..81c23160 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
@@ -13,7 +13,7 @@ internal class Wonder(
val name: String,
val initialResource: ResourceType,
val stages: List<WonderStage>,
- val image: String
+ val image: String,
) {
val nbBuiltStages: Int
get() = stages.count { it.isBuilt }
@@ -54,14 +54,13 @@ private object Buildability {
isBuildable = false,
minPrice = Int.MAX_VALUE,
cheapestTransactions = emptySet(),
- playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD
+ playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD,
)
- internal fun requirementDependent(satisfaction: RequirementsSatisfaction) =
- WonderBuildability(
- isBuildable = satisfaction.satisfied,
- minPrice = satisfaction.minPrice,
- cheapestTransactions = satisfaction.cheapestTransactions,
- playabilityLevel = satisfaction.level
- )
+ fun requirementDependent(satisfaction: RequirementsSatisfaction) = WonderBuildability(
+ isBuildable = satisfaction.satisfied,
+ minPrice = satisfaction.minPrice,
+ cheapestTransactions = satisfaction.cheapestTransactions,
+ playabilityLevel = satisfaction.level,
+ )
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/WonderStage.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/WonderStage.kt
index 974c6a7a..80b69f52 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/WonderStage.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/wonders/WonderStage.kt
@@ -9,7 +9,7 @@ import org.luxons.sevenwonders.model.resources.ResourceTransactions
internal class WonderStage(
val requirements: Requirements,
- val effects: List<Effect>
+ val effects: List<Effect>,
) {
var cardBack: CardBack? = null
private set
bgstack15