Protect from Certain Hit?

I have an enemy which has 100% protection from physical damage until a particular item is used.

However, if there is a skill which is Certain Hit, that overrides a PDR of 0%

I had thought to get round that by inflicting a state (which does nothing) on the enemy, a state which the item also removes, and having the skill with this damage formula so that if the state is still present, no damage is inflicted, if it has been removed, then damage as per the formula (very high at the moment for testing purposes)

b.state?(93)? 0 : a.atk * 9

However, what it does is give damage of 30 while the state is present.

Can anyone see the error in my formula?

Thanks.
You could always do what I do, which is set that state to give you element rate of 0% to all elements you want blocked until the item is used. That gets around the PDR/MDR being ignored.
But that would not block a physical attack which does not use elements but is Certain Hit.  Unless there is something in your answer which I've not understood.
No, but you could set it to an element (I just called it Physical). That's the workaround I used anyways.

As for the error in the formula, no idea, so thought I'd propose a workaround in case it helps.
I'd recommend the element method. Set the element rates to 0% for the state, then even a certain hit will do no damage.
Ah, got it.

I shall pass this on to Indy - in his time zone it's well after midnight, so testing will have to wait until tomorrow.

Thanks for the suggestion.

I'm still perplexed about my formula, so I'm hoping someone will spot my error so that if I want to use it in some other circumstances I can.
As an alternative, if you want a non-physical skill to be affected by PDR, you can just include that parameter into your damage formula:

9 * a.atk * b.pdr

The formula looks fine. However, back in september 2014 you were using a "Physical Skill Growth Script", which would be capable of boosting a skill from 0 damage. Are you still using it or another script that could interfere with the damage calculation?
Wow, what a memory!  Yes, it's the same game which I'm trying to wrap up and have just stumbled on this (or rather Indy found it).

The skill which is causing the trouble is one which levels up and I've just had a look at it.  It hits twice, and does 15HP damage each time, hence the 30 HP damage.  15 is also the boost that is given for each level.  Now, however, I come to the end of my powers of analysis, as I'm not a scripter.  But it seems to me to be the obvious suspect.  I will have to go hunting for the link as it done over the course of a whole thread.

EDIT

Found it.  The script is posted here

Original thread: https://forums.rpgmakerweb.com/threads/protect-from-certain-hit.43799/