Resolved #8360 - Game speed affects additional aspects

This commit is contained in:
Yair Morgenstern 2023-01-12 18:52:01 +02:00
parent 5c4798442d
commit 47e1ee1bc7
6 changed files with 16 additions and 5 deletions

View File

@ -42,6 +42,8 @@ class CityExpansionManager : IsPartOfGameInfoSerialization {
fun getCultureToNextTile(): Int {
var cultureToNextTile = 6 * (max(0, tilesClaimed()) + 1.4813).pow(1.3)
cultureToNextTile *= cityInfo.civInfo.gameInfo.speed.cultureCostModifier
if (cityInfo.civInfo.isCityState())
cultureToNextTile *= 1.5f // City states grow slower, perhaps 150% cost?
@ -67,6 +69,8 @@ class CityExpansionManager : IsPartOfGameInfoSerialization {
val distanceFromCenter = tileInfo.aerialDistanceTo(cityInfo.getCenterTile())
var cost = baseCost * (distanceFromCenter - 1) + tilesClaimed() * 5.0
cost *= cityInfo.civInfo.gameInfo.speed.goldCostModifier
for (unique in cityInfo.getMatchingUniques(UniqueType.TileCostPercentage)) {
if (cityInfo.matchesFilter(unique.params[1]))
cost *= unique.params[0].toPercent()

View File

@ -47,6 +47,9 @@ class PopulationManager : IsPartOfGameInfoSerialization {
fun getFoodToNextPopulation(): Int {
// civ v math, civilization.wikia
var foodRequired = 15 + 6 * (population - 1) + floor((population - 1).toDouble().pow(1.8))
foodRequired *= cityInfo.civInfo.gameInfo.speed.modifier
if (cityInfo.civInfo.isCityState())
foodRequired *= 1.5f
if (!cityInfo.civInfo.isHuman())

View File

@ -938,7 +938,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
// Generate great people at the start of the turn,
// so they won't be generated out in the open and vulnerable to enemy attacks before you can control them
if (cities.isNotEmpty()) { //if no city available, addGreatPerson will throw exception
val greatPerson = greatPeople.getNewGreatPerson()
val greatPerson = greatPeople.getNewGreatPerson(gameInfo.speed.modifier)
if (greatPerson != null && gameInfo.ruleSet.units.containsKey(greatPerson)) addUnit(greatPerson)
religionManager.startTurn()
if (isLongCountActive())

View File

@ -23,7 +23,10 @@ class GoldenAgeManager : IsPartOfGameInfoSerialization {
fun isGoldenAge(): Boolean = turnsLeftForCurrentGoldenAge > 0
fun happinessRequiredForNextGoldenAge(): Int {
return ((500 + numberOfGoldenAges * 250) * civInfo.cities.size.toPercent()).toInt() //https://forums.civfanatics.com/resources/complete-guide-to-happiness-vanilla.25584/
var cost = (500 + numberOfGoldenAges * 250).toFloat()
cost *= civInfo.cities.size.toPercent() //https://forums.civfanatics.com/resources/complete-guide-to-happiness-vanilla.25584/
cost *= civInfo.gameInfo.speed.modifier
return cost.toInt()
}
fun enterGoldenAge(unmodifiedNumberOfTurns: Int = 10) {

View File

@ -2,7 +2,6 @@ package com.unciv.logic.civilization
import com.unciv.logic.IsPartOfGameInfoSerialization
import com.unciv.models.Counter
import java.util.HashSet
// todo: Great Admiral?
// todo: Free GP from policies and wonders should increase threshold according to the wiki
@ -32,7 +31,7 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
return toReturn
}
fun getNewGreatPerson(): String? {
fun getNewGreatPerson(gameSpeedModifier:Float): String? {
if (greatGeneralPoints > pointsForNextGreatGeneral) {
greatGeneralPoints -= pointsForNextGreatGeneral
pointsForNextGreatGeneral += 50
@ -40,7 +39,7 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
}
for ((key, value) in greatPersonPointsCounter) {
if (value > pointsForNextGreatPerson) {
if (value > pointsForNextGreatPerson * gameSpeedModifier) {
greatPersonPointsCounter.add(key, -pointsForNextGreatPerson)
pointsForNextGreatPerson *= 2
return key

View File

@ -598,12 +598,14 @@ class MapUnit : IsPartOfGameInfoSerialization {
if (era != null)
stepCost *= (1f + era.eraNumber * constants.eraMultiplier)
stepCost = (stepCost * civModifier).pow(constants.exponent)
stepCost *= civInfo.gameInfo.speed.modifier
goldCostOfUpgrade += (stepCost / constants.roundTo).toInt() * constants.roundTo
if (baseUnit == unitToUpgradeTo)
break // stop at requested BaseUnit to upgrade to
currentUnit = baseUnit
}
return goldCostOfUpgrade
}