mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
units get promotions and xp bonuses from CS buildings (#5012)
* units get promotions and xp bonuses from CS buildings * fix siam
This commit is contained in:
parent
a01a6270fc
commit
7e0b7f0007
@ -892,10 +892,16 @@ class CivilizationInfo {
|
||||
.toList().random()
|
||||
// placing the unit may fail - in that case stay quiet
|
||||
val placedUnit = placeUnitNearTile(city.location, militaryUnit.name) ?: return
|
||||
|
||||
// The unit should have bonuses from Barracks, Alhambra etc as if it was built in the CS capital
|
||||
militaryUnit.addConstructionBonuses(placedUnit, otherCiv.getCapital().cityConstructions)
|
||||
|
||||
// Siam gets +10 XP for all CS units
|
||||
for (unique in getMatchingUniques("Military Units gifted from City-States start with [] XP")) {
|
||||
placedUnit.promotions.XP += unique.params[0].toInt()
|
||||
}
|
||||
|
||||
|
||||
// Point to the places mentioned in the message _in that order_ (debatable)
|
||||
val placedLocation = placedUnit.getTile().position
|
||||
val locations = LocationAction(listOf(placedLocation, cities.city2.location, city.location))
|
||||
|
@ -331,8 +331,14 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
|
||||
|
||||
if (this.isCivilian()) return true // tiny optimization makes save files a few bytes smaller
|
||||
|
||||
var XP = cityConstructions.getBuiltBuildings().sumBy { it.xpForNewUnits }
|
||||
addConstructionBonuses(unit, cityConstructions)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fun addConstructionBonuses(unit: MapUnit, cityConstructions: CityConstructions) {
|
||||
val civInfo = cityConstructions.cityInfo.civInfo
|
||||
var XP = cityConstructions.getBuiltBuildings().sumBy { it.xpForNewUnits }
|
||||
|
||||
for (unique in
|
||||
cityConstructions.cityInfo.getMatchingUniques("New [] units start with [] Experience []")
|
||||
@ -370,8 +376,6 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
|
||||
unit.promotions.addPromotion(promotion, isFree = true)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user