Let's say we have air and ice spell.
We:
1) Calculate attacking and defending levels for spell, as usual.
2) Divide it by two because we have 2 elements (3 for 3 elements, etc)
3) Calculate elemental bonuses for them separately. With divided by 2 elemental multipliers. (3 for 3 elements, etc)
4) Treat resulting two numbers of damage as two independent damages, with different colors, one after another.
This is a rewrite and a bunch of messy code. I want a cleaner solution, like on that site...
And you're oversimplifying! It would go something like this:
1) ATT/DEF base.
2) Get per elements damage fraction. We however NEVER do it like this, we do everything else first and calculate damage last
![Sad :(](https://www.pinkpetal.org/Smileys/DarkB/sad.gif)
And there are a number of reasons for that...
3) You forgot resistance and absorption... per element...
for element in elements:
multi = 1.0
- check for resistance and skip the next item in loop, subtracting damage fraction from total damage (OR adding it to a dict, if we want reports with different colors).
in case of no resistance:
- apply bonus and penalty to the damage fraction.
- check for absorption and if it's applicable, reduce the damage fraction by absorption ratio and subtract from total damage. Go to next item in loop.
if no absorption:
- add the resulting damage fraction to the total damage.
4) Easier said than done. And even if done, it will look absurd with 5 or 6 elements and we have like 8 total...
==============>>>
This is not all. This can no longer be a part of a method that calculates and account for other modifiers. We also need somehow to check for total resistance vs partial resistance because if all elements had been resisted, we want the attack to result in 0 as it does now, however that will not happen if we add other multipliers as well (like from your new resistance stat or item bonuses) while we do want to use them if at least one element went through... so it also means a complex and messy resistance_check method instead of a oneliner we have now (that doesn't even calc the damage if anything in skill's attrs was resisted).
You want more? We'd have to check defense on every step of that loop if we still wanted character "not to resist" element that can be absorbed.
There may be even more issues. On top of that, we'd have to keep all of this in mind and be able to work with the resulting code somehow... and all that to add a couple of ME skills that will either be stupidly overpowered if we allow stacking of bonuses like on that site or just the same as other attacks mean is drawn as we do now.
This feels like a really, really bad idea... especially without simplification of elemental system or moving part of variables from code to content somehow.