mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +07:00
Added diplomatic repercussions for attacking your own ally city-state, and discouraged AIs from doing so
This commit is contained in:
@ -737,9 +737,9 @@ object NextTurnAutomation {
|
|||||||
val ourCombatStrength = civInfo.getStatForRanking(RankingType.Force).toFloat() + baseForce
|
val ourCombatStrength = civInfo.getStatForRanking(RankingType.Force).toFloat() + baseForce
|
||||||
var theirCombatStrength = otherCiv.getStatForRanking(RankingType.Force).toFloat() + baseForce
|
var theirCombatStrength = otherCiv.getStatForRanking(RankingType.Force).toFloat() + baseForce
|
||||||
|
|
||||||
//for city-states, also consider there protectors
|
//for city-states, also consider their protectors
|
||||||
if (otherCiv.isCityState() and otherCiv.getProtectorCivs().isNotEmpty()) {
|
if (otherCiv.isCityState() and otherCiv.getProtectorCivs().isNotEmpty()) {
|
||||||
theirCombatStrength += otherCiv.getProtectorCivs().sumOf{it.getStatForRanking(RankingType.Force)}
|
theirCombatStrength += otherCiv.getProtectorCivs().filterNot { it == civInfo }.sumOf{it.getStatForRanking(RankingType.Force)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theirCombatStrength > ourCombatStrength) return 0
|
if (theirCombatStrength > ourCombatStrength) return 0
|
||||||
@ -814,7 +814,11 @@ object NextTurnAutomation {
|
|||||||
if (theirCity.getTiles().none { tile -> tile.neighbors.any { it.getOwner() == theirCity.civInfo && it.getCity() != theirCity } })
|
if (theirCity.getTiles().none { tile -> tile.neighbors.any { it.getOwner() == theirCity.civInfo && it.getCity() != theirCity } })
|
||||||
modifierMap["Isolated city"] = 15
|
modifierMap["Isolated city"] = 15
|
||||||
|
|
||||||
if (otherCiv.isCityState()) modifierMap["City-state"] = -20
|
if (otherCiv.isCityState()) {
|
||||||
|
modifierMap["City-state"] = -20
|
||||||
|
if (otherCiv.getAllyCiv() == civInfo.civName)
|
||||||
|
modifierMap["Allied City-state"] = -20 // There had better be a DAMN good reason
|
||||||
|
}
|
||||||
|
|
||||||
return modifierMap.values.sum()
|
return modifierMap.values.sum()
|
||||||
}
|
}
|
||||||
|
@ -705,6 +705,21 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
|||||||
val otherCiv = otherCiv()
|
val otherCiv = otherCiv()
|
||||||
val otherCivDiplomacy = otherCivDiplomacy()
|
val otherCivDiplomacy = otherCivDiplomacy()
|
||||||
|
|
||||||
|
if (otherCiv.isCityState() && !indirectCityStateAttack) {
|
||||||
|
otherCivDiplomacy.setInfluence(-60f)
|
||||||
|
civInfo.changeMinorCivsAttacked(1)
|
||||||
|
otherCiv.cityStateFunctions.cityStateAttacked(civInfo)
|
||||||
|
|
||||||
|
// You attacked your own ally, you're a right bastard
|
||||||
|
if (otherCiv.getAllyCiv() == civInfo.civName) {
|
||||||
|
otherCiv.updateAllyCivForCityState()
|
||||||
|
otherCivDiplomacy.setInfluence(-120f)
|
||||||
|
for (knownCiv in civInfo.getKnownCivs()) {
|
||||||
|
knownCiv.getDiplomacyManager(civInfo).addModifier(DiplomaticModifiers.BetrayedDeclarationOfFriendship, -10f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onWarDeclared()
|
onWarDeclared()
|
||||||
otherCivDiplomacy.onWarDeclared()
|
otherCivDiplomacy.onWarDeclared()
|
||||||
|
|
||||||
@ -717,11 +732,6 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
|||||||
|
|
||||||
otherCivDiplomacy.setModifier(DiplomaticModifiers.DeclaredWarOnUs, -20f)
|
otherCivDiplomacy.setModifier(DiplomaticModifiers.DeclaredWarOnUs, -20f)
|
||||||
otherCivDiplomacy.removeModifier(DiplomaticModifiers.ReturnedCapturedUnits)
|
otherCivDiplomacy.removeModifier(DiplomaticModifiers.ReturnedCapturedUnits)
|
||||||
if (otherCiv.isCityState() && !indirectCityStateAttack) {
|
|
||||||
otherCivDiplomacy.setInfluence(-60f)
|
|
||||||
civInfo.changeMinorCivsAttacked(1)
|
|
||||||
otherCiv.cityStateFunctions.cityStateAttacked(civInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (thirdCiv in civInfo.getKnownCivs()) {
|
for (thirdCiv in civInfo.getKnownCivs()) {
|
||||||
if (thirdCiv.isAtWarWith(otherCiv)) {
|
if (thirdCiv.isAtWarWith(otherCiv)) {
|
||||||
|
Reference in New Issue
Block a user