mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-19 20:28:56 +07:00
Changed "Archery" units to "Ranged" because it will also include machine gun in the future
This commit is contained in:
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ enum class UnitType{
|
||||
City,
|
||||
Civilian,
|
||||
Melee,
|
||||
Archery,
|
||||
Ranged,
|
||||
Mounted,
|
||||
Siege
|
||||
}
|
@ -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!")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user