More unique typing

This commit is contained in:
Yair Morgenstern 2022-02-14 19:05:54 +02:00
parent 4d02cdeb3b
commit bce65a96f6
5 changed files with 37 additions and 8 deletions

View File

@ -156,7 +156,7 @@ class BarbarianManager {
*/
private fun notifyCivsOfBarbarianEncampment(tile: TileInfo) {
gameInfo.civilizations.filter {
it.hasUnique("Notified of new Barbarian encampments")
it.hasUnique(UniqueType.NotifiedOfBarbarianEncampments)
&& it.exploredTiles.contains(tile.position)
}
.forEach {

View File

@ -103,7 +103,7 @@ object BattleDamage {
}
if (enemy.getCivInfo().isCityState()
&& civInfo.hasUnique("+30% Strength when fighting City-State units and cities")
&& civInfo.hasUnique(UniqueType.StrengthBonusVsCityStates)
)
modifiers["vs [City-States]"] = 30
} else if (combatant is CityCombatant) {

View File

@ -378,7 +378,7 @@ class TechManager {
}
private fun updateTransientBooleans() {
wayfinding = civInfo.hasUnique("Can embark and move over Coasts and Oceans immediately")
wayfinding = civInfo.hasUnique(UniqueType.EmbarkAndEnterOcean)
unitsCanEmbark = wayfinding || civInfo.hasUnique(UniqueType.LandUnitEmbarkation)
embarkedUnitsCanEnterOcean = wayfinding || civInfo.hasUnique(UniqueType.EmbarkedUnitsMayEnterOcean)

View File

@ -241,6 +241,8 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
EnablesConstructionOfSpaceshipParts("Enables construction of Spaceship parts", UniqueTarget.Global),
NotifiedOfBarbarianEncampments("Notified of new Barbarian encampments", UniqueTarget.Global),
EnablesOpenBorders("Enables Open Borders agreements", UniqueTarget.Global),
// Should the 'R' in 'Research agreements' be capitalized?
EnablesResearchAgreements("Enables Research agreements", UniqueTarget.Global),
@ -282,6 +284,8 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
// ToDo: make per unit and use unit filters?
LandUnitEmbarkation("Enables embarkation for land units", UniqueTarget.Global),
EmbarkedUnitsMayEnterOcean("Enables embarked units to enter ocean tiles", UniqueTarget.Global),
// todo: Should this be deprecated and replaces with the two above uniques?
EmbarkAndEnterOcean("Can embark and move over Coasts and Oceans immediately", UniqueTarget.Global),
PopulationLossFromNukes("Population loss from nuclear attacks [amount]% [cityFilter]", UniqueTarget.Global),
@Deprecated("as of 3.19.2", ReplaceWith("Population loss from nuclear attacks [-amount]% [in this city]"))
@ -365,6 +369,8 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
Strength("[amount]% Strength", UniqueTarget.Unit, UniqueTarget.Global),
StrengthNearCapital("[amount]% Strength decreasing with distance from the capital", UniqueTarget.Unit, UniqueTarget.Global),
FlankAttackBonus("[amount]% to Flank Attack bonuses", UniqueTarget.Unit, UniqueTarget.Global),
// There's currently no conditional that would allow you strength vs city-state *cities* and that's why this isn't deprecated yet
StrengthBonusVsCityStates("+30% Strength when fighting City-State units and cities", UniqueTarget.Global),
Movement("[amount] Movement", UniqueTarget.Unit, UniqueTarget.Global),
Sight("[amount] Sight", UniqueTarget.Unit, UniqueTarget.Global, UniqueTarget.Terrain),

View File

@ -131,6 +131,9 @@ Example: "[20]% Production towards any buildings that already exist in the Capit
Applicable to: Global, FollowerBelief
#### Tile yields from Natural Wonders doubled
Applicable to: Global
#### Military Units gifted from City-States start with [amount] XP
Example: "Military Units gifted from City-States start with [20] XP"
@ -362,6 +365,22 @@ Example: "[20]% Culture cost of adopting new Policies"
Applicable to: Global
#### Quantity of strategic resources produced by the empire +[amount]%
Example: "Quantity of strategic resources produced by the empire +[20]%"
Applicable to: Global
#### Double quantity of [resource] produced
Example: "Double quantity of [Iron] produced"
Applicable to: Global
#### Double Happiness from Natural Wonders
Applicable to: Global
#### Enables construction of Spaceship parts
Applicable to: Global
#### Enables Open Borders agreements
Applicable to: Global
@ -463,6 +482,9 @@ Example: "[20] Unit Supply per city"
Applicable to: Global
#### Units in cities cost no Maintenance
Applicable to: Global
#### Rebel units may spawn
Applicable to: Global
@ -634,11 +656,6 @@ Example: "[Wounded] units gain the [Shock I] promotion"
Applicable to: Global
#### Quantity of strategic resources produced by the empire +[amount]%
Example: "Quantity of strategic resources produced by the empire +[20]%"
Applicable to: Global
#### Provides the cheapest [stat] building in your first [amount] cities for free
Example: "Provides the cheapest [Culture] building in your first [20] cities for free"
@ -838,6 +855,9 @@ Example: "Blast radius [20]"
Applicable to: Unit
#### Ranged attacks may be performed over obstacles
Applicable to: Unit
#### Uncapturable
Applicable to: Unit
@ -846,6 +866,9 @@ Example: "May withdraw before melee ([20]%)"
Applicable to: Unit
#### Unable to capture cities
Applicable to: Unit
#### Can move after attacking
Applicable to: Unit