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

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
User avatar
Corbeau
Elite
Posts: 1293
Joined: Mon Jan 13, 2014 11:13 pm

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

Post 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?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
User avatar
Corbeau
Elite
Posts: 1293
Joined: Mon Jan 13, 2014 11:13 pm

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

Post 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...)
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

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

Post 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.
User avatar
Corbeau
Elite
Posts: 1293
Joined: Mon Jan 13, 2014 11:13 pm

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

Post 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...
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

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

Post 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.
User avatar
Corbeau
Elite
Posts: 1293
Joined: Mon Jan 13, 2014 11:13 pm

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

Post 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).
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Post Reply