TABLE OF CONTENTS

仮RPGの進捗ノート20240902-20240908

仮RPGの進捗を記載するノートです。20240902-20240908分。

Sep 8, 2024

はじめに

日々の進捗をメモしています。
 

20240902 バトル時、現在の行動者と実行内容を変数のリストに追加する

 
バトルのスキルで、行動順序や並びによって、効果が変動するようなスキルを考えたい。
 
例えば
  • 自分が連続で攻撃した場合、徐々に攻撃力が上がっていくスキル
  • 自分のターンの後ろに味方のターンがある場合まとめて回復できるスキル
など
 
これを実現するために、行動者と実行内容を管理する変数を準備したい。
 

プラグインを作成した「TT_BattleActionLogger.js」

 
//============================================================================= // TT_BattleActionLogger.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/02 // // Version // 1.1.0 2024/09/02 連続ターン数取得プラグインコマンドを追加 // 1.0.0 2024/09/02 初版 // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc バトル行動ログを指定の変数に保存します。 (Version 1.1.0) * @author たくろう_りらっくすーぷ * * @param LogVariableId * @text ログ保存変数ID * @type variable * @desc バトル行動ログを保存する変数のID * @default 25 * * @param EnableConsoleLog * @text コンソールログ出力 * @type boolean * @desc コンソールにログを出力するかどうか * @default true * * @help バトル中の行動をログとして記録します。 (Version 1.1.0) * * ◆プラグインパラメーター *  バトルログを保存する変数 *    ここで指定した変数にバトル中の行動をログとして記録します。 *    デフォルト:25 * *  コンソールログ出力 *    trueの場合、コンソールにログを出力します。 *    デフォルト:true * * ◆プラグインコマンド *  GetConsecutiveTurns 変数ID *    自分のターンが何回連続しているかを取得し、指定した変数IDに代入します。 *    例:GetConsecutiveTurns 1 *   * ◆注意 *  連続ターン数はバトル終了時にリセットされます。 *   */ (function() { 'use strict'; var parameters = PluginManager.parameters('TT_BattleActionLogger'); var logVariableId = Number(parameters['LogVariableId'] || 25); var enableConsoleLog = (parameters['EnableConsoleLog'] || 'true') === 'true'; var _BattleManager_initMembers = BattleManager.initMembers; BattleManager.initMembers = function() { _BattleManager_initMembers.call(this); this.consecutiveTurns = 0; }; var _BattleManager_startAction = BattleManager.startAction; BattleManager.startAction = function() { _BattleManager_startAction.call(this); this.logAction(); this.updateConsecutiveTurns(); }; BattleManager.updateConsecutiveTurns = function() { if (this._subject.isActor()) { this.consecutiveTurns++; } else { this.consecutiveTurns = 0; } }; BattleManager.logAction = function() { var subject = this._subject; var action = subject.currentAction(); if (subject && action) { var log = { turn: $gameTroop.turnCount(), name: subject.name(), isEnemy: subject.isEnemy(), actionType: this.getActionType(action), skillId: action.isSkill() ? action.item().id : 0, consecutiveTurns: this.consecutiveTurns }; var logList = $gameVariables.value(logVariableId) || []; logList.push(log); $gameVariables.setValue(logVariableId, logList); if (enableConsoleLog) { console.log('行動ログ:', JSON.stringify(log, null, 2)); } } }; BattleManager.getActionType = function(action) { if (action.isAttack()) return "攻撃"; if (action.isGuard()) return "防御"; if (action.isSkill()) return "スキル"; if (action.isItem()) return "アイテム"; return "その他"; }; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'GetConsecutiveTurns') { var variableId = Number(args[0]); $gameVariables.setValue(variableId, BattleManager.consecutiveTurns); } }; })();
 
これで指定した変数にバトルログか貯まっていくようになった。
 

 

20240902 スキルアイテム発動前コモンプラグイン

 
スキル実施前に変数の値を取得したい。
下記プラグインを導入した。
 
発動前コモン - BeforeCommon.js - #ツクプラ
https://plugin.fungamemake.com/archives/2033
 
プラグイン設定画面
プラグイン設定画面
 

試しに実行してみる

 
スキルに発動前コモンを設定する
スキルに発動前コモンを設定する
紐付けたコモンスキル
紐付けたコモンスキル
 
対象のスキルを実行してみる。
 
 
スキル実行前にコモンイベントが実行されていることを確認出来た。
 

 

20240902 見方のターンが連続する度に攻撃力が20%上昇し最大で500%上昇するスキル「コンボブースト」

 
表題のスキルを考えてみる。
 
変数51に連続ターン数が入っているとする
Math.min((変数×0.2),5)
変数による上昇割合と5を比較して小さい方、つまり最大で5になる
a.atk * 4 * ( 1 + Math.min((変数×0.2),5)) - b.def * 2
※上がり幅があまり感じられなかったので途中で変更した
 
その通りに設定してみた。
スキル「コンボブースト」
スキル「コンボブースト」
 
発動前コモンで現在の味方連続攻撃回数を取得する。
 
味方の連続ターン数を取得して変数51に格納している
味方の連続ターン数を取得して変数51に格納している
 
上記「TT_BattleActionLogger.js」で設定したプラグインコマンドによって取得している。
 
取得した変数51の数値=味方の連続ターン数を使って、ダメージ計算式を書く。
a.atk * 4 * ( 1 + Math.min((v[51]*0.2),5)) - b.def * 2
 
これで味方ターン数が連続すればするほど強くなるスキルが出来た。
 
徐々に攻撃力が上がっていく
徐々に攻撃力が上がっていく
 
あまり気持ちよさはないか? ベースハロルドが弱すぎる?
ただ計算式で想定している上がり幅より断然大きくなっている。四回連続攻撃で、約10倍のダメージ。
大きくなりすぎ?
 

 

20240903 戦闘行動の強制をプラグインコマンドから指定できるようにする

 
下記プラグインを使わせていただく。
 
RPGMaker/FTKR_ExForceAction.ja.md at master · futokoro/RPGMaker · GitHub
https://github.com/futokoro/RPGMaker/blob/master/FTKR_ExForceAction.ja.md
 
プラグインパラメーターはいじらず、いったんそのままいれる。
 
プラグイン設定画面
プラグイン設定画面
 

試しに <攻撃後、敵ID1にも攻撃するスキル> を作成する

 
コモンイベントで戦闘行動の強制を指定する。
 
