mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Bombard notification (#5637)
* add notification when able to bombard * harmonize with enemy unit notification * use city.range
This commit is contained in:
parent
25cad3aef2
commit
010931ca42
BIN
android/Images/OtherIcons/CrosshairB.png
Normal file
BIN
android/Images/OtherIcons/CrosshairB.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
@ -579,6 +579,8 @@ Our [attackerName] was attacked by an intercepting [interceptorName] =
|
||||
Our [interceptorName] intercepted and attacked an enemy [attackerName] =
|
||||
An enemy [unit] was spotted near our territory =
|
||||
An enemy [unit] was spotted in our territory =
|
||||
Your city [cityName] can bombard the enemy! =
|
||||
[amount] of your cities can bombard the enemy! =
|
||||
[amount] enemy units were spotted near our territory =
|
||||
[amount] enemy units were spotted in our territory =
|
||||
A(n) [nukeType] exploded in our territory! =
|
||||
|
@ -279,6 +279,12 @@ class GameInfo {
|
||||
enemyUnitsCloseToTerritory.filter { it.getOwner() != thisPlayer },
|
||||
"near"
|
||||
)
|
||||
|
||||
addBombardNotification(thisPlayer,
|
||||
thisPlayer.cities.filter { city -> city.canBombard() &&
|
||||
enemyUnitsCloseToTerritory.any { tile -> tile.aerialDistanceTo(city.getCenterTile()) <= city.range }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun addEnemyUnitNotification(thisPlayer: CivilizationInfo, tiles: List<TileInfo>, inOrNear: String) {
|
||||
@ -294,6 +300,15 @@ class GameInfo {
|
||||
}
|
||||
}
|
||||
|
||||
private fun addBombardNotification(thisPlayer: CivilizationInfo, cities: List<CityInfo>) {
|
||||
if (cities.count() < 3) {
|
||||
for (city in cities)
|
||||
thisPlayer.addNotification("Your city [${city.name}] can bombard the enemy!", city.location, NotificationIcon.City, NotificationIcon.Crosshair)
|
||||
|
||||
} else
|
||||
thisPlayer.addNotification("[${cities.count()}] of your cities can bombard the enemy!", LocationAction(cities.map { it.location }), NotificationIcon.City, NotificationIcon.Crosshair)
|
||||
}
|
||||
|
||||
fun notifyExploredResources(civInfo: CivilizationInfo, resourceName: String, maxDistance: Int, showForeign: Boolean) {
|
||||
// Calling with `maxDistance = 0` removes distance limitation.
|
||||
data class CityTileAndDistance(val city: CityInfo, val tile: TileInfo, val distance: Int)
|
||||
|
@ -28,6 +28,7 @@ object NotificationIcon {
|
||||
const val Production = "StatIcons/Production"
|
||||
const val Food = "StatIcons/Food"
|
||||
const val Faith = "StatIcons/Faith"
|
||||
const val Crosshair = "OtherIcons/CrosshairB"
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user