mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Fix Fountain of Youth (#5355)
* fix fountain of youth * fix test fail * reviews * reviews
This commit is contained in:
parent
03f374b058
commit
344c96319b
@ -233,6 +233,7 @@
|
|||||||
"name": "El Dorado",
|
"name": "El Dorado",
|
||||||
"type": "NaturalWonder",
|
"type": "NaturalWonder",
|
||||||
"culture": 5,
|
"culture": 5,
|
||||||
|
"overrideStats": true,
|
||||||
"occursOn": ["Plains"],
|
"occursOn": ["Plains"],
|
||||||
"turnsInto": "Plains",
|
"turnsInto": "Plains",
|
||||||
"impassable": true,
|
"impassable": true,
|
||||||
@ -246,12 +247,14 @@
|
|||||||
"name": "Fountain of Youth",
|
"name": "Fountain of Youth",
|
||||||
"type": "NaturalWonder",
|
"type": "NaturalWonder",
|
||||||
"happiness": 10,
|
"happiness": 10,
|
||||||
|
"overrideStats": true,
|
||||||
"occursOn": ["Plains"],
|
"occursOn": ["Plains"],
|
||||||
"turnsInto": "Plains",
|
"turnsInto": "Plains",
|
||||||
"impassable": true,
|
"impassable": true,
|
||||||
"unbuildable": true,
|
"unbuildable": true,
|
||||||
"uniques": ["Must be adjacent to [0] [Coast] tiles",
|
"uniques": ["Must be adjacent to [0] [Coast] tiles",
|
||||||
"Grants [Rejuvenation] ([all healing effects doubled]) to adjacent [{Military} {Land}] units for the rest of the game"],
|
"Grants [Rejuvenation] ([all healing effects doubled]) to adjacent [{Military} {Land}] units for the rest of the game",
|
||||||
|
"Tile provides yield without assigned population"],
|
||||||
"weight": 1
|
"weight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -411,6 +414,7 @@
|
|||||||
"name": "King Solomon's Mines",
|
"name": "King Solomon's Mines",
|
||||||
"type": "NaturalWonder",
|
"type": "NaturalWonder",
|
||||||
"production": 6,
|
"production": 6,
|
||||||
|
"overrideStats": true,
|
||||||
"occursOn": ["Plains","Desert"],
|
"occursOn": ["Plains","Desert"],
|
||||||
"uniques": ["Must be adjacent to [0] [Coast] tiles",
|
"uniques": ["Must be adjacent to [0] [Coast] tiles",
|
||||||
"Must be adjacent to [0] to [2] [Mountain] tiles"],
|
"Must be adjacent to [0] to [2] [Mountain] tiles"],
|
||||||
|
@ -45,7 +45,9 @@ class CityStats(val cityInfo: CityInfo) {
|
|||||||
val stats = Stats()
|
val stats = Stats()
|
||||||
for (cell in cityInfo.tilesInRange
|
for (cell in cityInfo.tilesInRange
|
||||||
.filter { cityInfo.location == it.position || cityInfo.isWorked(it) ||
|
.filter { cityInfo.location == it.position || cityInfo.isWorked(it) ||
|
||||||
it.getTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation)==true && it.owningCity == cityInfo })
|
it.owningCity == cityInfo && (it.getTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true ||
|
||||||
|
it.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation))
|
||||||
|
})
|
||||||
stats.add(cell.getTileStats(cityInfo, cityInfo.civInfo))
|
stats.add(cell.getTileStats(cityInfo, cityInfo.civInfo))
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
@ -648,13 +648,15 @@ class MapUnit {
|
|||||||
.flatMap { it.getUnits().asSequence() }.map { it.adjacentHealingBonus() }.maxOrNull()
|
.flatMap { it.getUnits().asSequence() }.map { it.adjacentHealingBonus() }.maxOrNull()
|
||||||
if (maxAdjacentHealingBonus != null)
|
if (maxAdjacentHealingBonus != null)
|
||||||
amountToHealBy += maxAdjacentHealingBonus
|
amountToHealBy += maxAdjacentHealingBonus
|
||||||
if (hasUnique("All healing effects doubled"))
|
|
||||||
amountToHealBy *= 2
|
|
||||||
healBy(amountToHealBy)
|
healBy(amountToHealBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun healBy(amount: Int) {
|
fun healBy(amount: Int) {
|
||||||
health += amount
|
health += if (hasUnique("All healing effects doubled"))
|
||||||
|
amount * 2
|
||||||
|
else
|
||||||
|
amount
|
||||||
if (health > 100) health = 100
|
if (health > 100) health = 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,8 @@ open class TileInfo {
|
|||||||
|
|
||||||
fun isRoughTerrain() = getAllTerrains().any{ it.isRough() }
|
fun isRoughTerrain() = getAllTerrains().any{ it.isRough() }
|
||||||
|
|
||||||
fun hasUnique(unique: String) = getAllTerrains().any { it.uniques.contains(unique) }
|
fun hasUnique(unique: String) = getAllTerrains().any { it.hasUnique(unique) }
|
||||||
|
fun hasUnique(uniqueType: UniqueType) = getAllTerrains().any { it.hasUnique(uniqueType) }
|
||||||
|
|
||||||
fun getWorkingCity(): CityInfo? {
|
fun getWorkingCity(): CityInfo? {
|
||||||
val civInfo = getOwner() ?: return null
|
val civInfo = getOwner() ?: return null
|
||||||
@ -203,7 +204,8 @@ open class TileInfo {
|
|||||||
|
|
||||||
fun isWorked(): Boolean = getWorkingCity() != null
|
fun isWorked(): Boolean = getWorkingCity() != null
|
||||||
fun providesYield() = getCity() != null && (isCityCenter() || isWorked()
|
fun providesYield() = getCity() != null && (isCityCenter() || isWorked()
|
||||||
|| getTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true)
|
|| getTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true
|
||||||
|
|| hasUnique(UniqueType.TileProvidesYieldWithoutPopulation))
|
||||||
|
|
||||||
fun isLocked(): Boolean {
|
fun isLocked(): Boolean {
|
||||||
val workingCity = getWorkingCity()
|
val workingCity = getWorkingCity()
|
||||||
@ -222,6 +224,20 @@ open class TileInfo {
|
|||||||
stats.add(terrainFeatureBase)
|
stats.add(terrainFeatureBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (naturalWonder != null) {
|
||||||
|
val wonder = getNaturalWonder().clone()
|
||||||
|
|
||||||
|
// Spain doubles tile yield
|
||||||
|
if (city != null && city.civInfo.hasUnique("Tile yields from Natural Wonders doubled")) {
|
||||||
|
wonder.timesInPlace(2f)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getNaturalWonder().overrideStats)
|
||||||
|
stats = wonder
|
||||||
|
else
|
||||||
|
stats.add(wonder)
|
||||||
|
}
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
var tileUniques = city.getMatchingUniques("[] from [] tiles []")
|
var tileUniques = city.getMatchingUniques("[] from [] tiles []")
|
||||||
.filter { city.matchesFilter(it.params[2]) }
|
.filter { city.matchesFilter(it.params[2]) }
|
||||||
@ -245,15 +261,6 @@ open class TileInfo {
|
|||||||
stats.add(unique.stats)
|
stats.add(unique.stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (naturalWonder != null) {
|
|
||||||
val wonder = getNaturalWonder()
|
|
||||||
stats.add(wonder)
|
|
||||||
|
|
||||||
// Spain doubles tile yield
|
|
||||||
if (city != null && city.civInfo.hasUnique("Tile yields from Natural Wonders doubled")) {
|
|
||||||
stats.add(wonder)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// resource base
|
// resource base
|
||||||
if (hasViewableResource(observingCiv)) stats.add(getTileResource())
|
if (hasViewableResource(observingCiv)) stats.add(getTileResource())
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
|||||||
@Deprecated("As of 3.16.14", ReplaceWith("[amount]% growth [cityFilter] <when not at war>"), DeprecationLevel.WARNING)
|
@Deprecated("As of 3.16.14", ReplaceWith("[amount]% growth [cityFilter] <when not at war>"), DeprecationLevel.WARNING)
|
||||||
GrowthPercentBonusWhenNotAtWar("+[amount]% growth [cityFilter] when not at war", UniqueTarget.Global),
|
GrowthPercentBonusWhenNotAtWar("+[amount]% growth [cityFilter] when not at war", UniqueTarget.Global),
|
||||||
|
|
||||||
TileProvidesYieldWithoutPopulation("Tile provides yield without assigned population", UniqueTarget.Improvement),
|
TileProvidesYieldWithoutPopulation("Tile provides yield without assigned population", UniqueTarget.Terrain, UniqueTarget.Improvement),
|
||||||
|
|
||||||
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
|
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
|
||||||
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs"), // No conditional support
|
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs"), // No conditional support
|
||||||
|
Loading…
x
Reference in New Issue
Block a user