mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Extended battle notifications
This commit is contained in:
parent
d515955b30
commit
36131cb7c1
@ -174,7 +174,7 @@ object Battle {
|
|||||||
else " [" + defender.getName() + "]"
|
else " [" + defender.getName() + "]"
|
||||||
else " our [" + defender.getName() + "]"
|
else " our [" + defender.getName() + "]"
|
||||||
val notificationString = attackerString + whatHappenedString + defenderString
|
val notificationString = attackerString + whatHappenedString + defenderString
|
||||||
defender.getCivInfo().addNotification(notificationString, attackedTile.position, NotificationIcon.War)
|
defender.getCivInfo().addNotification(notificationString, attackedTile.position, attacker.getName(), NotificationIcon.War, defender.getName())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ object Battle {
|
|||||||
&& Random().nextDouble() < 0.67) {
|
&& Random().nextDouble() < 0.67) {
|
||||||
attacker.getCivInfo().placeUnitNearTile(attackedTile.position, defender.getName())
|
attacker.getCivInfo().placeUnitNearTile(attackedTile.position, defender.getName())
|
||||||
attacker.getCivInfo().gold += 25
|
attacker.getCivInfo().gold += 25
|
||||||
attacker.getCivInfo().addNotification("A barbarian [${defender.getName()}] has joined us!", attackedTile.position, Color.RED)
|
attacker.getCivInfo().addNotification("A barbarian [${defender.getName()}] has joined us!", attackedTile.position, defender.getName())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similarly, Ottoman unique
|
// Similarly, Ottoman unique
|
||||||
@ -335,7 +335,7 @@ object Battle {
|
|||||||
|
|
||||||
val capturedUnit = defender.unit
|
val capturedUnit = defender.unit
|
||||||
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
||||||
defender.getTile().position, NotificationIcon.War)
|
defender.getTile().position, attacker.getName(), NotificationIcon.War, defender.getName())
|
||||||
|
|
||||||
// Apparently in Civ V, captured settlers are converted to workers.
|
// Apparently in Civ V, captured settlers are converted to workers.
|
||||||
if (capturedUnit.name == Constants.settler) {
|
if (capturedUnit.name == Constants.settler) {
|
||||||
@ -433,17 +433,17 @@ object Battle {
|
|||||||
if (attacker.isDefeated()) {
|
if (attacker.isDefeated()) {
|
||||||
attacker.getCivInfo()
|
attacker.getCivInfo()
|
||||||
.addNotification("Our [$attackerName] was destroyed by an intercepting [$interceptorName]",
|
.addNotification("Our [$attackerName] was destroyed by an intercepting [$interceptorName]",
|
||||||
NotificationIcon.War)
|
attackerName, NotificationIcon.War, interceptorName)
|
||||||
defender.getCivInfo()
|
defender.getCivInfo()
|
||||||
.addNotification("Our [$interceptorName] intercepted and destroyed an enemy [$attackerName]",
|
.addNotification("Our [$interceptorName] intercepted and destroyed an enemy [$attackerName]",
|
||||||
interceptor.currentTile.position, NotificationIcon.War)
|
interceptor.currentTile.position, interceptorName, NotificationIcon.War, attackerName)
|
||||||
} else {
|
} else {
|
||||||
attacker.getCivInfo()
|
attacker.getCivInfo()
|
||||||
.addNotification("Our [$attackerName] was attacked by an intercepting [$interceptorName]",
|
.addNotification("Our [$attackerName] was attacked by an intercepting [$interceptorName]",
|
||||||
NotificationIcon.War)
|
attackerName, NotificationIcon.War, interceptorName)
|
||||||
defender.getCivInfo()
|
defender.getCivInfo()
|
||||||
.addNotification("Our [$interceptorName] intercepted and attacked an enemy [$attackerName]",
|
.addNotification("Our [$interceptorName] intercepted and attacked an enemy [$attackerName]",
|
||||||
interceptor.currentTile.position, NotificationIcon.War)
|
interceptor.currentTile.position, interceptorName, NotificationIcon.War, attackerName)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -497,9 +497,11 @@ object Battle {
|
|||||||
defender.unit.putInTile(toTile)
|
defender.unit.putInTile(toTile)
|
||||||
// and count 1 attack for attacker but leave it in place
|
// and count 1 attack for attacker but leave it in place
|
||||||
reduceAttackerMovementPointsAndAttacks(attacker, defender)
|
reduceAttackerMovementPointsAndAttacks(attacker, defender)
|
||||||
val notificationString = "[" + defendBaseUnit.name + "] withdrew from a [" + attackBaseUnit.name + "]"
|
|
||||||
defender.getCivInfo().addNotification(notificationString, toTile.position, NotificationIcon.War)
|
val attackingUnit = attackBaseUnit.name; val defendingUnit = defendBaseUnit.name
|
||||||
attacker.getCivInfo().addNotification(notificationString, toTile.position, NotificationIcon.War)
|
val notificationString = "[$defendingUnit] withdrew from a [$attackingUnit]"
|
||||||
|
defender.getCivInfo().addNotification(notificationString, toTile.position, defendingUnit, NotificationIcon.War, attackingUnit)
|
||||||
|
attacker.getCivInfo().addNotification(notificationString, toTile.position, defendingUnit, NotificationIcon.War, attackingUnit)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
|
|||||||
val label = notification.text.toLabel(Color.BLACK, 30)
|
val label = notification.text.toLabel(Color.BLACK, 30)
|
||||||
val listItem = Table()
|
val listItem = Table()
|
||||||
|
|
||||||
val iconSize = 20f
|
val iconSize = 30f
|
||||||
if (notification.icons.isNotEmpty()) {
|
if (notification.icons.isNotEmpty()) {
|
||||||
val ruleset = worldScreen.gameInfo.ruleSet
|
val ruleset = worldScreen.gameInfo.ruleSet
|
||||||
for (icon in notification.icons) {
|
for (icon in notification.icons) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user