mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 19:08:48 -04:00
tooltip for purchase blocked by unit (#13012)
* tooltip for purchase blocked by unit * fixup tooltip for purchase blocked by unit: translation template * extend German translation * fixup! fixup tooltip for purchase blocked by unit: translation template * fixup! fixup tooltip for purchase blocked by unit: translation template --------- Co-authored-by: Jon Witte <jon.witte@bevuta.com>
This commit is contained in:
parent
b8b88935a2
commit
905d3c7bfa
@ -1296,6 +1296,7 @@ Raze city = Stadt niederreißen
|
||||
Stop razing city = Niederreißen der Stadt stoppen
|
||||
Buy for [amount] gold = Für [amount] Gold kaufen
|
||||
Buy = Kaufen
|
||||
Move unit out of city first = Zuerst Einheit aus der Stadt entfernen
|
||||
Currently you have [amount] [stat]. = Zur Zeit besitzt du [amount] [stat].
|
||||
Would you like to purchase [constructionName] for [buildingGoldCost] [stat]? = [constructionName] für [buildingGoldCost] [stat] kaufen?
|
||||
You are buying a religious unit in a city that doesn't follow the religion you founded ([yourReligion]). This means that the unit is tied to that foreign religion ([majorityReligion]) and will be less useful. = Du möchtest eine an [majorityReligion] glaubende Einheit kaufen, obwohl Du [yourReligion] gegründet hast? Das wird nicht ganz so nützlich sein!
|
||||
|
@ -1296,6 +1296,7 @@ Raze city =
|
||||
Stop razing city =
|
||||
Buy for [amount] gold =
|
||||
Buy =
|
||||
Move unit out of city first =
|
||||
Currently you have [amount] [stat]. =
|
||||
Would you like to purchase [constructionName] for [buildingGoldCost] [stat]? =
|
||||
You are buying a religious unit in a city that doesn't follow the religion you founded ([yourReligion]). This means that the unit is tied to that foreign religion ([majorityReligion]) and will be less useful. =
|
||||
|
@ -752,6 +752,14 @@ class CityConstructions : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
}
|
||||
|
||||
fun isConstructionPurchaseBlockedByUnit(construction: INonPerpetualConstruction): Boolean {
|
||||
return !city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets)
|
||||
.any() &&
|
||||
!city.isInResistance() &&
|
||||
construction.isPurchasable(city.cityConstructions) &&
|
||||
(construction is BaseUnit) && !city.canPlaceNewUnit(construction)
|
||||
}
|
||||
|
||||
private fun removeCurrentConstruction() = removeFromQueue(0, true)
|
||||
|
||||
fun chooseNextConstruction() {
|
||||
|
@ -14,6 +14,7 @@ import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.audio.SoundPlayer
|
||||
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
|
||||
import com.unciv.ui.components.extensions.disable
|
||||
import com.unciv.ui.components.extensions.isEnabled
|
||||
import com.unciv.ui.components.extensions.toTextButton
|
||||
@ -70,6 +71,9 @@ class BuyButtonFactory(val cityScreen: CityScreen) {
|
||||
button.isEnabled = cityScreen.canChangeState &&
|
||||
city.cityConstructions.isConstructionPurchaseAllowed(construction, stat, constructionBuyCost)
|
||||
preferredBuyStat = stat // Not very intelligent, but the least common currency "wins"
|
||||
if (city.cityConstructions.isConstructionPurchaseBlockedByUnit(construction)) {
|
||||
button.addTooltip("Move unit out of city first", 26f, false)
|
||||
}
|
||||
}
|
||||
|
||||
button.labelCell.pad(5f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user