Move_Bonus effect with negative value

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Move_Bonus effect with negative value

Post by Dino the Dinosore »

The wiki page about Editing Effects says about the value field that "some do not handle negative numbers well". Is the Move_Bonus effect one of those? I'm seeing strange things when I try experimenting with it.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Move_Bonus effect with negative value

Post by cazfi »

Quick look (on master development branch, at least) shows that after the bonus is applied, there's check making the overall move rate at least min_speed. So at least negative effect value can't result in a negative overall move rate.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Move_Bonus effect with negative value

Post by Dino the Dinosore »

Based on my further testing, it appears that min_speed is either 1, or 0 if the unit has move_rate=0 in units.ruleset.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Move_Bonus effect with negative value

Post by cazfi »

min_speed is a unit class property. Its original purpose is to limit how much damage slows down units with "DamageSlows" flag.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: Move_Bonus effect with negative value

Post by Dino the Dinosore »

Duh - now I see it.
; min_speed = Minimum speed after damage and effects (whole movement points)
So after applying a Move_Bonus effect, a unit's move rate must be >= its unit class's min_speed setting. But before any Move_Bonus effects have been applied, its move rate can be less (even 0) if that is the unit's move_rate setting. Tricky. You could theoretically have a case where a unit has move_rate=0, its unit class has min_speed=2, then a Move_Bonus value of +1 (or -1) would cause its move rate to become 2. Or damaging that unit would increase its move rate from 0 to 2.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Move_Bonus effect with negative value

Post by cazfi »

Dino the Dinosore wrote:You could theoretically have a case where a unit has move_rate=0, its unit class has min_speed=2, then a Move_Bonus value of +1 (or -1) would cause its move rate to become 2. Or damaging that unit would increase its move rate from 0 to 2.
Not exactly, but there IS a bug there: https://osdn.net/projects/freeciv/ticket/43587
Post Reply