45 lines
2.3 KiB
JavaScript
45 lines
2.3 KiB
JavaScript
/*:
|
|
* @target MZ
|
|
* @plugindesc パーティが1人以下ならアクター選択をスキップし、先頭アクターを即決定します。複数人いれば通常選択。
|
|
* @author
|
|
*
|
|
* @help
|
|
* =============================================================================
|
|
* ■ 概要
|
|
* =============================================================================
|
|
* - スキルやアイテムで味方を対象にするとき、MZ標準では
|
|
* Scene_Battle.prototype.startActorSelection が呼ばれて
|
|
* アクター選択ウィンドウ(_actorWindow)が表示されます。
|
|
* - このプラグインは、パーティ人数が1人以下の場合は
|
|
* startActorSelection を上書きして即座に先頭アクターを決定し、
|
|
* ウィンドウを開かずにスキップします。
|
|
* - パーティが複数人いる場合は通常通りアクター選択ウィンドウを表示。
|
|
*
|
|
* ■ 使い方
|
|
* 1) このファイルを「IM_BattleSingleActorSkip.js」として js/plugins フォルダに置く。
|
|
* 2) プラグイン管理でON (他のバトル系プラグインよりも下に配置すると確実)。
|
|
* 3) これだけでは「ステータスウィンドウのレイアウト」は変えません。
|
|
* ステータスを1人用にするなどは別プラグインで行ってください。
|
|
*/
|
|
|
|
(() => {
|
|
"use strict";
|
|
|
|
//--------------------------------------------------------------------------
|
|
// ■ Scene_Battle.prototype.startActorSelection
|
|
//--------------------------------------------------------------------------
|
|
// MZ標準だとスキル・アイテム使用時に「アクター選択ウィンドウを開く」処理。
|
|
// ここを上書きして、パーティが1人しかいなければ自動決定→onActorOk()
|
|
const _Scene_Battle_startActorSelection = Scene_Battle.prototype.startActorSelection;
|
|
Scene_Battle.prototype.startActorSelection = function() {
|
|
// パーティ人数1人以下ならスキップ
|
|
if ($gameParty.members().length <= 1) {
|
|
$gameParty.setTargetActor($gameParty.members()[0]);
|
|
this.onActorOk(); // 自動決定(ウィンドウを開かない)
|
|
} else {
|
|
// 通常処理
|
|
_Scene_Battle_startActorSelection.call(this);
|
|
}
|
|
};
|
|
|
|
})();
|