From 30fdc07d01d5d9c399a289af61c042cfabe00164 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 6 May 2021 15:09:46 +0300 Subject: [PATCH 23/23] AI: Increase want for improvement provided gold when tax rate high Improvement provided gold is often negative as maintenance cost is included. The high tax rate indicates that there's gold shortage that runs it high, and we should avoid making situation worse. Ideally we even improve the situation and make it possible to lower the tax rate in the future. Especially with civ2civ3 ruleset AI has often ended to permanent 100% tax rate with no attempt to resolve the situation. Reported by chippo See osdn #42191 Signed-off-by: Marko Lindqvist --- ai/default/aicity.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ai/default/aicity.c b/ai/default/aicity.c index fe4f81f052..7623417631 100644 --- a/ai/default/aicity.c +++ b/ai/default/aicity.c @@ -1351,7 +1351,7 @@ adv_want dai_city_want(struct player *pplayer, struct city *acity, memset(prod, 0, O_LAST * sizeof(*prod)); if (NULL != pimprove - && adv->impr_calc[improvement_index(pimprove)] == ADV_IMPR_CALCULATE_FULL) { + && adv->impr_calc[improvement_index(pimprove)] == ADV_IMPR_CALCULATE_FULL) { struct tile *acenter = city_tile(acity); bool celebrating = base_city_celebrating(acity); @@ -1400,7 +1400,15 @@ adv_want dai_city_want(struct player *pplayer, struct city *acity, } want += prod[O_LUXURY] * adv->luxury_priority; want += prod[O_SCIENCE] * adv->science_priority; - want += prod[O_GOLD] * adv->gold_priority; + if (pplayer->economic.tax > 50) { + /* Increased tax rate indicates that we've had gold shortage which + * we are trying to fill with taxes. Consider gold more critical + * than usually. + * Smallest tax rate we can have here is 60% -> factor (60 - 40) / 14.0 = 1.43 */ + want += prod[O_GOLD] * adv->gold_priority * (pplayer->economic.tax - 40) / 14.0; + } else { + want += prod[O_GOLD] * adv->gold_priority; + } return want; } -- 2.30.2