code:
/*
 * ==============================================================================
 * ** Victor Engine MV - Battle Status Window
 * ------------------------------------------------------------------------------
 * Version History:
 *  v 1.00 - 2016.04.05 > First release.
 *  v 1.01 - 2016.04.10 > Fixed crash at battle end.
 *                      > Fixed issue with background image not disappearing.
 *                      > Adde back opacity and frame opacity plugin parameters.
 *  v 1.02 - 2016.04.30 > Compatibility with Basic Module 1.19.
 *  v 1.03 - 2016.05.12 > Fixed issue with target window position.
 *                      > Added more custom code Plugin Parameters.
 *  v 1.04 - 2016.05.15 > Fixed issue with 'unexpected token'.
 * ==============================================================================
 */

var Imported = Imported || {};
Imported['VE - Battle Status Window'] = '1.04';

var VictorEngine = VictorEngine || {};
VictorEngine.BattleStatusWindow = VictorEngine.BattleStatusWindow || {};

(function() {

	VictorEngine.BattleStatusWindow.loadDatabase = DataManager.loadDatabase;
	DataManager.loadDatabase = function() {
		VictorEngine.BattleStatusWindow.loadDatabase.call(this);
		PluginManager.requiredPlugin.call(PluginManager, 'VE - Battle Status Window', 'VE - Basic Module', '1.20');
	};

	VictorEngine.BattleStatusWindow.requiredPlugin = PluginManager.requiredPlugin;
	PluginManager.requiredPlugin = function(name, required, version) {
		if (!VictorEngine.BasicModule) {
			var msg = 'The plugin ' + name + ' requires the plugin ' + required;
			msg += ' v' + version + ' or higher installed to work properly.';
			msg += ' Go to http://victorenginescripts.wordpress.com/ to download the plugin.';
			throw new Error(msg);
		} else {
			VictorEngine.BattleStatusWindow.requiredPlugin.call(this, name, required, version)
		};
	};

})();

