RPGMZ插件-n次战败可不结局

文件名称:yx_noDie.js
/*:
 * @plugindesc n次战败可不结局
 * @author yx_
 * 
 * 
 * @param variablesId
 * @desc 指定变量id,指定值为0时死亡,默认战败一次id减1
 * @default 0
 * @type variables
 * 
 * @help
 * v1.0.0
 * 设置变量id,并指定变量数值,数值为可战败次数
 * --用途:队伍战败后,可携带队伍逃跑次数限制。
 */

(function(){
    var parameters=PluginManager.parameters('yx_noDie');
    var variablesId=Number(parameters['variablesId']||0);
    BattleManager.updateBattleEnd = function() {
        if (this.isBattleTest()) {
            AudioManager.stopBgm();
            SceneManager.exit();
        } else if (!this._escaped && $gameParty.isAllDead()) {
            if (this._canLose) {
                $gameParty.reviveBattleMembers();
                SceneManager.pop();
            } else {
                var value=$gameVariables.value(variablesId);
                if(0<value){
                    $gameVariables.setValue(variablesId,value-1)
                    $gameParty.reviveBattleMembers();
                    SceneManager.pop();
                }else{
                    SceneManager.goto(Scene_Gameover);
                }
                
            }
        } else {
            SceneManager.pop();
        }
        this._phase = "";
    };

})();

 

posted @ 2021-01-18 11:35  yx_亦心  阅读(154)  评论(0编辑  收藏  举报