File size: 5,192 Bytes
99b0de1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | //=============================================================================
// Plugin for RPG Maker MZ
// GR_EquipDisplayCustom.js
// ----------------------------------------------------------------------------
// Released under the MIT License.
// https://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version 1.1.1
//=============================================================================
/*:ja
* @target MZ
* @plugindesc 装備画面で表示項目を任意でオン/オフできるようにします
* @author げれげれ
* @url https://twitter.com/geregeregere
*
*
* @param HP
* @text HP表示
* @desc HP表示
* @default false
* @type boolean
* @on オン
* @off オフ
*
* @param MP
* @text MP表示
* @desc MP表示
* @default false
* @type boolean
* @on オン
* @off オフ
*
* @param ATK
* @text 攻撃力表示
* @desc 攻撃力表示
* @default true
* @type boolean
* @on オン
* @off オフ
*
* @param DEF
* @text 防御力表示
* @desc 防御力表示
* @default true
* @type boolean
* @on オン
* @off オフ
* @param MAT
* @text 魔法力表示
* @desc 魔法力表示
* @default true
* @type boolean
* @on オン
* @off オフ
* @param MDF
* @text 魔法防御表示
* @desc 魔法防御表示
* @default true
* @type boolean
* @on オン
* @off オフ
* @param AGI
* @text 敏捷性表示
* @desc 敏捷性表示
* @default true
* @type boolean
* @on オン
* @off オフ
* @param LUK
* @text 運表示
* @desc 運表示
* @default true
* @type boolean
* @on オン
* @off オフ
*
* @param Adjustment
* @text 自動調整
* @desc 表示項目数が7個以上の場合に文字サイズや表示位置の微調整を行うか
* @default true
* @type boolean
* @on オン
* @off オフ
*
* @help
* 装備画面のステータスに表示させる項目を任意で変更できるようにします。
* (通常は「攻撃力、防御力、魔法力、魔法防御、敏捷性、運」の6項目で
* HPとMPの表示がない)
* 基本想定としてはHPやMPが増減する装備品への対応です。
*
* 『使い方』
* 各能力値についてオン/オフの設定を個別に用意しましたので、
* プラグインパラメータから設定してください。
* 初期値では標準機能と同様の上記6項目です。
*
* なお、元々は6項目しか表示しない箇所に最大で8項目をねじ込みますので、
* 項目数によってわずかに文字を小さくしたり行間隔を詰めたりします。
* →Ver1.1.0でレイアウト調整のオン/オフ機能を実装。
* レイアウト調整が不要、返って邪魔になる場合は「自動調整」をオフにしてください。
*
* プラグインコマンドはありません。
*
* 『注意点』
* 装備画面のレイアウトを調整する性質上、他の装備画面レイアウト変更プラグインとは
* 競合する可能性が高いと思います。
* 相談されれば対応を検討しますがあまり期待はしないでね。
*
*/
'use strict';
{
const PLUGIN_NAME = 'GR_EquipDisplayCustom';
// プラグインパラメータ=================================================
const PARAMETERS = PluginManager.parameters(PLUGIN_NAME);
const PARAM_DISP = Array(8);
let index = 0;
let onCount = 0;
for (let value of Object.values(PARAMETERS)) {
PARAM_DISP[index] = value === 'true' ? true : false;
if (PARAM_DISP[index]) onCount++;
index++;
if (index === 8) break;
}
const ADJUST_FLAG = PARAMETERS.Adjustment === 'true' ? true : false;
// 実処理==============================================================
Window_EquipStatus.prototype.drawAllParams = function () {
let dispIndex = 0;
// 標準のフォントサイズを一時保存
const tempFontSize = this.contents.fontSize;
// 自動調整がオンならば表示項目数に応じてフォントサイズを調整
if (ADJUST_FLAG) {
if (onCount === 7) {
this.contents.fontSize -= 1;
} else if (onCount === 8) {
this.contents.fontSize -= 3;
}
}
for (let i = 0; i < 8; i++) {
if (PARAM_DISP[i]) {
const x = this.itemPadding();
const y = this.paramY(dispIndex, onCount);
this.drawItem(x, y, i);
dispIndex++;
}
}
// フォントサイズを元に戻す
this.contents.fontSize = tempFontSize;
};
// 項目数に応じてyを微調整
Window_EquipStatus.prototype.paramY = function (index, onCount) {
let offsetY = -20;
let shortenSpan = 0;
// 自動調整がオンならば調整を実施
if (ADJUST_FLAG) {
if (onCount === 7) {
offsetY = -2;
shortenSpan = -1;
} else if (onCount === 8) {
offsetY = -8;
shortenSpan = -5;
}
}
const faceHeight = ImageManager.faceHeight;
return (
faceHeight +
Math.floor(
this.lineHeight() * (index + 1.5) + offsetY + shortenSpan * index
)
);
};
}
|