/*:
 * ------------------------------------------------------------------------------
 * @plugindesc v1.04 - Customize the Battle Status Window.
 * @author Victor Sant
 *
 * @param == Window Layout ==
 * @default ================================================
 *
 * @param Window Lines
 * @desc Number of lines the status window have.
 * Default: 4 (allows script code)
 * @default 4
 *
 * @param Window Columns
 * @desc Number of columns the status window have.
 * Default: 1 (allows script code)
 * @default 1
 *
 * @param == Window Display ==
 * @default ================================================
 *
 * @param Window X
 * @desc Status window X position.
 * Default: boxWidth - width (allows script code)
 * @default boxWidth - width
 *
 * @param Window Y
 * @desc Status window Y position.
 * Default: boxHeight - height (allows script code)
 * @default boxHeight - height
 *
 * @param Window Width
 * @desc Status window width.
 * Default: width (allows script code)
 * @default width
 *
 * @param Window Height
 * @desc Status window height.
 * Default: height (allows script code)
 * @default height
 *
 * @param Window Back Opacity
 * @desc Status window back opacity.
 * Default: this.standardBackOpacity() (allows script code)
 * @default this.standardBackOpacity()
 *
 * @param Window Frame Opacity
 * @desc Status window frame opacity.
 * Default: 255 (allows script code)
 * @default 255
 *
 * @param Window Movement
 * @desc Slide the status window during command input.
 * Default: 96 (Numeric, can be negative)
 * @default 96
 *
 * @param Window Background
 * @desc Background image shown behind the window.
 * Filename (leave blank for no background)
 * @default @@
 *
 * @param Window Background X
 * @desc Background image offset X.
 * Default: 0 (Numeric, can be negative)
 * @default 0
 *
 * @param Window Background Y
 * @desc Background image offset Y.
 * Default: 0 (Numeric, can be negative)
 * @default 0
 *
 * @param == Content Setup ==
 * @default ================================================
 *
 * @param Horizontal Centralize
 * @desc Centralize content horizontally.
 * true - ON     false - OFF
 * @default false
 *
 * @param Vertical Centralize
 * @desc Centralize content vertically.
 * true - ON     false - OFF
 * @default false
 *
 * @param Content Offset X
 * @desc Content position offset X.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Content Offset Y
 * @desc Content position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Content Background
 * @desc Background image for the window content.
 * Filename (leave blank for no background)
 * @default @@
 *
 * @param Content Back X
 * @desc Descriptigin
 * @desc Content image position offset X.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Content Back Y
 * @desc Content image position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param == Active Setup ==
 * @default ================================================
 *
 * @param Active Select
 * @desc Show default cursor on active battler.
 * true - ON     false - OFF
 * @default true
 *
 * @param Active Offset X
 * @desc Active battler content offset X.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Active Offset Y
 * @desc Active battler content offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Active Background
 * @desc Background image for the content when the actor is active.
 * Filename (leave blank for no background)
 * @default @@
 *
 * @param Active Back X
 * @desc Background image position offset X.
 * Default: 0 (Numeric, can be negative)
 * @default 0
 *
 * @param Active Back Y
 * @desc Background image position offset Y.
 * Default: 0 (Numeric, can be negative)
 * @default 0
 *
 * @param == Faces Setup ==
 * @default ================================================
 *
 * @param Show Faces
 * @desc Show faces for each actor on the status window.
 * true - ON     false - OFF
 * @default false
 *
 * @param Face Sufix
 * @desc Add a sufix for face graphics shown in battle,
 * Sufix (leave blank for no sufix)
 * @default @@
 *
 * @param Face Width
 * @desc Face display width
 * Default: 144 (allows script code)
 * @default 144
 *
 * @param Face Height
 * @desc Face display height
 * Default: 144 (allows script code)
 * @default 144
 *
 * @param Face Offset X
 * @desc Face image position offset X.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Face Offset Y
 * @desc Face image position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param == Name Display ==
 * @default ================================================
 *
 * @param Show Name
 * @desc Show actor name on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param Name Offset X
 * @desc Name display position offset X.
 * Default: 6 (allows script code)
 * @default 6
 *
 * @param Name Offset Y
 * @desc Name display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Name Fontface
 * @desc Name display font name.
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Name Fontsize
 * @desc Name display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Name Color
 * @desc Name display font color.
 * Default: this.hpColor(actor) (allows script code)
 * @default this.hpColor(actor)
 *
 * @param == States Display ==
 * @default ================================================
 *
 * @param Show States
 * @desc Show actor states icons on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param States Max Icons
 * @desc Max number of icons displayed on the window.
 * Default: 2 (allows script code)
 * @default 2
 *
 * @param States Offset X
 * @desc States display position offset X.
 * Default: 156 (allows script code)
 * @default 156
 *
 * @param States Offset Y
 * @desc States display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param == Action Icon ==
 * @default ================================================
 *
 * @param Show Action Icon
 * @desc Show icon for the action selected on the status window.
 * true - ON     false - OFF
 * @default false
 *
 * @param No Action Icon
 * @desc Icon id for when the actor have no action selected.
 * Default: 16 (Numeric, use 0 for no icon)
 * @default 16
 *
 * @param Action Offset X
 * @desc Action icon display position offset X.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param Action Offset Y
 * @desc Action icon display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param == HP display ==
 * @default ================================================
 *
 * @param Show HP Gauge
 * @desc Show HP gauge on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param HP Gauge Width
 * @desc Width of the HP Gauge
 * Default: 108 (allows script code)
 * @default 108
 *
 * @param HP Offset X
 * @desc HP display position offset X.
 * Default: 252 (allows script code)
 * @default 252
 *
 * @param HP Offset Y
 * @desc HP display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param HP Text Fontface
 * @desc HP text display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param HP Text Fontsize
 * @desc HP text display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param HP Text Color
 * @desc HP text display font coloe.
 * Default: this.systemColor() (allows script code)
 * @default this.systemColor()
 *
 * @param Current HP Fontface
 * @desc Current HP digits display font name. (leave blank for no
 * text)   Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Current HP Fontsize
 * @desc Current HP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Current HP Color
 * @desc Current HP digits display font color.
 * Default: this.hpColor(actor)
 * @default this.hpColor(actor)
 *
 * @param Max HP Fontface
 * @desc Max HP digits display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Max HP Fontsize
 * @desc Max HP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Max HP Color
 * @desc Max HP digits display font color.
 * Default: this.normalColor() (allows script code)
 * @default this.normalColor()
 *
 * @param == MP display ==
 * @default ================================================
 *
 * @param Show MP
 * @desc Show MP value and gauge on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param Show MP Gauge
 * @desc Show MP gauge on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param MP Gauge Width
 * @desc Width of the MP Gauge
 * Default: 96 (allows script code)
 * @default 96
 *
 * @param MP Offset X
 * @desc MP display position offset X.
 * Default: 375 (allows script code)
 * @default 375
 *
 * @param MP Offset Y
 * @desc MP display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param MP Text Fontface
 * @desc MP text display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param MP Text Fontsize
 * @desc MP text display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param MP Text Color
 * @desc MP text display font color.
 * Default: this.systemColor() (allows script code)
 * @default this.systemColor()
 *
 * @param Current MP Fontface
 * @desc Current MP digits display font name. (leave blank for no
 * text)   Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Current MP Fontsize
 * @desc Current MP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Current MP Color
 * @desc Current MP digits display font color.
 * Default: this.mpColor(actor) (allows script code)
 * @default this.mpColor(actor)
 *
 * @param Max MP Fontface
 * @desc Max MP digits display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Max MP Fontsize
 * @desc Max MP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Max MP Color
 * @desc Max MP digits display font color.
 * Default: this.normalColor() (allows script code)
 * @default this.normalColor()
 *
 * @param == TP display ==
 * @default ================================================
 *
 * @param Max TP
 * @desc Max TP value for the actors.
 * Default: 100 (allows script code)
 * @default 100
 *
 * @param Show TP
 * @desc Show TP value and gauge on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param Show TP Gauge
 * @desc Show TP gauge on the status window.
 * true - ON     false - OFF
 * @default true
 *
 * @param TP Gauge Width
 * @desc Width of the TP Gauge
 * Default: 96 (allows script code)
 * @default 96
 *
 * @param TP Offset X
 * @desc TP display position offset X.
 * Default: 485 (allows script code)
 * @default 485
 *
 * @param TP Offset Y
 * @desc TP display position offset Y.
 * Default: 0 (allows script code)
 * @default 0
 *
 * @param TP Text Fontface
 * @desc TP text display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param TP Text Fontsize
 * @desc TP text display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param TP Text Color
 * @desc TP text display font color.
 * Default: this.systemColor() (allows script code)
 * @default this.systemColor()
 *
 * @param Current TP Fontface
 * @desc Current TP digits display font name. (leave blank for no
 * text)  Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Current TP Fontsize
 * @desc Current TP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Current TP Color
 * @desc Current TP digits display font color.
 * Default: this.tpColor(actor) (allows script code)
 * @default this.tpColor(actor)
 *
 * @param Max TP Fontface
 * @desc Max TP digits display font name. (leave blank for no text)
 * Default: this.standardFontFace() (allows script code)
 * @default this.standardFontFace()
 *
 * @param Max TP Fontsize
 * @desc Max TP digits display font size.
 * Default: this.standardFontSize() (allows script code)
 * @default this.standardFontSize()
 *
 * @param Max TP Color
 * @desc Max TP digits display font color.
 * Default: this.normalColor() (allows script code)
 * @default this.normalColor()
 *
 * @param == Custom Code ==
 * @default ================================================
 *
 * @param Custom Code 1
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 2
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 3
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 4
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 5
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 6
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 7
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 8
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 9
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * @param Custom Code 10
 * @desc Custom code processed when the status window refresh.
 * Use to display values provided by other plugins.
 * @default @@
 *
 * ------------------------------------------------------------------------------
 * @help
 * ------------------------------------------------------------------------------
 *
 *  Before going ahead with the plugin instructions I must warn something about
 *  this plugin. While this plugin offers a lot of options, almost no setup will
 *  be automated. So if you make any change to the layout, you will need to setup
 *  the offset of each information **manually**. This plugin requires a lot of
 *  trial-and-error to get everything in position. There is no shortcut.
 *
 *  If you expect just to copy and paste, and change a couple of values to have
 *  this plugin to make heavy changes to the layout, I suggest looking for
 *  another, because this one will require a LOT of effort.
 *
 *  This plugin also have a heavy processing during the window refresh, plugins
 *  poorly designed that calls the battle status window refresh more than needed
 *  might cause lag. If you experience too much lag while using this plugin, it's
 *  probably because another plugin is refreshing the window more than needed.
 *
 * ------------------------------------------------------------------------------
 * Actors and Classes Notetags:
 * ------------------------------------------------------------------------------
 *
 *  <hide mp display>
 *   Hides the MP display for the actor on the battle status window.
 *
 * ---------------
 *
 *  <hide tp display>
 *   Hides the TP display for the actor on the battle status window.
 *
 * ---------------
 *
 *  <mp display>
 *   x = code
 *   y = code
 *   width = code
 *  <mp display>
 *   Changes the MP display for the actor.
 *    x : offset X.
 *    y : offset Y.
 *    width : gauge width.
 *
 * ---------------
 *
 *  <tp display>
 *   x = code
 *   y = code
 *   width = code
 *  <tp display>
 *   Changes the TP display for the actor.
 *    x : offset X.
 *    y : offset Y.
 *    width : gauge width.
 *
 * ------------------------------------------------------------------------------
 * Additional Information:
 * ------------------------------------------------------------------------------
 *
 *  - MP and TP display notetags
 *  On the codes for the notetags, you can use "actor" to refer for the actor,
 *  "rect" to get the rectange data that contains the actor's info and 'index' to
 *  get the actor index on the party. Any other valid code for basic windows are
 *  also valid.
 *  You must add a code for each value and all must return a numeric values.
 *
 * ---------------
 *
 *  - Plugin Parameters Setup
 *  Most of the setup for this plugin is made through plugin parameters.
 *  Several of those plugin parameters allows the use of script codes. If this is
 *  the case, you can use any valid code for basic windows.
 *
 * ---------------
 *
 *  - Window Layout
 *  The 'Window Layout' plugin parameters changes how the actor's parameters
 *  display will be organized on the status window. By default it's show as 4
 *  lines. You can change the number of lines and columns for the display.
 *
 *  - Window Lines and Columns
 *  You can use script codes that returns numeric values as the value for the
 *  'Window Lines' and 'Window Columns' values
 *
 * ---------------
 *
 *  - Window Display
 *  The 'Window Display' plugin parameters setups the window postion, size,
 *  opacity and allows you to set a background image for the window.
 *
 *  - Window Position and Size
 *  The parameters 'Window X' and 'Window Y' defines the window position and
 *  the parameters 'Window Width' and 'Window Height' defines the size.
 *  You can use script codes that returns numeric values as the value for them.
 *
 *  You can use 'boxWidth' to get the screen width, You can use 'boxHeight' to
 *  get the screen height, 'width' to get the default RMMV window width and
 *  'height' for the default window height as the code.
 *
 *  - Window Movement
 *  The 'Window Movement' makes the window slide while inputing commands, leave
 *  the value 0 for no movement, negative values will make the window slide
 *  left when the command window is open.
 *
 *  - Window Background
 *  The 'Window Background' is placed behind the window itself. It's advised to
 *  lower the opacity, otherwise the window will cover the image. You can adjust
 *  it's position with the parameters 'Window Background X' and
 *  'Window Background Y'.
 *  The image graphic should be placed on the folder 'img/system/'
 *
 * ---------------
 *
 *  - Content Setup
 *  The 'Content Setup' plugin parameters controls the global position of each
 *  actor data display.
 *
 *  - Content Offset
 *  The parameters 'Content Offset X' and 'Content Offset Y' can be used to
 *  adjust the position of the content. You can use script codes that returns
 *  numeric values as the value for the 'Content Offset X' and
 *  'Content Offset Y' values.
 *
 *  - Content Background
 *  The 'Content Background' is placed behind the actor data, but above the
 *  windowskin. The image is shown for each actor in the party. You can adjust
 *  the images offset with the parameters 'Content Back X' and 'Content Back Y'.
 *  The image graphic should be placed on the folder 'img/system/'
 *
 * ---------------
 *
 *  - Active Setup
 *  The 'Active Setup' plugin parameters changes some behavior of the display
 *  while selecting actions for an actor.
 *
 *  - Active Select
 *  The parameter 'Active Select' defines if the current actor content in the
 *  window will be highligthed by the default cursor while he is active.
 *
 *  - Active Offset
 *  The parameters 'Active Offset X' and 'Active Offset Y' changes the offset of
 *  the actor content while he is active.
 *
 *  - Active Background
 *  The 'Active Background' is placed behind the actor data, but above the
 *  windowskin. If you're using the 'Content Background', it will replace the
 *  content image while the actor is active.  You can adjust the images offset
 *  with the parameters 'Active Back X' and 'Active Back Y'.
 *
 * ---------------
 *
 *  - Face Setup
 *  The 'Face Setup' plugin parameters allows you to display faces for the
 *  actors on the battle status window. The face is displayed bellow all the
 *  actor information, but above the background images, if using them.
 *
 *  - Face Sufix
 *  The parameter 'Face Sufix' set a sufix for the actor battle face, this
 *  can be used if you want the faces displayed on battle to be different
 *  from the faces used everywhere else. The face must have the same filename
 *  as the original face + the sufix. For example, if you set the sufix [battle]
 *  and have a face named 'Actor1' the battle face should be 'Actor1[battle]'
 *  The index for the face is not changed, keep that in mind while formating the
 *  battle faces.
 *
 *  - Face Offset and Size
 *  The parameters 'Face Offset X' and 'Face Offset Y' defines the face offset
 *  position and the parameters 'Face Width' and 'Face Height' defines the size.
 *  You can use script codes that returns numeric values as the value for them.
 *
 * ---------------
 *
 *  - Name Display
 *  The 'Name Display' plugin parameters controls actor's name display.
 *
 *  - Name Offset
 *  The parameters 'Name Offset X' and 'Name Offset Y' defines the name offset
 *  position.
 *  You can use script codes that returns numeric values as the value for them.
 *
 *  - Name Fontface
 *  The parameter 'Name Fontface' defines the font name for the name display.
 *  You can use script codes that returns a string with the fontname se the
 *  value for it.
 *
 *  - Name Fontsize
 *  The parameter 'Name Fontsize' defines the font size for the name display.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - Name Color
 *  The parameter 'Name Color' defines the font color for the name display.
 *  The color must be either a hex color code (#000000) or a script code
 *  that returns a color value. If using the plugin 'SFonts' only the codes
 *  will work (hex codes will not work).
 *
 * ---------------
 *
 *  - States Display
 *  The 'States Display' plugin parameters controls actor's states icons display.
 *
 *  - States Icons
 *  The parameter 'States Max Icons' defines the max number of icons displayed.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - States Offset
 *  The parameters 'States Offset X' and 'States Offset Y' defines the states
 *  icons offset position.
 *  You can use script codes that returns numeric values as the value for them.
 *
 * ---------------
 *
 *  - Action Icon
 *  The 'Action Icon' plugin parameters allows you to display the icon for the
 *  action currently selected by the actor.
 *
 *  - No Action Icon
 *  The parameter 'No Action Icon' defines the Id for the icon used when no
 *  action is selected.
 *
 *  - Action Offset
 *  The parameters 'Action Offset X' and 'Action Offset Y' defines the action
 *  icon offset position.
 *  You can use script codes that returns numeric values as the value for them.
 *
 * ---------------
 *
 *  - HP display
 *  The 'HP Display' plugin parameters controls the actor's hp display.
 *
 *  - Show HP Gauge
 *  The parameter 'Show HP Gauge' defines if the HP gauge will be shown, this
 *  only affect the gauge, the HP text and digits are shown regardless of this.
 *
 *  - HP Gauge Width
 *  The parameter 'HP Gauge Width' defines the hp gauge width and also the space
 *  used to draw the hp text and digits. So, even if the Hp gauge is hidden, you
 *  should keep the gauge width value set.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - HP Offset
 *  The parameters 'HP Offset X' and 'HP Offset Y' defines the hp display offset
 *  position.
 *  You can use script codes that returns numeric values as the value for them.
 *
 * ---------------
 *
 *  - HP Text Fontface
 *  The parameter 'HP Text Fontface' defines the font name for the hp text
 *  display.
 *  You can use script codes that returns a string with the fontname se the
 *  value for it.
 *
 *  - HP Text Fontsize
 *  The parameter 'HP Text Fontsize' defines the font size for the hp text
 *  display.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - HP Text Color
 *  The parameter 'HP Text Color' defines the font color for the hp text display.
 *  The color must be either a hex color code (#000000) or a script code
 *  that returns a color value. If using the plugin 'SFonts' only the codes
 *  will work (hex codes will not work).
 *
 * ---------------
 *
 *  - Current HP Fontface
 *  The parameter 'Current HP Fontface' defines the font name for the current hp
 *  digits display.
 *  You can use script codes that returns a string with the fontname se the
 *  value for it.
 *
 *  - Current HP Fontsize
 *  The parameter 'Current HP Fontsize' defines the font size for the current hp
 *  digits display.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - Current HP Color
 *  The parameter 'Current HP Color' defines the font color for the current hp
 *  digits display.
 *  The color must be either a hex color code (#000000) or a script code
 *  that returns a color value. If using the plugin 'SFonts' only the codes
 *  will work (hex codes will not work).
 *
 * ---------------
 *
 *  - Max HP Fontface
 *  The parameter 'Max HP Fontface' defines the font name for the max hp
 *  digits display***.
 *  You can use script codes that returns a string with the fontname se the
 *  value for it.
 *
 *  - Max HP Fontsize
 *  The parameter 'Max HP Fontsize' defines the font size for the max hp
 *  digits display***.
 *  You can use script codes that returns numeric values as the value for it.
 *
 *  - Max HP Color
 *  The parameter 'Max HP Color' defines the font color for the max hp
 *  digits display***.
 *  The color must be either a hex color code (#000000) or a script code
 *  that returns a color value. If using the plugin 'SFonts' only the codes
 *  will work (hex codes will not work).
 *
 *  *** Notice that the Max HP display depends on the gauge width and fontsize.
 *    If there is not enough room for it to be drawn, it will be not show at all.
 *
 * ---------------
 *
 *  - MP display
 *  The 'MP Display' plugin parameters controls the actor's MP display. It's
 *  setup is the same as the 'HP Display' parameters setup.
 *
 * ---------------
 *
 *  - TP display
 *  The 'TP Display' plugin parameters controls the actor's TP display. It's
 *  setup is the same as the 'HP Display' parameters setup.
 *
 * ---------------
 *
 *  - Custom Codes
 *  The 'Custom Code' plugin parameter allows you to process script codes when
 *  the status window refresh. This can be used to add information from custom
 *  plugins into the status window. you can use "actor" to refer for the actor,
 *  "rect" to get the rectange data that contains the actor's info, 'index' to
 *  get the actor index on the party, 'x' to get the rect x position, 'y' to get
 *  the rect y position, 'width' to get the rect width and 'height' to get the
 *  rect height. Any other valid code for basic windows are also valid.
 *  This requires scripting knwoledge, use at your own risk.
 *
 * ------------------------------------------------------------------------------
 * Example Notetags:
 * ------------------------------------------------------------------------------
 *
 * <mp display>
 *  x = 4;
 *  y = 72;
 *  width = 108;
 * </mp display>
 *
 * ---------------
 *
 * <tp display>
 *  x = 4;
 *  y = this.lineHeight() * 3;
 *  width = rect.width - 8;
 * </tp display>
 *
 * ------------------------------------------------------------------------------
 */

