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 0000000000..abb5861941 Binary files /dev/null and b/android/Images/BuildingIcons/CN Tower.png differ diff --git a/android/Images/BuildingIcons/Pentagon.png b/android/Images/BuildingIcons/Pentagon.png new file mode 100644 index 0000000000..67ab0206f5 Binary files /dev/null and b/android/Images/BuildingIcons/Pentagon.png differ 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()