From 5190604466ff19815bd6818b75bcbf1773df2353 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sun, 15 Jun 2025 04:24:07 -0400 Subject: [PATCH] Allow using `[relativeAmount]% Gold from Great Merchant trade missions` on units (#13436) * Apply [relativeAmount]% Gold from Great Merchant trade missions to units * Use checkCivInfoUniques for trade mission modifier * Fix typo --- core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 2 +- .../worldscreen/unit/actions/UnitActionsGreatPerson.kt | 10 +++++++--- docs/Modders/uniques.md | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 019d719fa9..d3638ddf41 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -165,7 +165,7 @@ enum class UniqueType( /// Great Persons GreatPersonPointPercentage("[relativeAmount]% Great Person generation [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief), - PercentGoldFromTradeMissions("[relativeAmount]% Gold from Great Merchant trade missions", UniqueTarget.Global), + PercentGoldFromTradeMissions("[relativeAmount]% Gold from Great Merchant trade missions", UniqueTarget.Global, UniqueTarget.Unit), GreatGeneralProvidesDoubleCombatBonus("Great General provides double combat bonus", UniqueTarget.Unit, UniqueTarget.Global), // This should probably support conditionals, e.g. MayanGainGreatPerson("Receive a free Great Person at the end of every [comment] (every 394 years), after researching [tech]. Each bonus person can only be chosen once.", UniqueTarget.Global), diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsGreatPerson.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsGreatPerson.kt index 293d917ec3..8780ec0464 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsGreatPerson.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsGreatPerson.kt @@ -109,13 +109,17 @@ object UnitActionsGreatPerson { action = { // http://civilization.wikia.com/wiki/Great_Merchant_(Civ5) var goldEarned = (350 + 50 * unit.civ.getEraNumber()) * unit.civ.gameInfo.speed.goldCostModifier - for (goldUnique in unit.civ.getMatchingUniques(UniqueType.PercentGoldFromTradeMissions)) + + // Apply the gold trade mission modifier + for (goldUnique in unit.getMatchingUniques(UniqueType.PercentGoldFromTradeMissions, checkCivInfoUniques = true)) goldEarned *= goldUnique.params[0].toPercent() - unit.civ.addGold(goldEarned.toInt()) + + var goldEarnedInt = goldEarned.toInt() + unit.civ.addGold(goldEarnedInt) 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!", + unit.civ.addNotification("Your trade mission to [$tileOwningCiv] has earned you [$goldEarnedInt] gold and [$influenceEarned] influence!", NotificationCategory.General, tileOwningCiv.civName, NotificationIcon.Gold, NotificationIcon.Culture) unit.consume() }.takeIf { unit.hasMovement() && canConductTradeMission } diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index 5f7642395a..e2eddc4378 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -682,7 +682,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl ??? example "[relativeAmount]% Gold from Great Merchant trade missions" Example: "[+20]% Gold from Great Merchant trade missions" - Applicable to: Global + Applicable to: Global, Unit ??? example "Great General provides double combat bonus" Applicable to: Global, Unit @@ -1677,6 +1677,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Global, Unit +??? example "[relativeAmount]% Gold from Great Merchant trade missions" + Example: "[+20]% Gold from Great Merchant trade missions" + + Applicable to: Global, Unit + ??? example "Great General provides double combat bonus" Applicable to: Global, Unit