mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Great improvements are no longer hardcoded, so new great improvements can be modded in =)
This commit is contained in:
parent
ad5cf3a1ec
commit
a06a4531be
@ -46,7 +46,6 @@ object Constants {
|
|||||||
const val researchAgreement = "Research Agreement"
|
const val researchAgreement = "Research Agreement"
|
||||||
const val openBorders = "Open Borders"
|
const val openBorders = "Open Borders"
|
||||||
const val random = "Random"
|
const val random = "Random"
|
||||||
val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house", "Citadel")
|
|
||||||
|
|
||||||
const val fort = "Fort"
|
const val fort = "Fort"
|
||||||
const val citadel = "Citadel"
|
const val citadel = "Citadel"
|
||||||
|
@ -69,13 +69,12 @@ open class TileInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun containsGreatImprovement(): Boolean {
|
fun containsGreatImprovement(): Boolean {
|
||||||
if (improvement in Constants.greatImprovements) return true
|
return getTileImprovement()?.isGreatImprovement() == true
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun containsUnfinishedGreatImprovement(): Boolean {
|
fun containsUnfinishedGreatImprovement(): Boolean {
|
||||||
if (improvementInProgress in Constants.greatImprovements) return true
|
if(improvementInProgress==null) return false
|
||||||
return false
|
return ruleset.tileImprovements[improvementInProgress!!]!!.isGreatImprovement()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun containsUnique(unique: String): Boolean =
|
fun containsUnique(unique: String): Boolean =
|
||||||
|
@ -316,7 +316,7 @@ class Building : NamedStats(), IConstruction{
|
|||||||
it.resource != null
|
it.resource != null
|
||||||
&& requiredNearbyImprovedResources!!.contains(it.resource!!)
|
&& requiredNearbyImprovedResources!!.contains(it.resource!!)
|
||||||
&& it.getOwner() == civInfo
|
&& it.getOwner() == civInfo
|
||||||
&& (it.getTileResource().improvement == it.improvement || it.improvement in Constants.greatImprovements || it.isCityCenter())
|
&& (it.getTileResource().improvement == it.improvement || it.getTileImprovement()?.isGreatImprovement()==true || it.isCityCenter())
|
||||||
}
|
}
|
||||||
if (!containsResourceWithImprovement) return "Nearby $requiredNearbyImprovedResources required"
|
if (!containsResourceWithImprovement) return "Nearby $requiredNearbyImprovedResources required"
|
||||||
}
|
}
|
||||||
|
@ -70,5 +70,6 @@ class TileImprovement : NamedStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun hasUnique(unique: String) = uniques.contains(unique)
|
fun hasUnique(unique: String) = uniques.contains(unique)
|
||||||
|
fun isGreatImprovement() = hasUnique("Great improvement")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
improvement.terrainsCanBeBuiltOn.isEmpty() && improvement.turnsToBuild == 0
|
improvement.terrainsCanBeBuiltOn.isEmpty() && improvement.turnsToBuild == 0
|
||||||
// Allow Great Improvement but clear unbuildable terrain feature
|
// Allow Great Improvement but clear unbuildable terrain feature
|
||||||
// Allow barbarian camps, ruins and similar without clear
|
// Allow barbarian camps, ruins and similar without clear
|
||||||
-> if (topTerrain.unbuildable && improvement.name in Constants.greatImprovements)
|
-> if (topTerrain.unbuildable && improvement.isGreatImprovement())
|
||||||
tileInfo.terrainFeature = null
|
tileInfo.terrainFeature = null
|
||||||
topTerrain.unbuildable
|
topTerrain.unbuildable
|
||||||
-> tileInfo.improvement = null // forbid on unbuildable feature
|
-> tileInfo.improvement = null // forbid on unbuildable feature
|
||||||
|
Loading…
x
Reference in New Issue
Block a user