mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Resolve #11752 - fix crash in spy automation
This commit is contained in:
parent
5967f56f6d
commit
ac54209d6b
@ -86,8 +86,9 @@ class EspionageAutomation(val civInfo: Civilization) {
|
|||||||
if (!spy.canDoCoup()) return
|
if (!spy.canDoCoup()) return
|
||||||
if (spy.getCoupChanceOfSuccess(false) < .7) return
|
if (spy.getCoupChanceOfSuccess(false) < .7) return
|
||||||
val allyCiv = spy.getCity().civ.getAllyCiv()?.let { civInfo.gameInfo.getCivilization(it) }
|
val allyCiv = spy.getCity().civ.getAllyCiv()?.let { civInfo.gameInfo.getCivilization(it) }
|
||||||
// Don't coup ally city-states
|
// Don't coup city-states whose allies are out friends
|
||||||
if (allyCiv != null && civInfo.getDiplomacyManager(allyCiv).isRelationshipLevelGE(RelationshipLevel.Friend)) return
|
if (allyCiv != null && civInfo.knows(allyCiv)
|
||||||
|
&& civInfo.getDiplomacyManager(allyCiv).isRelationshipLevelGE(RelationshipLevel.Friend)) return
|
||||||
val spies = civInfo.espionageManager.spyList
|
val spies = civInfo.espionageManager.spyList
|
||||||
val randomSeed = spies.size + spies.indexOf(spy) + civInfo.gameInfo.turns
|
val randomSeed = spies.size + spies.indexOf(spy) + civInfo.gameInfo.turns
|
||||||
val randomAction = Random(randomSeed).nextInt(100)
|
val randomAction = Random(randomSeed).nextInt(100)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user