pure-full-lily/js/plugins/NRP_VictoryRewards_Custom.js
2025-09-16 10:12:44 -05:00

847 lines
No EOL
30 KiB
JavaScript
Raw 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.

//=============================================================================
// NRP_VictoryRewards_Custom.js
//=============================================================================
/*:
* @target MZ
* @plugindesc v1.09 戦闘勝利時の表示をカスタマイズし、レベルアップ時の演出を強化します。
* @author 砂川赳http://newrpg.seesaa.net/, 改修 by Google Gemini
* @url https://newrpg.seesaa.net/article/499138292.html
*
* @help 戦闘勝利時の表示をカスタマイズします。(改修版)
*
* v1.09変更点:
* ・レベルアップ時にウィンドウを改ページし、表示を仕切り直すように変更。
* ・勝利MEをフェードアウトで停止させ、マップBGMの早期再開を抑制。
*
* ■使い方
* 1. 元のNRP_VictoryRewards.jsとLevelUpSE.jsを無効にしてください。
* 2. このプラグインを有効にしてください。
* 3. プラグインパラメータで、下部に追加された
* <レベルアップ関連>の項目を設定してください。
*
* @-----------------------------------------------------
* @ プラグインパラメータ
* @-----------------------------------------------------
*
* @param NotDisplayVictoryMessage
* @text 勝利メッセージを省略
* @type boolean
* @default false
* @desc 冒頭の勝利メッセージを省略し、経験値表示を先頭にします。
*
* @param ApplyNotBattle
* @text 非戦闘時にも反映
* @type boolean
* @default false
* @desc 非戦闘時のレベルアップ表示にも当プラグインの処理を反映します。
*
* @param StartCommmonEvent
* @text 開始時のコモンイベント
* @type common_event
* @desc 勝利画面開始時に実行するコモンイベントです。
*
* @param EndCommmonEvent
* @text 終了時のコモンイベント
* @type common_event
* @desc 勝利画面終了時に実行するコモンイベントです。
*
* @param <Window>
* @text <ウィンドウ関連>
*
* @param VictoryWindowBackground
* @text 勝利時のウィンドウ背景
* @parent <Window>
* @type select
* @option 通常 @value 0
* @option 暗くする @value 1
* @option 透明 @value 2
* @desc 勝利時のウィンドウ背景です。
*
* @param WindowX
* @text ウィンドウのX座標
* @parent <Window>
* @type string
* @default 0
* @desc ウィンドウを表示するX座標です。
*
* @param WindowY
* @text ウィンドウのY座標
* @parent <Window>
* @type string
* @default 0
* @desc ウィンドウを表示するY座標です。
*
* @param WindowWidth
* @text ウィンドウの横幅
* @parent <Window>
* @type string
* @default Graphics.boxWidth
* @desc ウィンドウの横幅です。
* 「Graphics.boxWidth」で全体になります。
*
* @param WindowHeight
* @text ウィンドウの縦幅
* @parent <Window>
* @type string
* @default Graphics.boxHeight
* @desc ウィンドウの縦幅です。
* 「Graphics.boxHeight」で全体になります。
*
* @param DefeatWindowBackground
* @text 敗北時のウィンドウ背景
* @parent <Window>
* @type select
* @option 通常 @value 0
* @option 暗くする @value 1
* @option 透明 @value 2
* @desc 敗北時のウィンドウ背景です。
*
* @param <DimmerWindow>
* @text <暗くする関連>
* @desc ウィンドウを暗くするにした場合の設定です。
*
* @param GradientType
* @text グラデーション方式
* @parent <DimmerWindow>
* @type select
* @option 0:なし @value 0
* @option 1:横 @value 1
* @option 2:縦 @value 2
* @default 2
* @desc ウィンドウのグラデーション方式です。
*
* @param StartGradientSize
* @text 開始グラデーション幅
* @parent <DimmerWindow>
* @type number
* @desc ウィンドウの開始グラデーション幅です。
* 初期値は12です。
*
* @param EndGradientSize
* @text 終了グラデーション幅
* @parent <DimmerWindow>
* @type number
* @desc ウィンドウの終了グラデーション幅です。
* 初期値は12です。
*
* @param DimmerColor
* @text 色調
* @parent <DimmerWindow>
* @type string
* @desc ウィンドウの色調(赤、緑、青、不透明度)です。
* 初期値は"rgba(0, 0, 0, 0.6)"です。
*
* @param <Message>
* @text <メッセージ関連>
*
* @param MessageSpeed
* @text メッセージ速度
* @parent <Message>
* @type number
* @default 100
* @desc 100を標準としてメッセージ速度を設定してください。
* 例えば、150なら通常の1.5倍速となります。
*
* @param FontSize
* @text フォントサイズ
* @parent <Message>
* @type number
* @desc 勝利メッセージのフォントサイズです。
* 未指定ならシステム設定を使います。
*
* @param LineHeight
* @text 行の縦幅
* @parent <Message>
* @type number
* @desc 勝利ウィンドウの行の縦幅です。
* 初期値は36です。
*
* @param AdjustMessageX
* @text メッセージX座標調整
* @parent <Message>
* @type number @min -999 @max 999
* @desc メッセージのX座標を調整します。
*
* @param AdjustMessageY
* @text メッセージY座標調整
* @parent <Message>
* @type number @min -999 @max 999
* @desc メッセージのY座標を調整します。
*
* @param MessageFitWidth
* @text 横幅を自動で縮小
* @parent <Message>
* @type boolean
* @default false
* @desc ウィンドウの横幅に合わせて自動でメッセージを縮小します。
*
* @param <Actor>
* @text <アクター関連>
*
* @param UseActorHeadline
* @text アクターの見出しを使用
* @parent <Actor>
* @type boolean
* @default false
* @desc レベルアップ時にアクター名の見出しを使用します。
*
* @param ActorHeadline
* @text アクターの見出し
* @parent <Actor>
* @type string
* @default \c[16]【%1】\c[0]
* @desc アクター名の見出しです。%1=アクター名
*
* @param <DropItem>
* @text <ドロップアイテム関連>
*
* @param DropItemHeadline
* @text ドロップアイテムの見出し
* @parent <DropItem>
* @type string
* @default \c[16]【戦利品】\c[0]
* @desc ドロップアイテムの見出しです。
* 不要なら空欄にしてください。
*
* @param DropItemDisplay
* @text ドロップアイテムの表示
* @parent <DropItem>
* @type string
* @default %2%1 × %3
* @desc ドロップアイテムの表示形式です。
* %1=アイテム名, %2=アイコン, %3=個数
*
* @param DropItemNewline
* @text ドロップアイテムの改行
* @parent <DropItem>
* @type boolean
* @default true
* @desc ドロップアイテムの見出しの前に改行を挿入します。
*
* @param DropItemConsolidate
* @text ドロップアイテムの集約
* @parent <DropItem>
* @type boolean
* @default true
* @desc 同じアイテムならば、ドロップアイテムの個数を集約して表示します。
*
* @param <AdditionalClasses>
* @text <多重職業連携用>
* @desc 多重職業プラグインとの連携用の項目です。
*
* @param AC_DisplayStyle
* @text 【多重】表示方式
* @parent <AdditionalClasses>
* @type select
* @option 改ページ @value page
* @option 一括表示 @value batch
* @option 一括+入力待ち @value input
* @default input
* @desc 追加職業のレベルアップ時の動作です。
* 一括表示なら通常レベルアップと同ページに表示します。
*
* @param <LevelUp>
* @text <レベルアップ関連>
* @desc レベルアップ時の演出に関する設定です。
*
* @param EnableLevelUpWait
* @parent <LevelUp>
* @text レベルアップ前にウェイト
* @desc ONにすると、レベルアップ表示前に1秒間のウェイト待ちを入れます。決定キー長押しでスキップ可能です。
* @type boolean
* @default true
*
* @param StopVictoryMe
* @parent <LevelUp>
* @text 勝利MEを停止
* @desc ONにすると、レベルアップ表示のタイミングで勝利ME音楽を停止します。
* @type boolean
* @default true
*
* @param LevelUpSE
* @parent <LevelUp>
* @text レベルアップSE
* @desc レベルアップ時に再生する効果音です。
* @type file
* @dir audio/se
* @default Powerup
*
* @param LevelUpVolume
* @parent <LevelUp>
* @text SEの音量
* @desc レベルアップSEの音量です。
* @type number
* @default 90
*
* @param LevelUpPitch
* @parent <LevelUp>
* @text SEのピッチ
* @desc レベルアップSEのピッチです。
* @type number
* @default 100
*
* @param LevelUpPan
* @parent <LevelUp>
* @text SEの位相
* @desc レベルアップSEの位相パンです。
* @type number
* @default 0
*
*/
(function() {
"use strict";
function toBoolean(str, def) {
if (str === true || str === "true") {
return true;
} else if (str === false || str === "false") {
return false;
}
return def;
}
function toNumber(str, def) {
if (str === "") {
return def;
}
return isNaN(str) ? def : +(str || def);
}
function setDefault(str, def) {
if (str == undefined || str === "") {
return def;
}
return str;
}
const PLUGIN_NAME = "NRP_VictoryRewards_Custom";
const parameters = PluginManager.parameters(PLUGIN_NAME);
const pNotDisplayVictoryMessage = toBoolean(parameters["NotDisplayVictoryMessage"]);
const pApplyNotBattle = toBoolean(parameters["ApplyNotBattle"]);
const pStartCommmonEvent = setDefault(parameters["StartCommmonEvent"]);
const pEndCommmonEvent = setDefault(parameters["EndCommmonEvent"]);
// ウィンドウ関連
const pVictoryWindowBackground = toNumber(parameters["VictoryWindowBackground"]);
const pWindowX = setDefault(parameters["WindowX"]);
const pWindowY = setDefault(parameters["WindowY"]);
const pWindowWidth = setDefault(parameters["WindowWidth"]);
const pWindowHeight = setDefault(parameters["WindowHeight"]);
const pDefeatWindowBackground = toNumber(parameters["DefeatWindowBackground"]);
const pGradientType = toNumber(parameters["GradientType"], 2);
const pStartGradientSize = toNumber(parameters["StartGradientSize"]);
const pEndGradientSize = toNumber(parameters["EndGradientSize"]);
const pDimmerColor = setDefault(parameters["DimmerColor"]);
// メッセージ関連
const pMessageSpeed = toNumber(parameters["MessageSpeed"], 100);
const pFontSize = toNumber(parameters["FontSize"]);
const pLineHeight = toNumber(parameters["LineHeight"]);
const pAdjustMessageX = toNumber(parameters["AdjustMessageX"]);
const pAdjustMessageY = toNumber(parameters["AdjustMessageY"]);
const pMessageFitWidth = toBoolean(parameters["MessageFitWidth"]);
// アクター関連
const pUseActorHeadline = toBoolean(parameters["UseActorHeadline"]);
const pActorHeadline = setDefault(parameters["ActorHeadline"]);
// ドロップアイテム関連
const pDropItemHeadline = setDefault(parameters["DropItemHeadline"]);
const pDropItemDisplay = setDefault(parameters["DropItemDisplay"]);
const pDropItemNewline = toBoolean(parameters["DropItemNewline"]);
const pDropItemConsolidate = toBoolean(parameters["DropItemConsolidate"]);
// 多重職業関連
const pAC_DisplayStyle = setDefault(parameters["AC_DisplayStyle"], "input");
// レベルアップ関連
const pEnableLevelUpWait = toBoolean(parameters["EnableLevelUpWait"], true);
const pStopVictoryMe = toBoolean(parameters["StopVictoryMe"], true);
const pLevelUpSE = setDefault(parameters["LevelUpSE"], "Powerup");
const pLevelUpVolume = toNumber(parameters["LevelUpVolume"], 90);
const pLevelUpPitch = toNumber(parameters["LevelUpPitch"], 100);
const pLevelUpPan = toNumber(parameters["LevelUpPan"], 0);
let mIsRewardsMessage = false;
let mIsRewardsMessageInit = false;
const _Scene_Title_initialize = Scene_Title.prototype.initialize;
Scene_Title.prototype.initialize = function() {
_Scene_Title_initialize.apply(this, arguments);
mIsRewardsMessage = false;
mIsRewardsMessageInit = false;
};
const _BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
$gameTemp._firstLevelUpDisplayed = false;
if (pStartCommmonEvent) {
$gameTemp.reserveCommonEvent(pStartCommmonEvent);
$gameTroop._interpreter.setupReservedCommonEvent();
$gameTroop._interpreter.update();
}
_BattleManager_processVictory.apply(this, arguments);
};
const _BattleManager_displayVictoryMessage = BattleManager.displayVictoryMessage;
BattleManager.displayVictoryMessage = function() {
mIsRewardsMessage = true;
mIsRewardsMessageInit = true;
if (pVictoryWindowBackground != null) {
$gameMessage.setBackground(pVictoryWindowBackground);
}
if (pNotDisplayVictoryMessage) {
return;
}
_BattleManager_displayVictoryMessage.apply(this, arguments);
};
const _BattleManager_displayDefeatMessage = BattleManager.displayDefeatMessage;
BattleManager.displayDefeatMessage = function() {
if (pDefeatWindowBackground != null) {
$gameMessage.setBackground(pDefeatWindowBackground);
}
_BattleManager_displayDefeatMessage.apply(this, arguments);
};
const _BattleManager_updateBattleEnd = BattleManager.updateBattleEnd;
BattleManager.updateBattleEnd = function() {
if (pEndCommmonEvent) {
$gameTemp.reserveCommonEvent(pEndCommmonEvent);
$gameTroop._interpreter.setupReservedCommonEvent();
$gameTroop._interpreter.update();
}
_BattleManager_updateBattleEnd.apply(this, arguments);
mIsRewardsMessage = false;
delete $gameTemp._firstLevelUpDisplayed;
}
BattleManager.displayDropItems = function() {
const items = this._rewards.items;
if (items.length === 0) {
return;
}
const groupItems = [];
if (pDropItemConsolidate) {
for (const item of items) {
const findItem = groupItems.find(i => i.item === item);
if (findItem) {
findItem.count++;
} else {
groupItems.push({item: item, count: 1});
}
}
} else {
for (const item of items) {
groupItems.push({item: item, count: 1});
}
}
if (pDropItemNewline) {
$gameMessage.add("");
}
if (pDropItemHeadline) {
$gameMessage.add(pDropItemHeadline);
}
for (const group of groupItems) {
const item = group.item;
if (pDropItemDisplay) {
$gameMessage.add(pDropItemDisplay.format(item.name, "\\i[" + item.iconIndex + "]", group.count));
} else {
$gameMessage.add(TextManager.obtainItem.format(item.name));
}
}
};
let mTempLevelUp = false;
const _Game_Actor_gainExp = Game_Actor.prototype.gainExp;
Game_Actor.prototype.gainExp = function(exp) {
mTempLevelUp = false;
_Game_Actor_gainExp.apply(this, arguments);
mTempLevelUp = false;
};
/**
* ●レベルアップメッセージの表示 (【上書】)
* 改ページ処理とMEのフェードアウトを追加。
*/
Game_Actor.prototype.displayLevelUp = function(newSkills) {
let firstPrefix = "";
// 最初のレベルアップ時のみ適用する処理
if (!$gameTemp._firstLevelUpDisplayed) {
// ★追加: レベルアップ表示の際にウィンドウを改ページする
$gameMessage.newPage();
if (pStopVictoryMe) {
firstPrefix += "\\STOPME";
}
if (pEnableLevelUpWait) {
firstPrefix += "\\|";
}
$gameTemp._firstLevelUpDisplayed = true;
}
const everyTimePrefix = "\\LVUPSE";
const finalPrefix = firstPrefix + everyTimePrefix;
const levelUpMessage = TextManager.levelUp.format(
this._name,
TextManager.level,
this._level
);
if (pUseActorHeadline && pActorHeadline) {
$gameMessage.add(finalPrefix + pActorHeadline.format(this._name));
$gameMessage.add(levelUpMessage);
} else {
$gameMessage.add(finalPrefix + levelUpMessage);
}
for (const skill of newSkills) {
$gameMessage.add(TextManager.obtainSkill.format(skill.name));
}
mTempLevelUp = true;
};
const PLUGIN_NAME_MESSAGE_PICTURE = "NRP_MessagePicture";
const parametersMessagePicture = PluginManager.parameters(PLUGIN_NAME_MESSAGE_PICTURE);
const pShowAboveWindow = toBoolean(parametersMessagePicture["ShowAboveWindow"]);
const pShowBelowMessages = toBoolean(parametersMessagePicture["ShowBelowMessages"]);
Window_Message.prototype.initVictoryRewards = function() {
const x = setDefault(eval(pWindowX), this.x);
const y = setDefault(eval(pWindowY), this.y);
const width = setDefault(eval(pWindowWidth), this.width);
const height = setDefault(eval(pWindowHeight), this.height);
this.move(x, y, width, height);
this.createContents();
if (pShowAboveWindow && pShowBelowMessages) {
this.contentsSprite().x = this.x;
this.contentsSprite().y = this.y;
}
if (pAdjustMessageX) {
this.contentsSprite().x += pAdjustMessageX;
}
if (pAdjustMessageY) {
this.contentsSprite().y += pAdjustMessageY;
}
mIsRewardsMessageInit = false;
this._isVictoryReward = true;
};
const _Window_Message_updateOpen = Window_Message.prototype.updateOpen;
Window_Message.prototype.updateOpen = function() {
if (this._opening) {
if (mIsRewardsMessage && mIsRewardsMessageInit) {
this.initVictoryRewards();
}
}
_Window_Message_updateOpen.apply(this, arguments);
};
const _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement;
Window_Message.prototype.updatePlacement = function() {
if (mIsRewardsMessage) {
return;
}
_Window_Message_updatePlacement.apply(this, arguments);
}
if (Window_Message.prototype.lineHeight === Window_Base.prototype.lineHeight) {
Window_Message.prototype.lineHeight = function() {
return Window_Base.prototype.lineHeight.apply(this, arguments);
}
}
const _Window_Message_lineHeight = Window_Message.prototype.lineHeight;
Window_Message.prototype.lineHeight = function() {
if (mIsRewardsMessage && pLineHeight) {
return pLineHeight;
}
return _Window_Message_lineHeight.apply(this, arguments);
};
if (Window_Message.prototype.resetFontSettings === Window_Base.prototype.resetFontSettings) {
Window_Message.prototype.resetFontSettings = function() {
return Window_Base.prototype.resetFontSettings.apply(this, arguments);
}
}
const _Window_Message_resetFontSettings = Window_Message.prototype.resetFontSettings;
Window_Message.prototype.resetFontSettings = function() {
_Window_Message_resetFontSettings.apply(this, arguments);
if (mIsRewardsMessage && pFontSize) {
this.contents.fontSize = pFontSize;
}
};
if (Window_Message.prototype.updateOpen === Window_Base.prototype.updateOpen) {
Window_Message.prototype.updateOpen = function() {
return Window_Base.prototype.updateOpen.apply(this, arguments);
}
}
Window_Message.prototype.contentsSprite = function() {
if (this._contentsSprite) {
return this._contentsSprite;
} else if (this._windowContentsSprite) {
return this._windowContentsSprite;
}
}
if (pVictoryWindowBackground == 1) {
if (Window_Message.prototype.refreshDimmerBitmap === Window_Base.prototype.refreshDimmerBitmap) {
Window_Message.prototype.refreshDimmerBitmap = function() {
return Window_Base.prototype.refreshDimmerBitmap.apply(this, arguments);
}
}
const _Window_Message_refreshDimmerBitmap = Window_Message.prototype.refreshDimmerBitmap;
Window_Message.prototype.refreshDimmerBitmap = function() {
if (!mIsRewardsMessage) {
_Window_Message_refreshDimmerBitmap.apply(this, arguments);
return;
}
if (mIsRewardsMessageInit) {
this.initVictoryRewards();
}
if (this._dimmerSprite) {
const bitmap = this._dimmerSprite.bitmap;
const windowWidth = setDefault(eval(pWindowWidth) + 8, this.width + 8);
const windowHeight = setDefault(eval(pWindowHeight), this.height);
const m1 = startGradientSize(this);
const m2 = endGradientSize(this);
const c1 = pDimmerColor ?? ColorManager.dimColor1();
const c2 = ColorManager.dimColor2();
bitmap.resize(windowWidth, windowHeight);
let w = windowWidth;
let h = windowHeight;
if (pGradientType == 1) {
w -= m1 + m2;
} else if (pGradientType == 2) {
h -= m1 + m2;
}
if (pGradientType == 1) {
bitmap.gradientFillRect(0, 0, m1, h, c2, c1, false);
bitmap.fillRect(m1, 0, w, h, c1);
bitmap.gradientFillRect(m1 + w, 0, m2, h, c1, c2, false);
} else if (pGradientType == 2) {
bitmap.gradientFillRect(0, 0, w, m1, c2, c1, true);
bitmap.fillRect(0, m1, w, h, c1);
bitmap.gradientFillRect(0, m1 + h, w, m2, c1, c2, true);
}
this._dimmerSprite.setFrame(0, 0, windowWidth, windowHeight);
}
};
}
function startGradientSize(win) {
if (pStartGradientSize != undefined) {
return eval(pStartGradientSize);
}
return win.padding;
};
function endGradientSize(win) {
if (pEndGradientSize != undefined) {
return eval(pEndGradientSize);
}
return win.padding;
};
if (pMessageFitWidth) {
let mLineText = "";
let mTextScale = null;
let mNoControl = false;
const _Window_Message_initMembers = Window_Message.prototype.initMembers;
Window_Message.prototype.initMembers = function() {
_Window_Message_initMembers.apply(this, arguments);
mTextScale = null;
};
if (Window_Message.prototype.flushTextState == Window_Base.prototype.flushTextState) {
Window_Message.prototype.flushTextState = function() {
return Window_Base.prototype.flushTextState.apply(this, arguments);
}
}
const _Window_Message_flushTextState = Window_Message.prototype.flushTextState;
Window_Message.prototype.flushTextState = function(textState) {
if (!mIsRewardsMessage) {
_Window_Message_flushTextState.apply(this, arguments);
return;
}
const preCharacter = textState.text[textState.index - 1];
if (textState.index <= 1 || preCharacter == "\n" || preCharacter == "\f") {
let index = textState.index;
if (textState.index <= 1) {
index--;
}
mLineText = "";
mTextScale = null;
while (true) {
const c = textState.text[index];
if (index >= textState.text.length || c == "\n" || c == "\f") {
break;
}
if (c != null) {
mLineText += c;
}
index++;
}
const regExp = /\x1b[a-zA-Z]+\[.+\]/i;
mLineText = mLineText.replace(regExp, "");
mIsRewardsMessage = false;
mNoControl = true;
const textWidth = this.textSizeEx(mLineText).width;
mIsRewardsMessage = true;
mNoControl = false;
const maxWidth = this.innerWidth - this.padding;
if (textWidth > maxWidth) {
mTextScale = maxWidth / textWidth;
}
}
_Window_Message_flushTextState.apply(this, arguments);
};
if (Window_Message.prototype.textWidth == Window_Base.prototype.textWidth) {
Window_Message.prototype.textWidth = function(text) {
return Window_Base.prototype.textWidth.apply(this, arguments);
}
}
const _Window_Message_textWidth = Window_Message.prototype.textWidth;
Window_Message.prototype.textWidth = function(text) {
let width = _Window_Message_textWidth.apply(this, arguments);
if (mTextScale) {
return width * mTextScale;
}
return width;
};
const _Window_Message_processControlCharacter = Window_Message.prototype.processControlCharacter;
Window_Message.prototype.processControlCharacter = function(textState, c) {
if (mNoControl) {
return;
}
_Window_Message_processControlCharacter.apply(this, arguments);
};
}
if (pApplyNotBattle) {
const _Game_Interpreter_command315 = Game_Interpreter.prototype.command315;
Game_Interpreter.prototype.command315 = function(params) {
const ret = _Game_Interpreter_command315.apply(this, arguments);
if (params[5] && $gameMessage.isBusy()) {
mIsRewardsMessage = true;
mIsRewardsMessageInit = true;
if (pVictoryWindowBackground != null) {
$gameMessage.setBackground(pVictoryWindowBackground);
}
this.setWaitMode("message");
}
return ret;
};
const _Game_Interpreter_command316 = Game_Interpreter.prototype.command316;
Game_Interpreter.prototype.command316 = function(params) {
const ret = _Game_Interpreter_command316.apply(this, arguments);
if (params[5] && $gameMessage.isBusy()) {
mIsRewardsMessage = true;
mIsRewardsMessageInit = true;
if (pVictoryWindowBackground != null) {
$gameMessage.setBackground(pVictoryWindowBackground);
}
this.setWaitMode("message");
}
return ret;
};
const _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage;
Window_Message.prototype.terminateMessage = function() {
_Window_Message_terminateMessage.apply(this, arguments);
mIsRewardsMessage = false;
mIsRewardsMessageInit = false;
mTempLevelUp = false;
this._isVictoryReward = false;
};
}
let mMessageCount = 0;
const _Window_Message_startMessage = Window_Message.prototype.startMessage;
Window_Message.prototype.startMessage = function() {
if (!mIsRewardsMessage) {
_Window_Message_startMessage.apply(this, arguments);
return;
}
mMessageCount = 0;
_Window_Message_startMessage.apply(this, arguments);
}
const _Window_Message_updateMessage = Window_Message.prototype.updateMessage;
Window_Message.prototype.updateMessage = function() {
if (!mIsRewardsMessage) {
return _Window_Message_updateMessage.apply(this, arguments);
}
if (!this._textState) {
return false;
}
mMessageCount += getMessageSpeed() / 100;
return _Window_Message_updateMessage.apply(this, arguments);
};
const _Window_Message_shouldBreakHere = Window_Message.prototype.shouldBreakHere;
Window_Message.prototype.shouldBreakHere = function(textState) {
if (!mIsRewardsMessage) {
return _Window_Message_shouldBreakHere.apply(this, arguments);
}
mMessageCount--;
if (mMessageCount >= 1 && this.canBreakHere(textState)) {
if (this.isWaiting()) {
mMessageCount = 0;
return true;
}
return false;
}
return _Window_Message_shouldBreakHere.apply(this, arguments);
};
function getMessageSpeed() {
return pMessageSpeed;
}
if (typeof AdditionalClass !== "undefined") {
const _AdditionalClass_displayLevelUp = AdditionalClass.prototype.displayLevelUp;
AdditionalClass.prototype.displayLevelUp = function(newSkills) {
if (pApplyNotBattle && !$gameParty.inBattle()) {
mIsRewardsMessage = true;
mIsRewardsMessageInit = true;
if (pVictoryWindowBackground != null) {
$gameMessage.setBackground(pVictoryWindowBackground);
}
if (pUseActorHeadline && pActorHeadline && $gameMessage._texts.length == 0) {
_AdditionalClass_displayLevelUp.apply(this, arguments);
$gameMessage._texts.splice(0, 0, pActorHeadline.format(this.actor()._name));
mTempLevelUp = true;
return;
}
}
_AdditionalClass_displayLevelUp.apply(this, arguments);
for (let i = $gameMessage._texts.length - 1; i >= 0; i--) {
if ($gameMessage._texts[i].indexOf("\f") != -1) {
if (mTempLevelUp) {
if (pAC_DisplayStyle == "batch") {
$gameMessage._texts[i] = $gameMessage._texts[i].replace("\f", "\n");
} else if (pAC_DisplayStyle == "input") {
$gameMessage._texts[i] = $gameMessage._texts[i].replace("\f", "\n\\!");
}
} else {
if (pUseActorHeadline && pActorHeadline) {
$gameMessage._texts.splice(i + 1, 0, pActorHeadline.format(this.actor()._name));
}
mTempLevelUp = true;
}
return;
}
}
};
}
/**
* ● 新規制御文字の処理 (【更新】)
* MEの停止をフェードアウトに変更
*/
const _Window_Base_processEscapeCharacter = Window_Base.prototype.processEscapeCharacter;
Window_Base.prototype.processEscapeCharacter = function(code, textState) {
const upperCode = code.toUpperCase();
switch (upperCode) {
case 'STOPME':
// ★変更点: 0.5秒かけてフェードアウトさせる
AudioManager.fadeOutMe(0.5);
break;
case 'LVUPSE':
const se = {
name: pLevelUpSE,
volume: pLevelUpVolume,
pitch: pLevelUpPitch,
pan: pLevelUpPan
};
if (se.name) {
AudioManager.playSe(se);
}
break;
default:
_Window_Base_processEscapeCharacter.call(this, code, textState);
break;
}
};
})();