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

57 lines
2.1 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.

//=============================================================================
// IM_RestrictionTargetSkill_GrayOut.js
// ----------------------------------------------------------------------------
// author : Umu
//=============================================================================
/*:
* @target MZ
* @plugindesc [v1.0.0] Grays out skills when RestrictionTargetSkill determines there are no valid targets.
* @author Umu
*
* @help RestrictionTargetSkill_GrayOut.js
*
* ◆概要
* Triacontane 氏の「RestrictionTargetSkill.js」と併用する
* 軽量なアドオンです。対象となるバトラーが 0 人の場合、
* スキル選択ウィンドウ上で当該スキルを自動で非活性
* (グレーアウト)表示にします。
*
* ◆使用方法
* 1. このプラグインを RestrictionTargetSkill.js より
* 下の位置に導入してください。
* 2. パラメータやプラグインコマンドはありません。
*
* ◆ライセンス
* 2025 Umu
*/
(() => {
'use strict';
// 既存の isEnabled 判定を拡張
const _isEnabled = Window_SkillList.prototype.isEnabled;
Window_SkillList.prototype.isEnabled = function(item) {
// 元々の条件MP不足・封印などが false ならそのまま
if (!_isEnabled.call(this, item)) return false;
const actor = this._actor;
// 戦闘中のスキル選択の場合
if (!!actor && BattleManager.isInputting()) {
if ($gameTroop._enemies.some(enemy => {
const data = enemy.enemy();
return !!data.meta['Boss'];
})) {
// Bossタグの付いた敵がいる
if (item.id === 23) {
// ボス相手に諦念は使用不可
return false;
}
}
}
// RestrictionTargetSkill のターゲット判定を流用
if (!!actor && typeof actor.isExistValidTarget === 'function') {
return actor.isExistValidTarget(item);
}
return true;
};
})();