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

@ -33,6 +33,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Catapult](https://thenounproject.com/search/?q=Spear&i=1233840) By Jakub Ukrop * [Catapult](https://thenounproject.com/search/?q=Spear&i=1233840) By Jakub Ukrop
* [Unloaded Crossbow](https://thenounproject.com/term/unloaded-crossbow/815992/) By Hamish as Ballista * [Unloaded Crossbow](https://thenounproject.com/term/unloaded-crossbow/815992/) By Hamish as Ballista
* [Sword](https://thenounproject.com/search/?q=Sword&i=1215443) By Guilherme Furtado for Swordsman * [Sword](https://thenounproject.com/search/?q=Sword&i=1215443) By Guilherme Furtado for Swordsman
* [Roman Helmet](https://thenounproject.com/search/?q=legion&i=440134) By parkjisun for Legion
* [Horse](https://thenounproject.com/search/?q=Horse&i=1373793) By AFY Studio for Horseman * [Horse](https://thenounproject.com/search/?q=Horse&i=1373793) By AFY Studio for Horseman
* [Horse Head](https://thenounproject.com/search/?q=Cavalry&i=374037) By Juan Pablo Bravo for Companion Cavalry * [Horse Head](https://thenounproject.com/search/?q=Cavalry&i=374037) By Juan Pablo Bravo for Companion Cavalry

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 976 KiB

After

Width:  |  Height:  |  Size: 979 KiB

View file

@ -6482,6 +6482,7 @@
Portuguese:"Espadachin" // may replace with guerreiro com espada if nescessary Portuguese:"Espadachin" // may replace with guerreiro com espada if nescessary
German:"Schwertkämpfer" German:"Schwertkämpfer"
} }
"Legion":{ "Legion":{
Italian:"Legionario" Italian:"Legionario"
Romanian:"Legionar" Romanian:"Legionar"
@ -6489,7 +6490,10 @@
Simplified_Chinese:"古罗马军团" Simplified_Chinese:"古罗马军团"
German:"Legionär" German:"Legionär"
French:"Légion" French:"Légion"
} // Rome unique }
"Can construct roads":{}
"Construct road":{} // for unit action button
"Horseman":{ "Horseman":{
Italian:"Guerriero a cavallo" //wrong translation by Smashfanful Italian:"Guerriero a cavallo" //wrong translation by Smashfanful
Russian:"Всадник" Russian:"Всадник"

View file

@ -332,7 +332,6 @@
hurryCostModifier:20, hurryCostModifier:20,
attackSound:"metalhit" attackSound:"metalhit"
}, },
/*
{ {
name:"Legion", name:"Legion",
unitType:"Melee", unitType:"Melee",
@ -345,10 +344,11 @@
upgradesTo:"Longswordsman", upgradesTo:"Longswordsman",
obsoleteTech:"Steel", obsoleteTech:"Steel",
requiredResource:"Iron", requiredResource:"Iron",
uniques:["Can construct roads"]
hurryCostModifier:20, hurryCostModifier:20,
attackSound:"metalhit" attackSound:"metalhit"
//Roman unique unit. It is stronger than Swordsman. It should also build roads (maybe railroads, too). It takes more to Steel to make it obsolete.
}, },
/*
{ {
name:"Mohawk Warrior", name:"Mohawk Warrior",
unitType:"Melee", unitType:"Melee",

View file

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

View file

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

View file

@ -5,6 +5,7 @@ import com.unciv.UnCivGame
import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.UnitAutomation
import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.map.MapUnit import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
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.tr 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")) { for(improvement in listOf("Fishing Boats","Oil well")) {
if (unit.hasUnique("May create improvements on water resources") && tile.resource != null if (unit.hasUnique("May create improvements on water resources") && tile.resource != null
&& tile.improvement==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 Fishing Boats" -> return ImageGetter.getImprovementIcon("Fishing Boats")
"Create Oil well" -> return ImageGetter.getImprovementIcon("Oil well") "Create Oil well" -> return ImageGetter.getImprovementIcon("Oil well")
"Pillage" -> return ImageGetter.getImage("OtherIcons/Pillage") "Pillage" -> return ImageGetter.getImage("OtherIcons/Pillage")
"Construct road" -> return ImageGetter.getImprovementIcon("Road")
else -> return ImageGetter.getImage("OtherIcons/Star") else -> return ImageGetter.getImage("OtherIcons/Star")
} }
} }