mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-05 00:18:13 +07:00
Land melee units can only attack water units once they are able to embark (#6957)
This commit is contained in:
parent
37d6233f5d
commit
57c027dca5
@ -102,6 +102,11 @@ object BattleHelper {
|
|||||||
if (tileCombatant.getCivInfo() == combatant.getCivInfo()) return false
|
if (tileCombatant.getCivInfo() == combatant.getCivInfo()) return false
|
||||||
if (!combatant.getCivInfo().isAtWarWith(tileCombatant.getCivInfo())) return false
|
if (!combatant.getCivInfo().isAtWarWith(tileCombatant.getCivInfo())) return false
|
||||||
|
|
||||||
|
if (combatant is MapUnitCombatant && combatant.isLandUnit() && combatant.isMelee() &&
|
||||||
|
!combatant.hasUnique(UniqueType.LandUnitEmbarkation) && tile.isWater
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
|
||||||
if (combatant is MapUnitCombatant &&
|
if (combatant is MapUnitCombatant &&
|
||||||
combatant.unit.hasUnique(UniqueType.CanOnlyAttackUnits) &&
|
combatant.unit.hasUnique(UniqueType.CanOnlyAttackUnits) &&
|
||||||
combatant.unit.getMatchingUniques(UniqueType.CanOnlyAttackUnits).none { tileCombatant.matchesCategory(it.params[0]) }
|
combatant.unit.getMatchingUniques(UniqueType.CanOnlyAttackUnits).none { tileCombatant.matchesCategory(it.params[0]) }
|
||||||
|
@ -31,6 +31,14 @@ interface ICombatant {
|
|||||||
if (this is CityCombatant) return false
|
if (this is CityCombatant) return false
|
||||||
return (this as MapUnitCombatant).unit.baseUnit.isAirUnit()
|
return (this as MapUnitCombatant).unit.baseUnit.isAirUnit()
|
||||||
}
|
}
|
||||||
|
fun isWaterUnit(): Boolean {
|
||||||
|
if (this is CityCombatant) return false
|
||||||
|
return (this as MapUnitCombatant).unit.baseUnit.isWaterUnit()
|
||||||
|
}
|
||||||
|
fun isLandUnit(): Boolean {
|
||||||
|
if (this is CityCombatant) return false
|
||||||
|
return (this as MapUnitCombatant).unit.baseUnit.isLandUnit()
|
||||||
|
}
|
||||||
fun isCity(): Boolean {
|
fun isCity(): Boolean {
|
||||||
return this is CityCombatant
|
return this is CityCombatant
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user