States that affect params randomly when attacking/attacked

Kind of an unusual case here. I'm looking to implement two states:

State 1: An actor with this state will have a 50% chance to do double physical (element) damage when they attack, or 50% chance to do none.

State 2: Similar, but kind of inverse. An actor with this state will have a 50% chance to take double physical damage when attacked, or 50% chance to take half.
You can use VisuStella's Battle Core (oops, edit) or you could use:

1709236696791.png
You don't say if you're using any plugins, but using VisuStella's Battle Core:

State 1:
Code:
<JS Pre-Apply as User>
if (this.isDamage() && this.isPhysical())
    value = Math.random()>.5 ? value * 2 : 0;
</JS Pre-Apply as User>

State 2:
Code:
<JS Pre-Apply as Target>
if (this.isDamage() && this.isPhysical())
    value = Math.random()>.5 ? value * 2 : 0;
</JS Pre-Apply as Target>

You can use yanfly's buffs and states core
Except the OP is using MZ 😉
You don't say if you're using any plugins, but using VisuStella's Battle Core:

Oops, I keep forgetting. Yes, I'm using VS Battle Core.

Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/states-that-affect-params-randomly-when-attacking-attacked.166319/