コモンイベントで設定
コモンイベントで設定
 
実施後に準備したコモンイベントを実行するスキルを準備した。
 
notion image
 
連続攻撃するスキルが出来た。
 
 
おー!
 

 

20240903 ターンが後ろに連なる敵キャラをまとめて攻撃できるスキル「チェインアタック」

 
行動済みのログを使ったスキルを作ったので、今度は以降の行動予定を使ったスキルを作ってみる。
 

作業の流れを整理する

 
思った以上に複雑かもしれない。
流れを整理しておく。
 
  • 行動予定を取得するコモンイベントかプラグインコマンドを準備する
  • 選択したターゲットに連なるターゲットを取得する(インデックスかな)
  • 連なるターゲットに対して繰り返し行動するスキルかコモンイベントを作成する
    • 条件分岐で、取得した連なるターゲット分ループするイメージ
 

指定したターゲット分、スキルをループする処理を考えてみる

 
スキル<ターゲット追加攻撃>で呼び出すコモンイベントにループ処理を追加する。
 
ターゲットリストの分だけループする
ターゲットリストの分だけループする
 
指定したターゲットに対して攻撃できた。
 
あとは変数52に後ろに連なるターゲットリストを入れられればOK。
 

バトル行動予定を入れる変数を準備した

 
notion image
 
 

バトル行動予定の取得方法について考えてみる

 
例えば行動順はこんな感じになっている。
  1. ハロルド
  1. ハロルド
  1. ハロルド
  1. コウモリB
  1. ハロルド
  1. マーシャ
  1. コウモリD
  1. コウモリE
  1. コウモリA
 
表示ターン内に同じキャラクターが複数いた場合、先にターンが来る方が優先される。
 
敵を選択する場合:
例えばコウモリDを選択した場合、コウモリE・Aが取得できる
 
味方を選択する場合:
ハロルドを選択した場合、2ハロルドと3ハロルドが取得出来る
 
取得は名前を取るか添え字を取るかで敵か味方かは判断できるが…
 

 

20240904 プラグインコマンドの引数に変数を指定する

 
下記ページのプラグインを使わせていただく。
 
プラグインコマンドの引数に変数の値を採用するプラグイン - RPGツクールと数学のブログ
https://fermiumbay13.hatenablog.com/entry/2017/12/03/102529
 

 

20240904 ターン関連のバトル情報を指定の変数に保存する

 
以降のターン情報を使ったスキルを作るため、その情報を取得するプラグインを準備した。
 
