mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Mods with no techs should work again
This commit is contained in:
@ -281,8 +281,8 @@ object BattleDamage {
|
|||||||
private fun damageModifier(attackerToDefenderRatio: Float, damageToAttacker: Boolean): Float {
|
private fun damageModifier(attackerToDefenderRatio: Float, damageToAttacker: Boolean): Float {
|
||||||
// https://forums.civfanatics.com/threads/getting-the-combat-damage-math.646582/#post-15468029
|
// https://forums.civfanatics.com/threads/getting-the-combat-damage-math.646582/#post-15468029
|
||||||
val strongerToWeakerRatio = attackerToDefenderRatio.pow(if (attackerToDefenderRatio < 1) -1 else 1)
|
val strongerToWeakerRatio = attackerToDefenderRatio.pow(if (attackerToDefenderRatio < 1) -1 else 1)
|
||||||
var ratioModifier = ((((strongerToWeakerRatio + 3) / 4).pow(4) + 1) / 2)
|
var ratioModifier = (((strongerToWeakerRatio + 3) / 4).pow(4) + 1) / 2
|
||||||
if ((damageToAttacker && attackerToDefenderRatio > 1) || (!damageToAttacker && attackerToDefenderRatio < 1)) // damage ratio from the weaker party is inverted
|
if (damageToAttacker && attackerToDefenderRatio > 1 || !damageToAttacker && attackerToDefenderRatio < 1) // damage ratio from the weaker party is inverted
|
||||||
ratioModifier = ratioModifier.pow(-1)
|
ratioModifier = ratioModifier.pow(-1)
|
||||||
val randomCenteredAround30 = (24 + 12 * Random().nextFloat())
|
val randomCenteredAround30 = (24 + 12 * Random().nextFloat())
|
||||||
return randomCenteredAround30 * ratioModifier
|
return randomCenteredAround30 * ratioModifier
|
||||||
|
@ -93,6 +93,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
|
|
||||||
private fun createTechTable() {
|
private fun createTechTable() {
|
||||||
val allTechs = civInfo.gameInfo.ruleSet.technologies.values
|
val allTechs = civInfo.gameInfo.ruleSet.technologies.values
|
||||||
|
if (allTechs.isEmpty()) return
|
||||||
val columns = allTechs.map { it.column!!.columnNumber }.maxOrNull()!! + 1
|
val columns = allTechs.map { it.column!!.columnNumber }.maxOrNull()!! + 1
|
||||||
val rows = allTechs.map { it.row }.maxOrNull()!! + 1
|
val rows = allTechs.map { it.row }.maxOrNull()!! + 1
|
||||||
val techMatrix = Array<Array<Technology?>>(columns) { arrayOfNulls(rows) } // Divided into columns, then rows
|
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)
|
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)
|
techTable.row().pad(5f).padRight(40f)
|
||||||
|
|
||||||
for (columnIndex in techMatrix.indices) {
|
for (columnIndex in techMatrix.indices) {
|
||||||
|
Reference in New Issue
Block a user