I'd suggest storing the value on the affected battler:
Code:
<Custom Apply Effect>
user._sunder = origin.atk;
user.addParam(3, -user._sunder);
</Custom Apply Effect>
<Custom Remove Effect>
user.addParam(3, user._sunder);
delete user._sunder;
</Custom Remove Effect>
Note that there are some caveats with Buffs & States stuff: the notetags only process when in battle, and the remove effect will not run if the state is removed via State Resist. (There may be other cases, too.)
origin should work for referencing the caster, I'll go do some tests...
Edit: yep, looks OK for me!
😂
Looks like LTBS is breaking stuff again...sigh
😔
I just noticed a bug where states aren't ticking at all. Like the turns remaining stay the same as when they're applied...
I might just have to start the project over and slowly import stuff since I have no idea what's the root cause of this.
Edit: Omg, I found the issue... In the YEP_BattleEngineCore.js settings, I had it set to
stb (what I was using before installing LTBS) and never changed it back to
dtb when I removed YEP_X_BattleSysSTB.js.
I only found out cuz I was partway through redoing my entire project from scratch! No wonder I was experiencing so many bugs...
I'd suggest storing the value on the affected battler:
Code:
<Custom Apply Effect>
user._sunder = origin.atk;
user.addParam(3, -user._sunder);
</Custom Apply Effect>
<Custom Remove Effect>
user.addParam(3, user._sunder);
delete user._sunder;
</Custom Remove Effect>
Note that there are some caveats with Buffs & States stuff: the notetags only process when in battle, and the remove effect will not run if the state is removed via State Resist. (There may be other cases, too.)
origin should work for referencing the caster, I'll go do some tests...
Edit: yep, looks OK for me!
😂
Wait when you tested it, did origin actually use the caster's stats? Cuz I just copy-pasted Yanfly's Unstable Affliction spell and the damage dealt is using the target's MAT and not the caster's MAT...
This whole issue with "origin" not working seems to be related to LTBS as a whole...