tnevolin / thinker-doer

Modifications to a SMACX Thinker mod to highlight more game features
GNU General Public License v2.0
27 stars 3 forks source link

Retooling function interacts poorly with INDUSTRY mineral scaling #36

Closed nevill-spb closed 3 years ago

nevill-spb commented 3 years ago

You know how retooling allows you to switch production back and forth, dynamically changing the number of accumulated minerals? You lose some minerals if you switch production, but you gain them back if you choose the same production again.

It turns out it reacts poorly to another dynamic change in the amount of accumulated minerals introduced by WtP mineral scaling.

Steps to recreate the bug.

1) Build a former, collect 14/20 minerals. 2) Switch to Planned, the mineral scale will shrink to 13/18 (this is intended WtP behavior) 3) Switch production to anything and then back again. The retooling function will set the number of minerals to 14/18. (this is a bug) 4) Switch back from Planned to whatever economy you were running, refunding the SE cost. The mineral scale will stretch to 16/20.

You just gained 2 minerals out of thin air at no additional cost! You can do that on every base.

The retooling function remembers the number of accumulated minerals at the beginning of the turn, and uses 14 minerals instead of 13 (scaled) when you switch production.

tnevolin commented 3 years ago

Excellent catch!

180 Also scaling saved accumulated minerals at the beginning of turn. That fixes it.