Can no longer gift city states with gold you don't have

This commit is contained in:
Yair Morgenstern
2019-05-16 22:08:45 +03:00
parent 1f498f3fa6
commit 2e16a96c4d
4 changed files with 15 additions and 10 deletions

View File

@ -79,10 +79,10 @@ class DiplomacyScreen:CameraStageBaseScreen() {
return tradeTable
}
fun giveGoldGift(otherCiv: CivilizationInfo) {
fun giveGoldGift(otherCiv: CivilizationInfo, giftAmount: Int) {
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
currentPlayerCiv.gold -= 100
otherCiv.getDiplomacyManager(currentPlayerCiv).influence += 10
currentPlayerCiv.gold -= giftAmount
otherCiv.getDiplomacyManager(currentPlayerCiv).influence += giftAmount/10
rightSideTable.clear()
rightSideTable.add(getCityStateDiplomacyTable(otherCiv))
}
@ -112,9 +112,10 @@ class DiplomacyScreen:CameraStageBaseScreen() {
diplomacyTable.addSeparator()
val giftButton = TextButton("Give 100 gold".tr(), skin)
giftButton.onClick{ giveGoldGift(otherCiv) }
val giftAmount = 100
giftButton.onClick{ giveGoldGift(otherCiv,giftAmount ) }
diplomacyTable.add(giftButton).row()
if (currentPlayerCiv.gold < 1) giftButton.disable()
if (currentPlayerCiv.gold < giftAmount ) giftButton.disable()
val diplomacyManager = currentPlayerCiv.getDiplomacyManager(otherCiv)

View File

@ -47,8 +47,9 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
val translatedNation = civ.getTranslatedNation()
if (civ.isCityState()) {
addLeaderName(translatedNation)
addGoodSizedLabel("Type : " + civ.getCityStateType()).row()
add(getCloseButton("A pleasure to meet you."))
val cityStateType = civ.getCityStateType()
addGoodSizedLabel("We have encountered the City-State of [${translatedNation.getNameTranslation()}]!").row()
add(getCloseButton("Excellent!"))
} else {
addLeaderName(translatedNation)
addGoodSizedLabel(translatedNation.introduction).row()