635 lines
21 KiB
JavaScript
635 lines
21 KiB
JavaScript
//=============================================================================
|
|
// SoR_BattleStateHelpWindow_MZ.js
|
|
// SoR License (C) 2020 蒼竜, REQUIRED User Registration on Dragon Cave
|
|
// http://dragonflare.blue/dcave/license.php
|
|
// ----------------------------------------------------------------------------
|
|
// Latest version v1.00 (2022/03/01)
|
|
//=============================================================================
|
|
/*:ja
|
|
@plugindesc <ステートヘルプ機能> v1.00
|
|
@author 蒼竜
|
|
@target MZ
|
|
@orderAfter SoR_TagDataProcessor_MZ
|
|
@base SoR_TagDataProcessor_MZ
|
|
@url https://dragonflare.blue/dcave/
|
|
@help ※要 88.「SoRタグデータ解析」(SoR_TagDataProcessor_MZ)
|
|
|
|
戦闘中に、特定のキーによるトリガーで
|
|
現在の戦闘フィールド上で生じているステート・バフ
|
|
(バトラー頭上等にアイコン表示を伴う諸効果)を一覧化し、
|
|
別途定義したヘルプを表示する機能を実装します。
|
|
|
|
@param -項目表示テキスト-
|
|
@param BuffNameText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc バフ用表示名テキスト(先頭からMHP/MMP/ATK/DEF/...と対応)
|
|
@param BuffHelpText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc バフ用ヘルプテキスト(先頭からMHP/MMP/ATK/DEF/...と対応)
|
|
@param DebuffNameText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc デバフ用表示名テキスト(先頭からMHP/MMP/ATK/DEF/...と対応)
|
|
@param DebuffHelpText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc デバフ用ヘルプテキスト(先頭からMHP/MMP/ATK/DEF/...と対応)
|
|
|
|
@param -UI-
|
|
@param TriggerKey_StateHelp
|
|
@desc ステートヘルプ(戦闘シーンポーズ)起動キー (default: tab)
|
|
@default tab
|
|
@type string
|
|
@param CloseKey_StateHelp
|
|
@desc ステートヘルプ(戦闘シーンポーズ)終了キー (default: cancel)
|
|
@default cancel
|
|
@type string
|
|
@param ControlHelpText
|
|
@type string
|
|
@default カーソル: ステート確認 W/R: 味方/敵切り替え X: 閉じる
|
|
@desc ステートヘルプ起動中に表示するヘルプの操作テキスト
|
|
*/
|
|
/*:
|
|
@plugindesc <Battle State Help Display> v1.00
|
|
@author Soryu
|
|
@target MZ
|
|
@orderAfter SoR_TagDataProcessor_MZ
|
|
@base SoR_TagDataProcessor_MZ
|
|
@url https://dragonflare.blue/dcave/
|
|
@help [Prerequisite] 88. SoR_TagDataProcessor_MZ
|
|
|
|
This plugin presents a battle pause window equipped
|
|
a mechanism to display state help for battlers. Helps for
|
|
buffs and states are originally given by configuration.
|
|
|
|
@param -Text-
|
|
@param BuffNameText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc Buff name text (corresponding to MHP, MMP, ATK, and DEF ...)
|
|
@param BuffHelpText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc Buff help text (corresponding to MHP, MMP, ATK, and DEF ...)
|
|
@param DebuffNameText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc Debuff name text (corresponding to MHP, MMP, ATK, and DEF ...)
|
|
@param DebuffHelpText
|
|
@type string[]
|
|
@default ["","","","","","","",""]
|
|
@desc Debuff help text (corresponding to MHP, MMP, ATK, and DEF ...)
|
|
|
|
@param -UI-
|
|
@param TriggerKey_StateHelp
|
|
@desc A key to trigger to activate the state help window (default: tab)
|
|
@default tab
|
|
@type string
|
|
@param CloseKey_StateHelp
|
|
@desc A key to trigger to terminate the state help window (default: cancel)
|
|
@default cancel
|
|
@type string
|
|
@param ControlHelpText
|
|
@type string
|
|
@default Curosr: Show state help W/R: Switch party/troop X: Close
|
|
@desc Text for the control help in the state help window
|
|
*/
|
|
|
|
(function() {
|
|
if(!PluginManager._scripts.includes("SoR_TagDataProcessor_MZ")) throw new Error("[SoR_BattleStateHelpWindow_MZ] This plugin REQUIRES SoR_TagDataProcessor_MZ.");
|
|
const pluginName = "SoR_BattleStateHelpWindow_MZ";
|
|
const Param = PluginManager.parameters(pluginName);
|
|
|
|
const BuffNameText = convertJsonParam(Param['BuffNameText']) || '';
|
|
const BuffHelpText = convertJsonParam(Param['BuffHelpText']) || '';
|
|
const DebuffNameText = convertJsonParam(Param['DebuffNameText']) || '';
|
|
const DebuffHelpText = convertJsonParam(Param['DebuffHelpText']) || '';
|
|
|
|
const TriggerKey_StateHelp = String(Param['TriggerKey_StateHelp']) || '';
|
|
const CloseKey_StateHelp = String(Param['CloseKey_StateHelp']) || '';
|
|
|
|
const ControlHelpText = String(Param['ControlHelpText']) || '';
|
|
|
|
|
|
function convertJsonParam(param) {
|
|
if (param == undefined) return [];
|
|
let arr = [];
|
|
JSON.parse(param).map(function(param) {
|
|
arr.push(param);
|
|
});
|
|
return arr;
|
|
}
|
|
|
|
const bsd = PluginManager._scripts.includes("SoR_TimeDurationBuffState_MZ_Alpha") || PluginManager._scripts.includes("SoR_TimeDurationBuffState_MZ_Beta");
|
|
|
|
let Max_FPS = 0;
|
|
if(bsd){
|
|
const bsdtx = PluginManager._scripts.includes("SoR_TimeDurationBuffState_MZ_Alpha")? "SoR_TimeDurationBuffState_MZ_Alpha" : PluginManager._scripts.includes("SoR_TimeDurationBuffState_MZ_Beta") ? "SoR_TimeDurationBuffState_MZ_Beta" : null;
|
|
const bsdp = PluginManager.parameters(bsdtx);
|
|
Max_FPS = Number(bsdp['GameFPS'] || 0);
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
const SoR_BSHW_DM_initializeSoRTagProcessor = DataManager.initializeSoRTagProcessor;
|
|
DataManager.initializeSoRTagProcessor = function() {
|
|
SoR_BSHW_DM_initializeSoRTagProcessor.call(this);
|
|
const q = {name: "SoRBSHW", target: ["state"]};
|
|
this._SoRTagProcessFuncs.push(q);
|
|
}
|
|
DataManager.SoRBSHW_init = function(obj) {
|
|
obj.description = null;
|
|
}
|
|
|
|
const beginTag = /<(?:Description)>/i;
|
|
const texttag = /(.*)/i;
|
|
const endTag = /<(?:\/Description)>/i;
|
|
|
|
DataManager.SoRBSHW = function(obj, line, intensive) {
|
|
let MatchFlag = false;
|
|
|
|
if(!intensive){
|
|
if(line.match(beginTag)){
|
|
obj.description = [];
|
|
return null;
|
|
}
|
|
else return false;
|
|
}
|
|
|
|
if(intensive === true){
|
|
if (line.match(endTag)){
|
|
let x = "";
|
|
for(let i=0;i<obj.description.length;i++){
|
|
x += obj.description[i];
|
|
if(i<obj.description.length-1) x+="\n";
|
|
}
|
|
obj.description = x;
|
|
return true;
|
|
}
|
|
else if(line.match(texttag)){
|
|
obj.description.push(RegExp.$1);
|
|
}
|
|
}
|
|
|
|
return MatchFlag;
|
|
}
|
|
|
|
|
|
const SoR_BSHW_SB_update = Scene_Battle.prototype.update;
|
|
Scene_Battle.prototype.update = function(){
|
|
SoR_BSHW_SB_update.call(this);
|
|
this.callStateHelpWindowCheck();
|
|
}
|
|
|
|
const SoR_BSHW_SB_updateBattleProcess = Scene_Battle.prototype.updateBattleProcess;
|
|
Scene_Battle.prototype.updateBattleProcess = function() {
|
|
SoR_BSHW_SB_updateBattleProcess.call(this);
|
|
this.check_canStateHWopen();
|
|
}
|
|
|
|
Scene_Battle.prototype.check_canStateHWopen = function() {
|
|
if(!this._SoRStateHelpWindow && Input.isTriggered(TriggerKey_StateHelp)){
|
|
this.callStateHelpWindow();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
const SoR_BSHW_SB_isAnyInputWindowActive = Scene_Battle.prototype.isAnyInputWindowActive;
|
|
Scene_Battle.prototype.isAnyInputWindowActive = function() {
|
|
const base = SoR_BSHW_SB_isAnyInputWindowActive.call(this);
|
|
return base || (this._SoRStateHelpWindow && this._SoRStateHelpWindow.active);
|
|
}
|
|
|
|
|
|
Scene_Battle.prototype.callStateHelpWindow = function(){
|
|
let target = null;
|
|
if(!this.temporalActiveW) this.temporalActiveW = [];
|
|
for (const [key, value] of Object.entries(this._windowLayer.children)) {
|
|
if(value.hasOwnProperty("active") && value.hasOwnProperty("_index")){
|
|
if(value.active){
|
|
value.active = false;
|
|
target = value;
|
|
this.temporalActiveW.push(target);
|
|
}
|
|
}
|
|
}
|
|
|
|
const rectW = Graphics.boxWidth*0.8;
|
|
const rectH = Graphics.boxHeight*0.8;
|
|
this._SoRStateHelpWindow = new StateHelpWindow(new Rectangle((Graphics.boxWidth-rectW)/2, (Graphics.boxHeight-rectH)/2, rectW, rectH));
|
|
this.addChild(this._SoRStateHelpWindow);
|
|
this._SoRStateHelpWindow.open();
|
|
|
|
this._SoRStateHelpWindow_Helpwindow = new Window_BSHWCommandHelp();
|
|
this._SoRStateHelpWindow_Helpwindow.visible = true;
|
|
this.addChild(this._SoRStateHelpWindow_Helpwindow);
|
|
this._SoRStateHelpWindow_Helpwindow.setup();
|
|
}
|
|
|
|
Scene_Battle.prototype.callStateHelpWindowCheck = function(){
|
|
if(this._SoRStateHelpWindow){
|
|
this._SoRStateHelpWindow.inputCheck();
|
|
if(Input.isTriggered(CloseKey_StateHelp)){
|
|
this._SoRStateHelpWindow.close();
|
|
this.removeChild(this._SoRStateHelpWindow);
|
|
delete this._SoRStateHelpWindow;
|
|
|
|
this._SoRStateHelpWindow_Helpwindow.close();
|
|
this.removeChild(this._SoRStateHelpWindow_Helpwindow);
|
|
delete this._SoRStateHelpWindow_Helpwindow;
|
|
|
|
if(this._SoRStateHelpWindow_SHwindow){
|
|
this.removeChild(this._SoRStateHelpWindow_SHwindow);
|
|
delete this._SoRStateHelpWindow_SHwindow;
|
|
}
|
|
|
|
for(const x of this.temporalActiveW) x.activate();
|
|
this.temporalActiveW = [];
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
const SoR_BSHW_SB_isBusy = Scene_Battle.prototype.isBusy;
|
|
Scene_Battle.prototype.isBusy = function() {
|
|
const base = SoR_BSHW_SB_isBusy.call(this);
|
|
const shw = typeof this._SoRStateHelpWindow === "undefined" ? false : true;
|
|
return base || shw;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
function StateHelpWindow() {
|
|
this.initialize(...arguments);
|
|
}
|
|
StateHelpWindow.prototype = Object.create(Window_Base.prototype);
|
|
StateHelpWindow.prototype.constructor = StateHelpWindow;
|
|
|
|
StateHelpWindow.prototype.initialize = function(rect) {
|
|
Window_Base.prototype.initialize.call(this, rect);
|
|
this._page = 1;
|
|
this._idxcursor = -1;
|
|
this._actcursor = -1;
|
|
this.states = [];
|
|
this.show();
|
|
this.refresh();
|
|
}
|
|
|
|
StateHelpWindow.prototype.refresh = function() {
|
|
this.contents.clear();
|
|
this.states = [];
|
|
if(this._page==1){
|
|
const pt = $gameParty.battleMembers();
|
|
for(let i=0; i<pt.length; i++){
|
|
this.drawInfoActor(i,pt[i]);
|
|
}
|
|
}
|
|
else{
|
|
const pt = $gameTroop.members().filter(x=>x.isAlive());
|
|
for(let i=0; i<pt.length; i++){
|
|
this.drawInfoEnemy(i,pt[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
StateHelpWindow.prototype.drawInfoActor = function(i, battler) {
|
|
const x = 24;
|
|
const y = i*84 + 16;
|
|
this.drawFace(battler.faceName(), battler.faceIndex(), x, y, ImageManager.faceWidth, 72);
|
|
this.changeTextColor(ColorManager.hpColor(battler));
|
|
this.contents.fontSize = 20;
|
|
this.drawText(battler.name(), x + 8 + ImageManager.faceWidth, y, ImageManager.faceWidth+8);
|
|
const gx = x + 16 + ImageManager.faceWidth;
|
|
|
|
// const texthp = "HP: " + battler.hp + "/" + battler.mhp;
|
|
// this.drawText(texthp, gx+92, y, ImageManager.faceWidth+8);
|
|
// this.resetFontSettings();
|
|
|
|
const iconWidth = ImageManager.iconWidth;
|
|
this.states[i] = this.getStatesInvolvingIcons(battler);
|
|
|
|
let iconX = x + 8 + ImageManager.faceWidth;
|
|
for (const cand of this.states[i]) {
|
|
const icon = cand.icon;
|
|
this.drawIcon(icon, iconX, y +38);
|
|
iconX += (iconWidth+4);
|
|
}
|
|
}
|
|
|
|
StateHelpWindow.prototype.drawInfoEnemy = function(i, battler) {
|
|
const x = 24;
|
|
const y = i*56;
|
|
|
|
this.contents.fontSize = 20;
|
|
this.drawText(battler.name(), x + 8, y, ImageManager.faceWidth+8);
|
|
this.resetFontSettings();
|
|
|
|
const iconWidth = ImageManager.iconWidth;
|
|
this.states[i] = this.getStatesInvolvingIcons(battler);
|
|
|
|
let iconX = x + 8;
|
|
for (const cand of this.states[i]) {
|
|
const icon = cand.icon;
|
|
this.drawIcon(icon, iconX, y +30);
|
|
iconX += (iconWidth+4);
|
|
}
|
|
}
|
|
|
|
|
|
StateHelpWindow.prototype.getStatesInvolvingIcons = function(battler) {
|
|
|
|
const states = battler.states().map(state => ({type: "state", id: state.id, icon: state.iconIndex})).filter(x => x.icon > 0);
|
|
const buffs = [];
|
|
for (let i = 0; i < battler._buffs.length; i++) {
|
|
if (battler._buffs[i] > 0) buffs.push({type: "buff", id: i, icon: battler.buffIconIndex(battler._buffs[i], i)});
|
|
else if (battler._buffs[i] < 0) buffs.push({type: "debuff", id: i, icon: battler.buffIconIndex(battler._buffs[i], i)});
|
|
}
|
|
|
|
return states.concat(buffs);
|
|
}
|
|
|
|
|
|
|
|
|
|
StateHelpWindow.prototype.inputCheck = function() {
|
|
const sm = SceneManager._scene;
|
|
let changed = false;
|
|
if(Input.isTriggered('up')){
|
|
if(this._actcursor == -1) this.initializeStateHelp();
|
|
else{
|
|
|
|
const orig = this._actcursor;
|
|
while(1){
|
|
const nbm = this.states.length;
|
|
if(nbm==0) break;
|
|
this._actcursor = (this._actcursor-1+nbm)%nbm;
|
|
if(orig==this._actcursor) break;
|
|
if(this.states[this._actcursor].length>0) break;
|
|
}
|
|
if(this.states[this._actcursor].length <= this._idxcursor) this._idxcursor = this.states[this._actcursor].length-1;
|
|
|
|
}
|
|
changed = true;
|
|
}
|
|
else if(Input.isTriggered('down')){
|
|
if(this._actcursor == -1) this.initializeStateHelp();
|
|
else{
|
|
const orig = this._actcursor;
|
|
while(1){
|
|
const nbm = this.states.length;
|
|
if(nbm==0) break;
|
|
this._actcursor = (this._actcursor+1)%nbm;
|
|
if(orig==this._actcursor) break;
|
|
if(this.states[this._actcursor].length>0) break;
|
|
}
|
|
if(this.states[this._actcursor].length <= this._idxcursor) this._idxcursor = this.states[this._actcursor].length-1;
|
|
|
|
}
|
|
changed = true;
|
|
}
|
|
else if(Input.isTriggered('left')){
|
|
if(this._actcursor == -1) this.initializeStateHelp();
|
|
else{
|
|
const nbm = this.states[this._actcursor].length;
|
|
this._idxcursor = (this._idxcursor-1+nbm)%nbm;
|
|
}
|
|
changed = true;
|
|
}
|
|
else if(Input.isTriggered('right')){
|
|
if(this._actcursor == -1) this.initializeStateHelp();
|
|
else{
|
|
const nbm = this.states[this._actcursor].length;
|
|
this._idxcursor = (this._idxcursor+1)%nbm;
|
|
}
|
|
changed = true;
|
|
}
|
|
else if(Input.isTriggered('pageup') || Input.isTriggered('pagedown')){
|
|
this._page *= -1;
|
|
this._actcursor = -1;
|
|
this.setCursorRect(0,0,0,0);
|
|
sm.removeChild(sm._SoRStateHelpWindow_SHwindow);
|
|
this.refresh();
|
|
return;
|
|
}
|
|
|
|
if(changed){
|
|
const statedata = this.states[this._actcursor][this._idxcursor];
|
|
if(statedata){
|
|
let basex,basey;
|
|
if(this._page==1){
|
|
basex = 28+ImageManager.faceWidth + (ImageManager.iconWidth+4)*this._idxcursor;
|
|
basey = 84*this._actcursor+16+34;
|
|
}
|
|
else{
|
|
basex = 24 + 4 +(ImageManager.iconWidth+4)*this._idxcursor;
|
|
basey = 56*this._actcursor+34-8;
|
|
}
|
|
this.setCursorRect(basex, basey, ImageManager.iconWidth+8, ImageManager.iconWidth+8);
|
|
|
|
const hw = sm._SoRStateHelpWindow_SHwindow;
|
|
|
|
const btl = this._page==1? $gameParty.members()[this._actcursor] : $gameTroop.members()[this._actcursor];
|
|
if(statedata.type=="state") hw.setItem($dataStates[statedata.id],btl);
|
|
else hw.setItem(statedata,btl);
|
|
|
|
if(hw.openness==0) hw.open();
|
|
hw.x = basex +64 + (this._page==1?80:72);
|
|
hw.y = basey +12 + (this._page==1?92:96);
|
|
}
|
|
}
|
|
}
|
|
|
|
StateHelpWindow.prototype.initializeStateHelp = function() {
|
|
this._actcursor = 0;
|
|
this._idxcursor = 0;
|
|
|
|
const sm = SceneManager._scene;
|
|
const h = sm.calcWindowHeight(2, true);
|
|
sm._SoRStateHelpWindow_SHwindow = new Window_StateHelpDesc(new Rectangle(0, Graphics.height-52-h , Graphics.width, h));
|
|
sm.addChild(sm._SoRStateHelpWindow_SHwindow);
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
function Window_BSHWCommandHelp() {
|
|
this.initialize.apply(this, arguments);
|
|
}
|
|
Window_BSHWCommandHelp.prototype = Object.create(Window_Base.prototype);
|
|
Window_BSHWCommandHelp.prototype.constructor = Window_BSHWCommandHelp;
|
|
|
|
Window_BSHWCommandHelp.prototype.initialize = function() {
|
|
this._text = '';
|
|
this.item = null;
|
|
const x = -12;
|
|
const y = Graphics.height - 50;
|
|
const width = Graphics.boxWidth;
|
|
const height = 64;
|
|
this.visible = true;
|
|
Window_Base.prototype.initialize.call(this, new Rectangle(x, y, width, height));
|
|
this.setBackgroundType(2);
|
|
this.openness = 255;
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.contentsHeight = function() {return this.height;}
|
|
Window_BSHWCommandHelp.prototype.standardPadding = function() { return 2; }
|
|
|
|
Window_BSHWCommandHelp.prototype.setup = function() {
|
|
this._text = '';
|
|
this.setText();
|
|
this.visible = true;
|
|
this.openness = 255;
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.updateHelp = function() {
|
|
this.setText();
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.setText = function() {
|
|
this._text = ControlHelpText;
|
|
this.refresh();
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.refresh = function() {
|
|
this.contents.clear();
|
|
this.DrawBackground();
|
|
|
|
this.contents.fontSize = 18;
|
|
this.drawText(this._text, 15, 0, this.width, 'left');
|
|
this.resetFontSettings();
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.close = function(){
|
|
Window_Base.prototype.close.call(this);
|
|
this._text = '';
|
|
}
|
|
|
|
Window_BSHWCommandHelp.prototype.DrawBackground = function() {
|
|
const color1 = ColorManager.dimColor1();
|
|
const color2 = ColorManager.dimColor2();
|
|
this.contents.fillRect(0, 0, this.width / 2, this.height, color1);
|
|
this.contents.gradientFillRect(this.width / 2, 0, this.width / 2, this.height, color1, color2);
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
// Window_Help for state item
|
|
function Window_StateHelpDesc() {
|
|
this.initialize(...arguments);
|
|
}
|
|
Window_StateHelpDesc.prototype = Object.create(Window_Help.prototype);
|
|
Window_StateHelpDesc.prototype.constructor = Window_StateHelpDesc;
|
|
|
|
Window_StateHelpDesc.prototype.initialize = function(rect) {
|
|
Window_Help.prototype.initialize.call(this, rect);
|
|
this.openness = 0;
|
|
this.targetData = null;
|
|
this.btl = null;
|
|
}
|
|
|
|
Window_StateHelpDesc.prototype.setItem = function(item, btl) {
|
|
if(item == null){
|
|
this.targetData = null;
|
|
this.btl = null;
|
|
this.close();
|
|
return;
|
|
}
|
|
|
|
this.btl = btl;
|
|
|
|
let desctxt = "";
|
|
if(item.description){
|
|
this.targetData = item;
|
|
desctxt = this.processDesc(item.description,"s", item.id);
|
|
}
|
|
else if(item.type && (item.type=="buff" || item.type=="debuff")){
|
|
if(item.type=="buff"){
|
|
this.targetData = {name: BuffNameText[item.id], iconIndex: item.icon};
|
|
desctxt = this.processDesc(BuffHelpText[item.id],"b", item.id);
|
|
}
|
|
else if(item.type=="debuff"){
|
|
this.targetData = {name: DebuffNameText[item.id], iconIndex: item.icon};
|
|
desctxt = this.processDesc(DebuffHelpText[item.id],"d", item.id);
|
|
}
|
|
}
|
|
else{
|
|
if(this.isOpen()) this.close();
|
|
this.targetData = null;
|
|
}
|
|
this.setText(desctxt);
|
|
}
|
|
|
|
|
|
|
|
|
|
Window_StateHelpDesc.prototype.processDesc = function(text,t,id) {
|
|
let desc = text.trim();
|
|
const obj = this.btl;
|
|
|
|
if(PluginManager._scripts.includes("SoR_BuffFunctionExtension_MZ")) {
|
|
if(t=="b"||t=="d"){
|
|
desc = desc.replace(/\brank/,(p1)=>{
|
|
return obj._buffs[id];
|
|
});
|
|
}
|
|
}
|
|
|
|
desc = desc.replace(/\\dur(\[(.*)\])?/,(p1,p2,p3,p4)=>{
|
|
if((!p2||!p3) || !bsd){
|
|
if(t=="b"||t=="d") return obj._buffTurns[id];
|
|
else return obj._stateTurns[id];
|
|
}
|
|
|
|
if(p3.match(/(\d+)(.(\d+))?/)){
|
|
const time = (t=="b"||t=="d") ? obj._buffDurationTime[id] : obj._stateDurationTime[id];
|
|
const sec = time/Max_FPS;
|
|
let b = 1;
|
|
if(RegExp.$3 && RegExp.$3>=1){
|
|
for(let i=1; i<=RegExp.$3; i++) b *= 10;
|
|
}
|
|
return Math.floor(sec * b)/b;
|
|
}
|
|
|
|
return (t=="b"||t=="d") ? obj._buffDurationTime[id] : obj._stateDurationTime[id];
|
|
});
|
|
|
|
return desc;
|
|
}
|
|
|
|
|
|
|
|
|
|
Window_StateHelpDesc.prototype.open = function() {
|
|
if(this._text == "") return;
|
|
Window_Help.prototype.open.call(this);
|
|
}
|
|
|
|
Window_StateHelpDesc.prototype.refresh = function() {
|
|
if(this.targetData == null) return;
|
|
|
|
const rect = this.baseTextRect();
|
|
this.contents.clear();
|
|
|
|
const legend = "\\i[" + this.targetData.iconIndex + "] " + this.targetData.name;
|
|
this.drawhelpText(legend, rect.x, rect.y, rect.width, 21);
|
|
const res = this.drawhelpText(this._text, rect.x, rect.y+36, rect.width, 18);
|
|
|
|
this.width = res.ow+36;
|
|
this.height = res.oh+60;
|
|
this.resetFontSettings();
|
|
}
|
|
|
|
Window_StateHelpDesc.prototype.drawhelpText = function(text, x, y, width, fs) {
|
|
this.contents.fontSize = fs;
|
|
const textState = this.createTextState(text, x, y, width);
|
|
this.processAllText(textState);
|
|
return {ow: textState.outputWidth, oh: textState.outputHeight};
|
|
}
|
|
|
|
})();
|