Passive effect: Iron Arm Style

Hello.

I'm currently doing the skills for my game and there's one thing I'm missing. One of my skills is the "Iron Arm Style" a passive effect. When the affected battler do a physical attack and manage to apply the "stun" state he gets a atack buff.

If it was a active skill I could work it out, but as a passive I can't find a solution that works. If someone know how make a state check if the battler managed to apply a state I would be thankful.
I'd suggest using Yanfly's Buffs & States Core plugin for its <Custom Apply Effect> notetag. ^_^

Put something like this in your Stun state's notebox:
Code:
<Custom Apply Effect>
if (origin && origin.isStateAffected(50)) {
  origin.addBuff(2, 3);
}
</Custom Apply Effect>
Replace 50 with the ID of your "Iron Arm" state and 3 with the number of turns you want the atk buff to last. Alternatively you can make it apply a state instead, just replace the addBuff line with this (where 123 should be replaced with the ID of the state you want to add):
Code:
  origin.addState(123);

Some explanation: the apply effect is run when this state, Stun, is applied. origin is the battler that applied the state. The if statement checks two things: does origin exist (just in case the stun was applied by event or something) and if so are they affected by the "Iron Arm" state (state #50). The addBuff method's two inputs are parameter ID (0 = mhp, 1 = mmp, 2 = atk, etc) and buff duration in turns.
Thanks. I don't know how I didn't think about changing the stun state. x_x

Original thread: https://forums.rpgmakerweb.com/threads/passive-effect-iron-arm-style.95054/