Inca abilities: Great Andean Road, Terrace farm (#2218)

* Inca abilities for Terrace farm and Great Andean Road

* Language files re-done by manual pull and merge

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
rh-github-2015
2020-03-23 09:13:40 +01:00
committed by GitHub
parent 063486ab09
commit 8aab5bb80b
10 changed files with 1185 additions and 262 deletions

View File

@ -165,15 +165,16 @@
},
/*
{
"name": "Terrace Farm",
"uniqueTo": "Inca",
"food": 1,
"turnsToBuild": 4,
"improvingTech": "Construction",
"uniques": ["+1 Food for each adjacent Mountain","+1 additional Food with Fertilizer and no fresh water"],
"terrainsCanBeBuiltOn": ["Plains","Grassland","Desert","Tundra"],
"name":"Terrace farm",
"uniqueTo":"Inca",
"food":1,
"turnsToBuild":7,
"uniques": ["+1 food for each adjacent Mountain","Cannot improve a resource"],
"techRequired":"Construction",
"improvingTech":"Fertilizer",
"improvingTechStats":{"food":1},
"terrainsCanBeBuiltOn":["Hill"]
//It can be colored in lemon
//Cannot improve a resource
},
*/

View File

@ -123,7 +123,7 @@
"hurryCostModifier": 20,
"requiredTech": "Archery",
"obsoleteTech": "Machinery",
"uniques": ["May withdraw before melee"],
"uniques": ["May withdraw before melee"], // should be inheritable (promotion)
"upgradesTo": "Crossbowman",
"attackSound": "arrow"
//Incan unique unit

View File

@ -238,6 +238,7 @@ Seven Cities of Gold = Les sept cités d'Or
Combat Strength +30% when fighting City-State units or attacking a City-State itself. All mounted units have +1 Movement. = +30% dans l'attaque des Cité-Etats ou de leur unités. +1 Mouvement pour toutes les unités montées.
Mongol Terror = Terreur Mongole
Units ignore terrain costs when moving into any tile with Hills. No maintenance costs for improvements in Hills; half cost elsewhere. = Unités ignorent le coût du terrain lors qu'ils entrant collines. Aucun entretien pour routes en collines, entretien réduit en moitié ailleurs.
Great Andean Road = Grande Route des Andes
Viking Fury = Fureur Viking
@ -815,7 +816,6 @@ Future era = Ère du futur
# Terrains
Impassable = Impraticable
# Resources
Bison = Bison
@ -825,6 +825,10 @@ Crab = Crabe
Citrus = Agrumes
Truffles = Truffe
Terrace farm = Ferme en Terrace
+1 food for each adjacent Mountain = +1 Nourriture par montagne adjacente
Cannot improve a resource = Non permis en cases avec ressources
# Unit types
Civilian = Civil

View File

@ -238,6 +238,8 @@ Seven Cities of Gold = Die Sieben Goldenen Städte
Combat Strength +30% when fighting City-State units or attacking a City-State itself. All mounted units have +1 Movement. = +30% Kampfstärke im Kampf gegen Stadtstaaten und deren Einheiten. Alle berittenen Einheiten haben +1 Bewegung.
Mongol Terror = Mongolischer Terror
Units ignore terrain costs when moving into any tile with Hills. No maintenance costs for improvements in Hills; half cost elsewhere. = Einheiten ignorieren Geländekosten beim betreten von Hügeln. Keine Wartungskosten für Straßen und Eisenbahnen in Hügeln, halbe Kosten anderswo.
Great Andean Road = Die Große Andenstraße
Great Andean Road = Die Große Andenstraße
Viking Fury = Wikinger-Raserei
@ -818,6 +820,10 @@ Crab = Krabben
Citrus = Zitrusfrüchte
Truffles = Trüffel
Terrace farm = Terrassenfelder
+1 food for each adjacent Mountain = +1 Nahrung pro anliegendem Berg
Cannot improve a resource = Kann nicht auf Feld mit Ressourcen gebaut werden
# Unit types
Civilian = ZivilistIn

File diff suppressed because it is too large Load Diff

