Fixed war declaration against civs with a space in their name (e.g. The Ottomans)

This commit is contained in:
Yair Morgenstern 2019-06-29 23:56:35 +03:00
parent 6d38800093
commit e59ad4ff94
3 changed files with 7 additions and 7 deletions

View file

@ -88,7 +88,7 @@ class TradeEvaluation{
TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20
TradeType.Introduction -> return 250
TradeType.WarDeclaration -> {
val nameOfCivToDeclareWarOn = offer.name.split(' ').last()
val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ")
val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn)
val threatToThem = Automation().threatAssessment(civInfo,civToDeclareWarOn)
@ -159,7 +159,7 @@ class TradeEvaluation{
TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20
TradeType.Introduction -> return 250
TradeType.WarDeclaration -> {
val nameOfCivToDeclareWarOn = offer.name.split(' ').last()
val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ")
val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn)
val threatToUs = Automation().threatAssessment(civInfo, civToDeclareWarOn)

View file

@ -52,9 +52,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
private fun updateLeftSideTable() {
leftSideTable.clear()
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
for (civ in UnCivGame.Current.gameInfo.civilizations
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) {
if (!currentPlayerCiv.knows(civ)) continue
for (civ in currentPlayerCiv.getKnownCivs()
.filterNot { it.isDefeated() || it.isBarbarianCivilization() }) {
val civIndicator = ImageGetter.getNationIndicator(civ.getNation(),100f)
@ -225,7 +224,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
}
diplomacyTable.add(demandsButton).row()
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
if(!otherCiv.isPlayerCivilization())
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
val diplomacyModifiersTable = Table()
for (modifier in otherCivDiplomacyManager.diplomaticModifiers) {

View file

@ -186,7 +186,7 @@ class WorldScreen : CameraStageBaseScreen() {
private fun updateDiplomacyButton(civInfo: CivilizationInfo) {
diplomacyButtonWrapper.clear()
if(civInfo.getKnownCivs()
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }
.filterNot { it.isDefeated() || it.isBarbarianCivilization() }
.any()) {
displayTutorials("OtherCivEncountered")
val btn = TextButton("Diplomacy".tr(), skin)