mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 07:39:44 +07:00
Fix Navies capturing Land Civilians (#6223)
* Correct logic for blocking Naval Melee from capturing Civilians on Land * Even better solution now that we can move on to unguarded Civilian tiles. But still won't let us capture Civilians if we can't get there Co-authored-by: itanasi <spellman23@gmail.com>
This commit is contained in:
@ -39,16 +39,16 @@ object BattleHelper {
|
|||||||
): ArrayList<AttackableTile> {
|
): ArrayList<AttackableTile> {
|
||||||
val tilesWithEnemies = (tilesToCheck ?: unit.civInfo.viewableTiles)
|
val tilesWithEnemies = (tilesToCheck ?: unit.civInfo.viewableTiles)
|
||||||
.filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) }
|
.filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) }
|
||||||
|
// Filter out invalid Civilian Captures
|
||||||
.filterNot {
|
.filterNot {
|
||||||
val mapCombatant = Battle.getMapCombatantOfTile(it)
|
val mapCombatant = Battle.getMapCombatantOfTile(it)
|
||||||
// IF all of these are true, THEN the action we'll be taking is in fact CAPTURING the civilian.
|
// IF all of these are true, THEN the action we'll be taking is in fact CAPTURING the civilian.
|
||||||
unit.baseUnit.isMelee() && mapCombatant is MapUnitCombatant && mapCombatant.unit.isCivilian()
|
unit.baseUnit.isMelee() && mapCombatant is MapUnitCombatant && mapCombatant.unit.isCivilian()
|
||||||
// If we can't pass though that tile, we can't capture the civilian "remotely"
|
// If we can't pass though that tile, we can't capture the civilian "remotely"
|
||||||
// DO NOT use "!unit.movement.canPassThrough(it)" since then we won't be able to
|
// Can use "unit.movement.canPassThrough(it)" now that we can move through
|
||||||
// capture enemy units since we can't move through them!
|
// unguarded Civilian tiles. And this catches Naval trying to capture Land
|
||||||
&& !it.canCivPassThrough(unit.civInfo)
|
// Civilians or Land attacking Water Civilians it can't Embark on
|
||||||
// Land Unit can't capture Naval and vice versa
|
&& !unit.movement.canPassThrough(it)
|
||||||
&& !(unit.type.isLandUnit() && it.isWater || unit.type.isWaterUnit() && it.isLand)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val rangeOfAttack = unit.getRange()
|
val rangeOfAttack = unit.getRange()
|
||||||
|
Reference in New Issue
Block a user