mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
We can now support mods with no techs whatsoever!
This commit is contained in:
parent
c5abfc5066
commit
e06c0f47a7
@ -40,10 +40,11 @@ class CityCombatant(val city: CityInfo) : ICombatant {
|
||||
val cityTile = city.getCenterTile()
|
||||
if(cityTile.baseTerrain== Constants.hill) strength+=5
|
||||
// as tech progresses so does city strength
|
||||
val techsPercentKnown: Float = city.civInfo.tech.techsResearched.count().toFloat() /
|
||||
getCivInfo().gameInfo.ruleSet.technologies.count()
|
||||
val techCount = getCivInfo().gameInfo.ruleSet.technologies.count()
|
||||
val techsPercentKnown: Float = if(techCount>0) city.civInfo.tech.techsResearched.count().toFloat() / techCount else 0.5f // for mods with no tech
|
||||
strength += (techsPercentKnown * 5.5).pow(2.8).toFloat()
|
||||
|
||||
|
||||
// The way all of this adds up...
|
||||
// All ancient techs - 0.5 extra, Classical - 2.7, Medieval - 8, Renaissance - 17.5,
|
||||
// Industrial - 32.4, Modern - 51, Atomic - 72.5, All - 118.3
|
||||
|
@ -541,13 +541,17 @@ class CityInfo {
|
||||
}
|
||||
|
||||
private fun tryUpdateRoadStatus(){
|
||||
if(getCenterTile().roadStatus==RoadStatus.None
|
||||
&& getRuleset().tileImprovements["Road"]!!.techRequired in civInfo.tech.techsResearched)
|
||||
if(getCenterTile().roadStatus==RoadStatus.None){
|
||||
val roadImprovement = getRuleset().tileImprovements["Road"]
|
||||
if(roadImprovement!=null && roadImprovement.techRequired in civInfo.tech.techsResearched)
|
||||
getCenterTile().roadStatus=RoadStatus.Road
|
||||
}
|
||||
|
||||
else if(getCenterTile().roadStatus!=RoadStatus.Railroad
|
||||
&& getRuleset().tileImprovements["Railroad"]!!.techRequired in civInfo.tech.techsResearched)
|
||||
getCenterTile().roadStatus=RoadStatus.Railroad
|
||||
else if (getCenterTile().roadStatus != RoadStatus.Railroad) {
|
||||
val railroadImprovement = getRuleset().tileImprovements["Railroad"]
|
||||
if (railroadImprovement != null && railroadImprovement.techRequired in civInfo.tech.techsResearched)
|
||||
getCenterTile().roadStatus = RoadStatus.Railroad
|
||||
}
|
||||
}
|
||||
|
||||
fun getGoldForSellingBuilding(buildingName:String) = getRuleset().buildings[buildingName]!!.cost / 10
|
||||
|
@ -73,7 +73,9 @@ class CityStats {
|
||||
|
||||
private fun getStatPercentBonusesFromRailroad(): Stats {
|
||||
val stats = Stats()
|
||||
val techEnablingRailroad = cityInfo.getRuleset().tileImprovements["Railroad"]!!.techRequired!!
|
||||
val railroadImprovement = cityInfo.getRuleset().tileImprovements["Railroad"]
|
||||
if (railroadImprovement == null) return stats // for mods
|
||||
val techEnablingRailroad = railroadImprovement.techRequired!!
|
||||
// If we conquered enemy cities connected by railroad, but we don't yet have that tech,
|
||||
// we shouldn't get bonuses, it's as if the tracks aare layed out but we can't operate them.
|
||||
if (cityInfo.civInfo.tech.isResearched(techEnablingRailroad)
|
||||
|
@ -220,8 +220,11 @@ class CivilizationInfo {
|
||||
}
|
||||
//endregion
|
||||
|
||||
fun shouldOpenTechPicker() = tech.freeTechs != 0
|
||||
|| tech.currentTechnology()==null && cities.isNotEmpty()
|
||||
fun shouldOpenTechPicker(): Boolean {
|
||||
if (gameInfo.ruleSet.technologies.isEmpty()) return false
|
||||
if (tech.freeTechs != 0) return true
|
||||
return tech.currentTechnology() == null && cities.isNotEmpty()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -435,7 +438,8 @@ class CivilizationInfo {
|
||||
|
||||
gold += nextTurnStats.gold.toInt()
|
||||
|
||||
if (cities.isNotEmpty()) tech.nextTurn(nextTurnStats.science.toInt())
|
||||
if (cities.isNotEmpty() && gameInfo.ruleSet.technologies.isNotEmpty())
|
||||
tech.nextTurn(nextTurnStats.science.toInt())
|
||||
|
||||
if (isMajorCiv()) greatPeople.addGreatPersonPoints(getGreatPersonPointsForNextTurn()) // City-states don't get great people!
|
||||
|
||||
|
@ -580,7 +580,8 @@ class MapUnit {
|
||||
}
|
||||
|
||||
actions.add {
|
||||
val chosenUnit = listOf(Constants.settler, Constants.worker,"Warrior").random(tileBasedRandom)
|
||||
val chosenUnit = listOf(Constants.settler, Constants.worker,"Warrior")
|
||||
.filter { civInfo.gameInfo.ruleSet.units.containsKey(it) }.random(tileBasedRandom)
|
||||
if (!(civInfo.isCityState() || civInfo.isOneCityChallenger()) || chosenUnit != Constants.settler) { //City states and OCC don't get settler from ruins
|
||||
civInfo.placeUnitNearTile(tile.position, chosenUnit)
|
||||
civInfo.addNotification("A [$chosenUnit] has joined us!", tile.position, Color.BROWN)
|
||||
|
@ -135,7 +135,7 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){
|
||||
}
|
||||
toggleIconTable.add(populationImage).row()
|
||||
|
||||
val resourceImage = ImageGetter.getResourceImage("Cattle",30f).surroundWithCircle(40f)
|
||||
val resourceImage = ImageGetter.getImage("ResourceImages/Cattle").surroundWithCircle(40f)
|
||||
resourceImage.circle.color = Color.BLACK
|
||||
resourceImage.actor.color.a = if(settings.showResourcesAndImprovements) 1f else 0.5f
|
||||
resourceImage.onClick {
|
||||
|
@ -386,6 +386,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
private fun updateTechButton() {
|
||||
if(gameInfo.ruleSet.technologies.isEmpty()) return
|
||||
techButtonHolder.isVisible = viewingCiv.cities.isNotEmpty()
|
||||
techButtonHolder.clearChildren()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user