Added longbowman (Engand unique unit)

Techs now don't display units that are unique to other civs, or the base unit if you have a unique that replaces it
This commit is contained in:
Yair Morgenstern 2018-06-18 23:33:49 +03:00
parent 07293ac449
commit 0af880877f
6 changed files with 22 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -102,6 +102,9 @@
Romanian:"Dispune"
}
"Found city":{
}
"Promote":{
}

View File

@ -136,6 +136,19 @@
requiredTech:"Machinery",
hurryCostModifier:20
},
{
name:"Longbowman",
unitType:"Ranged",
range:3,
movement:2,
strength:13,
rangedStrength:18,
replaces:"Crossbowman",
uniqueTo:"England",
cost: 120,
requiredTech:"Machinery",
hurryCostModifier:20
},
{
name:"Trebuchet",
unitType:"Siege",

View File

@ -59,7 +59,7 @@ class UnitAutomation{
}
else { // Range attack, so enemy needs to be in range
return attackableTiles.filter { unit.getTile().getTilesInDistance(2).contains(it) }
return attackableTiles.filter { unit.getTile().getTilesInDistance(unit.getBaseUnit().range).contains(it) }
}
}

View File

@ -1,5 +1,6 @@
package com.unciv.models.gamebasics
import com.unciv.UnCivGame
import com.unciv.ui.utils.tr
import java.util.*
@ -16,7 +17,9 @@ class Technology : ICivilopedia {
SB.appendln(impimpString.tr())
}
val enabledUnits = GameBasics.Units.values.filter { it.requiredTech==name }
var enabledUnits = GameBasics.Units.values.filter { it.requiredTech==name && (it.uniqueTo==null || it.uniqueTo==UnCivGame.Current.gameInfo.getPlayerCivilization().civName) }
val replacedUnits = enabledUnits.map { it.replaces }.filterNotNull()
enabledUnits = enabledUnits.filter { it.name !in replacedUnits}
if(enabledUnits.isNotEmpty()) SB.appendln("{Units enabled}: "+enabledUnits.map { it.name + " ("+it.getShortDescription()+")" }.joinToString())
val enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name }

View File

@ -18,6 +18,7 @@ class Unit : INamed, IConstruction, ICivilopedia {
var movement: Int = 0
var strength:Int = 0
var rangedStrength:Int = 0
var range:Int = 2
lateinit var unitType: UnitType
internal var unbuildable: Boolean = false // for special units like great people
var requiredTech:String? = null