mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Small fixes (#4548)
* Raze city button should be disabled for original capitals * Halicarnassus trigger checks Great Person * New water improvements should recalculate resource stuff * Should't be able to create water improvements outside borders
This commit is contained in:
parent
46da6bd56e
commit
973a8fb0ac
@ -599,7 +599,7 @@ class CityInfo {
|
||||
}
|
||||
|
||||
fun canBeDestroyed(): Boolean {
|
||||
return !isCapital() && !isHolyCity()
|
||||
return !isOriginalCapital && !isCapital() && !isHolyCity()
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
@ -114,17 +114,20 @@ object UnitActions {
|
||||
val tile = unit.currentTile
|
||||
if (!tile.isWater || !unit.hasUnique("May create improvements on water resources") || tile.resource == null) return null
|
||||
|
||||
val improvement = tile.getTileResource().improvement
|
||||
val improvementName = tile.getTileResource().improvement ?: return null
|
||||
val improvement = tile.ruleset.tileImprovements[improvementName] ?: return null
|
||||
if (!tile.canBuildImprovement(improvement, unit.civInfo)) return null
|
||||
|
||||
if (tile.improvement == null && tile.ruleset.tileImprovements.containsKey(improvement)
|
||||
&& tile.ruleset.tileImprovements[improvement]!!.techRequired.let { it == null || unit.civInfo.tech.isResearched(it) })
|
||||
return UnitAction(UnitActionType.Create, "Create [$improvement]",
|
||||
action = {
|
||||
tile.improvement = improvement
|
||||
unit.destroy()
|
||||
}.takeIf { unit.currentMovement > 0 })
|
||||
|
||||
return null
|
||||
return UnitAction(UnitActionType.Create, "Create [$improvementName]",
|
||||
action = {
|
||||
tile.improvement = improvementName
|
||||
val city = tile.getCity()
|
||||
if (city != null) {
|
||||
city.cityStats.update()
|
||||
city.civInfo.updateDetailedCivResources()
|
||||
}
|
||||
unit.destroy()
|
||||
}.takeIf { unit.currentMovement > 0 })
|
||||
}
|
||||
|
||||
// This entire function is deprecated since 3.15.4, as the 'can construct roads' unique is deprecated
|
||||
@ -491,10 +494,8 @@ object UnitActions {
|
||||
city.cityStats.update()
|
||||
city.civInfo.updateDetailedCivResources()
|
||||
}
|
||||
// Why is this here? How do we now the unit is actually a great person?
|
||||
// What if in some mod some unit can construct a certain type of improvement using the "Can construct []" unique?
|
||||
// That unit does not need to be a great person at all, and yet it would trigger mausoleum of halicarnassus (?) here.
|
||||
addGoldPerGreatPersonUsage(unit.civInfo)
|
||||
if (unit.hasUnique("Great Person - []"))
|
||||
addGoldPerGreatPersonUsage(unit.civInfo)
|
||||
unit.destroy()
|
||||
}.takeIf {
|
||||
unit.currentMovement > 0f && tile.canBuildImprovement(improvement, unit.civInfo)
|
||||
|
Loading…
x
Reference in New Issue
Block a user