//============================================================================= // 戦闘時のウィンドウ配置を変更するプラグイン // FTKR_BattleWindowLayout.js // プラグインNo : 76 // 作成者 : フトコロ // 作成日 : 2018/04/08 // 最終更新日 : 2020/04/26 // バージョン : v1.3.0 //============================================================================= var Imported = Imported || {}; Imported.FTKR_BWL = true; var FTKR = FTKR || {}; FTKR.BWL = FTKR.BWL || {}; //============================================================================= /*: @plugindesc v1.3.0 Change the window layout during battle @author Futokoro @url https://github.com/munokura/futokoro-MV-plugins @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/futokoro-MV-plugins ). Original plugin by Futokoro. Please check the URL below for the latest version of the plugin. URL https://github.com/futokoro/RPGMaker ----- ----------------------------------------------------------------------------- Overview ----------------------------------------------------------------------------- Changes the window layout and size during battle. 1. Makes the status window width the same as the screen size. 2. Changes the status window actors to be arranged side-by-side. (*1) 3. Overlays the actor command window display position on the currently selected actor in the status window. (*2) 4. Displays the party command window above the status window, arranging the commands side-by-side. (*1) The status window displays the following information: face image, name, status, HP, MP, and TP. The face image display can be turned on/off in the plugin parameters. TP is displayed when "Show TP on battle screen" is checked. (*2) You can change the display position to the same as the party command window in the plugin parameters. ----------------------------------------------------------------------------- Setup Instructions ----------------------------------------------------------------------------- 1. Add this plugin to the "Plugin Manager." 2. When using with FTKR_AlternatingTurnBattle.js, place this plugin underneath. ----------------------------------------------------------------------------- License for this plugin ----------------------------------------------------------------------------- This plugin is released under the MIT License. Copyright (c) 2018 Futokoro http://opensource.org/licenses/mit-license.php Plugin publisher https://github.com/futokoro/RPGMaker/blob/master/README.md ----------------------------------------------------------------------------- Change History ----------------------------------------------------------------------------- v1.3.0 - 2020/04/26: Added Traits 1. The function to hide the status window when selecting an actor or enemy can now be turned on/off via plugin parameters. v1.2.0 - August 19, 2018: Traits Added 1. Added the ability to set party commands and actor commands. v1.1.1 - August 17, 2018: Bug Fixes 1. Fixed an issue where processing overlapped with FTKR_FVActorAnimation. v1.1.0 - April 9, 2018: Traits Added, Bug Fixes 1. Fixed an issue where actors could overlap in the status window. 2. Added the ability to change the display position of the actor command window. 3. Compatible with v1.1.0 of FTKR_AlternatingTurnBattle.js. v1.0.0 - April 8, 2018: Initial version created ----------------------------------------------------------------------------- @param Show Actor Face @desc Displaying the actor's face image @default true @type boolean @on valid @off invalid @param Party @text Party Command Settings @param Party Command PositionY @desc Specifies the vertical position where the party command window is displayed. @default 0 @type select @parent Party @option Displayed horizontally above the status window @value 0 @option center of screen @value 1 @param Party Command PositionX @desc Specifies the horizontal position where the party command window will be displayed. @default 0 @type select @parent Party @option Left-justified @value 0 @option center @value 1 @option Right-justified @value 2 @param Party Command Window @desc Party command window display settings @default {"width":"","height":"","background":"0"} @type struct @parent Party @param Actor @text Actor Command Settings @param Actor Command Position @desc Specifies where the Actor Commands window will be displayed. @default 0 @type select @parent Actor @option Overlaying the actor in the status window @value 0 @option Displayed horizontally above the status window @value 1 @option Displayed vertically above the actor in the status window @value 2 @param Actor Command PositionY @desc Specifies the vertical position to display the actor command window. This is invalid if it is displayed above the status window. @default 0 @type select @parent Actor @option Top alignment @value 0 @option center @value 1 @option Lowering @value 2 @param Actor Command PositionX @desc Specifies the horizontal position where the Actor Commands window is displayed. @default 0 @type select @parent Actor @option Right-justified @value 0 @option center @value 1 @option Left-justified @value 2 @param Actor Command Window @desc Actor Command window display settings Some settings are disabled depending on the Actor Command Position setting. @default {"width":"","height":"","background":"0"} @type struct @parent Actor @param Status @text Status window settings @param Hide When Selecting Actor @desc Hide the status window when selecting an actor @default true @type boolean @parent Status @on valid @off invalid @param Hide When Selecting Enemy @desc Hide the status window when selecting an enemy @default true @type boolean @parent Status @on valid @off invalid */ /*~struct~window: @param width @desc Set the window width in pixels. Blank: default setting, -1: screen width @type number @min -1 @param height @desc Set the window height in lines (lineNumber). Blank: Default setting @type number @param background @desc Sets the window background. @default 0 @type select @option window @value 0 @option Darken @value 1 @option transparent @value 2 */ /*:ja @plugindesc v1.3.0 戦闘時のウィンドウ配置を変更する @author Futokoro @url https://github.com/munokura/futokoro-MV-plugins @license MIT License @help ----------------------------------------------------------------------------- 概要 ----------------------------------------------------------------------------- 戦闘時のウィンドウ配置やサイズを変更します。 1.ステータスウィンドウの幅を画面サイズと同じにします。 2.ステータスウィンドウのアクターを横並びに変更します。(*1) 3.アクターコマンドウィンドウの表示位置を、ステータスウィンドウの   選択中のアクターに重ねます。(*2) 4.パーティーコマンドウィンドウをステータスウィンドウの上に表示し   コマンドを横並びにします。 (*1) ステータスウィンドウの表示内容は、顔画像、名前、ステート、HP、MP、TPです。 顔画像は、プラグインパラメータで表示のON/OFFを変えられます。 TPは、「バトル画面でTPを表示」にチェックが入っている場合に表示します。 (*2) プラグインパラメータで、パーティーコマンドウィンドウと同じ表示位置に 変更できます。 ----------------------------------------------------------------------------- 設定方法 ----------------------------------------------------------------------------- 1.「プラグインマネージャー(プラグイン管理)」に、本プラグインを追加して ください。 2. FTKR_AlternatingTurnBattle.jsと組み合わせる場合は、このプラグインが 下になるように配置してください。 ----------------------------------------------------------------------------- 本プラグインのライセンスについて(License) ----------------------------------------------------------------------------- 本プラグインはMITライセンスのもとで公開しています。 This plugin is released under the MIT License. Copyright (c) 2018 Futokoro http://opensource.org/licenses/mit-license.php プラグイン公開元 https://github.com/futokoro/RPGMaker/blob/master/README.md ----------------------------------------------------------------------------- 変更来歴 ----------------------------------------------------------------------------- v1.3.0 - 2020/04/26 : 機能追加 1. アクター選択時とエネミー選択時にステータスウィンドウを非表示にする機能を プラグインパラメータでON/OFFできるように変更。 v1.2.0 - 2018/08/19 : 機能追加 1. パーティーコマンドとアクターコマンドの設定機能を追加。 v1.1.1 - 2018/08/17 : 不具合修正 1. FTKR_FVActorAnimationと処理が重複していた部分を修正。 v1.1.0 - 2018/04/09 : 機能追加、不具合修正 1. ステータスウィンドウでアクター同士の表示が重なる場合がある不具合を修正。 2. アクターコマンドウィンドウの表示位置を変更する機能を追加。 3. FTKR_AlternatingTurnBattle.jsの v1.1.0 に対応。 v1.0.0 - 2018/04/08 : 初版作成 ----------------------------------------------------------------------------- @param Show Actor Face @desc アクターの顔画像を表示する @default true @type boolean @on 有効 @off 無効 @param Party @text パーティーコマンドの設定 @param Party Command PositionY @desc パーティーコマンドウィンドウを表示する縦の位置を指定します。 @default 0 @type select @parent Party @option ステータスウィンドウの上に横に表示 @value 0 @option 画面中央 @value 1 @param Party Command PositionX @desc パーティーコマンドウィンドウを表示する横の位置を指定します。 @default 0 @type select @parent Party @option 左寄せ @value 0 @option 中央 @value 1 @option 右寄せ @value 2 @param Party Command Window @desc パーティーコマンドウィンドウの表示設定 @default {"width":"","height":"","background":"0"} @type struct @parent Party @param Actor @text アクターコマンドの設定 @param Actor Command Position @desc アクターコマンドウィンドウを表示する場所を指定します。 @default 0 @type select @parent Actor @option ステータスウィンドウのアクターに重ねる @value 0 @option ステータスウィンドウの上に横に表示 @value 1 @option ステータスウィンドウのアクターの上に縦に表示 @value 2 @param Actor Command PositionY @desc アクターコマンドウィンドウを表示する縦の位置を指定します。 ステータスウィンドウの上表示の場合は無効です。 @default 0 @type select @parent Actor @option 上寄せ @value 0 @option 中央 @value 1 @option 下寄せ @value 2 @param Actor Command PositionX @desc アクターコマンドウィンドウを表示する横の位置を指定します。 @default 0 @type select @parent Actor @option 右寄せ @value 0 @option 中央 @value 1 @option 左寄せ @value 2 @param Actor Command Window @desc アクターコマンドウィンドウの表示設定 Actor Command Position の設定により一部の設定が無効になる @default {"width":"","height":"","background":"0"} @type struct @parent Actor @param Status @text ステータスウィンドウの設定 @param Hide When Selecting Actor @desc アクター選択時にステータスウィンドウを非表示にする @default true @type boolean @parent Status @on 有効 @off 無効 @param Hide When Selecting Enemy @desc エネミー選択時にステータスウィンドウを非表示にする @default true @type boolean @parent Status @on 有効 @off 無効 */ /*~struct~window:ja @param width @desc ウィンドウの幅をpixel単位で設定します。 空欄:デフォルト設定、-1:画面幅 @type number @min -1 @param height @desc ウィンドウの高さを行数(lineNumber)で設定します。 空欄:デフォルト設定 @type number @param background @desc ウィンドウの背景を設定します。 @default 0 @type select @option ウィンドウ @value 0 @option 暗くする @value 1 @option 透明 @value 2 */ (function() { var paramParse = function(obj) { return JSON.parse(JSON.stringify(obj, paramReplace)); }; var paramReplace = function(key, value) { try { return JSON.parse(value || null); } catch (e) { return value; } }; //============================================================================= // プラグイン パラメータ //============================================================================= var parameters = PluginManager.parameters('FTKR_BattleWindowLayout'); FTKR.BWL = { showFace : (paramParse(parameters['Show Actor Face']) || false), partyCmdPosY : +(paramParse(parameters['Party Command PositionY']) || 0), partyCmdPosX : +(paramParse(parameters['Party Command PositionX']) || 0), partyCmdWindow : paramParse(parameters['Party Command Window']), actorCmdPos : +(paramParse(parameters['Actor Command Position']) || 0), actorCmdPosY : +(paramParse(parameters['Actor Command PositionY']) || 0), actorCmdPosX : +(paramParse(parameters['Actor Command PositionY']) || 0), actorCmdWindow : paramParse(parameters['Actor Command Window']), }; var enabledStatusWhenSelectActor = paramParse(parameters['Hide When Selecting Actor']); var enabledStatusWhenSelectEnemy = paramParse(parameters['Hide When Selecting Enemy']); //============================================================================= // Scene_Battle //============================================================================= Scene_Battle.prototype.updateWindowPositions = function() { }; var _BWL_Scene_Battle_startActorCommandSelection = Scene_Battle.prototype.startActorCommandSelection; Scene_Battle.prototype.startActorCommandSelection = function() { _BWL_Scene_Battle_startActorCommandSelection.call(this); this._actorCommandWindow.refreshPosition(); }; if (enabledStatusWhenSelectActor) { var _BWL_Scene_Battle_selectActorSelection = Scene_Battle.prototype.selectActorSelection; Scene_Battle.prototype.selectActorSelection = function() { _BWL_Scene_Battle_selectActorSelection.call(this); this._statusWindow.hide(); }; var _BWL_Scene_Battle_onActorOk = Scene_Battle.prototype.onActorOk; Scene_Battle.prototype.onActorOk = function() { _BWL_Scene_Battle_onActorOk.call(this); this._statusWindow.show(); }; var _BWL_Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel; Scene_Battle.prototype.onActorCancel = function() { _BWL_Scene_Battle_onActorCancel.call(this); this._statusWindow.show(); }; };//enabledStatusWhenSelectActor if (enabledStatusWhenSelectEnemy) { var _BWL_Scene_Battle_selectEnemySelection = Scene_Battle.prototype.selectEnemySelection; Scene_Battle.prototype.selectEnemySelection = function() { _BWL_Scene_Battle_selectEnemySelection.call(this); this._statusWindow.hide(); }; var _BWL_Scene_Battle_onEnemyOk = Scene_Battle.prototype.onEnemyOk; Scene_Battle.prototype.onEnemyOk = function() { _BWL_Scene_Battle_onEnemyOk.call(this); this._statusWindow.show(); }; var _BWL_Scene_Battle_onEnemyCancel = Scene_Battle.prototype.onEnemyCancel; Scene_Battle.prototype.onEnemyCancel = function() { _BWL_Scene_Battle_onEnemyCancel.call(this); this._statusWindow.show(); }; };//enabledStatusWhenSelectEnemy //============================================================================= // Window_BattleStatus //============================================================================= var _BWL_Window_BattleStatus_changeActorOnMouse = Window_BattleStatus.prototype.changeActorOnMouse; Window_BattleStatus.prototype.changeActorOnMouse = function(index) { _BWL_Window_BattleStatus_changeActorOnMouse.call(this, index); BattleManager._actorCommandWindow.refreshPosition(); }; Window_BattleStatus.prototype.maxCols = function() { return $gameParty.battleMembers().length; }; Window_BattleStatus.prototype.windowWidth = function() { return Graphics.boxWidth; }; Window_BattleStatus.prototype.spacing = function() { return this.padding * 2; }; Window_BattleStatus.prototype.numVisibleRows = function() { return 4; }; Window_BattleStatus.prototype.itemHeight = function() { return this.lineHeight() * this.numVisibleRows(); }; Window_BattleStatus.prototype.drawItem = function(index) { var lineHeight = this.lineHeight(); var actor = $gameParty.battleMembers()[index]; var rect = this.itemRect(index); var x = rect.x; var y = rect.y; var width = rect.width; if (FTKR.BWL.showFace) { var x2 = x + Math.max((width - 144)/2, 0); this.drawActorFace(actor, x2, y, width); } this.drawActorName(actor, x, y, width); this.drawActorIcons(actor, x, y + lineHeight * 1, width); this.drawActorHp(actor, x, y + lineHeight * 2, width); if ($dataSystem.optDisplayTp) { var width2 = (width - 4) / 2; this.drawActorMp(actor, x, y + lineHeight * 3, width2); this.drawActorTp(actor, x + width2 + 4, y + lineHeight * 3, width2) } else { this.drawActorMp(actor, x, y + lineHeight * 3, width); } }; //============================================================================= // Window_BattleEnemy //============================================================================= Window_BattleEnemy.prototype.windowWidth = function() { return Graphics.boxWidth; }; //============================================================================= // Window_PartyCommand //============================================================================= Window_PartyCommand.prototype.initialize = function() { var x = +FTKR.BWL.partyCmdPosX * (Graphics.boxWidth - this.windowWidth()) / 2; Window_Command.prototype.initialize.call(this, x, 0); switch(+FTKR.BWL.partyCmdPosY) { case 1: var y = (Graphics.boxHeight - this.windowHeight()) / 2; break; default: var y = Graphics.boxHeight - this.statusWindow().windowHeight() - this.windowHeight(); break; } this.y = y; this.setBackgroundType(+FTKR.BWL.partyCmdWindow.background); this.openness = 0; this.deactivate(); }; Window_PartyCommand.prototype.statusWindow = function() { return SceneManager._scene._statusWindow; } Window_PartyCommand.prototype.windowWidth = function() { return this.windowBwlWidth(); }; Window_PartyCommand.prototype.windowBwlWidth = function() { var width = FTKR.BWL.partyCmdWindow.width; switch(width) { case -1: return Graphics.boxWidth; default: return !width ? Graphics.boxWidth : +width; } }; Window_PartyCommand.prototype.numVisibleRows = function() { return +FTKR.BWL.partyCmdWindow.height || 1; }; Window_PartyCommand.prototype.maxCols = function() { return Math.ceil(this.maxItems() / this.numVisibleRows()); }; Window_PartyCommand.prototype.itemTextAlign = function() { return 'center'; }; //============================================================================= // Window_ActorCommand //============================================================================= Window_ActorCommand.prototype.initialize = function() { switch(FTKR.BWL.actorCmdPos) { case 1://上横 case 2://上縦 var y = Graphics.boxHeight - this.statusWindow().windowHeight() - this.windowHeight(); break; default://重ね var y = Graphics.boxHeight - this.statusWindow().windowHeight() + FTKR.BWL.actorCmdPosY * (this.statusWindow().windowHeight() - this.windowHeight()) / 2; break; } var x = this.offsetX(); Window_Command.prototype.initialize.call(this, x, y); console.log(this.x, this.y, this.width, this.height); this.setBackgroundType(+FTKR.BWL.actorCmdWindow.background); this.openness = 0; this.deactivate(); this._actor = null; }; Window_ActorCommand.prototype.offsetX = function() { return +FTKR.BWL.actorCmdPosX * ((FTKR.BWL.actorCmdPos == 1 ? Graphics.boxWidth : this.actorWidth()) - this.windowWidth()) / 2; }; Window_ActorCommand.prototype.actorWidth = function() { return SceneManager._scene._statusWindow.width / SceneManager._scene._statusWindow.maxCols(); }; Window_ActorCommand.prototype.statusWindow = function() { return SceneManager._scene._statusWindow; } Window_ActorCommand.prototype.windowWidth = function() { return this.windowBwlWidth() || (FTKR.BWL.actorCmdPos == 1 ? Graphics.boxWidth : this.actorWidth()); }; Window_ActorCommand.prototype.windowBwlWidth = function() { var width = +FTKR.BWL.actorCmdWindow.width; switch(width) { case -1: return Graphics.boxWidth; default: return width; } }; Window_ActorCommand.prototype.refreshPosition = function() { if (FTKR.BWL.actorCmdPos != 1) this.x = this.actorWidth() * BattleManager.actor().index() + this.offsetX();; }; Window_ActorCommand.prototype.numVisibleRows = function() { return +FTKR.BWL.actorCmdWindow.height || (FTKR.BWL.actorCmdPos == 1 ? 1 : 4); }; Window_ActorCommand.prototype.maxCols = function() { return FTKR.BWL.actorCmdPos == 1 ? 4 : 1; }; Window_ActorCommand.prototype.itemTextAlign = function() { return FTKR.BWL.actorCmdPos == 1 ? 'center' : 'left'; }; var _BWL_Window_ActorCommand_changeInputWindow = Window_ActorCommand.prototype.changeInputWindow; Window_ActorCommand.prototype.changeInputWindow = function() { _BWL_Window_ActorCommand_changeInputWindow.call(this); this.refreshPosition(); }; }());//EOF