Damage Formula Question: HP/MP Split Damage Mechanic

Hello ^_^ I'm wondering if it's possible to have a damage formula that checks the enemy's MP value and then damage the enemy as follows:

Example - if the enemy's current MP is 1 or more, then the skill will inflict 15 damage to HP and 15 damage to MP. However, if the enemy's MP is 0, then the skill will inflict 30 damage to HP (full damage instead of a split.)

I hope I explained that clearly and any help or tips would be greatly appreciated!

EDIT: I just realized I posted this in the wrong forum, as I meant to post in MV and not VX Ace, since I use MV and not VX Ace. I apologize for the gaffe 🙁
Checking the enemy's MP value in the damage formula is simple - should be a simple "b.mp > 0 ? <Split damage formula> ; 30"

The problem is, I do believe skills target either MP or HP - not both - so finding a way to deal both MP and HP damage is the tricky bit...
If you are fine with. Not having either hp or mp damage not shown in the battle log then it is quite simple. You have to check if the condition is true (up to you if you want to check if mp are 0 or if they are not) then apply damage based on that. Unfortunatly the syntax "condition ? do something if yes : do something else if no" is not something you can use in Javasctipt.

For RPG Maker MV you should do something like this:
Code:
dmg = damage_formula_goes_here; if (b.mp > 0) dmg /= 2; b.gainMp(-dmg); end; dmg

This checks if target mp are greater than 0. If they are it halves the damage and inflicts it to target mp after the check. At the end of the line, it inflicts the damage (either real or halved depending on the situation) to the target.

I didn't use Javascript for a very long time, I hope my syntax is correct.

Moved to MV Support

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-question-hp-mp-split-damage-mechanic.84027/