diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index 62e2924b80..6d0b2c07e7 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -281,8 +281,8 @@ object BattleDamage { private fun damageModifier(attackerToDefenderRatio: Float, damageToAttacker: Boolean): Float { // https://forums.civfanatics.com/threads/getting-the-combat-damage-math.646582/#post-15468029 val strongerToWeakerRatio = attackerToDefenderRatio.pow(if (attackerToDefenderRatio < 1) -1 else 1) - var ratioModifier = ((((strongerToWeakerRatio + 3) / 4).pow(4) + 1) / 2) - if ((damageToAttacker && attackerToDefenderRatio > 1) || (!damageToAttacker && attackerToDefenderRatio < 1)) // damage ratio from the weaker party is inverted + var ratioModifier = (((strongerToWeakerRatio + 3) / 4).pow(4) + 1) / 2 + if (damageToAttacker && attackerToDefenderRatio > 1 || !damageToAttacker && attackerToDefenderRatio < 1) // damage ratio from the weaker party is inverted ratioModifier = ratioModifier.pow(-1) val randomCenteredAround30 = (24 + 12 * Random().nextFloat()) return randomCenteredAround30 * ratioModifier diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index 8fe03f8674..ecfab27d4e 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -93,6 +93,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec private fun createTechTable() { val allTechs = civInfo.gameInfo.ruleSet.technologies.values + if (allTechs.isEmpty()) return val columns = allTechs.map { it.column!!.columnNumber }.maxOrNull()!! + 1 val rows = allTechs.map { it.row }.maxOrNull()!! + 1 val techMatrix = Array>(columns) { arrayOfNulls(rows) } // Divided into columns, then rows @@ -116,7 +117,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec techTable.add(era.toLabel().addBorder(2f, color)).fill().colspan(columnSpan) } - for (rowIndex in 0..rows-1) { + for (rowIndex in 0..rows - 1) { techTable.row().pad(5f).padRight(40f) for (columnIndex in techMatrix.indices) {