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
This commit is contained in:
Rob Loach 2025-06-15 04:24:07 -04:00 committed by GitHub
parent 79fb4b4d59
commit 5190604466
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 5 deletions

View File

@ -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. <after discovering [tech]>
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),

View File

@ -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 }

View File

@ -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