mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-09 10:29:02 +07:00
Change the default cost of buildings and the default time of tile improvements (#9621)
This commit is contained in:
parent
c0e5f9d736
commit
172fee9902
@ -817,7 +817,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
fun canBuildImprovement(improvement: TileImprovement, tile: Tile = currentTile): Boolean {
|
||||
// Workers (and similar) should never be able to (instantly) construct things, only build them
|
||||
// HOWEVER, they should be able to repair such things if they are pillaged
|
||||
if (improvement.turnsToBuild == 0
|
||||
if (improvement.turnsToBuild == -1
|
||||
&& improvement.name != Constants.cancelImprovementOrder
|
||||
&& tile.improvementInProgress != improvement.name
|
||||
) return false
|
||||
|
@ -456,7 +456,7 @@ class Ruleset {
|
||||
* */
|
||||
fun updateBuildingCosts() {
|
||||
for (building in buildings.values) {
|
||||
if (building.cost == 0 && building.getMatchingUniques(UniqueType.Unbuildable).none { it.conditionals.isEmpty() }) {
|
||||
if (building.cost == -1 && building.getMatchingUniques(UniqueType.Unbuildable).none { it.conditionals.isEmpty() }) {
|
||||
val column = technologies[building.requiredTech]?.column
|
||||
?: throw UncivShowableException("Building '[${building.name}]' is buildable and therefore must either have an explicit cost or reference an existing tech.")
|
||||
building.cost = if (building.isAnyWonder()) column.wonderCost else column.buildingCost
|
||||
|
@ -58,7 +58,7 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
}
|
||||
|
||||
for (building in ruleset.buildings.values) {
|
||||
if (building.requiredTech == null && building.cost == 0 && !building.hasUnique(
|
||||
if (building.requiredTech == null && building.cost == -1 && !building.hasUnique(
|
||||
UniqueType.Unbuildable))
|
||||
lines += "${building.name} is buildable and therefore must either have an explicit cost or reference an existing tech!"
|
||||
|
||||
|
@ -27,7 +27,7 @@ class TileImprovement : RulesetStatsObject() {
|
||||
override fun getUniqueTarget() = UniqueTarget.Improvement
|
||||
val shortcutKey: Char? = null
|
||||
// This is the base cost. A cost of 0 means created instead of buildable.
|
||||
val turnsToBuild: Int = 0
|
||||
val turnsToBuild: Int = -1
|
||||
|
||||
|
||||
fun getTurnsToBuild(civInfo: Civilization, unit: MapUnit): Int {
|
||||
@ -269,7 +269,7 @@ class TileImprovement : RulesetStatsObject() {
|
||||
|
||||
return ruleset.units.values.asSequence()
|
||||
.filter { unit ->
|
||||
turnsToBuild != 0
|
||||
turnsToBuild != -1
|
||||
&& unit.getMatchingUniques(UniqueType.BuildImprovements, StateForConditionals.IgnoreConditionals)
|
||||
.any { matchesBuildImprovementsFilter(it.params[0]) }
|
||||
|| unit.hasUnique(UniqueType.CreateWaterImprovements)
|
||||
|
@ -424,7 +424,7 @@ class DiplomacyScreen(
|
||||
if (otherCiv.cities.isEmpty()) return null
|
||||
val improvableResourceTiles = getImprovableResourceTiles(otherCiv)
|
||||
val improvements =
|
||||
otherCiv.gameInfo.ruleset.tileImprovements.filter { it.value.turnsToBuild != 0 }
|
||||
otherCiv.gameInfo.ruleset.tileImprovements.filter { it.value.turnsToBuild != -1 }
|
||||
var needsImprovements = false
|
||||
|
||||
for (improvableTile in improvableResourceTiles)
|
||||
|
@ -89,7 +89,7 @@ class ImprovementPickerScreen(
|
||||
for (improvement in ruleSet.tileImprovements.values) {
|
||||
var suggestRemoval = false
|
||||
// canBuildImprovement() would allow e.g. great improvements thus we need to exclude them - except cancel
|
||||
if (improvement.turnsToBuild == 0 && improvement.name != Constants.cancelImprovementOrder) continue
|
||||
if (improvement.turnsToBuild == -1 && improvement.name != Constants.cancelImprovementOrder) continue
|
||||
if (improvement.name == tile.improvement) continue // also checked by canImprovementBeBuiltHere, but after more expensive tests
|
||||
if (!unit.canBuildImprovement(improvement)) continue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user