Overall the script works, but my Grand Elves get extra turns for some reason. For example, when I have 7 stacks of Grand Elves, they act one by one from 1 to 4, and then after the end of the 4# stacks, it becomes the 1# stack's turn again.
Checked several times and got completely confused. I will get some rest and try again, maybe.
Is changing stack turn OnBattleStackObtainsTurn too hacky?
Also, my attempt at ignoring the morale effect OnBattleActionEnd seems to be invalid. It triggers after Morale. Any better timing after calculating the distance of moving and before morale calculation?
________
Edit: Problem was solved after I replaced my 77006 with FU(OnBeforeBattleStackTurn), now it works flawlessly - almost! There is still a problem I can't seem to solve. I am looking for a timing "After knowing whether my Grand Elves stack moved by 1 hex, but before morale calculation", in short, I need to prevent the first 1 hex move to trigger morale. Is there a better way to do it than checking the position of the mouse click?
Note: I tried setting morale to 0 at OnBattleActionEnd, it is later than the morale check and thus was invalid.