mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 13:49:54 +07:00
Resolved #11864 - Promotion added to unit with that promotion does not retrigger trigger uniques
This commit is contained in:
@ -171,7 +171,6 @@ object BackwardCompatibility {
|
|||||||
fun GameInfo.guaranteeUnitPromotions() {
|
fun GameInfo.guaranteeUnitPromotions() {
|
||||||
for (tileInfo in tileMap.values) for (unit in tileInfo.getUnits())
|
for (tileInfo in tileMap.values) for (unit in tileInfo.getUnits())
|
||||||
for (startingPromo in unit.baseUnit.promotions)
|
for (startingPromo in unit.baseUnit.promotions)
|
||||||
if (startingPromo !in unit.promotions.promotions)
|
|
||||||
unit.promotions.addPromotion(startingPromo, true)
|
unit.promotions.addPromotion(startingPromo, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,7 +875,6 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
|||||||
for (unique in promotionUniques) {
|
for (unique in promotionUniques) {
|
||||||
if (!this.matchesFilter(unique.params[2])) continue
|
if (!this.matchesFilter(unique.params[2])) continue
|
||||||
val promotion = unique.params[0]
|
val promotion = unique.params[0]
|
||||||
if (promotion in promotions.promotions) continue
|
|
||||||
promotions.addPromotion(promotion, true)
|
promotions.addPromotion(promotion, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ class UnitPromotions : IsPartOfGameInfoSerialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addPromotion(promotionName: String, isFree: Boolean = false) {
|
fun addPromotion(promotionName: String, isFree: Boolean = false) {
|
||||||
|
if (promotions.contains(promotionName)) return
|
||||||
val ruleset = unit.civ.gameInfo.ruleset
|
val ruleset = unit.civ.gameInfo.ruleset
|
||||||
val promotion = ruleset.unitPromotions[promotionName] ?: return
|
val promotion = ruleset.unitPromotions[promotionName] ?: return
|
||||||
|
|
||||||
|
@ -246,7 +246,6 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
|||||||
else yield(RejectionReasonType.CannotBeBuilt.toInstance())
|
else yield(RejectionReasonType.CannotBeBuilt.toInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expensive, since adding and removing the fake unit causes side-effects
|
|
||||||
if (city != null && isAirUnit()) {
|
if (city != null && isAirUnit()) {
|
||||||
// Not actually added to civ so doesn't require destroy
|
// Not actually added to civ so doesn't require destroy
|
||||||
val fakeUnit = getMapUnit(civ, Constants.NO_ID)
|
val fakeUnit = getMapUnit(civ, Constants.NO_ID)
|
||||||
|
Reference in New Issue
Block a user