mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 23:58:43 +07:00
Add Damage numbers to Battle Notifications (#7587)
* Initial changes * Adding damage numbers
This commit is contained in:
@ -762,17 +762,29 @@ Your Golden Age has ended. =
|
|||||||
[cityName] has been razed to the ground! =
|
[cityName] has been razed to the ground! =
|
||||||
We have conquered the city of [cityName]! =
|
We have conquered the city of [cityName]! =
|
||||||
An enemy [unit] has attacked [cityName] =
|
An enemy [unit] has attacked [cityName] =
|
||||||
|
An enemy [unit] ([amount]) has attacked [cityName] ([amount2]) =
|
||||||
An enemy [unit] has attacked our [ourUnit] =
|
An enemy [unit] has attacked our [ourUnit] =
|
||||||
|
An enemy [unit] ([amount]) has attacked our [ourUnit] ([amount2]) =
|
||||||
Enemy city [cityName] has attacked our [ourUnit] =
|
Enemy city [cityName] has attacked our [ourUnit] =
|
||||||
|
Enemy city [cityName] ([amount]) has attacked our [ourUnit] ([amount2]) =
|
||||||
An enemy [unit] has captured [cityName] =
|
An enemy [unit] has captured [cityName] =
|
||||||
|
An enemy [unit] ([amount]) has captured [cityName] ([amount2]) =
|
||||||
An enemy [unit] has raided [cityName] =
|
An enemy [unit] has raided [cityName] =
|
||||||
|
An enemy [unit] ([amount]) has raided [cityName] ([amount2]) =
|
||||||
An enemy [unit] has captured our [ourUnit] =
|
An enemy [unit] has captured our [ourUnit] =
|
||||||
|
An enemy [unit] ([amount]) has captured our [ourUnit] ([amount2]) =
|
||||||
An enemy [unit] has destroyed our [ourUnit] =
|
An enemy [unit] has destroyed our [ourUnit] =
|
||||||
|
An enemy [unit] ([amount]) has destroyed our [ourUnit] ([amount2]) =
|
||||||
Your [ourUnit] has destroyed an enemy [unit] =
|
Your [ourUnit] has destroyed an enemy [unit] =
|
||||||
|
Your [ourUnit] ([amount]) has destroyed an enemy [unit] ([amount2]) =
|
||||||
An enemy [RangedUnit] has destroyed the defence of [cityName] =
|
An enemy [RangedUnit] has destroyed the defence of [cityName] =
|
||||||
|
An enemy [RangedUnit] ([amount]) has destroyed the defence of [cityName] ([amount2]) =
|
||||||
Enemy city [cityName] has destroyed our [ourUnit] =
|
Enemy city [cityName] has destroyed our [ourUnit] =
|
||||||
|
Enemy city [cityName] ([amount]) has destroyed our [ourUnit] ([amount2]) =
|
||||||
An enemy [unit] was destroyed while attacking [cityName] =
|
An enemy [unit] was destroyed while attacking [cityName] =
|
||||||
|
An enemy [unit] ([amount]) was destroyed while attacking [cityName] ([amount2]) =
|
||||||
An enemy [unit] was destroyed while attacking our [ourUnit] =
|
An enemy [unit] was destroyed while attacking our [ourUnit] =
|
||||||
|
An enemy [unit] ([amount]) was destroyed while attacking our [ourUnit] ([amount2]) =
|
||||||
Our [attackerName] ([amount]) was destroyed by an intercepting [interceptorName] ([amount2]) =
|
Our [attackerName] ([amount]) was destroyed by an intercepting [interceptorName] ([amount2]) =
|
||||||
Our [attackerName] ([amount]) was destroyed by an unknown interceptor =
|
Our [attackerName] ([amount]) was destroyed by an unknown interceptor =
|
||||||
Our [interceptorName] ([amount]) intercepted and destroyed an enemy [attackerName] ([amount2]) =
|
Our [interceptorName] ([amount]) intercepted and destroyed an enemy [attackerName] ([amount2]) =
|
||||||
|
@ -115,14 +115,14 @@ object Battle {
|
|||||||
|
|
||||||
val isAlreadyDefeatedCity = defender is CityCombatant && defender.isDefeated()
|
val isAlreadyDefeatedCity = defender is CityCombatant && defender.isDefeated()
|
||||||
|
|
||||||
takeDamage(attacker, defender)
|
val damageDealt = takeDamage(attacker, defender)
|
||||||
|
|
||||||
// check if unit is captured by the attacker (prize ships unique)
|
// check if unit is captured by the attacker (prize ships unique)
|
||||||
// As ravignir clarified in issue #4374, this only works for aggressor
|
// As ravignir clarified in issue #4374, this only works for aggressor
|
||||||
val captureMilitaryUnitSuccess = tryCaptureUnit(attacker, defender, attackedTile)
|
val captureMilitaryUnitSuccess = tryCaptureUnit(attacker, defender, attackedTile)
|
||||||
|
|
||||||
if (!captureMilitaryUnitSuccess) // capture creates a new unit, but `defender` still is the original, so this function would still show a kill message
|
if (!captureMilitaryUnitSuccess) // capture creates a new unit, but `defender` still is the original, so this function would still show a kill message
|
||||||
postBattleNotifications(attacker, defender, attackedTile, attacker.getTile())
|
postBattleNotifications(attacker, defender, attackedTile, attacker.getTile(), damageDealt)
|
||||||
|
|
||||||
if (defender.getCivInfo().isBarbarian() && attackedTile.improvement == Constants.barbarianEncampment)
|
if (defender.getCivInfo().isBarbarian() && attackedTile.improvement == Constants.barbarianEncampment)
|
||||||
defender.getCivInfo().gameInfo.barbarians.campAttacked(attackedTile.position)
|
defender.getCivInfo().gameInfo.barbarians.campAttacked(attackedTile.position)
|
||||||
@ -376,7 +376,8 @@ object Battle {
|
|||||||
attacker: ICombatant,
|
attacker: ICombatant,
|
||||||
defender: ICombatant,
|
defender: ICombatant,
|
||||||
attackedTile: TileInfo,
|
attackedTile: TileInfo,
|
||||||
attackerTile: TileInfo? = null
|
attackerTile: TileInfo? = null,
|
||||||
|
damageDealt: DamageDealt? = null
|
||||||
) {
|
) {
|
||||||
if (attacker.getCivInfo() != defender.getCivInfo()) {
|
if (attacker.getCivInfo() != defender.getCivInfo()) {
|
||||||
// If what happened was that a civilian unit was captured, that's dealt with in the captureCivilianUnit function
|
// If what happened was that a civilian unit was captured, that's dealt with in the captureCivilianUnit function
|
||||||
@ -400,7 +401,9 @@ object Battle {
|
|||||||
if (defender.isDefeated() && attacker.isRanged()) " the defence of [" + defender.getName() + "]"
|
if (defender.isDefeated() && attacker.isRanged()) " the defence of [" + defender.getName() + "]"
|
||||||
else " [" + defender.getName() + "]"
|
else " [" + defender.getName() + "]"
|
||||||
else " our [" + defender.getName() + "]"
|
else " our [" + defender.getName() + "]"
|
||||||
val notificationString = attackerString + whatHappenedString + defenderString
|
val attackerDealtString = if (damageDealt != null) " ([${damageDealt.attackerDealt}])" else ""
|
||||||
|
val defenderDealtString = if (damageDealt != null) " ([${damageDealt.defenderDealt}])" else ""
|
||||||
|
val notificationString = attackerString + attackerDealtString + whatHappenedString + defenderString + defenderDealtString
|
||||||
val attackerIcon = if (attacker is CityCombatant) NotificationIcon.City else attacker.getName()
|
val attackerIcon = if (attacker is CityCombatant) NotificationIcon.City else attacker.getName()
|
||||||
val defenderIcon = if (defender is CityCombatant) NotificationIcon.City else defender.getName()
|
val defenderIcon = if (defender is CityCombatant) NotificationIcon.City else defender.getName()
|
||||||
val locations = LocationAction(attackedTile.position, attackerTile?.position)
|
val locations = LocationAction(attackedTile.position, attackerTile?.position)
|
||||||
|
Reference in New Issue
Block a user