mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 22:00:24 +07:00
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:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user