Spell Damage Based on MP?

I'm trying to user Yanfly's Skill Core plugin (link attached below) in order to make a skill that does its damage based on the MP you had when you cast it, but drains all of that MP (it's basically Magic Burst from the Dragon Quest series). The problem, however, is that it takes away the MP and THEN calculates its damage, instead of the other way around, therefore causing it to do 0 damage. How can I fix this? Is it possible to fix this? (Sorry if this has already been asked, I searched elsewhere for it and couldn't find it).


http://yanfly.moe/2015/10/13/yep-8-skill-core/
I've moved this thread to JS/Plugin Support (Tutorials is where you post tutorials, not support questions). Please be sure to post your threads in the correct forum next time. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/spell-damage-based-on-mp.62476/