summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt7
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt22
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt3
3 files changed, 23 insertions, 9 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
index 0d02c5fd..8b339788 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
@@ -1,6 +1,8 @@
package org.luxons.sevenwonders.model
import kotlinx.serialization.Serializable
+import org.luxons.sevenwonders.model.boards.Board
+import org.luxons.sevenwonders.model.boards.RelativeBoardPosition
import org.luxons.sevenwonders.model.cards.HandCard
import org.luxons.sevenwonders.model.cards.TableCard
import org.luxons.sevenwonders.model.resources.ResourceTransactions
@@ -33,6 +35,11 @@ data class PlayerTurnInfo(
val wonderBuildability: WonderBuildability = table.boards[playerIndex].wonder.buildability
}
+fun PlayerTurnInfo.getOwnBoard(): Board = table.boards[playerIndex]
+
+fun PlayerTurnInfo.getBoard(position: RelativeBoardPosition): Board =
+ table.boards[position.getIndexFrom(playerIndex, table.boards.size)]
+
// TODO move to server code
fun Collection<PlayerTurnInfo>.hideHandsAndWaitForReadiness() =
map { it.copy(action = Action.SAY_READY, hand = null) }
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt
index 7a337f9a..d22a350a 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Api.kt
@@ -44,19 +44,25 @@ data class Actionability(
val tooltip: String
)
+interface BasicPlayerInfo {
+ val username: String
+ val displayName: String
+ val icon: Icon?
+}
+
@Serializable
data class ConnectedPlayer(
- val username: String,
- val displayName: String,
- val icon: Icon?
-)
+ override val username: String,
+ override val displayName: String,
+ override val icon: Icon?
+) : BasicPlayerInfo
@Serializable
data class PlayerDTO(
- val username: String,
- val displayName: String,
- val icon: Icon?,
+ override val username: String,
+ override val displayName: String,
+ override val icon: Icon?,
val index: Int,
val isGameOwner: Boolean,
val isReady: Boolean
-)
+) : BasicPlayerInfo
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
index cdf5b65c..2fdb40b6 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/boards/Boards.kt
@@ -15,7 +15,8 @@ data class Board(
val science: Science,
val military: Military,
val playedCards: List<List<TableCard>>,
- val gold: Int
+ val gold: Int,
+ val bluePoints: Int
)
@Serializable
bgstack15