I have something working at the moment so I won't complain, we can leave it later
Critical issue: Interaction between !!EA (use on negative stack id) and Battle Replay
This is a critical issue in scripting that if a stack is set with !!EA and kill and transform into another stack, its stats will remain the ones after its transformation after battle replay.
Ok I understand this doesn't sound understandable. Let me show you my testing script:
- !?FU(OnKeyPressed_Battle)&i^key^=(KEY_K);
- !!VR(stack:y):S0;
- !!VR(eaStack:y):S(stack) +1 *-1;
- !!BM(stack):P?(pos:y);
- !!EA(eaStack):E?(exp:y)/2/d/d;
- !!BM(stack):H?(hp:y);
- !!IF:M^The hp of the stack to be killed is %(hp).^;
- !!BM(stack):Fd|(MON_FLAG_SUMMONED) Fd|(MON_FLAG_CLONE) Fd|(MON_FLAG_NO_COLORING);
- !!BM(stack):K1;
- !!SN&i^battle_isVisible^:D;
- !!BU:S(MON_AZURE_DRAGON)/1/(pos)/(BATTLE_LEFT)/-1/(TRUE);
- !!BU:E(pos)/?(newStack:y);
- !!if&(stack)<>(newStack);
- !!IF:M^Warning! The new stack has different stack id with the killed stack!^;
- !!FU:E;
- !!en;
- !!BM(stack):H?(hp:y);
- !!IF:M^The hp of the summoned stack is %(hp).^;
- !!EA(eaStack):E(exp)/2/d/d;
- !!BM(stack):H?(hp:y);
- !!IF:M^The hp of the summoned stack after setting EA is %(hp).^;
And my testing video
In this video, I used raw ERA + GEM (for battle replay) + my testing script (see above). I picked a random fight and ran my script.
As you can see in the video,
- The gnoll had a standard HP stats initially
- It got killed with script, with (MON_FLAG_SUMMONED) added
- An Azure Dragon was summoned, due to the vacancy left by the Gnoll, it occupied the killed Gnoll's stack Id
- Set any !!EA on the summoned Azure Dragon
- Killed the Azure and Summoned again (optional)
- Ended the battle and replayed
- Found the Gnolls had 1000 HP
My guess is that !!EA for stack id has some cache that needs to be reset on Battle Replay. However, I don't know where to find them. I don't know how to fix.
Currently, the mechanism corrupts "Metamorph" script's behaviour.