diff options
Diffstat (limited to 'game-engine/src/main/kotlin')
2 files changed, 8 insertions, 8 deletions
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 22ecc488..74b5b086 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 @@ -1,11 +1,8 @@ package org.luxons.sevenwonders.game.data -import com.github.salomonbrys.kotson.registerTypeAdapter import com.github.salomonbrys.kotson.typeToken import com.google.gson.Gson import com.google.gson.GsonBuilder -import com.google.gson.JsonNull -import com.google.gson.JsonPrimitive import org.luxons.sevenwonders.game.data.definitions.DecksDefinition import org.luxons.sevenwonders.game.data.definitions.WonderDefinition import org.luxons.sevenwonders.game.data.serializers.NumericEffectSerializer diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt index 3f42746c..0b7b9229 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt @@ -8,15 +8,18 @@ import org.luxons.sevenwonders.game.cards.Requirements internal class CardDefinition( private val name: String, private val color: Color, - private val requirements: Requirements = Requirements(), + private val requirements: Requirements?, private val effect: EffectsDefinition, - private val chainParent: String? = null, - private val chainChildren: List<String> = emptyList(), + private val chainParent: String?, + private val chainChildren: List<String>?, private val image: String, private val countPerNbPlayer: Map<Int, Int> ) { fun create(back: CardBack, nbPlayers: Int): List<Card> = List(countPerNbPlayer[nbPlayers] ?: 0) { create(back) } - fun create(back: CardBack): Card = - Card(name, color, requirements, effect.create(), chainParent, chainChildren, image, back) + fun create(back: CardBack): Card { + val reqs = requirements ?: Requirements() + val children = chainChildren ?: emptyList() + return Card(name, color, reqs, effect.create(), chainParent, children, image, back) + } } |