Move Spy tech steal modifiers to mod constants (#12964)

* Update ModConstants.kt

* Update Spy.kt

* Update ModConstants.kt
This commit is contained in:
EmperorPinguin 2025-02-19 12:09:14 +01:00 committed by GitHub
parent 4973488b2e
commit e3e1d0fb49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -108,9 +108,13 @@ class ModConstants {
// Espionage
var maxSpyRank = 3
// How much of a skill bonus each rank gives.
// Rank 0 is 100%, rank 1 is 130%, and so on for stealing technology.
// Rank 0 is 100, rank 1 is 130, and so on.
// Half as much for a coup.
var spyRankSkillPercentBonus = 30
// Rank 2 is +25% tech steal rate, rank 3 is +50%, and so on
var spyRankStealPercentBonus = 25
// Steal cost equal to 125% of the most expensive stealable tech
var spyTechStealCostModifier = 1.25f
// UI: If set >= 0, ImprovementPicker will silently skip improvements whose tech requirement is more advanced than your current Era + this
var maxImprovementTechErasForward = -1

View File

@ -170,13 +170,15 @@ class Spy private constructor() : IsPartOfGameInfoSerialization {
if (stealableTechs.isEmpty()) return -1
var techStealCost = stealableTechs.maxOfOrNull { civInfo.gameInfo.ruleset.technologies[it]!!.cost }!!.toFloat()
val techStealCostModifier = civInfo.gameInfo.ruleset.modOptions.constants.spyTechStealCostModifier //1.25f in Civ5 GlobalDefines.XML
val techSpeedModifier = civInfo.gameInfo.speed.scienceCostModifier //Modify steal cost according to game speed
techStealCost *= techSpeedModifier * 1.25f //Multiply by 1.25f, according to Civ5 GlobalDefines.XML
techStealCost *= techStealCostModifier * techSpeedModifier
var progressThisTurn = getCity().cityStats.currentCityStats.science
if (progressThisTurn <= 0f) return -2 // The city has no science
// 25% spy bonus for each level
progressThisTurn *= (rank + 3f) / 4f
val rankTechStealModifier = rank * civInfo.gameInfo.ruleset.modOptions.constants.spyRankStealPercentBonus
progressThisTurn *= (rankTechStealModifier + 75f) / 100f
progressThisTurn *= getEfficiencyModifier().toFloat()
progressTowardsStealingTech += progressThisTurn.toInt()