Hi!
I'm having a bit of difficulty with a particular damage formula, and my searches didn't helped a bit.
I have two kinds of weapons in my game: pure physical weapons and enchanted (elemental) weapons.
When the user attacks with a pure physical weapon (command Attack), it's the default formula that should be used (old and good a.atk * 4 - b.def * 2).
However, if the weapon has an element, I'd like to add some damage on top of that (i.e., the target is hit by the physical part of the weapon and also by the magical).
In other words, it should be something like this:
WEAPON_HAS_ELEMENT_OTHER_THAN_NORMAL ? (a.atk * 4 - b.def * 2) + (a.mat * 4 - b.mdf * 2) : a.atk * 4 - b.def * 2;
That's where I struck a roadblock. How to check if the weapon has an element associated?
Considering Normal is elementId 1, I could check if elementId > 1, but I don't know how to check that.
Follow up question: if the target is immune or resistant to that element, will this formula take that in consideration? Let's say I hit a 50% fire resistant target with a Fire Sword, he should receive full damage from the physical part (a.atk * 4 - b.def * 2) and half damage from the magical part (a.mat * 4 - b.mdf * 2).
Can this be done changing the damage formula or it's something that'll require a plug-in?
EDIT: An alternative way to do this would be having such weapon to make a second/simultaneous magical attack. If this is the alternative (and it seems easier, I think), how to chain both attacks?
I'm having a bit of difficulty with a particular damage formula, and my searches didn't helped a bit.
I have two kinds of weapons in my game: pure physical weapons and enchanted (elemental) weapons.
When the user attacks with a pure physical weapon (command Attack), it's the default formula that should be used (old and good a.atk * 4 - b.def * 2).
However, if the weapon has an element, I'd like to add some damage on top of that (i.e., the target is hit by the physical part of the weapon and also by the magical).
In other words, it should be something like this:
WEAPON_HAS_ELEMENT_OTHER_THAN_NORMAL ? (a.atk * 4 - b.def * 2) + (a.mat * 4 - b.mdf * 2) : a.atk * 4 - b.def * 2;
That's where I struck a roadblock. How to check if the weapon has an element associated?
Considering Normal is elementId 1, I could check if elementId > 1, but I don't know how to check that.
Follow up question: if the target is immune or resistant to that element, will this formula take that in consideration? Let's say I hit a 50% fire resistant target with a Fire Sword, he should receive full damage from the physical part (a.atk * 4 - b.def * 2) and half damage from the magical part (a.mat * 4 - b.mdf * 2).
Can this be done changing the damage formula or it's something that'll require a plug-in?
EDIT: An alternative way to do this would be having such weapon to make a second/simultaneous magical attack. If this is the alternative (and it seems easier, I think), how to chain both attacks?