All nations uniqueified!

This commit is contained in:
Yair Morgenstern
2020-08-06 23:29:49 +03:00
parent de97e1c32f
commit 0a30e99359
8 changed files with 27 additions and 18 deletions

View File

@ -325,7 +325,7 @@
"outerColor": [16,126,5], "outerColor": [16,126,5],
"innerColor": [255,153,51], "innerColor": [255,153,51],
"unique": "POPULATION_GROWTH", "unique": "POPULATION_GROWTH",
"unique": "Population Growth", "uniqueName": "Population Growth",
"uniques": ["Unhappiness from number of Cities doubled", "Unhappiness from population decreased by [50]%"] "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", "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", "Kolhapur","Prayaga","Ayodhya","Indraprastha","Mathura","Ujjain","Gulbarga","Jaunpur","Rajagriha","Sravasti","Tiruchirapalli","Thanjavur",
@ -590,7 +590,8 @@
"outerColor": [81,0,9], "outerColor": [81,0,9],
"innerColor": [255,120,0], "innerColor": [255,120,0],
"unique": "MONGOL_TERROR", "unique": "MONGOL_TERROR",
"uniques": ["+30% Strength when fighting City-State units and cities", "+[] Movement for all [] units"] "uniqueName": "Mongol Terror",
"uniques": ["+30% Strength when fighting City-State units and cities", "+[1] Movement for all [Mounted] units"]
"cities": ["Karakorum","Beshbalik","Turfan","Hsia","Old Sarai","New Sarai","Tabriz","Tiflis","Otrar","Sanchu","Kazan", "cities": ["Karakorum","Beshbalik","Turfan","Hsia","Old Sarai","New Sarai","Tabriz","Tiflis","Otrar","Sanchu","Kazan",
"Almarikh","Ulaanbaatar","Hovd","Darhan","Dalandzadgad","Mandalgovi","Choybalsan","Erdenet","Tsetserieg", "Almarikh","Ulaanbaatar","Hovd","Darhan","Dalandzadgad","Mandalgovi","Choybalsan","Erdenet","Tsetserieg",
"Baruun-Urt","Ereen","Batshireet","Choyr","Ulaangom","Tosontsengel","Altay","Uliastay","Bayanhongor", "Baruun-Urt","Ereen","Batshireet","Choyr","Ulaangom","Tosontsengel","Altay","Uliastay","Bayanhongor",
@ -655,6 +656,9 @@
"outerColor": [253,245,155], "outerColor": [253,245,155],
"innerColor": [4,144,95], "innerColor": [4,144,95],
"unique": "GREAT_ANDEAN_ROAD", "unique": "GREAT_ANDEAN_ROAD",
"uniqueName": "Great Andean Road",
"uniques": ["Units ignore terrain costs when moving into any tile with Hills", "50% Maintenance costs reduction",
"No Maintenance costs for improvements in Hills"],
"cities": ["Cuzco","Tiwanaku","Machu","Ollantaytambo","Corihuayrachina","Huamanga","Rumicucho","Vilcabamba","Vitcos", "cities": ["Cuzco","Tiwanaku","Machu","Ollantaytambo","Corihuayrachina","Huamanga","Rumicucho","Vilcabamba","Vitcos",
"Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha", "Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha",
"Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac", "Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac",
@ -679,6 +683,9 @@
"outerColor": [51,25,0], "outerColor": [51,25,0],
"innerColor": [255,255,102], "innerColor": [255,255,102],
"unique": "VIKING_FURY", "unique": "VIKING_FURY",
"uniqueName": "Viking Fury",
"uniques": ["+1 Movement for all embarked units", "Units pay only 1 movement point to embark and disembark",
"Melee units pay no movement cost to pillage"],
"cities": ["Copenhagen","Aarhus","Kaupang","Ribe","Viborg","Tunsbers","Roskilde","Hedeby","Oslo","Jelling","Truso", "cities": ["Copenhagen","Aarhus","Kaupang","Ribe","Viborg","Tunsbers","Roskilde","Hedeby","Oslo","Jelling","Truso",
"Bergen","Faeroerne","Reykjavik","Trondheim","Godthab","Helluland","Lillehammer","Markland","Elsinore", "Bergen","Faeroerne","Reykjavik","Trondheim","Godthab","Helluland","Lillehammer","Markland","Elsinore",
"Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers", "Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers",

View File

@ -97,8 +97,6 @@ object BattleDamage {
if (enemy.getCivInfo().isCityState() && civInfo.hasUnique("+30% Strength when fighting City-State units and cities")) if (enemy.getCivInfo().isCityState() && civInfo.hasUnique("+30% Strength when fighting City-State units and cities"))
modifiers["vs [City-States]"] = 0.3f modifiers["vs [City-States]"] = 0.3f
if (civInfo.nation.unique == UniqueAbility.GREAT_EXPANSE && civInfo.cities.map { it.getTiles() }.any { it.contains(combatant.getTile()) })
modifiers[UniqueAbility.GREAT_EXPANSE.displayName] = 0.15f
} }
if (enemy.getCivInfo().isBarbarian()) { if (enemy.getCivInfo().isBarbarian()) {

View File

@ -83,6 +83,7 @@ class CityConstructions {
val buildingName = policyManager.legalismState[cityInfo.id] val buildingName = policyManager.legalismState[cityInfo.id]
maintenanceCost -= cityInfo.getRuleset().buildings[buildingName]!!.maintenance maintenanceCost -= cityInfo.getRuleset().buildings[buildingName]!!.maintenance
} }
return maintenanceCost return maintenanceCost
} }

View File

@ -44,12 +44,13 @@ class CivInfoStats(val civInfo: CivilizationInfo){
private fun getTransportationUpkeep(): Int { private fun getTransportationUpkeep(): Int {
var transportationUpkeep = 0 var transportationUpkeep = 0
var hillsUpkeep = 0
// we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list // we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list
// just to go over them once is a waste of memory - there are low-end phones who don't have much ram // just to go over them once is a waste of memory - there are low-end phones who don't have much ram
val ignoreHillTiles = civInfo.hasUnique("No Maintenance costs for improvements in Hills")
for (city in civInfo.cities) { for (city in civInfo.cities) {
for (tile in city.getTiles()) { for (tile in city.getTiles()) {
if (tile.isCityCenter()) continue if (tile.isCityCenter()) continue
if(ignoreHillTiles && tile.baseTerrain==Constants.hill) continue
val tileUpkeep = val tileUpkeep =
when (tile.roadStatus) { when (tile.roadStatus) {
RoadStatus.Road -> 1 RoadStatus.Road -> 1
@ -57,12 +58,11 @@ class CivInfoStats(val civInfo: CivilizationInfo){
RoadStatus.None -> 0 RoadStatus.None -> 0
} }
transportationUpkeep += tileUpkeep transportationUpkeep += tileUpkeep
if (tile.baseTerrain == Constants.hill) hillsUpkeep += tileUpkeep
} }
} }
// Inca unique according to https://civilization.fandom.com/wiki/Incan_%28Civ5%29 // Inca unique according to https://civilization.fandom.com/wiki/Incan_%28Civ5%29
if (civInfo.nation.greatAndeanRoad) if (civInfo.hasUnique("50% Maintenance costs reduction"))
transportationUpkeep = (transportationUpkeep - hillsUpkeep) / 2 transportationUpkeep /= 2
if (civInfo.hasUnique("Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes")) if (civInfo.hasUnique("Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes"))
transportationUpkeep = (transportationUpkeep * 2 / 3f).toInt() transportationUpkeep = (transportationUpkeep * 2 / 3f).toInt()
return transportationUpkeep return transportationUpkeep

View File

@ -233,7 +233,7 @@ class MapUnit {
fun getEmbarkedMovement(): Int { fun getEmbarkedMovement(): Int {
var movement=2 var movement=2
movement += civInfo.tech.getTechUniques().count { it == "Increases embarked movement +1" } movement += civInfo.tech.getTechUniques().count { it == "Increases embarked movement +1" }
if (civInfo.nation.unique == UniqueAbility.VIKING_FURY) movement +=1 if (civInfo.hasUnique("+1 Movement for all embarked units")) movement +=1
return movement return movement
} }

View File

@ -11,7 +11,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float { fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float {
if ((from.isLand != to.isLand) && unit.type.isLandUnit() && if ((from.isLand != to.isLand) && unit.type.isLandUnit() &&
(unit.civInfo.nation.unique != UniqueAbility.VIKING_FURY)) (unit.civInfo.nation.embarkDisembarkCosts1))
return 100f // this is embarkment or disembarkment, and will take the entire turn return 100f // this is embarkment or disembarkment, and will take the entire turn
var extraCost = 0f var extraCost = 0f
@ -36,7 +36,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (unit.doubleMovementInForestAndJungle && (to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle)) if (unit.doubleMovementInForestAndJungle && (to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle))
return 1f + extraCost // usually forest and jungle take 2 movements, so here it is 1 return 1f + extraCost // usually forest and jungle take 2 movements, so here it is 1
if (civInfo.nation.greatAndeanRoad && to.baseTerrain == Constants.hill) if (civInfo.nation.ignoreHillMovementCost && to.baseTerrain == Constants.hill)
return 1f + extraCost // usually hills take 2 movements, so here it is 1 return 1f + extraCost // usually hills take 2 movements, so here it is 1
if (unit.roughTerrainPenalty && to.isRoughTerrain()) if (unit.roughTerrainPenalty && to.isRoughTerrain())
@ -345,7 +345,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (tile.isOcean && !unit.civInfo.tech.embarkedUnitsCanEnterOcean) if (tile.isOcean && !unit.civInfo.tech.embarkedUnitsCanEnterOcean)
return false return false
} }
if (tile.isOcean && unit.civInfo.tech.wayfinding) { // Apparently all Polynesian naval unit can enter oceans if (tile.isOcean && unit.civInfo.tech.wayfinding) { // Apparently all Polynesian naval units can enter oceans
if (unit.cannotEnterOceanTiles) return false if (unit.cannotEnterOceanTiles) return false
if (unit.cannotEnterOceanTilesUntilAstronomy if (unit.cannotEnterOceanTilesUntilAstronomy
&& !unit.civInfo.tech.isResearched("Astronomy")) && !unit.civInfo.tech.isResearched("Astronomy"))

View File

@ -56,7 +56,8 @@ class Nation : INamed {
// This is its own transient because we'll need to check this for every tile-to-tile movement which is harsh // This is its own transient because we'll need to check this for every tile-to-tile movement which is harsh
@Transient var forestsAndJunglesAreRoads = false @Transient var forestsAndJunglesAreRoads = false
// Same for Inca unique // Same for Inca unique
@Transient var greatAndeanRoad = false @Transient var ignoreHillMovementCost = false
@Transient var embarkDisembarkCosts1 = false
fun setTransients() { fun setTransients() {
outerColorObject = colorFromRGB(outerColor[0], outerColor[1], outerColor[2]) outerColorObject = colorFromRGB(outerColor[0], outerColor[1], outerColor[2])
@ -66,8 +67,10 @@ class Nation : INamed {
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.")) 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 forestsAndJunglesAreRoads = true
if (unique == UniqueAbility.GREAT_ANDEAN_ROAD) if (uniques.contains("Units ignore terrain costs when moving into any tile with Hills"))
greatAndeanRoad = true ignoreHillMovementCost = true
if(uniques.contains("Units pay only 1 movement point to embark and disembark"))
embarkDisembarkCosts1 = true
} }
lateinit var cities: ArrayList<String> lateinit var cities: ArrayList<String>

View File

@ -200,9 +200,9 @@ object UnitActions {
tile.improvement = null tile.improvement = null
if (tile.resource!=null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource if (tile.resource!=null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
if (!unit.hasUnique("No movement cost to pillage") && val freePillage = unit.hasUnique("No movement cost to pillage") ||
(!unit.type.isMelee() || unit.civInfo.nation.unique != UniqueAbility.VIKING_FURY)) (unit.type.isMelee() && unit.civInfo.hasUnique("Melee units pay no movement cost to pillage"))
unit.useMovementPoints(1f) if(!freePillage) unit.useMovementPoints(1f)
unit.healBy(25) unit.healBy(25)