ここより下に更新したプラグインを記載している
//============================================================================= // TT_BattleInfoStorage.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/04 // // Version // 1.1.2 2024/09/04 直近のターン情報取得を修正 // 1.1.1 2024/09/04 直近のターン情報取得を修正 // 1.1.0 2024/09/04 直近のターン情報取得コマンドを追加 // 1.0.9 2024/09/04 敵連続ターン取得コマンドを追加 // 1.0.8 2024/09/04 味方連続ターン取得コマンドのロジックを修正 // 1.0.7 2024/09/04 JSONパースエラーを防ぐためのチェックを追加 // 1.0.6 2024/09/04 味方連続ターン取得コマンドの動作を修正 // 1.0.5 2024/09/04 味方連続ターン取得コマンドを追加 // 1.0.4 2024/09/04 デバッグログのON/OFFをプラグインパラメータで制御可能に // 1.0.3 2024/09/04 インデックスを1からスタートするように修正 // 1.0.2 2024/09/04 アクターとエネミーのグループ内インデックスを正確に取得するように修正 // 1.0.1 2024/09/04 バトル情報が正しく格納されない問題を修正 // 1.0.0 2024/09/04 初版 // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc バトル情報を指定の変数に保存します。 (Version 1.1.2) * @author たくろう_りらっくすーぷ * * @param Variable ID * @text 情報保存変数ID * @type variable * @desc バトル情報を保存する変数のID * @default 1 * * @param Enable Debug Log * @text デバッグログの有効化 * @type boolean * @desc デバッグ用のコンソールログを有効にするかどうか * @default false * * @help バトル中の各ターンの情報を指定した変数に格納します。 (Version 1.1.2) * * ◆プラグインパラメーター *  情報保存変数ID *    ここで指定した変数にバトル中の各ターンの情報を記録します。 *    デフォルト:1 * *  デバッグログの有効化 *    trueに設定すると、コンソールにデバッグ用のログが出力されます。 *    デフォルト:false * * ◆格納される情報 *  各ターンの開始時に、以下の形式でJSONデータが変数に格納されます: *  [{"name":"キャラクター名","type":"アクター/エネミー","index":1}, ...] *  indexはアクターの場合はパーティー内の位置、エネミーの場合は敵グループ内の位置を示します。 *  インデックスは1からスタートします。 * * ◆プラグインコマンド *  味方連続ターン取得 indexID 変数ID *   指定したプレイヤーIDの最初に登場する順番から続けて行動する味方のプレイヤーindexIDを取得し、指定した変数にリストで格納します。 *   例:味方連続ターン取得 1 2 * *  敵連続ターン取得 indexID 変数ID *   指定したエネミーIDの最初に登場する順番から続けて行動するエネミーのindexIDを取得し、指定した変数にリストで格納します。 *   例:敵連続ターン取得 1 3 * *  直近ターン情報取得 変数ID *   直近のターンの情報(行動者、行動内容、ターゲット)を取得し、指定した変数に格納します。 *   例:直近ターン情報取得 4 * * ◆使用例 *  イベントコマンドの「条件分岐」や「スクリプト」で格納された情報を利用できます。 *  例: *  var battleInfo = JSON.parse($gameVariables.value(variableId)); *  console.log(battleInfo[0].name); // 最初のキャラクターの名前を表示 * * ◆注意 *  バトル情報はターン開始時に更新されます。 *  バトル終了時にデータはリセットされません。 */ (function() { var parameters = PluginManager.parameters('TT_BattleInfoStorage'); var variableId = Number(parameters['Variable ID'] || 1); var enableDebugLog = parameters['Enable Debug Log'] === 'true'; var _BattleManager_startTurn = BattleManager.startTurn; BattleManager.startTurn = function() { _BattleManager_startTurn.call(this); this.storeBattleInfo(); }; BattleManager.storeBattleInfo = function() { if (this._actionBattlers && this._actionBattlers.length > 0) { var battleInfo = this._actionBattlers.map(function(battler) { var index, type; if (battler.isActor()) { index = $gameParty.members().indexOf(battler) + 1; // 1を加算 type = 'アクター'; } else { index = $gameTroop.members().indexOf(battler) + 1; // 1を加算 type = 'エネミー'; } return { name: battler.name(), type: type, index: index }; }); $gameVariables.setValue(variableId, JSON.stringify(battleInfo)); if (enableDebugLog) { console.log("Battle info stored:", battleInfo); // デバッグ用ログ } } else { if (enableDebugLog) { console.log("No action battlers available"); // デバッグ用ログ } } }; var _BattleManager_startAction = BattleManager.startAction; BattleManager.startAction = function() { _BattleManager_startAction.call(this); this.storeLastActionInfo(); }; BattleManager.storeLastActionInfo = function() { var subject = this._subject; var action = this._action; if (subject && action) { var targets = action.makeTargets(); this._lastActionInfo = { subject: { type: subject.isActor() ? 'アクター' : 'エネミー', index: this.getBattlerIndex(subject) }, action: action.item().name, targets: targets.map(function(target) { if (action.isForAll()) { return { type: target.isActor() ? 'アクター' : 'エネミー', index: 99 }; } else { return { type: target.isActor() ? 'アクター' : 'エネミー', index: this.getBattlerIndex(target) }; } }, this) }; if (this._lastActionInfo.targets.length === 0) { this._lastActionInfo.targets.push({ type: 'なし', index: -1 }); } if (enableDebugLog) { console.log("Last action info stored:", JSON.stringify(this._lastActionInfo)); } } }; BattleManager.getBattlerIndex = function(battler) { if (battler.isActor()) { return $gameParty.members().indexOf(battler) + 1; } else { return $gameTroop.members().indexOf(battler) + 1; } }; var _Scene_Battle_start = Scene_Battle.prototype.start; Scene_Battle.prototype.start = function() { _Scene_Battle_start.call(this); BattleManager.storeBattleInfo(); // バトル開始時にも情報を格納 }; // プラグインコマンドの追加 var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === '味方連続ターン取得') { var indexId = Number(args[0]); var variableId = Number(args[1]); this.getConsecutiveTurns(indexId, variableId, 'アクター'); } else if (command === '敵連続ターン取得') { var indexId = Number(args[0]); var variableId = Number(args[1]); this.getConsecutiveTurns(indexId, variableId, 'エネミー'); } else if (command === '直近ターン情報取得') { var variableId = Number(args[0]); this.getLastActionInfo(variableId); } }; Game_Interpreter.prototype.getConsecutiveTurns = function(indexId, variableId, targetType) { var battleInfoString = $gameVariables.value(1); if (!battleInfoString) { console.error("No battle information available."); return; } try { var battleInfo = JSON.parse(battleInfoString); } catch (e) { console.error("Failed to parse battle information:", e); return; } var consecutiveIndexes = []; var foundFirstTarget = false; for (var i = 0; i < battleInfo.length; i++) { var battler = battleInfo[i]; if (battler.type === targetType) { if (battler.index === indexId) { foundFirstTarget = true; } if (foundFirstTarget) { consecutiveIndexes.push(battler.index); } } else if (foundFirstTarget) { break; } } $gameVariables.setValue(variableId, JSON.stringify(consecutiveIndexes)); if (enableDebugLog) { console.log("Consecutive turns for", targetType, "index", indexId, ":", consecutiveIndexes); } }; Game_Interpreter.prototype.getLastActionInfo = function(variableId) { if (BattleManager._lastActionInfo) { $gameVariables.setValue(variableId, JSON.stringify(BattleManager._lastActionInfo)); if (enableDebugLog) { console.log("Last action info retrieved:", BattleManager._lastActionInfo); } } else { $gameVariables.setValue(variableId, JSON.stringify({ error: "No last action information available" })); if (enableDebugLog) { console.log("No last action information available"); } } }; })();
 
これで必要な情報が取得できるようになった。
 

 

20240905 改めて、ターンが後ろに連なる敵キャラをまとめて攻撃できるスキル「チェインアタック」を作成する

 

ベースとなるスキル「チェインアタック」を準備する

 
チェインアタックの設定
チェインアタックの設定
 
ダメージ計算式は通常の攻撃と同じもの。
使用効果でコモンイベントを呼ぶ。
 

コモンイベント:ターゲットを取得する

 
スキルから呼ばれるコモンイベント。
スキルの行動者とターゲットを取得する。
 
情報を取得して、変数45に格納する
情報を取得して、変数45に格納する
 
チェインアタックでEコウモリを攻撃した
チェインアタックでEコウモリを攻撃した
 
変数45には下記のように値が格納される。
 
$gameVariables.value(45) "{"subject":{"type":"アクター","index":1},"action":"チェインアタック","targets":[{"type":"エネミー","index":5}]}"
 

ターゲットを別の変数に格納する

 
変数48にターゲットIDを格納する。
 
ターゲットIDを取得した
ターゲットIDを取得した
 

取得したターゲットIDに連なる敵のターゲットIDを取得した

 
敵連続ターン取得
敵連続ターン取得
 
$gameVariables.value(45) "[4,5]"
 

