From 1e98b6bdf6aac5df09545349373a9f9624f38692 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Wed, 1 Aug 2018 00:09:46 +0200 Subject: Remove checkstyle and add ktlint --- game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Game.kt | 4 ++-- game-engine/src/main/kotlin/org/luxons/sevenwonders/game/Player.kt | 2 +- .../src/main/kotlin/org/luxons/sevenwonders/game/api/Action.kt | 3 +-- .../src/main/kotlin/org/luxons/sevenwonders/game/boards/Science.kt | 2 +- .../kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt | 4 ++-- .../org/luxons/sevenwonders/game/data/definitions/WonderDefinition.kt | 2 +- .../game/data/serializers/ProductionIncreaseSerializer.kt | 2 +- .../main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) (limited to 'game-engine/src/main/kotlin/org/luxons') 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 = mutableMapOf() + private val quantities: MutableMap = 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 GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder - = this.registerTypeAdapter(typeToken(), typeAdapter) + private inline fun GsonBuilder.registerTypeAdapter(typeAdapter: Any): GsonBuilder = + this.registerTypeAdapter(typeToken(), 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, 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 ): 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) = fun Iterable.toResources(): Resources = resourcesOf(this) -fun Iterable.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1} +fun Iterable.merge(): Resources = fold(MutableResources()) { r1, r2 -> r1.add(r2); r1 } internal fun Resources.toMutableResources(): MutableResources { val resources = MutableResources() -- cgit