mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Civs respond according to neutral/hate and respond properly after peace
This commit is contained in:
parent
f78f9c2fad
commit
1bb62ad681
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 2.7 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 988 KiB After Width: | Height: | Size: 991 KiB |
@ -2640,10 +2640,13 @@
|
||||
Portuguese:"Aliado"
|
||||
}
|
||||
|
||||
// City State bonuses
|
||||
// City States
|
||||
|
||||
"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":{}
|
||||
|
||||
|
||||
////// Diplomatic modifiers
|
||||
|
||||
|
@ -24,10 +24,19 @@ class Nation : INamed {
|
||||
var introduction=""
|
||||
var tradeRequest=""
|
||||
|
||||
var neutralHello=""
|
||||
var hateHello=""
|
||||
|
||||
var neutralLetsHearIt = ArrayList<String>()
|
||||
var neutralYes = ArrayList<String>()
|
||||
var neutralNo = ArrayList<String>()
|
||||
|
||||
var hateLetsHearIt = ArrayList<String>()
|
||||
var hateYes = ArrayList<String>()
|
||||
var hateNo = ArrayList<String>()
|
||||
|
||||
var afterPeace=""
|
||||
|
||||
lateinit var mainColor: List<Int>
|
||||
var unique:String?=null
|
||||
var secondaryColor: List<Int>?=null
|
||||
|
@ -125,7 +125,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
diplomacyTable.addSeparator()
|
||||
|
||||
val giftAmount = 100
|
||||
val giftButton = TextButton("Give [$giftAmount] gold".tr(), skin)
|
||||
val influenceAmount = giftAmount/10
|
||||
val giftButton = TextButton("Gift [$giftAmount] gold (+[$influenceAmount] influence)".tr(), skin)
|
||||
giftButton.onClick{ giveGoldGift(otherCiv,giftAmount ) }
|
||||
diplomacyTable.add(giftButton).row()
|
||||
if (currentPlayerCiv.gold < giftAmount ) giftButton.disable()
|
||||
@ -154,9 +155,17 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
|
||||
private fun getMajorCivDiplomacyTable(otherCiv: CivilizationInfo): Table {
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
val otherCivDiplomacyManager = otherCiv.getDiplomacyManager(currentPlayerCiv)
|
||||
|
||||
val diplomacyTable = Table()
|
||||
diplomacyTable.defaults().pad(10f)
|
||||
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel())
|
||||
|
||||
val translatedNation = otherCiv.getTranslatedNation()
|
||||
diplomacyTable.add(translatedNation.getLeaderDisplayName().toLabel().setFontSize(24)).row()
|
||||
if(otherCivDiplomacyManager.relationshipLevel()<=RelationshipLevel.Enemy)
|
||||
diplomacyTable.add(translatedNation.hateHello.toLabel()).row()
|
||||
else
|
||||
diplomacyTable.add(translatedNation.neutralHello.toLabel()).row()
|
||||
diplomacyTable.addSeparator()
|
||||
|
||||
if(!currentPlayerCiv.isAtWarWith(otherCiv)) {
|
||||
@ -173,7 +182,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
tradeTable.tradeLogic.currentTrade.ourOffers.add(peaceTreaty)
|
||||
tradeTable.offerColumnsTable.update()
|
||||
}
|
||||
if (otherCiv.getDiplomacyManager(currentPlayerCiv).hasFlag(DiplomacyFlags.DeclaredWar))
|
||||
if (otherCivDiplomacyManager.hasFlag(DiplomacyFlags.DeclaredWar))
|
||||
negotiatePeaceButton.disable() // Can't trade for 10 turns after war was declared
|
||||
|
||||
diplomacyTable.add(negotiatePeaceButton).row()
|
||||
@ -184,7 +193,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
|
||||
|
||||
if (!currentPlayerCiv.isAtWarWith(otherCiv)) {
|
||||
if(otherCiv.getDiplomacyManager(currentPlayerCiv).relationshipLevel() > RelationshipLevel.Neutral
|
||||
if(otherCivDiplomacyManager.relationshipLevel() > RelationshipLevel.Neutral
|
||||
&& !diplomacyManager.hasFlag(DiplomacyFlags.DeclarationOfFriendship)){
|
||||
val declareFriendshipButton = TextButton("Declare Friendship ([30] turns)".tr(),skin)
|
||||
declareFriendshipButton.onClick {
|
||||
@ -199,8 +208,6 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
|
||||
val otherCivDiplomacyManager = otherCiv.getDiplomacyManager(currentPlayerCiv)
|
||||
|
||||
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
||||
|
||||
val diplomacyModifiersTable = Table()
|
||||
|
@ -4,7 +4,9 @@ import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
|
||||
import com.unciv.logic.trade.TradeEvaluation
|
||||
import com.unciv.logic.trade.TradeLogic
|
||||
import com.unciv.models.gamebasics.tr
|
||||
@ -16,11 +18,18 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
var tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
var offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
var offerColumnsTableWrapper = Table() // This is so that after a trade has been traded, we can switch out the offersToDisplay to start anew - this is the easiest way
|
||||
val tradeText = Label(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr(), CameraStageBaseScreen.skin)
|
||||
val tradeText = Label("", CameraStageBaseScreen.skin)
|
||||
val offerButton = TextButton("Offer trade".tr(), CameraStageBaseScreen.skin)
|
||||
|
||||
fun letsHearIt(){
|
||||
val relationshipLevel = otherCivilization.getDiplomacyManager(currentPlayerCiv).relationshipLevel()
|
||||
if(relationshipLevel <= RelationshipLevel.Enemy)
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().hateLetsHearIt.random().tr())
|
||||
else tradeText.setText(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr())
|
||||
}
|
||||
|
||||
init{
|
||||
letsHearIt()
|
||||
offerColumnsTableWrapper.add(offerColumnsTable)
|
||||
add(offerColumnsTableWrapper).row()
|
||||
|
||||
@ -29,26 +38,34 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
lowerTable.add(tradeText).colspan(2).row()
|
||||
|
||||
offerButton.onClick {
|
||||
val relationshipLevel = otherCivilization.getDiplomacyManager(currentPlayerCiv).relationshipLevel()
|
||||
if(offerButton.text.toString() == "Offer trade".tr()) {
|
||||
if(tradeLogic.currentTrade.theirOffers.size==0 && tradeLogic.currentTrade.ourOffers.size==0){
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr())
|
||||
letsHearIt()
|
||||
}
|
||||
else if (TradeEvaluation().isTradeAcceptable(tradeLogic.currentTrade.reverse(),otherCivilization,currentPlayerCiv)){
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralYes.random().tr())
|
||||
if(relationshipLevel<=RelationshipLevel.Enemy)
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().hateYes.random().tr())
|
||||
else tradeText.setText(otherCivilization.getTranslatedNation().neutralYes.random().tr())
|
||||
offerButton.setText("Accept".tr())
|
||||
}
|
||||
else{
|
||||
if(relationshipLevel<=RelationshipLevel.Enemy)
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().hateNo.random().tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralNo.random().tr())
|
||||
}
|
||||
}
|
||||
else if(offerButton.text.toString() == "Accept".tr()){
|
||||
tradeLogic.acceptTrade()
|
||||
tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
offerColumnsTableWrapper.clear()
|
||||
offerColumnsTableWrapper.add(offerColumnsTable)
|
||||
tradeText.setText("Pleasure doing business with you!".tr())
|
||||
if(tradeLogic.currentTrade.ourOffers.any { it.name== Constants.peaceTreaty })
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().afterPeace)
|
||||
else tradeText.setText("Pleasure doing business with you!".tr())
|
||||
onTradeComplete()
|
||||
|
||||
tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
offerButton.setText("Offer trade".tr())
|
||||
}
|
||||
}
|
||||
@ -64,7 +81,7 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
private fun onChange(){
|
||||
offerColumnsTable.update()
|
||||
offerButton.setText("Offer trade".tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr())
|
||||
letsHearIt()
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user