Added Compass tech and Harbor building

This commit is contained in:
Yair Morgenstern
2018-10-28 14:33:42 +02:00
parent cc0e76ba00
commit 45e5f82478
17 changed files with 366 additions and 341 deletions

View File

@ -139,6 +139,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Cambodia](https://thenounproject.com/term/cambodia/1809152/) By Wichai Wi for Angkor Wat
* [Books](https://thenounproject.com/term/books/1140218/) By Abir Alward for Oxford University
* [Forge](https://thenounproject.com/term/forge/1044767/) By Monjin Friends
* [Anchor](https://thenounproject.com/term/anchor/1258518/) By Saeful Muslim for Harbor
* [Hand saw](https://thenounproject.com/term/hand-saw/990902/) By b farias for Workshop
* [Hagia Sophia](https://thenounproject.com/term/hagia-sophia/1907752/) By Felipe Alvarado
* [Factory](https://thenounproject.com/term/factory/1624235/) By Maxim Kulikov for Ironworks
@ -298,6 +299,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
### Medieval
* [Judaism](https://thenounproject.com/term/judaism/324145/) By Ben Davis for Theology
* [Institution](https://thenounproject.com/term/institution/260586/) By Luis Prado for Civil Service
* [Compass](https://thenounproject.com/term/compass/821505/) By Bernar Novalyi
* [Education](https://thenounproject.com/term/education/1817512/) By Tomas Knopp
* [Casting](https://thenounproject.com/term/casting/10773/) By Jasmine Rae Friedrich
* [Bar association](https://thenounproject.com/term/bar-association/217443/) By Miroslav Kurdov for Guilds

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 KiB

After

Width:  |  Height:  |  Size: 905 KiB

View File

@ -276,6 +276,13 @@
resourceBonusStats:{production:1},
requiredTech:"Metal Casting"
},
{
name:"Harbor",
maintenance:2,
hurryCostModifier:25,
uniques:["+1 production from all sea resources worked by the city","Connects trade routes over water"]
requiredTech:"Compass"
},
{
name:"University",
maintenance:2,

View File

@ -177,13 +177,11 @@
buildingCost:200,
wonderCost:500,
techs:[
/*{
{
name:"Compass",
row:1,
cost:415,
prerequisites:["Optics"],
baseDescription:"Does nothing since we have no sea tiles - In theory, allows construction of harbors"
},*/
prerequisites:["Optics","Theology"],
},
{
name:"Education",
row:3,

View File

@ -239,8 +239,7 @@
food:1,
gold:1,
improvement:"Fishing Boats",
improvementStats:{food:1},
building:"Harbor"
improvementStats:{food:1}
},
{
name:"Pearls",
@ -248,7 +247,6 @@
terrainsCanBeFoundOn:["Coast"],
gold:2,
improvement:"Fishing Boats",
improvementStats:{food:1},
building:"Harbor"
improvementStats:{food:1}
}
]

View File

@ -2500,6 +2500,10 @@
Dutch:"Ruimteschip onderdeel"
Spanish:"Parte de Nave Espacial"
}
"Can only be built in coastal cities":{}
"All military naval units receive +1 movement and +1 sight":{}
"+1 production from all sea resources worked by the city":{}
"Connects trade routes over water":{}
// Unit types
"Civilian":{
@ -3226,6 +3230,8 @@
Romanian:"Chichen Itza"
Spanish:"Chichén Itzá"
}
"Lighthouse":{}
"The Great Lighthouse"{}
"Stable":{
Italian:"Scuderia"
Russian:"Конюшня"
@ -3284,7 +3290,6 @@
}
"Mint":{
Russian:"Монетный двор"
//don't know what this mint
Spanish:"Casa de la moneda"
}
"Machu Pichu":{
@ -3315,6 +3320,7 @@
Romanian:"Forja"
Spanish:"Forja"
}
"Harbor":{}
"University":{
Italian:"Università"
Russian:"Университет"
@ -3761,6 +3767,7 @@
Spanish:"Desbloqueado en"
}
// Tradition branch
"Tradition":{
Russian:"Традиция"
Spanish:"Tradición"
@ -3817,7 +3824,8 @@
Russian:"+15% роста и +2 еды во всех городах"
Spanish:"+15% crecimiento y +2 comida en todas las ciudades"
}
// And so on for all the policies. I can't be bothered to add them all now...
// Liberty branch
"Liberty":{
Russian:"Воля"
Spanish:"Liberación"

View File

@ -26,7 +26,7 @@ class GameStarter(){
val distanceAroundStartingPointNoOneElseWillStartIn = 5
val freeTiles = gameInfo.tileMap.values
.filter { it.getBaseTerrain().type==TerrainType.Land && vectorIsWithinNTilesOfEdge(it.position,3)}
.filter { it.isLand() && vectorIsWithinNTilesOfEdge(it.position,3)}
.toMutableList()
val playerPosition = freeTiles.getRandom().position
val playerCiv = CivilizationInfo(newGameParameters.nation, gameInfo)

View File

@ -81,7 +81,7 @@ class UnitAutomation{
}
private fun hasWorkableSeaResource(tileInfo: TileInfo): Boolean {
return tileInfo.resource!=null && tileInfo.getBaseTerrain().type==TerrainType.Water && tileInfo.improvement==null
return tileInfo.resource!=null && tileInfo.isWater() && tileInfo.improvement==null
}
private fun automateWorkBoats(unit: MapUnit) {
@ -129,7 +129,7 @@ class UnitAutomation{
fun containsAttackableEnemy(tile: TileInfo, unit: MapUnit): Boolean {
if(unit.isEmbarked()){
if(unit.baseUnit.unitType.isRanged()) return false
if(tile.getBaseTerrain().type==TerrainType.Water) return false // can't attack water units while embarked, only land
if(tile.isWater()) return false // can't attack water units while embarked, only land
}
val tileCombatant = Battle(unit.civInfo.gameInfo).getMapCombatantOfTile(tile)
if(tileCombatant==null) return false

View File

@ -6,7 +6,6 @@ import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tile.TerrainType
import com.unciv.models.gamebasics.tile.TileImprovement
class WorkerAutomation(val unit: MapUnit) {
@ -30,7 +29,7 @@ class WorkerAutomation(val unit: MapUnit) {
if(reachedTile!=tile) unit.doPreTurnAction() // otherwise, we get a situation where the worker is automated, so it tries to move but doesn't, then tries to automate, then move, etc, forever. Stack overflow exception!
return
}
if (tile.improvementInProgress == null && tile.getBaseTerrain().type==TerrainType.Land) {
if (tile.improvementInProgress == null && tile.isLand()) {
val improvement = chooseImprovement(tile)
if (tile.canBuildImprovement(improvement, unit.civInfo)) {
// What if we're stuck on this tile but can't build there?
@ -83,7 +82,7 @@ class WorkerAutomation(val unit: MapUnit) {
.filter {
(it.civilianUnit== null || it == currentTile)
&& it.improvement == null
&& it.getBaseTerrain().type==TerrainType.Land
&& it.isLand()
&& it.canBuildImprovement(chooseImprovement(it), unit.civInfo)
&& {val city=it.getCity(); city==null || it.getCity()?.civInfo == unit.civInfo}() // don't work tiles belonging to another civ
}.sortedByDescending { getPriority(it, unit.civInfo) }.toMutableList()

View File

@ -107,13 +107,13 @@ class MapUnit {
fun canPassThrough(tile: TileInfo):Boolean{
val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit()){
if(tile.isWater() && baseUnit.unitType.isLandUnit()){
if(!civInfo.tech.isResearched("Optics"))
return false
if(tile.baseTerrain == "Ocean" && !civInfo.tech.isResearched("Astronomy"))
return false
}
if(tile.getBaseTerrain().type==TerrainType.Land && baseUnit.unitType.isWaterUnit())
if(tile.isLand() && baseUnit.unitType.isWaterUnit())
return false
if(tile.baseTerrain=="Ocean" && baseUnit.uniques.contains("Cannot enter ocean tiles until Astronomy")
&& !civInfo.tech.isResearched("Astronomy"))

View File

@ -5,10 +5,7 @@ import com.unciv.UnCivGame
import com.unciv.logic.city.CityInfo
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tile.ResourceType
import com.unciv.models.gamebasics.tile.Terrain
import com.unciv.models.gamebasics.tile.TileImprovement
import com.unciv.models.gamebasics.tile.TileResource
import com.unciv.models.gamebasics.tile.*
import com.unciv.models.stats.Stats
import com.unciv.ui.utils.tr
import kotlin.math.abs
@ -142,6 +139,9 @@ open class TileInfo {
if(resource.name=="Oil" && city!=null
&& city.getBuildingUniques().contains("+2 Gold for each source of Oil and oasis"))
stats.gold += 2
if(city!=null && isWater()
&& city.getBuildingUniques().contains("+1 production from all sea resources worked by the city"))
stats.production+=1
}
val improvement = getTileImprovement()
@ -258,6 +258,9 @@ open class TileInfo {
return city!=null && city.workedTiles.contains(position)
}
fun isLand() = getBaseTerrain().type==TerrainType.Land
fun isWater() = getBaseTerrain().type==TerrainType.Water
fun arialDistanceTo(otherTile:TileInfo): Int {
val xDelta = position.x-otherTile.position.x
val yDelta = position.y-otherTile.position.y

View File

@ -1,15 +1,14 @@
package com.unciv.logic.map
import com.badlogic.gdx.math.Vector2
import com.unciv.models.gamebasics.tile.TerrainType
class UnitMovementAlgorithms(val unit:MapUnit) {
val tileMap = unit.getTile().tileMap
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
if(from.getBaseTerrain().type==TerrainType.Land && to.getBaseTerrain().type==TerrainType.Water
|| from.getBaseTerrain().type==TerrainType.Water && to.getBaseTerrain().type==TerrainType.Land)
if(from.isLand() && to.isWater()
|| from.isWater() && to.isLand())
return 100f // this is embarkment or disembarkment, and will take the entire turn
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)

View File

@ -10,7 +10,6 @@ import com.unciv.UnCivGame
import com.unciv.logic.HexMath
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.tile.TerrainType
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.onClick
@ -74,10 +73,9 @@ class Minimap(val tileMapHolder: TileMapHolder) : ScrollPane(null){
val exploredTiles = cloneCivilization.exploredTiles
for(tileInfo in tileMapHolder.tileMap.values) {
val hex = tileImages[tileInfo]!!
val isWaterTile = tileInfo.getBaseTerrain().type==TerrainType.Water
if (!(exploredTiles.contains(tileInfo.position) || UnCivGame.Current.viewEntireMapForDebug)) hex.color = Color.BLACK
else if (tileInfo.isCityCenter() && !isWaterTile) hex.color = tileInfo.getOwner()!!.getNation().getSecondaryColor()
else if (tileInfo.getCity() != null && !isWaterTile) hex.color = tileInfo.getOwner()!!.getNation().getColor()
else if (tileInfo.isCityCenter() && !tileInfo.isWater()) hex.color = tileInfo.getOwner()!!.getNation().getSecondaryColor()
else if (tileInfo.getCity() != null && !tileInfo.isWater()) hex.color = tileInfo.getOwner()!!.getNation().getColor()
else hex.color = tileInfo.getBaseTerrain().getColor().lerp(Color.GRAY, 0.5f) // Todo add to baseterrain as function
}
}

View File

@ -6,7 +6,6 @@ import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.map.MapUnit
import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tile.TerrainType
import com.unciv.models.gamebasics.unit.UnitType
import com.unciv.ui.pickerscreens.ImprovementPickerScreen
import com.unciv.ui.pickerscreens.PromotionPickerScreen
@ -131,7 +130,7 @@ class UnitActions {
}
if(unit.name == "Work Boats" && tile.improvement==null && tile.resource!=null
&& tile.getBaseTerrain().type==TerrainType.Water)
&& tile.isWater())
actionList += UnitAction("Create Fishing Boats",{
tile.improvement = "Fishing Boats"
unit.destroy()