Added countdown to relationship change with city states

This commit is contained in:
Yair Morgenstern 2019-05-26 18:52:32 +03:00
parent 1bb62ad681
commit a204333410
4 changed files with 18 additions and 10 deletions

View File

@ -2645,7 +2645,8 @@
"Provides [amountOfCulture] culture at 30 Influence":{}
"Provides 3 food in capital and 1 food in other cities at 30 Influence":{}
"Provides 3 happiness at 30 Influence":{}
"Gift [goldAmount] gold":{}
"Gift [goldAmount] gold (+[influenceAmount] influence)":{}
"Relationship changes in another [turnsToRelationshipChange] turns":{}
////// Diplomatic modifiers

View File

@ -156,7 +156,7 @@ class CivilizationInfo {
if (otherCiv.isCityState() && otherCiv.getCityStateType() == CityStateType.Cultured
&& otherCiv.getDiplomacyManager(civName).relationshipLevel() >= RelationshipLevel.Friend) {
val cultureBonus = Stats()
cultureBonus.add(Stat.Culture, 5.0f * getEra().ordinal)
cultureBonus.add(Stat.Culture, 3f * (getEra().ordinal+1))
if (statMap.containsKey("City States"))
statMap["City States"] = statMap["City States"]!! + cultureBonus
else

View File

@ -113,6 +113,7 @@ class DiplomacyManager() {
if(influence>=60) return RelationshipLevel.Ally
if(influence>=30) return RelationshipLevel.Friend
return RelationshipLevel.Neutral
}
// not entirely sure what to do between AI civs, because they probably have different views of each other,

View File

@ -98,33 +98,39 @@ class DiplomacyScreen:CameraStageBaseScreen() {
private fun getCityStateDiplomacyTable(otherCiv: CivilizationInfo): Table {
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
val otherCivDiplomacyManager = otherCiv.getDiplomacyManager(currentPlayerCiv)
val diplomacyTable = Table()
diplomacyTable.defaults().pad(10f)
if (otherCiv.isCityState()) {
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel()).row()
diplomacyTable.add(("Type: " + otherCiv.getCityStateType().toString()).toLabel()).row()
diplomacyTable.add(("Influence: " + otherCiv.getDiplomacyManager(currentPlayerCiv).influence.toInt()+"/30").toLabel()).row()
diplomacyTable.add(("Influence: " + otherCivDiplomacyManager.influence.toInt()+"/30").toLabel()).row()
diplomacyTable.add(getRelationshipTable(otherCiv.getDiplomacyManager(currentPlayerCiv))).row()
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
val friendBonusText = when(otherCiv.getCityStateType()) {
CityStateType.Cultured -> "Provides [" + (5.0f * currentPlayerCiv.getEra().ordinal).toString() + "] culture at 30 Influence"
CityStateType.Maritime -> "Provides 3 food in capital and 1 food in other cities at 30 Influence"
CityStateType.Mercantile -> "Provides 3 happiness at 30 Influence"
CityStateType.Cultured -> "Provides [" + (3 * (currentPlayerCiv.getEra().ordinal+1)).toString() + "] culture at [30] Influence"
CityStateType.Maritime -> "Provides 3 food in capital and 1 food in other cities at [30] Influence"
CityStateType.Mercantile -> "Provides 3 happiness at [30] Influence"
}
val friendBonusLabel = friendBonusText.toLabel()
if (otherCiv.getDiplomacyManager(currentPlayerCiv).relationshipLevel() >= RelationshipLevel.Friend)
diplomacyTable.add(friendBonusLabel).row()
if (otherCivDiplomacyManager.relationshipLevel() >= RelationshipLevel.Friend) {
friendBonusLabel.setFontColor(Color.GREEN)
val turnsToRelationshipChange = otherCivDiplomacyManager.influence.toInt() - 30 + 1
diplomacyTable.add("Relationship changes in another [$turnsToRelationshipChange] turns".toLabel()).row()
}
else
friendBonusLabel.setFontColor(Color.GRAY)
diplomacyTable.add(friendBonusLabel).row()
} else {
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel())
}
diplomacyTable.addSeparator()
val giftAmount = 100
val giftAmount = 250
val influenceAmount = giftAmount/10
val giftButton = TextButton("Gift [$giftAmount] gold (+[$influenceAmount] influence)".tr(), skin)
giftButton.onClick{ giveGoldGift(otherCiv,giftAmount ) }