Page 1 of 1

Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Sat Dec 11, 2021 12:19 am
by Corbeau
This is the situation:

"Raiders" unit requires 1 Shield upkeep.

"Raiders" have "Shield2Gold" tag, verified in the automatic game help.

This is the effect:

Code: Select all

[effect_shield2gold_raiders]
type	= "Shield2Gold_Factor"
value	= 100
reqs	= 
	{ "type", "name", "range", "present"
	  "Gov", "Tribal", "Player", FALSE
	  "UnitType", "Raiders", "Local", TRUE
	}
Under Despotism:

Code: Select all

type    = "Unit_Upkeep_Free_Per_City"
value   = 2
All of this can be verified here:
https://github.com/longturn/games/tree/master/SIM30/data/SIM30

However, a city that supports three Raiders and one Diplomat (2 Gold upkeep!) pays NO gold upkeep!

Does anyone have any idea what's going on?

Re: Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Sat Dec 11, 2021 12:32 am
by Corbeau
Upon the third look... The "Shield2Gold" effect says: "The range of this effect must be player or world."

So, it this the problem?

"UnitType", "Raiders", "Local", TRUE

(Unfortunately, can't test it right now for technical reasons...)

Re: Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Sun Dec 12, 2021 3:04 pm
by Ignatus
"Shield2gold" flag works this way: if a player has positive "Shield2Gold_Factor" effect (that is indeed not unit type dependent), gold upkeep of a unit is replaced by its shield upkeep with this factor (in percents rounded up), and then "Upkeep_Factor" for shields (in 1's) is applied to the result. (The unit type shield upkeep is considered to be zero in that case.)

Since Despotism has no shield upkeep factor, your city pays nothing for Raiders, and the diplo fits in 2 free gold upkeep.

Re: Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Sun Dec 12, 2021 9:57 pm
by Corbeau
Ignatus wrote:"Shield2gold" flag works this way: if a player has positive "Shield2Gold_Factor" effect (that is indeed not unit type dependent), gold upkeep of a unit is replaced by its shield upkeep with this factor (in percents rounded up), and then "Upkeep_Factor" for shields (in 1's) is applied to the result. (The unit type shield upkeep is considered to be zero in that case.)

Since Despotism has no shield upkeep factor, your city pays nothing for Raiders, and the diplo fits in 2 free gold upkeep.
Did you swap those two above by mistake? Because the Wiki says the opposite.

As for the solution, does this mean that this

Code: Select all

type    = "Upkeep_Factor"
value   = 1
reqs    =
      {	"type", "name", "range"
	"OutputType", "Shield", "Local"
      }	
with no nreqs would solve the problem?

I'm not even sure what is the purpose of those nreqs in the original ruleset...

Re: Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Mon Dec 13, 2021 1:44 pm
by Ignatus
Corbeau wrote:Did you swap those two above by mistake? Because the Wiki says the opposite.
Sorry if I am not clear: I mean, for the upkeep of a unit in gold its uk_shield value is taken, and for upkeep in shields nothing, like the wiki basically says.
As for the solution, does this mean that this

Code: Select all

type    = "Upkeep_Factor"
value   = 1
reqs    =
      {	"type", "name", "range"
	"OutputType", "Shield", "Local"
      }	
with no nreqs would solve the problem?

I'm not even sure what is the purpose of those nreqs in the original ruleset...
Like, this effect will make all governments upkeep units in shields (some ones additionally to other upkeeps). Government nreqs are used to filter the commented/omitted govs, it's shorter to write than to add a separate effect with a positive req for each gov affected.

Re: Mystery solvers wanted: unit upkeep doesn't come out right

Posted: Wed Dec 15, 2021 2:14 pm
by Corbeau
For the record, I went through all units and set shield upkeep to zero for all those that are not meant to have shield upkeep.

Right, now I understand. Civ has a paradigm that unit upkeep depends on governemnts. Sim has upkeep independent of governments, apart from two exceptions (double gold under Democracy and the aforementioned Raiders).