diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-18 17:04:59 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-18 17:05:33 +0100 |
commit | d72b60390dd9c75a91bb21f413f7b59fb8ef8d51 (patch) | |
tree | 7ea443ecbdaa37053ef0c6d3497e2b7e8a8c0efa /game-engine | |
parent | Fix code style in BonusPerBoardElement (diff) | |
download | seven-wonders-d72b60390dd9c75a91bb21f413f7b59fb8ef8d51.tar.gz seven-wonders-d72b60390dd9c75a91bb21f413f7b59fb8ef8d51.tar.bz2 seven-wonders-d72b60390dd9c75a91bb21f413f7b59fb8ef8d51.zip |
Reduce visibility where appropriate
Diffstat (limited to 'game-engine')
5 files changed, 16 insertions, 13 deletions
diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt index 9775b5ee..c4dbeb21 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/api/Table.kt @@ -24,10 +24,11 @@ class Table internal constructor(val boards: List<Board>) { get() = HandRotationDirection.forAge(currentAge) var lastPlayedMoves: List<Move> = emptyList() + internal set - fun getBoard(playerIndex: Int): Board = boards[playerIndex] + internal fun getBoard(playerIndex: Int): Board = boards[playerIndex] - fun getBoard(playerIndex: Int, position: RelativeBoardPosition): Board = + internal fun getBoard(playerIndex: Int, position: RelativeBoardPosition): Board = boards[position.getIndexFrom(playerIndex, nbPlayers)] internal fun increaseCurrentAge() { diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt index 64db9f41..00de0239 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Board.kt @@ -26,9 +26,10 @@ class Board internal constructor(val wonder: Wonder, val playerIndex: Int, setti private val consumedFreeCards: MutableMap<Age, Boolean> = mutableMapOf() var gold: Int = settings.initialGold + private set var copiedGuild: Card? = null - set(copiedGuild) { + internal set(copiedGuild) { if (copiedGuild!!.color !== Color.PURPLE) { throw IllegalArgumentException("The given card '$copiedGuild' is not a Guild card") } @@ -42,7 +43,7 @@ class Board internal constructor(val wonder: Wonder, val playerIndex: Int, setti fun getPlayedCards(): List<Card> = playedCards - fun addCard(card: Card) { + internal fun addCard(card: Card) { playedCards.add(card) } @@ -50,18 +51,18 @@ class Board internal constructor(val wonder: Wonder, val playerIndex: Int, setti fun isPlayed(cardName: String): Boolean = playedCards.count { it.name == cardName } > 0 - fun addGold(amount: Int) { + internal fun addGold(amount: Int) { this.gold += amount } - fun removeGold(amount: Int) { + internal fun removeGold(amount: Int) { if (gold < amount) { throw InsufficientFundsException(gold, amount) } this.gold -= amount } - fun addSpecial(specialAbility: SpecialAbility) { + internal fun addSpecial(specialAbility: SpecialAbility) { specialAbilities.add(specialAbility) } @@ -75,7 +76,8 @@ class Board internal constructor(val wonder: Wonder, val playerIndex: Int, setti } internal fun computeScore(player: Player): PlayerScore = PlayerScore( - gold, mapOf( + boardGold = gold, + pointsByCategory = mapOf( ScoreCategory.CIVIL to computePointsForCards(player, Color.BLUE), ScoreCategory.MILITARY to military.totalPoints, ScoreCategory.SCIENCE to science.computePoints(), diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Military.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Military.kt index c00d1ace..593716fd 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Military.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/boards/Military.kt @@ -15,16 +15,16 @@ class Military internal constructor( var nbDefeatTokens = 0 private set - fun addShields(nbShields: Int) { + internal fun addShields(nbShields: Int) { this.nbShields += nbShields } - fun victory(age: Age) { + internal fun victory(age: Age) { val wonPoints = wonPointsPerVictoryPerAge[age] ?: throw UnknownAgeException(age) totalPoints += wonPoints } - fun defeat() { + internal fun defeat() { totalPoints -= lostPointsPerDefeat nbDefeatTokens++ } diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt index 56dc7077..83865c74 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/cards/Cards.kt @@ -11,7 +11,7 @@ data class Card internal constructor( val name: String, val color: Color, val requirements: Requirements, - val effects: List<Effect>, + internal val effects: List<Effect>, val chainParent: String?, val chainChildren: List<String>, val image: String, diff --git a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt index 476ffea8..333c8edb 100644 --- a/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt +++ b/game-engine/src/main/kotlin/org/luxons/sevenwonders/game/resources/Resources.kt @@ -62,7 +62,7 @@ interface Resources { fun toList(): List<ResourceType> = quantities.flatMap { (type, quantity) -> List(quantity) { type } } } -data class MutableResources( +internal data class MutableResources( override val quantities: MutableMap<ResourceType, Int> = mutableMapOf() ) : Resources { |