multiple discrete instances of elemental damage in a damage formula?

Wondering if it's possible to do something like this with the damage formula:

10 (fire) damage + 20 (ice) damage + 30 (physical) damage.

If the target has no elemental resistances to anything, the target would receive 60 damage.

If the target has 100% ice resistance, the target would receive 40 damage ( 10 fire + 30 physical).

If the target has 50% ice resistance, the target would receive 50 damage (10 fire + 10 ice (halved) + 30 physical).



Basically, the damage formula would contain different damage totals that individually factored in a target's elemental resistance. Could this be done, and if so how?
not by default, you'll need a plugin to change the engine behaviour.

theoretically this is possible to do with the damage formula alone, but that would get extremely complex and error-prone.

the first problem is that the engine by default multiplies the result of the damage formula with the elemental damage rate of the set element. You would have to divide by that to prevent a doubled effect.
it is better if a plugin removes that part in favor of other handling if you want to do this.

the second problem is that the code needed to get the damage rates for elements into the damage formula is not short, and having it done multiple times would make the formula difficult to read.
So the second function of that hypothetical plugin should be to provide a shortcut-function to write that into the damage formula.

I don't know of a plugin that does this, but should be easy to do if you request one.
The easiest way to do this in the engine alone (albiet, in a bit of a clunky way) is to make new elements that are hybrid elements
You should be able to include elemental resistances in the damage formula.
I'm not sure if MZ changed anything here, but in MV you could use
b.elementRate(12)
for the targets elemental resistance (to element 12). Of course the end result of the damage formula would still be modified through the actual element of that skill if you chose one.

So something like this could maybe work:
10 * b.elementRate(2) + 20 * b.elementRate(3) + 30 * b.elementRate(1)

Edit: So yeah, what Andar has already suggested 🙂

Original thread: https://forums.rpgmakerweb.com/threads/multiple-discrete-instances-of-elemental-damage-in-a-damage-formula.129054/