View File

@ -238,6 +238,7 @@ Seven Cities of Gold =
Combat Strength +30% when fighting City-State units or attacking a City-State itself. All mounted units have +1 Movement. =
Mongol Terror =
Units ignore terrain costs when moving into any tile with Hills. No maintenance costs for improvements in Hills; half cost elsewhere. =
Great Andean Road =
Viking Fury =
@ -818,6 +819,10 @@ Crab =
Citrus =
Truffles =
Terrace farm =
+1 food for each adjacent Mountain =
Cannot improve a resource =
# Unit types
Civilian =

View File

@ -1,5 +1,6 @@
package com.unciv.logic.civilization
import com.unciv.Constants
import com.unciv.UniqueAbility
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
import com.unciv.logic.map.RoadStatus
@ -44,17 +45,25 @@ class CivInfoStats(val civInfo: CivilizationInfo){
private fun getTransportationUpkeep(): Int {
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
// just to go over them once is a waste of memory - there are low-end phones who don't have much ram
for (city in civInfo.cities) {
for (tile in city.getTiles()) {
if (tile.isCityCenter()) continue
when (tile.roadStatus) {
RoadStatus.Road -> transportationUpkeep += 1
RoadStatus.Railroad -> transportationUpkeep += 2
}
val tileUpkeep =
when (tile.roadStatus) {
RoadStatus.Road -> 1
RoadStatus.Railroad -> 2
RoadStatus.None -> 0
}
transportationUpkeep += tileUpkeep
if (tile.baseTerrain == Constants.hill) hillsUpkeep += tileUpkeep
}
}
// Inca unique according to https://civilization.fandom.com/wiki/Incan_%28Civ5%29
if (civInfo.nation.greatAndeanRoad)
transportationUpkeep = (transportationUpkeep - hillsUpkeep) / 2
if (civInfo.policies.isAdopted("Trade Unions"))
transportationUpkeep = (transportationUpkeep * 2 / 3f).toInt()
return transportationUpkeep

View File

@ -239,6 +239,8 @@ open class TileInfo {
if (improvement.uniques.contains("+1 additional Culture for each adjacent Moai"))
stats.culture += neighbors.count { it.improvement == "Moai" }
if (improvement.uniques.contains("+1 food for each adjacent Mountain"))
stats.food += neighbors.count { it.baseTerrain == Constants.mountain }
return stats
}
@ -251,6 +253,7 @@ open class TileInfo {
improvement.name == this.improvement -> false
improvement.uniqueTo != null && improvement.uniqueTo != civInfo.civName -> false
improvement.techRequired?.let { civInfo.tech.isResearched(it) } == false -> false
"Cannot improve a resource" in improvement.uniques && resource != null -> false
improvement.terrainsCanBeBuiltOn.contains(topTerrain.name) -> true
improvement.name == "Road" && roadStatus == RoadStatus.None -> true
improvement.name == "Railroad" && this.roadStatus != RoadStatus.Railroad -> true

View File

@ -30,6 +30,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (unit.ignoresTerrainCost) return 1f + extraCost
if (unit.doubleMovementInForestAndJungle && (to.baseTerrain == Constants.forest || to.baseTerrain == Constants.jungle))
return 1f + extraCost
if (civInfo.nation.greatAndeanRoad && to.baseTerrain == Constants.hill)
return 1f + extraCost
if (unit.roughTerrainPenalty
&& (to.baseTerrain == Constants.hill || to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle))

View File

@ -51,6 +51,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
@Transient var forestsAndJunglesAreRoads = false
// Same for Inca unique
@Transient var greatAndeanRoad = false
fun setTransients(){
outerColorObject = colorFromRGB(outerColor[0], outerColor[1], outerColor[2])
@ -60,6 +62,8 @@ class Nation : INamed {
if(unique == UniqueAbility.GREAT_WARPATH)
forestsAndJunglesAreRoads = true
if(unique == UniqueAbility.GREAT_ANDEAN_ROAD)
greatAndeanRoad = true
}
lateinit var cities: ArrayList<String>