mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
"Gift" trades to AI civs make them more friendly towards you
This commit is contained in:
parent
0b5ded98c9
commit
1d30336ea5
@ -88,6 +88,7 @@ enum class DiplomaticModifiers(val text:String) {
|
||||
OpenBorders("Our open borders have brought us closer together."),
|
||||
FulfilledPromiseToNotSettleCitiesNearUs("You fulfilled your promise to stop settling cities near us!"),
|
||||
GaveUsUnits("You gave us units!"),
|
||||
GaveUsGifts("We appreciate your gifts"),
|
||||
ReturnedCapturedUnits("You returned captured units to us"),
|
||||
|
||||
}
|
||||
@ -589,6 +590,7 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
if (openBorders > 0) addModifier(DiplomaticModifiers.OpenBorders, openBorders / 8f) // so if we both have open borders it'll grow by 0.25 per turn
|
||||
else revertToZero(DiplomaticModifiers.OpenBorders, 1 / 8f)
|
||||
|
||||
// Negatives
|
||||
revertToZero(DiplomaticModifiers.DeclaredWarOnUs, 1 / 8f) // this disappears real slow - it'll take 160 turns to really forget, this is war declaration we're talking about
|
||||
revertToZero(DiplomaticModifiers.WarMongerer, 1 / 2f) // warmongering gives a big negative boost when it happens but they're forgotten relatively quickly, like WWII amirite
|
||||
revertToZero(DiplomaticModifiers.CapturedOurCities, 1 / 4f) // if you captured our cities, though, that's harder to forget
|
||||
@ -596,12 +598,15 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs, 1 / 8f) // That's a bastardly thing to do
|
||||
revertToZero(DiplomaticModifiers.UnacceptableDemands, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.LiberatedCity, 1 / 8f)
|
||||
revertToZero(DiplomaticModifiers.StealingTerritory, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.DenouncedOurAllies, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.DenouncedOurEnemies, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.Denunciation, 1 / 8f) // That's personal, it'll take a long time to fade
|
||||
|
||||
// Positives
|
||||
revertToZero(DiplomaticModifiers.GaveUsUnits, 1 / 4f)
|
||||
revertToZero(DiplomaticModifiers.LiberatedCity, 1 / 8f)
|
||||
revertToZero(DiplomaticModifiers.GaveUsGifts, 1 / 4f)
|
||||
|
||||
setFriendshipBasedModifier()
|
||||
|
||||
|
@ -4,7 +4,9 @@ import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.AlertType
|
||||
import com.unciv.logic.civilization.Civilization
|
||||
import com.unciv.logic.civilization.PopupAlert
|
||||
import com.unciv.logic.civilization.diplomacy.CityStateFunctions
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
|
||||
import com.unciv.models.ruleset.ModOptionsConstants
|
||||
import com.unciv.models.ruleset.tile.ResourceType
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
@ -142,6 +144,12 @@ class TradeLogic(val ourCivilization:Civilization, val otherCivilization: Civili
|
||||
for (offer in currentTrade.ourOffers.filter { it.type == TradeType.Treaty })
|
||||
transferTrade(ourCivilization, otherCivilization, offer)
|
||||
|
||||
if (currentTrade.ourOffers.isEmpty()){
|
||||
val goldValueOfTrade = TradeEvaluation().getTradeAcceptability(currentTrade, ourCivilization, otherCivilization)
|
||||
val diplomaticValueOfTrade = CityStateFunctions(ourCivilization).influenceGainedByGift(otherCivilization, goldValueOfTrade) / 10
|
||||
ourCivilization.getDiplomacyManager(otherCivilization).addModifier(DiplomaticModifiers.GaveUsGifts, diplomaticValueOfTrade.toFloat())
|
||||
}
|
||||
|
||||
ourCivilization.cache.updateCivResources()
|
||||
ourCivilization.updateStatsForNextTurn()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user