取得する形式が文字列でJSONパースが必要になっていたのでプラグインを修正した

 
//============================================================================= // TT_BattleInfoStorage.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/04 // // Version // 1.1.3 2024/09/04 連続ターン取得の結果をリスト形式で格納するように修正 // 1.1.2 2024/09/04 直近のターン情報取得を修正 // 1.1.1 2024/09/04 直近のターン情報取得を修正 // 1.1.0 2024/09/04 直近のターン情報取得コマンドを追加 // 1.0.9 2024/09/04 敵連続ターン取得コマンドを追加 // 1.0.8 2024/09/04 味方連続ターン取得コマンドのロジックを修正 // 1.0.7 2024/09/04 JSONパースエラーを防ぐためのチェックを追加 // 1.0.6 2024/09/04 味方連続ターン取得コマンドの動作を修正 // 1.0.5 2024/09/04 味方連続ターン取得コマンドを追加 // 1.0.4 2024/09/04 デバッグログのON/OFFをプラグインパラメータで制御可能に // 1.0.3 2024/09/04 インデックスを1からスタートするように修正 // 1.0.2 2024/09/04 アクターとエネミーのグループ内インデックスを正確に取得するように修正 // 1.0.1 2024/09/04 バトル情報が正しく格納されない問題を修正 // 1.0.0 2024/09/04 初版 // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc バトル情報を指定の変数に保存します。 (Version 1.1.3) * @author たくろう_りらっくすーぷ * * @param Variable ID * @text 情報保存変数ID * @type variable * @desc バトル情報を保存する変数のID * @default 1 * * @param Enable Debug Log * @text デバッグログの有効化 * @type boolean * @desc デバッグ用のコンソールログを有効にするかどうか * @default false * * @help バトル中の各ターンの情報を指定した変数に格納します。 (Version 1.1.3) * * ◆プラグインパラメーター *  情報保存変数ID *    ここで指定した変数にバトル中の各ターンの情報を記録します。 *    デフォルト:1 * *  デバッグログの有効化 *    trueに設定すると、コンソールにデバッグ用のログが出力されます。 *    デフォルト:false * * ◆格納される情報 *  各ターンの開始時に、以下の形式でJSONデータが変数に格納されます: *  [{"name":"キャラクター名","type":"アクター/エネミー","index":1}, ...] *  indexはアクターの場合はパーティー内の位置、エネミーの場合は敵グループ内の位置を示します。 *  インデックスは1からスタートします。 * * ◆プラグインコマンド *  味方連続ターン取得 indexID 変数ID *   指定したプレイヤーIDの最初に登場する順番から続けて行動する味方のプレイヤーindexIDを取得し、指定した変数にリストで格納します。 *   例:味方連続ターン取得 1 2 * *  敵連続ターン取得 indexID 変数ID *   指定したエネミーIDの最初に登場する順番から続けて行動するエネミーのindexIDを取得し、指定した変数にリストで格納します。 *   例:敵連続ターン取得 1 3 * *  直近ターン情報取得 変数ID *   直近のターンの情報(行動者、行動内容、ターゲット)を取得し、指定した変数に格納します。 *   例:直近ターン情報取得 4 * * ◆使用例 *  イベントコマンドの「条件分岐」や「スクリプト」で格納された情報を利用できます。 *  例: *  var battleInfo = $gameVariables.value(variableId); *  console.log(battleInfo[0].name); // 最初のキャラクターの名前を表示 * * ◆注意 *  バトル情報はターン開始時に更新されます。 *  バトル終了時にデータはリセットされません。 */ (function() { var parameters = PluginManager.parameters('TT_BattleInfoStorage'); var variableId = Number(parameters['Variable ID'] || 1); var enableDebugLog = parameters['Enable Debug Log'] === 'true'; var _BattleManager_startTurn = BattleManager.startTurn; BattleManager.startTurn = function() { _BattleManager_startTurn.call(this); this.storeBattleInfo(); }; BattleManager.storeBattleInfo = function() { if (this._actionBattlers && this._actionBattlers.length > 0) { var battleInfo = this._actionBattlers.map(function(battler) { var index, type; if (battler.isActor()) { index = $gameParty.members().indexOf(battler) + 1; // 1を加算 type = 'アクター'; } else { index = $gameTroop.members().indexOf(battler) + 1; // 1を加算 type = 'エネミー'; } return { name: battler.name(), type: type, index: index }; }); $gameVariables.setValue(variableId, battleInfo); if (enableDebugLog) { console.log("Battle info stored:", battleInfo); // デバッグ用ログ } } else { if (enableDebugLog) { console.log("No action battlers available"); // デバッグ用ログ } } }; var _BattleManager_startAction = BattleManager.startAction; BattleManager.startAction = function() { _BattleManager_startAction.call(this); this.storeLastActionInfo(); }; BattleManager.storeLastActionInfo = function() { var subject = this._subject; var action = this._action; if (subject && action) { var targets = action.makeTargets(); this._lastActionInfo = { subject: { type: subject.isActor() ? 'アクター' : 'エネミー', index: this.getBattlerIndex(subject) }, action: action.item().name, targets: targets.map(function(target) { if (action.isForAll()) { return { type: target.isActor() ? 'アクター' : 'エネミー', index: 99 }; } else { return { type: target.isActor() ? 'アクター' : 'エネミー', index: this.getBattlerIndex(target) }; } }, this) }; if (this._lastActionInfo.targets.length === 0) { this._lastActionInfo.targets.push({ type: 'なし', index: -1 }); } if (enableDebugLog) { console.log("Last action info stored:", this._lastActionInfo); } } }; BattleManager.getBattlerIndex = function(battler) { if (battler.isActor()) { return $gameParty.members().indexOf(battler) + 1; } else { return $gameTroop.members().indexOf(battler) + 1; } }; var _Scene_Battle_start = Scene_Battle.prototype.start; Scene_Battle.prototype.start = function() { _Scene_Battle_start.call(this); BattleManager.storeBattleInfo(); // バトル開始時にも情報を格納 }; // プラグインコマンドの追加 var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === '味方連続ターン取得') { var indexId = Number(args[0]); var variableId = Number(args[1]); this.getConsecutiveTurns(indexId, variableId, 'アクター'); } else if (command === '敵連続ターン取得') { var indexId = Number(args[0]); var variableId = Number(args[1]); this.getConsecutiveTurns(indexId, variableId, 'エネミー'); } else if (command === '直近ターン情報取得') { var variableId = Number(args[0]); this.getLastActionInfo(variableId); } }; Game_Interpreter.prototype.getConsecutiveTurns = function(indexId, variableId, targetType) { var battleInfo = $gameVariables.value(1); if (!battleInfo) { console.error("No battle information available."); return; } var consecutiveIndexes = []; var foundFirstTarget = false; for (var i = 0; i < battleInfo.length; i++) { var battler = battleInfo[i]; if (battler.type === targetType) { if (battler.index === indexId) { foundFirstTarget = true; } if (foundFirstTarget) { consecutiveIndexes.push(battler.index); } } else if (foundFirstTarget) { break; } } $gameVariables.setValue(variableId, consecutiveIndexes); if (enableDebugLog) { console.log("Consecutive turns for", targetType, "index", indexId, ":", consecutiveIndexes); } }; Game_Interpreter.prototype.getLastActionInfo = function(variableId) { if (BattleManager._lastActionInfo) { $gameVariables.setValue(variableId, BattleManager._lastActionInfo); if (enableDebugLog) { console.log("Last action info retrieved:", BattleManager._lastActionInfo); } } else { $gameVariables.setValue(variableId, { error: "No last action information available" }); if (enableDebugLog) { console.log("No last action information available"); } } }; })();
 

