mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Solved bug that made civilian units uncapturable
This commit is contained in:
parent
31639aac9f
commit
0088ddd18b
@ -39,11 +39,14 @@ object BattleHelper {
|
|||||||
): ArrayList<AttackableTile> {
|
): ArrayList<AttackableTile> {
|
||||||
val tilesWithEnemies = (tilesToCheck ?: unit.civInfo.viewableTiles)
|
val tilesWithEnemies = (tilesToCheck ?: unit.civInfo.viewableTiles)
|
||||||
.filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) }
|
.filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) }
|
||||||
.filterNot { val mapCombatant = Battle.getMapCombatantOfTile(it)
|
.filterNot {
|
||||||
|
val mapCombatant = Battle.getMapCombatantOfTile(it)
|
||||||
// IF all of these are true, THEN the action we'll be taking is in fact CAPTURING the civilian.
|
// IF all of these are true, THEN the action we'll be taking is in fact CAPTURING the civilian.
|
||||||
unit.baseUnit.isMelee() && mapCombatant is MapUnitCombatant && mapCombatant.unit.isCivilian()
|
unit.baseUnit.isMelee() && mapCombatant is MapUnitCombatant && mapCombatant.unit.isCivilian()
|
||||||
// If we can't pass though that tile, we can't capture the civilian "remotely"
|
// If we can't pass though that tile, we can't capture the civilian "remotely"
|
||||||
&& !unit.movement.canPassThrough(it)
|
// DO NOT use "!unit.movement.canPassThrough(it)" since then we won't be able to
|
||||||
|
// capture enemy units since we can't move through them!
|
||||||
|
&& !it.canCivPassThrough(unit.civInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
val rangeOfAttack = unit.getRange()
|
val rangeOfAttack = unit.getRange()
|
||||||
|
@ -48,7 +48,7 @@ object UnitActions {
|
|||||||
|
|
||||||
addSleepActions(actionList, unit, false)
|
addSleepActions(actionList, unit, false)
|
||||||
addFortifyActions(actionList, unit, false)
|
addFortifyActions(actionList, unit, false)
|
||||||
|
|
||||||
addPromoteAction(unit, actionList)
|
addPromoteAction(unit, actionList)
|
||||||
addUnitUpgradeAction(unit, actionList)
|
addUnitUpgradeAction(unit, actionList)
|
||||||
addPillageAction(unit, actionList, worldScreen)
|
addPillageAction(unit, actionList, worldScreen)
|
||||||
@ -63,7 +63,7 @@ object UnitActions {
|
|||||||
actionList += getImprovementConstructionActions(unit, tile)
|
actionList += getImprovementConstructionActions(unit, tile)
|
||||||
addActionsWithLimitedUses(unit, actionList, tile)
|
addActionsWithLimitedUses(unit, actionList, tile)
|
||||||
|
|
||||||
|
|
||||||
addToggleActionsAction(unit, actionList, unitTable)
|
addToggleActionsAction(unit, actionList, unitTable)
|
||||||
|
|
||||||
return actionList
|
return actionList
|
||||||
@ -285,8 +285,8 @@ object UnitActions {
|
|||||||
tile.improvement = null
|
tile.improvement = null
|
||||||
if (tile.resource != null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
|
if (tile.resource != null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
|
||||||
|
|
||||||
val freePillage = unit.hasUnique("No movement cost to pillage")
|
val freePillage = unit.hasUnique("No movement cost to pillage")
|
||||||
|| unit.civInfo.hasUnique("No movement cost to pillage")
|
|| unit.civInfo.hasUnique("No movement cost to pillage")
|
||||||
|| (unit.baseUnit.isMelee() && unit.civInfo.hasUnique("Melee units pay no movement cost to pillage"))
|
|| (unit.baseUnit.isMelee() && unit.civInfo.hasUnique("Melee units pay no movement cost to pillage"))
|
||||||
if (!freePillage) unit.useMovementPoints(1f)
|
if (!freePillage) unit.useMovementPoints(1f)
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ object UnitActions {
|
|||||||
val tile = unit.currentTile
|
val tile = unit.currentTile
|
||||||
if (unit.baseUnit().upgradesTo == null || !unit.canUpgrade()) return null
|
if (unit.baseUnit().upgradesTo == null || !unit.canUpgrade()) return null
|
||||||
if (tile.getOwner() != unit.civInfo && !isFree) return null
|
if (tile.getOwner() != unit.civInfo && !isFree) return null
|
||||||
val goldCostOfUpgrade =
|
val goldCostOfUpgrade =
|
||||||
if (isFree) 0
|
if (isFree) 0
|
||||||
else unit.getCostOfUpgrade()
|
else unit.getCostOfUpgrade()
|
||||||
val upgradedUnit = unit.getUnitToUpgradeTo()
|
val upgradedUnit = unit.getUnitToUpgradeTo()
|
||||||
@ -345,7 +345,7 @@ object UnitActions {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAncientRuinsUpgradeAction(unit: MapUnit): UnitAction? {
|
fun getAncientRuinsUpgradeAction(unit: MapUnit): UnitAction? {
|
||||||
val upgradedUnitName =
|
val upgradedUnitName =
|
||||||
when {
|
when {
|
||||||
@ -353,12 +353,12 @@ object UnitActions {
|
|||||||
unit.baseUnit.upgradesTo != null -> unit.baseUnit.upgradesTo
|
unit.baseUnit.upgradesTo != null -> unit.baseUnit.upgradesTo
|
||||||
else -> return null
|
else -> return null
|
||||||
}
|
}
|
||||||
val upgradedUnit =
|
val upgradedUnit =
|
||||||
unit.civInfo.getEquivalentUnit(
|
unit.civInfo.getEquivalentUnit(
|
||||||
unit.civInfo.gameInfo.ruleSet.units[upgradedUnitName]!!
|
unit.civInfo.gameInfo.ruleSet.units[upgradedUnitName]!!
|
||||||
)
|
)
|
||||||
if (!unit.canUpgrade(upgradedUnit,true)) return null
|
if (!unit.canUpgrade(upgradedUnit,true)) return null
|
||||||
|
|
||||||
return UnitAction(UnitActionType.Upgrade,
|
return UnitAction(UnitActionType.Upgrade,
|
||||||
title = "Upgrade to [${upgradedUnit.name}] (free)",
|
title = "Upgrade to [${upgradedUnit.name}] (free)",
|
||||||
action = {
|
action = {
|
||||||
@ -366,7 +366,7 @@ object UnitActions {
|
|||||||
unit.destroy()
|
unit.destroy()
|
||||||
val newUnit = unit.civInfo.placeUnitNearTile(unitTile.position, upgradedUnit.name)!!
|
val newUnit = unit.civInfo.placeUnitNearTile(unitTile.position, upgradedUnit.name)!!
|
||||||
unit.copyStatisticsTo(newUnit)
|
unit.copyStatisticsTo(newUnit)
|
||||||
|
|
||||||
newUnit.currentMovement = 0f
|
newUnit.currentMovement = 0f
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -428,7 +428,7 @@ object UnitActions {
|
|||||||
val canHurryWonder =
|
val canHurryWonder =
|
||||||
if (!tile.isCityCenter()) false
|
if (!tile.isCityCenter()) false
|
||||||
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
||||||
|
|
||||||
|
|
||||||
actionList += UnitAction(UnitActionType.HurryWonder,
|
actionList += UnitAction(UnitActionType.HurryWonder,
|
||||||
action = {
|
action = {
|
||||||
@ -437,21 +437,21 @@ object UnitActions {
|
|||||||
addProductionPoints(((300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt())
|
addProductionPoints(((300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt())
|
||||||
constructIfEnough()
|
constructIfEnough()
|
||||||
}
|
}
|
||||||
|
|
||||||
addStatsPerGreatPersonUsage(unit)
|
addStatsPerGreatPersonUsage(unit)
|
||||||
unit.destroy()
|
unit.destroy()
|
||||||
}.takeIf { canHurryWonder }
|
}.takeIf { canHurryWonder }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
"Can speed up construction of a building" -> {
|
"Can speed up construction of a building" -> {
|
||||||
if (!tile.isCityCenter()) {
|
if (!tile.isCityCenter()) {
|
||||||
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
val canHurryConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction() is Building
|
val canHurryConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction() is Building
|
||||||
|
|
||||||
val cityConstructions = tile.getCity()!!.cityConstructions
|
val cityConstructions = tile.getCity()!!.cityConstructions
|
||||||
|
|
||||||
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
||||||
@ -459,15 +459,15 @@ object UnitActions {
|
|||||||
(300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier,
|
(300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier,
|
||||||
cityConstructions.getRemainingWork(cityConstructions.currentConstructionFromQueue).toFloat() - 1
|
cityConstructions.getRemainingWork(cityConstructions.currentConstructionFromQueue).toFloat() - 1
|
||||||
).toInt()
|
).toInt()
|
||||||
|
|
||||||
actionList += UnitAction(UnitActionType.HurryBuilding,
|
actionList += UnitAction(UnitActionType.HurryBuilding,
|
||||||
title = "Hurry Construction (+[$productionPointsToAdd]⚙)",
|
title = "Hurry Construction (+[$productionPointsToAdd]⚙)",
|
||||||
action = {
|
action = {
|
||||||
cityConstructions.apply {
|
cityConstructions.apply {
|
||||||
addProductionPoints(productionPointsToAdd)
|
addProductionPoints(productionPointsToAdd)
|
||||||
constructIfEnough()
|
constructIfEnough()
|
||||||
}
|
}
|
||||||
|
|
||||||
addStatsPerGreatPersonUsage(unit)
|
addStatsPerGreatPersonUsage(unit)
|
||||||
unit.destroy()
|
unit.destroy()
|
||||||
}.takeIf { canHurryConstruction }
|
}.takeIf { canHurryConstruction }
|
||||||
@ -502,7 +502,7 @@ object UnitActions {
|
|||||||
action = getFoundReligionAction(unit).takeIf { unit.civInfo.religionManager.mayFoundReligionNow(unit) }
|
action = getFoundReligionAction(unit).takeIf { unit.civInfo.religionManager.mayFoundReligionNow(unit) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFoundReligionAction(unit: MapUnit): () -> Unit {
|
fun getFoundReligionAction(unit: MapUnit): () -> Unit {
|
||||||
return {
|
return {
|
||||||
addStatsPerGreatPersonUsage(unit)
|
addStatsPerGreatPersonUsage(unit)
|
||||||
@ -519,7 +519,7 @@ object UnitActions {
|
|||||||
action = getEnhanceReligionAction(unit).takeIf { unit.civInfo.religionManager.mayEnhanceReligionNow(unit) }
|
action = getEnhanceReligionAction(unit).takeIf { unit.civInfo.religionManager.mayEnhanceReligionNow(unit) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEnhanceReligionAction(unit: MapUnit): () -> Unit {
|
fun getEnhanceReligionAction(unit: MapUnit): () -> Unit {
|
||||||
return {
|
return {
|
||||||
addStatsPerGreatPersonUsage(unit)
|
addStatsPerGreatPersonUsage(unit)
|
||||||
@ -542,7 +542,7 @@ object UnitActions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun useActionWithLimitedUses(unit: MapUnit, action: String) {
|
private fun useActionWithLimitedUses(unit: MapUnit, action: String) {
|
||||||
unit.abilityUsesLeft[action] = unit.abilityUsesLeft[action]!! - 1
|
unit.abilityUsesLeft[action] = unit.abilityUsesLeft[action]!! - 1
|
||||||
if (unit.abilityUsesLeft[action]!! <= 0) {
|
if (unit.abilityUsesLeft[action]!! <= 0) {
|
||||||
@ -573,10 +573,10 @@ object UnitActions {
|
|||||||
city.religion.removeAllPressuresExceptFor(unit.religion!!)
|
city.religion.removeAllPressuresExceptFor(unit.religion!!)
|
||||||
unit.currentMovement = 0f
|
unit.currentMovement = 0f
|
||||||
useActionWithLimitedUses(unit, Constants.spreadReligionAbilityCount)
|
useActionWithLimitedUses(unit, Constants.spreadReligionAbilityCount)
|
||||||
}.takeIf { unit.currentMovement > 0 && !blockedByInquisitor }
|
}.takeIf { unit.currentMovement > 0 && !blockedByInquisitor }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addRemoveHeresyActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) {
|
private fun addRemoveHeresyActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) {
|
||||||
if (!unit.civInfo.gameInfo.isReligionEnabled()) return
|
if (!unit.civInfo.gameInfo.isReligionEnabled()) return
|
||||||
if (city.civInfo != unit.civInfo) return
|
if (city.civInfo != unit.civInfo) return
|
||||||
@ -599,18 +599,18 @@ object UnitActions {
|
|||||||
if (unit.religiousActionsUnitCanDo().all { unit.abilityUsesLeft[it] == unit.maxAbilityUses[it] })
|
if (unit.religiousActionsUnitCanDo().all { unit.abilityUsesLeft[it] == unit.maxAbilityUses[it] })
|
||||||
uniquesToCheck += unit.getMatchingUniques("Can construct [] if it hasn't used other actions yet")
|
uniquesToCheck += unit.getMatchingUniques("Can construct [] if it hasn't used other actions yet")
|
||||||
val civResources = unit.civInfo.getCivResourcesByName()
|
val civResources = unit.civInfo.getCivResourcesByName()
|
||||||
|
|
||||||
for (unique in uniquesToCheck) {
|
for (unique in uniquesToCheck) {
|
||||||
val improvementName = unique.params[0]
|
val improvementName = unique.params[0]
|
||||||
val improvement = tile.ruleset.tileImprovements[improvementName]
|
val improvement = tile.ruleset.tileImprovements[improvementName]
|
||||||
?: continue
|
?: continue
|
||||||
|
|
||||||
var resourcesAvailable = true
|
var resourcesAvailable = true
|
||||||
if (improvement.uniqueObjects.any {
|
if (improvement.uniqueObjects.any {
|
||||||
it.isOfType(UniqueType.ConsumesResources) && civResources[unique.params[1]] ?: 0 < unique.params[0].toInt()
|
it.isOfType(UniqueType.ConsumesResources) && civResources[unique.params[1]] ?: 0 < unique.params[0].toInt()
|
||||||
})
|
})
|
||||||
resourcesAvailable = false
|
resourcesAvailable = false
|
||||||
|
|
||||||
finalActions += UnitAction(UnitActionType.Create,
|
finalActions += UnitAction(UnitActionType.Create,
|
||||||
title = "Create [$improvementName]",
|
title = "Create [$improvementName]",
|
||||||
action = {
|
action = {
|
||||||
@ -630,8 +630,8 @@ object UnitActions {
|
|||||||
addStatsPerGreatPersonUsage(unit)
|
addStatsPerGreatPersonUsage(unit)
|
||||||
unit.destroy()
|
unit.destroy()
|
||||||
}.takeIf {
|
}.takeIf {
|
||||||
resourcesAvailable
|
resourcesAvailable
|
||||||
&& unit.currentMovement > 0f
|
&& unit.currentMovement > 0f
|
||||||
&& tile.canBuildImprovement(improvement, unit.civInfo)
|
&& tile.canBuildImprovement(improvement, unit.civInfo)
|
||||||
&& !tile.isImpassible() // Not 100% sure that this check is necessary...
|
&& !tile.isImpassible() // Not 100% sure that this check is necessary...
|
||||||
})
|
})
|
||||||
@ -685,9 +685,9 @@ object UnitActions {
|
|||||||
|
|
||||||
fun addStatsPerGreatPersonUsage(unit: MapUnit) {
|
fun addStatsPerGreatPersonUsage(unit: MapUnit) {
|
||||||
if (!unit.isGreatPerson()) return
|
if (!unit.isGreatPerson()) return
|
||||||
|
|
||||||
val civInfo = unit.civInfo
|
val civInfo = unit.civInfo
|
||||||
|
|
||||||
val gainedStats = Stats()
|
val gainedStats = Stats()
|
||||||
for (unique in civInfo.getMatchingUniques("Provides a sum of gold each time you spend a Great Person")) {
|
for (unique in civInfo.getMatchingUniques("Provides a sum of gold each time you spend a Great Person")) {
|
||||||
gainedStats.gold += (100 * civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
gainedStats.gold += (100 * civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
||||||
@ -695,9 +695,9 @@ object UnitActions {
|
|||||||
for (unique in civInfo.getMatchingUniques("[] whenever a Great Person is expended")) {
|
for (unique in civInfo.getMatchingUniques("[] whenever a Great Person is expended")) {
|
||||||
gainedStats.add(unique.stats)
|
gainedStats.add(unique.stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gainedStats.isEmpty()) return
|
if (gainedStats.isEmpty()) return
|
||||||
|
|
||||||
for (stat in gainedStats)
|
for (stat in gainedStats)
|
||||||
civInfo.addStat(stat.key, stat.value.toInt())
|
civInfo.addStat(stat.key, stat.value.toInt())
|
||||||
civInfo.addNotification("By expending your [${unit.name}] you gained [${gainedStats}]!", unit.getTile().position, unit.name)
|
civInfo.addNotification("By expending your [${unit.name}] you gained [${gainedStats}]!", unit.getTile().position, unit.name)
|
||||||
@ -723,36 +723,27 @@ object UnitActions {
|
|||||||
|
|
||||||
if (isDamaged && !showingAdditionalActions && unit.rankTileForHealing(unit.currentTile) != 0)
|
if (isDamaged && !showingAdditionalActions && unit.rankTileForHealing(unit.currentTile) != 0)
|
||||||
actionList += UnitAction(UnitActionType.FortifyUntilHealed,
|
actionList += UnitAction(UnitActionType.FortifyUntilHealed,
|
||||||
action = {
|
action = { unit.fortifyUntilHealed() }.takeIf { !unit.isFortifyingUntilHealed() })
|
||||||
unit.fortifyUntilHealed()
|
|
||||||
}.takeIf { !unit.isFortifyingUntilHealed() }
|
|
||||||
)
|
|
||||||
else if (isDamaged || !showingAdditionalActions)
|
else if (isDamaged || !showingAdditionalActions)
|
||||||
actionList += UnitAction(UnitActionType.Fortify,
|
actionList += UnitAction(UnitActionType.Fortify,
|
||||||
action = {
|
action = { unit.fortify() }.takeIf { !isFortified })
|
||||||
unit.fortify()
|
|
||||||
}.takeIf { !isFortified }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addSleepActions(actionList: ArrayList<UnitAction>, unit: MapUnit, showingAdditionalActions: Boolean) {
|
private fun addSleepActions(actionList: ArrayList<UnitAction>, unit: MapUnit, showingAdditionalActions: Boolean) {
|
||||||
if (unit.isFortified() || unit.canFortify() || unit.currentMovement == 0f) return
|
if (unit.isFortified() || unit.canFortify() || unit.currentMovement == 0f) return
|
||||||
// If this unit is working on an improvement, it cannot sleep
|
// If this unit is working on an improvement, it cannot sleep
|
||||||
if ((unit.currentTile.hasImprovementInProgress() && unit.canBuildImprovement(unit.currentTile.getTileImprovementInProgress()!!))) return
|
if (unit.currentTile.hasImprovementInProgress() && unit.canBuildImprovement(unit.currentTile.getTileImprovementInProgress()!!)) return
|
||||||
val isSleeping = unit.isSleeping()
|
val isSleeping = unit.isSleeping()
|
||||||
val isDamaged = unit.health < 100
|
val isDamaged = unit.health < 100
|
||||||
|
|
||||||
if (isDamaged && !showingAdditionalActions) {
|
if (isDamaged && !showingAdditionalActions) {
|
||||||
actionList += UnitAction(UnitActionType.SleepUntilHealed,
|
actionList += UnitAction(UnitActionType.SleepUntilHealed,
|
||||||
action = {
|
action = { unit.action = UnitActionType.SleepUntilHealed.value }
|
||||||
unit.action = UnitActionType.SleepUntilHealed.value
|
.takeIf { !unit.isSleepingUntilHealed() }
|
||||||
}.takeIf { !unit.isSleepingUntilHealed() }
|
|
||||||
)
|
)
|
||||||
} else if (isDamaged || !showingAdditionalActions) {
|
} else if (isDamaged || !showingAdditionalActions) {
|
||||||
actionList += UnitAction(UnitActionType.Sleep,
|
actionList += UnitAction(UnitActionType.Sleep,
|
||||||
action = {
|
action = { unit.action = UnitActionType.Sleep.value }.takeIf { !isSleeping }
|
||||||
unit.action = UnitActionType.Sleep.value
|
|
||||||
}.takeIf { !isSleeping }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -778,7 +769,7 @@ object UnitActions {
|
|||||||
|
|
||||||
// City States only take military units (and units specifically allowed by uniques)
|
// City States only take military units (and units specifically allowed by uniques)
|
||||||
if (recipient.isCityState()) {
|
if (recipient.isCityState()) {
|
||||||
if (!unit.matchesFilter("Military")
|
if (!unit.matchesFilter("Military")
|
||||||
&& unit.getMatchingUniques("Gain [] Influence with a [] gift to a City-State")
|
&& unit.getMatchingUniques("Gain [] Influence with a [] gift to a City-State")
|
||||||
.none { unit.matchesFilter(it.params[1]) }
|
.none { unit.matchesFilter(it.params[1]) }
|
||||||
) return null
|
) return null
|
||||||
@ -792,18 +783,18 @@ object UnitActions {
|
|||||||
val giftAction = {
|
val giftAction = {
|
||||||
if (recipient.isCityState()) {
|
if (recipient.isCityState()) {
|
||||||
for (unique in unit.civInfo.getMatchingUniques("Gain [] Influence with a [] gift to a City-State")) {
|
for (unique in unit.civInfo.getMatchingUniques("Gain [] Influence with a [] gift to a City-State")) {
|
||||||
if (unit.matchesFilter(unique.params[1])
|
if (unit.matchesFilter(unique.params[1])) {
|
||||||
) {
|
recipient.getDiplomacyManager(unit.civInfo)
|
||||||
recipient.getDiplomacyManager(unit.civInfo).addInfluence(unique.params[0].toFloat() - 5f)
|
.addInfluence(unique.params[0].toFloat() - 5f)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recipient.getDiplomacyManager(unit.civInfo).addInfluence(5f)
|
recipient.getDiplomacyManager(unit.civInfo).addInfluence(5f)
|
||||||
}
|
} else recipient.getDiplomacyManager(unit.civInfo)
|
||||||
else recipient.getDiplomacyManager(unit.civInfo).addModifier(DiplomaticModifiers.GaveUsUnits, 5f)
|
.addModifier(DiplomaticModifiers.GaveUsUnits, 5f)
|
||||||
|
|
||||||
if(recipient.isCityState() && unit.isGreatPerson())
|
if (recipient.isCityState() && unit.isGreatPerson())
|
||||||
unit.destroy() // City states dont get GPs
|
unit.destroy() // City states dont get GPs
|
||||||
else
|
else
|
||||||
unit.gift(recipient)
|
unit.gift(recipient)
|
||||||
@ -815,7 +806,8 @@ object UnitActions {
|
|||||||
|
|
||||||
private fun addToggleActionsAction(unit: MapUnit, actionList: ArrayList<UnitAction>, unitTable: UnitTable) {
|
private fun addToggleActionsAction(unit: MapUnit, actionList: ArrayList<UnitAction>, unitTable: UnitTable) {
|
||||||
actionList += UnitAction(
|
actionList += UnitAction(
|
||||||
type = if (unit.showAdditionalActions) UnitActionType.HideAdditionalActions else UnitActionType.ShowAdditionalActions,
|
type = if (unit.showAdditionalActions) UnitActionType.HideAdditionalActions
|
||||||
|
else UnitActionType.ShowAdditionalActions,
|
||||||
action = {
|
action = {
|
||||||
unit.showAdditionalActions = !unit.showAdditionalActions
|
unit.showAdditionalActions = !unit.showAdditionalActions
|
||||||
unitTable.update()
|
unitTable.update()
|
||||||
@ -823,4 +815,4 @@ object UnitActions {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user