Fixed a bug where crosshairs are everywhere with the 'attack when embarked' unique (#6507)

This commit is contained in:
Xander Lenstra 2022-04-08 11:26:45 +02:00 committed by GitHub
parent a2a8c0aab5
commit c45885c763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,9 +91,10 @@ object BattleHelper {
}
fun containsAttackableEnemy(tile: TileInfo, combatant: ICombatant): Boolean {
if (combatant is MapUnitCombatant && combatant.unit.isEmbarked()) {
if (combatant is MapUnitCombatant && combatant.unit.isEmbarked() && !combatant.hasUnique(UniqueType.AttackOnSea)) {
// Can't attack water units while embarked, only land
if (tile.isWater || combatant.isRanged()) return combatant.hasUnique(UniqueType.AttackOnSea)
if (tile.isWater || combatant.isRanged())
return false
}
val tileCombatant = Battle.getMapCombatantOfTile(tile) ?: return false