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,
wonderCost:185,
techs:[
/*{
{
name:"Sailing",
row:1,
prerequisites:["Pottery"],
baseDescription:"Does nothing since we have no sea tiles - In theory, Allows access to sea resources by building work boats"
},*/
},
{
name:"Calendar",
row:2,

View file

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

View file

@ -63,6 +63,15 @@
uniqueTo:"Babylon",
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",
unitType:"Ranged",

View file

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

View file

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

View file

@ -307,7 +307,9 @@ class UnitAutomation{
val top5Tiles = tileInfo.neighbors.union(bestTilesFromOuterLayer)
.sortedByDescending { nearbyTileRankings[it] }
.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) {

View file

@ -105,6 +105,8 @@ class MapUnit {
val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit())
return false
if(tile.getBaseTerrain().type==TerrainType.Land && baseUnit.unitType.isWaterUnit())
return false
if(tileOwner!=null && tileOwner.civName!=owner
&& (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
}
fun isBuildable(civInfo:CivilizationInfo): Boolean {
override fun isBuildable(construction: CityConstructions): Boolean {
val civInfo = construction.cityInfo.civInfo
if (unbuildable) return false
if (requiredTech!=null && !civInfo.tech.isResearched(requiredTech!!)) return false
if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) 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 (requiredResource!=null && !civInfo.getCivResources().keys.any { it.name == requiredResource }) return false
if(unitType.isWaterUnit() && construction.cityInfo.getCenterTile().neighbors.none { it.baseTerrain=="Coast" })
return true
}
override fun isBuildable(construction: CityConstructions): Boolean {
return isBuildable(construction.cityInfo.civInfo)
}
override fun postBuildEvent(construction: CityConstructions) {
val unit = construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name)
unit.promotions.XP += construction.getBuiltBuildings().sumBy { it.xpForNewUnits }

View file

@ -7,6 +7,7 @@ enum class UnitType{
Ranged,
Scout,
Mounted,
WaterCivilian,
Siege;
fun isMelee(): Boolean {
@ -27,4 +28,7 @@ enum class UnitType{
|| this == Ranged
|| 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.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
@ -33,13 +34,6 @@ class UnitActions {
val unitTable = worldScreen.bottomBar.unitTable
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")){
actionList +=
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") {
actionList += UnitAction( "Discover Technology",
{
unit.civInfo.tech.freeTechs += 1
unit.destroy()
worldScreen.game.screen = TechPickerScreen(true, unit.civInfo)
},unit.currentMovement != 0f)
actionList += UnitAction("Construct Academy",
constructImprovementAndDestroyUnit(unit, "Academy"),

View file

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