Rule debugging (city walls trade penalty)

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Drachefly
Posts: 13
Joined: Mon May 30, 2016 12:25 pm

Rule debugging (city walls trade penalty)

Post by Drachefly »

I wanted to reduce trade by 1 in each non-adjacent tile, if you have city walls*

So I put this effect in the effects ruleset.

Code: Select all

[effect_city_walls_bad_traffic]
type    = "Output_Penalty_Tile"
value   = 1
reqs = { "type", "name", "range"
         "Building", "City Walls", "City"
         "OutputType", "Trade", "Local"
       }
nreqs = {"type", "name", "range"
         "CityTile", "Center", "Adjacent"
        }
It appeared to have no effect - a paper resource 2 squares away from my test cities continued to yield 2 trade (or 3 with a river) after building city walls.

Any ideas why this doesn't work? Did I do it wrong, or does Output_Penalty_Tile not use the CityTile requirement? Or does it test the city center and find that it is adjacent to the city center and say 'nope' each time it considers what to do?


*(I have changed the effect of Great Wall not to replace city walls)
User avatar
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Rule debugging (city walls trade penalty)

Post by Alien Valkyrie »

It might be possible that Output_Penalty_Tile only works on city level, not on tile level. Also, Output_Penalty_Tile doesn't reduce output by a value, but reduces it by one if it's greater than that value. You could instead use Output_Inc_Tile with an amount of -1; if that works at all (which I assume it should), it'll work on tile level.
~ AVL
cazfi
Elite
Posts: 3091
Joined: Tue Jan 29, 2013 6:54 pm

Re: Rule debugging (city walls trade penalty)

Post by cazfi »

Caedo wrote:Output_Penalty_Tile doesn't reduce output by a value, but reduces it by one if it's greater than that value.
... and as values from active effects are added together, this might actually cause penalty to be applied less often (if it was applied to all tiles producing any trade (at least 1), it could be now only those tiles producing at least 2 (1 + 1))
Drachefly
Posts: 13
Joined: Mon May 30, 2016 12:25 pm

Re: Rule debugging (city walls trade penalty)

Post by Drachefly »

So, I tried that. Oddly, it was successful in reducing trade from a non-adjacent whales tile, but a non-adjacent paper tile remained 1-2-2. A distant roads-grassland tile was reduced to 0 trade, a nearby roads-plains tile was left with 1 trade.

I think this reduction is occurring before special resources and getting trimmed, not after.

Eh. Good enough. Thanks!
Post Reply