57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
/*:
|
|
* @target MZ
|
|
* @plugindesc v1.1 プレイヤーの次ターンのみスキップ(敵は通常行動)
|
|
* @author IvI
|
|
*
|
|
* @command SkipNextTurn
|
|
* @text プレイヤーターンをスキップ
|
|
* @desc 次ターンのプレイヤー入力と行動を飛ばして敵フェーズへ。
|
|
*
|
|
* @help SkipNextPlayerTurn.js
|
|
* ----------------------------------------------------
|
|
* ■ 使い方
|
|
* バトルイベント(例:ターン終了)で
|
|
* ▶ SkipNextTurn
|
|
* を呼ぶと次ターンだけプレイヤーをスキップします。
|
|
* パーティは 1 人を想定しています。
|
|
* ----------------------------------------------------
|
|
* v1.1 敵の行動も飛んでしまう不具合を修正
|
|
* ----------------------------------------------------
|
|
*/
|
|
|
|
(() => {
|
|
"use strict";
|
|
|
|
const PLUGIN_NAME = "SkipNextPlayerTurn";
|
|
|
|
// --------------------------------------------------
|
|
// プラグインコマンド
|
|
// --------------------------------------------------
|
|
PluginManager.registerCommand(PLUGIN_NAME, "SkipNextTurn", () => {
|
|
if ($gameParty.inBattle()) {
|
|
$gameTemp._skipNextPlayerTurn = true;
|
|
}
|
|
});
|
|
|
|
// --------------------------------------------------
|
|
// BattleManager.startInput の拡張
|
|
// --------------------------------------------------
|
|
const _BM_startInput = BattleManager.startInput;
|
|
BattleManager.startInput = function () {
|
|
if ($gameTemp._skipNextPlayerTurn) {
|
|
$gameTemp._skipNextPlayerTurn = false; // 1 度きり
|
|
|
|
// ─ プレイヤー(先頭アクター)を行動なしに
|
|
const actor = $gameParty.members()[0];
|
|
if (actor) actor.clearActions();
|
|
|
|
// ─ 敵に行動を決めさせる
|
|
$gameTroop.members().forEach(enemy => enemy.makeActions());
|
|
|
|
// ─ 入力フェーズを飛ばし、そのままターン処理へ
|
|
this.startTurn();
|
|
return;
|
|
}
|
|
_BM_startInput.call(this);
|
|
};
|
|
})();
|