取得したターゲットリストに対して攻撃スキルをループする→スキル完成

 
◆注釈:## 直近ターンの行動者やターゲットを取得する :  :下記のような値が取れる :  :"{"subject":{"type":"アクター","index":1},"action":"チェインアタック","targets":[{"type":"エネミー","index":5}]}" ◆プラグインコマンド:直近ターン情報取得 45 ◆注釈: :  :## ターゲットIDを取得する ◆スクリプト:// 取得したインデックスを変数48に格納 :     :$gameVariables.setValue(48, $gameVariables.value(45).targets[0].index); ◆注釈: :  :## ターゲットIDに連なるターゲットIDを取得し、変数52に入れる :  :→[4,5] ◆プラグインコマンド:敵連続ターン取得_varID[1] 48 52 ◆注釈: :  :#### ターゲットリストから先頭を取り除く :  :最初のターゲット自身が先頭に入っているため ◆変数の操作:#0045 使い捨て変数 = $gameVariables.value(52).shift() ◆注釈: :  :## ターゲットリスト分ループする ◆ループ ◆注釈:### ターゲットリストが0より大きい、つまり攻撃対象がまだいたら ◆条件分岐:スクリプト:$gameVariables.value(52).length > 0 ◆注釈:#### ターゲットリストの先頭を取得しつつ取り除く ◆変数の操作:#0045 使い捨て変数 = $gameVariables.value(52).shift() ◆注釈:#### 取得したターゲットリストのIDに対して攻撃 ◆プラグインコマンド:EFA_戦闘行動の強制 アクター 8 スキル 16 対象 \v[45] リセット無効 ◆ :それ以外のとき ◆ループの中断 ◆ :分岐終了 ◆ :以上繰り返し
 
 
 

 

20240905 ハロルドが逃げ出す仕組みを考える

 
「ハロルドは非常にビビりなため、たびたび逃げ出してしまう」という設定を検討中。
この設定をバトル中に実現するための方法を検討する。
 

要件

 
  • ハロルドは確率で行動内容を無視して逃げ出してしまう
  • 「逃走」状態だと起こること
    • ハロルドが「逃走」状態だとメンバーの能力が下がる(勇者不在のパーティは本領発揮できないという設定)
    • 「逃走」状態だとバトル中行動できない
    • 「逃走」状態だと攻撃も受けない
    • 「逃走」状態だとターン毎に少しだけHPとMPが回復する(本当に少しにする)
    • 「逃走」状態でバトルが終了すると「逃走」状態のアクターは経験値がもらえない
    • 全員が「逃走」状態になるとパーティーコマンドの逃げると同じようにそのバトルから逃げたことになる
  • アクターコマンドで逃げることも可能にしておく(HPMP回復が戦略に使えるかも?)
    • アクターコマンドから逃げる場合、確率で失敗してもいいかもしれない
  • アクターコマンドに連れ戻すがある
    • 逃げている人を連れ戻すことができる
    • 逃げてない人にやると何もおこらない
 
 

 

20240906 選択した行動を、確率で無視して別のスキルが実行されるプラグイン

 
ハロルドが逃げ出す仕組み作り。
<ハロルドは確率で行動内容を無視して逃げ出してしまう>の機能を実装してみる。
 

プラグインを準備して配置してみる

//============================================================================= // TT_ActionReplacementSkill.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/06 // // Version // 1.0.0 2024/09/06 初版 // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc 指定アクターの行動を別スキルに置き換える (Version 1.0.0) * @author たくろう_りらっくすーぷ * * @param Actor Variable ID * @text アクター指定変数ID * @type variable * @desc アクターIDを指定する変数のID * @default 1 * * @param Probability Variable ID * @text 確率指定変数ID * @type variable * @desc 行動置換の確率を指定する変数のID * @default 2 * * @param Skill Variable ID * @text スキル指定変数ID * @type variable * @desc 置換するスキルIDを指定する変数のID * @default 3 * * @param Enable Switch ID * @text 有効化スイッチID * @type switch * @desc このプラグインの効果を有効にするスイッチのID * @default 1 * * @help 指定したアクターの行動が別のスキルに置き換わるプラグインです。 (Version 1.0.0) * * ◆プラグインパラメーター *  アクター指定変数ID *    この変数に指定されたIDのアクターに効果が適用されます。 *    カンマ区切りで複数指定可能です。 *    デフォルト:1 * *  確率指定変数ID *    この変数に指定された確率で行動が置き換わります。 *    デフォルト:2 * *  スキル指定変数ID *    この変数に指定されたIDのスキルに置き換わります。 *    デフォルト:3 * *  有効化スイッチID *    このスイッチがONの時のみプラグインの効果が有効になります。 *    デフォルト:1 * * ◆使用方法 *  1. プラグインパラメーターで各変数IDとスイッチIDを設定します。 *  2. ゲーム中で、指定した変数に適切な値を設定します。 *    例:$gameVariables.setValue(1, "1,8"); // アクターID 1と8を対象に *    $gameVariables.setValue(2, 30); // 30%の確率で *    $gameVariables.setValue(3, 12); // スキルID 12に置き換え *  3. 有効化スイッチをONにすると、効果が適用されます。 * * ◆注意 *  ・アクターIDとスキルIDは必ず存在するものを指定してください。 *  ・確率は0から100の間で指定してください。 */ (function() { var parameters = PluginManager.parameters('TT_ActionReplacementSkill'); var actorVarId = Number(parameters['Actor Variable ID'] || 1); var probVarId = Number(parameters['Probability Variable ID'] || 2); var skillVarId = Number(parameters['Skill Variable ID'] || 3); var enableSwitchId = Number(parameters['Enable Switch ID'] || 1); var _BattleManager_startAction = BattleManager.startAction; BattleManager.startAction = function() { var subject = this._subject; var action = subject.currentAction(); if ($gameSwitches.value(enableSwitchId) && subject.isActor()) { var actorIds = String($gameVariables.value(actorVarId)).split(',').map(Number); var probability = Number($gameVariables.value(probVarId)); var skillId = Number($gameVariables.value(skillVarId)); if (actorIds.includes(subject.actorId()) && Math.random() * 100 < probability) { action.setSkill(skillId); // this._logWindow.addText(subject.name() + "のスキルが" + $dataSkills[skillId].name + "に置き換わった!"); } } _BattleManager_startAction.call(this); }; })();
 
