Changed "Archery" units to "Ranged" because it will also include machine gun in the future

This commit is contained in:
Yair Morgenstern
2018-06-08 17:44:49 +03:00
parent 4b7ec5303a
commit 0edbaac53d
5 changed files with 9 additions and 9 deletions

View File

@ -39,19 +39,19 @@
},
{
name:"Archer",
unitType:"Archery",
unitType:"Ranged",
movement:2,
strength:5,
rangedStrength:7,
cost: 40,
hurryCostModifier:20
requiredTech:"Archery",
requiredTech:"Ranged",
obsoleteTech:"Machinery",
upgradesTo:"Crossbowman"
},
{
name:"Chariot Archer",
unitType:"Archery",
unitType:"Ranged",
movement:4,
strength:6,
rangedStrength:10,
@ -114,7 +114,7 @@
// Medieval Era
{
name:"Crossbowman",
unitType:"Archery",
unitType:"Ranged",
movement:2,
strength:13,
rangedStrength:18,

View File

@ -69,8 +69,8 @@ class Automation {
val combatUnits = city.cityConstructions.getConstructableUnits().filter { it.unitType != UnitType.Civilian }
val chosenUnit: Unit
if(city.civInfo.cities.any { it.getCenterTile().militaryUnit==null}
&& combatUnits.any { it.unitType== UnitType.Archery }) // this is for city defence so get an archery unit if we can
chosenUnit = combatUnits.filter { it.unitType== UnitType.Archery }.maxBy { it.cost }!!
&& combatUnits.any { it.unitType== UnitType.Ranged }) // this is for city defence so get an archery unit if we can
chosenUnit = combatUnits.filter { it.unitType== UnitType.Ranged }.maxBy { it.cost }!!
else{ // randomize type of unit and takee the most expensive of its kind
val chosenUnitType = combatUnits.map { it.unitType }.distinct().getRandom()

View File

@ -19,6 +19,6 @@ interface ICombatant{
return this.getUnitType() in listOf(UnitType.Melee, UnitType.Mounted)
}
fun isRanged(): Boolean {
return this.getUnitType() in listOf(UnitType.Archery, UnitType.Siege)
return this.getUnitType() in listOf(UnitType.Ranged, UnitType.Siege)
}
}

View File

@ -4,7 +4,7 @@ enum class UnitType{
City,
Civilian,
Melee,
Archery,
Ranged,
Mounted,
Siege
}

View File

@ -102,7 +102,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
UnitType.Civilian -> unit.getDistanceToTiles().keys.toList()
UnitType.Melee, UnitType.Mounted -> unit.getDistanceToTiles().keys.toList()
UnitType.Archery, UnitType.Siege -> unit.getTile().getTilesInDistance(2)
UnitType.Ranged, UnitType.Siege -> unit.getTile().getTilesInDistance(2)
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
}