Page 1 of 1
Move_Bonus effect with negative value
Posted: Thu Jan 06, 2022 2:46 am
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.
Re: Move_Bonus effect with negative value
Posted: Thu Jan 06, 2022 11:00 am
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.
Re: Move_Bonus effect with negative value
Posted: Sun Jan 09, 2022 3:49 am
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.
Re: Move_Bonus effect with negative value
Posted: Sun Jan 09, 2022 8:46 am
by cazfi
min_speed is a unit class property. Its original purpose is to limit how much damage slows down units with "DamageSlows" flag.
Re: Move_Bonus effect with negative value
Posted: Mon Jan 10, 2022 2:54 am
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.
Re: Move_Bonus effect with negative value
Posted: Mon Jan 10, 2022 3:48 am
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