You are not logged in.
Hello everyone! Lately, I've been working on a hack of Crystal. I managed to make a lot of progress thanks to all the information available on the disassembly tutorials, but I have recently come across with an issue related to enemy switching and spikes damage. To summarize, when the opponent switches out, the damage is not applied (at least in later gens it does). However, when I use Roar or a new Pokemon enters due to a previous KO, it is applied.
To test this, I modified the first Rival battle to have two Pokemon, the second one not being Flying and having Rapid Spin (with this method I managed to get somewhat frequent switches when I used Spikes). Unfortunately, I couldn't get the damage when the enemy purposedly switched out to the second one.
I also tried with a new rom (only modifying the roster and the player moves) in case I messed with the code, but I got no luck.
From what I know (I'm not an expert), the routine that applies the damage is in engine/battle/core.asm , named 'SpikesDamage' and it is referenced several times, including this one which I think should handle the damage when switching:
So, if someone could help me understand why this is happening or give me a solution, I would really appreciate it. I know that enemy switching is not that common but it will be a great improvement to my project. Thanks!