A Skill that gives buffs in exchange for debuffs?

Hello! Is there a way to create a skill that gives you a random buff in exchange for a random debuff? I'm designing a gambler-style class and thought it'd be interesting to have a move like this. I've seen threads where you can make random buffs and random debuffs but they're mostly MV stuff. Is there a script or plugin way to do this in MZ? Thanks in advance! <3
Does this work (assuming you want to target self) or is this bullsh*t?

let params = [0,1,2,3,4,5,6,7];
let random = Math.randomInt(8);
BattleManager._subject.addBuff(params[random], 3);
params.splice(random, 1);
random = Math.randomInt(7);
BattleManager._subject.addDebuff(params[random], 3);

EDIT:
Unless I misunderstood your question. I just read it like add buff and (different) debuff.
Oh shoot, I forgot to say the target! Sorry!

Yeah, way I was envisioning it, it only affects the user. Though I was also considering a version that could be aimed towards other Actors, as a kind of support thing.

Well, pretty sure I messed up something.
Yeah, it works for me inside VisuStella action sequence, but not if I just run a common event on the skill.

Change the BattleManager._subject reference to: $gameActors.actor($gameVariables.value(X))
(set variable X to last actor id to act with event command before the script)
Ah, I wasn't using Visustella. It is on my shopping list, but I'll try the common event route first to see if I can get it to do what I want!
OMG!!!! It worked!!!! The common event worked! Thank you so much rpgLord!!!!

1742686823800.png
1742686807340.png

Original thread: https://forums.rpgmakerweb.com/threads/a-skill-that-gives-buffs-in-exchange-for-debuffs.176440/