From 637b487a2cea1880b6cce5fbb01fc80900dba0af Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 9 Nov 2019 20:25:30 +0200 Subject: [PATCH] City-states allied to Civs no longer attempt to declare war when it does on Civs they haven't met yet --- .../Images/TileSets/FantasyHex/Tiles/Atoll.png | Bin 0 -> 677 bytes .../unciv/logic/civilization/CivilizationInfo.kt | 6 +++--- .../civilization/diplomacy/DiplomacyManager.kt | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 android/Images/TileSets/FantasyHex/Tiles/Atoll.png diff --git a/android/Images/TileSets/FantasyHex/Tiles/Atoll.png b/android/Images/TileSets/FantasyHex/Tiles/Atoll.png new file mode 100644 index 0000000000000000000000000000000000000000..1241c2cfa609a0da5fc9f3df837e8aab964c239e GIT binary patch literal 677 zcmV;W0$TlvP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940y;@VK~zXft(8AZ z13?hQFCnOfVv!UIB32fD2(h=dNGn*0jiO>>Wg{A}NpBm()>05ZL<$>41TA7^qY^mx z&F!4Cd$X6jTz+uupS$dPGqby?MI&gQ-Nv>%7N4hExf;1ItBNyuCMIg2yS-_9347Of z)Q)996AuZ1^j-5SX~E~*NE3D2I^;$U0sHudFxRf#rH}k3w5IAR7`+u>da;=^Q4;pu z%Ef*%HoP2PrQaYES{5=Bqr@`;gSH(R#xT*aZ4gZyivn6$Vnlk)P4nK44NjI695;US zA@Nk$F3cN^>y6)}c;5h-g|t&jTtp-n2B`_b!TmF}zps620h>@uAjKJ9+!tp2`KjeK z+tZSQlEzumWDuWezy}h7FX=> zA1(#qMXs4>w3edb;LVO)LI#HKFH!xc|3Mue5`l2Rv=x_^vvC+tuPsD4md-w~S2EuR zd<-Fca=A)<2p-%Fs1IcN88#p@o-u${GeO8BY34L>O&IvKr;fof0D>kg@)F`2Bh`6? z#6iXYkfoReTI!kLMT8&VhgFf$Yp4b^r&S5985ELxp$eheCq&U73@wx}k0VMx00000 LNkvXXu0mjfO8*#m literal 0 HcmV?d00001 diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 2e63bcd6f5..3cfe044d52 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -374,7 +374,7 @@ class CivilizationInfo { policies.endTurn(nextTurnStats.culture.toInt()) // disband units until there are none left OR the gold values are normal - if(!isBarbarian() && gold < -100 && nextTurnStats.gold.toInt() < 0) { + if (!isBarbarian() && gold < -100 && nextTurnStats.gold.toInt() < 0) { for (i in 1 until (gold / -100)) { var civMilitaryUnits = getCivUnits().filter { !it.type.isCivilian() } if (civMilitaryUnits.isNotEmpty()) { @@ -390,7 +390,7 @@ class CivilizationInfo { if (cities.isNotEmpty()) tech.nextTurn(nextTurnStats.science.toInt()) - if(isMajorCiv()) greatPeople.addGreatPersonPoints(getGreatPersonPointsForNextTurn()) // City-states don't get great people! + if (isMajorCiv()) greatPeople.addGreatPersonPoints(getGreatPersonPointsForNextTurn()) // City-states don't get great people! for (city in cities.toList()) { // a city can be removed while iterating (if it's being razed) so we need to iterate over a copy city.endTurn() @@ -398,7 +398,7 @@ class CivilizationInfo { goldenAges.endTurn(getHappiness()) getCivUnits().forEach { it.endTurn() } - diplomacy.values.forEach{it.nextTurn()} + diplomacy.values.forEach { it.nextTurn() } updateAllyCivForCityState() updateHasActiveGreatWall() } diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 2b7cd7cf30..ff68edb064 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -346,14 +346,18 @@ class DiplomacyManager() { if (!civInfo.isCityState()) { for (thirdCiv in civInfo.getKnownCivs()) { - if (thirdCiv.isCityState() && thirdCiv.getAllyCiv() == civInfo.civName && thirdCiv.getDiplomacyManager(otherCiv).canDeclareWar()) { + if (thirdCiv.isCityState() && thirdCiv.getAllyCiv() == civInfo.civName + && thirdCiv.knows(otherCiv) + && thirdCiv.getDiplomacyManager(otherCiv).canDeclareWar()) { thirdCiv.getDiplomacyManager(otherCiv).declareWar() } } } if (!otherCiv.isCityState()) { for (thirdCiv in otherCiv.getKnownCivs()) { - if (thirdCiv.isCityState() && thirdCiv.getAllyCiv() == otherCiv.civName && thirdCiv.getDiplomacyManager(civInfo).canDeclareWar()) { + if (thirdCiv.isCityState() && thirdCiv.getAllyCiv() == otherCiv.civName + && thirdCiv.knows(otherCiv) + && thirdCiv.getDiplomacyManager(civInfo).canDeclareWar()) { thirdCiv.getDiplomacyManager(civInfo).declareWar() } }