Fixed Coast start bias
This commit is contained in:
parent
a1e1b91b9a
commit
7958c795dd
9 changed files with 12 additions and 9 deletions
|
@ -9,6 +9,7 @@ class Constants{
|
|||
const val forest = "Forest"
|
||||
const val jungle = "Jungle"
|
||||
const val hill = "Hill"
|
||||
const val coast = "Coast"
|
||||
const val peaceTreaty = "Peace Treaty"
|
||||
const val barbarianEncampment = "Barbarian encampment"
|
||||
const val ancientRuins = "Ancient ruins"
|
||||
|
|
|
@ -116,6 +116,7 @@ class GameStarter{
|
|||
val tileToAvoid = startBias.removePrefix("Avoid ")
|
||||
preferredTiles = preferredTiles.filter { it.baseTerrain != tileToAvoid && it.terrainFeature != tileToAvoid}
|
||||
}
|
||||
else if(startBias==Constants.coast) preferredTiles = preferredTiles.filter { it.neighbors.any { n -> n.baseTerrain==startBias } }
|
||||
else preferredTiles = preferredTiles.filter { it.baseTerrain == startBias || it.terrainFeature==startBias }
|
||||
}
|
||||
val randomLocation = if(preferredTiles.isNotEmpty()) preferredTiles.random() else freeTiles.random()
|
||||
|
|
|
@ -157,7 +157,7 @@ class GameInfo {
|
|||
|
||||
val unit:String
|
||||
if (unitList.isEmpty()) unit="Warrior"
|
||||
else if(waterUnits.isNotEmpty() && tileToPlace.neighbors.any{ it.baseTerrain=="Coast" } && Random().nextBoolean())
|
||||
else if(waterUnits.isNotEmpty() && tileToPlace.neighbors.any{ it.baseTerrain==Constants.coast } && Random().nextBoolean())
|
||||
unit=waterUnits.random().name
|
||||
else unit = landUnits.random().name
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.unciv.logic.automation
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.GreatPersonManager
|
||||
|
@ -73,7 +74,7 @@ class SpecificUnitAutomation{
|
|||
.take(5)
|
||||
.toList()
|
||||
var rank = top5Tiles.asSequence().map { nearbyTileRankings[it]!! }.sum()
|
||||
if(tileInfo.neighbors.any{it.baseTerrain == "Coast"}) rank += 5
|
||||
if(tileInfo.neighbors.any{it.baseTerrain == Constants.coast}) rank += 5
|
||||
return rank
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() {
|
|||
//Coasts
|
||||
for (tile in map.values.filter { it.baseTerrain == ocean }) {
|
||||
if (HexMath().getVectorsInDistance(tile.position,2).any { hasLandTile(map,it) }) {
|
||||
tile.baseTerrain = "Coast"
|
||||
tile.baseTerrain = Constants.coast
|
||||
tile.setTransients()
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ open class RandomMapGenerator {
|
|||
open fun setWaterTiles(map: HashMap<String, TileInfo>) {
|
||||
for (tile in map.values.filter { it.baseTerrain == ocean }) {
|
||||
if (HexMath().getVectorsInDistance(tile.position,2).any { hasLandTile(map,it) }) {
|
||||
tile.baseTerrain = "Coast"
|
||||
tile.baseTerrain = Constants.coast
|
||||
tile.setTransients()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ open class TileInfo {
|
|||
fun getTileStats(city: CityInfo?, observingCiv: CivilizationInfo): Stats {
|
||||
var stats = getBaseTerrain().clone()
|
||||
|
||||
if((baseTerrain== Constants.ocean||baseTerrain=="Coast") && city!=null
|
||||
if((baseTerrain== Constants.ocean||baseTerrain==Constants.coast) && city!=null
|
||||
&& city.getBuildingUniques().contains("+1 food from Ocean and Coast tiles"))
|
||||
stats.food += 1
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||
&& (to.baseTerrain == Constants.hill || to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle))
|
||||
return 4f
|
||||
|
||||
if(unit.doubleMovementInCoast && to.baseTerrain=="Coast")
|
||||
if(unit.doubleMovementInCoast && to.baseTerrain==Constants.coast)
|
||||
return 1/2f
|
||||
|
||||
return to.getLastTerrain().movementCost.toFloat() // no road
|
||||
|
|
|
@ -224,11 +224,11 @@ class Building : NamedStats(), IConstruction{
|
|||
return "Must be next to desert"
|
||||
|
||||
if ("Must be next to mountain" in uniques
|
||||
&& !construction.cityInfo.getCenterTile().neighbors.any { it.baseTerrain == "Mountain" })
|
||||
&& !construction.cityInfo.getCenterTile().neighbors.any { it.baseTerrain == Constants.mountain })
|
||||
return "Must be next to mountain"
|
||||
|
||||
if("Can only be built in coastal cities" in uniques
|
||||
&& !construction.cityInfo.getCenterTile().neighbors.any { it.baseTerrain=="Coast" })
|
||||
&& !construction.cityInfo.getCenterTile().neighbors.any { it.baseTerrain==Constants.coast })
|
||||
return "Can only be built in coastal cities"
|
||||
|
||||
val civInfo = construction.cityInfo.civInfo
|
||||
|
|
|
@ -120,7 +120,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||
fun getRejectionReason(construction: CityConstructions): String {
|
||||
val civRejectionReason = getRejectionReason(construction.cityInfo.civInfo)
|
||||
if(civRejectionReason!="") return civRejectionReason
|
||||
if(unitType.isWaterUnit() && construction.cityInfo.getCenterTile().neighbors.none { it.baseTerrain=="Coast" })
|
||||
if(unitType.isWaterUnit() && construction.cityInfo.getCenterTile().neighbors.none { it.baseTerrain==Constants.coast })
|
||||
return "Can't build water units by the coast"
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue