mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-05 08:28:16 +07:00
Resolved #8901 - Modding: Units from triggers respect "limited to [amount] per civilization" limits
This commit is contained in:
parent
6aef2ff3c6
commit
f89765354a
@ -58,6 +58,11 @@ object UniqueTriggerActivation {
|
||||
|| unit.hasUnique(UniqueType.FoundCity) && civInfo.isOneCityChallenger())
|
||||
return false
|
||||
|
||||
val limit = unit.getMatchingUniques(UniqueType.MaxNumberBuildable)
|
||||
.map { it.params[0].toInt() }.minOrNull()
|
||||
if (limit!=null && limit <= civInfo.units.getCivUnits().count { it.name==unitName })
|
||||
return false
|
||||
|
||||
val placedUnit = civInfo.units.addUnit(unitName, chosenCity) ?: return false
|
||||
|
||||
val notificationText = getNotificationText(notification, triggerNotificationText,
|
||||
@ -78,6 +83,15 @@ object UniqueTriggerActivation {
|
||||
if (chosenCity == null || unit == null || (unit.hasUnique(UniqueType.FoundCity) && civInfo.isOneCityChallenger()))
|
||||
return false
|
||||
|
||||
val limit = unit.getMatchingUniques(UniqueType.MaxNumberBuildable)
|
||||
.map { it.params[0].toInt() }.minOrNull()
|
||||
val amountFromTriggerable = unique.params[0].toInt()
|
||||
val actualAmount =
|
||||
if (limit==null) amountFromTriggerable
|
||||
else civInfo.units.getCivUnits().count { it.name==unitName } - limit
|
||||
|
||||
if (actualAmount <= 0) return false
|
||||
|
||||
val tilesUnitsWerePlacedOn: MutableList<Vector2> = mutableListOf()
|
||||
for (i in 1..unique.params[0].toInt()) {
|
||||
val placedUnit = civInfo.units.addUnit(unitName, chosenCity)
|
||||
|
@ -92,6 +92,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Reveal up to [amount/'all'] [tileFilter] within a [amount] tile radius"
|
||||
Example: "Reveal up to [3] [Farm] within a [3] tile radius"
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Triggers the following global alert: [comment]"
|
||||
Example: "Triggers the following global alert: [comment]"
|
||||
|
||||
@ -121,10 +126,13 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "This Unit gains [amount] XP"
|
||||
Example: "This Unit gains [3] XP"
|
||||
|
||||
Applicable to: UnitTriggerable, Ruins
|
||||
Applicable to: UnitTriggerable
|
||||
|
||||
??? example "This Unit upgrades for free"
|
||||
Applicable to: UnitTriggerable, Global
|
||||
Applicable to: UnitTriggerable
|
||||
|
||||
??? example "This Unit upgrades for free including special upgrades"
|
||||
Applicable to: UnitTriggerable
|
||||
|
||||
??? example "This Unit gains the [promotion] promotion"
|
||||
Example: "This Unit gains the [Shock I] promotion"
|
||||
@ -1625,19 +1633,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Ruins
|
||||
|
||||
??? example "Reveal up to [amount/'all'] [tileFilter] within a [amount] tile radius"
|
||||
Example: "Reveal up to [3] [Farm] within a [3] tile radius"
|
||||
|
||||
Applicable to: Ruins
|
||||
|
||||
??? example "From a randomly chosen tile [amount] tiles away from the ruins, reveal tiles up to [amount] tiles away with [amount]% chance"
|
||||
Example: "From a randomly chosen tile [3] tiles away from the ruins, reveal tiles up to [3] tiles away with [3]% chance"
|
||||
|
||||
Applicable to: Ruins
|
||||
|
||||
??? example "This Unit upgrades for free including special upgrades"
|
||||
Applicable to: Ruins
|
||||
|
||||
??? example "Hidden after generating a Great Prophet"
|
||||
Applicable to: Ruins
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user