Skill like "Punishment" from Pokemon

I'm trying to make a skill that deals more damage if the enemy has either an attack or m.attack buff.
So i did some research and this is the formula i've come up with, but sadly it doesn't work.

a.buffs[2] > 0 || a.buffs[4] > 0 ? a.mat * 7 - b.mdf : a.mat * 2 - b.mdf

I also tried replacing a.buffs with b.buffs and leaving out the second check like this:

b.buffs[2] > 0 ? a.mat * 7 - b.mdf : a.mat * 2 - b.mdf

But that also does not work.
Any Ideas?
I've only ever used addBuff(ID, turns) so I'm not 100% sure on how you should write it to check for a buff.

Maybe it would be the same for a state?

isBuffAffected(buffId)

And if you're checking if the target is affected, then target = b

You could try this

b.isBuffAffected(buffId) ? a.mat * 7 . b.mdf : a.mat * 2 - b.mdf

I think my above statement would work if you have the correct syntax to check if the target is affected by the particular buff. I'm just not sure on the correct syntax. Maybe someone who knows will chime in.
I tried it out and it worked even after adding the second condition.

b.isBuffAffected(2) || b.isBuffAffected(4) ? a.mat * 7 - b.mdf : a.mat * 2 - b.mdf

Thanks ^^
Awesome, glad you got it

Original thread: https://forums.rpgmakerweb.com/threads/skill-like-punishment-from-pokemon.123717/