Increasing an actor's state success rate

Let's say I have a skill with a 20% chance to inflict poison, and I want to have another self-applied state that increases this 20% chance to 100%. At first, I assumed that adding a 1000* State Rate to the buffing state was the answer, but then I realised it only affected the success rate of poison from enemies onto the afflicted actor.

In short, is there a way I can accomplish the following?:
Skill 1: Deals damage (regular accuracy) and applies Poison at a 20% success rate.
Skill 2: Applies State 1 to the user.
State 1: Changes Skill 1's poison success rate to 100% for the duration of the state.
You have to do this manually via Yanfly Skill Core plugin.
First, setup your skill 1 to deal damage in database and apply Poison at 20% success rate with this note tag put into the Note tag box:
Code:
<Pre-Damage Eval>
//Check if user has State 1
if (user.isStateAffected(1)){
//Change X to your Poison state below. State is applied when damage is deal with 100% chance
target.addState(x);}
else{
//Make a random number for 20% chance when user does not have State 1
if (Math.random() < 0.2){
//Change X to your Poison state below
target.addState(x);}}
</Pre-Damage Eval>
I'm not sure this will work so please try it out and let me know.
Ah, that works perfectly - thanks a lot!

Just a quick note, though: I had to add another ) in line 3, if (user.isStateAffected(1){, just before the {. I assume it's just a case of brackets.
Yeah sorry for that i have just realized i missed it 😀

Original thread: https://forums.rpgmakerweb.com/threads/increasing-an-actors-state-success-rate.82445/