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/cards/Cards.kt4
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt16
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/wonders/Wonders.kt4
3 files changed, 18 insertions, 6 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
index 16cd6ca1..7b228d4d 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/cards/Cards.kt
@@ -2,7 +2,7 @@ package org.luxons.sevenwonders.model.cards
import kotlinx.serialization.Serializable
import org.luxons.sevenwonders.model.boards.Requirements
-import org.luxons.sevenwonders.model.resources.ResourceTransactions
+import org.luxons.sevenwonders.model.resources.PricedResourceTransactions
import org.luxons.sevenwonders.model.resources.noTransactions
interface Card {
@@ -82,7 +82,7 @@ data class CardPlayability(
val isPlayable: Boolean,
val isChainable: Boolean = false,
val minPrice: Int = Int.MAX_VALUE,
- val cheapestTransactions: Set<ResourceTransactions> = setOf(noTransactions()),
+ val cheapestTransactions: Set<PricedResourceTransactions> = setOf(noTransactions()),
val playabilityLevel: PlayabilityLevel,
) {
val isFree: Boolean = minPrice == 0
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
index 0ebb837d..51e7f78d 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
@@ -41,8 +41,20 @@ enum class Provider(val boardPosition: RelativeBoardPosition) {
}
@Serializable
-data class ResourceTransaction(val provider: Provider, val resources: List<CountedResource>)
+sealed class ResourceTransaction {
+ abstract val provider: Provider
+ abstract val resources: List<CountedResource>
+}
typealias ResourceTransactions = Set<ResourceTransaction>
-fun noTransactions(): ResourceTransactions = emptySet()
+@Serializable
+data class PricedResourceTransaction(
+ override val provider: Provider,
+ override val resources: List<CountedResource>,
+ val totalPrice: Int,
+) : ResourceTransaction()
+
+typealias PricedResourceTransactions = Set<PricedResourceTransaction>
+
+fun noTransactions(): PricedResourceTransactions = emptySet()
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/wonders/Wonders.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/wonders/Wonders.kt
index a99f4f58..56b22e82 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/wonders/Wonders.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/wonders/Wonders.kt
@@ -4,7 +4,7 @@ import kotlinx.serialization.Serializable
import org.luxons.sevenwonders.model.boards.Requirements
import org.luxons.sevenwonders.model.cards.CardBack
import org.luxons.sevenwonders.model.cards.PlayabilityLevel
-import org.luxons.sevenwonders.model.resources.ResourceTransactions
+import org.luxons.sevenwonders.model.resources.PricedResourceTransactions
import org.luxons.sevenwonders.model.resources.ResourceType
import kotlin.random.Random
@@ -58,7 +58,7 @@ data class ApiWonderStage(
data class WonderBuildability(
val isBuildable: Boolean,
val minPrice: Int,
- val cheapestTransactions: Set<ResourceTransactions>,
+ val cheapestTransactions: Set<PricedResourceTransactions>,
val playabilityLevel: PlayabilityLevel,
) {
val isFree: Boolean = minPrice == 0
bgstack15