Andars 'solution' is somewhat overly elaborate...
Code:
a.buff(Math.round(Math.random() * 8));
Use that as part of the skill formula..
The `Math.round(Math.random() * 8)` gets a random stat id between 0-7. the .buff() triggers a buff for that given stat id, and the a. reffers to the attacker using the skill/item.
Happy gaming :*
Edit:
There are other functions which might be more suitable..
Code:
a.increaseBuff(id);
a.overwriteBuffTurns(id, turnCount);
increaseBuff takes into account if the max buff is already applied (where buff() wouldnt) and overwriteBuffTurns() takes a second argument for the number of turns the buff should last..
for an easy way to create incredibly complex skill formulas, see
this post! :*
Edit edit: after double checking, the .buff() call just returns the level of the current buff for that id. so i'd recommend using the increaseBuff function after all lol, and also the overwrite function if you need to set the turn count
😛