From 9f5b8d157a1bf3cd45a1d22dfed42450b0a5311b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 6 Aug 2020 19:53:29 +0300 Subject: [PATCH] Converted civ uniques up to India --- .../assets/jsons/Civ V - Vanilla/Buildings.json | 2 +- android/assets/jsons/Civ V - Vanilla/Nations.json | 15 +++++++++++++++ .../assets/jsons/Civ V - Vanilla/Policies.json | 2 +- core/src/com/unciv/logic/battle/BattleDamage.kt | 5 +++-- .../com/unciv/logic/city/CityExpansionManager.kt | 2 +- core/src/com/unciv/logic/city/CityStats.kt | 11 ++++------- core/src/com/unciv/logic/map/MapUnit.kt | 2 +- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/android/assets/jsons/Civ V - Vanilla/Buildings.json b/android/assets/jsons/Civ V - Vanilla/Buildings.json index f6a6a603..2e9217a9 100644 --- a/android/assets/jsons/Civ V - Vanilla/Buildings.json +++ b/android/assets/jsons/Civ V - Vanilla/Buildings.json @@ -596,7 +596,7 @@ "culture": 1, "isWonder": true, "greatPersonPoints": {"culture": 1}, - "uniques": ["Unhappiness from population decreased by 10%"], + "uniques": ["Unhappiness from population decreased by [10]%"], "requiredTech": "Banking", "quote": "'Most of us can, as we choose, make of this world either a palace or a prison' - John Lubbock" }, diff --git a/android/assets/jsons/Civ V - Vanilla/Nations.json b/android/assets/jsons/Civ V - Vanilla/Nations.json index 7a864a2d..8d4a47f7 100644 --- a/android/assets/jsons/Civ V - Vanilla/Nations.json +++ b/android/assets/jsons/Civ V - Vanilla/Nations.json @@ -30,6 +30,7 @@ "outerColor": [27,53,63], "innerColor": [213,249,255], "unique": "INGENUITY", + "uniqueName": "Ingenuity", "uniques": ["Receive free [Great Scientist] when you discover [Writing]", "[Great Scientist] is earned [50]% faster"] "cities": ["Babylon","Akkad","Dur-Kurigalzu","Nippur","Borsippa","Sippar","Opis","Mari","Shushan","Eshnunna", "Ellasar","Erech","Kutha","Sirpurla","Neribtum","Ashur","Ninveh","Nimrud","Arbela","Nuzi", @@ -59,6 +60,7 @@ "outerColor": [181, 232, 232], "innerColor": [68,142,249], "unique": "HELLENIC_LEAGUE", + "uniqueName": "Hellenic League", "uniques": ["City-State Influence degrades at half rate", "City-State Influence recovers at twice the normal rate"] "cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes", "Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios", @@ -84,6 +86,7 @@ "outerColor": [9, 112, 84], "innerColor": [255,255,255], "unique": "ART_OF_WAR", + "uniqueName": "Art of War", "uniques": ["Great General provides double combat bonus", "[Great General] is earned [50]% faster"] "cities": ["Beijing","Shanghai","Guangzhou","Nanjing","Xian","Chengdu","Hangzhou","Tianjin","Macau","Shandong", "Kaifeng","Ningbo","Baoding","Yangzhou","Harbin","Chongqing","Luoyang","Kunming","Taipei","Shenyang", @@ -113,6 +116,7 @@ "outerColor": [ 231, 213, 0], "innerColor": [98,10,210], "unique": "MONUMENT_BUILDERS", + "uniqueName": "Monument Builders", "uniques": ["+[20]% Production when constructing [Wonders]"] "cities": ["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten", "Hieraconpolis","Abydos","Asyut","Avaris","Lisht","Buto","Edfu","Pithom","Busiris","Kahun","Athribis", @@ -139,6 +143,7 @@ "outerColor": [ 114, 0, 0], "innerColor": [255,255,255], "unique": "SUN_NEVER_SETS", + "uniqueName": "Sun Never Sets", "uniques": ["+2 movement for all naval units"] "cities": ["London","York","Nottingham","Hastings","Canterbury","Coventry","Warwick","Newcastle","Oxford","Liverpool", "Dover","Brighton","Norwich","Leeds","Reading","Birmingham","Richmond","Exeter","Cambridge","Gloucester", @@ -163,6 +168,7 @@ "outerColor": [ 38, 98, 255], "innerColor": [239,236,148], "unique": "ANCIEN_REGIME", + "uniqueName": "Ancien RĂ©gime", "uniques": ["+2 Culture per turn from cities before discovering Steam Power"] "cities": ["Paris","Orleans","Lyon","Troyes","Tours","Marseille","Chartres","Avignon","Rouen","Grenoble", "Dijon","Amiens","Cherbourg","Poitiers","Toulouse","Bayonne","Strasbourg","Brest","Bordeaux","Rennes", @@ -188,6 +194,7 @@ "outerColor": [ 236, 178, 0], "innerColor": [0,0,0], "unique": "SIBERIAN_RICHES", + "uniqueName": "Siberian Riches", "uniques": ["[+1 Production] from [Strategic resource] tiles","Double quantity of [Horses] produced", "Double quantity of [Iron] produced","Double quantity of [Uranium] produced"] "cities": ["Moscow","St. Petersburg","Novgorod","Rostov","Yaroslavl","Yekaterinburg","Yakutsk","Vladivostok","Smolensk","Orenburg", @@ -214,6 +221,7 @@ "outerColor": [ 53,0,87], "innerColor": [238,201,9], "unique": "GLORY_OF_ROME", + "uniqueName": "The Glory of Rome", "uniques": ["+25% Production towards any buildings that already exist in the Capital"] "cities": ["Rome","Antium","Cumae","Neapolis","Ravenna","Arretium","Mediolanum","Arpinum","Circei","Setia", "Satricum","Ardea","Ostia","Velitrae","Viroconium","Tarentum","Brundisium","Caesaraugusta","Caesarea","Palmyra", @@ -239,6 +247,7 @@ "outerColor": [ 41,83,42], "innerColor": [146,221,9], "unique": "TRADE_CARAVANS", + "uniqueName": "Trade Caravans", "uniques": ["[+1 Gold] from each Trade Route", "Double quantity of [Oil] produced"], "cities": ["Mecca","Medina","Damascus","Baghdad","Najran","Kufah","Basra","Khurasan","Anjar","Fustat", "Aden","Yamama","Muscat","Mansura","Bukhara","Fez","Shiraz","Merw","Balkh","Mosul", @@ -262,6 +271,8 @@ "outerColor": [ 28,51,119], "innerColor": [255,255,255], "unique": "MANIFEST_DESTINY", + "uniqueName": "Manifest Destiny", + "uniques": ["+1 Sight for all land military units", "-50% cost when purchasing tiles"] "cities": ["Washington","New York","Boston","Philadelphia","Atlanta","Chicago","Seattle","San Francisco","Los Angeles","Houston", "Portland","St. Louis","Miami","Buffalo","Detroit","New Orleans","Baltimore","Denver","Cincinnati","Dallas","Memphis", "Cleveland","Kansas City","San Diego","Richmond","Las Vegas","Phoenix","Albuquerque","Minneapolis","Pittsburgh", @@ -288,6 +299,8 @@ "outerColor": [215,225,225], "innerColor": [185,0,0], "unique": "BUSHIDO", + "uniqueName": "Bushido", + "uniques": ["Units fight as though they were at full strength even when damaged"] "cities": ["Kyoto","Osaka","Tokyo","Satsuma","Kagoshima","Nara","Nagoya","Izumo","Nagasaki","Yokohama", "Shimonoseki","Matsuyama","Sapporo","Hakodate","Ise","Toyama","Fukushima","Suo","Bizen","Echizen", "Izumi","Omi","Echigo","Kozuke","Sado","Kobe","Nagano","Hiroshima","Takayama","Akita","Fukuoka","Aomori", @@ -312,6 +325,8 @@ "outerColor": [16,126,5], "innerColor": [255,153,51], "unique": "POPULATION_GROWTH", + "unique": "Population Growth", + "uniques": ["Unhappiness from number of Cities doubled", "Unhappiness from population decreased by [50]%"] "cities": ["Delhi","Mumbai","Vijayanagara","Pataliputra","Varanasi","Agra","Calcutta","Lahore","Bangalore","Hyderabad","Madurai","Ahmedabad", "Kolhapur","Prayaga","Ayodhya","Indraprastha","Mathura","Ujjain","Gulbarga","Jaunpur","Rajagriha","Sravasti","Tiruchirapalli","Thanjavur", "Bodhgaya","Kushinagar","Amaravati","Gaur","Gwalior","Jaipur","Karachi"] diff --git a/android/assets/jsons/Civ V - Vanilla/Policies.json b/android/assets/jsons/Civ V - Vanilla/Policies.json index 62f88639..41538930 100644 --- a/android/assets/jsons/Civ V - Vanilla/Policies.json +++ b/android/assets/jsons/Civ V - Vanilla/Policies.json @@ -88,7 +88,7 @@ { "name": "Meritocracy", "effect": "+1 happiness for every city connected to capital, -5% unhappiness from citizens", - "uniques": ["+1 happiness for every city connected to capital", "-5% unhappiness from citizens"], + "uniques": ["+1 happiness for every city connected to capital", "Unhappiness from population decreased by [5]%"], "requires": ["Citizenship"], "row": 2, "column": 5 diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index 0c0c33ee..bbc85631 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -259,8 +259,9 @@ object BattleDamage { } private fun getHealthDependantDamageRatio(combatant: ICombatant): Float { - return if(combatant.getUnitType() == UnitType.City - || combatant.getCivInfo().nation.unique == UniqueAbility.BUSHIDO && !combatant.getUnitType().isAirUnit()) + return if (combatant.getUnitType() == UnitType.City + || combatant.getCivInfo().hasUnique("Units fight as though they were at full strength even when damaged") + && !combatant.getUnitType().isAirUnit()) 1f else 1 - (100 - combatant.getHealth()) / 300f// Each 3 points of health reduces damage dealt by 1% like original game } diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index 9983a807..b42d52e8 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -61,7 +61,7 @@ class CityExpansionManager { if (cityInfo.containsBuildingUnique("Culture and Gold costs of acquiring new tiles reduced by 25% in this city")) cost *= 0.75 // Specialty of Krepost - if (cityInfo.civInfo.nation.unique == UniqueAbility.MANIFEST_DESTINY) + if (cityInfo.civInfo.hasUnique("-50% cost when purchasing tiles")) cost /= 2 return cost.toInt() } diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index c6cf45ff..93b45eb0 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -183,7 +183,7 @@ class CityStats { unhappinessModifier *= civInfo.gameInfo.getDifficulty().aiUnhappinessModifier var unhappinessFromCity = -3f // -3 happiness per city - if (civInfo.nation.unique == UniqueAbility.POPULATION_GROWTH) + if (civInfo.hasUnique("Unhappiness from number of Cities doubled")) unhappinessFromCity *= 2f//doubled for the Indian newHappinessList["Cities"] = unhappinessFromCity * unhappinessModifier @@ -196,12 +196,9 @@ class CityStats { unhappinessFromCitizens *= 1.5f else if (hasExtraAnnexUnhappiness()) unhappinessFromCitizens *= 2f - if (civInfo.hasUnique("Unhappiness from population decreased by 10%")) - unhappinessFromCitizens *= 0.9f - if (civInfo.hasUnique("-5% unhappiness from citizens")) - unhappinessFromCitizens *= 0.95f - if (civInfo.nation.unique == UniqueAbility.POPULATION_GROWTH) - unhappinessFromCitizens *= 0.5f //halved for the Indian + + for(unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []%")) + unhappinessFromCitizens *= (1-unique.params[0].toFloat()/100) newHappinessList["Population"] = -unhappinessFromCitizens * unhappinessModifier diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 58d8856c..e7122302 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -160,7 +160,7 @@ class MapUnit { visibilityRange += getUniques().count { it == "+1 Visibility Range" } if (hasUnique("+2 Visibility Range")) visibilityRange += 2 // This shouldn't be stackable if (hasUnique("Limited Visibility")) visibilityRange -= 1 - if (civInfo.nation.unique == UniqueAbility.MANIFEST_DESTINY) + if (civInfo.hasUnique("+1 Sight for all land military units")) visibilityRange += 1 if (type.isWaterUnit() && !type.isCivilian() && civInfo.hasUnique("All military naval units receive +1 movement and +1 sight"))