Fix spies being gained in non espionage games (#7661)

* Handfull of comment questions, small refactorings

* Code changes

* Reworded a unique, removed a file

* Added spy names for all nations, minor consistency change

* Removed debug output

* Added an empty constructor so gdx can reconstruct it

* No spies gained when espionage is disabled

* Added missing function
This commit is contained in:
Xander Lenstra
2022-08-14 17:37:39 +02:00
committed by GitHub
parent 87c1662462
commit b1727f9360
3 changed files with 10 additions and 1 deletions

View File

@ -212,6 +212,10 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
return !religionDisabledByRuleset && gameParameters.religionEnabled return !religionDisabledByRuleset && gameParameters.religionEnabled
} }
fun isEspionageEnabled(): Boolean {
return gameParameters.espionageEnabled
}
private fun getEquivalentTurn(): Int { private fun getEquivalentTurn(): Int {
val totalTurns = speed.numTotalTurns() val totalTurns = speed.numTotalTurns()
val startPercent = ruleSet.eras[gameParameters.startingEra]!!.startPercent val startPercent = ruleSet.eras[gameParameters.startingEra]!!.startPercent
@ -540,6 +544,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
//endregion //endregion
fun asPreview() = GameInfoPreview(this) fun asPreview() = GameInfoPreview(this)
} }
/** /**

View File

@ -479,6 +479,7 @@ object UniqueTriggerActivation {
OneTimeGlobalSpiesWhenEnteringEra -> { OneTimeGlobalSpiesWhenEnteringEra -> {
if (!civInfo.isMajorCiv()) return false if (!civInfo.isMajorCiv()) return false
if (!civInfo.gameInfo.isEspionageEnabled()) return false
val currentEra = civInfo.getEra().name val currentEra = civInfo.getEra().name
for (otherCiv in civInfo.gameInfo.getAliveMajorCivs()) { for (otherCiv in civInfo.gameInfo.getAliveMajorCivs()) {
if (currentEra !in otherCiv.espionageManager.erasSpyEarnedFor) { if (currentEra !in otherCiv.espionageManager.erasSpyEarnedFor) {

View File

@ -808,6 +808,9 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
??? example "Every major Civilization gains a spy once a civilization enters this era" ??? example "Every major Civilization gains a spy once a civilization enters this era"
Applicable to: Era Applicable to: Era
??? example "Every major Civilization gains a spy once a civilization enters this era"
Applicable to: Era
## Tech uniques ## Tech uniques
??? example "Starting tech" ??? example "Starting tech"
Applicable to: Tech Applicable to: Tech
@ -1887,4 +1890,4 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
*[stats]: For example: `+2 Production, +3 Food`. Note that the stat names need to be capitalized! *[stats]: For example: `+2 Production, +3 Food`. Note that the stat names need to be capitalized!
*[tech]: The name of any tech. *[tech]: The name of any tech.
*[tileFilter]: Anything that can be used either in an improvementFilter or in a terrainFilter can be used here, plus 'unimproved' *[tileFilter]: Anything that can be used either in an improvementFilter or in a terrainFilter can be used here, plus 'unimproved'
*[victoryType]: The name of any victory type: 'Neutral', 'Cultural', 'Diplomatic', 'Domination', 'Scientific', 'Time' *[victoryType]: The name of any victory type: 'Neutral', 'Cultural', 'Diplomatic', 'Domination', 'Scientific', 'Time'