mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Transported units gifting fix (#9865)
* Gifting units containing transported units now gifts the transported units as well. * Change transported units so that they can't be gifted.
This commit is contained in:
parent
0fe584700b
commit
15bfaa24a5
@ -559,10 +559,9 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
fun gift(recipient: Civilization) {
|
||||
civ.units.removeUnit(this)
|
||||
civ.cache.updateViewableTiles()
|
||||
// all transported units should be destroyed as well
|
||||
// all transported units should be gift as well
|
||||
currentTile.getUnits().filter { it.isTransported && isTransportTypeOf(it) }
|
||||
.toList() // because we're changing the list
|
||||
.forEach { unit -> unit.destroy() }
|
||||
.forEach { unit -> unit.gift(recipient) }
|
||||
assignOwner(recipient)
|
||||
recipient.cache.updateViewableTiles()
|
||||
}
|
||||
|
@ -634,6 +634,9 @@ object UnitActions {
|
||||
// If gifting to major civ they need to be friendly
|
||||
else if (!tile.isFriendlyTerritory(unit.civ)) return null
|
||||
|
||||
// Transported units can't be gifted
|
||||
if (unit.isTransported) return null
|
||||
|
||||
if (unit.currentMovement <= 0)
|
||||
return UnitAction(UnitActionType.GiftUnit, action = null)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user