mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 02:42:16 -04:00
Add Gain control over [positiveAmount] tiles [cityFilter]
Triggerable (#13489)
* Add 'Expand the border [cityFilter]' Unique * Update OneTimeExpandBorder * Add quantifier * Clean up the code * Rename and add a test * Update docs
This commit is contained in:
parent
fe10b96837
commit
9cce7b21bd
@ -913,6 +913,23 @@ object UniqueTriggerActivation {
|
||||
}
|
||||
}
|
||||
|
||||
UniqueType.OneTimeTakeOverTilesInCity -> {
|
||||
val applicableCities = getApplicableCities(unique.params[1])
|
||||
if (applicableCities.none()) return null
|
||||
if (applicableCities.none { it.expansion.chooseNewTileToOwn() != null }) return null
|
||||
|
||||
return {
|
||||
val positiveAmount = unique.params[0].toInt()
|
||||
for (applicableCity in applicableCities) {
|
||||
for (i in 1..positiveAmount) {
|
||||
val tileToOwn = applicableCity.expansion.chooseNewTileToOwn() ?: break
|
||||
applicableCity.expansion.takeOwnership(tileToOwn)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
UniqueType.GainFreeBuildings -> {
|
||||
val freeBuilding = civInfo.getEquivalentBuilding(unique.params[0])
|
||||
val applicableCities = getApplicableCities(unique.params[1])
|
||||
|
@ -857,6 +857,7 @@ enum class UniqueType(
|
||||
OneTimeGainTechPercent("Research [relativeAmount]% of [tech]", UniqueTarget.Triggerable),
|
||||
|
||||
OneTimeTakeOverTilesInRadius("Gain control over [tileFilter] tiles in a [nonNegativeAmount]-tile radius", UniqueTarget.Triggerable),
|
||||
OneTimeTakeOverTilesInCity("Gain control over [positiveAmount] tiles [cityFilter]", UniqueTarget.Triggerable),
|
||||
|
||||
// todo: The "up to [All]" used in vanilla json is not nice to read. Split?
|
||||
// Or just reword it without the 'up to', so it reads "Reveal [amount/'all'] [tileFilter] tiles within [amount] tiles"
|
||||
@ -867,7 +868,6 @@ enum class UniqueType(
|
||||
OneTimeSpiesLevelUp("Promotes all spies [positiveAmount] time(s)", UniqueTarget.Triggerable), // used in Policies, Buildings
|
||||
OneTimeGainSpy("Gain an extra spy", UniqueTarget.Triggerable), // used in Wonders
|
||||
|
||||
|
||||
SkipPromotion("Doing so will consume this opportunity to choose a Promotion", UniqueTarget.Promotion),
|
||||
FreePromotion("This Promotion is free", UniqueTarget.Promotion),
|
||||
|
||||
|
@ -153,6 +153,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Gain control over [positiveAmount] tiles [cityFilter]"
|
||||
Example: "Gain control over [3] tiles [in all cities]"
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Reveal up to [positiveAmount/'all'] [tileFilter] within a [positiveAmount] tile radius"
|
||||
Example: "Reveal up to [3] [Farm] within a [3] tile radius"
|
||||
|
||||
|
@ -626,6 +626,22 @@ class GlobalUniquesTests {
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Gain control over tiles
|
||||
|
||||
@Test
|
||||
fun takeOverTilesInCity() {
|
||||
game.makeHexagonalMap(5)
|
||||
val civInfo = game.addCiv()
|
||||
val tile = game.getTile(Vector2.Zero)
|
||||
val city = game.addCity(civInfo, tile, true)
|
||||
Assert.assertEquals(7, city.getTiles().count())
|
||||
val building = game.createBuilding("Gain control over [8] tiles [in this city]")
|
||||
city.cityConstructions.addBuilding(building)
|
||||
Assert.assertEquals(15, city.getTiles().count())
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// endregion
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user