これで、ハロルドの行動を確率で逃走に上書きできる。
 

 

20240906 逃走する処理を追加した

 

逃走しているステートを作成

逃走ステート
逃走ステート
 

逃走するスキル(逃走ステートを付与するスキル)を作成

notion image
 

逃走前の会話を作成(チュートリアル用)

逃走するときに会話する
逃走するときに会話する
 
スイッチ23がONのとき
変数53で指定したアクターIDが→ハロルド
変数54で指定した数値の確率で→50%
変数55で指定した数値のスキルを実行する→19逃走スキル
のように設定した。
 
 
 

 

20240906 対象ステートの間少しずつ回復する

 
ステートの特徴に回復率を設定する。
 
回復率を設定する
回復率を設定する
 
これでこのステート中は、徐々にHPMPが回復する
 

 

20240907 誰かが逃走中だとメンバーの能力が下がる

 
最初はハロルドが逃げていた場合、を考えていたが、大変? そんなことないか?
 

誰かか対象ステートになっているときに、パーティーステータスを変動させるプラグイン

 
//============================================================================= // TT_DarkPlasma_PartyAbilityTraitExtension.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/07 // // Version // 2.1.1 2024/09/07 パーティ能力特徴を複数指定する場合の書式を変更 // 2.0.2 2024/09/07 デバッグログのON/OFF機能を追加 // 2.0.1 2024/09/07 パラメータ計算の修正 // 2.0.0 2024/09/07 MV用に改変 // 略 // 1.0.0 2021/06/27 公開 (原作者: DarkPlasma) // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc ステートなどにパーティ能力特徴を追加します。 (Version 2.1.1) * @author DarkPlasma, たくろう_りらっくすーぷ * * @param Enable Debug Log * @text デバッグログを有効にする * @type boolean * @default false * @desc パラメータ計算のデバッグログをコンソールに出力するかどうか(大量に出るので注意) * * @help ステートなどにパーティ能力特徴を追加します。 (Version 2.1.1) * * アクター/職業/装備/ステートのメモ欄に指定の記述を行うことで、 * パーティ全体に効果を及ぼす特徴を付与できます。 * * このプラグインは DarkPlasma 氏がMZ用に作成したプラグインを * たくろう がMVで使用するため改変したものです。 * * 原作者: DarkPlasma * 改変者: たくろう_りらっくすーぷ * * * ◆プラグインパラメーター *  デバッグログを有効にする: *   ONにすると、パラメータ計算のデバッグログがコンソールに出力されます。 *   開発時のデバッグに使用し、リリース時にはOFFにすることをおすすめします。 *   大量に出力されるため注意してください。 * * ◆基本構文: * <partyAbility:[effect]:[value]> * パーティ全体に[effect]で指定した効果を、効果量[value]で付与します。 * * 複数指定する場合は,(カンマ)区切りで並記します。 * <partyAbility:atk_x:50,def_x:50,mat_x:50,mdf_x:50> * * [effect]: * mhp: 最大HP加算 * mmp: 最大MP加算 * atk: 攻撃力加算 * def: 防御力加算 * mat: 魔法攻撃力加算 * mdf: 魔法防御力加算 * agi: 敏捷性加算 * luk: 運加算 * tgr: 狙われ率乗算 * grd: 防御効果率乗算 * rec: 回復効果率乗算 * pha: 薬の知識乗算 * mcr: MP消費率乗算 * tcr: TPチャージ率乗算 * phr: 物理ダメージ率乗算 * mdr: 魔法ダメージ率乗算 * fdr: 床ダメージ率乗算 * exr: 経験値獲得率乗算 * * 設定例 * 最大HP+10: * <partyAbility:mhp:10> * * 床ダメージ率*0: * <partyAbility:fdr:0> * * MP消費率 80%: * <partyAbility:mcr:80> * * ◆基本パラメータの割合変更 *  基本パラメータ(能力値)に「_x」を追加することで、割合で変更できます。 * * [effect]: *  mhp_x: 最大HP *  mmp_x: 最大MP *  atk_x: 攻撃力 *  def_x: 防御力 *  mat_x: 魔法攻撃力 *  mdf_x: 魔法防御力 *  agi_x: 敏捷性 *  luk_x: 運 * *  例えば: *  <partyAbility:def_x:120> で防御力を120%(1.2倍)にします。 *  <partyAbility:agi_x:80> で敏捷性を80%(0.8倍)にします。 * * ◆使用例 * ステートのメモ欄に以下のように記述します: * <partyAbility:atk:20,def_x:110> * * これにより、このステートが付与されているキャラクターがパーティにいる場合、 * パーティ全体の攻撃力が20上昇し、防御力が10%増加します。 * * ◆注意 * ・このプラグインはRPGツクールMV用に改変されています。MZ版とは * 一部の機能や動作が異なる可能性があります。 * ・パーティ能力特徴は累積的に適用されます。複数のステートや装備品に * 同じ効果を設定した場合、それらは全て合算されます。 * ・割合変更(_x)と加算は別々に計算されます。例えば、ATK+10とATK×120% * の両方が適用される場合、まず基本値に120%を掛け、その後に10を加算します。 * ・ゲームバランスに大きく影響する可能性があるため、効果の設定には * 十分注意してください。 * ・このプラグインは他のステータス変更プラグインと競合する可能性が * あります。他のプラグインと併用する場合は、十分なテストを行ってください。 * ・パーティ能力特徴は、バトルテストでは正しく機能しない場合があります。 * 必ず実際のゲームプレイで動作を確認してください。 */ (function () { 'use strict'; const pluginName = 'TT_DarkPlasma_PartyAbilityTraitExtension'; const parameters = PluginManager.parameters(pluginName); const enableDebugLog = parameters['Enable Debug Log'] === 'true'; const PARAM_KEYS = ['mhp', 'mmp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk']; const SPARAM_KEYS = ['tgr', 'grd', 'rec', 'pha', 'mcr', 'tcr', 'pdr', 'mdr', 'fdr', 'exr']; // ユーティリティ関数 const paramKey = (paramId) => PARAM_KEYS[paramId]; const sparamKey = (paramId) => SPARAM_KEYS[paramId]; // デバッグログ出力関数 function debugLog(message) { if (enableDebugLog) { console.log(`[${pluginName}] ${message}`); } } const partyAbilityTraitAdd = (object, key) => { const traits = object.meta.partyAbility; if (!traits) return 0; const allTraits = traits.split(','); for (let trait of allTraits) { const match = trait.match(new RegExp(`${key}:([0-9]+)`)); if (match) { return Number(match[1]); } } return 0; }; const partyAbilityTraitMulti = (object, key) => { const traits = object.meta.partyAbility; if (!traits) return 1; const allTraits = traits.split(','); for (let trait of allTraits) { const match = trait.match(new RegExp(`${key}:([0-9]+)`)); if (match) { return Number(match[1]) / 100; } } return 1; }; // Game_BattlerBase の拡張 const _Game_BattlerBase_param = Game_BattlerBase.prototype.param; Game_BattlerBase.prototype.param = function(paramId) { let value = _Game_BattlerBase_param.call(this, paramId); if (this.isActor()) { const plusValue = $gameParty.paramPlusByPartyAbility(paramId); const multiValue = $gameParty.paramMultiByPartyAbility(paramId); value = (value + plusValue) * multiValue; debugLog(`Param ${PARAM_KEYS[paramId]} for ${this.name()}: Base=${_Game_BattlerBase_param.call(this, paramId)}, Plus=${plusValue}, Multi=${multiValue}, Final=${value}`); } return value; }; // Game_Actor の拡張 Game_Actor.prototype.setTempParty = function(tempParty) { this._tempParty = tempParty; }; Game_Actor.prototype.paramPlusByPartyAbility = function(paramId) { const party = this._tempParty || $gameParty; return party.paramPlusByPartyAbility(paramId); }; Game_Actor.prototype.paramMultiByPartyAbility = function(paramId) { const party = this._tempParty || $gameParty; return party.paramMultiByPartyAbility(paramId); }; const _Game_Actor_sparam = Game_Actor.prototype.sparam; Game_Actor.prototype.sparam = function(paramId) { const baseValue = _Game_Actor_sparam.call(this, paramId); const finalValue = baseValue * this.sparamRateByPartyAbility(paramId); debugLog(`SParam ${SPARAM_KEYS[paramId]} for ${this.name()}: Base=${baseValue}, Final=${finalValue}`); return finalValue; }; Game_Actor.prototype.sparamRateByPartyAbility = function(paramId) { return $gameParty.sparamRateByPartyAbility(paramId); }; Game_Actor.prototype.partyAbilityTraitsSum = function(key) { return this.traitObjects().reduce((result, object) => result + partyAbilityTraitAdd(object, key), 0); }; Game_Actor.prototype.partyAbilityTraitsPi = function(key) { return this.traitObjects().reduce((result, object) => result * partyAbilityTraitMulti(object, key), 1); }; // Game_Party の拡張 Game_Party.prototype.paramPlusByPartyAbility = function(paramId) { const key = paramKey(paramId); debugLog(`Calculating paramPlusByPartyAbility for ${key}`); const result = this.allMembers().reduce((result, actor) => { const actorPlus = actor.traitObjects().reduce((sum, obj) => { const plus = partyAbilityTraitAdd(obj, key); debugLog(`Actor ${actor.name()}, Object ${obj.name}, Plus: ${plus}`); return sum + plus; }, 0); debugLog(`Actor ${actor.name()}, Total Plus: ${actorPlus}`); return result + actorPlus; }, 0); debugLog(`Final result for ${key}: ${result}`); return result; }; Game_Party.prototype.paramMultiByPartyAbility = function(paramId) { const key = `${paramKey(paramId)}_x`; debugLog(`Calculating paramMultiByPartyAbility for ${key}`); const result = this.allMembers().reduce((result, actor) => { const actorMulti = actor.traitObjects().reduce((acc, obj) => { const multi = partyAbilityTraitMulti(obj, key); debugLog(`Actor ${actor.name()}, Object ${obj.name}, Multi: ${multi}`); return acc * multi; }, 1); debugLog(`Actor ${actor.name()}, Total Multi: ${actorMulti}`); return result * actorMulti; }, 1); debugLog(`Final result for ${key}: ${result}`); return result; }; Game_Party.prototype.sparamRateByPartyAbility = function(paramId) { const key = sparamKey(paramId); debugLog(`Calculating sparamRateByPartyAbility for ${key}`); const result = this.allMembers().reduce((result, actor) => { const actorRate = actor.partyAbilityTraitsPi(key); debugLog(`Actor ${actor.name()}, Rate: ${actorRate}`); return result * actorRate; }, 1); debugLog(`Final result for ${key}: ${result}`); return result; }; // Window_EquipStatus の拡張 const _Window_EquipStatus_setTempActor = Window_EquipStatus.prototype.setTempActor; Window_EquipStatus.prototype.setTempActor = function(tempActor) { if (this._tempActor !== tempActor && tempActor) { const party = new Game_Party(); $gameParty.allMembers().forEach(actor => party.addActor(actor.actorId())); party.allMembers = function() { return this._actors .map(id => id === tempActor.actorId() ? tempActor : $gameActors.actor(id)) .filter(actor => !!actor); }; tempActor.setTempParty(party); } _Window_EquipStatus_setTempActor.call(this, tempActor); }; })();
 

