OK, I already have two tips to submit:
1. If you ever find yourself in a situation where you aren't sure if your effect is even triggered to begin with, add a line of code in one of the functions that simply restores the player's Life Points by a fixed amount. This will let you distinctively see, in-game, when that particular line of code is reached. You can expand this technique for complicated traces, where each individual line restores a different number of Life Points. So in-game, you would go "1, 2, 3, 4... no 5. OK, why did it stop before 5?". This will very quickly narrow down where the bug may be hiding.
2. When all else fails when debugging a script, you can try what is known in the programming world as "mutation testing". What it simply means is that you start changing your code so that chunks of it are deliberately not run. If you make such a change and the problem persists, you can be sure that the problem is not in that part of the code, and move on to trying to eliminate a different chunk. The most often used technique to achieve this is to start at the end of the effect's code and comment out lines of code back towards the start until the problem goes away. Then you start uncommenting line-per-line in normal order until the problem reappears, and boom - you know that the very last line you uncommented is causing the problem.