City-states allied to Civs no longer attempt to declare war when it does on Civs they haven't met yet

This commit is contained in:
Yair Morgenstern
2019-11-09 20:25:30 +02:00
parent 065b7586b2
commit 637b487a2c
3 changed files with 9 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

View File

@ -374,7 +374,7 @@ class CivilizationInfo {
policies.endTurn(nextTurnStats.culture.toInt()) policies.endTurn(nextTurnStats.culture.toInt())
// disband units until there are none left OR the gold values are normal // 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)) { for (i in 1 until (gold / -100)) {
var civMilitaryUnits = getCivUnits().filter { !it.type.isCivilian() } var civMilitaryUnits = getCivUnits().filter { !it.type.isCivilian() }
if (civMilitaryUnits.isNotEmpty()) { if (civMilitaryUnits.isNotEmpty()) {
@ -390,7 +390,7 @@ class CivilizationInfo {
if (cities.isNotEmpty()) tech.nextTurn(nextTurnStats.science.toInt()) 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 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() city.endTurn()
@ -398,7 +398,7 @@ class CivilizationInfo {
goldenAges.endTurn(getHappiness()) goldenAges.endTurn(getHappiness())
getCivUnits().forEach { it.endTurn() } getCivUnits().forEach { it.endTurn() }
diplomacy.values.forEach{it.nextTurn()} diplomacy.values.forEach { it.nextTurn() }
updateAllyCivForCityState() updateAllyCivForCityState()
updateHasActiveGreatWall() updateHasActiveGreatWall()
} }

View File

@ -346,14 +346,18 @@ class DiplomacyManager() {
if (!civInfo.isCityState()) { if (!civInfo.isCityState()) {
for (thirdCiv in civInfo.getKnownCivs()) { 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() thirdCiv.getDiplomacyManager(otherCiv).declareWar()
} }
} }
} }
if (!otherCiv.isCityState()) { if (!otherCiv.isCityState()) {
for (thirdCiv in otherCiv.getKnownCivs()) { 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() thirdCiv.getDiplomacyManager(civInfo).declareWar()
} }
} }