mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-25 07:09:16 +07:00
Units can pass through cities of other friendly civs
This commit is contained in:
@ -303,6 +303,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
if (!canPassThrough(tile))
|
if (!canPassThrough(tile))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
if(tile.isCityCenter() && tile.getOwner()!=unit.civInfo) return false // even if they'll let us pass through, we can't enter their city
|
||||||
|
|
||||||
if (unit.type.isCivilian())
|
if (unit.type.isCivilian())
|
||||||
return tile.civilianUnit == null && (tile.militaryUnit == null || tile.militaryUnit!!.owner == unit.owner)
|
return tile.civilianUnit == null && (tile.militaryUnit == null || tile.militaryUnit!!.owner == unit.owner)
|
||||||
else return tile.militaryUnit == null && (tile.civilianUnit == null || tile.civilianUnit!!.owner == unit.owner)
|
else return tile.militaryUnit == null && (tile.civilianUnit == null || tile.civilianUnit!!.owner == unit.owner)
|
||||||
@ -353,8 +355,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
if (tile.naturalWonder != null) return false
|
if (tile.naturalWonder != null) return false
|
||||||
|
|
||||||
val tileOwner = tile.getOwner()
|
val tileOwner = tile.getOwner()
|
||||||
if (tileOwner != null && tileOwner != unit.civInfo) { // comparing the CivInfo objects is cheaper than comparing strings?
|
if (tileOwner != null && tileOwner != unit.civInfo) { // comparing the CivInfo objects is cheaper than comparing strings
|
||||||
if (tile.isCityCenter() && !tile.getCity()!!.hasJustBeenConquered) return false
|
if (tile.isCityCenter() && unit.civInfo.isAtWarWith(tileOwner)
|
||||||
|
&& !tile.getCity()!!.hasJustBeenConquered) return false
|
||||||
if (!unit.civInfo.canEnterTiles(tileOwner)
|
if (!unit.civInfo.canEnterTiles(tileOwner)
|
||||||
&& !(unit.civInfo.isPlayerCivilization() && tileOwner.isCityState())) return false
|
&& !(unit.civInfo.isPlayerCivilization() && tileOwner.isCityState())) return false
|
||||||
// AIs won't enter city-state's border.
|
// AIs won't enter city-state's border.
|
||||||
|
Reference in New Issue
Block a user