Change Damage Type outside of Database

Is there a way to change an attack's damage type? Outside of setting up the skill in the database, I mean.

To be more precise:
I'm planning to have attacks deal mp damage unless their targets are afflicted with a certain state (to then deal hp damage instead; basically using mp as a shield).
Is this even possible? I couldn't find anything in the event commands or while searching through forum threads. I just hope I overlooked something and it's actually easy.
If you're just using the default battle system, you could try to use this in the formula box:

b.state?(state_id) ? b.hp -= damage_formula : b.mp -= damage_formulaThen, you just need to replace "state_id" and "damage_formula" with the appropriate values.
Thanks a ton, I just tried it.

It works, if only partially: Actors don't do any damage at all whereas it only works for enemies using the exact same skill.

Wait, nevermind, this was just me being stupid and forgetting to add the state to the enemies.

So, what I want to say is:

It works! Thanks a lot!

Original thread: https://forums.rpgmakerweb.com/threads/change-damage-type-outside-of-database.36298/