誰かが逃走するとパーティーのステータスが下がる設定

 
物理・魔法それぞれのの攻撃力防御力がさがる。
 
パーティ能力特徴の設定
パーティ能力特徴の設定
<partyAbility:atk_x:50,def_x:50,mat_x:50,mdf_x:50>
 

ハロルドが逃げる前

$gameParty.members().forEach(actor => console.log(`${actor.name()}: 攻撃力=${actor.atk}, 防御力=${actor.def}, 魔法攻撃力=${actor.mat}, 魔法防御力=${actor.mdf}`)); VM13118:1 ハロルド: 攻撃力=16, 防御力=16, 魔法攻撃力=16, 魔法防御力=16 VM13118:1 マーシャ: 攻撃力=16, 防御力=16, 魔法攻撃力=16, 魔法防御力=16
 

ハロルドが逃げた後

$gameParty.members().forEach(actor => console.log(`${actor.name()}: 攻撃力=${actor.atk}, 防御力=${actor.def}, 魔法攻撃力=${actor.mat}, 魔法防御力=${actor.mdf}`)); VM13222:1 ハロルド: 攻撃力=8, 防御力=8, 魔法攻撃力=8, 魔法防御力=8 VM13222:1 マーシャ: 攻撃力=8, 防御力=8, 魔法攻撃力=8, 魔法防御力=8
 
