Random buff and debuff skill

Does anyone know of a good way to create a skill that applies two random buffs and a debuff?

For example. A skill gives the user 3 turns of buff attack and agility but debuffs luck. Then is used again and applies a different set of buffs and debuffs.

I am using the Yanfly engine if that helps. It is probably better than making an array in the battle formula which is the only way I really know.

Bonus: It is never the same buff that get's applied twice.
I am using the Yanfly engine if that helps. It is probably better than making an array in the battle formula which is the only way I really know.

Bonus: It is never the same buff that get's applied twice.
you can try making the skill have this tag. I removed max hp and mp, but if you want those you can just add 0 and 1 to the array
Code:
<After Eval>
var buffs = [2,3,4,5,6,7];
buffs = buffs.sort(() => 0.5 - Math.random());

user.addBuff(buffs[0], 3);
user.addBuff(buffs[1], 3);
user.addDebuff(buffs[2], 3);
</After Eval>
Ah, I love it when code is so simple.

The only thing is. What would you use instead of user? Is there some way you can make it reflect the skills target that is set (Target an ally, Target a foe, Target everyone)?

I know a is for actor and b is for enemy in the battle formula but wasn't sure if it can be used in Eval
I know a is for actor and b is for enemy in the battle formula but wasn't sure if it can be used in Eval
Most yanfly plugins allow you to use "user" and "target" to automatically have the code refer to some battler the same way a and b does in damage formulas. a and b still work too, but im just used to using user/target in notetags and a/b in formulas
if this skill was intended to only ever be used as a self targeting skill, you dont have to change the code at all. if you wanted for the user to be able to use that with any other scope, then you can change the "user" in every line to "target". (you can also do that anyway if its meant to be user only. in a self targeting skill, user == target)
Thanks for the little mini-lesson 🙂 Target does work. I'll have to get more used to using Yanfly's system since there are a lot of features I am sleeping on. Thanks for all your help.

Original thread: https://forums.rpgmakerweb.com/threads/random-buff-and-debuff-skill.162435/