The Koopo bug, redux
Posted: Fri Oct 22, 2010 6:10 pm
I couldn't find this already described anywhere, so here we go. Are you ready for this?
It's the tail end of the duplicator cycle.
P1 is the duplicator phase, and that gets reset to 0 at the time a duplicator performs its function; for an object, P1 is the display character, so the object displays as the blank NUL graphic. Duplicators also reset their cycle to 3(9 − P2) every cycle, and for an object P2 is normally zero for unlocked, so that results in a cycle of 27 (or 24 if the object starts out locked). The object that gets scrambled is the one that has the same stat index on the new board as the duplicator did in the previous board. The duplicator code just never bothers to check whether the stats record it's now modifying is the same one it was modifying before. (Why would it, after all?)
Note that this implies that non-object records, such as for monsters, can be altered as well, with different resultant effects.
So put your sacrificial stats records at the same stat index as the triggering duplicators and you should be safe, I expect.
It's the tail end of the duplicator cycle.
P1 is the duplicator phase, and that gets reset to 0 at the time a duplicator performs its function; for an object, P1 is the display character, so the object displays as the blank NUL graphic. Duplicators also reset their cycle to 3(9 − P2) every cycle, and for an object P2 is normally zero for unlocked, so that results in a cycle of 27 (or 24 if the object starts out locked). The object that gets scrambled is the one that has the same stat index on the new board as the duplicator did in the previous board. The duplicator code just never bothers to check whether the stats record it's now modifying is the same one it was modifying before. (Why would it, after all?)
Note that this implies that non-object records, such as for monsters, can be altered as well, with different resultant effects.
So put your sacrificial stats records at the same stat index as the triggering duplicators and you should be safe, I expect.