(function() {

	//=============================================================================
	// Parameters
	//=============================================================================

	if (Imported['VE - Basic Module']) {
		var parameters = VictorEngine.getPluginParameters();
		VictorEngine.Parameters = VictorEngine.Parameters || {};
		VictorEngine.Parameters.BattleStatusWindow = {};
		VictorEngine.Parameters.BattleStatusWindow.WindowLines    = String(parameters["Window Lines"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowColumns  = String(parameters["Window Columns"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowX        = String(parameters["Window X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowY        = String(parameters["Window Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowWidth    = String(parameters["Window Width"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowHeight   = String(parameters["Window Height"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.BackOpacity    = String(parameters["Window Back Opacity"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FrameOpacity   = String(parameters["Window Frame Opacity"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.WindowBack     = String(parameters["Window Background"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ContentOffsetX = String(parameters["Content Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ContentOffsetY = String(parameters["Content Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ContentBack    = String(parameters["Content Background"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ContentBackX   = String(parameters["Content Back X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ContentBackY   = String(parameters["Content Back Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActiveOffsetX  = String(parameters["Active Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActiveOffsetY  = String(parameters["Active Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActiveBack     = String(parameters["Active Background"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActiveBackX    = String(parameters["Active Back X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActiveBackY    = String(parameters["Active Back Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FaceSufix      = String(parameters["Face Sufix"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FaceWidth      = String(parameters["Face Width"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FaceHeight     = String(parameters["Face Height"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FaceOffsetX    = String(parameters["Face Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.FaceOffsetY    = String(parameters["Face Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NameOffsetX    = String(parameters["Name Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NameOffsetY    = String(parameters["Name Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NameFontface   = String(parameters["Name Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NameFontsize   = String(parameters["Name Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NameColor      = String(parameters["Name Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.StatesMaxIcons = String(parameters["States Max Icons"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.StatesOffsetX  = String(parameters["States Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.StatesOffsetY  = String(parameters["States Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.NoActionIcon   = String(parameters["No Action Icon"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActionOffsetX  = String(parameters["Action Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.ActionOffsetY  = String(parameters["Action Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPGaugeWidth   = String(parameters["HP Gauge Width"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPOffsetX      = String(parameters["HP Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPOffsetY      = String(parameters["HP Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPTextFontface = String(parameters["HP Text Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPTextFontsize = String(parameters["HP Text Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HPTextColor    = String(parameters["HP Text Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentHPName  = String(parameters["Current HP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentHPSize  = String(parameters["Current HP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentHPColor = String(parameters["Current HP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxHPName      = String(parameters["Max HP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxHPSize      = String(parameters["Max HP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxHPColor     = String(parameters["Max HP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPGaugeWidth   = String(parameters["MP Gauge Width"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPOffsetX      = String(parameters["MP Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPOffsetY      = String(parameters["MP Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPTextFontface = String(parameters["MP Text Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPTextFontsize = String(parameters["MP Text Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MPTextColor    = String(parameters["MP Text Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentMPName  = String(parameters["Current MP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentMPSize  = String(parameters["Current MP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentMPColor = String(parameters["Current MP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxMPName      = String(parameters["Max MP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxMPSize      = String(parameters["Max MP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxMPColor     = String(parameters["Max MP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxTP          = String(parameters["Max TP"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPGaugeWidth   = String(parameters["TP Gauge Width"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPOffsetX      = String(parameters["TP Offset X"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPOffsetY      = String(parameters["TP Offset Y"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPTextFontface = String(parameters["TP Text Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPTextFontsize = String(parameters["TP Text Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.TPTextColor    = String(parameters["TP Text Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentTPName  = String(parameters["Current TP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentTPSize  = String(parameters["Current TP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.CurrentTPColor = String(parameters["Current TP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxTPName      = String(parameters["Max TP Fontface"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxTPSize      = String(parameters["Max TP Fontsize"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.MaxTPColor     = String(parameters["Max TP Color"]).trim();
		VictorEngine.Parameters.BattleStatusWindow.HorzCentralize = eval(parameters["Horizontal Centralize"]);
		VictorEngine.Parameters.BattleStatusWindow.VertCentralize = eval(parameters["Vertical Centralize"]);
		VictorEngine.Parameters.BattleStatusWindow.ActiveSelect   = eval(parameters["Active Select"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowFaces      = eval(parameters["Show Faces"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowName       = eval(parameters["Show Name"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowStates     = eval(parameters["Show States"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowActionIcon = eval(parameters["Show Action Icon"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowHPGauge    = eval(parameters["Show HP Gauge"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowMP         = eval(parameters["Show MP"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowMPGauge    = eval(parameters["Show MP Gauge"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowTP         = eval(parameters["Show TP"]);
		VictorEngine.Parameters.BattleStatusWindow.ShowTPGauge    = eval(parameters["Show TP Gauge"]);
		VictorEngine.Parameters.BattleStatusWindow.WindowMove     = Number(parameters["Window Movement"]) || 0;
		VictorEngine.Parameters.BattleStatusWindow.BackgroundX    = Number(parameters["Window Background X"]) || 0;
		VictorEngine.Parameters.BattleStatusWindow.BackgroundY    = Number(parameters["Window Background Y"]) || 0;
		for (var i = 1; i <= 10; i++) {
			var value = String(i);
			VictorEngine.Parameters.BattleStatusWindow['CustomCode' + value] = String(parameters["Custom Code " + value]).trim();
		}
	}

	//=============================================================================
	// VictorEngine
	//=============================================================================

	VictorEngine.BattleStatusWindow.loadParameters = VictorEngine.loadParameters;
	VictorEngine.loadParameters = function() {
		VictorEngine.BattleStatusWindow.loadParameters.call(this);
		VictorEngine.BattleStatusWindow.processParameters();
	};

	VictorEngine.BattleStatusWindow.loadNotetagsValues = VictorEngine.loadNotetagsValues;
	VictorEngine.loadNotetagsValues = function(data, index) {
		VictorEngine.BattleStatusWindow.loadNotetagsValues.call(this, data, index);
		if (this.objectSelection(index, ['actor', 'class'])) {
			VictorEngine.BattleStatusWindow.loadNotes(data);
		}
	};

	VictorEngine.BattleStatusWindow.loadNotes = function(data) {
		data.battleStatusWindow = data.battleStatusWindow || {};
		this.processNotes(data);
	};

	VictorEngine.BattleStatusWindow.processNotes = function(data) {
		var match;
		var part1  = "[ ]*('[^\']+'|\"[^\"]+\")[ ]*"
		var regex1 = new RegExp('<hide tp display>', 'gi');
		var regex2 = new RegExp('<hide mp display>', 'gi');
		var regex3 = VictorEngine.getNotesValues('(mp|tp) display')
		data.battleStatusWindow.hideTp = !!data.note.match(regex1);
		data.battleStatusWindow.hideMp = !!data.note.match(regex2);
		while (match = regex3.exec(data.note)) {
			this.processValues(data, match);
		};
	};

	VictorEngine.BattleStatusWindow.processValues = function(data, match) {
		data.battleStatusWindow[match[1].toLowerCase()] = match[2].trim();
	};

	VictorEngine.BattleStatusWindow.processParameters = function() {
		if (!this.loaded) {
			this.loaded = true;
			this.setupLayout();
			this.setupDisplay();
			this.setupContent();
			this.setupActive();
			this.setupFace();
			this.setupName();
			this.setupState();
			this.setupAction();
			this.setupHP();
			this.setupMP();
			this.setupTP();
			this.setupCustom();
			this.setupOffset();
		}
	};

	VictorEngine.BattleStatusWindow.setupLayout = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.layout = {};
		this.layout.lines   = parameters.WindowLines;
		this.layout.columns = parameters.WindowColumns;
	};

	VictorEngine.BattleStatusWindow.setupDisplay = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.display = {};
		this.display.x = parameters.WindowX;
		this.display.y = parameters.WindowY;
		this.display.width  = parameters.WindowWidth;
		this.display.height = parameters.WindowHeight;
		this.display.movement = parameters.WindowMove;
		this.display.background  = parameters.WindowBack;
		this.display.backgroundX = parameters.BackgroundX;
		this.display.backgroundY = parameters.BackgroundY;
		this.display.backOpacity  = parameters.BackOpacity;
		this.display.frameOpacity = parameters.FrameOpacity;
	};

	VictorEngine.BattleStatusWindow.setupContent = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.content = {};
		this.content.horizontal = parameters.HorzCentralize;
		this.content.vertical   = parameters.VertCentralize;
		this.content.background = parameters.ContentBack;
		this.content.x = parameters.ContentBackX;
		this.content.y = parameters.ContentBackY;
	};

	VictorEngine.BattleStatusWindow.setupActive = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.active = {};
		this.active.select     = parameters.ActiveSelect;
		this.active.background = parameters.ActiveBack;
		this.active.x = parameters.ActiveBackX;
		this.active.y = parameters.ActiveBackY;
	};

	VictorEngine.BattleStatusWindow.setupFace = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.face = {};
		this.face.show   = parameters.ShowFaces;
		this.face.sufix  = parameters.FaceSufix;
		this.face.width  = parameters.FaceWidth;
		this.face.height = parameters.FaceHeight;
	};

	VictorEngine.BattleStatusWindow.setupName = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.name = {};
		this.name.show  = parameters.ShowName;
		this.name.face  = parameters.NameFontface;
		this.name.size  = parameters.NameFontsize;
		this.name.color = parameters.NameColor;
	};

	VictorEngine.BattleStatusWindow.setupState = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.state = {};
		this.state.show = parameters.ShowStates;
		this.state.max  = parameters.StatesMaxIcons;
	};

	VictorEngine.BattleStatusWindow.setupAction = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.action = {};
		this.action.show = parameters.ShowActionIcon;
		this.action.icon = parameters.NoActionIcon;
	};

	VictorEngine.BattleStatusWindow.setupHP = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.hp = {};
		this.hp.gauge  = parameters.ShowHPGauge;
		this.hp.width  = parameters.HPGaugeWidth;
		this.hp.textFace  = parameters.HPTextFontface;
		this.hp.textSize  = parameters.HPTextFontsize;
		this.hp.textColor = parameters.HPTextColor;
		this.hp.currentFace  = parameters.CurrentHPName;
		this.hp.currentSize  = parameters.CurrentHPSize;
		this.hp.currentColor = parameters.CurrentHPColor;
		this.hp.maxFace  = parameters.MaxHPName;
		this.hp.maxSize  = parameters.MaxHPSize;
		this.hp.maxColor = parameters.MaxHPColor;
	};

	VictorEngine.BattleStatusWindow.setupMP = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.mp = {};
		this.mp.show  = parameters.ShowMP;
		this.mp.gauge = parameters.ShowMPGauge;
		this.mp.width = parameters.MPGaugeWidth;
		this.mp.textFace  = parameters.MPTextFontface;
		this.mp.textSize  = parameters.MPTextFontsize;
		this.mp.textColor = parameters.MPTextColor;
		this.mp.currentFace  = parameters.CurrentMPName;
		this.mp.currentSize  = parameters.CurrentMPSize;
		this.mp.currentColor = parameters.CurrentMPColor;
		this.mp.maxFace  = parameters.MaxMPName;
		this.mp.maxSize  = parameters.MaxMPSize;
		this.mp.maxColor = parameters.MaxMPColor;
	};

	VictorEngine.BattleStatusWindow.setupTP = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.tp = {};
		this.tp.max   = parameters.MaxTP
		this.tp.show  = parameters.ShowTP;
		this.tp.gauge = parameters.ShowTPGauge;
		this.tp.width = parameters.TPGaugeWidth;
		this.tp.textFace  = parameters.TPTextFontface;
		this.tp.textSize  = parameters.TPTextFontsize;
		this.tp.textColor = parameters.TPTextColor;
		this.tp.currentFace  = parameters.CurrentTPName;
		this.tp.currentSize  = parameters.CurrentTPSize;
		this.tp.currentColor = parameters.CurrentTPColor;
		this.tp.maxFace  = parameters.MaxTPName;
		this.tp.maxSize  = parameters.MaxTPSize;
		this.tp.maxColor = parameters.MaxTPColor;
	};

	VictorEngine.BattleStatusWindow.setupCustom = function() {
		this.custom = [];
		for (var i = 1; i <= 10; i++) {
			var value = String(i);
			this.custom.push(VictorEngine.Parameters.BattleStatusWindow['CustomCode' + value]);
		};
	};

	VictorEngine.BattleStatusWindow.setupOffset = function() {
		var parameters = VictorEngine.Parameters.BattleStatusWindow;
		this.offset = {};
		this.offset.content = {x: parameters.ContentOffsetX, y: parameters.ContentOffsetY};
		this.offset.active  = {x: parameters.ActiveOffsetX,  y: parameters.ActiveOffsetY};
		this.offset.action  = {x: parameters.ActionOffsetX,  y: parameters.ActionOffsetY};
		this.offset.state   = {x: parameters.StatesOffsetX,  y: parameters.StatesOffsetY};
		this.offset.face    = {x: parameters.FaceOffsetX,    y: parameters.FaceOffsetY};
		this.offset.name    = {x: parameters.NameOffsetX,    y: parameters.NameOffsetY};
		this.offset.hp      = {x: parameters.HPOffsetX,      y: parameters.HPOffsetY};
		this.offset.mp      = {x: parameters.MPOffsetX,      y: parameters.MPOffsetY};
		this.offset.tp      = {x: parameters.TPOffsetX,      y: parameters.TPOffsetY};
	};

	//=============================================================================
	// Game_Actor
	//=============================================================================

	VictorEngine.BattleStatusWindow.startTurn = BattleManager.startTurn;
	BattleManager.startTurn = function() {
		VictorEngine.BattleStatusWindow.startTurn.call(this);
		$gameParty.aliveMembers().forEach(function(member) {
			if (member.isConfused() && !member.actionIcon()) {
				action = member.currentAction();
				if (action) {
					member.setActionIcon(action.item().iconIndex);
				}
			}
		})
	};

	//=============================================================================
	// Game_Actor
	//=============================================================================

	VictorEngine.BattleStatusWindow.performActionEnd = Game_Actor.prototype.performActionEnd;
	Game_Actor.prototype.performActionEnd = function() {
		VictorEngine.BattleStatusWindow.performActionEnd.call(this);
		this.clearActionIcon();
	};

	VictorEngine.BattleStatusWindow.onRestrict = Game_Actor.prototype.onRestrict;
	Game_Actor.prototype.onRestrict = function() {
		VictorEngine.BattleStatusWindow.onRestrict.call(this);
		this.clearActionIcon();
	};

	VictorEngine.BattleStatusWindow.onBattleEnd = Game_Actor.prototype.onBattleEnd;
	Game_Actor.prototype.onBattleEnd = function() {
		VictorEngine.BattleStatusWindow.onBattleEnd.call(this);
		this.clearActionIcon();
	};

	Game_Actor.prototype.actionIcon = function() {
		return this._actionIcon;
	};

	Game_Actor.prototype.clearActionIcon = function() {
		this._actionIcon = 0;
	};

	Game_Actor.prototype.setActionIcon = function(icon) {
		this._actionIcon = icon;
	};

	Game_Actor.prototype.hideMpDisplay = function() {
		var objects = [this.actor(), this.currentClass()];
		return objects.some(function(object) { return object.battleStatusWindow.hideMp });
	};

	Game_Actor.prototype.hideTpDisplay = function() {
		var objects = [this.actor(), this.currentClass()];
		return objects.some(function(object) { return object.battleStatusWindow.hideTp });
	};

	Game_Actor.prototype.mpStatusDisplay = function() {
		if (this.actor().battleStatusWindow.mp) {
			return this.actor().battleStatusWindow.mp;
		} else if (this.currentClass().battleStatusWindow.mp) {
			return this.currentClass().battleStatusWindow.mp;
		} else {
			return null;
		}
	};

	Game_Actor.prototype.tpStatusDisplay = function() {
		if (this.actor().battleStatusWindow.tp) {
			return this.actor().battleStatusWindow.tp
		} else if (this.currentClass().battleStatusWindow.tp) {
			return this.currentClass().battleStatusWindow.tp;
		} else {
			return null;
		}
	};

	//=============================================================================
	// Window_Base
	//=============================================================================

	Window_Base.prototype.drawHpGauge = function(actor, x, y, width) {
		var gauge1 = this.hpGaugeColor1();
		var gauge2 = this.hpGaugeColor2();
		this.drawGauge(x, y, width, actor.hpRate(), gauge1, gauge2);
	};

	Window_Base.prototype.drawMpGauge = function(actor, x, y, width) {
		var gauge1 = this.mpGaugeColor1();
		var gauge2 = this.mpGaugeColor2();
		this.drawGauge(x, y, width, actor.mpRate(), gauge1, gauge2);
	};

	Window_Base.prototype.drawTpGauge = function(actor, x, y, width) {
		var gauge1 = this.tpGaugeColor1();
		var gauge2 = this.tpGaugeColor2();
		this.drawGauge(x, y, width, actor.tpRate(), gauge1, gauge2);
	};

	//=============================================================================
	// Scene_Battle
	//=============================================================================

	/* Overwritten function */
	Scene_Battle.prototype.createStatusWindow = function() {
		this._statusWindow = new Window_CustomBattleStatus();
		this.addWindow(this._statusWindow);
	};

	/* Overwritten function */
	Scene_Battle.prototype.updateWindowPositions = function() {
		if (this._statusWindow.moveX()) {
			var statusX = 0;
			if (BattleManager.isInputting()) {
				statusX = this._statusWindow.defaultX();
			} else {
				statusX = this._statusWindow.defaultX() - this._statusWindow.moveX();
			}
			if (this._statusWindow.x < statusX) {
				this._statusWindow.x += 16;
				if (this._statusWindow.x > statusX) {
					this._statusWindow.x = statusX;
				}
			}
			if (this._statusWindow.x > statusX) {
				this._statusWindow.x -= 16;
				if (this._statusWindow.x < statusX) {
					this._statusWindow.x = statusX;
				}
			}
		}
	};

	VictorEngine.BattleStatusWindow.startActorCommandSelection = Scene_Battle.prototype.startActorCommandSelection;
	Scene_Battle.prototype.startActorCommandSelection = function() {
		VictorEngine.BattleStatusWindow.startActorCommandSelection.call(this);
		this.clearActionIcon();
	};

	VictorEngine.BattleStatusWindow.onSelectAction = Scene_Battle.prototype.onSelectAction;
	Scene_Battle.prototype.onSelectAction = function() {
		VictorEngine.BattleStatusWindow.onSelectAction.call(this);
		this.setActionIcon();
	};

	VictorEngine.BattleStatusWindow.commandAttack = Scene_Battle.prototype.commandAttack;
	Scene_Battle.prototype.commandAttack = function() {
		VictorEngine.BattleStatusWindow.commandAttack.call(this);
		this.setActionIcon();
	};

	VictorEngine.BattleStatusWindow.commandGuard = Scene_Battle.prototype.commandGuard;
	Scene_Battle.prototype.commandGuard = function() {
		this.setGuardIcon();
		VictorEngine.BattleStatusWindow.commandGuard.call(this);
	};

	VictorEngine.BattleStatusWindow.onActorCancel = Scene_Battle.prototype.onActorCancel;
	Scene_Battle.prototype.onActorCancel = function() {
		VictorEngine.BattleStatusWindow.onActorCancel.call(this);
		this.clearActionIcon();
	};

	VictorEngine.BattleStatusWindow.onEnemyCancel = Scene_Battle.prototype.onEnemyCancel;
	Scene_Battle.prototype.onEnemyCancel = function() {
		VictorEngine.BattleStatusWindow.onEnemyCancel.call(this);
		this.clearActionIcon();
	};

	Scene_Battle.prototype.setActionIcon = function() {
		var item = BattleManager.inputtingAction().item();
		BattleManager.actor().setActionIcon(item.iconIndex);
		this._statusWindow.refresh();
	};

	Scene_Battle.prototype.setGuardIcon = function() {
		var item = $dataSkills[BattleManager.actor().guardSkillId()]
		BattleManager.actor().setActionIcon(item.iconIndex);
		this._statusWindow.refresh();
	};

	Scene_Battle.prototype.clearActionIcon = function() {
		BattleManager.actor().clearActionIcon();
		this._statusWindow.refresh();
	};

})();

//=============================================================================
// Window_CustomBattleStatus
//=============================================================================

function Window_CustomBattleStatus() {
    this.initialize.apply(this, arguments);
}

Window_CustomBattleStatus.prototype = Object.create(Window_BattleStatus.prototype);
Window_CustomBattleStatus.prototype.constructor = Window_CustomBattleStatus;

(function() {

	Object.defineProperties(Window_CustomBattleStatus.prototype, {
        frameOpacity: {
			get: function() {
				return this._windowFrameSprite.alpha * 255;
			},
			set: function(value) {
				this._windowFrameSprite.alpha = value.clamp(0, 255) / 255;
			},
			configurable: true
        }
    });

	Window_CustomBattleStatus.prototype.initialize = function() {
		var width  = this.windowWidth();
		var height = this.windowHeight();
		var boxWidth  = Graphics.boxWidth;
		var boxHeight = Graphics.boxHeight;
		var wx = Math.floor(Number(eval(this.display().x))) || 0;
		var wy = Math.floor(Number(eval(this.display().y))) || 0;
		var ww = Math.floor(Number(eval(this.display().width))) || 0;
		var wh = Math.floor(Number(eval(this.display().height))) || 0;
		Window_Selectable.prototype.initialize.call(this, wx, wy, ww, wh);
		this.createBackground();
		this.refresh();
		this.openness  = 0;
		this._defaultX = this.x;
		this._activeIndex  = -1;
	};

	Window_CustomBattleStatus.prototype.updateBackOpacity = function() {
		this.backOpacity  = Number(eval(this.display().backOpacity)) || 0;
		this.frameOpacity = Number(eval(this.display().frameOpacity)) || 0;
	};

	Window_CustomBattleStatus.prototype.refresh = function() {
		this._refreshRequest = true;
	};

	Window_CustomBattleStatus.prototype.update = function() {
		Window_BattleStatus.prototype.update.call(this);
		this.updateRefresh();
		this.updateBackground();
	};

	Window_CustomBattleStatus.prototype.updateRefresh = function() {
		if (this._refreshRequest) {
			Window_BattleStatus.prototype.refresh.call(this);
			this._refreshRequest = false;
		}
	};

	Window_CustomBattleStatus.prototype.updateBackground = function() {
		if (this.display().background && this._background) {
			if (!this._background.bitmap) {
				this._background.bitmap = ImageManager.loadSystem(this.display().background);
				this._background.bitmap.addLoadListener(this.updateBackgroundFrame.bind(this));
			}
			this._background.x = Math.floor(this.display().backgroundX);
			this._background.y = Math.floor(this.display().backgroundY);
			this._background.visible = this.visible && this.isOpen();
			this._background.opacity = this.opacity;
		}
	};

	Window_CustomBattleStatus.prototype.updateBackgroundFrame = function() {
		var width  = this._background.bitmap.width;
		var height = this._background.bitmap.height;
		this._background.setFrame(0, 0, width, height);
	};

	Window_CustomBattleStatus.prototype.select = function(index) {
		if (this.selected().select) {
			Window_Selectable.prototype.select.call(this, index);
		}
		if (this._activeIndex !== index) {
			this._activeIndex = index;
			this.refresh();
		}
	};

	Window_CustomBattleStatus.prototype.createBackground = function() {
		this._background = new Sprite();
		this._windowSpriteContainer.addChildAt(this._background, 0);
	};

	Window_CustomBattleStatus.prototype.defaultX = function() {
		return this._defaultX;
	};

	Window_CustomBattleStatus.prototype.moveX = function() {
		return this.display().movement || 0;
	};

	Window_CustomBattleStatus.prototype.numVisibleRows = function() {
		return Math.floor(Number(eval(this.layout().lines))) || 1;
	};

	Window_CustomBattleStatus.prototype.maxCols = function() {
		return Math.floor(Number(eval(this.layout().columns))) || 1;
	};

	Window_CustomBattleStatus.prototype.itemWidth = function() {
		return Math.floor((this.width - this.padding * 2) / this.maxCols());
	};

	Window_CustomBattleStatus.prototype.itemHeight = function() {
		return Math.floor((this.height - this.padding * 2) / this.numVisibleRows());
	};

	Window_CustomBattleStatus.prototype.itemRect = function(index) {
		var horz = 0;
		var vert = 0;
		var rect = new Rectangle();
		var rows = this.numVisibleRows();
		var cols = this.maxCols();
		var cw = this.contents.width;
		var ch = this.contents.height;
		rect.width  = this.itemWidth();
		rect.height = this.itemHeight();
		if (this.content().horizontal) {
			var max = this.maxItems() - cols * Math.floor(index / cols);
			if (max < cols) {
				horz = Math.floor(cw / 2 - rect.width * max / 2);
			}
		}
		if (this.content().vertical) {
			var max = this.maxItems() - rows * Math.floor(index / rows);
			if (max < rows) {
				vert = Math.floor(ch / 2 - rect.height * max / 2);
			}
		}
		var row = cols === 1 ? Math.floor(index / cols) : Math.floor(index / cols) % rows;
		rect.x = index % cols * rect.width + horz - this._scrollX;
		rect.y = row * rect.height + vert - this._scrollY;
		return rect;
	};

	Window_CustomBattleStatus.prototype.layout = function() {
		return VictorEngine.BattleStatusWindow.layout;
	};

	Window_CustomBattleStatus.prototype.display = function() {
		return VictorEngine.BattleStatusWindow.display;
	};

	Window_CustomBattleStatus.prototype.content = function() {
		return VictorEngine.BattleStatusWindow.content;
	};

	Window_CustomBattleStatus.prototype.selected = function() {
		return VictorEngine.BattleStatusWindow.active;
	};

	Window_CustomBattleStatus.prototype.action = function() {
		return VictorEngine.BattleStatusWindow.action;
	};

	Window_CustomBattleStatus.prototype.face = function() {
		return VictorEngine.BattleStatusWindow.face;
	};

	Window_CustomBattleStatus.prototype.name = function() {
		return VictorEngine.BattleStatusWindow.name;
	};

	Window_CustomBattleStatus.prototype.face = function() {
		return VictorEngine.BattleStatusWindow.face;
	};

	Window_CustomBattleStatus.prototype.state = function() {
		return VictorEngine.BattleStatusWindow.state;
	};

	Window_CustomBattleStatus.prototype.hp = function() {
		return VictorEngine.BattleStatusWindow.hp;
	};

	Window_CustomBattleStatus.prototype.mp = function() {
		return VictorEngine.BattleStatusWindow.mp;
	};

	Window_CustomBattleStatus.prototype.tp = function() {
		return VictorEngine.BattleStatusWindow.tp;
	};

	Window_CustomBattleStatus.prototype.custom = function() {
		return VictorEngine.BattleStatusWindow.custom;
	};

	Window_CustomBattleStatus.prototype.offset = function() {
		return VictorEngine.BattleStatusWindow.offset;
	};

	Window_CustomBattleStatus.prototype.isActive = function(index) {
		return this._activeIndex === index;
	};

	Window_CustomBattleStatus.prototype.drawItem = function(index) {
		var actor = $gameParty.battleMembers()[index];
		var rect  = this.setupItemRect(index, actor);
		this.drawBackArea(rect, index, actor);
		this.drawFaceArea(rect, index, actor);
		this.drawNameArea(rect, index, actor);
		this.drawIconArea(rect, index, actor);
		this.drawHpArea(rect, index, actor);
		this.drawMpArea(rect, index, actor);
		this.drawTpArea(rect, index, actor);
		this.drawCustomArea(rect, index, actor);
	};

	Window_CustomBattleStatus.prototype.setupItemRect = function(index, actor) {
		var rect = this.itemRect(index);
		var offsetX = Number(eval(this.offset().content.x));
		var offsetY = Number(eval(this.offset().content.y));
		var actionX = this.isActive(index) ? Number(eval(this.offset().active.x)) : 0;
		var actionY = this.isActive(index) ? Number(eval(this.offset().active.y)) : 0;
		rect.x += Math.floor(offsetX + actionX);
		rect.y += Math.floor(offsetY + actionY);
		return rect;
	};

	Window_CustomBattleStatus.prototype.drawBackArea = function(rect, index, actor) {
		var name;
		if (this.selected().background && this.isActive(index)) {
			var ox = Math.floor(Number(eval(this.selected().x)));
			var oy = Math.floor(Number(eval(this.selected().y)));
			var name = this.selected().background;
		} else if (this.content().background) {
			var ox = Math.floor(Number(eval(this.content().x)));
			var oy = Math.floor(Number(eval(this.content().y)));
			var name = this.content().background;
		}
		if (name) {
			var bitmap = ImageManager.loadSystem(name);
			this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, rect.x + ox, rect.y + oy);
			if (!bitmap.isReady()) {
				bitmap.addLoadListener(this.refresh.bind(this));
			}
		}
	};

	Window_CustomBattleStatus.prototype.drawFaceArea = function(rect, index, actor) {
		if (this.face().show) {
			var ox = Math.floor(Number(eval(this.offset().face.x)));
			var oy = Math.floor(Number(eval(this.offset().face.y)));
			var fw = Math.floor(Number(eval(this.face().width)));
			var fh = Math.floor(Number(eval(this.face().height)));
			var faceName  = actor.faceName() + this.face().sufix;
			var faceIndex = actor.faceIndex();
			this.drawFace(faceName, faceIndex, rect.x + ox, rect.y + oy, fw, fh);
			var bitmap = ImageManager.loadFace(faceName);
			if (!bitmap.isReady()) {
				bitmap.addLoadListener(this.refresh.bind(this));
			}
		}
	};

	Window_CustomBattleStatus.prototype.drawNameArea = function(rect, index, actor) {
		if (this.name().show) {
			var ox = Math.floor(Number(eval(this.offset().name.x)));
			var oy = Math.floor(Number(eval(this.offset().name.y)));
			var color = eval(this.getFontColor(this.name().color));
			var font  = eval(this.name().face);
			var size  = eval(this.name().size);
			this.changeTextColor(color);
			this.contents.fontFace = font;
			this.contents.fontSize = Math.floor(size);
			this.drawText(actor.name(), rect.x + ox, rect.y + oy, rect.width - ox);
			this.resetFontSettings();
		}
	};

	Window_CustomBattleStatus.prototype.drawIconArea = function(rect, index, actor) {
		if (this.state().show) {
			var ox = Math.floor(Number(eval(this.offset().state.x)));
			var oy = Math.floor(Number(eval(this.offset().state.y)));
			var width = Math.floor(Number(eval(this.state().max)) * Window_Base._iconWidth);
			this.drawActorIcons(actor, rect.x + ox, rect.y + oy, width);
		}
		if (this.action().show) {
			var ox = Math.floor(Number(eval(this.offset().action.x)));
			var oy = Math.floor(Number(eval(this.offset().action.y)));
			var icon = actor.actionIcon() || this.action().icon;
			this.drawIcon(icon, rect.x + ox, rect.y + oy);
		}
	};

	Window_CustomBattleStatus.prototype.drawHpArea = function(rect, index, actor) {
		var ox = Math.floor(Number(eval(this.offset().hp.x)));
		var oy = Math.floor(Number(eval(this.offset().hp.y)));
		var gw = Math.floor(Math.min(Number(eval(this.hp().width)), rect.width - ox));
		this.drawActorHp(actor, rect.x + ox, rect.y + oy, gw);
	};

	Window_CustomBattleStatus.prototype.drawMpArea = function(rect, index, actor) {
		if (this.showMP(actor)) {
			var display = actor.mpStatusDisplay();
			var x = this.offset().mp.x;
			var y = this.offset().mp.y;
			var width = this.mp().width;
			if (display) {
				eval(display);
			}
			var ox = Math.floor(Number(eval(x)));
			var oy = Math.floor(Number(eval(y)));
			var gw = Math.floor(Math.min(Number(eval(width)), rect.width - ox));
			this.drawActorMp(actor, rect.x + ox, rect.y + oy, gw);
		}
	};

	Window_CustomBattleStatus.prototype.drawTpArea = function(rect, index, actor) {
		if (this.showTP(actor)) {
			var display = actor.tpStatusDisplay();
			var x = this.offset().tp.x;
			var y = this.offset().tp.y;
			var width = this.tp().width;
			if (display) {
				eval(display);
			}
			var ox = Math.floor(Number(eval(x)));
			var oy = Math.floor(Number(eval(y)));
			var gw = Math.floor(Math.min(Number(eval(width)), rect.width - ox));
			this.drawActorTp(actor, rect.x + ox, rect.y + oy, gw);
		}
	};

	Window_CustomBattleStatus.prototype.drawCustomArea = function(rect, index, actor) {
		var x = rect.x;
		var y = rect.y;
		var width  = rect.width;
		var height = rect.height;
		var custom = this.custom();
		for (var i = 0; i < custom.length; i++) {
			if (custom[i]) {
				eval(custom[i]);
			}
		}
	};

	Window_CustomBattleStatus.prototype.showMP = function(actor) {
		return this.mp().show && !actor.hideMpDisplay();
	};

	Window_CustomBattleStatus.prototype.showTP = function(actor) {
		return this.tp().show && !actor.hideTpDisplay();
	};

	Window_CustomBattleStatus.prototype.drawActorHp = function(actor, x, y, width) {
		var color1 = eval(this.getFontColor(this.hp().textColor));
		var color2 = eval(this.getFontColor(this.hp().currentColor));
		var color3 = eval(this.getFontColor(this.hp().maxColor));
		var font1  = eval(this.hp().textFace);
		var font2  = eval(this.hp().currentFace);
		var font3  = eval(this.hp().maxFace);
		var size1  = eval(this.hp().textSize);
		var size2  = eval(this.hp().currentSize);
		var size3  = eval(this.hp().maxSize);
		if (this.hp().gauge) {
			this.drawHpGauge(actor, x, y, width);
		}
		this.changeTextColor(color1);
		this.contents.fontFace = font1;
		this.contents.fontSize = size1;
		if (font1) {
			this.drawText(TextManager.hpA, x, y, width);
		}
		this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width, color2, color3, font2, font3, size2, size3);
	};

	Window_CustomBattleStatus.prototype.drawActorMp = function(actor, x, y, width) {
		var color1 = eval(this.getFontColor(this.mp().textColor));
		var color2 = eval(this.getFontColor(this.mp().currentColor));
		var color3 = eval(this.getFontColor(this.mp().maxColor));
		var font1  = eval(this.mp().textFace);
		var font2  = eval(this.mp().currentFace);
		var font3  = eval(this.mp().maxFace);
		var size1  = eval(this.mp().textSize);
		var size2  = eval(this.mp().currentSize);
		var size3  = eval(this.mp().maxSize);
		if (this.mp().gauge) {
			this.drawMpGauge(actor, x, y, width);
		}
		this.changeTextColor(color1);
		this.contents.fontFace = font1;
		this.contents.fontSize = size1;
		if (font1) {
			this.drawText(TextManager.mpA, x, y, width);
		}
		this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width, color2, color3, font2, font3, size2, size3);
	};

	Window_CustomBattleStatus.prototype.drawActorTp = function(actor, x, y, width) {
		var color1 = eval(this.getFontColor(this.tp().textColor));
		var color2 = eval(this.getFontColor(this.tp().currentColor));
		var color3 = eval(this.getFontColor(this.tp().maxColor));
		var font1  = eval(this.tp().textFace);
		var font2  = eval(this.tp().currentFace);
		var font3  = eval(this.tp().maxFace);
		var size1  = eval(this.tp().textSize);
		var size2  = eval(this.tp().currentSize);
		var size3  = eval(this.tp().maxSize);
		var maxTp  = eval(this.tp().maxTp) || 100;
		if (this.tp().gauge) {
			this.drawTpGauge(actor, x, y, width);
		}
		this.changeTextColor(color1);
		this.contents.fontFace = font1;
		this.contents.fontSize = Math.floor(size1);
		if (font1) {
			this.drawText(TextManager.tpA, x, y, width);
		}
		this.drawCurrentAndMax(actor.tp, maxTp, x, y, width, color2, color3, font2, font3, size2, size3);
	};

	Window_CustomBattleStatus.prototype.drawCurrentAndMax = function(current, max, x, y, width, c1, c2, f1, f2, s1, s2) {
		this.changeTextColor(c1);
		this.contents.fontFace = f1;
		this.contents.fontSize = Math.floor(s1);
		var labelWidth = this.textWidth('HP');
		var valueWidth = this.textWidth('0000');
		var slashWidth = this.textWidth('/');
		var x1 = x + width - valueWidth;
		var x2 = x1 - slashWidth;
		var x3 = x2 - valueWidth;
		if (x3 >= x + labelWidth) {
			this.drawText(current, x3, y, valueWidth, 'right');
			this.changeTextColor(c2);
			this.contents.fontFace = f2;
			this.contents.fontSize = Math.floor(s2);
			this.drawText('/', x2, y, slashWidth, 'right');
			this.drawText(max, x1, y, valueWidth, 'right');
		} else {
			this.drawText(current, x1, y, valueWidth, 'right');
		}
		this.resetFontSettings();
	};

})();


code:
//=============================================================================
// VariableControlItem.js
// ----------------------------------------------------------------------------
// Copyright (c) 2016 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.1.1 2017/04/19 範囲が「なし」の場合も操作できるよう修正
// 1.1.0 2016/10/21 加算と代入を別々のメモ欄で設定できるよう変更
// 1.0.0 2016/10/21 初版
// ----------------------------------------------------------------------------
// [Blog]   : http://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
 * @plugindesc VariableControlItemPlugin
 * @author triacontane
 *
 * @help アイテムもしくはスキルを使用し、かつ
 * 行動が成功した場合に、変数を操作できます。
 *
 * アイテムもしくはスキルのメモ欄に以下の通り指定してください。
 *
 * <VCI変数番号:3>  # 変数番号[3]に値を設定します。
 * <VCIVarNumber:3> # 同上
 * <VCI代入値:5>    # 指定した変数に値[5]を代入します。
 * <VCISetValue:5>  # 同上
 * <VCI加算値:5>    # 指定した変数に値[5]を加算します。
 * <VCIAddValue:5>  # 同上
 * ※加算値に負の値を指定すると減算になります。
 *
 * 設定値は、制御文字を適用した上でJavaScript計算式として評価されます。
 * たとえば、アイテムの使用で変数[1]に[5]を乗算したい場合は以下の通り設定します。
 * <VCI変数番号:1>
 * <VCI代入値:\v[1] * 5> # 変数[1]の値に[5]を乗算した結果を変数[1]に設定
 *
 * このプラグインにはプラグインコマンドはありません。
 */
/*:ja
 * @plugindesc 変数操作アイテムプラグイン
 * @author トリアコンタン
 *
 * @help アイテムもしくはスキルを使用し、かつ
 * 行動が成功した場合に、変数を操作できます。
 *
 * アイテムもしくはスキルのメモ欄に以下の通り指定してください。
 *
 * <VCI変数番号:3>  # 変数番号[3]に値を設定します。
 * <VCIVarNumber:3> # 同上
 * <VCI代入値:5>    # 指定した変数に値[5]を代入します。
 * <VCISetValue:5>  # 同上
 * <VCI加算値:5>    # 指定した変数に値[5]を加算します。
 * <VCIAddValue:5>  # 同上
 * ※加算値に負の値を指定すると減算になります。
 *
 * 設定値は、制御文字を適用した上でJavaScript計算式として評価されます。
 * たとえば、アイテムの使用で変数[1]に[5]を乗算したい場合は以下の通り設定します。
 * <VCI変数番号:1>
 * <VCI代入値:\v[1] * 5> # 変数[1]の値に[5]を乗算した結果を変数[1]に設定
 *
 * このプラグインにはプラグインコマンドはありません。
 *
 * 利用規約：
 *  作者に無断で改変、再配布が可能で、利用形態（商用、18禁利用等）
 *  についても制限はありません。
 *  このプラグインはもうあなたのものです。
 */

(function() {
    'use strict';
    var metaTagPrefix = 'VCI';

    var getArgNumber = function(arg, min, max) {
        if (arguments.length < 2) min = -Infinity;
        if (arguments.length < 3) max = Infinity;
        return (parseInt(convertEscapeCharacters(arg), 10) || 0).clamp(min, max);
    };

    var getArgEval = function(arg, min, max) {
        if (arguments.length < 2) min = -Infinity;
        if (arguments.length < 3) max = Infinity;
        return (eval(convertEscapeCharacters(arg)) || 0).clamp(min, max);
    };

    var getMetaValue = function(object, name) {
        var metaTagName = metaTagPrefix + (name ? name : '');
        return object.meta.hasOwnProperty(metaTagName) ? object.meta[metaTagName] : undefined;
    };

    var getMetaValues = function(object, names) {
        if (!Array.isArray(names)) return getMetaValue(object, names);
        for (var i = 0, n = names.length; i < n; i++) {
            var value = getMetaValue(object, names[i]);
            if (value !== undefined) return value;
        }
        return undefined;
    };

    var convertEscapeCharacters = function(text) {
        if (text == null) text = '';
        var windowLayer = SceneManager._scene._windowLayer;
        return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text;
    };

    //=============================================================================
    // Game_Action
    //  行動が成功した場合、変数の操作を実行します。
    //=============================================================================
    var _Game_Action_applyItemUserEffect      = Game_Action.prototype.applyItemUserEffect;
    Game_Action.prototype.applyItemUserEffect = function(target) {
        _Game_Action_applyItemUserEffect.apply(this, arguments);
        if (!this.isForNone()) {
            this.applyVariableControl();
        }
    };

    var _Game_Action_applyGlobal      = Game_Action.prototype.applyGlobal;
    Game_Action.prototype.applyGlobal = function(target) {
        _Game_Action_applyGlobal.apply(this, arguments);
        if (this.isForNone()) {
            this.applyVariableControl();
        }
    };

    Game_Action.prototype.isForNone = function() {
        return this.checkItemScope([0]);
    };

    Game_Action.prototype.applyVariableControl = function() {
        var varNumberStr = getMetaValues(this.item(), ['VarNumber', '変数番号']);
        if (varNumberStr) {
            var varNumber = getArgNumber(varNumberStr, 0);
            var setValue   = getMetaValues(this.item(), ['SetValue', '代入値']);
            if (setValue) {
                $gameVariables.setValue(varNumber, getArgEval(setValue));
                return;
            }
            var addValue   = getMetaValues(this.item(), ['AddValue', '加算値']);
            if (addValue) {
                var originalValue = $gameVariables.value(varNumber);
                $gameVariables.setValue(varNumber, originalValue + getArgEval(addValue));
            }
        }
    };
})();

repo_name: onms/sister

license: unknown


code:
//=============================================================================
// Vitsuno_Difficulty.js
//-----------------------------------------------------------------------------
// Copyright (c) 2016 Tsuno Ozumi
// Released under the MIT license
// http://opensource.org/licenses/mit-license.php
//=============================================================================

var Vitsuno = Vitsuno || {};
Vitsuno.Difficulty = {};
Vitsuno.Difficulty.version = 1.00;

/*:
 * @plugindesc 難易度により能力値や報酬倍率を変更できるようになります。
 * @author 尾角 つの (Tsuno Ozumi)
 *
 * @param Init Difficulty ID
 * @desc 難易度IDの初期値です。
 * @default 2
 *
 * @param Use Option
 * @desc オプションで難易度変更するかどうか。0:しない 1:する
 * @default 1
 *
 * @param Option Name
 * @desc オプションでの表示名です。
 * @default 難易度
 *
 * @param --(Difficulty ID:1)--
 *
 * @param 1 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 * @default イージー
 *
 * @param 1 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7
 *
 * @param 1 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.0,1.0,1.0,1.0,1.0
 *
 * @param --(ID:2)-------------
 *
 * @param 2 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 * @default ノーマル
 *
 * @param 2 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
 *
 * @param 2 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.0,1.0,1.0,1.0,1.0
 *
 * @param --(ID:3)-------------
 *
 * @param 3 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 * @default ハード
 *
 * @param 3 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3
 *
 * @param 3 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.2,1.2,1.2,1.2,1.2
 *
 * @param --(ID:4)-------------
 *
 * @param 4 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 * @default ベリーハード
 *
 * @param 4 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6
 *
 * @param 4 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.4,1.4,1.4,1.4,1.4
 *
 * @param --(ID:5)-------------
 *
 * @param 5 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 * @default マニア
 *
 * @param 5 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.9,1.9,1.9,1.9,1.9,1.9,1.9,1.9
 *
 * @param 5 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.6,1.6,1.6,1.6,1.6
 *
 * @param --(ID:6)-------------
 *
 * @param 6 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 *
 * @param 6 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
 *
 * @param 6 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.0,1.0,1.0,1.0,1.0
 *
 * @param --(ID:7)-------------
 *
 * @param 7 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 *
 * @param 7 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
 *
 * @param 7 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.0,1.0,1.0,1.0,1.0
 *
 * @param --(ID:8)-------------
 *
 * @param 8 : Name
 * @desc 難易度名です。（使用しない場合は無記入にしてください。）
 *
 * @param 8 : Param Rate
 * @desc 難易度によるステータス倍率です。
 * 最大HP,最大MP,攻撃力,防御力,魔法力,魔法防御,敏捷性,運
 * @default 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
 *
 * @param 8 : Drop Rate
 * @desc 難易度による報酬倍率です。
 * 経験値,お金,アイテム1,アイテム2,アイテム3
 * @default 1.0,1.0,1.0,1.0,1.0
 *
 * @help
 *
 * プラグインコマンド:
 *    Difficulty SetID 難易度ID     # 難易度IDを変更する
 *    Difficulty Next              # 難易度IDを上げる
 *    Difficulty Previous          # 難易度IDを下げる
 */

// ● プラグインの設定値を取得
(function($) {
    $.parameters = PluginManager.parameters('Vitsuno_Difficulty');
    $.initDifficultyId = Number($.parameters['Init Difficulty ID']) || 2;
    $.useOption = Number($.parameters['Use Option']) === 1;
    $.optionName = $.parameters['Option Name'];
    $.data = [];
    $.data[0] = null;

    // ● セットアップ用の一時関数
    var setup = function(id) {
        // 設定値の取得
        var idText = '%1 : '.format(id);
        var nameData = $.parameters[idText + 'Name'] || '';
        var paramData = $.parameters[idText + 'Param Rate'];
        var dropData = $.parameters[idText + 'Drop Rate'];
        if (nameData === '' || paramData === undefined || dropData === undefined) {
            return false;
        }
        // データの準備
        var paramRate = paramData ? paramData.split(',').map(Number) : [];
        var dropRate = dropData ? dropData.split(',').map(Number) : [];
        var getRate = function(rate) {
            return typeof rate === 'number' ? rate : 1.0;
        };
        // 難易度オブジェクトの作成
        var difficulty = {};
        difficulty.name = nameData;
        difficulty.paramRate = [];
        for (var i = 0; i < 8; i++) {
            difficulty.paramRate[i] = getRate(paramRate[i]);
        }
        difficulty.expRate = getRate(dropRate[0]);
        difficulty.goldRate = getRate(dropRate[1]);
        difficulty.dropItemRate = [];
        for (var i = 0;; i++) {
            if (typeof dropRate[i + 2] === 'number' || i < 3) {
                difficulty.dropItemRate[i] = getRate(dropRate[i + 2]);
            } else {
                break;
            }
        }
        $.data[id] = difficulty;
        return true;
    };

    for (var i = 1;; i++) {
        if (!setup(i)) {
            break;
        }
    }

})(Vitsuno.Difficulty);

//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------

// ● ニューゲームのセットアップ
Vitsuno.Difficulty.DataMgr_setupNewGame = DataManager.setupNewGame;
DataManager.setupNewGame = function() {
    Vitsuno.Difficulty.DataMgr_setupNewGame.call(this);
    SceneManager.setDifficultyMutable();
};

// ● 戦闘テストのセットアップ
Vitsuno.Difficulty.DataMgr_setupBattleTest = DataManager.setupBattleTest;
DataManager.setupBattleTest = function() {
    Vitsuno.Difficulty.DataMgr_setupBattleTest.call(this);
    SceneManager.setDifficultyMutable();
};

// ● イベントテストのセットアップ
Vitsuno.Difficulty.DataMgr_setupEventTest = DataManager.setupEventTest
DataManager.setupEventTest = function() {
    Vitsuno.Difficulty.DataMgr_setupEventTest.call(this);
    SceneManager.setDifficultyMutable();
};

// ● ゲームのロード
Vitsuno.Difficulty.DataMgr_loadGame = DataManager.loadGame;
DataManager.loadGame = function(savefileId) {
    var result = Vitsuno.Difficulty.DataMgr_loadGame.call(this, savefileId);
    if (result) {
        SceneManager.setDifficultyMutable();
    }
    return result;
};

//-----------------------------------------------------------------------------
// TextManager
//-----------------------------------------------------------------------------

// ● 難易度表示名を取得
Object.defineProperty(TextManager, 'difficulty', {
    get: function() { return Vitsuno.Difficulty.optionName; },
    configurable: true
});

//-----------------------------------------------------------------------------
// SceneManager
//-----------------------------------------------------------------------------

// ● クラス変数
SceneManager._isDifficultyMutable = false;

// ● 難易度変更可能判定
SceneManager.isDifficultyMutable = function() {
    return SceneManager._isDifficultyMutable;
};

// ● 難易度変更可能に設定
SceneManager.setDifficultyMutable = function() {
    SceneManager._isDifficultyMutable = true;
};

// ● 難易度変更可能設定を削除
SceneManager.removeDifficultyMutable = function() {
    SceneManager._isDifficultyMutable = false;
};

//-----------------------------------------------------------------------------
// Game_System
//-----------------------------------------------------------------------------

// ● 初期化
Vitsuno.Difficulty.GSystem_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
    Vitsuno.Difficulty.GSystem_initialize.call(this);
    this._difficultyId = Vitsuno.Difficulty.initDifficultyId;
};

// ● 難易度IDの取得
Game_System.prototype.difficultyId = function() {
    if (this._difficultyId === undefined) {
        this._difficultyId = Vitsuno.Difficulty.initDifficultyId;
    }
    return this._difficultyId;
};

// ● 難易度IDの設定
Game_System.prototype.setDifficultyId = function(difficultyId) {
    if (Vitsuno.Difficulty.data[difficultyId]) {
        this._difficultyId = difficultyId;
    }
};

// ● 難易度の設定
Game_System.prototype.setDifficulty = function(difficulty) {
    var id = Vitsuno.Difficulty.data.indexOf(difficulty);
    if (id >= 0) {
        this.setDifficultyId(id);
    }
};

// ● 難易度オブジェクトの取得
Game_System.prototype.difficultyObject = function() {
    return Vitsuno.Difficulty.data[this.difficultyId()];
};

// ● 難易度名の取得
Game_System.prototype.difficultyName = function() {
    var difficulty = this.difficultyObject();
    return difficulty ? difficulty.name : '';
};

// ● 難易度オブジェクト配列の取得
Game_System.prototype.difficulties = function() {
    return Vitsuno.Difficulty.data.filter(function(difficulty) {
        return difficulty;
    });
};

// ● 次の難易度に変更
Game_System.prototype.nextDifficulty = function(wrap) {
    var lastDifficulty = this.difficultyObject();
    var difficulties = this.difficulties();
    var index = difficulties.indexOf(lastDifficulty);
    index = index < 0 ? 0 : index + 1;
    index = wrap ? index % difficulties.length : index;
    if (index >= 0 && index < difficulties.length) {
        this.setDifficulty(difficulties[index]);
    }
    return lastDifficulty !== this.difficultyObject();
};

// ● 前の難易度に変更する
Game_System.prototype.previousDifficulty = function(wrap) {
    var lastDifficulty = this.difficultyObject();
    var difficulties = this.difficulties();
    var index = difficulties.indexOf(lastDifficulty);
    index = index < 0 ? 0 : index - 1;
    index = wrap ? index % difficulties.length : index;
    if (index >= 0 && index < difficulties.length) {
        this.setDifficulty(difficulties[index]);
    }
    return lastDifficulty !== this.difficultyObject();
};

//-----------------------------------------------------------------------------
// Game_Enemy
//-----------------------------------------------------------------------------

// ● 能力値倍率の取得
Vitsuno.Difficulty.GEnemy_paramRate = Game_Enemy.prototype.paramRate;
Game_Enemy.prototype.paramRate = function(paramId) {
    var rate = Vitsuno.Difficulty.GEnemy_paramRate ?
        Vitsuno.Difficulty.GEnemy_paramRate.call(this, paramId) :
        Game_Battler.prototype.paramRate.call(this, paramId);
    var difficulty = $gameSystem.difficultyObject();
    if (difficulty) {
        rate *= difficulty.paramRate[paramId];
    }
    return rate;
};

// ● 経験値の取得
Vitsuno.Difficulty.GEnemy_exp = Game_Enemy.prototype.exp;
Game_Enemy.prototype.exp = function() {
    var exp = Vitsuno.Difficulty.GEnemy_exp.call(this);
    var difficulty = $gameSystem.difficultyObject();
    if (difficulty) {
        exp *= difficulty.expRate;
    }
    return Math.floor(exp);
};

// ● お金の取得
Vitsuno.Difficulty.GEnemy_gold = Game_Enemy.prototype.gold;
Game_Enemy.prototype.gold = function() {
    var gold = Vitsuno.Difficulty.GEnemy_gold.call(this);
    var difficulty = $gameSystem.difficultyObject();
    if (difficulty) {
        gold *= difficulty.goldRate;
    }
    return Math.floor(gold);
};

// ● ドロップアイテムの作成 (再定義)
Game_Enemy.prototype.makeDropItems = function() {
    return this.enemy().dropItems.reduce(function(r, di, i) {
        if (di.kind > 0 && Math.random() * di.denominator < this.dropItemRateFromIndex(i)) {
            return r.concat(this.itemObject(di.kind, di.dataId));
        } else {
            return r;
        }
    }.bind(this), []);
};

// ● インデック付きドロップアイテムレートの取得
Game_Enemy.prototype.dropItemRateFromIndex = function(index) {
    var rate = this.dropItemRate();
    var difficulty = $gameSystem.difficultyObject();
    if (difficulty) {
        rate *= difficulty.dropItemRate[index];
    }
    return rate;
};

//-----------------------------------------------------------------------------
// Game_Interpreter
//-----------------------------------------------------------------------------

// ● プラグインコマンドの実行
Vitsuno.Difficulty.GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    Vitsuno.Difficulty.GInterpreter_pluginCommand.call(this, command, args);
    if (command === 'Difficulty') {
        switch (args[0]) {
            case 'SetID':
                $gameSystem.setDifficultyId(Number(args[1]));
                break;
            case 'Next':
                $gameSystem.nextDifficulty(false);
                break;
            case 'Previous':
                $gameSystem.previousDifficulty(false);
                break;
        }
    }
};

//-----------------------------------------------------------------------------
// Window_Options
//-----------------------------------------------------------------------------

// ● コマンドリストの作成
Vitsuno.Difficulty.WOptions_makeCommandList = Window_Options.prototype.makeCommandList;
Window_Options.prototype.makeCommandList = function() {
    Vitsuno.Difficulty.WOptions_makeCommandList.call(this);
    this.addDifficultyOptions();
};

// ● 難易度を表示するか判定
Window_Options.prototype.isDifficultyDisplayed = function() {
    return Vitsuno.Difficulty.useOption;
};

// ● 難易度が有効かどうか
Window_Options.prototype.isDifficultyEnabled = function() {
    return $gameSystem && SceneManager.isDifficultyMutable();
};

// ● 難易度コマンドの追加
Window_Options.prototype.addDifficultyOptions = function() {
    if (this.isDifficultyDisplayed()) {
        var enabled = this.isDifficultyEnabled();
        this.addCommand(TextManager.difficulty, 'difficulty', enabled);
    }
};

// ● 状態文字の取得
Vitsuno.Difficulty.WOptions_statusText = Window_Options.prototype.statusText;
Window_Options.prototype.statusText = function(index) {
    if (this.commandSymbol(index) === 'difficulty') {
        return this.isDifficultyEnabled() ? $gameSystem.difficultyName() : '';
    } else {
        return Vitsuno.Difficulty.WOptions_statusText.call(this, index);
    }
};

// ● 決定時の処理
Vitsuno.Difficulty.WOptions_processOk = Window_Options.prototype.processOk;
Window_Options.prototype.processOk = function() {
    if (this.commandSymbol(this.index()) === 'difficulty') {
        if (this.isDifficultyEnabled()) {
            if ($gameSystem.nextDifficulty(true)) {
                this.redrawItem(this.findSymbol('difficulty'));
                SoundManager.playCursor();
            }
        }
    } else {
        Vitsuno.Difficulty.WOptions_processOk.call(this);
    }
};

// ● カーソルを右に移動
Vitsuno.Difficulty.WOptions_cursorRight = Window_Options.prototype.cursorRight;
Window_Options.prototype.cursorRight = function(wrap) {
    if (this.commandSymbol(this.index()) === 'difficulty') {
        if (this.isDifficultyEnabled()) {
            if ($gameSystem.nextDifficulty(false)) {
                this.redrawItem(this.findSymbol('difficulty'));
                SoundManager.playCursor();
            }
        }
    } else {
        Vitsuno.Difficulty.WOptions_cursorRight.call(this, wrap);
    }
};

// ● カーソルを左に移動
Vitsuno.Difficulty.WOptions_cursorLeft = Window_Options.prototype.cursorLeft;
Window_Options.prototype.cursorLeft = function(wrap) {
    if (this.commandSymbol(this.index()) === 'difficulty') {
        if (this.isDifficultyEnabled()) {
            if ($gameSystem.previousDifficulty(false)) {
                this.redrawItem(this.findSymbol('difficulty'));
                SoundManager.playCursor();
            }
        }
    } else {
        Vitsuno.Difficulty.WOptions_cursorLeft.call(this, wrap);
    }
};

//-----------------------------------------------------------------------------
// Scene_Title
//-----------------------------------------------------------------------------

// ● シーン開始
Vitsuno.Difficulty.STitle_start = Scene_Title.prototype.start;
Scene_Title.prototype.start = function() {
    Vitsuno.Difficulty.STitle_start.call(this);
    SceneManager.removeDifficultyMutable();
};


code:
//=============================================================================
// WeaponSkill.js
//=============================================================================

/*:
 * @plugindesc Change skill id of attack for each weapon.
 * @author Sasuke KANNAZUKI
 *
 * @help This plugin does not provide plugin commands.
 *
 * When <skill_id:3> is written in a weapon's note field,
 * skill id # 3 is used for the weapon's attack.
 * If nothing is written, default id(=1) is used.
 *
 * Check Points:
 * - When multiple weapons are equipped, the skill id of the weapon
 *  held in the dominant hand (previously defined) is used.
 * - It is most favorable for "skill type" to be "none"(=0),
 *  otherwise you cannot attack when your skill is blocked.
 *
 * Usage examples of this plugin:
 * - to create all-range weapons
 * - to create dual-attack or triple-attack weapons
 * - If healing skill is set when actor attacks, you can choose a friend to heal.
 * - It is possible to make a weapon that functions similar to a guard command.
 */

/*:ja
 * @plugindesc 武器ごとに通常攻撃のスキルIDを変更します。
 * @author 神無月サスケ
 *
 * @help このプラグインにはプラグインコマンドはありません。
 *
 *  武器の「メモ」欄に、<skill_id:3> と書いた場合、
 * 通常攻撃の際、3番のスキルが発動します。
 * ※特に記述がなければ、通常通り1番のスキルが採用されます。
 *
 * チェックポイント:
 * - 二刀流の場合、利き腕(先に定義された方)に持っているスキルIDが採用されます。
 * - スキルタイプは「なし」にするのが望ましいです。
 * さもなくば、技などを封じられたとき、攻撃が出来なくなります。
 *
 * 想定される用途:
 * - 全体攻撃可能な武器
 * - 2回攻撃、3回攻撃する武器
 * - 回復魔法をスキルに指定した場合、
 * 「攻撃」を選んだ際、味方の選択が出来、その仲間を回復します
 * - 防御コマンドなどと同等になる武器も実現可能です。
 */

(function() {

  //
  // set skill id for attack.
  //
  Game_Actor.prototype.attackSkillId = function() {
    var normalId = Game_BattlerBase.prototype.attackSkillId.call(this);
    if(this.hasNoWeapons()){
      return normalId;
    }
    var weapon = this.weapons()[0];  // at plural weapon, one's first skill.
    var id = weapon.meta.skill_id;
    return id ? Number(id) : normalId;
  };

  //
  // for command at battle
  //
  var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
  Scene_Battle.prototype.commandAttack = function() {
    BattleManager.inputtingAction().setAttack();
    // normal attack weapon (or other single attack weapon)
    var action = BattleManager.inputtingAction();
    if(action.needsSelection() && action.isForOpponent()){
      _Scene_Battle_commandAttack.call(this);
      return;
    }
    // special skill weapon
    this.onSelectAction();
  };

})();