Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Maliki's State Categories EX
- // Mal_StateCategories_Ext_add_debuff.js
- // version 1.0
- //=============================================================================
- /*:
- * @plugindesc This plugin allows debuffs to be included when removing State Categories
- * @author Maliki79
- *
- * @help Version 1.0
- * You will need YanFly's State Categories Plugin as well as any accompanying plugins.
- * This plugin is plug and play.
- * Just put it right under the State Categories one and you're go to go!
- *
- * To use, add battler.removeStateDebuffCategory('text', x);
- * with text being the category name (dont forget the quote marks (' ')) and x being
- * the number of states or debuffs to remove.
- * The plugin will pick x number of states/debuffs and remove them.
- * YF's plugin removed them in a specific order, but this one will remove a random state/debuff.
- * (By the way, if you want to only remove a Debuff, do the call with a category name you
- * are NOT using.)
- */
- Game_Battler.prototype.removeStateDebuffCategory = function(category, count) {
- category = category.toUpperCase().trim();
- count = count || 0;
- var states = JsonEx.makeDeepCopy(this._states);
- var buffs = JsonEx.makeDeepCopy(this._buffs);
- var states2 = [];
- var length = states.length;
- var value = 0;
- for (var i = 0; i < length; ++i) {
- var id = states[i];
- var state = $dataStates[id];
- if (!state) continue;
- if (state.category.contains(category)) states2.push("s," + id);
- }
- for (var i = 0; i < buffs.lenght; i++) {
- if (buffs[i] < 0) states2.push("b," + i);
- }
- for (var i = 0; i < count; i++) {
- if (states2 === [] ) continue;
- var pick2 = Math.randomInt(states2.length);
- var pick = states2[pick2].split(",");
- if (pick[0] === "s") {
- this.removeState(pick[1]);
- } else {
- this.removeBuff(pick[1]);
- }
- states2.splice(pick2, 1);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement