Lower chances of Enemy Surprises with a state?

I have the Force Advantage plugin from Yanfly, and I know about the RTP's Cancel Surprise thing... but is it possible to create a state where the chance of being surprised by an enemy is lowered but not impossible to happen? Like say, 25%-50%? Trying to create a passive ability for one of my actors, which is why I ask.
You would need a plugin.


Who has the state - ANY party member?  The leader?  A particular member?  If more people have the state, does the chance get lowered further for each one?
//=============================================================================
// VariableSurpriseRate.js
//=============================================================================

//=============================================================================
/*:
* @plugindesc Adjust the surprise rate via a variable and state combination.
*/
//=============================================================================

(function() {

var actor = 1;
var state = 110;
var variable = 15;

//-----------------------------------------------------------------------------
// Game_Party
//
// The game object class for the party. Information such as gold and items is
// included.

Game_Party.prototype.rateSurprise = function(troopAgi) {
var rate = this.agility() >= troopAgi ? 0.03 : 0.05;
if (this.hasCancelSurprise()) {
rate = 0;
}
else if ($gameActors.actor(actor).isStateAffected(state)) {
rate = $gameVariables.value(variable);
}
return rate;
};

})();


Copy the above, paste it into Notepad, and save it as a .js file. Then, load it into MV as a pluign. You'll need to edit the actor, state, and variable settings at the top of the file using Notepad.


Based on your description, the actor setting correlates to the desired actor, the state correlates to the state to check for, and the variable correlates to a game variable of your choosing that you've set. For example, set variable number 15 to 100, and the surprise rate will equal 100.
Do I need to edit anything else besides what I changed at the top? I changed "var state" to 97 and "var variable" to 35 btw.


Where do I place this code? In the Notetags of the state? A Common Event?
Per my instructions:


Copy the above, paste it into Notepad, and save it as a .js file. Then, load it into MV as a pluign.
I did. It's at the bottom of my list. 


Okay, now what?

Original thread: https://forums.rpgmakerweb.com/threads/lower-chances-of-enemy-surprises-with-a-state.61934/