Civilian should not move when bought (#2621)
* Civilian cannot move when bought same as military unit * Minor code restyling
This commit is contained in:
parent
4026c9b91d
commit
8877c18f31
1 changed files with 12 additions and 12 deletions
|
@ -154,22 +154,22 @@ class BaseUnit : INamed, IConstruction {
|
|||
|
||||
override fun postBuildEvent(construction: CityConstructions, wasBought: Boolean): Boolean {
|
||||
val unit = construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name)
|
||||
if(unit==null) return false // couldn't place the unit, so there's actually no unit =(
|
||||
|
||||
if(this.unitType.isCivilian()) return true // tiny optimization makes save files a few bytes smaller
|
||||
|
||||
var XP = construction.getBuiltBuildings().sumBy { it.xpForNewUnits }
|
||||
if(construction.cityInfo.civInfo.policies.isAdopted("Total War")) XP += 15
|
||||
unit.promotions.XP = XP
|
||||
|
||||
if(unit.type in listOf(UnitType.Melee,UnitType.Mounted,UnitType.Armor)
|
||||
&& construction.cityInfo.containsBuildingUnique("All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion"))
|
||||
unit.promotions.addPromotion("Drill I", isFree = true)
|
||||
if (unit == null) return false // couldn't place the unit, so there's actually no unit =(
|
||||
|
||||
//movement penalty
|
||||
if(!unit.hasUnique("Can move directly once bought") && wasBought)
|
||||
if (wasBought && !unit.hasUnique("Can move directly once bought"))
|
||||
unit.currentMovement = 0f
|
||||
|
||||
if (this.unitType.isCivilian()) return true // tiny optimization makes save files a few bytes smaller
|
||||
|
||||
var XP = construction.getBuiltBuildings().sumBy { it.xpForNewUnits }
|
||||
if (construction.cityInfo.civInfo.policies.isAdopted("Total War")) XP += 15
|
||||
unit.promotions.XP = XP
|
||||
|
||||
if (unit.type in listOf(UnitType.Melee,UnitType.Mounted,UnitType.Armor)
|
||||
&& construction.cityInfo.containsBuildingUnique("All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion"))
|
||||
unit.promotions.addPromotion("Drill I", isFree = true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue