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