prison-brave/js/plugins/IM_AnimToCommon.js
2025-08-28 10:38:20 -05:00

59 lines
No EOL
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*:
* @target MZ
* @plugindesc ヒット時のみダメージ計算前にカットインCE v1.1
* @author Umu
* @help
* スキル/アイテムのメモ欄に <HitCutinCE:123> の形で記述。
* 123 は再生したい共通イベントID。マルチターゲットでも 1 回だけ再生します。
* 利用自由。
*/
(() => {
"use strict";
const TAG = /<HitCutinCE\s*:\s*(\d+)>/i;
//―― ① ヒット確定後Game_Action.applyでログに Cutin を差し込む
const _apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function (target) {
_apply.call(this, target);
if (!this._cutinQueued && target.result().isHit()) {
const m = this.item().note.match(TAG);
if (m) {
BattleManager._logWindow.push("performCutin", Number(m[1]));
this._cutinQueued = true; // 1アクション1回
}
}
};
//―― ② ログウィンドウに Cutin コマンドを実装
Window_BattleLog.prototype.performCutin = function (ceId) {
this._cutinInterpreter = new Game_Interpreter();
this._cutinInterpreter.setup($dataCommonEvents[ceId].list);
this.setWaitMode("cutin");
};
//―― ③ 待機処理Interpreter が走っている間 Busy を維持
const _updateWait = Window_BattleLog.prototype.updateWait;
Window_BattleLog.prototype.updateWait = function () {
if (this._waitMode === "cutin") {
if (this._cutinInterpreter.isRunning()) {
this._cutinInterpreter.update();
return true; // まだ実行中なのでウェイト
}
this._cutinInterpreter = null; // 終了
this._waitMode = "";
}
return _updateWait.call(this);
};
//―― ④ push された "performCutin" を実行できるように callNextMethod を拡張
const _callNext = Window_BattleLog.prototype.callNextMethod;
Window_BattleLog.prototype.callNextMethod = function () {
const method = this._methods[0];
if (method && method.name === "performCutin") {
this.performCutin(...method.params);
this._methods.shift();
} else {
_callNext.call(this);
}
};
})();