mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 22:37:02 -04:00
3.11.16-patch1
Fixed x100 combat modifier for units in rough/open terrain
This commit is contained in:
parent
b30e6e6fdd
commit
07cee7e679
@ -3,8 +3,8 @@ package com.unciv.build
|
|||||||
object BuildConfig {
|
object BuildConfig {
|
||||||
const val kotlinVersion = "1.3.71"
|
const val kotlinVersion = "1.3.71"
|
||||||
const val appName = "Unciv"
|
const val appName = "Unciv"
|
||||||
const val appCodeNumber = 503
|
const val appCodeNumber = 504
|
||||||
const val appVersion = "3.11.16"
|
const val appVersion = "3.11.16-patch1"
|
||||||
|
|
||||||
const val gdxVersion = "1.9.12"
|
const val gdxVersion = "1.9.12"
|
||||||
const val roboVMVersion = "2.3.1"
|
const val roboVMVersion = "2.3.1"
|
||||||
|
@ -6,7 +6,6 @@ import com.unciv.logic.map.TileInfo
|
|||||||
import com.unciv.models.Counter
|
import com.unciv.models.Counter
|
||||||
import com.unciv.models.ruleset.unit.UnitType
|
import com.unciv.models.ruleset.unit.UnitType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.HashMap
|
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
@ -218,11 +217,11 @@ object BattleDamage {
|
|||||||
|
|
||||||
// As of 3.11.0 This is to be deprecated and converted to "+[15]% combat bonus for units fighting in [Friendly Land]" - keeping it here to that mods with this can still work for now
|
// As of 3.11.0 This is to be deprecated and converted to "+[15]% combat bonus for units fighting in [Friendly Land]" - keeping it here to that mods with this can still work for now
|
||||||
// Civ 5 does not use "Himeji Castle"
|
// Civ 5 does not use "Himeji Castle"
|
||||||
if(tile.isFriendlyTerritory(unit.getCivInfo()) && unit.getCivInfo().hasUnique("+15% combat strength for units fighting in friendly territory"))
|
if (tile.isFriendlyTerritory(unit.getCivInfo()) && unit.getCivInfo().hasUnique("+15% combat strength for units fighting in friendly territory"))
|
||||||
modifiers.add("Friendly Land", 15)
|
modifiers.add("Friendly Land", 15)
|
||||||
|
|
||||||
// As of 3.11.0 This is to be deprecated and converted to "+[20]% combat bonus in [Foreign Land]" - keeping it here to that mods with this can still work for now
|
// As of 3.11.0 This is to be deprecated and converted to "+[20]% combat bonus in [Foreign Land]" - keeping it here to that mods with this can still work for now
|
||||||
if(!tile.isFriendlyTerritory(unit.getCivInfo()) && unit.unit.hasUnique("+20% bonus outside friendly territory"))
|
if (!tile.isFriendlyTerritory(unit.getCivInfo()) && unit.unit.hasUnique("+20% bonus outside friendly territory"))
|
||||||
modifiers.add("Foreign Land", 20)
|
modifiers.add("Foreign Land", 20)
|
||||||
|
|
||||||
for (unique in unit.unit.getMatchingUniques("+[]% combat bonus in []")
|
for (unique in unit.unit.getMatchingUniques("+[]% combat bonus in []")
|
||||||
@ -244,37 +243,31 @@ object BattleDamage {
|
|||||||
|| tile.terrainFeature != Constants.jungle))
|
|| tile.terrainFeature != Constants.jungle))
|
||||||
modifiers[tile.baseTerrain] = 25
|
modifiers[tile.baseTerrain] = 25
|
||||||
|
|
||||||
for(unique in unit.getCivInfo().getMatchingUniques("+[]% Strength if within [] tiles of a []")) {
|
for (unique in unit.getCivInfo().getMatchingUniques("+[]% Strength if within [] tiles of a []")) {
|
||||||
if (tile.getTilesInDistance(unique.params[1].toInt()).any { it.matchesUniqueFilter(unique.params[2]) })
|
if (tile.getTilesInDistance(unique.params[1].toInt()).any { it.matchesUniqueFilter(unique.params[2]) })
|
||||||
modifiers[unique.params[2]] = unique.params[0].toInt()
|
modifiers[unique.params[2]] = unique.params[0].toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tile.neighbors.flatMap { it.getUnits() }
|
if (tile.neighbors.flatMap { it.getUnits() }
|
||||||
.any { it.hasUnique("-10% combat strength for adjacent enemy units") && it.civInfo.isAtWarWith(unit.getCivInfo()) })
|
.any { it.hasUnique("-10% combat strength for adjacent enemy units") && it.civInfo.isAtWarWith(unit.getCivInfo()) })
|
||||||
modifiers["Haka War Dance"] = -10
|
modifiers["Haka War Dance"] = -10
|
||||||
|
|
||||||
// As of 3.10.6 This is to be deprecated and converted to "+[]% combat bonus in []" - keeping it here to that mods with this can still work for now
|
// As of 3.10.6 This is to be deprecated and converted to "+[]% combat bonus in []" - keeping it here to that mods with this can still work for now
|
||||||
if(unit.unit.hasUnique("+33% combat bonus in Forest/Jungle")
|
if (unit.unit.hasUnique("+33% combat bonus in Forest/Jungle")
|
||||||
&& (tile.terrainFeature== Constants.forest || tile.terrainFeature==Constants.jungle))
|
&& (tile.terrainFeature == Constants.forest || tile.terrainFeature == Constants.jungle))
|
||||||
modifiers[tile.terrainFeature!!]=33
|
modifiers[tile.terrainFeature!!] = 33
|
||||||
|
|
||||||
val isRoughTerrain = tile.isRoughTerrain()
|
val isRoughTerrain = tile.isRoughTerrain()
|
||||||
for (BDM in getBattleDamageModifiersOfUnit(unit.unit)) {
|
for (BDM in getBattleDamageModifiersOfUnit(unit.unit)) {
|
||||||
val text = BDM.getText()
|
val text = BDM.getText()
|
||||||
// this will change when we change over everything to ints
|
// this will change when we change over everything to ints
|
||||||
if (BDM.vs == "units in open terrain" && !isRoughTerrain) modifiers.add(text, (BDM.modificationAmount*100).toInt())
|
if (BDM.vs == "units in open terrain" && !isRoughTerrain) modifiers.add(text, (BDM.modificationAmount).toInt())
|
||||||
if (BDM.vs == "units in rough terrain" && isRoughTerrain) modifiers.add(text, (BDM.modificationAmount*100).toInt())
|
if (BDM.vs == "units in rough terrain" && isRoughTerrain) modifiers.add(text, (BDM.modificationAmount).toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifiers
|
return modifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Counter<String>.toOldModifiers(): HashMap<String, Float> {
|
|
||||||
val modifiers = HashMap<String,Float>()
|
|
||||||
for((key,value) in this) modifiers[key] = value.toFloat()/100
|
|
||||||
return modifiers
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun modifiersToMultiplicationBonus(modifiers: Counter<String>): Float {
|
private fun modifiersToMultiplicationBonus(modifiers: Counter<String>): Float {
|
||||||
var finalModifier = 1f
|
var finalModifier = 1f
|
||||||
for (modifierValue in modifiers.values) finalModifier *= (1 + modifierValue/100f) // so 25 will result in *= 1.25
|
for (modifierValue in modifiers.values) finalModifier *= (1 + modifierValue/100f) // so 25 will result in *= 1.25
|
||||||
|
@ -255,12 +255,11 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
val couldntDownloadLatestGame = Popup(this)
|
|
||||||
couldntDownloadLatestGame.addGoodSizedLabel("Couldn't download the latest game state!").row()
|
|
||||||
couldntDownloadLatestGame.addCloseButton()
|
|
||||||
couldntDownloadLatestGame.addAction(Actions.delay(5f, Actions.run { couldntDownloadLatestGame.close() }))
|
|
||||||
|
|
||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
|
val couldntDownloadLatestGame = Popup(this)
|
||||||
|
couldntDownloadLatestGame.addGoodSizedLabel("Couldn't download the latest game state!").row()
|
||||||
|
couldntDownloadLatestGame.addCloseButton()
|
||||||
|
couldntDownloadLatestGame.addAction(Actions.delay(5f, Actions.run { couldntDownloadLatestGame.close() }))
|
||||||
loadingGamePopup.close()
|
loadingGamePopup.close()
|
||||||
couldntDownloadLatestGame.open()
|
couldntDownloadLatestGame.open()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user