mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 14:19:15 +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 damageToDefender = BattleDamage().calculateDamageToDefender(attacker,defender)
|
||||||
var damageToAttacker = BattleDamage().calculateDamageToAttacker(attacker,defender)
|
var damageToAttacker = BattleDamage().calculateDamageToAttacker(attacker,defender)
|
||||||
|
|
||||||
if (attacker.getUnitType().isMissileUnit()) {
|
if (attacker.getUnitType()==UnitType.Missile) {
|
||||||
nuclearBlast(attacker, defender)
|
nuclearBlast(attacker, defender)
|
||||||
}
|
}
|
||||||
else if(defender.getUnitType().isCivilian() && attacker.isMelee()){
|
else if(defender.getUnitType().isCivilian() && attacker.isMelee()){
|
||||||
@ -101,7 +101,7 @@ class Battle(val gameInfo:GameInfo) {
|
|||||||
attacker.unit.action = null
|
attacker.unit.action = null
|
||||||
|
|
||||||
if (attacker is MapUnitCombatant) {
|
if (attacker is MapUnitCombatant) {
|
||||||
if (attacker.getUnitType().isMissileUnit()) {
|
if (attacker.getUnitType()==UnitType.Missile) {
|
||||||
attacker.unit.destroy()
|
attacker.unit.destroy()
|
||||||
} else if (attacker.unit.action != null
|
} else if (attacker.unit.action != null
|
||||||
&& attacker.unit.action!!.startsWith("moveTo")) {
|
&& 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.GameBasics
|
||||||
import com.unciv.models.gamebasics.unit.Promotion
|
import com.unciv.models.gamebasics.unit.Promotion
|
||||||
|
import com.unciv.models.gamebasics.unit.UnitType
|
||||||
|
|
||||||
class UnitPromotions{
|
class UnitPromotions{
|
||||||
@Transient lateinit var unit:MapUnit
|
@Transient lateinit var unit:MapUnit
|
||||||
@ -13,7 +14,10 @@ class UnitPromotions{
|
|||||||
var numberOfPromotions = 0
|
var numberOfPromotions = 0
|
||||||
|
|
||||||
fun xpForNextPromotion() = (numberOfPromotions+1)*10
|
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){
|
fun addPromotion(promotionName: String, isFree: Boolean = false){
|
||||||
if (!isFree) {
|
if (!isFree) {
|
||||||
|
@ -152,9 +152,9 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
|||||||
|
|
||||||
row().pad(5f)
|
row().pad(5f)
|
||||||
val attackText : String = when {
|
val attackText : String = when {
|
||||||
attacker is MapUnitCombatant && attacker.getUnitType().isMissileUnit() -> "NUKE"
|
attacker is CityCombatant -> "Bombard"
|
||||||
attacker is MapUnitCombatant -> "Attack"
|
attacker.getUnitType()==UnitType.Missile -> "NUKE"
|
||||||
else -> "Bombard"
|
else -> "Attack"
|
||||||
}
|
}
|
||||||
val attackButton = TextButton(attackText.tr(), skin).apply { color= Color.RED }
|
val attackButton = TextButton(attackText.tr(), skin).apply { color= Color.RED }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user