115 lines
No EOL
4.2 KiB
JavaScript
115 lines
No EOL
4.2 KiB
JavaScript
/*=============================================================================
|
||
BattleLogOutput.js
|
||
----------------------------------------------------------------------------
|
||
(C)2023 Triacontane
|
||
This software is released under the MIT License.
|
||
http://opensource.org/licenses/mit-license.php
|
||
----------------------------------------------------------------------------
|
||
Version
|
||
1.1.3 2025/07/07 通常のバトルログまで消去されてしまう不具合を修正
|
||
1.1.2 2025/07/07 ベースライン追加を強制的にfalseにする修正
|
||
1.1.1 2025/07/07 PluginCommonBaseへの依存をなくし、単体で動作するように修正
|
||
1.1.0 2025/07/07 最大行数を超えた場合に古いログを消去する機能を追加
|
||
1.0.0 2023/08/11 初版
|
||
----------------------------------------------------------------------------
|
||
[Blog] : https://triacontane.blogspot.jp/
|
||
[Twitter]: https://twitter.com/triacontane/
|
||
[GitHub] : https://github.com/triacontane/
|
||
=============================================================================*/
|
||
|
||
/*:
|
||
* @plugindesc バトルログ出力プラグイン(v1.1.3)
|
||
* @target MZ
|
||
* @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/BattleLogOutput.js
|
||
* @author トリアコンタン
|
||
*
|
||
* @param maxLines
|
||
* @text 最大行数
|
||
* @desc バトルログの最大表示行数です。0を指定すると無制限になります。
|
||
* @default 4
|
||
* @type number
|
||
*
|
||
* @command OUTPUT_LOG
|
||
* @text バトルログ出力
|
||
* @desc バトルログを出力します。
|
||
*
|
||
* @arg message
|
||
* @text 出力メッセージ
|
||
* @desc バトルログとして出力するメッセージです。
|
||
* @default
|
||
* @type multiline_string
|
||
*
|
||
* @arg pushBaseLine
|
||
* @text ベースライン追加
|
||
* @desc 【この設定は無視されます】バトルログ出力前に表示していたログを消去し、先頭からログ出力します。
|
||
* @default true
|
||
* @type boolean
|
||
*
|
||
* @arg waitCount
|
||
* @text ウェイト
|
||
* @desc 指定したフレームが経過したのち、すべてのログを削除します。0を指定するとログは削除されません。
|
||
* @default 0
|
||
* @type number
|
||
*
|
||
* @help BattleLogOutput.js
|
||
*
|
||
* プラグインコマンドからバトルログを出力できます。
|
||
* このコマンドは戦闘画面でのみ有効です。
|
||
*
|
||
* 【v1.1.2での変更】
|
||
* プラグインコマンドの「ベースライン追加」の設定を無視し、
|
||
* 常にログを追記するようになりました。
|
||
*
|
||
* 利用規約:
|
||
* 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
|
||
* についても制限はありません。
|
||
* このプラグインはもうあなたのものです。
|
||
*/
|
||
|
||
(() => {
|
||
'use strict';
|
||
const pluginName = "BattleLogOutput";
|
||
const parameters = PluginManager.parameters(pluginName);
|
||
const maxLines = Number(parameters.maxLines || 0);
|
||
|
||
PluginManager.registerCommand(pluginName, 'OUTPUT_LOG', args => {
|
||
const message = args.message;
|
||
const pushBaseLine = false;
|
||
const waitCount = Number(args.waitCount);
|
||
BattleManager.displayCustomLog(message, pushBaseLine, waitCount);
|
||
});
|
||
|
||
BattleManager.displayCustomLog = function(text, pushBaseLine, waitCount) {
|
||
this._logWindow.displayCustomLog(text, pushBaseLine, waitCount);
|
||
};
|
||
|
||
Window_BattleLog.prototype.displayCustomLog = function(text, pushBaseLine, waitCount) {
|
||
if (pushBaseLine) {
|
||
this.push("pushBaseLine");
|
||
}
|
||
const textList = text.split('\n');
|
||
textList.forEach(line => this.push('addText', line));
|
||
if (waitCount > 0) {
|
||
this.push('waitForCount', waitCount);
|
||
this.push("clear");
|
||
}
|
||
};
|
||
|
||
Window_BattleLog.prototype.waitForCount = function(count) {
|
||
this._waitCount = count;
|
||
};
|
||
|
||
const _Window_BattleLog_addText = Window_BattleLog.prototype.addText;
|
||
Window_BattleLog.prototype.addText = function(text) {
|
||
_Window_BattleLog_addText.apply(this, arguments);
|
||
|
||
if (maxLines > 0) {
|
||
while (this._lines.length > maxLines) {
|
||
this._lines.shift();
|
||
}
|
||
this.refresh();
|
||
}
|
||
};
|
||
|
||
// pushBaseLineを書き換える処理を完全に削除しました。
|
||
})(); |