Merge pull request #443 from ninjatao/free_promotions

Allow to add real free promotions to unit.
This commit is contained in:
Yair Morgenstern 2019-01-29 17:49:12 +02:00 committed by GitHub
commit 24d2a2c320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -15,10 +15,12 @@ class UnitPromotions{
fun xpForNextPromotion() = (numberOfPromotions+1)*10
fun canBePromoted() = XP >= xpForNextPromotion()
fun addPromotion(promotionName:String){
fun addPromotion(promotionName:String, isFree:Boolean = false){
if (!isFree) {
XP -= xpForNextPromotion()
promotions.add(promotionName)
numberOfPromotions++
}
promotions.add(promotionName)
unit.updateUniques()
unit.civInfo.updateViewableTiles() // some promotions give the unit bonus sight
}

View File

@ -125,7 +125,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
if(unit.type in listOf(UnitType.Melee,UnitType.Mounted,UnitType.Armor)
&& construction.cityInfo.getBuildingUniques()
.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{