diff --git a/GameLauncher.csproj b/GameLauncher.csproj index a39df75..1c9d1c8 100644 --- a/GameLauncher.csproj +++ b/GameLauncher.csproj @@ -16,6 +16,10 @@ embedded + + + + PreserveNewest diff --git a/MainWindow.xaml b/MainWindow.xaml index c068bd9..a240f93 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -1065,6 +1065,33 @@ + + + + + + + + + + + + + + + + + + diff --git a/Models/GameItemBase.cs b/Models/GameItemBase.cs index 1b141a4..f594c40 100644 --- a/Models/GameItemBase.cs +++ b/Models/GameItemBase.cs @@ -152,6 +152,9 @@ namespace GameLauncher.Models /// SRPG Studioか public virtual bool IsSrpgStudio => false; + /// プリンセスシナジー(専用改造対象のMZゲーム)か + public virtual bool IsPrincessSynergy => false; + /// RGSSアーカイブ(rgss3a/rgss2a等)を持つか public virtual bool HasRgssArchive { diff --git a/Models/TkoolGameItem.cs b/Models/TkoolGameItem.cs index 092466e..10c301e 100644 --- a/Models/TkoolGameItem.cs +++ b/Models/TkoolGameItem.cs @@ -141,6 +141,14 @@ namespace GameLauncher.Models public override bool IsSrpgStudio => EngineType == TkoolEngineType.SrpgStudio; public override bool IsRgss => EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce; + /// + /// 「プリンセスシナジー」(ツクールMZ製・専用改造対象ゲーム)かどうか。 + /// タイトルまたはフォルダ名に "プリンセスシナジー" を含み、エンジンがMZの場合のみ true。 + /// これにより当該機能が他ゲームに表示・適用されるのを防ぎます。 + /// + public override bool IsPrincessSynergy => + !string.IsNullOrEmpty(Title) && Title.Contains("プリンセスシナジー"); + // SRPG Studio アーカイブ関連プロパティ private bool _hasSrpgArchive; private bool _isSrpgExtracted; @@ -478,6 +486,41 @@ namespace GameLauncher.Models set { if (_pluginOptions != value) { _pluginOptions = value; OnPropertyChanged(); } } } + /// + /// プリンセスシナジー専用: HP常時MAX(プラグイン "AlwaysMaxHp")の有効状態。 + /// PluginSettings に直接マッピングされ、既存の改造適用パイプラインで反映されます。 + /// + public bool PrincessAlwaysMaxHp + { + get => IsPluginEnabled("AlwaysMaxHp", fallbackVal: false); + set => SetPrincessPluginSetting("AlwaysMaxHp", value); + } + + /// + /// プリンセスシナジー専用: MP常時MAX(プラグイン "AlwaysMaxMp")の有効状態。 + /// + public bool PrincessAlwaysMaxMp + { + get => IsPluginEnabled("AlwaysMaxMp", fallbackVal: false); + set => SetPrincessPluginSetting("AlwaysMaxMp", value); + } + + /// + /// プラグイン設定を更新し、関連プロパティの変更通知を発行します。 + /// + private void SetPrincessPluginSetting(string pluginId, bool value) + { + if (_pluginSettings.TryGetValue(pluginId, out var cur) && cur == value) + { + return; + } + + _pluginSettings[pluginId] = value; + OnPropertyChanged(pluginId == "AlwaysMaxHp" ? nameof(PrincessAlwaysMaxHp) : nameof(PrincessAlwaysMaxMp)); + // 連動して独自の改造設定であることを示す + HasCustomApplyMod = true; + } + public bool IsPluginEnabled(string pluginId, Dictionary? defaultSettings = null, bool fallbackVal = true) { if (_pluginSettings.TryGetValue(pluginId, out var val)) diff --git a/plugins/AlwaysMaxHp.js b/plugins/AlwaysMaxHp.js new file mode 100644 index 0000000..8d1dd84 --- /dev/null +++ b/plugins/AlwaysMaxHp.js @@ -0,0 +1,74 @@ +/*: + * @target MZ + * @plugindesc プリンセスシナジー専用: 主人公のHPを常時最大に固定する + * @author GameLauncher + * + * @help + * プリンセスシナジー(RPGツクールMZ/カードバトル)専用プラグインです。 + * + * 【分析結果】 + * 本作の戦闘は標準の Game_BattlerBase / Game_Actor のHP APIを一切使わず、 + * 独自のプレイヤー配列 NPlayer[] の _hp を直接書き換える実装になっています + * (JsScript100Set.js で NPlayer[0] = $gameActors._data[1] を参照)。 + * ダメージは JsScript79Set.js:710 で NPlayer[0]._hp -= value と直接減算され、 + * 描画は JsScript87Set.js で NPlayer[i]._hp を読みます。 + * 戦闘の毎フレーム処理は Game_Interpreter.prototype.update + * (JsScript54Set.js:91)から呼ばれる NUpdate() が担っています。 + * + * 【方式】 + * 本プラグインは戦闘の毎フレーム入口 Game_Interpreter.prototype.update を + * フックし、主人公(NPlayer[0])の _hp を毎フレーム mhp へクランプします。 + * どの経路で書き換えられても、描画前に必ず最大値へ戻ります。 + * + * 【対象範囲】 + * NPlayer[0](主人公ロマーシャ)のみ。敵(NEnemy)・他の味方(NPlayer[1]以降) + * には一切影響しません。 + * + * 【適用/解除】 + * ランチャーの改造チェック(PrincessAlwaysMaxHp)でこのプラグインの + * 適用/解除を切り替えられます(plugins.js への登録/解除)。 + */ + +(() => { + 'use strict'; + + // 主人公(NPlayer[0])のHPを最大値へクランプする + function clampHeroHp() { + if (typeof NPlayer === 'undefined' || !NPlayer || !NPlayer[0]) return; + const hero = NPlayer[0]; + const mhp = hero.mhp; + if (typeof mhp === 'number' && mhp > 0 && hero._hp !== mhp) { + hero._hp = mhp; + } + } + + // 戦闘中、毎フレーム呼ばれる Game_Interpreter.update をフック + if (Game_Interpreter.prototype.update) { + const _Game_Interpreter_update = Game_Interpreter.prototype.update; + Game_Interpreter.prototype.update = function() { + const result = _Game_Interpreter_update.apply(this, arguments); + clampHeroHp(); + return result; + }; + } + + // 毎フレームの戦闘更新(ダメージ等の直接書き換えを毎回打ち消す) + if (Game_Interpreter.prototype.DmgEffectUpdate) { + const _DmgEffectUpdate = Game_Interpreter.prototype.DmgEffectUpdate; + Game_Interpreter.prototype.DmgEffectUpdate = function() { + const result = _DmgEffectUpdate.apply(this, arguments); + clampHeroHp(); + return result; + }; + } + + // プレイヤーターン開始時の保険 + if (Game_Interpreter.prototype.BtlPLTurnSetup_Update) { + const _BtlPLTurnSetup_Update = Game_Interpreter.prototype.BtlPLTurnSetup_Update; + Game_Interpreter.prototype.BtlPLTurnSetup_Update = function() { + const result = _BtlPLTurnSetup_Update.apply(this, arguments); + clampHeroHp(); + return result; + }; + } +})(); diff --git a/plugins/AlwaysMaxMp.js b/plugins/AlwaysMaxMp.js new file mode 100644 index 0000000..902348c --- /dev/null +++ b/plugins/AlwaysMaxMp.js @@ -0,0 +1,84 @@ +/*: + * @target MZ + * @plugindesc プリンセスシナジー専用: 主人公のMPを常時最大に固定する + * @author GameLauncher + * + * @help + * プリンセスシナジー(RPGツクールMZ/カードバトル)専用プラグインです。 + * + * 【分析結果】 + * 本作の戦闘は標準の Game_BattlerBase / Game_Actor のMP APIを一切使わず、 + * 独自のプレイヤー配列 NPlayer[] の _mp を直接書き換える実装になっています + * (JsScript100Set.js で NPlayer[0] = $gameActors._data[1] を参照)。 + * カードコストは JsScript72Set.js:119 で NPlayer[0]._mp -= Cost と直接減算 + * され、毎ターン減少や回復(上限9クランプ)も直接書き換えです。 + * 戦闘の毎フレーム処理は Game_Interpreter.prototype.update + * (JsScript54Set.js:91)から呼ばれる NUpdate() が担っています。 + * + * 【方式】 + * 本プラグインは戦闘の毎フレーム入口 Game_Interpreter.prototype.update を + * フックし、主人公(NPlayer[0])の _mp を毎フレーム mmp へクランプします。 + * どの経路で書き換えられても、描画前に必ず最大値へ戻ります。 + * + * 【対象範囲】 + * NPlayer[0](主人公ロマーシャ)のみ。敵(NEnemy)・他の味方(NPlayer[1]以降) + * には一切影響しません。 + * + * 【適用/解除】 + * ランチャーの改造チェック(PrincessAlwaysMaxMp)でこのプラグインの + * 適用/解除を切り替えられます(plugins.js への登録/解除)。 + */ + +(() => { + 'use strict'; + + // 主人公(NPlayer[0])のMPを最大値へクランプする + function clampHeroMp() { + if (typeof NPlayer === 'undefined' || !NPlayer || !NPlayer[0]) return; + const hero = NPlayer[0]; + const mmp = hero.mmp; + if (typeof mmp === 'number' && mmp > 0 && hero._mp !== mmp) { + hero._mp = mmp; + } + } + + // 戦闘中、毎フレーム呼ばれる Game_Interpreter.update をフック + if (Game_Interpreter.prototype.update) { + const _Game_Interpreter_update = Game_Interpreter.prototype.update; + Game_Interpreter.prototype.update = function() { + const result = _Game_Interpreter_update.apply(this, arguments); + clampHeroMp(); + return result; + }; + } + + // 毎フレームの戦闘更新(カードコスト等の直接書き換えを毎回打ち消す) + if (Game_Interpreter.prototype.DmgEffectUpdate) { + const _DmgEffectUpdate = Game_Interpreter.prototype.DmgEffectUpdate; + Game_Interpreter.prototype.DmgEffectUpdate = function() { + const result = _DmgEffectUpdate.apply(this, arguments); + clampHeroMp(); + return result; + }; + } + + // プレイヤーターン開始時の保険 + if (Game_Interpreter.prototype.BtlPLTurnSetup_Update) { + const _BtlPLTurnSetup_Update = Game_Interpreter.prototype.BtlPLTurnSetup_Update; + Game_Interpreter.prototype.BtlPLTurnSetup_Update = function() { + const result = _BtlPLTurnSetup_Update.apply(this, arguments); + clampHeroMp(); + return result; + }; + } + + // 本作のMP回復は上限9でクランプされるため、回復後にも最大値へ戻す + if (Game_Interpreter.prototype.MPKaihuku) { + const _MPKaihuku = Game_Interpreter.prototype.MPKaihuku; + Game_Interpreter.prototype.MPKaihuku = function() { + const result = _MPKaihuku.apply(this, arguments); + clampHeroMp(); + return result; + }; + } +})();