summaryrefslogtreecommitdiff
path: root/game-engine/src/main/kotlin
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2018-07-10 21:32:43 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2018-07-10 21:39:26 +0200
commit039536abfe590515108828ef9cbd46a56b2af3c5 (patch)
tree74a71e69c556b51f595b856b994e5c309ebc0c7b /game-engine/src/main/kotlin
parentKotlin mig: score package (diff)
downloadseven-wonders-039536abfe590515108828ef9cbd46a56b2af3c5.tar.gz
seven-wonders-039536abfe590515108828ef9cbd46a56b2af3c5.tar.bz2
seven-wonders-039536abfe590515108828ef9cbd46a56b2af3c5.zip
Remove unnecessary properties from cards/wonders.json
Diffstat (limited to 'game-engine/src/main/kotlin')
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/GameDefinitionLoader.kt3
-rw-r--r--game-engine/src/main/kotlin/org/luxons/sevenwonders/game/data/definitions/CardDefinition.kt13
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)
+ }
}
bgstack15