Added CN Tower, Pentagon #245

This commit is contained in:
Yair Morgenstern 2019-01-16 22:24:29 +02:00
parent eeaca08f57
commit e573368d18
10 changed files with 79 additions and 24 deletions

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -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,

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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()