mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
Can now see when city contains air units
This commit is contained in:
parent
c01c9b96bf
commit
185ec10f10
@ -447,6 +447,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
|
||||
* [Viking Hat](https://thenounproject.com/search/?q=pillage&i=185405) By my name is mud for pillaging improvements
|
||||
* [Aim](https://thenounproject.com/search/?q=aim&i=2034920) By Kaviashri for ranged strength
|
||||
* [Capitol](https://thenounproject.com/search/?q=capitol&i=160031) By Loren Klein, US for city states
|
||||
* [Aircraft](https://thenounproject.com/search/?q=aircraft&i=1629000) By Tom Fricker
|
||||
|
||||
# Sound credits
|
||||
|
||||
|
BIN
android/Images/OtherIcons/Aircraft.png
Normal file
BIN
android/Images/OtherIcons/Aircraft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1014 KiB After Width: | Height: | Size: 997 KiB |
@ -833,11 +833,21 @@
|
||||
strength:34,
|
||||
cost: 225,
|
||||
requiredTech:"Rifling",
|
||||
obsoleteTech:"Replaceable Parts", //Should be Replaceable Parts
|
||||
obsoleteTech:"Replaceable Parts",
|
||||
upgradesTo:"Great War Infantry",
|
||||
hurryCostModifier:20,
|
||||
attackSound:"shot"
|
||||
},
|
||||
{
|
||||
name:"Triplane",
|
||||
unitType:"AirFighter",
|
||||
movement:1,
|
||||
strength:34,
|
||||
cost: 225,
|
||||
requiredTech:"Flight",
|
||||
hurryCostModifier:20,
|
||||
attackSound:"shot"
|
||||
},
|
||||
/*
|
||||
{
|
||||
name:"Norvegian Ski Infantry",
|
||||
|
@ -201,6 +201,9 @@ class MapUnit {
|
||||
* DOES NOT designate whether we can reach that tile in the current turn
|
||||
*/
|
||||
fun canMoveTo(tile: TileInfo): Boolean {
|
||||
if(type.isAirUnit())
|
||||
return tile.airUnits.size<6 && tile.isCityCenter() && tile.getCity()?.civInfo==civInfo
|
||||
|
||||
if(!canPassThrough(tile)) return false
|
||||
|
||||
if (type.isCivilian())
|
||||
@ -410,15 +413,24 @@ class MapUnit {
|
||||
|
||||
fun moveToTile(otherTile: TileInfo) {
|
||||
if(otherTile==getTile()) return // already here!
|
||||
val distanceToTiles = getDistanceToTiles()
|
||||
|
||||
class YouCantGetThereFromHereException(msg: String) : Exception(msg)
|
||||
if (!distanceToTiles.containsKey(otherTile))
|
||||
throw YouCantGetThereFromHereException("$this can't get from ${currentTile.position} to ${otherTile.position}.")
|
||||
|
||||
class CantEnterThisTileException(msg: String) : Exception(msg)
|
||||
if(!canMoveTo(otherTile))
|
||||
throw CantEnterThisTileException("$this can't enter $otherTile")
|
||||
|
||||
if(type.isAirUnit()){ // they move differently from all other units
|
||||
action=null
|
||||
removeFromTile()
|
||||
putInTile(otherTile)
|
||||
currentMovement=0f
|
||||
return
|
||||
}
|
||||
|
||||
val distanceToTiles = getDistanceToTiles()
|
||||
class YouCantGetThereFromHereException(msg: String) : Exception(msg)
|
||||
if (!distanceToTiles.containsKey(otherTile))
|
||||
throw YouCantGetThereFromHereException("$this can't get from ${currentTile.position} to ${otherTile.position}.")
|
||||
|
||||
if(otherTile.isCityCenter() && otherTile.getOwner()!=civInfo)
|
||||
throw Exception("This is an enemy city, you can't go here!")
|
||||
|
||||
@ -453,15 +465,20 @@ class MapUnit {
|
||||
}
|
||||
|
||||
fun removeFromTile(){
|
||||
if (type.isCivilian()) getTile().civilianUnit=null
|
||||
else getTile().militaryUnit=null
|
||||
when {
|
||||
type.isAirUnit() -> currentTile.airUnits.remove(this)
|
||||
type.isCivilian() -> getTile().civilianUnit=null
|
||||
else -> getTile().militaryUnit=null
|
||||
}
|
||||
}
|
||||
|
||||
fun putInTile(tile:TileInfo){
|
||||
if(!canMoveTo(tile)) throw Exception("I can't go there!")
|
||||
if(type.isCivilian())
|
||||
tile.civilianUnit=this
|
||||
else tile.militaryUnit=this
|
||||
when {
|
||||
!canMoveTo(tile) -> throw Exception("I can't go there!")
|
||||
type.isAirUnit() -> tile.airUnits.add(this)
|
||||
type.isCivilian() -> tile.civilianUnit=this
|
||||
else -> tile.militaryUnit=this
|
||||
}
|
||||
currentTile = tile
|
||||
if(tile.improvement==Constants.ancientRuins && civInfo.isMajorCiv())
|
||||
getAncientRuinBonus()
|
||||
|
@ -23,6 +23,7 @@ open class TileInfo {
|
||||
|
||||
var militaryUnit:MapUnit?=null
|
||||
var civilianUnit:MapUnit?=null
|
||||
var airUnits=ArrayList<MapUnit>()
|
||||
|
||||
var position: Vector2 = Vector2.Zero
|
||||
lateinit var baseTerrain: String
|
||||
|
@ -28,6 +28,8 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
|
||||
|
||||
setButtonActions()
|
||||
|
||||
addAirUnitTable()
|
||||
|
||||
if (isCityViewable && city.health < city.getMaxHealth().toFloat()) {
|
||||
val healthBar = ImageGetter.getHealthBar(city.health.toFloat(), city.getMaxHealth().toFloat(), 100f)
|
||||
add(healthBar).row()
|
||||
@ -41,6 +43,20 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
|
||||
centerX(tileGroup)
|
||||
}
|
||||
|
||||
private fun addAirUnitTable() {
|
||||
if (!tileGroup.tileInfo.airUnits.isNotEmpty()) return
|
||||
val secondarycolor = city.civInfo.getNation().getSecondaryColor()
|
||||
val airUnitTable = Table().apply { defaults().pad(5f) }
|
||||
airUnitTable.background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
||||
.tint(city.civInfo.getNation().getColor())
|
||||
val aircraftImage = ImageGetter.getImage("OtherIcons/Aircraft")
|
||||
aircraftImage.color = secondarycolor
|
||||
airUnitTable.add(aircraftImage).size(15f)
|
||||
airUnitTable.add(tileGroup.tileInfo.airUnits.size.toString().toLabel()
|
||||
.setFontColor(secondarycolor).setFontSize(15))
|
||||
add(airUnitTable).row()
|
||||
}
|
||||
|
||||
private fun setButtonActions() {
|
||||
|
||||
val unitTable = tileGroup.worldScreen.bottomBar.unitTable
|
||||
|
@ -10,9 +10,11 @@ class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
|
||||
TexturePacker.Settings settings = new TexturePacker.Settings();
|
||||
settings.maxWidth = 2048;
|
||||
settings.maxHeight = 2048;
|
||||
settings.maxWidth = 2500;
|
||||
settings.maxHeight = 2500;
|
||||
settings.combineSubdirectories=true;
|
||||
settings.pot=false;
|
||||
settings.fast=true;
|
||||
|
||||
// This is so they don't look all pixelated
|
||||
settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
||||
|
Loading…
x
Reference in New Issue
Block a user