mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-24 22:59:34 +07:00
Changed "Archery" units to "Ranged" because it will also include machine gun in the future
This commit is contained in:
@ -39,19 +39,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Archer",
|
name:"Archer",
|
||||||
unitType:"Archery",
|
unitType:"Ranged",
|
||||||
movement:2,
|
movement:2,
|
||||||
strength:5,
|
strength:5,
|
||||||
rangedStrength:7,
|
rangedStrength:7,
|
||||||
cost: 40,
|
cost: 40,
|
||||||
hurryCostModifier:20
|
hurryCostModifier:20
|
||||||
requiredTech:"Archery",
|
requiredTech:"Ranged",
|
||||||
obsoleteTech:"Machinery",
|
obsoleteTech:"Machinery",
|
||||||
upgradesTo:"Crossbowman"
|
upgradesTo:"Crossbowman"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Chariot Archer",
|
name:"Chariot Archer",
|
||||||
unitType:"Archery",
|
unitType:"Ranged",
|
||||||
movement:4,
|
movement:4,
|
||||||
strength:6,
|
strength:6,
|
||||||
rangedStrength:10,
|
rangedStrength:10,
|
||||||
@ -114,7 +114,7 @@
|
|||||||
// Medieval Era
|
// Medieval Era
|
||||||
{
|
{
|
||||||
name:"Crossbowman",
|
name:"Crossbowman",
|
||||||
unitType:"Archery",
|
unitType:"Ranged",
|
||||||
movement:2,
|
movement:2,
|
||||||
strength:13,
|
strength:13,
|
||||||
rangedStrength:18,
|
rangedStrength:18,
|
||||||
|
@ -69,8 +69,8 @@ class Automation {
|
|||||||
val combatUnits = city.cityConstructions.getConstructableUnits().filter { it.unitType != UnitType.Civilian }
|
val combatUnits = city.cityConstructions.getConstructableUnits().filter { it.unitType != UnitType.Civilian }
|
||||||
val chosenUnit: Unit
|
val chosenUnit: Unit
|
||||||
if(city.civInfo.cities.any { it.getCenterTile().militaryUnit==null}
|
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
|
&& 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.Archery }.maxBy { it.cost }!!
|
chosenUnit = combatUnits.filter { it.unitType== UnitType.Ranged }.maxBy { it.cost }!!
|
||||||
|
|
||||||
else{ // randomize type of unit and takee the most expensive of its kind
|
else{ // randomize type of unit and takee the most expensive of its kind
|
||||||
val chosenUnitType = combatUnits.map { it.unitType }.distinct().getRandom()
|
val chosenUnitType = combatUnits.map { it.unitType }.distinct().getRandom()
|
||||||
|
@ -19,6 +19,6 @@ interface ICombatant{
|
|||||||
return this.getUnitType() in listOf(UnitType.Melee, UnitType.Mounted)
|
return this.getUnitType() in listOf(UnitType.Melee, UnitType.Mounted)
|
||||||
}
|
}
|
||||||
fun isRanged(): Boolean {
|
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,
|
City,
|
||||||
Civilian,
|
Civilian,
|
||||||
Melee,
|
Melee,
|
||||||
Archery,
|
Ranged,
|
||||||
Mounted,
|
Mounted,
|
||||||
Siege
|
Siege
|
||||||
}
|
}
|
@ -102,7 +102,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
|
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
|
||||||
UnitType.Civilian -> unit.getDistanceToTiles().keys.toList()
|
UnitType.Civilian -> unit.getDistanceToTiles().keys.toList()
|
||||||
UnitType.Melee, UnitType.Mounted -> 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!")
|
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user