From 0eb6b919575ee99c53d24ab9bda111d363fd89a6 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 30 Apr 2019 20:45:09 +0300 Subject: [PATCH] Ibrushed up on the rules and there are ways to have influence decrease in quantities less than 1, so you were right, it is a float --- core/src/com/unciv/UnCivGame.kt | 2 +- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 2 +- .../logic/civilization/diplomacy/DiplomacyManager.kt | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/UnCivGame.kt b/core/src/com/unciv/UnCivGame.kt index 9260514649..971f3f36c2 100644 --- a/core/src/com/unciv/UnCivGame.kt +++ b/core/src/com/unciv/UnCivGame.kt @@ -17,7 +17,7 @@ class UnCivGame(val version: String) : Game() { * This exists so that when debugging we can see the entire map. * Remember to turn this to false before commit and upload! */ - val viewEntireMapForDebug = true + val viewEntireMapForDebug = false // For when you need to test something in an advanced game and don't have time to faff around val superchargedForDebug = false diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index d09b9a7774..fb79cc8595 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -147,7 +147,7 @@ class CivilizationInfo { for (otherCivName in diplomacy.keys) { val otherCiv = gameInfo.getCivilization(otherCivName) if (otherCiv.isCityState() && otherCiv.diplomacy[civName]!!.influence > 60) { - var cultureBonus = Stats() + val cultureBonus = Stats() cultureBonus.add(Stat.Culture, 5.0f * getEra().ordinal) if (statMap.containsKey("City States")) statMap["City States"] = statMap["City States"]!! + cultureBonus diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 46ce30c168..da44fe9f53 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -28,7 +28,7 @@ class DiplomacyManager() { * The JSON serialize/deserialize REFUSES to deserialize hashmap keys as Enums, so I'm forced to use strings instead =( * This is so sad Alexa play Despacito */ var flagsCountdown = HashMap() - var influence: Int = 0 // For city states + var influence = 0f // For city states fun clone(): DiplomacyManager { val toReturn = DiplomacyManager() @@ -145,11 +145,11 @@ class DiplomacyManager() { if(flagsCountdown[flag]==0) flagsCountdown.remove(flag) } - if (influence > 0) { + if (influence > 1) { influence -= 1 - } else if (influence < 0) { + } else if (influence < 1) { influence += 1 - } + } else influence = 0f }