diff options
Diffstat (limited to 'sw-engine')
59 files changed, 212 insertions, 153 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt index 70198f15..b8866e9f 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.game import org.luxons.sevenwonders.game.api.Action -import org.luxons.sevenwonders.game.cards.HandCard +import org.luxons.sevenwonders.game.api.cards.HandCard import org.luxons.sevenwonders.game.api.PlayerMove import org.luxons.sevenwonders.game.api.PlayerTurnInfo import org.luxons.sevenwonders.game.api.toApiTable @@ -10,7 +10,7 @@ import org.luxons.sevenwonders.game.api.toTableCard import org.luxons.sevenwonders.game.boards.Board import org.luxons.sevenwonders.game.boards.Table import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.CardBack import org.luxons.sevenwonders.game.cards.Decks import org.luxons.sevenwonders.game.cards.Hands import org.luxons.sevenwonders.game.data.LAST_AGE diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt index 2c82b6ff..877ea530 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.game import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.boards.Table import org.luxons.sevenwonders.game.cards.Card diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt index 1fe3295a..60b04318 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt @@ -1,23 +1,22 @@ package org.luxons.sevenwonders.game.api import org.luxons.sevenwonders.game.Player -import org.luxons.sevenwonders.game.boards.ApiBoard -import org.luxons.sevenwonders.game.boards.ApiMilitary -import org.luxons.sevenwonders.game.boards.ApiProduction -import org.luxons.sevenwonders.game.boards.ApiRequirements -import org.luxons.sevenwonders.game.boards.ApiScience +import org.luxons.sevenwonders.game.api.boards.ApiBoard +import org.luxons.sevenwonders.game.api.boards.ApiMilitary +import org.luxons.sevenwonders.game.api.boards.ApiProduction +import org.luxons.sevenwonders.game.api.boards.ApiRequirements +import org.luxons.sevenwonders.game.api.boards.ApiScience import org.luxons.sevenwonders.game.boards.Military import org.luxons.sevenwonders.game.boards.Science import org.luxons.sevenwonders.game.boards.ScienceType import org.luxons.sevenwonders.game.cards.Requirements -import org.luxons.sevenwonders.game.cards.TableCard +import org.luxons.sevenwonders.game.api.cards.TableCard import org.luxons.sevenwonders.game.moves.Move -import org.luxons.sevenwonders.game.moves.MoveType -import org.luxons.sevenwonders.game.resources.CountedResource +import org.luxons.sevenwonders.game.api.resources.CountedResource import org.luxons.sevenwonders.game.resources.Production import org.luxons.sevenwonders.game.resources.Resources -import org.luxons.sevenwonders.game.wonders.ApiWonder -import org.luxons.sevenwonders.game.wonders.ApiWonderStage +import org.luxons.sevenwonders.game.api.wonders.ApiWonder +import org.luxons.sevenwonders.game.api.wonders.ApiWonderStage import org.luxons.sevenwonders.game.boards.Board as InternalBoard import org.luxons.sevenwonders.game.wonders.Wonder as InternalWonder import org.luxons.sevenwonders.game.wonders.WonderStage as InternalWonderStage diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Cards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Cards.kt index 7587d69a..9580e3be 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Cards.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Cards.kt @@ -2,8 +2,8 @@ package org.luxons.sevenwonders.game.api import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.HandCard -import org.luxons.sevenwonders.game.cards.TableCard +import org.luxons.sevenwonders.game.api.cards.HandCard +import org.luxons.sevenwonders.game.api.cards.TableCard import org.luxons.sevenwonders.game.moves.Move internal fun Card.toTableCard(lastMove: Move? = null): TableCard = diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt index a43b8a3c..38bae9ea 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt @@ -4,7 +4,7 @@ import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.Settings import org.luxons.sevenwonders.game.api.Age import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.effects.SpecialAbility import org.luxons.sevenwonders.game.resources.Production import org.luxons.sevenwonders.game.resources.TradingRules diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Table.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Table.kt index 168649f4..04b3d104 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Table.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Table.kt @@ -1,9 +1,11 @@ package org.luxons.sevenwonders.game.boards import org.luxons.sevenwonders.game.api.Age +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.neighboursPositions import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.Color -import org.luxons.sevenwonders.game.cards.HandRotationDirection +import org.luxons.sevenwonders.game.api.cards.Color +import org.luxons.sevenwonders.game.api.cards.HandRotationDirection import org.luxons.sevenwonders.game.moves.Move /** diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt index b983aa0e..b179a2e4 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt @@ -1,10 +1,14 @@ package org.luxons.sevenwonders.game.cards import org.luxons.sevenwonders.game.Player +import org.luxons.sevenwonders.game.api.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.CardPlayability +import org.luxons.sevenwonders.game.api.cards.Color +import org.luxons.sevenwonders.game.api.cards.PlayabilityLevel import org.luxons.sevenwonders.game.boards.Board import org.luxons.sevenwonders.game.effects.Effect -import org.luxons.sevenwonders.game.resources.ResourceTransactions -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.noTransactions internal data class Card( val name: String, @@ -41,24 +45,27 @@ internal data class Card( private object Playability { - internal fun incompatibleWithBoard(): CardPlayability = CardPlayability( - isPlayable = false, - playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD - ) + internal fun incompatibleWithBoard(): CardPlayability = + CardPlayability( + isPlayable = false, + playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD + ) - internal fun chainable(): CardPlayability = CardPlayability( - isPlayable = true, - isChainable = true, - minPrice = 0, - cheapestTransactions = setOf(noTransactions()), - playabilityLevel = PlayabilityLevel.CHAINABLE - ) + internal fun chainable(): CardPlayability = + CardPlayability( + isPlayable = true, + isChainable = true, + minPrice = 0, + cheapestTransactions = setOf(noTransactions()), + playabilityLevel = PlayabilityLevel.CHAINABLE + ) - internal fun requirementDependent(satisfaction: RequirementsSatisfaction): CardPlayability = CardPlayability( - isPlayable = satisfaction.satisfied, - isChainable = false, - minPrice = satisfaction.minPrice, - cheapestTransactions = satisfaction.cheapestTransactions, - playabilityLevel = satisfaction.level - ) + internal fun requirementDependent(satisfaction: RequirementsSatisfaction): CardPlayability = + CardPlayability( + isPlayable = satisfaction.satisfied, + isChainable = false, + minPrice = satisfaction.minPrice, + cheapestTransactions = satisfaction.cheapestTransactions, + playabilityLevel = satisfaction.level + ) } diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Hands.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Hands.kt index 19490b9c..1dc5e5df 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Hands.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Hands.kt @@ -1,6 +1,8 @@ package org.luxons.sevenwonders.game.cards import org.luxons.sevenwonders.game.Player +import org.luxons.sevenwonders.game.api.cards.HandCard +import org.luxons.sevenwonders.game.api.cards.HandRotationDirection import org.luxons.sevenwonders.game.api.toHandCard internal class Hands(private val hands: List<List<Card>>) { diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Requirements.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Requirements.kt index 27f73109..3cdf8141 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Requirements.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Requirements.kt @@ -2,7 +2,7 @@ package org.luxons.sevenwonders.game.cards import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions import org.luxons.sevenwonders.game.resources.Resources import org.luxons.sevenwonders.game.resources.asResources import org.luxons.sevenwonders.game.resources.bestSolution diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/RequirementsSatisfaction.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/RequirementsSatisfaction.kt index 87b35723..3df2811f 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/RequirementsSatisfaction.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/RequirementsSatisfaction.kt @@ -1,7 +1,8 @@ package org.luxons.sevenwonders.game.cards -import org.luxons.sevenwonders.game.resources.ResourceTransactions -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.cards.PlayabilityLevel +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.noTransactions internal data class RequirementsSatisfaction( val satisfied: Boolean, diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinition.kt index 43c48aa7..f682b970 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinition.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinition.kt @@ -23,7 +23,7 @@ import org.luxons.sevenwonders.game.effects.ProductionIncrease import org.luxons.sevenwonders.game.effects.RawPointsIncrease import org.luxons.sevenwonders.game.effects.ScienceProgress import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.Resources internal const val LAST_AGE: Age = 3 diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt index 0b7b9229..879c2c68 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt @@ -1,8 +1,8 @@ package org.luxons.sevenwonders.game.data.definitions import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.CardBack -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.cards.Requirements internal class CardDefinition( diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.kt index b090547d..a4011e84 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.game.data.definitions import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.CardBack import org.luxons.sevenwonders.game.cards.Decks import kotlin.random.Random @@ -9,7 +9,10 @@ internal class DeckDefinition( val cards: List<CardDefinition>, val backImage: String ) { - fun create(nbPlayers: Int): List<Card> = cards.flatMap { it.create(CardBack(backImage), nbPlayers) } + fun create(nbPlayers: Int): List<Card> = cards.flatMap { it.create( + CardBack( + backImage + ), nbPlayers) } } internal class DecksDefinition( diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt index fb0eccda..6b694acc 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt @@ -2,7 +2,7 @@ package org.luxons.sevenwonders.game.data.definitions import org.luxons.sevenwonders.game.api.WonderSide import org.luxons.sevenwonders.game.cards.Requirements -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.wonders.Wonder import org.luxons.sevenwonders.game.wonders.WonderStage diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.kt index b766dd31..9f3c4721 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializer.kt @@ -8,7 +8,7 @@ import com.google.gson.JsonParseException import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.Resources import java.lang.reflect.Type diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.kt index 99c364c5..37dd2cdb 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializer.kt @@ -7,7 +7,7 @@ import com.google.gson.JsonParseException import com.google.gson.JsonPrimitive import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import java.lang.reflect.Type internal class ResourceTypeSerializer : JsonSerializer<ResourceType>, JsonDeserializer<ResourceType> { diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.kt index b4784689..8dc43af4 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializer.kt @@ -7,7 +7,7 @@ import com.google.gson.JsonParseException import com.google.gson.JsonPrimitive import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import java.lang.reflect.Type internal class ResourceTypesSerializer : JsonSerializer<List<ResourceType>>, JsonDeserializer<List<ResourceType>> { diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.kt index 1b1373ed..0d9230d8 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializer.kt @@ -8,7 +8,7 @@ import com.google.gson.JsonParseException import com.google.gson.JsonPrimitive import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.Resources import org.luxons.sevenwonders.game.resources.toResources import java.lang.reflect.Type diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.kt index 04dbf9be..f16c9f78 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElement.kt @@ -2,8 +2,8 @@ package org.luxons.sevenwonders.game.effects import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.cards.Color enum class BoardElementType { CARD, diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/Discount.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/Discount.kt index 981ad9bd..0809d279 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/Discount.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/effects/Discount.kt @@ -1,8 +1,8 @@ package org.luxons.sevenwonders.game.effects import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.resources.Provider -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceType internal data class Discount( val resourceTypes: List<ResourceType> = emptyList(), diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/CopyGuildMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/CopyGuildMove.kt index 3a7fe792..b637eb6c 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/CopyGuildMove.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/CopyGuildMove.kt @@ -3,9 +3,9 @@ package org.luxons.sevenwonders.game.moves import org.luxons.sevenwonders.game.PlayerContext import org.luxons.sevenwonders.game.Settings import org.luxons.sevenwonders.game.api.PlayerMove -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.effects.SpecialAbility internal class CopyGuildMove(move: PlayerMove, card: Card, player: PlayerContext) : Move(move, card, player) { diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/Move.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/Move.kt index 98a96fd9..134918d0 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/Move.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/moves/Move.kt @@ -3,8 +3,9 @@ package org.luxons.sevenwonders.game.moves import org.luxons.sevenwonders.game.PlayerContext import org.luxons.sevenwonders.game.Settings import org.luxons.sevenwonders.game.api.PlayerMove +import org.luxons.sevenwonders.game.api.MoveType import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions internal abstract class Move( val move: PlayerMove, diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculator.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculator.kt index dea6f2c2..6a49449b 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculator.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculator.kt @@ -1,6 +1,9 @@ package org.luxons.sevenwonders.game.resources import org.luxons.sevenwonders.game.Player +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType import java.util.EnumSet internal fun bestSolution(resources: Resources, player: Player): TransactionPlan = diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Production.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Production.kt index 66a63463..f3c71e2a 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Production.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Production.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.game.resources +import org.luxons.sevenwonders.game.api.resources.ResourceType import java.util.EnumSet data class Production internal constructor( diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt index 134240a5..862b7caf 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt @@ -1,11 +1,20 @@ package org.luxons.sevenwonders.game.resources import org.luxons.sevenwonders.game.Player +import org.luxons.sevenwonders.game.api.resources.CountedResource +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceTransaction +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions import org.luxons.sevenwonders.game.api.toCountedResourcesList fun Map<Provider, Resources>.toTransactions(): ResourceTransactions = filterValues { !it.isEmpty() } - .map { (p, res) -> ResourceTransaction(p, res.toCountedResourcesList()) } + .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/game/resources/Resources.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt index 6ffda080..bc893062 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt @@ -1,5 +1,7 @@ package org.luxons.sevenwonders.game.resources +import org.luxons.sevenwonders.game.api.resources.ResourceType + fun emptyResources(): Resources = MutableResources() fun resourcesOf(singleResource: ResourceType): Resources = mapOf(singleResource to 1).toMutableResources() diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/TradingRules.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/TradingRules.kt index a006fadf..c516f4b1 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/TradingRules.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/TradingRules.kt @@ -1,5 +1,10 @@ package org.luxons.sevenwonders.game.resources +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceTransaction +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType + class TradingRules internal constructor(private val defaultCost: Int) { private val costs: MutableMap<ResourceType, MutableMap<Provider, Int>> = mutableMapOf() diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt index fc2e8676..49ce9a67 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt @@ -2,11 +2,12 @@ package org.luxons.sevenwonders.game.wonders import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.cards.CardBack -import org.luxons.sevenwonders.game.cards.PlayabilityLevel +import org.luxons.sevenwonders.game.api.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.PlayabilityLevel import org.luxons.sevenwonders.game.cards.RequirementsSatisfaction -import org.luxons.sevenwonders.game.resources.ResourceTransactions -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.wonders.WonderBuildability internal class Wonder( val name: String, @@ -53,10 +54,11 @@ private object Buildability { isBuildable = false, playabilityLevel = PlayabilityLevel.INCOMPATIBLE_WITH_BOARD ) - internal fun requirementDependent(satisfaction: RequirementsSatisfaction) = WonderBuildability( - isBuildable = satisfaction.satisfied, - minPrice = satisfaction.minPrice, - cheapestTransactions = satisfaction.cheapestTransactions, - playabilityLevel = satisfaction.level - ) + internal 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/game/wonders/WonderStage.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/WonderStage.kt index 311e589e..cb2bf386 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/WonderStage.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/game/wonders/WonderStage.kt @@ -2,10 +2,10 @@ package org.luxons.sevenwonders.game.wonders import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.CardBack import org.luxons.sevenwonders.game.cards.Requirements import org.luxons.sevenwonders.game.effects.Effect -import org.luxons.sevenwonders.game.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions internal class WonderStage( val requirements: Requirements, diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt index 82075d5c..a3b5cf62 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt @@ -4,13 +4,13 @@ import org.luxons.sevenwonders.game.api.Action import org.luxons.sevenwonders.game.api.PlayedMove import org.luxons.sevenwonders.game.api.PlayerMove import org.luxons.sevenwonders.game.api.PlayerTurnInfo -import org.luxons.sevenwonders.game.cards.HandCard -import org.luxons.sevenwonders.game.cards.TableCard +import org.luxons.sevenwonders.game.api.cards.HandCard +import org.luxons.sevenwonders.game.api.cards.TableCard import org.luxons.sevenwonders.game.data.GameDefinition import org.luxons.sevenwonders.game.data.LAST_AGE -import org.luxons.sevenwonders.game.moves.MoveType -import org.luxons.sevenwonders.game.resources.ResourceTransactions -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.MoveType +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.test.testCustomizableSettings import kotlin.test.Test import kotlin.test.assertEquals @@ -80,7 +80,9 @@ class GameTest { return if (playableCard != null) { planMove(turnInfo, MoveType.PLAY, playableCard, playableCard.playability.cheapestTransactions.first()) } else { - planMove(turnInfo, MoveType.DISCARD, turnInfo.hand.first(), noTransactions()) + planMove(turnInfo, MoveType.DISCARD, turnInfo.hand.first(), + noTransactions() + ) } } @@ -92,7 +94,9 @@ class GameTest { return MoveExpectation( turnInfo.playerIndex, PlayerMove(MoveType.COPY_GUILD, neighbourGuilds.first().name), - PlayedMove(turnInfo.playerIndex, MoveType.COPY_GUILD, neighbourGuilds.first(), noTransactions()) + PlayedMove(turnInfo.playerIndex, MoveType.COPY_GUILD, neighbourGuilds.first(), + noTransactions() + ) ) } @@ -111,13 +115,6 @@ class GameTest { private fun HandCard.toPlayedCard(): TableCard = TableCard( - name, - color, - requirements, - chainParent, - chainChildren, - image, - back, - true + name, color, requirements, chainParent, chainChildren, image, back, true ) } diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/BoardsKtTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/BoardsKtTest.kt index 244c30a8..ede165f7 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/BoardsKtTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/BoardsKtTest.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.game.api -import org.luxons.sevenwonders.game.cards.Color -import org.luxons.sevenwonders.game.cards.TableCard +import org.luxons.sevenwonders.game.api.cards.Color +import org.luxons.sevenwonders.game.api.cards.TableCard import org.luxons.sevenwonders.game.test.testCard import kotlin.test.Test import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt index 19e4e8e8..65bd2b1b 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/api/TableTest.kt @@ -5,7 +5,7 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.test.createGuildCards import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt index d1b7c239..669934aa 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/BoardTest.kt @@ -9,11 +9,11 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.boards.Board.InsufficientFundsException -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.effects.RawPointsIncrease import org.luxons.sevenwonders.game.effects.SpecialAbility import org.luxons.sevenwonders.game.effects.SpecialAbilityActivation -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.resourcesOf import org.luxons.sevenwonders.game.score.ScoreCategory import org.luxons.sevenwonders.game.test.addCards diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt index 2038a676..75743b86 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/boards/RelativeBoardPositionTest.kt @@ -5,6 +5,7 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt index 66ff7a0e..967735b8 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardBackTest.kt @@ -1,6 +1,7 @@ package org.luxons.sevenwonders.game.cards import org.junit.Test +import org.luxons.sevenwonders.game.api.cards.CardBack import kotlin.test.assertEquals class CardBackTest { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardTest.kt index b6fecbd0..56fc9725 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/CardTest.kt @@ -2,12 +2,13 @@ package org.luxons.sevenwonders.game.cards import org.junit.Test import org.luxons.sevenwonders.game.SimplePlayer +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.boards.Board import org.luxons.sevenwonders.game.boards.Table import org.luxons.sevenwonders.game.effects.ProductionIncrease import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.ResourceType -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.test.testCard import org.luxons.sevenwonders.game.test.testSettings import org.luxons.sevenwonders.game.wonders.Wonder diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt index 4582c4a1..2fbaf8ed 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandRotationDirectionTest.kt @@ -1,6 +1,7 @@ package org.luxons.sevenwonders.game.cards import org.junit.Test +import org.luxons.sevenwonders.game.api.cards.HandRotationDirection import kotlin.test.assertEquals class HandRotationDirectionTest { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt index c7ff9106..4c9f258c 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/HandsTest.kt @@ -8,6 +8,7 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer +import org.luxons.sevenwonders.game.api.cards.HandRotationDirection import org.luxons.sevenwonders.game.test.sampleCards import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt index eccca3e7..4bed43b3 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt @@ -8,10 +8,10 @@ import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer import org.luxons.sevenwonders.game.boards.Table -import org.luxons.sevenwonders.game.resources.Provider -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.emptyResources -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.test.createRequirements import org.luxons.sevenwonders.game.test.createTransactions import org.luxons.sevenwonders.game.test.singleBoardPlayer @@ -43,7 +43,9 @@ class RequirementsTest { val board = testBoard(ResourceType.CLAY, boardGold) val player = singleBoardPlayer(board) - assertEquals(boardGold >= requiredGold, requirements.areMetWithHelpBy(board, noTransactions())) + assertEquals(boardGold >= requiredGold, requirements.areMetWithHelpBy(board, + noTransactions() + )) val satisfaction = requirements.assess(player) if (boardGold >= requiredGold) { @@ -64,7 +66,9 @@ class RequirementsTest { val board = testBoard(initialResource, 0) val player = singleBoardPlayer(board) - assertEquals(initialResource == requiredResource, requirements.areMetWithHelpBy(board, noTransactions())) + assertEquals(initialResource == requiredResource, requirements.areMetWithHelpBy(board, + noTransactions() + )) if (initialResource == requiredResource) { val satisfaction = requirements.assess(player) @@ -86,7 +90,9 @@ class RequirementsTest { board.production.addFixedResource(producedResource, 1) val player = singleBoardPlayer(board) - assertEquals(producedResource == requiredResource, requirements.areMetWithHelpBy(board, noTransactions())) + assertEquals(producedResource == requiredResource, requirements.areMetWithHelpBy(board, + noTransactions() + )) if (producedResource == requiredResource) { val satisfaction = requirements.assess(player) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt index 31d695e8..5ea60d5d 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializerTest.kt @@ -9,7 +9,7 @@ import org.junit.Test import org.luxons.sevenwonders.game.effects.ProductionIncrease import org.luxons.sevenwonders.game.resources.MutableResources import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.Resources import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.kt index 265087ba..4fbd8373 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionSerializerTest.kt @@ -8,7 +8,7 @@ import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.game.resources.MutableResources import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.Resources import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.kt index f2b07e84..c5e7b53d 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypeSerializerTest.kt @@ -5,7 +5,7 @@ import com.google.gson.Gson import com.google.gson.GsonBuilder import org.junit.Before import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertNull diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt index 8c1b421d..242f2e51 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourceTypesSerializerTest.kt @@ -7,7 +7,7 @@ import com.google.gson.Gson import com.google.gson.GsonBuilder import org.junit.Before import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import kotlin.test.assertEquals import kotlin.test.assertNull diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt index c146a948..58745841 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/data/serializers/ResourcesSerializerTest.kt @@ -6,9 +6,9 @@ import com.google.gson.GsonBuilder import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.game.resources.MutableResources -import org.luxons.sevenwonders.game.resources.ResourceType.CLAY -import org.luxons.sevenwonders.game.resources.ResourceType.STONE -import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.api.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.api.resources.ResourceType.WOOD import org.luxons.sevenwonders.game.resources.Resources import org.luxons.sevenwonders.game.resources.emptyResources import org.luxons.sevenwonders.game.resources.resourcesOf diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt index 700eddb1..3c72d0aa 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/BonusPerBoardElementTest.kt @@ -7,10 +7,10 @@ import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.SimplePlayer -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.boards.Table -import org.luxons.sevenwonders.game.cards.CardBack -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.test.addCards import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt index d92c8d24..9773ec5c 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/DiscountTest.kt @@ -5,8 +5,8 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.luxons.sevenwonders.game.resources.Provider -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.test.createTransactions import org.luxons.sevenwonders.game.test.testBoard import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.kt index 993cc273..3ade2773 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/GoldIncreaseTest.kt @@ -5,7 +5,7 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.test.testBoard import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.kt index 0d5765da..c8a89aaf 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/MilitaryReinforcementsTest.kt @@ -5,7 +5,7 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.test.testBoard import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt index c016ccc9..15366fd0 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ProductionIncreaseTest.kt @@ -5,7 +5,7 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.resources.resourcesOf import org.luxons.sevenwonders.game.test.fixedProduction import org.luxons.sevenwonders.game.test.testBoard diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt index 7e566a8c..b782f6b3 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/ScienceProgressTest.kt @@ -5,7 +5,7 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.boards.ScienceType -import org.luxons.sevenwonders.game.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType import org.luxons.sevenwonders.game.test.createScience import org.luxons.sevenwonders.game.test.createScienceProgress import org.luxons.sevenwonders.game.test.testBoard diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.kt index aae3be8e..f273783c 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/effects/SpecialAbilityActivationTest.kt @@ -7,9 +7,9 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.game.SimplePlayer -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.test.createGuildCard import org.luxons.sevenwonders.game.test.testTable import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/moves/BuildWonderMoveTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/moves/BuildWonderMoveTest.kt index 21b92872..5d4f0236 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/moves/BuildWonderMoveTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/moves/BuildWonderMoveTest.kt @@ -3,6 +3,7 @@ package org.luxons.sevenwonders.game.moves import org.junit.Test import org.luxons.sevenwonders.game.PlayerContext import org.luxons.sevenwonders.game.Settings +import org.luxons.sevenwonders.game.api.MoveType import org.luxons.sevenwonders.game.boards.Table import org.luxons.sevenwonders.game.cards.Card import org.luxons.sevenwonders.game.test.createMove diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt index b4c3b886..c531a866 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/BestPriceCalculatorTest.kt @@ -3,13 +3,15 @@ package org.luxons.sevenwonders.game.resources import org.junit.Test import org.luxons.sevenwonders.game.SimplePlayer import org.luxons.sevenwonders.game.boards.Table -import org.luxons.sevenwonders.game.resources.Provider.LEFT_PLAYER -import org.luxons.sevenwonders.game.resources.Provider.RIGHT_PLAYER -import org.luxons.sevenwonders.game.resources.ResourceType.CLAY -import org.luxons.sevenwonders.game.resources.ResourceType.GLASS -import org.luxons.sevenwonders.game.resources.ResourceType.ORE -import org.luxons.sevenwonders.game.resources.ResourceType.STONE -import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.Provider.LEFT_PLAYER +import org.luxons.sevenwonders.game.api.resources.Provider.RIGHT_PLAYER +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.api.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.api.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.api.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.api.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.test.createTransaction import org.luxons.sevenwonders.game.test.createTransactions import org.luxons.sevenwonders.game.test.testBoard diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt index 0e865921..13d7a10e 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ProductionTest.kt @@ -2,13 +2,14 @@ package org.luxons.sevenwonders.game.resources import org.junit.Before import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType.CLAY -import org.luxons.sevenwonders.game.resources.ResourceType.GLASS -import org.luxons.sevenwonders.game.resources.ResourceType.LOOM -import org.luxons.sevenwonders.game.resources.ResourceType.ORE -import org.luxons.sevenwonders.game.resources.ResourceType.PAPYRUS -import org.luxons.sevenwonders.game.resources.ResourceType.STONE -import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.api.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.api.resources.ResourceType.LOOM +import org.luxons.sevenwonders.game.api.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.api.resources.ResourceType.PAPYRUS +import org.luxons.sevenwonders.game.api.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.api.resources.ResourceType.WOOD import java.util.EnumSet import java.util.HashSet import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactionsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactionsTest.kt index 7e6d7816..6ae4169a 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactionsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactionsTest.kt @@ -1,8 +1,10 @@ package org.luxons.sevenwonders.game.resources import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType.CLAY -import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.api.resources.ResourceType.WOOD import org.luxons.sevenwonders.game.test.createTransaction import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt index 634a25c7..e53789b6 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/ResourcesTest.kt @@ -1,13 +1,14 @@ package org.luxons.sevenwonders.game.resources import org.junit.Test -import org.luxons.sevenwonders.game.resources.ResourceType.CLAY -import org.luxons.sevenwonders.game.resources.ResourceType.GLASS -import org.luxons.sevenwonders.game.resources.ResourceType.LOOM -import org.luxons.sevenwonders.game.resources.ResourceType.ORE -import org.luxons.sevenwonders.game.resources.ResourceType.PAPYRUS -import org.luxons.sevenwonders.game.resources.ResourceType.STONE -import org.luxons.sevenwonders.game.resources.ResourceType.WOOD +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.ResourceType.CLAY +import org.luxons.sevenwonders.game.api.resources.ResourceType.GLASS +import org.luxons.sevenwonders.game.api.resources.ResourceType.LOOM +import org.luxons.sevenwonders.game.api.resources.ResourceType.ORE +import org.luxons.sevenwonders.game.api.resources.ResourceType.PAPYRUS +import org.luxons.sevenwonders.game.api.resources.ResourceType.STONE +import org.luxons.sevenwonders.game.api.resources.ResourceType.WOOD import java.util.NoSuchElementException import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt index 38953529..99f85ac2 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/resources/TradingRulesTest.kt @@ -5,6 +5,9 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.test.createTransaction import org.luxons.sevenwonders.game.test.createTransactions import kotlin.test.assertEquals diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt index 07e22a56..e666140e 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/test/TestUtils.kt @@ -3,29 +3,29 @@ package org.luxons.sevenwonders.game.test import org.luxons.sevenwonders.game.Player import org.luxons.sevenwonders.game.PlayerContext import org.luxons.sevenwonders.game.Settings -import org.luxons.sevenwonders.game.resources.CountedResource +import org.luxons.sevenwonders.game.api.resources.CountedResource import org.luxons.sevenwonders.game.api.CustomizableSettings import org.luxons.sevenwonders.game.api.PlayerMove import org.luxons.sevenwonders.game.boards.Board -import org.luxons.sevenwonders.game.boards.RelativeBoardPosition +import org.luxons.sevenwonders.game.api.boards.RelativeBoardPosition import org.luxons.sevenwonders.game.boards.Science import org.luxons.sevenwonders.game.boards.ScienceType import org.luxons.sevenwonders.game.boards.Table import org.luxons.sevenwonders.game.cards.Card -import org.luxons.sevenwonders.game.cards.CardBack -import org.luxons.sevenwonders.game.cards.Color +import org.luxons.sevenwonders.game.api.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.Color import org.luxons.sevenwonders.game.cards.Requirements import org.luxons.sevenwonders.game.effects.Effect import org.luxons.sevenwonders.game.effects.ScienceProgress import org.luxons.sevenwonders.game.moves.Move -import org.luxons.sevenwonders.game.moves.MoveType +import org.luxons.sevenwonders.game.api.MoveType import org.luxons.sevenwonders.game.moves.resolve import org.luxons.sevenwonders.game.resources.Production -import org.luxons.sevenwonders.game.resources.Provider -import org.luxons.sevenwonders.game.resources.ResourceTransaction -import org.luxons.sevenwonders.game.resources.ResourceTransactions -import org.luxons.sevenwonders.game.resources.ResourceType -import org.luxons.sevenwonders.game.resources.noTransactions +import org.luxons.sevenwonders.game.api.resources.Provider +import org.luxons.sevenwonders.game.api.resources.ResourceTransaction +import org.luxons.sevenwonders.game.api.resources.ResourceTransactions +import org.luxons.sevenwonders.game.api.resources.ResourceType +import org.luxons.sevenwonders.game.api.resources.noTransactions import org.luxons.sevenwonders.game.resources.resourcesOf import org.luxons.sevenwonders.game.wonders.Wonder import org.luxons.sevenwonders.game.wonders.WonderStage @@ -75,7 +75,9 @@ internal fun createTransactions(provider: Provider, vararg resources: ResourceTy internal fun createTransactions(vararg transactions: ResourceTransaction): ResourceTransactions = transactions.toSet() internal fun createTransaction(provider: Provider, vararg resources: ResourceType): ResourceTransaction = - ResourceTransaction(provider, resources.map { CountedResource(1, it) }) + ResourceTransaction( + provider, + resources.map { CountedResource(1, it) }) internal fun createRequirements(vararg types: ResourceType): Requirements = Requirements(resources = resourcesOf(*types)) @@ -94,7 +96,9 @@ internal fun testCard( effect: Effect? = null ): Card { val effects = if (effect == null) emptyList() else listOf(effect) - return Card(name, color, requirements, effects, null, emptyList(), "path/to/card/image", CardBack("image-III")) + return Card(name, color, requirements, effects, null, emptyList(), "path/to/card/image", + CardBack("image-III") + ) } internal fun addCards(board: Board, nbCardsOfColor: Int, nbOtherCards: Int, color: Color) { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt index 491d13fb..156055ff 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/game/wonders/WonderTest.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.game.wonders import org.junit.Test -import org.luxons.sevenwonders.game.cards.CardBack +import org.luxons.sevenwonders.game.api.cards.CardBack import org.luxons.sevenwonders.game.test.testWonder import kotlin.test.assertEquals import kotlin.test.assertFailsWith |