mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 16:59:11 +07:00
Anti-Armor, negative tile yield, LoadScreen (#5018)
* Harden against negative yields, Anti-Armor * Anti-Armor bad unitType, LoadScreen
This commit is contained in:
BIN
android/Images/UnitPromotionIcons/Anti-Armor.png
Normal file
BIN
android/Images/UnitPromotionIcons/Anti-Armor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
android/assets/ExtraImages/LoadScreen.png
Normal file
BIN
android/assets/ExtraImages/LoadScreen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -422,13 +422,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Anti-Armor I",
|
"name": "Anti-Armor I",
|
||||||
"uniques": ["+[25]% vs [Armored]"],
|
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||||
"unitTypes:": ["Helicopter"]
|
"unitTypes": ["Helicopter"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Anti-Armor II",
|
"name": "Anti-Armor II",
|
||||||
"uniques": ["+[25]% vs [Armored]"],
|
"prerequisites": ["Anti-Armor I"],
|
||||||
"unitTypes:": ["Helicopter"]
|
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||||
|
"unitTypes": ["Helicopter"]
|
||||||
},
|
},
|
||||||
|
|
||||||
// Mixed
|
// Mixed
|
||||||
@ -473,13 +474,13 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "Ambush I",
|
"name": "Ambush I",
|
||||||
"uniques": ["+[33]% Strength vs [Armored]"],
|
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||||
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ambush II",
|
"name": "Ambush II",
|
||||||
"prerequisites": ["Ambush I"],
|
"prerequisites": ["Ambush I"],
|
||||||
"uniques": ["+[33]% Strength vs [Armored]"],
|
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||||
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -84,8 +84,10 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
|||||||
* - Skin (hence CameraStageBaseScreen.setSkin())
|
* - Skin (hence CameraStageBaseScreen.setSkin())
|
||||||
* - Font (hence Fonts.resetFont() inside setSkin())
|
* - Font (hence Fonts.resetFont() inside setSkin())
|
||||||
*/
|
*/
|
||||||
ImageGetter.resetAtlases()
|
|
||||||
settings = GameSaver.getGeneralSettings() // needed for the screen
|
settings = GameSaver.getGeneralSettings() // needed for the screen
|
||||||
|
screen = LoadingScreen() // NOT dependent on any atlas or skin
|
||||||
|
|
||||||
|
ImageGetter.resetAtlases()
|
||||||
ImageGetter.setNewRuleset(ImageGetter.ruleset) // This needs to come after the settings, since we may have default visual mods
|
ImageGetter.setNewRuleset(ImageGetter.ruleset) // This needs to come after the settings, since we may have default visual mods
|
||||||
if(settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back
|
if(settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back
|
||||||
settings.tileSet = "FantasyHex"
|
settings.tileSet = "FantasyHex"
|
||||||
@ -94,8 +96,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
|||||||
CameraStageBaseScreen.setSkin() // needs to come AFTER the Texture reset, since the buttons depend on it
|
CameraStageBaseScreen.setSkin() // needs to come AFTER the Texture reset, since the buttons depend on it
|
||||||
|
|
||||||
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
||||||
screen = LoadingScreen()
|
|
||||||
|
|
||||||
|
|
||||||
thread(name = "LoadJSON") {
|
thread(name = "LoadJSON") {
|
||||||
RulesetCache.loadRulesets(printOutput = true)
|
RulesetCache.loadRulesets(printOutput = true)
|
||||||
@ -206,9 +206,9 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadingScreen:CameraStageBaseScreen() {
|
private class LoadingScreen : CameraStageBaseScreen() {
|
||||||
init {
|
init {
|
||||||
val happinessImage = ImageGetter.getImage("StatIcons/Happiness")
|
val happinessImage = ImageGetter.getExternalImage("LoadScreen.png")
|
||||||
happinessImage.center(stage)
|
happinessImage.center(stage)
|
||||||
happinessImage.setOrigin(Align.center)
|
happinessImage.setOrigin(Align.center)
|
||||||
happinessImage.addAction(Actions.sequence(
|
happinessImage.addAction(Actions.sequence(
|
||||||
|
@ -230,7 +230,7 @@ open class TileInfo {
|
|||||||
else
|
else
|
||||||
stats.add(terrainFeatureBase)
|
stats.add(terrainFeatureBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
var tileUniques = city.getMatchingUniques("[] from [] tiles []")
|
var tileUniques = city.getMatchingUniques("[] from [] tiles []")
|
||||||
.filter { city.matchesFilter(it.params[2]) }
|
.filter { city.matchesFilter(it.params[2]) }
|
||||||
@ -244,7 +244,7 @@ open class TileInfo {
|
|||||||
stats.add(unique.stats)
|
stats.add(unique.stats)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unique in city.getMatchingUniques("[] from [] tiles without [] []"))
|
for (unique in city.getMatchingUniques("[] from [] tiles without [] []"))
|
||||||
if (
|
if (
|
||||||
matchesTerrainFilter(unique.params[1]) &&
|
matchesTerrainFilter(unique.params[1]) &&
|
||||||
@ -280,7 +280,8 @@ open class TileInfo {
|
|||||||
if (stats.gold != 0f && observingCiv.goldenAges.isGoldenAge())
|
if (stats.gold != 0f && observingCiv.goldenAges.isGoldenAge())
|
||||||
stats.gold++
|
stats.gold++
|
||||||
|
|
||||||
if (stats.production < 0) stats.production = 0f
|
for ((stat, value) in stats)
|
||||||
|
if (value < 0f) stats[stat] = 0f
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ class YieldGroup : HorizontalGroup() {
|
|||||||
currentStats = stats
|
currentStats = stats
|
||||||
clearChildren()
|
clearChildren()
|
||||||
for ((stat, amount) in stats) {
|
for ((stat, amount) in stats) {
|
||||||
addActor(getStatIconsTable(stat.name, amount.toInt()))
|
if (amount > 0f) // Defense against upstream bugs - negatives would show as "lots"
|
||||||
|
addActor(getStatIconsTable(stat.name, amount.toInt()))
|
||||||
}
|
}
|
||||||
pack()
|
pack()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.unciv.ui.utils
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
|
import com.badlogic.gdx.graphics.Texture.TextureFilter
|
||||||
import com.badlogic.gdx.graphics.g2d.NinePatch
|
import com.badlogic.gdx.graphics.g2d.NinePatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@ -16,7 +17,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
|||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.map.TileMap
|
|
||||||
import com.unciv.models.ruleset.Era
|
import com.unciv.models.ruleset.Era
|
||||||
import com.unciv.models.ruleset.Nation
|
import com.unciv.models.ruleset.Nation
|
||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
@ -153,7 +153,12 @@ object ImageGetter {
|
|||||||
fun getDot(dotColor: Color) = getWhiteDot().apply { color = dotColor }
|
fun getDot(dotColor: Color) = getWhiteDot().apply { color = dotColor }
|
||||||
|
|
||||||
fun getExternalImage(fileName: String): Image {
|
fun getExternalImage(fileName: String): Image {
|
||||||
return Image(TextureRegion(Texture("ExtraImages/$fileName")))
|
// Since these are not packed in an atlas, they have no scaling filter metadata and
|
||||||
|
// default to Nearest filter, anisotropic level 1. Use Linear instead, helps
|
||||||
|
// loading screen and Tutorial.WorldScreen quite a bit. More anisotropy barely helps.
|
||||||
|
val texture = Texture("ExtraImages/$fileName")
|
||||||
|
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear)
|
||||||
|
return Image(TextureRegion(texture))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getImage(fileName: String): Image {
|
fun getImage(fileName: String): Image {
|
||||||
|
Reference in New Issue
Block a user