diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-08-01 00:09:46 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-08-01 01:45:04 +0200 |
commit | 1e98b6bdf6aac5df09545349373a9f9624f38692 (patch) | |
tree | 2c6a9ae994f6c20679c59ac9046a006ce4d0a083 /game-engine/src/main/kotlin/org/luxons | |
parent | Add history note about Kotlin migration (diff) | |
download | seven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.tar.gz seven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.tar.bz2 seven-wonders-1e98b6bdf6aac5df09545349373a9f9624f38692.zip |
Remove checkstyle and add ktlint
Diffstat (limited to 'game-engine/src/main/kotlin/org/luxons')
8 files changed, 10 insertions, 11 deletions
diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt index 639c5535..d3327ba5 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt @@ -59,8 +59,8 @@ class Game internal constructor( endOfGameReached() && board.hasSpecial(SpecialAbility.COPY_GUILD) -> determineCopyGuildAction(board) hand.size == 1 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD) -> Action.PLAY_LAST hand.size == 2 && board.hasSpecial(SpecialAbility.PLAY_LAST_CARD) -> Action.PLAY_2 - hand.isEmpty() -> Action.WAIT - else -> Action.PLAY + hand.isEmpty() -> Action.WAIT + else -> Action.PLAY } private fun determineCopyGuildAction(board: Board): Action { diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt index c9e90f5c..c7d429ec 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt @@ -14,7 +14,7 @@ internal interface Player { internal data class SimplePlayer( override val index: Int, private val table: Table -): Player { +) : Player { override val board = table.getBoard(index) override fun getBoard(relativePosition: RelativeBoardPosition) = table.getBoard(index, relativePosition) } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt index 6cfd3679..a5ffd721 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt @@ -2,8 +2,7 @@ package org.luxons.sevenwonders.game.api enum class Action(val message: String) { PLAY("Pick the card you want to play or discard."), - PLAY_2("Pick the first card you want to play or discard. Note that you have the ability to play these 2 last " - + "cards. You will choose how to play the last one during your next turn."), + PLAY_2("Pick the first card you want to play or discard. Note that you have the ability to play these 2 last cards. You will choose how to play the last one during your next turn."), PLAY_LAST("You have the special ability to play your last card. Choose how you want to play it."), PICK_NEIGHBOR_GUILD("Choose a Guild card (purple) that you want to copy from one of your neighbours."), WAIT("Please wait for other players to perform extra actions.") diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt index 839986e0..cf2b7901 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt @@ -8,7 +8,7 @@ enum class ScienceType { class Science { - private val quantities : MutableMap<ScienceType, Int> = mutableMapOf() + private val quantities: MutableMap<ScienceType, Int> = mutableMapOf() var jokers: Int = 0 private set diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt index e0f82c2b..fc0f8a71 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt @@ -55,6 +55,6 @@ object GameDefinitionLoader { .create() } - private inline fun <reified T: Any> GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder - = this.registerTypeAdapter(typeToken<T>(), typeAdapter) + private inline fun <reified T : Any> GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder = + this.registerTypeAdapter(typeToken<T>(), typeAdapter) } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt index c75e18d4..ece0fe5f 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt @@ -18,7 +18,7 @@ internal class WonderSideDefinition( private val stages: List<WonderStageDefinition>, private val image: String ) { - fun createWonder(name: String): Wonder = Wonder(name, initialResource, stages.map { it.create() }, image) + fun createWonder(name: String): Wonder = Wonder(name, initialResource, stages.map { it.create() }, image) } internal class WonderStageDefinition( diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt index 6412d6b5..0970a968 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/serializers/ProductionIncreaseSerializer.kt @@ -20,7 +20,7 @@ internal class ProductionIncreaseSerializer : JsonSerializer<ProductionIncrease> ): 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) diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt index 15673bd2..476ffea8 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt @@ -22,7 +22,7 @@ internal fun mutableResourcesOf(vararg resources: Pair<ResourceType, Int>) = fun Iterable<ResourceType>.toResources(): Resources = resourcesOf(this) -fun Iterable<Resources>.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1} +fun Iterable<Resources>.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1 } internal fun Resources.toMutableResources(): MutableResources { val resources = MutableResources() |