From c1c829b7137d1c2bf4467e108808e635232cce69 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Fri, 15 Nov 2024 22:07:34 +0200
Subject: [PATCH 80/80] Make Shield2Gold_Factor to take unit type granularity
 requirements

See RM #1121

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/unittype.c  | 8 +++++++-
 doc/README.effects | 7 ++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/common/unittype.c b/common/unittype.c
index 1c8928173b..eec1602171 100644
--- a/common/unittype.c
+++ b/common/unittype.c
@@ -147,7 +147,13 @@ int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
      FIXME: Should the ai know about this? */
   if (utype_has_flag(ut, UTYF_SHIELD2GOLD)
       && (otype == O_GOLD || otype == O_SHIELD)) {
-    gold_upkeep_factor = get_player_bonus(pplayer, EFT_SHIELD2GOLD_FACTOR);
+    gold_upkeep_factor = get_target_bonus_effects(NULL,
+                                  &(const struct req_context) {
+                                    .player   = pplayer,
+                                    .unittype = ut
+                                  },
+                                  NULL, EFT_SHIELD2GOLD_FACTOR);
+
     if (gold_upkeep_factor > 0) {
       switch (otype) {
       case O_GOLD:
diff --git a/doc/README.effects b/doc/README.effects
index ed51327d81..602f172ee7 100644
--- a/doc/README.effects
+++ b/doc/README.effects
@@ -654,9 +654,10 @@ Revolution_Unhappiness
 
 Shield2Gold_Factor
     Factor in percent for the conversion of unit shield upkeep to gold upkeep.
-    A value of 200 would transfer 1 shield upkeep to 2 gold upkeep. The range
-    of this effect must be player or world. Note that only units with the
-    "Shield2Gold" flag will be affected by this.
+    A value of 200 would transfer 1 shield upkeep to 2 gold upkeep.
+    This works on unit type granularity, properties of individual units
+    do not count. Note that only units with the "Shield2Gold" flag will
+    be affected by this.
 
 Shrink_Food
     Food left after cities shrink is amount percent of the capacity of
-- 
2.45.2

