Resolved #1368 - missiles can no longer be promoted

This commit is contained in:
Yair Morgenstern
2019-11-25 11:58:02 +02:00
parent 041ca493ba
commit 488b733db6
3 changed files with 10 additions and 6 deletions

View File

@ -41,7 +41,7 @@ class Battle(val gameInfo:GameInfo) {
var damageToDefender = BattleDamage().calculateDamageToDefender(attacker,defender)
var damageToAttacker = BattleDamage().calculateDamageToAttacker(attacker,defender)
if (attacker.getUnitType().isMissileUnit()) {
if (attacker.getUnitType()==UnitType.Missile) {
nuclearBlast(attacker, defender)
}
else if(defender.getUnitType().isCivilian() && attacker.isMelee()){
@ -101,7 +101,7 @@ class Battle(val gameInfo:GameInfo) {
attacker.unit.action = null
if (attacker is MapUnitCombatant) {
if (attacker.getUnitType().isMissileUnit()) {
if (attacker.getUnitType()==UnitType.Missile) {
attacker.unit.destroy()
} else if (attacker.unit.action != null
&& attacker.unit.action!!.startsWith("moveTo")) {

View File

@ -2,6 +2,7 @@ package com.unciv.logic.map
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.unit.Promotion
import com.unciv.models.gamebasics.unit.UnitType
class UnitPromotions{
@Transient lateinit var unit:MapUnit
@ -13,7 +14,10 @@ class UnitPromotions{
var numberOfPromotions = 0
fun xpForNextPromotion() = (numberOfPromotions+1)*10
fun canBePromoted() = XP >= xpForNextPromotion()
fun canBePromoted(): Boolean {
if(unit.type==UnitType.Missile) return false
return XP >= xpForNextPromotion()
}
fun addPromotion(promotionName: String, isFree: Boolean = false){
if (!isFree) {

View File

@ -152,9 +152,9 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
row().pad(5f)
val attackText : String = when {
attacker is MapUnitCombatant && attacker.getUnitType().isMissileUnit() -> "NUKE"
attacker is MapUnitCombatant -> "Attack"
else -> "Bombard"
attacker is CityCombatant -> "Bombard"
attacker.getUnitType()==UnitType.Missile -> "NUKE"
else -> "Attack"
}
val attackButton = TextButton(attackText.tr(), skin).apply { color= Color.RED }