From ce0985d0772a6d9af44ee8c8f3468a7386760ea1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 6 Aug 2020 20:15:59 +0300 Subject: [PATCH] All nation uniques up to Iroquois --- android/assets/jsons/Civ V - Vanilla/Nations.json | 8 ++++++++ .../assets/jsons/Civ V - Vanilla/TileImprovements.json | 10 +++++----- core/src/com/unciv/logic/battle/Battle.kt | 4 ++-- core/src/com/unciv/logic/city/CityStats.kt | 4 +--- core/src/com/unciv/logic/civilization/CivInfoStats.kt | 2 +- core/src/com/unciv/logic/map/TileInfo.kt | 4 +--- core/src/com/unciv/models/ruleset/Nation.kt | 8 ++++---- .../com/unciv/models/ruleset/tile/TileImprovement.kt | 2 +- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/android/assets/jsons/Civ V - Vanilla/Nations.json b/android/assets/jsons/Civ V - Vanilla/Nations.json index 8d4a47f70d..eeeb8290d6 100644 --- a/android/assets/jsons/Civ V - Vanilla/Nations.json +++ b/android/assets/jsons/Civ V - Vanilla/Nations.json @@ -349,6 +349,8 @@ "outerColor": [150,150,150], "innerColor": [60,60,60], "unique": "FUROR_TEUTONICUS", + "uniqueName": "Furor Teutonicus", + "uniques": ["67% chance to earn 25 Gold and recruit a Barbarian unit from a conquered encampment", "-25% land units maintenance"], "cities": ["Berlin","Hamburg","Munich","Cologne","Frankfurt","Essen","Dortmund","Stuttgart","Dusseldorf","Bremen", "Hannover","Duisburg","Leipzig","Dresden","Bonn","Bochum","Bielefeld","Karlsruhe","Gelsenkirchen","Wiesbaden", "Munster","Rostok","Chemnitz","Braunschweig","Halle","M׌nchengladbach","Kiel","Wuppertal","Freiburg","Hagen", @@ -377,6 +379,8 @@ "outerColor": [245,248,185], "innerColor": [18,84,30], "unique": "BARBARY_CORSAIRS", + "uniqueName": "Barbary Corsairs", + "uniques": ["Pay only one third the usual cost for naval unit maintenance", "Melee naval units have a 1/3 chance to capture defeated naval units"], "cities": ["Istanbul","Edirne","Ankara","Bursa","Konya","Samsun","Gaziantep","Diyabakir","Izmir","Kayseri","Malatya", "Marsin","Antalya","Zonguldak","Denizli","Ordu","Mugia","Eskishehir","Inebolu","Sinop","Adana","Artuin", "Bodrum","Eregli","Silifke","Sivas","Amasya","Marmaris","Trabzon","Erzurum","Urfa","Izmit","Afyonkarhisar", @@ -402,6 +406,8 @@ "outerColor": [20,25,173], "innerColor": [187,33,51], "unique": "SCHOLARS_OF_THE_JADE_HALL", + "uniqueName": "Scholars of the Jade Hall", + "uniques": ["[+2 Science] from every specialist", "[+2 Science] from every [Great Improvement]"], "cities": ["Seoul","Busan","Jeonju","Daegu","Pyongyang","Kaesong","Suwon","Gwangju","Gangneung","Hamhung","Wonju","Ulsan", "Changwon","Andong","Gongju","Haeju","Cheongju","Mokpo","Dongducheon","Geoje","Suncheon","Jinju","Sangju", "Rason","Gyeongju","Chungju","Sacheon","Gimje","Anju"] @@ -426,6 +432,8 @@ "outerColor": [54,72,72], "innerColor": [246,205,137], "unique": "GREAT_WARPATH", + "uniqueName": "The Great Warpath", + "uniques": ["All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel."] "cities": ["Onoondaga","Osininka","Grand River","Akwesasme","Buffalo Creek","Brantford","Montreal","Genesse River", "Canandaigua Lake","Lake Simcoe","Salamanca","Gowanda","Cuba","Akron","Kanesatake","Ganienkeh","Cayuga Castle", "Chondote","Canajoharie","Nedrow","Oneida Lake","Kanonwalohale","Green Bay","Southwold","Mohawk Valley", diff --git a/android/assets/jsons/Civ V - Vanilla/TileImprovements.json b/android/assets/jsons/Civ V - Vanilla/TileImprovements.json index 2d1cc0a902..73429f917d 100644 --- a/android/assets/jsons/Civ V - Vanilla/TileImprovements.json +++ b/android/assets/jsons/Civ V - Vanilla/TileImprovements.json @@ -146,32 +146,32 @@ { "name": "Academy", "science": 8, - "uniques": ["Great improvement"], + "uniques": ["Great Improvement"], "improvingTech": "Scientific Theory", "improvingTechStats": {"science": 2} }, { "name": "Landmark", "culture": 6, - "uniques": ["Great improvement"], + "uniques": ["Great Improvement"], }, { "name": "Manufactory", "production": 4, "improvingTech": "Chemistry", - "uniques": ["Great improvement"], + "uniques": ["Great Improvement"], "improvingTechStats": {"production": 1} }, { "name": "Customs house", "gold": 4, "improvingTech": "Economics", - "uniques": ["Great improvement"], + "uniques": ["Great Improvement"], "improvingTechStats": {"gold": 1} }, { "name": "Citadel", - "uniques": ["Gives a defensive bonus of 100%", "Deal 30 damage to adjacent enemy units", "Great improvement"] + "uniques": ["Gives a defensive bonus of 100%", "Deal 30 damage to adjacent enemy units", "Great Improvement"] // TODO (G&K): adds every tile around it to your territory }, diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 60ce3b0967..cb3386023b 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -162,7 +162,7 @@ object Battle { // German unique - needs to be checked before we try to move to the enemy tile, since the encampment disappears after we move in if (defender.isDefeated() && defender.getCivInfo().isBarbarian() && attackedTile.improvement == Constants.barbarianEncampment - && attacker.getCivInfo().nation.unique == UniqueAbility.FUROR_TEUTONICUS + && attacker.getCivInfo().hasUnique("67% chance to earn 25 Gold and recruit a Barbarian unit from a conquered encampment") && Random().nextDouble() > 0.67) { attacker.getCivInfo().placeUnitNearTile(attackedTile.position, defender.getName()) attacker.getCivInfo().gold += 25 @@ -171,7 +171,7 @@ object Battle { // Similarly, Ottoman unique if (defender.isDefeated() && defender.getUnitType().isWaterUnit() && attacker.isMelee() && attacker.getUnitType().isWaterUnit() - && attacker.getCivInfo().nation.unique == UniqueAbility.BARBARY_CORSAIRS + && attacker.getCivInfo().hasUnique("Melee naval units have a 1/3 chance to capture defeated naval units") && Random().nextDouble() > 0.33) { attacker.getCivInfo().placeUnitNearTile(attackedTile.position, defender.getName()) } diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index 93b45eb086..305b2bef9e 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -196,7 +196,7 @@ class CityStats { unhappinessFromCitizens *= 1.5f else if (hasExtraAnnexUnhappiness()) unhappinessFromCitizens *= 2f - + for(unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []%")) unhappinessFromCitizens *= (1-unique.params[0].toFloat()/100) @@ -248,8 +248,6 @@ class CityStats { stats.add(Stats.parse(unique.params[0])) if (cityInfo.civInfo.hasUnique("+1 Production from specialists")) stats.production += 1 - if(cityInfo.civInfo.nation.unique == UniqueAbility.SCHOLARS_OF_THE_JADE_HALL) - stats.science+=2 return stats } diff --git a/core/src/com/unciv/logic/civilization/CivInfoStats.kt b/core/src/com/unciv/logic/civilization/CivInfoStats.kt index f5ccc847cc..1494f7ac25 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoStats.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoStats.kt @@ -27,7 +27,7 @@ class CivInfoStats(val civInfo: CivilizationInfo){ } var numberOfUnitsToPayFor = max(0f, unitsToPayFor.count().toFloat() - freeUnits) - if(civInfo.nation.unique == UniqueAbility.FUROR_TEUTONICUS){ + if(civInfo.hasUnique("-25% land units maintenance")){ val numberOfUnitsWithDiscount = min(numberOfUnitsToPayFor, unitsToPayFor.count { it.type.isLandUnit() }.toFloat()) numberOfUnitsToPayFor -= 0.25f * numberOfUnitsWithDiscount } diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index fbb690c085..2eab07f648 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -244,15 +244,13 @@ open class TileInfo { if(city!=null) for(unique in city.civInfo.getMatchingUniques("[] from every []")) { - if (improvement.name == unique.params[1]) + if (improvement.name == unique.params[1] || (unique.params[1]=="Great Improvement")) stats.add(Stats.parse(unique.params[0])) } if (containsGreatImprovement() && observingCiv.hasUnique("Tile yield from Great Improvements +100%")) stats.add(improvement) // again, for the double effect - if (containsGreatImprovement() && city != null && city.civInfo.nation.unique == UniqueAbility.SCHOLARS_OF_THE_JADE_HALL) - stats.science += 2 if (improvement.uniques.contains("+1 additional Culture for each adjacent Moai")) stats.culture += neighbors.count { it.improvement == "Moai" } diff --git a/core/src/com/unciv/models/ruleset/Nation.kt b/core/src/com/unciv/models/ruleset/Nation.kt index 2e3d13840b..1064d13b50 100644 --- a/core/src/com/unciv/models/ruleset/Nation.kt +++ b/core/src/com/unciv/models/ruleset/Nation.kt @@ -58,15 +58,15 @@ class Nation : INamed { // Same for Inca unique @Transient var greatAndeanRoad = false - fun setTransients(){ + fun setTransients() { outerColorObject = colorFromRGB(outerColor[0], outerColor[1], outerColor[2]) - if(innerColor==null) innerColorObject = Color.BLACK + if (innerColor == null) innerColorObject = Color.BLACK else innerColorObject = colorFromRGB(innerColor!![0], innerColor!![1], innerColor!![2]) - if(unique == UniqueAbility.GREAT_WARPATH) + if (uniques.contains("All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel.")) forestsAndJunglesAreRoads = true - if(unique == UniqueAbility.GREAT_ANDEAN_ROAD) + if (unique == UniqueAbility.GREAT_ANDEAN_ROAD) greatAndeanRoad = true } diff --git a/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt b/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt index cfb74468da..aaad9f5199 100644 --- a/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt +++ b/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt @@ -71,6 +71,6 @@ class TileImprovement : NamedStats() { } fun hasUnique(unique: String) = uniques.contains(unique) - fun isGreatImprovement() = hasUnique("Great improvement") + fun isGreatImprovement() = hasUnique("Great Improvement") }