mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-28 08:30:31 +07:00
Resolve #9432 - city-state-owned great merchants can no longer 'conduct trade mission' on their own tiles
This commit is contained in:
parent
472bb55b40
commit
7aea703fcc
@ -259,7 +259,10 @@ object SpecificUnitAutomation {
|
||||
val closestCityStateTile =
|
||||
unit.civ.gameInfo.civilizations
|
||||
.filter {
|
||||
!unit.civ.isAtWarWith(it) && it.isCityState() && it.cities.isNotEmpty()
|
||||
it != unit.civ
|
||||
&& !unit.civ.isAtWarWith(it)
|
||||
&& it.isCityState()
|
||||
&& it.cities.isNotEmpty()
|
||||
}
|
||||
.flatMap { it.cities[0].getTiles() }
|
||||
.filter { unit.civ.hasExplored(it) }
|
||||
|
@ -6,8 +6,8 @@ import com.unciv.logic.civilization.Civilization
|
||||
import com.unciv.logic.civilization.NotificationCategory
|
||||
import com.unciv.logic.civilization.NotificationIcon
|
||||
import com.unciv.logic.civilization.PopupAlert
|
||||
import com.unciv.logic.map.tile.Tile
|
||||
import com.unciv.logic.map.mapunit.UnitMovement
|
||||
import com.unciv.logic.map.tile.Tile
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.stats.Stats
|
||||
@ -37,7 +37,7 @@ class DiplomacyFunctions(val civInfo:Civilization){
|
||||
otherCiv.diplomacyFunctions.meetCiv(civInfo, warOnContact)
|
||||
}
|
||||
|
||||
fun meetCiv(otherCiv: Civilization, warOnContact: Boolean = false) {
|
||||
private fun meetCiv(otherCiv: Civilization, warOnContact: Boolean = false) {
|
||||
civInfo.diplomacy[otherCiv.civName] = DiplomacyManager(civInfo, otherCiv.civName)
|
||||
.apply { diplomaticStatus = DiplomaticStatus.Peace }
|
||||
|
||||
|
@ -88,7 +88,8 @@ object UnitActionsGreatPerson {
|
||||
}
|
||||
UniqueType.CanTradeWithCityStateForGoldAndInfluence -> {
|
||||
val canConductTradeMission = tile.owningCity?.civ?.isCityState() == true
|
||||
&& tile.owningCity?.civ?.isAtWarWith(unit.civ) == false
|
||||
&& tile.owningCity?.civ != unit.civ
|
||||
&& tile.owningCity?.civ?.isAtWarWith(unit.civ) == false
|
||||
val influenceEarned = unique.params[0].toFloat()
|
||||
actionList += UnitAction(
|
||||
UnitActionType.ConductTradeMission,
|
||||
@ -98,9 +99,11 @@ object UnitActionsGreatPerson {
|
||||
for (goldUnique in unit.civ.getMatchingUniques(UniqueType.PercentGoldFromTradeMissions))
|
||||
goldEarned *= goldUnique.params[0].toPercent()
|
||||
unit.civ.addGold(goldEarned.toInt())
|
||||
tile.owningCity!!.civ.getDiplomacyManager(unit.civ).addInfluence(influenceEarned)
|
||||
unit.civ.addNotification("Your trade mission to [${tile.owningCity!!.civ}] has earned you [${goldEarned}] gold and [$influenceEarned] influence!",
|
||||
NotificationCategory.General, tile.owningCity!!.civ.civName, NotificationIcon.Gold, NotificationIcon.Culture)
|
||||
val tileOwningCiv = tile.owningCity!!.civ
|
||||
|
||||
tileOwningCiv.getDiplomacyManager(unit.civ).addInfluence(influenceEarned)
|
||||
unit.civ.addNotification("Your trade mission to [$tileOwningCiv] has earned you [$goldEarned] gold and [$influenceEarned] influence!",
|
||||
NotificationCategory.General, tileOwningCiv.civName, NotificationIcon.Gold, NotificationIcon.Culture)
|
||||
unit.consume()
|
||||
}.takeIf { canConductTradeMission }
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user