これで特定のステートになっているパーティメンバーがいたときの、ステータス変更ができるようになった。
 

 

20240907 アイテムやスキルが使用不可になるステート

 
逃走中のキャラクターに対し、アイテムやスキルが使用できないようにする。
トリアコンタンさんの「RestrictionTargetSkill.js」プラグインを使用させていただく。
自分用に改変した。
  • プラグインパラメーターを追加した <無効ステート変数>
  • そこで指定した変数で無効にするステートIDを指定する
  • そのステートのアクターはアイテムやスキルの対象外になる
 
  • <無効にならないスキルID変数>を追加した
  • そこで指定した変数で無効にならないスキルIDを指定する
  • このスキルは<無効ステート変数>よりも優先され対象ステートIDのアクターにも使用できるスキルになる
 
改変してプラグインパラメーターを指定できるようにした
改変してプラグインパラメーターを指定できるようにした
 
文字で書くと何のことかわかりにくい。
やっていること
  • 逃走ステートになっているキャラクターにはアイテムもスキルも使用できない
  • ただし、スキル<連れ戻す>だけは使える
 

 

20240908 バトルの行動失敗メッセージを表示しないスキル

 
スキル<連れ戻す>を使用したとき、指定したコモンイベント内で逃走ステートを取り除いている。
ただ、スキル本体の効果は特に設定していないため、「○○には効かなかった」という行動失敗メッセージがバトルログに表示されてしまった。
 
この行動失敗メッセージを表示しないようにする。
 

行動失敗メッセージを表示しないようにするプラグイン

 
//============================================================================= // TT_HideInvalidMessagePlugin.js // ---------------------------------------------------------------------------- // Copyright (c) 2024 たくろう_りらっくすーぷ // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Last Updated: 2024/09/08 // // Version // 1.0.1 2024/09/08 プラグインパラメーターでログONOFFできるようにした // 1.0.0 2024/09/08 初版 // ---------------------------------------------------------------------------- // [Blog] : https://re-lacksoup-recipenote.bullet.site/ // [X(Twitter)]: https://x.com/relacksoup //============================================================================= /*:ja * @plugindesc スキルのメモ欄に<HideInvalidMessage>と記載があるスキルは「行動失敗」メッセージを表示しません。 (Version 1.0.1) * @author たくろう_りらっくすーぷ * * @param Enable Debug Log * @text コンソールログ出力 * @desc デバッグログを出力するかどうか(true: 出力する, false: 出力しない) * @default false * @type boolean * * * @help スキルのメモ欄に<HideInvalidMessage>と記載があるスキルは「行動失敗」メッセージを表示しません。 (Version 1.0.1) * * このプラグインは、スキルのメモ欄に<HideInvalidMessage>と記載があるスキルに対して、 * 「○○には効かなかった」などの行動失敗メッセージを表示しないようにします。 * * 使用方法: * 1. このプラグインをプロジェクトに追加します。 * 2. 行動失敗メッセージを表示したくないスキルのメモ欄に<HideInvalidMessage>と記入します。 * 3. プラグインパラメーターでデバッグログの出力を設定できます。 * * ◆プラグインパラメーター *  コンソールログ出力 *    trueの場合、コンソールにログを出力します。 *    デフォルト:true * * ◆プラグインコマンド *  今のところありません *   * ◆注意 *  他プラグインとの競合などは検証できていません。 *   */ (function() { var parameters = PluginManager.parameters('TT_HideInvalidMessagePlugin'); var enableDebugLog = (parameters['Enable Debug Log'] === 'true'); function debugLog() { if (enableDebugLog) { console.log.apply(console, arguments); } } var _BattleManager_startAction = BattleManager.startAction; BattleManager.startAction = function() { this._currentActionItem = this._subject.currentAction().item(); _BattleManager_startAction.call(this); }; var _Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults; Window_BattleLog.prototype.displayActionResults = function(subject, target) { debugLog('displayActionResults called:', subject.name(), target.name()); if (this.shouldHideInvalidMessage(BattleManager._currentActionItem)) { debugLog('行動失敗メッセージが表示されないべきスキル:', BattleManager._currentActionItem.name); if (target.result().used) { this.push('pushBaseLine'); this.displayDamage(target); this.displayAffectedStatus(target); this.push('waitForNewLine'); this.push('popBaseLine'); } else { debugLog('行動失敗が発生しました:', target.name()); } } else { debugLog('行動失敗メッセージが表示されるスキル:', BattleManager._currentActionItem ? BattleManager._currentActionItem.name : '不明'); _Window_BattleLog_displayActionResults.call(this, subject, target); } }; Window_BattleLog.prototype.shouldHideInvalidMessage = function(item) { if (!item) { debugLog('item is undefined'); return false; } var shouldHide = item.meta && item.meta.HideInvalidMessage; debugLog('shouldHideInvalidMessage:', shouldHide, 'for item:', item.name); return shouldHide; }; var _Window_BattleLog_displayFailure = Window_BattleLog.prototype.displayFailure; Window_BattleLog.prototype.displayFailure = function(target) { debugLog('displayFailure called for:', target.name()); if (this.shouldHideInvalidMessage(BattleManager._currentActionItem)) { debugLog('行動失敗メッセージを表示しません:', BattleManager._currentActionItem.name); } else { _Window_BattleLog_displayFailure.call(this, target); } }; var _Game_Action_apply = Game_Action.prototype.apply; Game_Action.prototype.apply = function(target) { debugLog('Game_Action.apply called:', this.subject().name(), '->', target.name(), 'with', this.item().name); _Game_Action_apply.call(this, target); }; })();
 

対象スキルのメモ欄に<HideInvalidMessage>と記載する

 
行動失敗メッセージ非表示
行動失敗メッセージ非表示
 
これで「○○には効かなかった」のメッセージが表示されなくなった。
 
 

 

今週のまとめ

  • バトル中のやりたいことを実現するために色々設定したりプラグインを準備したりした
  • 大変だが、チャットAIが登場したおかげで、かなりスムーズ
  • 必要な要件を満たすプラグインを割と簡単に準備できる
  • ただ、後半で不具合が起きたときが心配。対処できなくて頓挫しそう…
 

今後やりたいこと

  • バトルの最低限必要な要件を完了させる