mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-23 01:24:26 +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:
parent
6a3fddc757
commit
5a6a9c9759
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",
|
||||
"uniques": ["+[25]% vs [Armored]"],
|
||||
"unitTypes:": ["Helicopter"]
|
||||
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||
"unitTypes": ["Helicopter"]
|
||||
},
|
||||
{
|
||||
"name": "Anti-Armor II",
|
||||
"uniques": ["+[25]% vs [Armored]"],
|
||||
"unitTypes:": ["Helicopter"]
|
||||
"prerequisites": ["Anti-Armor I"],
|
||||
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||
"unitTypes": ["Helicopter"]
|
||||
},
|
||||
|
||||
// Mixed
|
||||
@ -473,13 +474,13 @@
|
||||
|
||||
{
|
||||
"name": "Ambush I",
|
||||
"uniques": ["+[33]% Strength vs [Armored]"],
|
||||
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
||||
},
|
||||
{
|
||||
"name": "Ambush II",
|
||||
"prerequisites": ["Ambush I"],
|
||||
"uniques": ["+[33]% Strength vs [Armored]"],
|
||||
"uniques": ["+[25]% Strength vs [Armored]"],
|
||||
"unitTypes": ["Sword","Gunpowder","Fighter","Bomber"]
|
||||
},
|
||||
|
||||
|
@ -84,8 +84,10 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
* - Skin (hence CameraStageBaseScreen.setSkin())
|
||||
* - Font (hence Fonts.resetFont() inside setSkin())
|
||||
*/
|
||||
ImageGetter.resetAtlases()
|
||||
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
|
||||
if(settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back
|
||||
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
|
||||
|
||||
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
||||
screen = LoadingScreen()
|
||||
|
||||
|
||||
thread(name = "LoadJSON") {
|
||||
RulesetCache.loadRulesets(printOutput = true)
|
||||
@ -206,9 +206,9 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
}
|
||||
}
|
||||
|
||||
class LoadingScreen:CameraStageBaseScreen() {
|
||||
private class LoadingScreen : CameraStageBaseScreen() {
|
||||
init {
|
||||
val happinessImage = ImageGetter.getImage("StatIcons/Happiness")
|
||||
val happinessImage = ImageGetter.getExternalImage("LoadScreen.png")
|
||||
happinessImage.center(stage)
|
||||
happinessImage.setOrigin(Align.center)
|
||||
happinessImage.addAction(Actions.sequence(
|
||||
|
@ -230,7 +230,7 @@ open class TileInfo {
|
||||
else
|
||||
stats.add(terrainFeatureBase)
|
||||
}
|
||||
|
||||
|
||||
if (city != null) {
|
||||
var tileUniques = city.getMatchingUniques("[] from [] tiles []")
|
||||
.filter { city.matchesFilter(it.params[2]) }
|
||||
@ -244,7 +244,7 @@ open class TileInfo {
|
||||
stats.add(unique.stats)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (unique in city.getMatchingUniques("[] from [] tiles without [] []"))
|
||||
if (
|
||||
matchesTerrainFilter(unique.params[1]) &&
|
||||
@ -280,7 +280,8 @@ open class TileInfo {
|
||||
if (stats.gold != 0f && observingCiv.goldenAges.isGoldenAge())
|
||||
stats.gold++
|
||||
|
||||
if (stats.production < 0) stats.production = 0f
|
||||
for ((stat, value) in stats)
|
||||
if (value < 0f) stats[stat] = 0f
|
||||
|
||||
return stats
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ class YieldGroup : HorizontalGroup() {
|
||||
currentStats = stats
|
||||
clearChildren()
|
||||
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()
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.unciv.ui.utils
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
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.TextureAtlas
|
||||
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.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.map.TileMap
|
||||
import com.unciv.models.ruleset.Era
|
||||
import com.unciv.models.ruleset.Nation
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
@ -153,7 +153,12 @@ object ImageGetter {
|
||||
fun getDot(dotColor: Color) = getWhiteDot().apply { color = dotColor }
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user