summaryrefslogtreecommitdiff
path: root/sw-common-model/src
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2019-05-20 11:46:01 +0200
committerjbion <joffrey.bion@amadeus.com>2019-05-20 11:46:01 +0200
commit036fc87fa4759dca994964ede7732ffa9f6dd4a3 (patch)
tree2cbcb27e6abbafa8e9511379b172cf71ade73aec /sw-common-model/src
parentFix some tests (diff)
downloadseven-wonders-036fc87fa4759dca994964ede7732ffa9f6dd4a3.tar.gz
seven-wonders-036fc87fa4759dca994964ede7732ffa9f6dd4a3.tar.bz2
seven-wonders-036fc87fa4759dca994964ede7732ffa9f6dd4a3.zip
Move some declarations to a better place
Diffstat (limited to 'sw-common-model/src')
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/ApiTable.kt (renamed from sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt)5
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerTurnInfo.kt2
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/boards/Boards.kt (renamed from sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt)14
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt2
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Provider.kt8
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt9
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt (renamed from sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt)18
-rw-r--r--sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt2
8 files changed, 29 insertions, 31 deletions
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/ApiTable.kt
index 23ab6ee2..595064b1 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt
+++ b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/ApiTable.kt
@@ -1,5 +1,6 @@
package org.luxons.sevenwonders.game.api
+import org.luxons.sevenwonders.game.boards.ApiBoard
import org.luxons.sevenwonders.game.cards.HandRotationDirection
import org.luxons.sevenwonders.game.cards.TableCard
import org.luxons.sevenwonders.game.moves.MoveType
@@ -7,8 +8,8 @@ import org.luxons.sevenwonders.game.resources.ResourceTransactions
typealias Age = Int
-data class Table(
- val boards: List<Board>,
+data class ApiTable(
+ val boards: List<ApiBoard>,
val currentAge: Age,
val handRotationDirection: HandRotationDirection,
val lastPlayedMoves: List<PlayedMove>
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerTurnInfo.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerTurnInfo.kt
index c5feb6c5..db177fee 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerTurnInfo.kt
+++ b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/PlayerTurnInfo.kt
@@ -17,7 +17,7 @@ enum class Action(val message: String) {
data class PlayerTurnInfo(
val playerIndex: Int,
- val table: Table,
+ val table: ApiTable,
val action: Action,
val hand: List<HandCard>,
val preparedMove: PlayedMove?,
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/boards/Boards.kt
index 698615e9..eb044cf2 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/api/Boards.kt
+++ b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/boards/Boards.kt
@@ -1,10 +1,11 @@
-package org.luxons.sevenwonders.game.api
+package org.luxons.sevenwonders.game.boards
import org.luxons.sevenwonders.game.cards.TableCard
+import org.luxons.sevenwonders.game.resources.CountedResource
import org.luxons.sevenwonders.game.resources.ResourceType
import org.luxons.sevenwonders.game.wonders.ApiWonder
-data class Board(
+data class ApiBoard(
val playerIndex: Int,
val wonder: ApiWonder,
val production: ApiProduction,
@@ -17,19 +18,14 @@ data class Board(
data class ApiRequirements(
val gold: Int = 0,
- val resources: List<ApiCountedResource> = emptyList()
+ val resources: List<CountedResource> = emptyList()
)
data class ApiProduction(
- val fixedResources: List<ApiCountedResource>,
+ val fixedResources: List<CountedResource>,
val alternativeResources: Set<Set<ResourceType>>
)
-data class ApiCountedResource(
- val count: Int,
- val type: ResourceType
-)
-
data class ApiMilitary(
val nbShields: Int,
val totalPoints: Int,
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt
index ab0e0297..1fc228d1 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt
+++ b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt
@@ -1,6 +1,6 @@
package org.luxons.sevenwonders.game.cards
-import org.luxons.sevenwonders.game.api.ApiRequirements
+import org.luxons.sevenwonders.game.boards.ApiRequirements
import org.luxons.sevenwonders.game.resources.ResourceTransactions
data class TableCard(
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Provider.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Provider.kt
deleted file mode 100644
index 5d0f3159..00000000
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Provider.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.luxons.sevenwonders.game.resources
-
-import org.luxons.sevenwonders.game.boards.RelativeBoardPosition
-
-enum class Provider(val boardPosition: RelativeBoardPosition) {
- LEFT_PLAYER(RelativeBoardPosition.LEFT),
- RIGHT_PLAYER(RelativeBoardPosition.RIGHT)
-}
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt
deleted file mode 100644
index 77a8670d..00000000
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceTransactions.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.luxons.sevenwonders.game.resources
-
-import org.luxons.sevenwonders.game.api.ApiCountedResource
-
-typealias ResourceTransactions = Collection<ResourceTransaction>
-
-data class ResourceTransaction(val provider: Provider, val resources: List<ApiCountedResource>)
-
-fun noTransactions(): ResourceTransactions = emptySet()
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt
index 5c92b887..926cd570 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/resources/ResourceType.kt
+++ b/sw-common-model/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.boards.RelativeBoardPosition
+
enum class ResourceType(val symbol: Char) {
WOOD('W'),
STONE('S'),
@@ -24,3 +26,19 @@ enum class ResourceType(val symbol: Char) {
typesPerSymbol[symbol] ?: throw IllegalArgumentException("Unknown resource type symbol '$symbol'")
}
}
+
+data class CountedResource(
+ val count: Int,
+ val type: ResourceType
+)
+
+enum class Provider(val boardPosition: RelativeBoardPosition) {
+ LEFT_PLAYER(RelativeBoardPosition.LEFT),
+ RIGHT_PLAYER(RelativeBoardPosition.RIGHT)
+}
+
+data class ResourceTransaction(val provider: Provider, val resources: List<CountedResource>)
+
+typealias ResourceTransactions = Collection<ResourceTransaction>
+
+fun noTransactions(): ResourceTransactions = emptySet()
diff --git a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt
index 6480e935..13fee8e2 100644
--- a/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt
+++ b/sw-common-model/src/main/kotlin/org/luxons/sevenwonders/game/wonders/Wonder.kt
@@ -1,6 +1,6 @@
package org.luxons.sevenwonders.game.wonders
-import org.luxons.sevenwonders.game.api.ApiRequirements
+import org.luxons.sevenwonders.game.boards.ApiRequirements
import org.luxons.sevenwonders.game.cards.CardBack
import org.luxons.sevenwonders.game.cards.PlayabilityLevel
import org.luxons.sevenwonders.game.resources.ResourceTransactions
bgstack15