Eval Collection: Shuffle

Suffle Option Kostenlose Icons

(Requested here)  (Picture Source)


Shuffle is a skill that will take all the states that are currently on the battle field and randomly assign them to each battle participant. There are two rules to Shuffle:

  1. A battler cannot be given the same state that was taken from them.
  2. The duration of the states will carry over.


  • YEP_BuffsStatesCore.js
  • YEP_AutoPassiveStates.js
  • YEP_SkillCore.js



First you’ll want to create your Shuffle skill. Change its Scope to User.

Then you’ll have to use this notetag:

<After Eval>
// These arrays will store the collected states and their durations.
var states = [];
var statesDuration = [];
// Collect all states on the field
for (var i = 0; i < $gameTroop.aliveMembers().length; i++) {
var enemy = $gameTroop.aliveMembers()[i];
// This array will contain all the states that were taken from this battler.
enemy._excludeShuffle = [];
if (enemy) {
for (j = 0; j < enemy.states().length; j++) {
var state = enemy.states()[j];
if (state && !enemy.isPassiveStateAffected(state.id)) {
statesDuration[state.id] = enemy.stateTurns(state.id);

for (var i = 0; i < $gameParty.aliveMembers().length; i++) {
var actor = $gameParty.aliveMembers()[i];
// This array will contain all the states that were taken from this battler.
actor._excludeShuffle = [];
if (actor) {
for (j = 0; j < actor.states().length; j++) {
var state = actor.states()[j];
if (state && !actor.isPassiveStateAffected(state.id)) {
statesDuration[state.id] = actor.stateTurns(state.id);

// This array will contain all the current battlers on the field.
var allBattlers = [];
for (var k = 0; k < $gameParty.battleMembers().length; k++) {
for (var l = 0; l < $gameTroop._enemies.length; l++) {

// This loop will assign the states

while (states.length > 0) {
var random = Math.floor(allBattlers.length * Math.random());
var randomState = Math.floor(states.length * Math.random());
if (allBattlers[random]._excludeShuffle.indexOf(states[randomState].id) === -1) {
allBattlers[random].setStateTurns(states[randomState].id, statesDuration[states[randomState].id]);
states.splice(randomState, 1);
} else {
</After Eval>

And that’s all. There’s nothing that you have to change in there, so you can just paste it and it will (or should) work.



3 thoughts on “Eval Collection: Shuffle

  1. How can I prevent obtaining death status?
    We also got the death situation of Butler, the dead Butler has come alive and the living Butler dies.


      1. Thank you for your reply.
        I was waiting.
        I modified the code so that I do not get the death state of the enemy, but it was difficult for me.


Write a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s