mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Battle table now displays "Captured" when attacking a city with no resistance
This commit is contained in:
parent
c27bcb00c4
commit
a380f7aa95
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 78
|
versionCode 80
|
||||||
versionName "2.4.8"
|
versionName "2.4.10"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -163,8 +163,10 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
|
|||||||
conquerCity((defender as CityCombatant).city, attacker)
|
conquerCity((defender as CityCombatant).city, attacker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we're a melee unit and we destroyed\captured an enemy unit
|
||||||
else if (attacker.isMelee() && (defender.isDefeated() || defender.getCivilization()==attacker.getCivilization() )) {
|
else if (attacker.isMelee() && (defender.isDefeated() || defender.getCivilization()==attacker.getCivilization() )) {
|
||||||
if(attackedTile.civilianUnit!=null)
|
// we destroyed an enemy military unit and there was a civilian unit in the same tile as well
|
||||||
|
if(attackedTile.civilianUnit!=null && attackedTile.civilianUnit!!.civInfo != attacker.getCivilization())
|
||||||
captureCivilianUnit(attacker,MapUnitCombatant(attackedTile.civilianUnit!!))
|
captureCivilianUnit(attacker,MapUnitCombatant(attackedTile.civilianUnit!!))
|
||||||
(attacker as MapUnitCombatant).unit.moveToTile(attackedTile)
|
(attacker as MapUnitCombatant).unit.moveToTile(attackedTile)
|
||||||
}
|
}
|
||||||
@ -222,7 +224,10 @@ 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)
|
||||||
|
return
|
||||||
|
} // 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(),
|
capturedUnit.civInfo.addNotification("Our "+defender.getName()+" was captured by an enemy "+attacker.getName(),
|
||||||
defender.getTile().position, Color.RED)
|
defender.getTile().position, Color.RED)
|
||||||
|
@ -113,6 +113,7 @@ class MapUnit {
|
|||||||
|
|
||||||
fun startTurn(){
|
fun startTurn(){
|
||||||
currentMovement = maxMovement.toFloat()
|
currentMovement = maxMovement.toFloat()
|
||||||
|
attacksThisTurn=0
|
||||||
doPreTurnAction()
|
doPreTurnAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
|||||||
else if (damageToDefender>defender.getHealth()) damageToDefender=defender.getHealth()
|
else if (damageToDefender>defender.getHealth()) damageToDefender=defender.getHealth()
|
||||||
|
|
||||||
|
|
||||||
if(attacker.isMelee() && defender.getUnitType()==UnitType.Civilian) {
|
if(attacker.isMelee() && (defender.getUnitType()==UnitType.Civilian || defender.getUnitType()==UnitType.City && defender.isDefeated())) {
|
||||||
add("")
|
add("")
|
||||||
add("Captured!")
|
add("Captured!")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user