Weapon Skills

So, I am having a bit of trouble with one of my skills in my game and need some help.
I have a weapon that enhances fire magic and one that enhances water/ice magic. They both weaken the opposite element, but I need a bit of help with the fire skill.
I have this in the fire skill I want to use:

a.hasWeapon($dataWeapons[95]) ? a.mat * 4 - b.mdf * 1.5 : a.mat * 3 - b.mdf * 2

My question is, if I have the water weapon (Id:96) equipped, how do I make it so the skill does even less damage?
Would the formula look like this:?

a.hasWeapon($dataWeapons[95]) ? a.mat * 4 - b.mdf * 1.5 : a.mat * 3 - b.mdf * 2 || a.hasWeapon($dataWeapons[96]) ? a.mat - b.mdf
When I do that, the damage is always zero, even if my magic attack is higher than the enemies magic defense. How do I fix this?

Edit: Nevermind, I found the problem. I didn't have the else part of the last code. I fixed it.
When I do that, the damage is always zero, even if my magic attack is higher than the enemies magic defense
its not 0 because of the parameters. its 0 because theres an errors in the formula and the engine replaces the value with 0 when it encounters an error.

ternary operators require 3 operands. your one for weap 96 is missing one. if youre trying to chain ternary operations together, you dont use || to do it the way you want it. itd be
Code:
a.hasWeapon($dataWeapons[95]) ? [boosted formula] : a.hasWeapon($dataWeapons[96]) ? [weak formula] : [standard formula]
fwiw, i wouldnt do element boosts like this. now you cant really see your formula within the formula box, every elemental skill now needs this logic put into it, and if you change the weapon ids later you have to update every formula.

Yanfly's element core has notetags for weapons that let you amplify the damage dealt by certain elements when equipped. even without plugins, you could make a new state or element for the "attack power" of each element, have each elemental spell reference the user's elemental attack power rate, and give each weapon a trait to adjust the relevant element attack power rates

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/weapon-skills.174882/