Added Legion unique unit - #563

This commit is contained in:
Yair Morgenstern
2019-04-12 14:30:53 +03:00
parent e3dcd4cb43
commit c3bfed1bd1
10 changed files with 268 additions and 244 deletions

View File

@ -20,7 +20,7 @@ class UnCivGame(val version: String) : Game() {
val viewEntireMapForDebug = false
// For when you need to test something in an advanced game and don't have time to faff around
val superchargedForDebug = false
val superchargedForDebug = true
lateinit var worldScreen: WorldScreen

View File

@ -176,6 +176,7 @@ class MapUnit {
fun isIdle(): Boolean {
if (currentMovement == 0f) return false
if (name == "Worker" && getTile().improvementInProgress != null) return false
if (hasUnique("Can construct roads") && currentTile.improvementInProgress=="Road") return false
if (isFortified()) return false
if (action=="Sleep") return false
return true
@ -301,6 +302,7 @@ class MapUnit {
private fun doPostTurnAction() {
if (name == "Worker" && getTile().improvementInProgress != null) workOnImprovement()
if(hasUnique("Can construct roads") && currentTile.improvementInProgress=="Road") workOnImprovement()
if(currentMovement== getMaxMovement().toFloat()
&& isFortified()){
val currentTurnsFortified = getFortificationTurns()

View File

@ -5,6 +5,7 @@ import com.unciv.UnCivGame
import com.unciv.logic.automation.UnitAutomation
import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tr
@ -140,6 +141,14 @@ class UnitActions {
}
}
if(unit.hasUnique("Can construct roads") && tile.roadStatus==RoadStatus.None
&& tile.improvementInProgress != "Road"
&& unit.civInfo.tech.isResearched(GameBasics.TileImprovements["Road"]!!.techRequired!!))
actionList+=UnitAction("Construct road", unit.currentMovement >0){
tile.improvementInProgress="Road"
tile.turnsToImprovement=4
}
for(improvement in listOf("Fishing Boats","Oil well")) {
if (unit.hasUnique("May create improvements on water resources") && tile.resource != null
&& tile.improvement==null

View File

@ -45,6 +45,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){
"Create Fishing Boats" -> return ImageGetter.getImprovementIcon("Fishing Boats")
"Create Oil well" -> return ImageGetter.getImprovementIcon("Oil well")
"Pillage" -> return ImageGetter.getImage("OtherIcons/Pillage")
"Construct road" -> return ImageGetter.getImprovementIcon("Road")
else -> return ImageGetter.getImage("OtherIcons/Star")
}
}