mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Allow civs to trade with each other before settling their first cities (#12706)
Co-authored-by: czyh2022 <2200013085@stu.pku.edu.cn>
This commit is contained in:
parent
fc1454e28c
commit
fe5a2acf04
@ -24,16 +24,22 @@ class TradeEvaluation {
|
||||
|
||||
// Edge case time! Guess what happens if you offer a peace agreement to the AI for all their cities except for the capital,
|
||||
// and then capture their capital THAT SAME TURN? It can agree, leading to the civilization getting instantly destroyed!
|
||||
if (trade.ourOffers.count { it.type == TradeOfferType.City } == offerer.cities.size
|
||||
|| trade.theirOffers.count { it.type == TradeOfferType.City } == tradePartner.cities.size)
|
||||
// If a civ doen't has ever owned an original capital, which means it has not settle the first city yet,
|
||||
// it shouldn't be forbidden to trade with other civs owing to cities.size == 0.
|
||||
if ((offerer.hasEverOwnedOriginalCapital && trade.ourOffers.count { it.type == TradeOfferType.City } == offerer.cities.size)
|
||||
|| (tradePartner.hasEverOwnedOriginalCapital && trade.theirOffers.count { it.type == TradeOfferType.City } == tradePartner.cities.size)) {
|
||||
return false
|
||||
}
|
||||
|
||||
for (offer in trade.ourOffers)
|
||||
if (!isOfferValid(offer, offerer, tradePartner))
|
||||
if (!isOfferValid(offer, offerer, tradePartner)) {
|
||||
return false
|
||||
}
|
||||
|
||||
for (offer in trade.theirOffers)
|
||||
if (!isOfferValid(offer, tradePartner, offerer))
|
||||
if (!isOfferValid(offer, tradePartner, offerer)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user