mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Resolved #1368 - missiles can no longer be promoted
This commit is contained in:
@ -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")) {
|
||||
|
@ -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) {
|
||||
|
@ -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 }
|
||||
|
||||
|
Reference in New Issue
Block a user