mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 12:37:42 -04:00
modding: "Not shown on world screen" applies to promotions and statuses
This commit is contained in:
parent
b552344547
commit
9e658eb012
@ -610,7 +610,7 @@ enum class UniqueType(
|
||||
"The current stockpiled amount can be affected with trigger uniques."),
|
||||
CityResource("City-level resource", UniqueTarget.Resource, docDescription = "This resource is calculated on a per-city level rather than a per-civ level"),
|
||||
CannotBeTraded("Cannot be traded", UniqueTarget.Resource),
|
||||
NotShownOnWorldScreen("Not shown on world screen", UniqueTarget.Resource, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
NotShownOnWorldScreen("Not shown on world screen", UniqueTarget.Resource, UniqueTarget.Promotion, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
|
||||
ResourceWeighting("Generated with weight [amount]", UniqueTarget.Resource, flags = UniqueFlag.setOfHiddenToUsers,
|
||||
docDescription = "The probability for this resource to be chosen is (this resource weight) / (sum weight of all eligible resources). " +
|
||||
|
@ -3,6 +3,7 @@ package com.unciv.ui.screens.worldscreen.unit.presenter
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.logic.map.mapunit.MapUnit
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.extensions.surroundWithCircle
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
@ -121,10 +122,13 @@ class UnitPresenter(private val unitTable: UnitTable, private val worldScreen: W
|
||||
unitIconHolder.add(UnitIconGroup(unit, 30f)).pad(5f)
|
||||
|
||||
for (promotion in unit.promotions.getPromotions(true))
|
||||
promotionsTable.add(ImageGetter.getPromotionPortrait(promotion.name, 20f))
|
||||
.padBottom(2f)
|
||||
if (!promotion.hasUnique(UniqueType.NotShownOnWorldScreen))
|
||||
promotionsTable.add(ImageGetter.getPromotionPortrait(promotion.name, 20f))
|
||||
.padBottom(2f)
|
||||
|
||||
for (status in unit.statusMap.values) {
|
||||
if (status.uniques.any { it.type == UniqueType.NotShownOnWorldScreen }) continue
|
||||
|
||||
val group = ImageGetter.getPromotionPortrait(status.name)
|
||||
val turnsLeft = "${status.turnsLeft}${Fonts.turn}".toLabel(fontSize = 8)
|
||||
.surroundWithCircle(15f, color = ImageGetter.CHARCOAL)
|
||||
|
@ -581,11 +581,8 @@ class GlobalUniquesTests {
|
||||
val city = game.addCity(civInfo, game.getTile(Vector2.Zero), true)
|
||||
|
||||
city.cityStats.update()
|
||||
// Because of some weird design choices, -3.6 is correct, though I would expect it to be -6 instead.
|
||||
// As I'm not certain enough in my feeling that it should be -6, I'm changing the test to fit the code instead of the other way around.
|
||||
// I've also written some text about this in CityStats.updateCityHappiness(). ~xlenstra
|
||||
println(city.cityStats.happinessList)
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Cities"]!! - -3.6f) < epsilon) // Float rounding errors
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Cities"]!! - -6f) < epsilon) // Float rounding errors
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -594,10 +591,8 @@ class GlobalUniquesTests {
|
||||
val city = game.addCity(civInfo, game.getTile(Vector2.Zero), true, initialPopulation = 4)
|
||||
|
||||
city.cityStats.update()
|
||||
// This test suffers from the same problems as `unhappinessFromCitiesPercentageTest()`.
|
||||
// This should be -2, I believe, as every pop should add -1 happiness and 4 pop with -50% unhappiness = -2 unhappiness.
|
||||
println(city.cityStats.happinessList)
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Population"]!! - -1.2f) < epsilon)
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Population"]!! - -2f) < epsilon)
|
||||
|
||||
val building = game.createBuilding("[-50]% Unhappiness from [Specialists] [in all cities]")
|
||||
val specialist = game.createSpecialist()
|
||||
@ -607,8 +602,7 @@ class GlobalUniquesTests {
|
||||
|
||||
city.cityStats.update()
|
||||
println(city.cityStats.happinessList)
|
||||
// This test suffers from the same problems as above. It should be -1, I believe.
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Population"]!! - -0.6f) < epsilon)
|
||||
Assert.assertTrue(abs(city.cityStats.happinessList["Population"]!! - -1f) < epsilon)
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user