Auto-translated
Well, I've already posted the algorithm.
In the TE version, the difference between the initial number and the number of killed creatures will remain, i.e., the remainder will be determined correctly.
Creatures killed by magic are just as dead as those who died from a physical attack :)
And you, check it!
Added 5 minutes later
Let's calculate. In the lower stack, 10 - 3 = 7 units will remain. This remainder will be recorded in the first slot. That is, there will be 7 + 10 + 10 + 10 + 10 = 47 creatures, i.e., in this case, everything is fine.
Everything is working as intended (the remainder is always written to the first slot), thank you! I'm going to check the bug with the dragons :smile13:
Best regards, VDV_forever