What is the best way to conditionally slay an enemy?

Here is what I am trying to do:


1. Skeleton enemy has a passive "brittle" state (stateId = 11).


2. When a character uses a blunt weapon (such as Crude Sword, weaponId = 1), I want the skeleton to have a 50% chance to "shatter".


3. In a happy world, "shatter" would be a conditionally activated skill that adds Knockout state after a "shatter" animation if the enemy is "brittle". I thought I could maybe accomplish this using something like Yanfly's Weapon Unleash


<Custom Weapon Unleash: 0014>


if (b.isStateAffected(11)){


rate = 100;


}


</Custom Weapon Unleash: 0014>


However, that doesn't take into account something like a specific target's state (it seems to only eval users since I believe all of these rates are determined ahead of battle).


Any ideas on how I could best accomplish this, possibly outside of the plugin?


Thanks in advance! 
The mechanic you are trying to implement can be scripted into the "troops" tab, so you can have a conditional branch when "if brittle" to go for a value check, just use 2 variables to emulate 50%.


The thing is that you  might have to copy the script on all troops that you would like to be susceptible to shatter.
I tried what you are saying... something like


<Custom Weapon Unleash: 0014>


if (v[1] == 1){


rate = 100;


}


</Custom Weapon Unleash: 0014>


And then I set something in the troop tab that sets the random variable between 0 and 1 every turn. But this would mean that I wouldn't be able to mix brittle enemies and non-brittle enemies because all of them would susceptible to "shatter" or at the very least the skill would be "unleashed" unexpectedly. I wonder... is there a way to do this via the damage formula? Here is the logic:


Check if the user has weaponId[1] or weaponId[2] (I wanted a second user to have their blunt weapon be possible to shatter a skeleton as well)


Check if the target has the brittle state[11]


If so, then set v[1] = randomInt(1);  


Then normal damage formula.


This is surprisingly more complicated than one would think it would be, haha. Is the above possible from the damage formula? 
Something like this?


c = a.atk * 4 - b.def * 2; if ((a.hasWeapon($dataWeapons[1]) || a.hasWeapon($dataWeapons[2]) && b.isStateAffected[11]) {v[1] = math.randomInt(1);c} else {v[1]= 0; c}

Original thread: https://forums.rpgmakerweb.com/threads/what-is-the-best-way-to-conditionally-slay-an-enemy.71243/