mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 06:08:46 +07:00
Consume stockpiled resources when purchasing constructions that require them
This commit is contained in:
@ -304,4 +304,18 @@ class ResourceTests {
|
||||
game.gameInfo.nextTurn()
|
||||
assert(civInfo.getCivResourcesByName()[resource.name] == 1) // 1 was consumed because production started
|
||||
}
|
||||
|
||||
@Test
|
||||
fun stockpiledResourcesConsumedWhenConstructionPurchased() {
|
||||
// given
|
||||
val resource = game.createResource(UniqueType.Stockpiled.text)
|
||||
val building = game.createBuilding("Instantly provides [2] [${resource.name}]")
|
||||
city.cityConstructions.addBuilding(building)
|
||||
assert(civInfo.getCivResourcesByName()[resource.name] == 2)
|
||||
|
||||
val consumingBuilding = game.createBuilding("Costs [1] [${resource.name}]")
|
||||
assert(civInfo.getCivResourcesByName()[resource.name] == 2) // no change yet
|
||||
city.cityConstructions.purchaseConstruction(consumingBuilding.name, -1, false)
|
||||
assert(civInfo.getCivResourcesByName()[resource.name] == 1) // 1 was consumed because production started
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user