84 lines
No EOL
2.6 KiB
JavaScript
84 lines
No EOL
2.6 KiB
JavaScript
//=============================================================================
|
|
// RPG Maker MZ - KN_ForceDebugMode.js
|
|
//=============================================================================
|
|
|
|
/*:ja
|
|
* @target MZ
|
|
* @author kurogoma knights
|
|
* @base PluginCommonBase
|
|
* @plugindesc ビルド版でデバッグ機能を強制的に有効化するプラグイン
|
|
*
|
|
*/
|
|
|
|
(() => {
|
|
'use strict';
|
|
const script = document.currentScript;
|
|
const param = PluginManagerEx.createParameter(script);
|
|
|
|
//
|
|
// Game_Player
|
|
//
|
|
|
|
const _Game_Player_isDebugThrough = Game_Player.prototype.isDebugThrough;
|
|
Game_Player.prototype.isDebugThrough = function() {
|
|
// 強制デバッグモードが有効なら Ctrl 押しで床抜けできるように
|
|
if (Kurogoma.ForceDebugMode.isActive() && Input.isPressed("control")) {
|
|
return true;
|
|
}
|
|
|
|
return _Game_Player_isDebugThrough.call(this);
|
|
};
|
|
|
|
//
|
|
// Game_Temp
|
|
//
|
|
|
|
const _Game_Temp_isPlaytest = Game_Temp.prototype.isPlaytest;
|
|
Game_Temp.prototype.isPlaytest = function() {
|
|
// 強制デバッグモードが有効ならF9デバッグウィンドウも使えるように
|
|
if (Kurogoma.ForceDebugMode.isActive()) {
|
|
return true;
|
|
}
|
|
return _Game_Temp_isPlaytest.call(this);
|
|
};
|
|
|
|
|
|
//
|
|
// 独自関数
|
|
//
|
|
|
|
window.Kurogoma = window.Kurogoma || {};
|
|
|
|
// ビルド版で強制的にデバッグ機能を有効化するコマンド類
|
|
class ForceDebugMode {
|
|
static forceDebug = false;
|
|
|
|
// 指定レベルまでレベルアップ
|
|
static levelUp(targetLevel) {
|
|
const actor = $gameActors.leader();
|
|
const currentLevel = actor.level;
|
|
if (targetLevel <= currentLevel) {
|
|
console.log(`[ForceDebugMode] Already at level ${currentLevel}`);
|
|
return;
|
|
}
|
|
actor.changeLevel(targetLevel, false); // false = レベルアップ表示なし
|
|
console.log(`[ForceDebugMode] Level Up: ${currentLevel} -> ${targetLevel}`);
|
|
}
|
|
|
|
static activate() {
|
|
this.forceDebug = true;
|
|
console.log("[ForceDebugMode] Force Debug Mode Activated - Debug Through & F9 Debug Window Enabled");
|
|
}
|
|
|
|
static deactivate() {
|
|
this.forceDebug = false;
|
|
console.log("[ForceDebugMode] Force Debug Mode Deactivated");
|
|
}
|
|
|
|
static isActive() {
|
|
return this.forceDebug;
|
|
}
|
|
}
|
|
window.Kurogoma.ForceDebugMode = ForceDebugMode;
|
|
|
|
})(); |