Formula - Damage took as MP dmg before HP dmg

Hello,

I'd like to turn MP into Magic resistance, so it works as a shield against Magical attacks. In the system I want to use, there is no resource costs for skills and attacks, instead MP are strictly used as Damage Resistance.

For instance, If a character deals 100 magic damage to an enemy with 25 MP, it will deal 25 dmg to their MP, and 75 damage to their HP (100 - 25 = 75). If MP are 0, all the damage are dealt to the HP instead.

I know there are plugins for magical barriers, but I'd like to work with custom formulas.

Thanks for your time.

PS : Is it also possible to do the same thing with TP for physical damage ?
I know there are plugins for magical barriers, but I'd like to work with custom formulas.
That's not really a good way to do it. The damage formula has to be selected to be one kind of damage, e.g. HP Damage.

If you use the formula to subtract from the target's MP and do no HP Damage, then you will see a 0 damage popup which looks wrong.
That's why the universal recommendation is to use a plugin with notetags like my Eval Tags or the VisuStella Battle Core.

PS : Is it also possible to do the same thing with TP for physical damage ?
Yes.

Everything you want to know is in here:
Thanks for your answer. So far i've used :

" dmg = 100; mpDmg = Math.min(dmg, b.mp); b.gainMp(-mpDmg); dmg - mpDmg; "

with parameters set to HP damage and it works just fine.

I could use a plugin though, as I don't know how to increase TP through parameters from equipment to simulate armor, or even give tp to enemies.
I don't know how to...even give tp to enemies.
Enemies have TP in exactly the same way actors do.
Enemies have TP in exactly the same way actors do.

Yes but what I meant is that I don't know how to set TP prebattle for each enemies, or even control the TP gain through notetags on equipment.

Another workaround could be to simply use def and magic def, but contrary to MP those parameters dont have current/max values.

The best way to do it would be through custom parameters I guess..
I know VisuStella has a plugin for custom param, but I don't know if it's possible to make custom "gauge" (current/max) params.

Original thread: https://forums.rpgmakerweb.com/threads/formula-damage-took-as-mp-dmg-before-hp-dmg.173450/