/*---------------------------------------------------------------------------* * Torigoya_AddStateSkill.js *---------------------------------------------------------------------------* * 2020/06/20 ru_shalm * http://torigoya.hatenadiary.jp/ *---------------------------------------------------------------------------*/ /*: * @plugindesc add/remove state to subject when using the skill * @author ru_shalm * * @help * * Skill Note: * # add state[1] when using the skill * # remove state[2] when using the skill */ /*:ja * @plugindesc スキル使用時に使用者にステートを追加/削除できるようにします * @author ru_shalm * * @help * * スキルのメモ: * # スキル使用時にステート1番(戦闘不能)を付与 * # スキル使用時にステート2番と3番を付与 * # スキル使用時にステート2番(防御)を解除 */ (function (global) { 'use strict'; var AddStateSkill = { name: 'Torigoya_AddStateSkill' }; AddStateSkill.addState = function () { if (!this._action) return 0; var stateIds = this._action.item() ? this._action.item().meta['AddState'] : null; if (stateIds && this._subject.isAlive()) { stateIds.split(/\s*,\s*/).filter(Boolean).forEach(function (id) { this._subject.addState(~~id); }.bind(this)); return 1; } else { return 0; } }; AddStateSkill.removeState = function () { if (!this._action) return 0; var stateIds = this._action.item() ? this._action.item().meta['RemoveState'] : null; if (stateIds) { stateIds.split(/\s*,\s*/).filter(Boolean).forEach(function (id) { this._subject.removeState(~~id); }.bind(this)); return 1; } else { return 0; } }; var upstream_BattleManager_endAction = BattleManager.endAction; BattleManager.endAction = function () { var n = AddStateSkill.addState.apply(this) + AddStateSkill.removeState.apply(this); if (n > 0) { this._logWindow.displayAutoAffectedStatus(this._subject); if (this._subject.isDead()) { this._subject.performCollapse(); } } upstream_BattleManager_endAction.apply(this); }; // ------------------------------------------------------------------------- global.Torigoya = (global.Torigoya || {}); global.Torigoya.AddStateSkill = AddStateSkill; })(window);