mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Fixed notification when capturing a civilian unit
This commit is contained in:
parent
4c3231a3fe
commit
c27bcb00c4
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 77
|
versionCode 78
|
||||||
versionName "2.4.7"
|
versionName "2.4.8"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -145,7 +145,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
|
|||||||
|
|
||||||
private fun postBattleAction(attacker: ICombatant, defender: ICombatant, attackedTile:TileInfo){
|
private fun postBattleAction(attacker: ICombatant, defender: ICombatant, attackedTile:TileInfo){
|
||||||
|
|
||||||
if (defender.getCivilization().isPlayerCivilization()) {
|
if(attacker.getCivilization()!=defender.getCivilization()) { // If what happened was that a civilian unit was captures, that's dealt with in the CaptureCilvilianUnit function
|
||||||
val whatHappenedString =
|
val whatHappenedString =
|
||||||
if (attacker.isDefeated()) " was destroyed while attacking"
|
if (attacker.isDefeated()) " was destroyed while attacking"
|
||||||
else " has " + (if (defender.isDefeated()) "destroyed" else "attacked")
|
else " has " + (if (defender.isDefeated()) "destroyed" else "attacked")
|
||||||
@ -153,7 +153,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
|
|||||||
if (defender.getUnitType() == UnitType.City) " " + defender.getName()
|
if (defender.getUnitType() == UnitType.City) " " + defender.getName()
|
||||||
else " our " + defender.getName()
|
else " our " + defender.getName()
|
||||||
val notificationString = "An enemy " + attacker.getName() + whatHappenedString + defenderString
|
val notificationString = "An enemy " + attacker.getName() + whatHappenedString + defenderString
|
||||||
gameInfo.getPlayerCivilization().addNotification(notificationString, attackedTile.position, Color.RED)
|
defender.getCivilization().addNotification(notificationString, attackedTile.position, Color.RED)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -224,6 +224,8 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
|
|||||||
fun captureCivilianUnit(attacker: ICombatant, defender: ICombatant){
|
fun captureCivilianUnit(attacker: ICombatant, defender: ICombatant){
|
||||||
if(attacker.getCivilization().isBarbarianCivilization()) defender.takeDamage(100) // barbarians don't capture civilians!
|
if(attacker.getCivilization().isBarbarianCivilization()) defender.takeDamage(100) // barbarians don't capture civilians!
|
||||||
val capturedUnit = (defender as MapUnitCombatant).unit
|
val capturedUnit = (defender as MapUnitCombatant).unit
|
||||||
|
capturedUnit.civInfo.addNotification("Our "+defender.getName()+" was captured by an enemy "+attacker.getName(),
|
||||||
|
defender.getTile().position, Color.RED)
|
||||||
capturedUnit.civInfo = attacker.getCivilization()
|
capturedUnit.civInfo = attacker.getCivilization()
|
||||||
capturedUnit.owner = capturedUnit.civInfo.civName
|
capturedUnit.owner = capturedUnit.civInfo.civName
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user