magical-girls-runa-and-nanami/js/plugins/no_preg.js
2026-02-28 12:33:13 -06:00

59 lines
1.9 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 変数55が4以上 または 変数40が0 のとき、スキル336を使用不可灰色表示 v1.1
* @author You
* @help
* ■仕様
* - 戦闘中・メニュー画面どちらでも有効です。
* - 条件を満たさない場合(=使用不可条件を満たす場合)は、
* スキル336はスキルリストに表示されますが灰色で選択不可になります。
* - 通常のMP/TP/ステート判定は引き続き有効です。
*
* @param SkillId
* @text 対象スキルID
* @type number
* @default 336
*
* @param VarA
* @text 変数Aしきい値以上で使用不可
* @type variable
* @default 55
*
* @param VarA_Min
* @text 変数Aのしきい値
* @type number
* @default 4
*
* @param VarB
* @text 変数B特定値で使用不可
* @type variable
* @default 40
*
* @param VarB_DisableValue
* @text 変数Bがこの値のとき使用不可
* @type number
* @default 0
*/
(() => {
"use strict";
const P = PluginManager.parameters(document.currentScript.src.match(/([^\/]+)\.js$/)?.[1] || "");
const SKILL_ID = Number(P.SkillId || 336);
const VAR_A = Number(P.VarA || 55);
const VAR_A_MIN = Number(P.VarA_Min || 4);
const VAR_B = Number(P.VarB || 40);
const VAR_B_DISABLE = Number(P.VarB_DisableValue || 0);
const _Game_BattlerBase_canUse = Game_BattlerBase.prototype.canUse;
Game_BattlerBase.prototype.canUse = function(item) {
if (DataManager.isSkill(item) && item.id === SKILL_ID && this.isActor && this.isActor()) {
const a = $gameVariables.value(VAR_A);
const b = $gameVariables.value(VAR_B);
// 条件変数55が4以上 または 変数40が0
if (a >= VAR_A_MIN || b === VAR_B_DISABLE) {
return false; // 灰色で選択不可
}
}
return _Game_BattlerBase_canUse.call(this, item);
};
})();