Bypassing the Guard skill…

Basically, if I want a skill that will deal full damage regardless of whether or not its target is guarding, how would I go about it? Also, on the flip side of that coin, how would I make a skill fail completely if its target is guarding? I don’t mind needing to do a bit of scripting for this, but I’d rather avoid using a plugin unless there is absolutely no alternative.
Code:
b.isStateAffected(2) ? 0 : a.atk

Would make the skill deal no damage if the target is guarding. It would still apply debuffs (if any) though.

As for making the skill deal full damage if the target is guarding, I guess you could write a similar conditional formula where the skill deals more damage when they are guarding, to offset the damage reduction they would otherwise get?
Guarding reduces damage by half(by default), so to bypass is a matter of increasing the damage by the inverse. Something like the above:

JavaScript:
b.isStateAffected(2) ? a.atk * 2 : a.atk
That’s helpful, thanks. ^.^

 What about the case of a skill that applies a state, though? How would I have a skill always fail to apply the state if the target is Guarding?
You'd need a plugin for that, unfortunately.

Using YEP Skill Core, in either the pre-damage eval or post-damage eval notetags write

Code:
if(!target.isStateAffected(2))
{
  target.addState(3);
}

Replace '3' with the ID of the state you want to add.
I believe there's a way to apply states in the damage formula as well, but I'd have to look it up.

Edit:
Untested, but this might do it:
if(!b.isStateAffected(2)) {b.addState(3);} b.isStateAffected(2) ? a.atk * 2 : a.atk
There is, yeah, but for a skill that doesn’t deal damage, that unfortunately wouldn’t apply. I may be able to work around it with some Troop event shenaniganry, though.
Added a formula to my post above while you were typing. But yeah, if you don't use the damage formula at all, it gets more complicated. You can still use it and have the skill do 0 damage like this:
if(!b.isStateAffected(2)) {b.addState(3);} 0
but that will still give you the "X took no damage" message.
I believe there's a way to apply states in the damage formula as well, but I'd have to look it up.

Edit:
Untested, but this might do it:
if(!b.isStateAffected(2)) {b.addState(3);} b.isStateAffected(2) ? a.atk * 2 : a.atk

That might seem to work, but I would advice against using the damage formula for mechanics, as the the AI runs the code in the damage formula to evaluate who they should target next. 'b.addState(3);' is going to be called for all possible targets, even if the skill only affects one target or they decide not to use the skill.

Original thread: https://forums.rpgmakerweb.com/threads/bypassing-the-guard-skill.140950/