mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
Starting in later eras triggers era uniques in all previous eras (#7787)
This commit is contained in:
@ -88,6 +88,11 @@ object GameStarter {
|
||||
}
|
||||
}
|
||||
|
||||
if (tileMap.continentSizes.isEmpty()) // Probably saved map without continent data
|
||||
runAndMeasure("assignContinents") {
|
||||
tileMap.assignContinents(TileMap.AssignContinentsMode.Ensure)
|
||||
}
|
||||
|
||||
runAndMeasure("setTransients") {
|
||||
tileMap.setTransients(ruleset) // if we're starting from a map with pre-placed units, they need the civs to exist first
|
||||
tileMap.setStartingLocationsTransients()
|
||||
@ -97,24 +102,20 @@ object GameStarter {
|
||||
gameInfo.setTransients() // needs to be before placeBarbarianUnit because it depends on the tilemap having its gameInfo set
|
||||
}
|
||||
|
||||
runAndMeasure("Techs and Stats") {
|
||||
addCivTechs(gameInfo, ruleset, gameSetupInfo)
|
||||
|
||||
addCivStats(gameInfo)
|
||||
runAndMeasure("addCivStartingUnits") {
|
||||
addCivStartingUnits(gameInfo)
|
||||
}
|
||||
|
||||
runAndMeasure("Policies") {
|
||||
addCivPolicies(gameInfo, ruleset)
|
||||
}
|
||||
|
||||
if (tileMap.continentSizes.isEmpty()) // Probably saved map without continent data
|
||||
runAndMeasure("assignContinents") {
|
||||
tileMap.assignContinents(TileMap.AssignContinentsMode.Ensure)
|
||||
runAndMeasure("Techs and Stats") {
|
||||
addCivTechs(gameInfo, ruleset, gameSetupInfo)
|
||||
}
|
||||
|
||||
runAndMeasure("addCivStartingUnits") {
|
||||
// and only now do we add units for everyone, because otherwise both the gameInfo.setTransients() and the placeUnit will both add the unit to the civ's unit list!
|
||||
addCivStartingUnits(gameInfo)
|
||||
runAndMeasure("Starting stats") {
|
||||
addCivStats(gameInfo)
|
||||
}
|
||||
|
||||
// remove starting locations once we're done
|
||||
|
@ -333,11 +333,14 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
civInfo.addNotification("[" + policyBranch.name + "] policy branch unlocked!", NotificationIcon.Culture)
|
||||
}
|
||||
// Note that if you somehow skip over an era, its uniques aren't triggered
|
||||
for (unique in currentEra.uniqueObjects) {
|
||||
val erasPassed = getRuleset().eras.values
|
||||
.filter { it.eraNumber > previousEra.eraNumber && it.eraNumber <= currentEra.eraNumber }
|
||||
.sortedBy { it.eraNumber }
|
||||
for (era in erasPassed)
|
||||
for (unique in era.uniqueObjects)
|
||||
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateEra() {
|
||||
val ruleset = civInfo.gameInfo.ruleSet
|
||||
|
@ -26,7 +26,7 @@ object UniqueTriggerActivation {
|
||||
tile: TileInfo? = null,
|
||||
notification: String? = null
|
||||
): Boolean {
|
||||
val timingConditional = unique.conditionals.firstOrNull{it.type == ConditionalTimedUnique}
|
||||
val timingConditional = unique.conditionals.firstOrNull { it.type == ConditionalTimedUnique }
|
||||
if (timingConditional != null) {
|
||||
civInfo.temporaryUniques.add(TemporaryUnique(unique, timingConditional.params[0].toInt()))
|
||||
return true
|
||||
@ -486,6 +486,7 @@ object UniqueTriggerActivation {
|
||||
val spyName = otherCiv.espionageManager.addSpy()
|
||||
otherCiv.espionageManager.erasSpyEarnedFor.add(currentEra)
|
||||
if (otherCiv == civInfo || otherCiv.knows(civInfo))
|
||||
// We don't tell which civilization entered the new era, as that is done in the notification directly above this one
|
||||
otherCiv.addNotification("We have recruited [${spyName}] as a spy!", NotificationIcon.Spy)
|
||||
else
|
||||
otherCiv.addNotification("After an unknown civilization entered the [${currentEra}], we have recruited [${spyName}] as a spy!", NotificationIcon.Spy)
|
||||
|
Reference in New Issue
Block a user