Added Fish, Pearls and Whale resources, Work Boats unit, Sailing tech and Fishing Boats impovement

This commit is contained in:
Yair Morgenstern 2018-10-11 23:03:31 +03:00
parent 64359a794e
commit 1111a23c14
19 changed files with 376 additions and 332 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

After

Width:  |  Height:  |  Size: 897 KiB

View File

@ -44,12 +44,12 @@
buildingCost:75, buildingCost:75,
wonderCost:185, wonderCost:185,
techs:[ techs:[
/*{ {
name:"Sailing", name:"Sailing",
row:1, row:1,
prerequisites:["Pottery"], prerequisites:["Pottery"],
baseDescription:"Does nothing since we have no sea tiles - In theory, Allows access to sea resources by building work boats" baseDescription:"Does nothing since we have no sea tiles - In theory, Allows access to sea resources by building work boats"
},*/ },
{ {
name:"Calendar", name:"Calendar",
row:2, row:2,

View File

@ -71,6 +71,13 @@
improvingTech:"Chemistry", improvingTech:"Chemistry",
improvingTechStats:{production:1} improvingTechStats:{production:1}
}, },
{
name:"Fishing Boats",
food:1,
techRequired:"Sailing",
improvingTech:"Compass",
improvingTechStats:{gold:1}
},
// Transportation // Transportation
{ {

View File

@ -63,6 +63,15 @@
uniqueTo:"Babylon", uniqueTo:"Babylon",
upgradesTo:"Crossbowman" upgradesTo:"Crossbowman"
}, },
{
name:"Work Boats",
unitType:"WaterCivilian",
baseDescription: "May create improvements on water resources",
movement:4,
cost: 30,
requiredTech:"Sailing",
hurryCostModifier:20
},
{ {
name:"Chariot Archer", name:"Chariot Archer",
unitType:"Ranged", unitType:"Ranged",

View File

@ -17,7 +17,7 @@ class UnCivGame : Game() {
* This exists so that when debugging we can see the entire map. * This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload! * Remember to turn this to false before commit and upload!
*/ */
val viewEntireMapForDebug = false val viewEntireMapForDebug = true
lateinit var worldScreen: WorldScreen lateinit var worldScreen: WorldScreen

View File

@ -68,7 +68,7 @@ class HexMath {
fun GetVectorsInDistance(origin: Vector2, distance: Int): List<Vector2> { fun GetVectorsInDistance(origin: Vector2, distance: Int): List<Vector2> {
val hexesToReturn = mutableListOf<Vector2>() val hexesToReturn = mutableListOf<Vector2>()
for (i in 0 until distance + 1) { for (i in 0 .. distance) {
hexesToReturn.addAll(GetVectorsAtDistance(origin, i)) hexesToReturn.addAll(GetVectorsAtDistance(origin, i))
} }
return hexesToReturn return hexesToReturn

View File

@ -307,7 +307,9 @@ class UnitAutomation{
val top5Tiles = tileInfo.neighbors.union(bestTilesFromOuterLayer) val top5Tiles = tileInfo.neighbors.union(bestTilesFromOuterLayer)
.sortedByDescending { nearbyTileRankings[it] } .sortedByDescending { nearbyTileRankings[it] }
.take(5) .take(5)
return top5Tiles.map { nearbyTileRankings[it]!! }.sum() var rank = top5Tiles.map { nearbyTileRankings[it]!! }.sum()
if(tileInfo.neighbors.any{it.baseTerrain == "Coast"}) rank += 5
return rank
} }
private fun automateSettlerActions(unit: MapUnit) { private fun automateSettlerActions(unit: MapUnit) {

View File

@ -105,6 +105,8 @@ class MapUnit {
val tileOwner = tile.getOwner() val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit()) if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit())
return false return false
if(tile.getBaseTerrain().type==TerrainType.Land && baseUnit.unitType.isWaterUnit())
return false
if(tileOwner!=null && tileOwner.civName!=owner if(tileOwner!=null && tileOwner.civName!=owner
&& (tile.isCityCenter() || !civInfo.canEnterTiles(tileOwner))) return false && (tile.isCityCenter() || !civInfo.canEnterTiles(tileOwner))) return false

View File

@ -89,20 +89,18 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
return (cost / 10).toInt() * 10 // rounded down o nearest ten return (cost / 10).toInt() * 10 // rounded down o nearest ten
} }
fun isBuildable(civInfo:CivilizationInfo): Boolean { override fun isBuildable(construction: CityConstructions): Boolean {
val civInfo = construction.cityInfo.civInfo
if (unbuildable) return false if (unbuildable) return false
if (requiredTech!=null && !civInfo.tech.isResearched(requiredTech!!)) return false if (requiredTech!=null && !civInfo.tech.isResearched(requiredTech!!)) return false
if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return false if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return false
if (uniqueTo!=null && uniqueTo!=civInfo.civName) return false if (uniqueTo!=null && uniqueTo!=civInfo.civName) return false
if (GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return false if (GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return false
if (requiredResource!=null && !civInfo.getCivResources().keys.any { it.name == requiredResource }) return false if (requiredResource!=null && !civInfo.getCivResources().keys.any { it.name == requiredResource }) return false
if(unitType.isWaterUnit() && construction.cityInfo.getCenterTile().neighbors.none { it.baseTerrain=="Coast" })
return true return true
} }
override fun isBuildable(construction: CityConstructions): Boolean {
return isBuildable(construction.cityInfo.civInfo)
}
override fun postBuildEvent(construction: CityConstructions) { override fun postBuildEvent(construction: CityConstructions) {
val unit = construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name) val unit = construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name)
unit.promotions.XP += construction.getBuiltBuildings().sumBy { it.xpForNewUnits } unit.promotions.XP += construction.getBuiltBuildings().sumBy { it.xpForNewUnits }

View File

@ -7,6 +7,7 @@ enum class UnitType{
Ranged, Ranged,
Scout, Scout,
Mounted, Mounted,
WaterCivilian,
Siege; Siege;
fun isMelee(): Boolean { fun isMelee(): Boolean {
@ -27,4 +28,7 @@ enum class UnitType{
|| this == Ranged || this == Ranged
|| this == Siege || this == Siege
} }
fun isWaterUnit(): Boolean {
return this == WaterCivilian
}
} }

View File

@ -6,6 +6,7 @@ import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.map.MapUnit import com.unciv.logic.map.MapUnit
import com.unciv.models.gamebasics.Building import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tile.TerrainType
import com.unciv.models.gamebasics.unit.UnitType import com.unciv.models.gamebasics.unit.UnitType
import com.unciv.ui.pickerscreens.ImprovementPickerScreen import com.unciv.ui.pickerscreens.ImprovementPickerScreen
import com.unciv.ui.pickerscreens.PromotionPickerScreen import com.unciv.ui.pickerscreens.PromotionPickerScreen
@ -33,13 +34,6 @@ class UnitActions {
val unitTable = worldScreen.bottomBar.unitTable val unitTable = worldScreen.bottomBar.unitTable
val actionList = ArrayList<UnitAction>() val actionList = ArrayList<UnitAction>()
// if (unitTable.currentlyExecutingAction != "moveTo"
// && (unit.action==null || !unit.action!!.startsWith("moveTo") )){
// actionList += UnitAction("Move unit", {
// unitTable.currentlyExecutingAction = "moveTo"
// }, unit.currentMovement != 0f )
// }
//
if(unit.action!=null && unit.action!!.startsWith("moveTo")){ if(unit.action!=null && unit.action!!.startsWith("moveTo")){
actionList += actionList +=
UnitAction("Stop movement", { UnitAction("Stop movement", {
@ -136,13 +130,19 @@ class UnitActions {
} }
} }
if(unit.name == "Work Boats" && tile.improvement==null && tile.resource!=null
&& tile.getBaseTerrain().type==TerrainType.Water)
actionList += UnitAction("Create Fishing Boats",{
tile.improvement = "Fishing Boats"
unit.destroy()
}, unit.currentMovement != 0f)
if (unit.name == "Great Scientist") { if (unit.name == "Great Scientist") {
actionList += UnitAction( "Discover Technology", actionList += UnitAction( "Discover Technology",
{ {
unit.civInfo.tech.freeTechs += 1 unit.civInfo.tech.freeTechs += 1
unit.destroy() unit.destroy()
worldScreen.game.screen = TechPickerScreen(true, unit.civInfo) worldScreen.game.screen = TechPickerScreen(true, unit.civInfo)
},unit.currentMovement != 0f) },unit.currentMovement != 0f)
actionList += UnitAction("Construct Academy", actionList += UnitAction("Construct Academy",
constructImprovementAndDestroyUnit(unit, "Academy"), constructImprovementAndDestroyUnit(unit, "Academy"),

View File

@ -39,6 +39,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){
"Sleep" -> return ImageGetter.getImage("OtherIcons/Sleep.png") "Sleep" -> return ImageGetter.getImage("OtherIcons/Sleep.png")
"Explore" -> return ImageGetter.getUnitIcon("Scout") "Explore" -> return ImageGetter.getUnitIcon("Scout")
"Stop exploration" -> return ImageGetter.getImage("OtherIcons/Stop.png") "Stop exploration" -> return ImageGetter.getImage("OtherIcons/Stop.png")
"Create Fishing Boats" -> return ImageGetter.getImprovementIcon("Fishing Boats")
else -> return ImageGetter.getImage("OtherIcons/Star.png") else -> return ImageGetter.getImage("OtherIcons/Star.png")
} }
} }