//============================================================================= // ParamTextColorChanger.js // ---------------------------------------------------------------------------- // (C)2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.2.2 2025/05/05 パラメータのテキストカラー指定に対応 // 1.2.1 2022/04/19 名称のカラーは変更しない設定のとき装備変更画面でアクター変更すると、アクター名称がシステムカラーで表示されてしまう問題を修正 // 1.2.0 2022/02/16 アクター名称のテキストカラーをHPカラーと連動させるデフォルト仕様を撤廃できる機能を追加 // 1.1.0 2022/02/16 MZで動作するよう修正 // パラメータに以上以下の条件を指定できる機能を追加 // 1.0.0 2016/11/25 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/ParamTextColorChanger.js @plugindesc Parameter text color change plug-in @author Triacontane @license MIT License @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/triacontane-MZ-plugins ). Original plugin by Triacontane. Please check the latest official version at: https://triacontane.blogspot.com ----- ParamTextColorChanger.js Changes the text color of HP, MP, and TP values based on their current percentage. This plugin requires the base plugin "PluginCommonBase.js." "PluginCommonBase.js" is located in the following folder under the RPG Maker MZ installation folder: dlc/BasicResources/plugins/official Terms of Use: You may modify and redistribute this plugin without permission, and there are no restrictions on its use (commercial, 18+, etc.). This plugin is now yours. @param HpColors @text HP Text Color @desc Changes the HP text color according to the percentage. Items are evaluated in order from the top of the list. @type struct[] @default [] @param MpColors @text MP Text Color @desc Changes the text color of MP according to the percentage. They are evaluated in order from the top of the list. @type struct[] @default [] @param TpColors @text TP Text Color @desc Changes the text color of TP according to the percentage. It is evaluated in order from the top of the list. @type struct[] @default [] @param NameColorNoChange @text Do not change the name color @desc The default setting of linking the actor name text color to HP color will be removed. @type boolean @default false */ /*~struct~Color: @param operand @text Percentage setting value @desc The percentage of the parameter (0% - 100%) when determining the condition. @type number @default 0 @min 0 @max 100 @param sign @text conditional sign @desc Sets whether the parameter percentage is greater than or equal to the specified value or less than or equal to the specified value. @type select @default ≥ @option ≥ (if greater than or equal to the specified percentage) @value ≥ @option ≤ (if below specified percentage) @value ≤ @param colorIndex @text Color Index @desc The color index (a number specified by \c[n]) that will change when the specified condition is met. @type color @default 0 */ /*:ja @plugindesc パラメータテキストカラー変更プラグイン @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/ParamTextColorChanger.js @base PluginCommonBase @orderAfter PluginCommonBase @author トリアコンタン @param HpColors @text HPテキストカラー @desc HPのテキストカラーを割合に応じて変更します。リストの上から順番に評価されます。 @default [] @type struct[] @param MpColors @text MPテキストカラー @desc MPのテキストカラーを割合に応じて変更します。リストの上から順番に評価されます。 @default [] @type struct[] @param TpColors @text TPテキストカラー @desc TPのテキストカラーを割合に応じて変更します。リストの上から順番に評価されます。 @default [] @type struct[] @param NameColorNoChange @text 名称のカラーは変更しない @desc アクター名称のテキストカラーをHPカラーと連動させるデフォルト仕様を撤廃します。 @default false @type boolean @help ParamTextColorChanger.js 現在の割合に応じて、HP、MPおよびTPの数値のテキストカラーを変更できます。 このプラグインの利用にはベースプラグイン『PluginCommonBase.js』が必要です。 『PluginCommonBase.js』は、RPGツクールMZのインストールフォルダ配下の 以下のフォルダに格納されています。 dlc/BasicResources/plugins/official 利用規約: 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) についても制限はありません。 このプラグインはもうあなたのものです。 */ /*~struct~Color:ja @param operand @text 割合設定値 @desc 条件判定する際のパラメータの割合(0% - 100%)です。 @default 0 @type number @min 0 @max 100 @param sign @text 条件符号 @desc パラメータの割合が指定値以上か指定値以下かを設定します。 @default ≥ @type select @option ≥ (指定割合以上の場合) @value ≥ @option ≤ (指定割合以下の場合) @value ≤ @param colorIndex @text カラーインデックス @desc 指定した条件を満たしたときに変更されるカラーインデックス(\c[n]で指定する数値)です。 @default 0 @type color */ (()=> { 'use strict'; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); if (!param.HpColors) { param.HpColors = []; } if (!param.MpColors) { param.MpColors = []; } if (!param.TpColors) { param.TpColors = []; } //============================================================================= // Window_Base // テキストカラーを変更します。 //============================================================================= const _ColorManager_hpColor = ColorManager.hpColor; ColorManager.hpColor = function(actor) { const defaultColor = _ColorManager_hpColor.apply(this, arguments); return this.findParamTextColor(param.HpColors, actor.hpRate()) || defaultColor; }; const _ColorManager_mpColor = ColorManager.mpColor; ColorManager.mpColor = function(actor) { const defaultColor = _ColorManager_mpColor.apply(this, arguments); return this.findParamTextColor(param.MpColors, actor.mpRate()) || defaultColor; }; const _ColorManager_tpColor = ColorManager.tpColor; ColorManager.tpColor = function(actor) { const defaultColor = _ColorManager_tpColor.apply(this, arguments); return this.findParamTextColor(param.TpColors, actor.tpRate()) || defaultColor; }; ColorManager.findParamTextColor = function(paramList, rate) { const color = paramList.find(item => { const operand = item.operand / 100; return item.sign === '≥' ? rate >= operand : rate <= operand; }); return color ? this.textColor(color.colorIndex) : null; }; if (param.NameColorNoChange) { const _Window_StatusBase_drawActorName = Window_StatusBase.prototype.drawActorName; Window_StatusBase.prototype.drawActorName = function(actor, x, y, width) { this._invalidChangeColor = true; _Window_StatusBase_drawActorName.apply(this, arguments); this._invalidChangeColor = false; }; const _Window_EquipStatus_refresh = Window_EquipStatus.prototype.refresh; Window_EquipStatus.prototype.refresh = function() { this.changeTextColor(ColorManager.normalColor()); _Window_EquipStatus_refresh.apply(this, arguments); }; const _Window_Base_initialize = Window_Base.prototype.initialize; Window_Base.prototype.initialize = function(rect) { _Window_Base_initialize.apply(this, arguments); this._invalidChangeColor = false; }; const _Window_Base_changeTextColor = Window_Base.prototype.changeTextColor; Window_Base.prototype.changeTextColor = function(color) { if (this._invalidChangeColor) { return; } _Window_Base_changeTextColor.apply(this, arguments); }; const _Sprite_Name_textColor = Sprite_Name.prototype.textColor; Sprite_Name.prototype.textColor = function() { _Sprite_Name_textColor.apply(this, arguments); return ColorManager.normalColor(); }; } })();