Mods with no techs should work again

This commit is contained in:
Yair Morgenstern 2021-03-10 20:27:37 +02:00
parent 7d3e2a4e78
commit 7bb2c70245
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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<Array<Technology?>>(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) {