Resolved #2071 - AI will wait 20 turns between proposing research agreements if declined

This commit is contained in:
Yair Morgenstern 2020-03-03 23:05:56 +02:00
parent 2cf5645629
commit 97a07d3530
3 changed files with 5 additions and 1 deletions

View file

@ -319,7 +319,8 @@ class NextTurnAutomation{
val canSignResearchAgreementCiv = civInfo.getKnownCivs()
.asSequence()
.filter { civInfo.canSignResearchAgreementsWith(it) }
.filter { civInfo.canSignResearchAgreementsWith(it)
&& !civInfo.getDiplomacyManager(it).hasFlag(DiplomacyFlags.DeclinedResearchAgreement) }
.sortedByDescending { it.statsForNextTurn.science }
val duration = when(civInfo.gameInfo.gameParameters.gameSpeed) {

View file

@ -23,6 +23,7 @@ enum class RelationshipLevel{
enum class DiplomacyFlags{
DeclinedLuxExchange,
DeclinedPeace,
DeclinedResearchAgreement,
DeclaredWar,
DeclarationOfFriendship,
ResearchAgreement,

View file

@ -69,6 +69,8 @@ class TradePopup(worldScreen: WorldScreen): Popup(worldScreen){
val diplomacyManager = requestingCiv.getDiplomacyManager(viewingCiv)
if(trade.ourOffers.all { it.type==TradeType.Luxury_Resource } && trade.theirOffers.all { it.type==TradeType.Luxury_Resource })
diplomacyManager.setFlag(DiplomacyFlags.DeclinedLuxExchange,20) // offer again in 20 turns
if(trade.ourOffers.any { it.type==TradeType.Agreement && it.name==Constants.researchAgreement })
diplomacyManager.setFlag(DiplomacyFlags.DeclinedResearchAgreement,20) // offer again in 20 turns
if(trade.ourOffers.any{ it.type==TradeType.Treaty && it.name== Constants.peaceTreaty })
diplomacyManager.setFlag(DiplomacyFlags.DeclinedPeace,5)