68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
//=============================================================================
|
|
// RPG Maker MZ - Fixed Special Effect:Escape bug
|
|
//=============================================================================
|
|
|
|
/*:
|
|
* @target MZ
|
|
* @plugindesc 特殊効果:逃げるのバグ修正
|
|
* @author GrayOgre
|
|
*
|
|
* @help FixSpecialEffectEscape.js
|
|
* @help
|
|
*
|
|
* このプラグインは、味方全体に対して。スキルの特殊効果:逃げるを使用した場合、
|
|
* ゲームオーバーになるバグを修正するものです。
|
|
*
|
|
* プラグインコマンドはありません。
|
|
*
|
|
* Copyright (c) 2021 GrayOgre
|
|
* Released under the MIT license
|
|
* https://opensource.org/licenses/mit-license.php
|
|
*
|
|
*/
|
|
|
|
(() => {
|
|
const _Game_Actor_initMembers = Game_Actor.prototype.initMembers;
|
|
Game_Actor.prototype.initMembers = function () {
|
|
_Game_Actor_initMembers.call(this);
|
|
this._escaped = false;
|
|
};
|
|
|
|
const _Game_Actor_escape = Game_Actor.prototype.escape;
|
|
Game_Actor.prototype.escape = function () {
|
|
_Game_Actor_escape.apply(this, arguments);
|
|
this._escaped = true;
|
|
BattleManager._escapeMemberCount++;
|
|
};
|
|
|
|
Game_Actor.prototype.isEscaped = function () {
|
|
return this._escaped;
|
|
};
|
|
|
|
Game_Actor.prototype.resetEscape = function () {
|
|
this._escaped = false;
|
|
};
|
|
|
|
const _Sprite_Actor_updateTargetPosition =
|
|
Sprite_Actor.prototype.updateTargetPosition;
|
|
Sprite_Actor.prototype.updateTargetPosition = function () {
|
|
if (this._actor.canMove() && this._actor.isEscaped()) {
|
|
this.retreat();
|
|
} else {
|
|
_Sprite_Actor_updateTargetPosition.call(this);
|
|
}
|
|
};
|
|
|
|
const _BattleManager_initMembers = BattleManager.initMembers;
|
|
BattleManager.initMembers = function () {
|
|
_BattleManager_initMembers.call(this);
|
|
this._escapeMemberCount = 0;
|
|
$gameParty.allMembers().forEach((m) => m.resetEscape());
|
|
};
|
|
|
|
const _BattleManager_updateBattleEnd = BattleManager.updateBattleEnd;
|
|
BattleManager.updateBattleEnd = function () {
|
|
this._escaped = this._escaped || this._escapeMemberCount > 0;
|
|
_BattleManager_updateBattleEnd.call(this);
|
|
};
|
|
})();
|