From 88ac6330dc59a1d0d6f9919d5e4d25bb11a6d47f Mon Sep 17 00:00:00 2001 From: givehub99 <71454921+givehub99@users.noreply.github.com> Date: Fri, 30 Oct 2020 01:01:27 -0700 Subject: [PATCH] -"Unable to capture cities" unique prevents the unit from conquering/capturing a city. (#3309) -Units with "All tiles costs 1" unique now spend all movement points when embarking. Technically, in CIV 5, helicopters do not embark or spend all movement units when moving to water, if embarkation (Optics) isn't researched. IMO, though, it is so unlikely that someone will have helicopters researched but not embarkation, that I don't think it is worth editing the code for this fringe case. --- core/src/com/unciv/logic/battle/Battle.kt | 2 +- core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 0bc6760607..3c41000dbc 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -63,7 +63,7 @@ object Battle { postBattleNationUniques(defender, attackedTile, attacker) // This needs to come BEFORE the move-to-tile, because if we haven't conquered it we can't move there =) - if (defender.isDefeated() && defender is CityCombatant && attacker.isMelee()) + if (defender.isDefeated() && defender is CityCombatant && attacker is MapUnitCombatant && attacker.isMelee() && !attacker.unit.hasUnique("Unable to capture cities")) conquerCity(defender.city, attacker) // we're a melee unit and we destroyed\captured an enemy unit diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index d517f147c5..c5de1253f7 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -8,12 +8,14 @@ class UnitMovementAlgorithms(val unit:MapUnit) { // This function is called ALL THE TIME and should be as time-optimal as possible! fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float { - if (unit.allTilesCosts1) - return 1f if ((from.isLand != to.isLand) && !unit.civInfo.nation.embarkDisembarkCosts1 && unit.type.isLandUnit()) return 100f // this is embarkment or disembarkment, and will take the entire turn + // land units will still spend all movement points to embark even with this unique + if (unit.allTilesCosts1) + return 1f + var extraCost = 0f val toOwner = to.getOwner()