mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
More unique typing
This commit is contained in:
parent
8d3be2323d
commit
6ec61128c4
@ -197,10 +197,10 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
?: return Stats()
|
||||
val stats = specialist.clone()
|
||||
// Deprecated since 3.16.11
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques("[] from every specialist"))
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques(UniqueType.StatsFromSpecialistDeprecated))
|
||||
stats.add(unique.stats)
|
||||
//
|
||||
for (unique in cityInfo.getMatchingUniques("[] from every specialist []"))
|
||||
for (unique in cityInfo.getMatchingUniques(UniqueType.StatsFromSpecialist))
|
||||
if (cityInfo.matchesFilter(unique.params[1]))
|
||||
stats.add(unique.stats)
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques("[] from every []"))
|
||||
@ -232,7 +232,7 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
}
|
||||
|
||||
// "[stats] per [amount] population [cityFilter]"
|
||||
if (unique.placeholderText == "[] per [] population []" && cityInfo.matchesFilter(unique.params[2])) {
|
||||
if (unique.isOfType(UniqueType.StatsPerPopulation) && cityInfo.matchesFilter(unique.params[2])) {
|
||||
val amountOfEffects = (cityInfo.population.population / unique.params[1].toInt()).toFloat()
|
||||
stats.add(unique.stats.times(amountOfEffects))
|
||||
}
|
||||
@ -253,11 +253,6 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
stats.add(unique.stats)
|
||||
//
|
||||
|
||||
// Deprecated since a very long time ago, moved here from another code section
|
||||
if (unique.placeholderText == "+2 Culture per turn from cities before discovering Steam Power" && !cityInfo.civInfo.tech.isResearched("Steam Power"))
|
||||
stats.culture += 2
|
||||
//
|
||||
|
||||
if (unique.placeholderText == "[] per turn from cities before []" && !cityInfo.civInfo.hasTechOrPolicy(unique.params[1]))
|
||||
stats.add(unique.stats)
|
||||
}
|
||||
|
@ -72,6 +72,12 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
|
||||
RemoveAnnexUnhappiness("Remove extra unhappiness from annexed cities", UniqueTarget.Building),
|
||||
|
||||
StatsFromSpecialist("[stats] from every specialist [cityFilter]", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.16.16", ReplaceWith("[stats] from every specialist [in all cities]"), DeprecationLevel.WARNING)
|
||||
StatsFromSpecialistDeprecated("[stats] from every specialist", UniqueTarget.Global),
|
||||
|
||||
StatsPerPopulation("[stats] per [amount] population [cityFilter]", UniqueTarget.Global),
|
||||
|
||||
/////// City-State related uniques
|
||||
|
||||
// I don't like the fact that currently "city state bonuses" are separate from the "global bonuses",
|
||||
|
@ -236,23 +236,20 @@ object UnitActions {
|
||||
}
|
||||
|
||||
private fun addParadropAction(unit: MapUnit, actionList: ArrayList<UnitAction>, worldScreen: WorldScreen) {
|
||||
val paradropUniques = unit.getMatchingUniques("May Paradrop up to [] tiles from inside friendly territory")
|
||||
val paradropUniques =
|
||||
unit.getMatchingUniques("May Paradrop up to [] tiles from inside friendly territory")
|
||||
if (!paradropUniques.any() || unit.isEmbarked()) return
|
||||
unit.paradropRange = paradropUniques.maxOfOrNull { it.params[0] }!!.toInt()
|
||||
actionList += UnitAction(UnitActionType.Paradrop,
|
||||
isCurrentAction = unit.isPreparingParadrop(),
|
||||
action = {
|
||||
if (unit.isPreparingParadrop()) {
|
||||
unit.action = null
|
||||
} else {
|
||||
unit.action = UnitActionType.Paradrop.value
|
||||
}
|
||||
}.takeIf {
|
||||
unit.currentMovement == unit.getMaxMovement().toFloat() &&
|
||||
unit.currentTile.isFriendlyTerritory(unit.civInfo) &&
|
||||
!unit.isEmbarked()
|
||||
})
|
||||
|
||||
isCurrentAction = unit.isPreparingParadrop(),
|
||||
action = {
|
||||
if (unit.isPreparingParadrop()) unit.action = null
|
||||
else unit.action = UnitActionType.Paradrop.value
|
||||
}.takeIf {
|
||||
unit.currentMovement == unit.getMaxMovement().toFloat() &&
|
||||
unit.currentTile.isFriendlyTerritory(unit.civInfo) &&
|
||||
!unit.isEmbarked()
|
||||
})
|
||||
}
|
||||
|
||||
private fun addPillageAction(unit: MapUnit, actionList: ArrayList<UnitAction>, worldScreen: WorldScreen) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user