From 62dc05ee5cbd99c0e9cdec0a2fb9443b61278610 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 27 May 2022 13:55:33 +0300 Subject: [PATCH] AI counteroffers will no longer contain items already offered by the player for 'double declaration of war' etc (#6940) --- core/src/com/unciv/logic/automation/NextTurnAutomation.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 0088283f36..6857f61245 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -129,7 +129,7 @@ object NextTurnAutomation { val tradeLogic = TradeLogic(civInfo, otherCiv) tradeLogic.currentTrade.set(tradeRequest.trade.reverse()) - // What do they have that we would want??? + // What do they have that we would want? val potentialAsks = HashMap() val counterofferAsks = HashMap() val counterofferGifts = ArrayList() @@ -142,8 +142,10 @@ object NextTurnAutomation { continue // For example resources gained by trade or CS if (offer.type == TradeType.City) continue // Players generally don't want to give up their cities, and they might misclick - if (offer.type == TradeType.Agreement && tradeLogic.currentTrade.theirOffers.contains(offer)) - continue // So you don't get double offers of open borders etc. + + if (tradeLogic.currentTrade.theirOffers.any { it.type == offer.type && it.name == offer.name }) + continue // So you don't get double offers of open borders declarations of war etc. + val value = evaluation.evaluateBuyCost(offer, civInfo, otherCiv) if (value > 0) potentialAsks[offer] = value