mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Added two more conditionals and updated movement, sight & combat to use these (#5389)
This commit is contained in:
parent
07822de375
commit
e1b4c53573
@ -270,12 +270,12 @@
|
||||
{
|
||||
"name": "Messiah",
|
||||
"type": "Enhancer",
|
||||
"uniques": ["[+25]% Spread Religion Strength for [Great Prophet] units", "[-25]% Faith cost of generating Great Prophet equivalents"]
|
||||
"uniques": ["[+25]% Spread Religion Strength <for [Great Prophet] units>", "[-25]% Faith cost of generating Great Prophet equivalents"]
|
||||
},
|
||||
{
|
||||
"name": "Missionary Zeal",
|
||||
"type": "Enhancer",
|
||||
"uniques": ["[+25]% Spread Religion Strength for [Missionary] units"]
|
||||
"uniques": ["[+25]% Spread Religion Strength <for [Missionary] units>"]
|
||||
},
|
||||
{
|
||||
"name": "Religious Texts",
|
||||
|
@ -207,8 +207,8 @@
|
||||
"culture": 1,
|
||||
"greatPersonPoints": {"Great Merchant": 1},
|
||||
"isWonder": true,
|
||||
"uniques": ["Must be next to [Coast]", "+[1] Movement for all [{Military} {Water}] units",
|
||||
"[+1] Sight for all [{Military} {Water}] units", "Provides a free [Lighthouse] [in this city]"],
|
||||
"uniques": ["Must be next to [Coast]", "[+1] Movement <for [{Military} {Water}] units>",
|
||||
"[+1] Sight <for [{Military} {Water}] units>", "Provides a free [Lighthouse] [in this city]"],
|
||||
"requiredTech": "Optics",
|
||||
"quote": "'They that go down to the sea in ships, that do business in great waters; these see the works of the Lord, and his wonders in the deep.' - The Bible, Psalms 107:23-24"
|
||||
},
|
||||
|
@ -139,7 +139,7 @@
|
||||
"outerColor": [ 114, 0, 0],
|
||||
"innerColor": [255,255,255],
|
||||
"uniqueName": "Sun Never Sets",
|
||||
"uniques": ["+[2] Movement for all [Water] units"],
|
||||
"uniques": ["[+2] Movement <for [Water] units>"],
|
||||
"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",
|
||||
@ -262,7 +262,7 @@
|
||||
"outerColor": [ 28,51,119],
|
||||
"innerColor": [255,255,255],
|
||||
"uniqueName": "Manifest Destiny",
|
||||
"uniques": ["[+1] Sight for all [{Military} {Land}] units", "-[50]% Gold cost of acquiring tiles [in all cities]"],
|
||||
"uniques": ["[+1] Sight <for [{Military} {Land}] units>", "-[50]% Gold cost of acquiring tiles [in all cities]"],
|
||||
"cities": ["Washington","New York","Boston","Philadelphia","Atlanta","Chicago","Seattle","San Francisco","Los Angeles","Houston",
|
||||
"Portland","St. Louis","Miami","Buffalo","Detroit","New Orleans","Baltimore","Denver","Cincinnati","Dallas","Memphis",
|
||||
"Cleveland","Kansas City","San Diego","Richmond","Las Vegas","Phoenix","Albuquerque","Minneapolis","Pittsburgh",
|
||||
@ -442,7 +442,7 @@
|
||||
"outerColor": [153,5,3],
|
||||
"innerColor": [244,232,54],
|
||||
"uniqueName": "Achaemenid Legacy",
|
||||
"uniques": ["Golden Age length increased by [50]%", "+1 Movement for all units during Golden Age", "+10% Strength for all units during Golden Age"],
|
||||
"uniques": ["Golden Age length increased by [50]%", "[+1] Movement <for [All] units> <during a Golden Age>", "[+10]% Strength <for [All] units> <during a Golden Age>"],
|
||||
"cities": ["Persepolis","Parsagadae","Susa","Ecbatana","Tarsus","Gordium","Bactra","Sardis","Ergili","Dariushkabir",
|
||||
"Ghulaman","Zohak","Istakhr","Jinjan","Borazjan","Herat","Dakyanus","Bampur","Turengtepe","Rey","Shiraz",
|
||||
"Thuspa","Hasanlu","Gabae","Merv","Behistun","Kandahar","Altintepe","Bunyan","Charsadda","Uratyube",
|
||||
@ -470,7 +470,7 @@
|
||||
"outerColor": [225,105,0],
|
||||
"innerColor": [255,255,78],
|
||||
"uniqueName": "Wayfinding",
|
||||
"uniques": ["Can embark and move over Coasts and Oceans immediately", "[+1] Sight for all [Embarked] units", "+[10]% Strength if within [2] tiles of a [Moai]"],
|
||||
"uniques": ["Can embark and move over Coasts and Oceans immediately", "Normal vision when embarked <for [All] units>", "+[10]% Strength if within [2] tiles of a [Moai]"],
|
||||
"cities": ["Honolulu","Samoa","Tonga","Nuku Hiva","Raiatea","Aotearoa","Tahiti","Hilo","Te Wai Pounamu","Rapa Nui",
|
||||
"Tuamotu","Rarotonga","Tuvalu","Tubuai","Mangareva","Oahu","Kiritimati","Ontong Java","Niue","Rekohu",
|
||||
"Rakahanga","Bora Bora","Kailua","Uvea","Futuna","Rotuma","Tokelau","Lahaina","Bellona","Mungava","Tikopia",
|
||||
@ -570,7 +570,7 @@
|
||||
"outerColor": [81,0,9],
|
||||
"innerColor": [255,120,0],
|
||||
"uniqueName": "Mongol Terror",
|
||||
"uniques": ["+30% Strength when fighting City-State units and cities", "+[1] Movement for all [Mounted] units"],
|
||||
"uniques": ["+30% Strength when fighting City-State units and cities", "[+1] Movement <for [Mounted] units>"],
|
||||
"cities": ["Karakorum","Beshbalik","Turfan","Hsia","Old Sarai","New Sarai","Tabriz","Tiflis","Otrar","Sanchu","Kazan",
|
||||
"Almarikh","Ulaanbaatar","Hovd","Darhan","Dalandzadgad","Mandalgovi","Choybalsan","Erdenet","Tsetserieg",
|
||||
"Baruun-Urt","Ereen","Batshireet","Choyr","Ulaangom","Tosontsengel","Altay","Uliastay","Bayanhongor",
|
||||
|
@ -230,8 +230,8 @@
|
||||
"policies": [
|
||||
{
|
||||
"name": "Naval Tradition",
|
||||
"uniques": ["+[1] Movement for all [{Military} {Water}] units", "[+1] Sight for all [{Military} {Water}] units",
|
||||
"Free [Great General] appears", "+[2] Movement for all [Great Admiral] units"
|
||||
"uniques": ["[+1] Movement <for [{Military} {Water}] units>", "[+1] Sight <for [{Military} {Water}] units>",
|
||||
"Free [Great General] appears", "[+2] Movement <for [Great Admiral] units>"
|
||||
],
|
||||
"row": 1,
|
||||
"column": 2
|
||||
@ -372,7 +372,7 @@
|
||||
"policies": [
|
||||
{
|
||||
"name": "Populism",
|
||||
"uniques": ["[Wounded] units deal +[25]% damage"],
|
||||
"uniques": ["[+25]% Strength <for [Wounded] units>"],
|
||||
"row": 1,
|
||||
"column": 1
|
||||
},
|
||||
@ -384,7 +384,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Fascism",
|
||||
"uniques": ["Quantity of strategic resources produced by the empire +[100]%", "+[2] Movement for all [Great General] units"],
|
||||
"uniques": ["Quantity of strategic resources produced by the empire +[100]%", "[+2] Movement <for [Great General] units>"],
|
||||
"requires": ["Populism","Militarism"],
|
||||
"row": 2,
|
||||
"column": 3
|
||||
|
@ -157,13 +157,13 @@
|
||||
// Scout
|
||||
{
|
||||
"name": "Scouting I",
|
||||
"uniques": ["[+1] Visibility Range"],
|
||||
"uniques": ["[+1] Sight"],
|
||||
"unitTypes": ["Scout"]
|
||||
},
|
||||
{
|
||||
"name": "Scouting II",
|
||||
"prerequisites": ["Scouting I"],
|
||||
"uniques": ["[+1] Visibility Range"],
|
||||
"uniques": ["[+1] Sight"],
|
||||
"unitTypes": ["Scout"]
|
||||
},
|
||||
{
|
||||
@ -459,7 +459,7 @@
|
||||
{
|
||||
"name": "Sentry",
|
||||
"prerequisites": ["Accuracy I","Barrage I","Shock II","Drill II","Bombardment I","Targeting I","Boarding Party I","Coastal Raider I"],
|
||||
"uniques": ["[+1] Visibility Range"],
|
||||
"uniques": ["[+1] Sight"],
|
||||
"unitTypes": ["Sword","Gunpowder","Mounted","Ranged Water","Armored","Melee Water"]
|
||||
},
|
||||
{
|
||||
|
@ -316,7 +316,7 @@
|
||||
"obsoleteTech": "Physics",
|
||||
"upgradesTo": "Trebuchet",
|
||||
"uniques": ["[+300]% Strength <vs cities>", "No defensive terrain bonus", "[-33]% Strength <when defending>",
|
||||
"-[1] Visibility Range", "Can only attack [City] units"],
|
||||
"[-1] Sight", "Can only attack [City] units"],
|
||||
"promotions": ["Cover I"],
|
||||
"attackSound": "throw"
|
||||
},
|
||||
@ -603,7 +603,7 @@
|
||||
"requiredResource": "Horses",
|
||||
"upgradesTo": "Cavalry",
|
||||
"obsoleteTech": "Military Science",
|
||||
"uniques": ["Can move after attacking","No defensive terrain bonus", "Founds a new city", "[+2] Visibility Range", "Defense bonus when embarked"],
|
||||
"uniques": ["Can move after attacking","No defensive terrain bonus", "Founds a new city", "[+2] Sight", "Defense bonus when embarked"],
|
||||
"attackSound": "horse"
|
||||
//Conquistador should have no penalty attacking cities
|
||||
//Ability to found new cities can only be used on a foreign continent that does not contain the Spanish capital.
|
||||
@ -784,7 +784,7 @@
|
||||
"requiredTech": "Astronomy",
|
||||
"upgradesTo": "Ironclad",
|
||||
"obsoleteTech": "Combustion",
|
||||
"uniques": ["[+1] Visibility Range", "May withdraw before melee ([80]%)"],
|
||||
"uniques": ["[+1] Sight", "May withdraw before melee ([80]%)"],
|
||||
"hurryCostModifier": 30,
|
||||
"attackSound": "cannon"
|
||||
},
|
||||
@ -920,7 +920,7 @@
|
||||
"rangedStrength": 35,
|
||||
"cost": 185,
|
||||
"requiredResource": "Iron",
|
||||
"uniques": ["[+1] Visibility Range"],
|
||||
"uniques": ["[+1] Sight"],
|
||||
"requiredTech": "Navigation",
|
||||
"obsoleteTech": "Electronics",
|
||||
"upgradesTo": "Battleship",
|
||||
@ -952,7 +952,7 @@
|
||||
"requiredTech": "Metallurgy",
|
||||
"requiredResource": "Horses",
|
||||
"uniques": ["Can move after attacking","No defensive terrain bonus","[-33]% Strength <vs cities>",
|
||||
"[+1] Visibility Range", "No movement cost to pillage"],
|
||||
"[+1] Sight", "No movement cost to pillage"],
|
||||
"promotions": ["Formation I"],
|
||||
"upgradesTo": "Anti-Tank Gun",
|
||||
"obsoleteTech": "Combined Arms",
|
||||
@ -1090,7 +1090,7 @@
|
||||
"requiredResource": "Horses",
|
||||
"upgradesTo": "Landship",
|
||||
"uniques": ["Can move after attacking","No defensive terrain bonus","[-33]% Strength <vs cities>" ,
|
||||
"[+1] Visibility Range", "[+50]% to Flank Attack bonuses" ],
|
||||
"[+1] Sight", "[+50]% to Flank Attack bonuses" ],
|
||||
"attackSound": "horse"
|
||||
},
|
||||
{
|
||||
@ -1490,7 +1490,7 @@
|
||||
"rangedStrength": 85,
|
||||
"cost": 425,
|
||||
"requiredTech": "Telecommunications",
|
||||
"uniques": ["[+75]% Strength <when attacking>", "Can only attack [Water] tiles", "[+1] Visibility Range", "Can carry [2] [Missile] units"],
|
||||
"uniques": ["[+75]% Strength <when attacking>", "Can only attack [Water] tiles", "[+1] Sight", "Can carry [2] [Missile] units"],
|
||||
"attackSound": "torpedo"
|
||||
},
|
||||
{
|
||||
@ -1600,7 +1600,7 @@
|
||||
"unitType": "Civilian",
|
||||
"uniques": ["Can construct [Holy site] if it hasn't used other actions yet", "Can [Spread Religion] [4] times",
|
||||
"Removes other religions when spreading religion", "May found a religion", "May enhance a religion",
|
||||
"May enter foreign tiles without open borders", "[-1] Visibility Range", "Great Person - [Faith]",
|
||||
"May enter foreign tiles without open borders", "[-1] Sight", "Great Person - [Faith]",
|
||||
"Unbuildable", "Religious Unit", "Hidden when religion is disabled",
|
||||
"Takes your religion over the one in their birth city"],
|
||||
"movement": 2,
|
||||
@ -1630,7 +1630,7 @@
|
||||
"unitType": "Civilian",
|
||||
"uniques": ["Can [Spread Religion] [2] times", "May enter foreign tiles without open borders, but loses [250] religious strength each turn it ends there",
|
||||
"Can be purchased with [Faith] [in all cities in which the majority religion is a major religion]",
|
||||
"[-1] Visibility Range", "Unbuildable", "Religious Unit", "Hidden when religion is disabled"],
|
||||
"[-1] Sight", "Unbuildable", "Religious Unit", "Hidden when religion is disabled"],
|
||||
"movement": 4,
|
||||
"religiousStrength": 1000
|
||||
},
|
||||
@ -1640,7 +1640,7 @@
|
||||
"uniques": ["Prevents spreading of religion to the city it is next to",
|
||||
"Can [Remove Foreign religions from your own cities] [1] times",
|
||||
"Can be purchased with [Faith] [in all cities in which the majority religion is an enhanced religion]",
|
||||
"[+1] Visibility Range", "Hidden when religion is disabled", "Unbuildable", "Religious Unit"
|
||||
"[+1] Sight", "Hidden when religion is disabled", "Unbuildable", "Religious Unit"
|
||||
],
|
||||
"movement": 3,
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ object BattleDamage {
|
||||
if (combatant is MapUnitCombatant) {
|
||||
for (unique in combatant.unit.getMatchingUniques(
|
||||
UniqueType.Strength,
|
||||
StateForConditionals(civInfo, defender = enemy, combatAction = combatAction))
|
||||
StateForConditionals(civInfo, defender = enemy, attacker = combatant, combatAction = combatAction))
|
||||
) {
|
||||
modifiers.add(getModifierStringFromUnique(unique), unique.params[0].toInt())
|
||||
}
|
||||
@ -68,11 +68,13 @@ object BattleDamage {
|
||||
-90
|
||||
) // otherwise it could exceed -100% and start healing enemy units...
|
||||
|
||||
for (unique in civInfo.getMatchingUniques("[] units deal +[]% damage")) {
|
||||
if (combatant.matchesCategory(unique.params[0])) {
|
||||
modifiers.add(unique.params[0], unique.params[1].toInt())
|
||||
// Deprecated since 3.17.5
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.DamageForUnits)) {
|
||||
if (combatant.matchesCategory(unique.params[0])) {
|
||||
modifiers.add(unique.params[0], unique.params[1].toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
val adjacentUnits = combatant.getTile().neighbors.flatMap { it.getUnits() }
|
||||
|
||||
@ -113,8 +115,10 @@ object BattleDamage {
|
||||
modifiers["Stacked with [${unique.params[1]}]"] = stackedUnitsBonus
|
||||
}
|
||||
|
||||
if (civInfo.goldenAges.isGoldenAge() && civInfo.hasUnique("+10% Strength for all units during Golden Age"))
|
||||
modifiers["Golden Age"] = 10
|
||||
// Deprecated since 3.17.5
|
||||
if (civInfo.goldenAges.isGoldenAge() && civInfo.hasUnique(UniqueType.StrengthGoldenAge))
|
||||
modifiers["Golden Age"] = 10
|
||||
//
|
||||
|
||||
if (enemy.getCivInfo()
|
||||
.isCityState() && civInfo.hasUnique("+30% Strength when fighting City-State units and cities")
|
||||
|
@ -336,7 +336,7 @@ class CivilizationInfo {
|
||||
else city.getAllUniquesWithNonLocalEffects()
|
||||
}
|
||||
|
||||
fun hasUnique(uniqueType: UniqueType) = getMatchingUniques(uniqueType).any()
|
||||
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null) = getMatchingUniques(uniqueType, stateForConditionals).any()
|
||||
fun hasUnique(unique: String) = getMatchingUniques(unique).any()
|
||||
|
||||
// Does not return local uniques, only global ones.
|
||||
|
@ -191,32 +191,7 @@ class MapUnit {
|
||||
DecimalFormat("0.#").format(currentMovement.toDouble()) + "/" + getMaxMovement()
|
||||
|
||||
fun getTile(): TileInfo = currentTile
|
||||
fun getMaxMovement(): Int {
|
||||
var movement =
|
||||
if (isEmbarked()) 2
|
||||
else baseUnit.movement
|
||||
|
||||
movement += getMatchingUniques("[] Movement").sumOf { it.params[0].toInt() }
|
||||
|
||||
for (unique in civInfo.getMatchingUniques("+[] Movement for all [] units"))
|
||||
if (matchesFilter(unique.params[1]))
|
||||
movement += unique.params[0].toInt()
|
||||
|
||||
if (civInfo.goldenAges.isGoldenAge() &&
|
||||
civInfo.hasUnique("+1 Movement for all units during Golden Age")
|
||||
)
|
||||
movement += 1
|
||||
|
||||
// Deprecated since 3.16.11
|
||||
if (isEmbarked()) {
|
||||
movement += civInfo.getMatchingUniques("Increases embarked movement +1").count()
|
||||
if (civInfo.hasUnique("+1 Movement for all embarked units")) movement += 1
|
||||
}
|
||||
//
|
||||
|
||||
return movement
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This SHOULD NOT be a HashSet, because if it is, then promotions with the same text (e.g. barrage I, barrage II)
|
||||
// will not get counted twice!
|
||||
@ -240,8 +215,9 @@ class MapUnit {
|
||||
return tempUniques.any { it.placeholderText == unique } || civInfo.hasUnique(unique)
|
||||
}
|
||||
|
||||
fun hasUnique(uniqueType: UniqueType): Boolean {
|
||||
return tempUniques.any { it.type == uniqueType } || civInfo.hasUnique(uniqueType)
|
||||
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Boolean {
|
||||
return tempUniques.any { it.type == uniqueType && it.conditionalsApply(stateForConditionals) }
|
||||
|| civInfo.hasUnique(uniqueType, stateForConditionals)
|
||||
}
|
||||
|
||||
fun updateUniques(ruleset: Ruleset) {
|
||||
@ -323,6 +299,38 @@ class MapUnit {
|
||||
newUnit.updateVisibleTiles()
|
||||
}
|
||||
|
||||
|
||||
fun getMaxMovement(): Int {
|
||||
var movement =
|
||||
if (isEmbarked()) 2
|
||||
else baseUnit.movement
|
||||
|
||||
movement += getMatchingUniques(UniqueType.Movement, StateForConditionals(civInfo = civInfo, unit = this))
|
||||
.sumOf { it.params[0].toInt() }
|
||||
|
||||
// Deprecated since 3.17.5
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.MovementUnits))
|
||||
if (matchesFilter(unique.params[1]))
|
||||
movement += unique.params[0].toInt()
|
||||
|
||||
if (civInfo.goldenAges.isGoldenAge() &&
|
||||
civInfo.hasUnique(UniqueType.MovementGoldenAge)
|
||||
)
|
||||
movement += 1
|
||||
//
|
||||
|
||||
// Deprecated since 3.16.11
|
||||
if (isEmbarked()) {
|
||||
movement += civInfo.getMatchingUniques("Increases embarked movement +1").count()
|
||||
if (civInfo.hasUnique("+1 Movement for all embarked units")) movement += 1
|
||||
}
|
||||
//
|
||||
|
||||
if (movement < 1) movement = 1
|
||||
|
||||
return movement
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines this (land or sea) unit's current maximum vision range from unit properties, civ uniques and terrain.
|
||||
* @return Maximum distance of tiles this unit may possibly see
|
||||
@ -331,22 +339,25 @@ class MapUnit {
|
||||
var visibilityRange = 2
|
||||
|
||||
if (isEmbarked() && !hasUnique("Normal vision when embarked")) {
|
||||
visibilityRange = 1
|
||||
for (unique in getMatchingUniques("[] Sight for all [] units"))
|
||||
if (unique.params[1] == "Embarked") // only count bonuses explicitly for embarked units
|
||||
visibilityRange += unique.params[0].toInt()
|
||||
return visibilityRange
|
||||
return 1
|
||||
}
|
||||
|
||||
for (unique in getMatchingUniques("[] Sight for all [] units"))
|
||||
if (matchesFilter(unique.params[1]))
|
||||
visibilityRange += unique.params[0].toInt()
|
||||
|
||||
// TODO: This should be replaced with "Sight" like others, for naming consistency
|
||||
visibilityRange += getMatchingUniques("[] Visibility Range").sumOf { it.params[0].toInt() }
|
||||
visibilityRange += getMatchingUniques(UniqueType.Sight, StateForConditionals(civInfo = civInfo, unit = this))
|
||||
.sumOf { it.params[0].toInt() }
|
||||
|
||||
// Deprecated since 3.17.5
|
||||
for (unique in getMatchingUniques(UniqueType.SightUnits))
|
||||
if (matchesFilter(unique.params[1]))
|
||||
visibilityRange += unique.params[0].toInt()
|
||||
|
||||
|
||||
visibilityRange += getMatchingUniques(UniqueType.VisibilityRange).sumOf { it.params[0].toInt() }
|
||||
//
|
||||
|
||||
// Should this be consolidated as "[-1] Sight"?
|
||||
if (hasUnique("Limited Visibility")) visibilityRange -= 1
|
||||
|
||||
// Maybe add the uniques of the tile a unit is standing on to the tempUniques of the unit?
|
||||
for (unique in getTile().getAllTerrains().flatMap { it.uniqueObjects })
|
||||
if (unique.placeholderText == "[] Sight for [] units" && matchesFilter(unique.params[1]))
|
||||
visibilityRange += unique.params[0].toInt()
|
||||
@ -355,7 +366,7 @@ class MapUnit {
|
||||
|
||||
return visibilityRange
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update this unit's cache of viewable tiles and its civ's as well.
|
||||
*/
|
||||
@ -1084,9 +1095,15 @@ class MapUnit {
|
||||
|
||||
fun getPressureAddedFromSpread(): Int {
|
||||
var pressureAdded = baseUnit.religiousStrength.toFloat()
|
||||
for (unique in civInfo.getMatchingUniques("[]% Spread Religion Strength for [] units"))
|
||||
if (matchesFilter(unique.params[0]))
|
||||
pressureAdded *= unique.params[0].toPercent()
|
||||
|
||||
// Deprecated since 3.17.5
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.SpreadReligionStrengthUnits))
|
||||
if (matchesFilter(unique.params[0]))
|
||||
pressureAdded *= unique.params[0].toPercent()
|
||||
//
|
||||
|
||||
for (unique in getMatchingUniques(UniqueType.SpreadReligionStrength, StateForConditionals(civInfo = civInfo, unit = this)))
|
||||
pressureAdded *= unique.params[0].toPercent()
|
||||
|
||||
return pressureAdded.toInt()
|
||||
}
|
||||
|
@ -4,12 +4,15 @@ import com.unciv.logic.battle.CombatAction
|
||||
import com.unciv.logic.battle.ICombatant
|
||||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.logic.map.TileInfo
|
||||
|
||||
data class StateForConditionals(
|
||||
val civInfo: CivilizationInfo? = null,
|
||||
val cityInfo: CityInfo? = null,
|
||||
// val attacker: ICombatant? = null,
|
||||
val unit: MapUnit? = null,
|
||||
|
||||
val attacker: ICombatant? = null,
|
||||
val defender: ICombatant? = null,
|
||||
// val attackedTile: TileInfo? = null,
|
||||
val combatAction: CombatAction? = null,
|
||||
|
@ -45,18 +45,26 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|
||||
state: StateForConditionals
|
||||
): Boolean {
|
||||
return when (condition.type) {
|
||||
UniqueType.ConditionalNotWar -> state.civInfo?.isAtWar() == false
|
||||
UniqueType.ConditionalWar -> state.civInfo?.isAtWar() == true
|
||||
UniqueType.ConditionalSpecialistCount ->
|
||||
state.cityInfo != null && state.cityInfo.population.getNumberOfSpecialists() >= condition.params[0].toInt()
|
||||
UniqueType.ConditionalNotWar -> state.civInfo?.isAtWar() == false
|
||||
UniqueType.ConditionalHappy ->
|
||||
state.civInfo != null && state.civInfo.statsForNextTurn.happiness >= 0
|
||||
UniqueType.ConditionalGoldenAge ->
|
||||
state.civInfo != null && state.civInfo.goldenAges.isGoldenAge()
|
||||
|
||||
UniqueType.ConditionalSpecialistCount ->
|
||||
state.cityInfo != null && state.cityInfo.population.getNumberOfSpecialists() >= condition.params[0].toInt()
|
||||
|
||||
UniqueType.ConditionalVsCity ->
|
||||
state.defender != null && state.defender.matchesCategory("City")
|
||||
UniqueType.ConditionalVsUnits ->
|
||||
state.defender != null && state.defender.matchesCategory(condition.params[0])
|
||||
UniqueType.ConditionalOurUnit ->
|
||||
(state.attacker != null && state.attacker.matchesCategory(condition.params[0]))
|
||||
|| (state.unit != null && state.unit.matchesFilter(condition.params[0]))
|
||||
UniqueType.ConditionalAttacking -> state.combatAction == CombatAction.Attack
|
||||
UniqueType.ConditionalDefending -> state.combatAction == CombatAction.Defend
|
||||
|
||||
UniqueType.ConditionalNeighborTiles ->
|
||||
state.cityInfo != null &&
|
||||
state.cityInfo.getCenterTile().neighbors.count {
|
||||
|
@ -115,6 +115,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
FreeExtraBeliefs("May choose [amount] additional [beliefType] beliefs when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
||||
FreeExtraAnyBeliefs("May choose [amount] additional of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global),
|
||||
|
||||
|
||||
///////////////////////////////////////// UNIT UNIQUES /////////////////////////////////////////
|
||||
|
||||
Strength("[amount]% Strength", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
@ -135,7 +136,29 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
StrengthDefending("+[amount]% Strength when defending", UniqueTarget.Unit),
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount]% Strength <when defending> <vs [mapUnitFilter] units>"), DeprecationLevel.WARNING)
|
||||
StrengthDefendingUnitFilter("[amount]% Strength when defending vs [mapUnitFilter] units", UniqueTarget.Unit),
|
||||
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount]% Strength <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
|
||||
DamageForUnits("[mapUnitFilter] units deal +[amount]% damage", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[+10]% Strength <for [All] units> <during a Golden Age>"), DeprecationLevel.WARNING)
|
||||
StrengthGoldenAge("+10% Strength for all units during Golden Age", UniqueTarget.Global),
|
||||
|
||||
Movement("[amount] Movement", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
Sight("[amount] Sight", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
SpreadReligionStrength("[amount]% Spread Religion Strength", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Movement <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
|
||||
MovementUnits("+[amount] Movement for all [mapUnitFilter] units", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Movement <for [All] units> <during a Golden Age>"), DeprecationLevel.WARNING)
|
||||
MovementGoldenAge("+1 Movement for all units during Golden Age", UniqueTarget.Global),
|
||||
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Sight <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
|
||||
SightUnits("[amount] Sight for all [mapUnitFilter] units", UniqueTarget.Global),
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Sight"), DeprecationLevel.WARNING)
|
||||
VisibilityRange("[amount] Visibility Range", UniqueTarget.Unit),
|
||||
|
||||
@Deprecated("As of 3.17.5", ReplaceWith("[amount]% Spread Religion Strength <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
|
||||
SpreadReligionStrengthUnits("[amount]% Spread Religion Strength for [mapUnitFilter] units", UniqueTarget.Global),
|
||||
|
||||
|
||||
// The following block gets cached in MapUnit for faster getMovementCostBetweenAdjacentTiles
|
||||
DoubleMovementOnTerrain("Double movement in [terrainFilter]", UniqueTarget.Unit),
|
||||
@Deprecated("As of 3.17.1", ReplaceWith("Double movement in [terrainFilter]"), DeprecationLevel.WARNING)
|
||||
@ -153,6 +176,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
CannotEnterOcean("Cannot enter ocean tiles", UniqueTarget.Unit),
|
||||
CannotEnterOceanUntilAstronomy("Cannot enter ocean tiles until Astronomy", UniqueTarget.Unit),
|
||||
|
||||
|
||||
//////////////////////////////////////// TERRAIN UNIQUES ////////////////////////////////////////
|
||||
|
||||
NaturalWonderNeighborCount("Must be adjacent to [amount] [simpleTerrain] tiles", UniqueTarget.Terrain),
|
||||
@ -175,10 +199,17 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
|
||||
///////////////////////////////////////// CONDITIONALS /////////////////////////////////////////
|
||||
|
||||
// civ conditionals
|
||||
ConditionalWar("when at war", UniqueTarget.Conditional),
|
||||
ConditionalNotWar("when not at war", UniqueTarget.Conditional),
|
||||
ConditionalSpecialistCount("if this city has at least [amount] specialists", UniqueTarget.Conditional),
|
||||
ConditionalHappy("while the empire is happy", UniqueTarget.Conditional),
|
||||
ConditionalGoldenAge("during a Golden Age", UniqueTarget.Conditional),
|
||||
|
||||
// city conditionals
|
||||
ConditionalSpecialistCount("if this city has at least [amount] specialists", UniqueTarget.Conditional),
|
||||
|
||||
// unit conditionals
|
||||
ConditionalOurUnit("for [mapUnitFilter] units", UniqueTarget.Conditional),
|
||||
ConditionalVsCity("vs cities", UniqueTarget.Conditional),
|
||||
ConditionalVsUnits("vs [mapUnitFilter] units", UniqueTarget.Conditional),
|
||||
ConditionalAttacking("when attacking", UniqueTarget.Conditional),
|
||||
@ -186,6 +217,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
// ConditionalIntercepting("when intercepting", UniqueTarget.Conditional),
|
||||
// ConditionalInTiles("fighting in [tileFilter] tiles", UniqueTarget.Conditional),
|
||||
|
||||
// tile conditionals
|
||||
ConditionalNeighborTiles("with [amount] to [amount] neighboring [tileFilter] tiles", UniqueTarget.Conditional),
|
||||
ConditionalNeighborTilesAnd("with [amount] to [amount] neighboring [tileFilter] [tileFilter] tiles", UniqueTarget.Conditional),
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user