summaryrefslogtreecommitdiff
path: root/sw-engine/src
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-08-20 15:36:49 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-08-20 15:44:47 +0200
commit53cdfdfd3d7f4a8fed08ee475b2d5936155f6875 (patch)
tree51410abd200b107b06c3ff144c77ba5a687a4480 /sw-engine/src
parentUpgrade to Spring Boot 2.3.3 (diff)
downloadseven-wonders-53cdfdfd3d7f4a8fed08ee475b2d5936155f6875.tar.gz
seven-wonders-53cdfdfd3d7f4a8fed08ee475b2d5936155f6875.tar.bz2
seven-wonders-53cdfdfd3d7f4a8fed08ee475b2d5936155f6875.zip
Fix style & sort imports
Diffstat (limited to 'sw-engine/src')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsSatisfaction.kt16
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Boards.kt10
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/GameDefinition.kt22
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/data/definitions/WonderDefinition.kt2
-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.kt6
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/CopyGuildMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/DiscardMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/Move.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayCardMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeCardMove.kt2
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeDiscardedCardMove.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt12
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt6
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt26
18 files changed, 44 insertions, 85 deletions
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 1c5ca8dc..e010c6aa 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
@@ -13,24 +13,16 @@ internal data class RequirementsSatisfaction(
companion object {
internal fun noRequirements() =
- RequirementsSatisfaction(true, PlayabilityLevel.NO_REQUIREMENTS, 0, setOf(
- noTransactions()
- ))
+ RequirementsSatisfaction(true, PlayabilityLevel.NO_REQUIREMENTS, 0, setOf(noTransactions()))
internal fun enoughResources() =
- RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_RESOURCES, 0, setOf(
- noTransactions()
- ))
+ RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_RESOURCES, 0, setOf(noTransactions()))
internal fun enoughGold(minPrice: Int) =
- RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_GOLD, minPrice, setOf(
- noTransactions()
- ))
+ RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_GOLD, minPrice, setOf(noTransactions()))
internal fun enoughResourcesAndGold(minPrice: Int) =
- RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_GOLD_AND_RES, minPrice, setOf(
- noTransactions()
- ))
+ RequirementsSatisfaction(true, PlayabilityLevel.ENOUGH_GOLD_AND_RES, minPrice, setOf(noTransactions()))
internal fun metWithHelp(minPrice: Int, cheapestTransactions: Set<ResourceTransactions>) =
RequirementsSatisfaction(true, PlayabilityLevel.REQUIRES_HELP, minPrice, cheapestTransactions)
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 ba07ce3a..df321952 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
@@ -10,6 +10,8 @@ import org.luxons.sevenwonders.model.MoveType
import org.luxons.sevenwonders.model.cards.Color
import org.luxons.sevenwonders.model.cards.TableCard
import org.luxons.sevenwonders.model.resources.CountedResource
+import org.luxons.sevenwonders.model.wonders.ApiWonder
+import org.luxons.sevenwonders.model.wonders.ApiWonderStage
import org.luxons.sevenwonders.engine.boards.Board as InternalBoard
import org.luxons.sevenwonders.engine.boards.Military as InternalMilitary
import org.luxons.sevenwonders.engine.boards.Science as InternalScience
@@ -22,8 +24,6 @@ import org.luxons.sevenwonders.model.boards.Military as ApiMilitary
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
-import org.luxons.sevenwonders.model.wonders.ApiWonder as ApiWonder
-import org.luxons.sevenwonders.model.wonders.ApiWonderStage as ApiWonderStage
internal fun InternalBoard.toApiBoard(player: Player, lastMove: Move?, currentAge: Age): ApiBoard =
ApiBoard(
@@ -83,9 +83,9 @@ internal fun InternalRequirements.toApiRequirements(): ApiRequirements =
)
internal fun Resources.toCountedResourcesList(): List<CountedResource> =
- quantities.filterValues { it > 0 }
- .map { (type, count) -> CountedResource(count, type) }
- .sortedBy { it.type }
+ quantities.filterValues { it > 0 }
+ .map { (type, count) -> CountedResource(count, type) }
+ .sortedBy { it.type }
internal fun InternalMilitary.toApiMilitary(): ApiMilitary =
ApiMilitary(nbShields, victoryPoints, totalPoints, nbDefeatTokens)
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 ccb73cc1..60ee5b21 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
@@ -1,9 +1,9 @@
package org.luxons.sevenwonders.engine.converters
import org.luxons.sevenwonders.engine.SimplePlayer
+import org.luxons.sevenwonders.engine.boards.Table
import org.luxons.sevenwonders.engine.moves.Move
import org.luxons.sevenwonders.model.PlayedMove
-import org.luxons.sevenwonders.engine.boards.Table
import org.luxons.sevenwonders.model.TableState
internal fun Table.toTableState(): TableState = TableState(
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 b33c9d50..4228f6af 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,25 +7,15 @@ 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.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.data.serializers.*
+import org.luxons.sevenwonders.engine.effects.*
import org.luxons.sevenwonders.engine.resources.Production
import org.luxons.sevenwonders.engine.resources.Resources
import org.luxons.sevenwonders.model.Age
-import org.luxons.sevenwonders.model.wonders.AssignedWonder
import org.luxons.sevenwonders.model.Settings
-import org.luxons.sevenwonders.model.wonders.PreGameWonder
import org.luxons.sevenwonders.model.resources.ResourceType
+import org.luxons.sevenwonders.model.wonders.AssignedWonder
+import org.luxons.sevenwonders.model.wonders.PreGameWonder
internal const val LAST_AGE: Age = 3
@@ -43,9 +33,7 @@ class GameDefinition internal constructor(
val maxPlayers: Int = rules.maxPlayers
val allWonders: List<PreGameWonder> = wonderDefinitions.map { w ->
- PreGameWonder(
- w.name,
- w.sides.mapValues { (_, def) -> def.image })
+ PreGameWonder(w.name, w.sides.mapValues { (_, def) -> def.image })
}
private val wondersByName = wonderDefinitions.associateBy { it.name }
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 58964e83..e7f1e0fc 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
@@ -3,9 +3,9 @@ package org.luxons.sevenwonders.engine.data.definitions
import org.luxons.sevenwonders.engine.cards.Requirements
import org.luxons.sevenwonders.engine.wonders.Wonder
import org.luxons.sevenwonders.engine.wonders.WonderStage
+import org.luxons.sevenwonders.model.resources.ResourceType
import org.luxons.sevenwonders.model.wonders.WonderName
import org.luxons.sevenwonders.model.wonders.WonderSide
-import org.luxons.sevenwonders.model.resources.ResourceType
internal class WonderDefinition(
val name: WonderName,
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 bad74e54..1d9f8349 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,13 +1,6 @@
package org.luxons.sevenwonders.engine.data.serializers
-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 com.google.gson.*
import org.luxons.sevenwonders.engine.boards.Science
import org.luxons.sevenwonders.engine.boards.ScienceType
import org.luxons.sevenwonders.engine.effects.ScienceProgress
@@ -50,6 +43,6 @@ internal class ScienceProgressSerializer : JsonSerializer<ScienceProgress>, Json
private fun deserializeScienceType(json: JsonElement, context: JsonDeserializationContext): ScienceType {
return context.deserialize<ScienceType>(json, ScienceType::class.java)
- ?: throw IllegalArgumentException("Invalid science level " + json.asString)
+ ?: throw IllegalArgumentException("Invalid science level " + json.asString)
}
}
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 046a7135..95eaae99 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
@@ -28,8 +28,8 @@ internal data class BonusPerBoardElement(
.sumBy { nbMatchingElementsIn(it) }
private fun nbMatchingElementsIn(board: Board): Int = when (type) {
- BoardElementType.CARD -> board.getNbCardsOfColor(colors!!)
- BoardElementType.BUILT_WONDER_STAGES -> board.wonder.nbBuiltStages
- BoardElementType.DEFEAT_TOKEN -> board.military.nbDefeatTokens
+ BoardElementType.CARD -> board.getNbCardsOfColor(colors!!)
+ BoardElementType.BUILT_WONDER_STAGES -> board.wonder.nbBuiltStages
+ BoardElementType.DEFEAT_TOKEN -> board.military.nbDefeatTokens
}
}
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt
index 9d1287f9..dfc69a41 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbility.kt
@@ -28,7 +28,7 @@ enum class SpecialAbility {
COPY_GUILD {
override fun computePoints(player: Player): Int {
val copiedGuild = player.board.copiedGuild
- ?: throw IllegalStateException("The copied Guild has not been chosen, cannot compute points")
+ ?: throw IllegalStateException("The copied Guild has not been chosen, cannot compute points")
return copiedGuild.effects.sumBy { it.computePoints(player) }
}
};
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMove.kt
index aaa26f7e..ff970c92 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMove.kt
@@ -2,8 +2,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
internal class BuildWonderMove(move: PlayerMove, card: Card, player: PlayerContext) :
CardFromHandMove(move, card, player) {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/CopyGuildMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/CopyGuildMove.kt
index c3ba8e9a..c2da63dd 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/CopyGuildMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/CopyGuildMove.kt
@@ -3,8 +3,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
import org.luxons.sevenwonders.engine.effects.SpecialAbility
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.boards.RelativeBoardPosition
import org.luxons.sevenwonders.model.cards.Color
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 92fb4952..6637cc6c 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
@@ -2,8 +2,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.Settings
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) {
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 a1790baa..2841d0c0 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
@@ -2,9 +2,9 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.MoveType
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.resources.ResourceTransactions
internal abstract class Move(
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayCardMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayCardMove.kt
index 250424c7..01078919 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayCardMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayCardMove.kt
@@ -2,8 +2,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
internal class PlayCardMove(move: PlayerMove, card: Card, player: PlayerContext) :
CardFromHandMove(move, card, player) {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeCardMove.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeCardMove.kt
index acaa2c95..71c0824b 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeCardMove.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/moves/PlayFreeCardMove.kt
@@ -2,8 +2,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
internal class PlayFreeCardMove(move: PlayerMove, card: Card, playerContext: PlayerContext) :
CardFromHandMove(move, card, playerContext) {
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 2fc03c92..9a15349d 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
@@ -3,8 +3,8 @@ package org.luxons.sevenwonders.engine.moves
import org.luxons.sevenwonders.engine.PlayerContext
import org.luxons.sevenwonders.engine.cards.Card
import org.luxons.sevenwonders.engine.effects.SpecialAbility
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
internal class PlayFreeDiscardedCardMove(
move: PlayerMove,
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
index da0ae124..27b3cad0 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
@@ -43,9 +43,7 @@ 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) {
@@ -66,9 +64,7 @@ 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)
@@ -90,9 +86,7 @@ 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/engine/converters/BoardsKtTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
index 96c5e500..c1b17d4a 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
@@ -75,9 +75,9 @@ class BoardsKtTest {
val cards = listOf(res1, green1, green2, res2, blue1, res3)
val cols = cards.toColumns()
val expectedCols = listOf(
- listOf(res1, res2, res3),
- listOf(blue1),
- listOf(green1, green2)
+ listOf(res1, res2, res3),
+ listOf(blue1),
+ listOf(green1, green2)
)
assertEquals(expectedCols, cols)
}
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
index 4db574e2..332718f9 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
@@ -2,32 +2,27 @@ package org.luxons.sevenwonders.engine.test
import org.luxons.sevenwonders.engine.Player
import org.luxons.sevenwonders.engine.PlayerContext
-import org.luxons.sevenwonders.model.resources.CountedResource
-import org.luxons.sevenwonders.model.Settings
-import org.luxons.sevenwonders.model.PlayerMove
import org.luxons.sevenwonders.engine.boards.Board
-import org.luxons.sevenwonders.model.boards.RelativeBoardPosition
import org.luxons.sevenwonders.engine.boards.Science
import org.luxons.sevenwonders.engine.boards.ScienceType
import org.luxons.sevenwonders.engine.boards.Table
import org.luxons.sevenwonders.engine.cards.Card
-import org.luxons.sevenwonders.model.cards.CardBack
-import org.luxons.sevenwonders.model.cards.Color
import org.luxons.sevenwonders.engine.cards.Requirements
import org.luxons.sevenwonders.engine.effects.Effect
import org.luxons.sevenwonders.engine.effects.ScienceProgress
import org.luxons.sevenwonders.engine.moves.Move
-import org.luxons.sevenwonders.model.MoveType
import org.luxons.sevenwonders.engine.moves.resolve
import org.luxons.sevenwonders.engine.resources.Production
-import org.luxons.sevenwonders.model.resources.Provider
-import org.luxons.sevenwonders.model.resources.ResourceTransaction
-import org.luxons.sevenwonders.model.resources.ResourceTransactions
-import org.luxons.sevenwonders.model.resources.ResourceType
-import org.luxons.sevenwonders.model.resources.noTransactions
import org.luxons.sevenwonders.engine.resources.resourcesOf
import org.luxons.sevenwonders.engine.wonders.Wonder
import org.luxons.sevenwonders.engine.wonders.WonderStage
+import org.luxons.sevenwonders.model.MoveType
+import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
+import org.luxons.sevenwonders.model.boards.RelativeBoardPosition
+import org.luxons.sevenwonders.model.cards.CardBack
+import org.luxons.sevenwonders.model.cards.Color
+import org.luxons.sevenwonders.model.resources.*
internal const val SEED: Long = 42
@@ -72,8 +67,7 @@ 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))
@@ -92,9 +86,7 @@ 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) {
bgstack15