diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-22 00:11:34 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-22 00:14:10 +0100 |
commit | d06f1ebfac1d4dbcba74a3c50b9424e9b0e2f529 (patch) | |
tree | 7652b47a0f7448f2e5562fc3ae7747aded200b95 /game-engine/src/test | |
parent | Refactor and cleanup GameTest (diff) | |
download | seven-wonders-d06f1ebfac1d4dbcba74a3c50b9424e9b0e2f529.tar.gz seven-wonders-d06f1ebfac1d4dbcba74a3c50b9424e9b0e2f529.tar.bz2 seven-wonders-d06f1ebfac1d4dbcba74a3c50b9424e9b0e2f529.zip |
Add wonder buildability info
Diffstat (limited to 'game-engine/src/test')
-rw-r--r-- | game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt | 5 | ||||
-rw-r--r-- | game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt index 11293b64..12f867f2 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/GameTest.kt @@ -71,6 +71,11 @@ class GameTest { } private fun createPlayCardMove(turnInfo: PlayerTurnInfo): MoveExpectation { + val wonderBuildability = turnInfo.table.boards[turnInfo.playerIndex].wonder.buildability + if (wonderBuildability.isBuildable) { + val transactions = wonderBuildability.cheapestTransactions.first() + return planMove(turnInfo, MoveType.UPGRADE_WONDER, turnInfo.hand.first(), transactions) + } val playableCard = turnInfo.hand.firstOrNull { it.playability.isPlayable } return if (playableCard != null) { planMove(turnInfo, MoveType.PLAY, playableCard, playableCard.playability.cheapestTransactions.first()) diff --git a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt index 5f6c18b0..eccca3e7 100644 --- a/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt +++ b/game-engine/src/test/kotlin/org/luxons/sevenwonders/game/cards/RequirementsTest.kt @@ -45,7 +45,7 @@ class RequirementsTest { assertEquals(boardGold >= requiredGold, requirements.areMetWithHelpBy(board, noTransactions())) - val satisfaction = requirements.computeSatisfaction(player) + val satisfaction = requirements.assess(player) if (boardGold >= requiredGold) { if (requiredGold == 0) { assertEquals(RequirementsSatisfaction.noRequirements(), satisfaction) @@ -67,7 +67,7 @@ class RequirementsTest { assertEquals(initialResource == requiredResource, requirements.areMetWithHelpBy(board, noTransactions())) if (initialResource == requiredResource) { - val satisfaction = requirements.computeSatisfaction(player) + val satisfaction = requirements.assess(player) assertEquals(RequirementsSatisfaction.enoughResources(), satisfaction) } } @@ -89,7 +89,7 @@ class RequirementsTest { assertEquals(producedResource == requiredResource, requirements.areMetWithHelpBy(board, noTransactions())) if (producedResource == requiredResource) { - val satisfaction = requirements.computeSatisfaction(player) + val satisfaction = requirements.assess(player) assertEquals(RequirementsSatisfaction.enoughResources(), satisfaction) } } @@ -115,7 +115,7 @@ class RequirementsTest { val neighbourHasResource = boughtResource == requiredResource assertEquals(neighbourHasResource, requirements.areMetWithHelpBy(board, resources)) - val satisfaction = requirements.computeSatisfaction(player) + val satisfaction = requirements.assess(player) if (neighbourHasResource) { val transactions = setOf( createTransactions(Provider.LEFT_PLAYER, requiredResource), @@ -141,7 +141,7 @@ class RequirementsTest { val transactions = createTransactions(Provider.RIGHT_PLAYER, requiredResource) assertTrue(requirements.areMetWithHelpBy(board, transactions)) - assertTrue(requirements.computeSatisfaction(player).satisfied) + assertTrue(requirements.assess(player).satisfied) requirements.pay(player, transactions) |