Add missing espionage uniques (#11559)

* Added "New spies start with [1] level(s)" unique

* Added England extra spy unique

* Fixed SpyStartingLevel target

* Added addspy notification
This commit is contained in:
Oskar Niesen 2024-05-04 13:04:17 -05:00 committed by GitHub
parent da4657fa44
commit 4aa75896e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 7 deletions

View File

@ -986,8 +986,10 @@
"cost": 120,
"culture": 1,
"isNationalWonder": true,
"uniques": ["Hidden when espionage is disabled", "Gain an extra spy", "Promotes all spies", "[-15]% enemy spy effectiveness [in this city]",
"Only available <if [Police Station] is constructed in all [non-[Puppeted]] cities>", "Cost increases by [30] per owned city"],
"uniques": ["Hidden when espionage is disabled", "Gain an extra spy", "Promotes all spies",
"[-15]% enemy spy effectiveness [in this city]", "New spies start with [1] level(s)",
"Only available <if [Police Station] is constructed in all [non-[Puppeted]] cities>",
"Cost increases by [30] per owned city"],
"requiredTech": "Radio"
},
{

View File

@ -154,7 +154,7 @@
"innerColor": [255, 255, 255],
"favoredReligion": "Christianity",
"uniqueName": "Sun Never Sets",
"uniques": ["[+2] Movement <for [Water] units>"],
"uniques": ["[+2] Movement <for [Water] units>", "Gain an extra spy <upon entering the [Renaissance era]>"],
"cities": ["London","York","Nottingham","Hastings","Canterbury","Coventry","Warwick","Newcastle","Oxford","Liverpool",
"Dover","Brighton","Norwich","Leeds","Reading","Birmingham","Richmond","Exeter","Cambridge","Gloucester",
"Manchester","Bristol","Leicester","Carlisle","Ipswich","Portsmouth","Berwick","Bath","Mumbles","Southampton",

View File

@ -5,6 +5,7 @@ import com.unciv.logic.city.City
import com.unciv.logic.civilization.Civilization
import com.unciv.logic.map.tile.Tile
import com.unciv.models.Spy
import com.unciv.models.ruleset.unique.UniqueType
class EspionageManager : IsPartOfGameInfoSerialization {
@ -50,7 +51,7 @@ class EspionageManager : IsPartOfGameInfoSerialization {
fun addSpy(): Spy {
val spyName = getSpyName()
val newSpy = Spy(spyName)
val newSpy = Spy(spyName, getStartingSpyRank())
newSpy.setTransients(civInfo)
spyList.add(newSpy)
return newSpy
@ -77,6 +78,8 @@ class EspionageManager : IsPartOfGameInfoSerialization {
return spyList.filter { it.getLocation() == city }.toMutableList()
}
fun getStartingSpyRank(): Int = 1 + civInfo.getMatchingUniques(UniqueType.SpyStartingLevel).sumOf { it.params[0].toInt() }
/**
* Returns a list of all cities with our spies in them.
* The list needs to be stable accross calls on the same turn.

View File

@ -44,12 +44,13 @@ class Spy() : IsPartOfGameInfoSerialization {
@Transient
private lateinit var espionageManager: EspionageManager
constructor(name: String) : this() {
constructor(name: String, rank:Int) : this() {
this.name = name
this.rank = rank
}
fun clone(): Spy {
val toReturn = Spy(name)
val toReturn = Spy(name, rank)
toReturn.location = location
toReturn.action = action
toReturn.turnsRemainingForAction = turnsRemainingForAction
@ -126,6 +127,7 @@ class Spy() : IsPartOfGameInfoSerialization {
val oldSpyName = name
name = espionageManager.getSpyName()
action = SpyAction.None
rank = espionageManager.getStartingSpyRank()
civInfo.addNotification("We have recruited a new spy name [$name] after [$oldSpyName] was killed.",
NotificationCategory.Espionage, NotificationIcon.Spy)
}

View File

@ -840,7 +840,8 @@ object UniqueTriggerActivation {
if (!civInfo.gameInfo.isEspionageEnabled()) return null
return {
civInfo.espionageManager.addSpy()
val spyName = civInfo.espionageManager.addSpy().name
civInfo.addNotification("We have recruited [${spyName}] as a spy!", NotificationCategory.Espionage, NotificationIcon.Spy)
true
}
}

View File

@ -230,6 +230,7 @@ enum class UniqueType(
/// Espionage
SpyEffectiveness("[relativeAmount]% spy effectiveness [cityFilter]", UniqueTarget.Global, UniqueTarget.Global),
EnemySpyEffectiveness("[relativeAmount]% enemy spy effectiveness [cityFilter]", UniqueTarget.Global, UniqueTarget.Global),
SpyStartingLevel("New spies start with [amount] level(s)", UniqueTarget.Global),
/// Things you get at the start of the game
StartingTech("Starting tech", UniqueTarget.Tech),