From e573368d18e8e166317a6d89e38ea3e9442e7840 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 16 Jan 2019 22:24:29 +0200 Subject: [PATCH] Added CN Tower, Pentagon #245 --- Credits.md | 2 ++ android/Images/BuildingIcons/CN Tower.png | Bin 0 -> 909 bytes android/Images/BuildingIcons/Pentagon.png | Bin 0 -> 1546 bytes android/assets/jsons/Buildings.json | 17 ++++++++++ android/assets/jsons/Policies.json | 2 +- android/assets/jsons/Translations.json | 23 ++++++++----- core/src/com/unciv/logic/city/CityStats.kt | 3 ++ core/src/com/unciv/logic/map/MapUnit.kt | 32 ++++++++++++++++++ .../com/unciv/models/gamebasics/Building.kt | 6 ++++ .../unciv/ui/worldscreen/unit/UnitActions.kt | 18 ++-------- 10 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 android/Images/BuildingIcons/CN Tower.png create mode 100644 android/Images/BuildingIcons/Pentagon.png diff --git a/Credits.md b/Credits.md index ccf7328ecb..64a1eb9a9b 100644 --- a/Credits.md +++ b/Credits.md @@ -206,6 +206,8 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc * [Spaceship](https://thenounproject.com/term/spaceship/1444621/) By Dinosoft Labs for Apollo Program * [Build](https://thenounproject.com/term/build/1156478/) By Michael G Brown for Spaceship Factory * [Nuclear Plant](https://thenounproject.com/term/nuclear-plant/1132340/) By Andrejs Kirma +* [CN Tower Toronto](https://thenounproject.com/search/?q=cn%20tower&i=807678) By mikicon +* [Pentagon](https://thenounproject.com/search/?q=the%20pentagon&i=1788323) By Maxim Kulikov ### Future Era * [Hubble Telescope](https://thenounproject.com/search/?q=hubble%20space&i=445502) By Scott Lewis for Hubble Space Telescope diff --git a/android/Images/BuildingIcons/CN Tower.png b/android/Images/BuildingIcons/CN Tower.png new file mode 100644 index 0000000000000000000000000000000000000000..abb58619410dec7c77e542c5718a4489bf012695 GIT binary patch literal 909 zcmeAS@N?(olHy`uVBq!ia0vp^DImQK$!8;-MT+OL5ULAh?3y^w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rq&?`#_7Zj4bDk?H_qLa+)1LEONwv4VWS#b$=Sr%*?WKy^bDk?T ze{f5vs6FSol45Ursrq;pWb&lg+g_qx_MGR6uIspi7!!T8UNzC1yFRDzLuk#D7B7r} wjzx8c?g6#WW^ZX}X=!O`X=!QclDWD60IeWDPhp2p>;M1&07*qoM6N<$g1`Xx&j0`b literal 0 HcmV?d00001 diff --git a/android/assets/jsons/Buildings.json b/android/assets/jsons/Buildings.json index 7913def1ea..1ee2df7ac8 100644 --- a/android/assets/jsons/Buildings.json +++ b/android/assets/jsons/Buildings.json @@ -614,6 +614,23 @@ uniques:["Free Social Policy","Can only be built in coastal cities"], requiredTech:"Ecology" }, + { + name:"CN Tower", + isWonder:true, + culture:1, + greatPersonPoints:{production:1} + providesFreeBuilding:"Broadcast Tower" + uniques:["+1 population in each city","+1 happiness in each city"] + requiredTech:"Telecommunications" + }, + { + name:"Pentagon", + isWonder:true, + culture:1, + greatPersonPoints:{production:2} + uniques:["Gold cost of upgrading military units reduced by 33%"] + requiredTech:"Combined Arms" + }, { name:"Spaceship Factory", production:3, diff --git a/android/assets/jsons/Policies.json b/android/assets/jsons/Policies.json index 2c94cb0f01..e2d84d99ec 100644 --- a/android/assets/jsons/Policies.json +++ b/android/assets/jsons/Policies.json @@ -119,7 +119,7 @@ }, { name:"Professional Army", - description:"Gold cost of upgrading military units reduced by 50%", + description:"Gold cost of upgrading military units reduced by 33%", requires:["Military Caste"], row:3, column:4 diff --git a/android/assets/jsons/Translations.json b/android/assets/jsons/Translations.json index 24b79c0c6c..2cf521b1be 100644 --- a/android/assets/jsons/Translations.json +++ b/android/assets/jsons/Translations.json @@ -4892,6 +4892,21 @@ Portuguese:"Ópera de Sydney" } + "CN Tower":{} + "+1 population in each city":{} + "+1 happiness in each city":{} + + "Pentagon":{} + "Gold cost of upgrading military units reduced by 33%":{ + Spanish:"El coste de mejorar unidades con oro se reduce un 33%" + Italian:"-33% costi in Oro per aggiornare un'unità militare" + Romanian:"Costurile în aur pentru dezvoltarea unităților militare reduse cu 33%" + Simplified_Chinese:"升级军事单位的成本降低33%" + Portuguese:"-33% custo de ouro para unidades militares" + Russian:"стоимость улучшения юнита снижается на 33%" + } + + "Apollo Program":{ Italian:"Programma Apollo" Russian:"Программа Аполлон" @@ -5888,14 +5903,6 @@ Portuguese:"Exército Profissional" Russian:"профессиональная армия" } - "Gold cost of upgrading military units reduced by 50%":{ - Spanish:"El coste de mejorar unidades con oro se reduce un 50%" - Italian:"-50% costi in Oro per aggiornare un'unità militare" - Romanian:"Costurile în aur pentru dezvoltarea unităților militare reduse cu 50%" - Simplified_Chinese:"升级军事单位的成本降低50%" - Portuguese:"-50% custo de ouro para unidades militares" - Russian:"стоимость улучшения юнита снижается на 50%" - } "Honor Complete":{ Spanish:"Honor completado" Italian:"Onore Completo" diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index 626113e29d..a9331e2e39 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -173,6 +173,9 @@ class CityStats { val happinessFromBuildings = cityInfo.cityConstructions.getStats().happiness.toInt().toFloat() newHappinessList ["Buildings"] = happinessFromBuildings + if(civInfo.getBuildingUniques().contains("+1 happiness in each city")) + newHappinessList["Wonders"] = 1f + // we don't want to modify the existing happiness list because that leads // to concurrency problems if we iterate on it while changing happinessList=newHappinessList diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 7bd7f109b2..84ec13ccd6 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -205,6 +205,38 @@ class MapUnit { return movement } + fun getUnitToUpgradeTo(): BaseUnit { + var upgradedUnit = baseUnit().getUpgradeUnit(civInfo) + + // Go up the upgrade tree until you find the first one which isn't obsolete + while (upgradedUnit.obsoleteTech!=null && civInfo.tech.isResearched(upgradedUnit.obsoleteTech!!)) + upgradedUnit = upgradedUnit.getUpgradeUnit(civInfo) + return upgradedUnit + } + + fun canUpgrade(): Boolean { + // We need to remove the unit from the civ for this check, + // because if the unit requires, say, horses, and so does its upgrade, + // and the civ currently has 0 horses, + // if we don't remove the unit before the check it's return false! + + val unitToUpgradeTo = getUnitToUpgradeTo() + civInfo.removeUnit(this) + val canUpgrade = unitToUpgradeTo.isBuildable(civInfo) + civInfo.addUnit(this) + return canUpgrade + } + + fun getCostOfUpgrade(): Int { + val unitToUpgradeTo = getUnitToUpgradeTo() + var goldCostOfUpgrade = (unitToUpgradeTo.cost - baseUnit().cost) * 2 + 10 + if (civInfo.policies.isAdopted("Professional Army")) + goldCostOfUpgrade = (goldCostOfUpgrade * 0.66f).toInt() + if(civInfo.getBuildingUniques().contains("Gold cost of upgrading military units reduced by 33%")) + goldCostOfUpgrade = (goldCostOfUpgrade * 0.66f).toInt() + return goldCostOfUpgrade + } + //endregion //region state-changing functions diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index fcc700ce25..514c3c2b3d 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -254,6 +254,12 @@ class Building : NamedStats(), IConstruction{ if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++ else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.getRandom()) } + "+1 population in each city" in uniques -> { + for(city in civInfo.cities){ + city.population.population += 1 + city.population.autoAssignPopulation() + } + } } if (freeTechs != 0) civInfo.tech.freeTechs += freeTechs diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index f17ad5dc57..fd68c72380 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -61,23 +61,11 @@ class UnitActions { } if(unit.baseUnit().upgradesTo!=null && tile.getOwner()==unit.civInfo) { - var upgradedUnit = unit.baseUnit().getUpgradeUnit(unit.civInfo) - // Go up the upgrade tree until you find the first one which isn't obsolete - while (upgradedUnit.obsoleteTech!=null && unit.civInfo.tech.isResearched(upgradedUnit.obsoleteTech!!)) - upgradedUnit = upgradedUnit.getUpgradeUnit(unit.civInfo) + if (unit.canUpgrade()) { + val goldCostOfUpgrade = unit.getCostOfUpgrade() + val upgradedUnit = unit.getUnitToUpgradeTo() - // We need to remove the unit from the civ for this check, - // because if the unit requires, say, horses, and so does its upgrade, - // and the civ currently has 0 horses, - // if we don;t remove the unit before the check it's return false! - unit.civInfo.removeUnit(unit) - val canUpgrade = upgradedUnit.isBuildable(unit.civInfo) - unit.civInfo.addUnit(unit) - - if (canUpgrade) { - var goldCostOfUpgrade = (upgradedUnit.cost - unit.baseUnit().cost) * 2 + 10 - if (unit.civInfo.policies.isAdopted("Professional Army")) goldCostOfUpgrade = (goldCostOfUpgrade * 0.66f).toInt() actionList += UnitAction("Upgrade to [${upgradedUnit.name}] ([$goldCostOfUpgrade] gold)", unit.civInfo.gold >= goldCostOfUpgrade && !unit.isEmbarked()