mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Merge pull request #443 from ninjatao/free_promotions
Allow to add real free promotions to unit.
This commit is contained in:
commit
24d2a2c320
@ -15,10 +15,12 @@ class UnitPromotions{
|
|||||||
fun xpForNextPromotion() = (numberOfPromotions+1)*10
|
fun xpForNextPromotion() = (numberOfPromotions+1)*10
|
||||||
fun canBePromoted() = XP >= xpForNextPromotion()
|
fun canBePromoted() = XP >= xpForNextPromotion()
|
||||||
|
|
||||||
fun addPromotion(promotionName:String){
|
fun addPromotion(promotionName:String, isFree:Boolean = false){
|
||||||
XP -= xpForNextPromotion()
|
if (!isFree) {
|
||||||
|
XP -= xpForNextPromotion()
|
||||||
|
numberOfPromotions++
|
||||||
|
}
|
||||||
promotions.add(promotionName)
|
promotions.add(promotionName)
|
||||||
numberOfPromotions++
|
|
||||||
unit.updateUniques()
|
unit.updateUniques()
|
||||||
unit.civInfo.updateViewableTiles() // some promotions give the unit bonus sight
|
unit.civInfo.updateViewableTiles() // some promotions give the unit bonus sight
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||||||
if(unit.type in listOf(UnitType.Melee,UnitType.Mounted,UnitType.Armor)
|
if(unit.type in listOf(UnitType.Melee,UnitType.Mounted,UnitType.Armor)
|
||||||
&& construction.cityInfo.getBuildingUniques()
|
&& construction.cityInfo.getBuildingUniques()
|
||||||
.contains("All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion"))
|
.contains("All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion"))
|
||||||
unit.promotions.addPromotion("Drill I")
|
unit.promotions.addPromotion("Drill I", isFree = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getUpgradeUnit(civInfo: CivilizationInfo):BaseUnit{
|
fun getUpgradeUnit(civInfo: CivilizationInfo):BaseUnit{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user