Carrier cannot attack, AS update to 4.1.3 (#3700)

This commit is contained in:
lishaoxia1985 2021-03-24 02:20:38 +08:00 committed by GitHub
parent 0aeee8d974
commit b5c12ec17c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 25 deletions

View File

@ -869,10 +869,9 @@
"unitType": "WaterAircraftCarrier",
"movement": 5,
"strength": 40,
"rangedStrength": 40,
"cost": 375,
"requiredTech": "Electronics",
"uniques": ["Can carry 2 aircraft"]
"uniques": ["Cannot attack","Can carry 2 aircraft"]
},
{
"name": "Triplane",

View File

@ -20,7 +20,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${com.unciv.build.BuildConfig.kotlinVersion}")
classpath("de.richsource.gradle.plugins:gwt-gradle-plugin:0.6")
classpath("com.android.tools.build:gradle:4.1.2")
classpath("com.android.tools.build:gradle:4.1.3")
classpath("com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1")
// This is for wrapping the .jar file into a standalone executable

View File

@ -227,7 +227,7 @@ class Ruleset {
lines += "${unit.name} upgrades to itself!"
if (!unit.unitType.isCivilian() && unit.strength == 0)
lines += "${unit.name} is a military unit but has no assigned strength!"
if (unit.unitType.isRanged() && unit.rangedStrength == 0)
if (unit.unitType.isRanged() && unit.rangedStrength == 0 && "Cannot attack" !in unit.uniques)
lines += "${unit.name} is a ranged unit but has no assigned rangedStrength!"
}

View File

@ -61,14 +61,13 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
private fun tryGetAttacker(): ICombatant? {
val unitTable = worldScreen.bottomUnitTable
if (unitTable.selectedUnit != null
&& !unitTable.selectedUnit!!.type.isCivilian()) {
return MapUnitCombatant(unitTable.selectedUnit!!)
} else if (unitTable.selectedCity != null) {
return CityCombatant(unitTable.selectedCity!!)
} else {
return null // no attacker
}
return if (unitTable.selectedUnit != null
&& !unitTable.selectedUnit!!.type.isCivilian()
&& !unitTable.selectedUnit!!.hasUnique("Cannot attack"))
MapUnitCombatant(unitTable.selectedUnit!!)
else if (unitTable.selectedCity != null)
CityCombatant(unitTable.selectedCity!!)
else null // no attacker
}
private fun tryGetDefender(): ICombatant? {
@ -243,9 +242,8 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
val canAttackDefenderCiv = attackerCiv.getDiplomacyManager(defenderTileCiv).canAttack()
canNuke = canNuke && canAttackDefenderCiv
}
val defender = tryGetDefenderAtTile(tile, true)
val defender = tryGetDefenderAtTile(tile, true) ?: continue
if (defender == null) continue
val defenderUnitCiv = defender.getCivInfo()
if( defenderUnitCiv.knows(attackerCiv))
@ -295,17 +293,6 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
setPosition(worldScreen.stage.width/2-width/2, 5f)
}
private fun openBugReportPopup() {
val battleBugPopup = Popup(worldScreen)
battleBugPopup.addGoodSizedLabel("You've encountered a bug that I've been looking for for a while!").row()
battleBugPopup.addGoodSizedLabel("If you could copy your game data (\"Copy saved game to clipboard\" - ").row()
battleBugPopup.addGoodSizedLabel(" paste into an email to yairm210@hotmail.com)").row()
battleBugPopup.addGoodSizedLabel("It would help me figure out what went wrong, since this isn't supposed to happen!").row()
battleBugPopup.addGoodSizedLabel("If you could tell me which unit was selected and which unit you tried to attack,").row()
battleBugPopup.addGoodSizedLabel(" that would be even better!").row()
battleBugPopup.open()
}
private fun getHealthBar(currentHealth: Int, maxHealth: Int, expectedDamage:Int): Table {
val healthBar = Table()
val totalWidth = 100f