/*:
* @target MZ
* @plugindesc 战斗胜利后不显示结算窗口直接返回地图
* @author 豆包编程助手
* @url https://doubao.com
*
* @help
* 这个插件允许你在战斗胜利后跳过结算窗口,直接返回地图。
*
* 插件参数:
* - 保留EXP和金钱动画: 如果你希望在返回地图前显示获得EXP和金钱的浮动动画,可以启用此选项。
* - 显示战斗结束消息: 如果你希望在返回地图前显示"战斗胜利!"消息,可以启用此选项。
*
* 插件命令:
* - 设置跳过结算: 可以在游戏中动态启用或禁用跳过结算功能。
*
* 注意事项:
* - 如果启用了"保留EXP和金钱动画",则会显示获得EXP和金钱的浮动动画,
* 但不会显示详细的结算窗口。
* - 如果启用了"显示战斗结束消息",则会在返回地图前显示战斗结束消息。
*/
(() => {
'use strict';
// 插件参数定义
const pluginName = 'BattleResultSkip';
const parameters = PluginManager.parameters(pluginName);
// 参数解析
const keepExpMoneyAnimation = parameters['保留EXP和金钱动画'] === 'true';
const showBattleEndMessage = parameters['显示战斗结束消息'] === 'true';
// 用于存储是否跳过结算的标志
let shouldSkipResult = true;
// 插件命令注册
PluginManager.registerCommand(pluginName, "设置跳过结算", args => {
shouldSkipResult = args.enabled === 'true';
});
// 拦截战斗结束处理函数
const _BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
if (shouldSkipResult) {
// 处理获得的EXP和金钱
this._rewards.exp = this._expTotal;
this._rewards.gold = this._goldTotal;
// 如果保留动画,则显示获得EXP和金钱的浮动文本
if (keepExpMoneyAnimation) {
this.displayExp();
this.displayGold();
}
// 如果显示战斗结束消息,则显示消息
if (showBattleEndMessage) {
this.displayVictoryMessage();
}
// 直接返回地图
this.processAbort();
} else {
// 执行默认的胜利处理
_BattleManager_processVictory.call(this);
}
};
// 防止显示结算窗口
const _Scene_Battle_createResultWindow = Scene_Battle.prototype.createResultWindow;
Scene_Battle.prototype.createResultWindow = function() {
if (!shouldSkipResult) {
_Scene_Battle_createResultWindow.call(this);
}
};
// 防止显示战斗结束后的评价
const _BattleManager_displayTrophies = BattleManager.displayTrophies;
BattleManager.displayTrophies = function() {
if (!shouldSkipResult) {
_BattleManager_displayTrophies.call(this);
}
};
})();