//=============================================================================
// HealOnLevelUp_MZ.js
// 功能:在角色升级时恢复血量和魔法值
// 作者:为你编写
// 最后更新:当前日期
//=============================================================================
/*:
* @target MZ
* @plugindesc 角色升级时恢复血量和魔法值,可选择恢复所有队员或特定队员
* @author 新作者
*
* @param HealAllHP
* @text 全体恢复HP
* @desc 是否让所有队员升级时恢复HP (Y/N)
* @default Y
*
* @param HealAllMP
* @text 全体恢复MP
* @desc 是否让所有队员升级时恢复MP (Y/N)
* @default Y
*
* @param RemoveAllStates
* @text 全体清除状态
* @desc 是否让所有队员升级时清除状态 (Y/N)
* @default Y
*
* @help
* 插件使用说明:
* - 此插件可让角色在升级时恢复血量和魔法值,还能清除状态。
* - 若只想让部分角色具有这些效果,可在角色备注栏添加以下标签:
*
*
*
*
* 插件命令:无
*/
(() => {
// 获取插件参数
const parameters = PluginManager.parameters('HealOnLevelUp_MZ');
const healAllHP = (parameters['HealAllHP'] || 'Y').toUpperCase() === 'Y';
const healAllMP = (parameters['HealAllMP'] || 'Y').toUpperCase() === 'Y';
const removeAllStates = (parameters['RemoveAllStates'] || 'Y').toUpperCase() === 'Y';
// 保存原始的 Game_Actor.prototype.levelUp 方法
const _Game_Actor_levelUp = Game_Actor.prototype.levelUp;
// 重写 Game_Actor.prototype.levelUp 方法
Game_Actor.prototype.levelUp = function() {
// 调用原始的升级方法
_Game_Actor_levelUp.call(this);
// 检查是否需要恢复 HP
if (healAllHP || this.actor().meta.LUHealHP) {
this.setHp(this.mhp);
}
// 检查是否需要恢复 MP
if (healAllMP || this.actor().meta.LUHealMP) {
this.setMp(this.mmp);
}
// 检查是否需要清除状态
if (removeAllStates || this.actor().meta.LUHealStates) {
this.clearStates();
}
};
})();