princess-synergy/www/js/plugins/JsScript214Set.js
2026-02-05 14:03:22 -06:00

2602 lines
81 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Imported = Imported || {};
Imported.YEP_CoreEngine = true;
var Yanfly = Yanfly || {};
Yanfly.Core = Yanfly.Core || {};
Yanfly.Core.version = 1.31;
/*:
* @plugindesc
* contains bug fixes found inherently in RPG Maker.
* @author Yanfly Engine Plugins
*
* @param ---Screen---
* @default
*
* @param Screen Width
* @parent ---Screen---
* @type number
* @min 0
* @desc Adjusts the width of the screen.
* Default: 816
* @default 816
*
* @param Screen Height
* @parent ---Screen---
* @type number
* @min 0
* @desc Adjusts the height of the screen.
* Default: 624
* @default 624
*
* @param Scale Battlebacks
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc Do you wish to scale battlebacks to resolution?
* NO - false YES - true
* @default true
*
* @param Scale Title
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc Do you wish to scale the title screen to resolution?
* NO - false YES - true
* @default true
*
* @param Scale Game Over
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc Do you wish to scale the game over screen to resolution?
* NO - false YES - true
* @default true
*
* @param Open Console
* @parent ---Screen---
* @type boolean
* @on Open
* @off Don't Open
* @desc For testing and debug purposes, this opens up the console.
* Don't Open - false Open - true
* @default false
*
* @param Reposition Battlers
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc Allow the plugin to reposition battlers to resolution?
* NO - false YES - true
* @default true
*
* @param GameFont Load Timer
* @parent ---Screen---
* @type number
* @min 0
* @desc This allows you to set the timer for loading the GameFont.
* Set to 0 for unlimited time. Default: 20000
* @default 0
*
* @param Update Real Scale
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc For now, best left alone, but it will allow real scaling for
* screen stretching. NO - false YES - true
* @default false
*
* @param Collection Clear
* @parent ---Screen---
* @type boolean
* @on YES
* @off NO
* @desc Clears stored objects within major scenes upon switching
* scenes to free up memory. NO - false YES - true
* @default true
*
* @param ---Gold---
* @desc
*
* @param Gold Max
* @parent ---Gold---
* @type number
* @min 1
* @desc The maximum amount of gold the player can have.
* Default: 99999999
* @default 99999999
*
* @param Gold Font Size
* @parent ---Gold---
* @type number
* @min 1
* @desc The font size used to display gold.
* Default: 28
* @default 20
*
* @param Gold Icon
* @parent ---Gold---
* @type number
* @min 0
* @desc This will be the icon used to represent gold in the gold
* window. If left at 0, no icon will be displayed.
* @default 313
*
* @param Gold Overlap
* @parent ---Gold---
* @desc This will be what's displayed when the gold number
* exceeds the allocated area's content size.
* @default A lotta
*
* @param ---Items---
* @desc
*
* @param Default Max
* @parent ---Items---
* @type number
* @min 1
* @desc This is the maximum number of items a player can hold.
* Default: 99
* @default 99
*
* @param Quantity Text Size
* @parent ---Items---
* @type number
* @min 1
* @desc This is the text's font size used for the item quantity.
* Default: 28
* @default 20
*
* @param ---Parameters---
* @default
*
* @param Max Level
* @parent ---Parameters---
* @type number
* @min 1
* @desc Adjusts the maximum level limit for actors.
* Default: 99
* @default 99
*
* @param Actor MaxHP
* @parent ---Parameters---
* @type number
* @min 1
* @desc Adjusts the maximum HP limit for actors.
* Default: 9999
* @default 9999
*
* @param Actor MaxMP
* @parent ---Parameters---
* @type number
* @min 0
* @desc Adjusts the maximum MP limit for actors.
* Default: 9999
* @default 9999
*
* @param Actor Parameter
* @parent ---Parameters---
* @type number
* @min 1
* @desc Adjusts the maximum parameter limit for actors.
* Default: 999
* @default 999
*
* @param Enemy MaxHP
* @parent ---Parameters---
* @type number
* @min 1
* @desc Adjusts the maximum HP limit for enemies.
* Default: 999999
* @default 999999
*
* @param Enemy MaxMP
* @parent ---Parameters---
* @type number
* @min 0
* @desc Adjusts the maximum MP limit for enemies.
* Default: 9999
* @default 9999
*
* @param Enemy Parameter
* @parent ---Parameters---
* @type number
* @min 1
* @desc Adjusts the maximum parameter limit for enemies.
* Default: 999
* @default 999
*
* @param ---Battle---
* @desc
*
* @param Animation Rate
* @parent ---Battle---
* @type number
* @min 1
* @desc Adjusts the rate of battle animations. Lower for faster.
* Default: 4
* @default 4
*
* @param Flash Target
* @parent ---Battle---
* @type boolean
* @on YES
* @off NO
* @desc If an enemy is targeted, it flashes or it can whiten.
* OFF - false ON - true
* @default false
*
* @param Show Events Transition
* @parent ---Battle---
* @type boolean
* @on Show
* @off Hide
* @desc Show events during the battle transition?
* SHOW - true HIDE - false Default: false
* @default true
*
* @param Show Events Snapshot
* @parent ---Battle---
* @type boolean
* @on Show
* @off Hide
* @desc Show events for the battle background snapshot?
* SHOW - true HIDE - false Default: false
* @default true
*
* @param ---Map Optimization---
* @desc
*
* @param Refresh Update HP
* @parent ---Map Optimization---
* @type boolean
* @on Show
* @off Hide
* @desc Do a full actor refresh when updating HP on map?
* YES - true NO - false Default: true
* @default true
*
* @param Refresh Update MP
* @parent ---Map Optimization---
* @type boolean
* @on Show
* @off Hide
* @desc Do a full actor refresh when updating MP on map?
* YES - true NO - false Default: true
* @default true
*
* @param Refresh Update TP
* @parent ---Map Optimization---
* @type boolean
* @on Show
* @off Hide
* @desc Do a full actor refresh when updating TP on map?
* YES - true NO - false Default: true
* @default false
*
* @param ---Font---
* @desc
*
* @param Chinese Font
* @parent ---Font---
* @desc Default font(s) used for a Chinese RPG.
* Default: SimHei, Heiti TC, sans-serif
* @default SimHei, Heiti TC, sans-serif
*
* @param Korean Font
* @parent ---Font---
* @desc Default font(s) used for a Korean RPG.
* Default: Dotum, AppleGothic, sans-serif
* @default Dotum, AppleGothic, sans-serif
*
* @param Default Font
* @parent ---Font---
* @desc Default font(s) used for everything else.
* Default: GameFont
* @default GameFont, Verdana, Arial, Courier New
*
* @param Font Size
* @parent ---Font---
* @type number
* @min 1
* @desc Default font size used for windows.
* Default: 28
* @default 28
*
* @param Text Align
* @parent ---Font---
* @type combo
* @option left
* @option center
* @option right
* @desc How to align the text for command windows.
* left center right
* @default left
*
* @param ---Windows---
* @default
*
* @param Digit Grouping
* @parent ---Windows---
* @type boolean
* @on YES
* @off NO
* @desc Groups together digits with a comma.
* false - OFF true - ON
* @default true
*
* @param Line Height
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts universal line height used in Windows.
* Default: 36
* @default 36
*
* @param Icon Width
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the width of your icons.
* Default: 32
* @default 32
*
* @param Icon Height
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the height of your icons.
* Default: 32
* @default 32
*
* @param Face Width
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the width of actors' faces.
* Default: 144
* @default 144
*
* @param Face Height
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the height of actors' faces.
* Default: 144
* @default 144
*
* @param Window Padding
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the padding for all standard windows.
* Default: 18
* @default 18
*
* @param Text Padding
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the padding for text inside of windows.
* Default: 6
* @default 6
*
* @param Window Opacity
* @parent ---Windows---
* @type number
* @min 0
* @desc Adjusts the background opacity for windows.
* Default: 192
* @default 192
*
* @param Gauge Outline
* @parent ---Windows---
* @type boolean
* @on YES
* @off NO
* @desc Enable outlines for gauges.
* false - OFF true - ON
* @default true
*
* @param Gauge Height
* @parent ---Windows---
* @type number
* @min 0
* @desc Sets the height for gauges.
* Default: 6
* @default 18
*
* @param Menu TP Bar
* @parent ---Windows---
* @type boolean
* @on YES
* @off NO
* @desc Draws a TP bar in the menu status for actors.
* false - OFF true - ON
* @default true
*
* @param ---Window Colors---
* @default
*
* @param Color: Normal
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 0
* @default 0
*
* @param Color: System
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 16
* @default 16
*
* @param Color: Crisis
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 17
* @default 17
*
* @param Color: Death
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 18
* @default 18
*
* @param Color: Gauge Back
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 19
* @default 19
*
* @param Color: HP Gauge 1
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 20
* @default 20
*
* @param Color: HP Gauge 2
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 21
* @default 21
*
* @param Color: MP Gauge 1
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 22
* @default 22
*
* @param Color: MP Gauge 2
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 23
* @default 23
*
* @param Color: MP Cost
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 23
* @default 23
*
* @param Color: Power Up
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 24
* @default 24
*
* @param Color: Power Down
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 25
* @default 25
*
* @param Color: TP Gauge 1
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 28
* @default 28
*
* @param Color: TP Gauge 2
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 29
* @default 29
*
* @param Color: TP Cost Color
* @parent ---Window Colors---
* @type number
* @min 0
* @max 31
* @desc Changes the text color for Windows.
* Default: 29
* @default 29
*
* @help
*/
/*:ja
* @plugindesc
* @author Yanfly Engine Plugins
*
* @param ---画面---
* @default
*
* @param Screen Width
* @parent ---画面---
* @type number
* @min 0
* @desc スクリーンの横幅を設定
* Default: 816
* @default 816
*
* @param Screen Height
* @parent ---画面---
* @type number
* @min 0
* @desc スクリーンの縦幅を設定
* Default: 624
* @default 624
*
* @param Scale Battlebacks
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc 戦闘背景のサイズを解像度に合わせるか設定
* NO - false YES - true
* @default true
*
* @param Scale Title
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc タイトルスクリーンのサイズを解像度に合わせるか設定
* NO - false YES - true
* @default true
*
* @param Scale Game Over
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc 解像度に合わせて画面上のゲームを拡大縮小させるか設定
* NO - false YES - true
* @default true
*
* @param Open Console
* @parent ---画面---
* @type boolean
* @on Open
* @off Don't Open
* @desc テスト/デバッグ用に、コンソール画面の設定
* 開かない - false 開く - true
* @default false
*
* @param Reposition Battlers
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc 解像度に合わせてバトラーの位置を変更させるか設定
* NO - false YES - true
* @default true
*
* @param GameFont Load Timer
* @parent ---画面---
* @type number
* @min 0
* @desc ゲームフォントをロードするためのタイマーを設定
* 無制限は0に設定してください。 Default: 20000
* @default 0
*
* @param Update Real Scale
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc 変更を非推奨。画面に合わせた引き伸ばしを可能に設定。 NO - false YES - true
* @default false
*
* @param Collection Clear
* @parent ---画面---
* @type boolean
* @on YES
* @off NO
* @desc シーンを切り替えてメモリを解放する時、主要シーン内に保存されているオブジェクトを消去。 NO - false YES - true
* @default true
*
* @param ---通貨---
* @desc
*
* @param Gold Max
* @parent ---通貨---
* @type number
* @min 1
* @desc プレイヤーが持てる通貨の最大値を設定
* Default: 99999999
* @default 99999999
*
* @param Gold Font Size
* @parent ---通貨---
* @type number
* @min 1
* @desc 通貨を表示する際のフォントサイズを指定
* Default: 28
* @default 20
*
* @param Gold Icon
* @parent ---通貨---
* @type number
* @min 0
* @desc 通貨を意味するアイコンを指定。無表示通常の単位は0
* @default 313
*
* @param Gold Overlap
* @parent ---通貨---
* @desc 通貨が割り当てられた範囲のサイズを超えた際に表示
* @default A lotta
*
* @param ---アイテム---
* @desc
*
* @param Default Max
* @parent ---アイテム---
* @type number
* @min 1
* @desc プレイヤーが所持できるアイテム数の上限を設定
* Default: 99
* @default 99
*
* @param Quantity Text Size
* @parent ---アイテム---
* @type number
* @min 1
* @desc アイテム数を表示する際のフォントサイズを指定
* Default: 28
* @default 20
*
* @param ---能力値---
* @default
*
* @param Max Level
* @parent ---能力値---
* @type number
* @min 1
* @desc アクターのレベルの上限値を設定
* Default: 99
* @default 99
*
* @param Actor MaxHP
* @parent ---能力値---
* @type number
* @min 1
* @desc アクターのHPの上限値を設定
* Default: 9999
* @default 9999
*
* @param Actor MaxMP
* @parent ---能力値---
* @type number
* @min 0
* @desc アクターのMPの上限値を設定
* Default: 9999
* @default 9999
*
* @param Actor Parameter
* @parent ---能力値---
* @type number
* @min 1
* @desc アクターの能力値の上限値を設定
* Default: 999
* @default 999
*
* @param Enemy MaxHP
* @parent ---能力値---
* @type number
* @min 1
* @desc 敵のHPの上限値を設定
* Default: 999999
* @default 999999
*
* @param Enemy MaxMP
* @parent ---能力値---
* @type number
* @min 0
* @desc 敵のMPの上限値を設定
* Default: 9999
* @default 9999
*
* @param Enemy Parameter
* @parent ---能力値---
* @type number
* @min 1
* @desc 敵の能力値の上限値を設定
* Default: 999
* @default 999
*
* @param ---戦闘---
* @desc
*
* @param Animation Rate
* @parent ---戦闘---
* @type number
* @min 1
* @desc 戦闘アニメーションのレートを設定
* Default: 4
* @default 4
*
* @param Flash Target
* @parent ---戦闘---
* @type boolean
* @on YES
* @off NO
* @desc 敵を対象に選んだ際、光らせるか白く表示
* NO - false YES - true
* @default false
*
* @param Show Events Transition
* @parent ---戦闘---
* @type boolean
* @on 表示
* @off 非表示
* @desc 戦闘移行中のイベントを表示するか設定
* 表示 - true 非表示 - false Default: false
* @default true
*
* @param Show Events Snapshot
* @parent ---戦闘---
* @type boolean
* @on 表示
* @off 非表示
* @desc バトルバックグラウンドスナップショットのイベントを表示するか設定
* 表示 - true 非表示 - false Default: false
* @default true
*
* @param ---マップ最適化---
* @desc
*
* @param Refresh Update HP
* @parent ---マップ最適化---
* @type boolean
* @on 表示
* @off 非表示
* @desc マップ上でHPを更新する時にすべてのアクターを更新するか設定
* 表示 - true 非表示 - false Default: true
* @default true
*
* @param Refresh Update MP
* @parent ---マップ最適化---
* @type boolean
* @on 表示
* @off 非表示
* @desc マップ上でMPを更新する時にすべてのアクターを更新するか設定
* 表示 - true 非表示 - false Default: true
* @default true
*
* @param Refresh Update TP
* @parent ---マップ最適化---
* @type boolean
* @on 表示
* @off 非表示
* @desc マップ上でTPを更新する時にすべてのアクターを更新するか設定
* 表示 - true 非表示 - false Default: true
* @default false
*
* @param ---フォント---
* @desc
*
* @param Chinese Font
* @parent ---フォント---
* @desc 中国語のRPGに使われるデフォルトフォントを設定
* Default: SimHei, Heiti TC, sans-serif
* @default SimHei, Heiti TC, sans-serif
*
* @param Korean Font
* @parent ---フォント---
* @desc 韓国語のRPGに使われるデフォルトフォントを設定
* Default: Dotum, AppleGothic, sans-serif
* @default Dotum, AppleGothic, sans-serif
*
* @param Default Font
* @parent ---フォント---
* @desc それ以外のRPGに使われるデフォルトフォントを設定
* Default: GameFont
* @default GameFont, Verdana, Arial, Courier New
*
* @param Font Size
* @parent ---フォント---
* @type number
* @min 1
* @desc ウィンドウに使われるデフォルトフォントのサイズを設定
* Default: 28
* @default 28
*
* @param Text Align
* @parent ---フォント---
* @type combo
* @option left
* @option center
* @option right
* @desc コマンドウィンドウ内でのテキスト配置方法を設定
* left(左) center(中央) right(右)
* @default left
*
* @param ---ウィンドウ---
* @default
*
* @param Digit Grouping
* @parent ---ウィンドウ---
* @type boolean
* @on ON
* @off OFF
* @desc 数字の桁区切り
* false - OFF true - ON
* @default true
*
* @param Line Height
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc ウィンドウ内での行高設定
* Default: 36
* @default 36
*
* @param Icon Width
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc アイコン幅の設定
* Default: 32
* @default 32
*
* @param Icon Height
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc アイコン高の設定
* Default: 32
* @default 32
*
* @param Face Width
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc アクターの顔グラフィックの幅を設定
* Default: 144
* @default 144
*
* @param Face Height
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc アクターの顔グラフィックの高さを設定
* Default: 144
* @default 144
*
* @param Window Padding
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc 全てのスタンダードウィンドウのパディングを設定
* Default: 18
* @default 18
*
* @param Text Padding
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc ウィンドウ内のテキストの適用パディング量
* Default: 6
* @default 6
*
* @param Window Opacity
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc 背景の不透明度を設定
* Default: 192
* @default 192
*
* @param Gauge Outline
* @parent ---ウィンドウ---
* @type boolean
* @on 表示
* @off 非表示
* @desc ゲージのアウトラインを表示
* 表示 - true 非表示 - false Default: true
* @default true
*
* @param Gauge Height
* @parent ---ウィンドウ---
* @type number
* @min 0
* @desc ゲージの高さを設定
* Default: 6
* @default 18
*
* @param Menu TP Bar
* @parent ---ウィンドウ---
* @type boolean
* @on 表示
* @off 非表示
* @desc アクターのメニュー能力値にTPバーを表示
* 表示 - true 非表示 - false
* @default true
*
* @param ---ウィンドウ色---
* @default
*
* @param Color: Normal
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 0
* @default 0
*
* @param Color: System
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 16
* @default 16
*
* @param Color: Crisis
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 17
* @default 17
*
* @param Color: Death
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 18
* @default 18
*
* @param Color: Gauge Back
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 19
* @default 19
*
* @param Color: HP Gauge 1
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 20
* @default 20
*
* @param Color: HP Gauge 2
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 21
* @default 21
*
* @param Color: MP Gauge 1
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 22
* @default 22
*
* @param Color: MP Gauge 2
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 23
* @default 23
*
* @param Color: MP Cost
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 23
* @default 23
*
* @param Color: Power Up
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 24
* @default 24
*
* @param Color: Power Down
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 25
* @default 25
*
* @param Color: TP Gauge 1
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 28
* @default 28
*
* @param Color: TP Gauge 2
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 29
* @default 29
*
* @param Color: TP Cost Color
* @parent ---ウィンドウ色---
* @type number
* @min 0
* @max 31
* @desc テキスト色で指定
* Default: 29
* @default 29
*
* @help
*/
Yanfly.Parameters = PluginManager.parameters('JsScript214Set');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Icon = Yanfly.Icon || {};
Yanfly.Param.ScreenWidth = Number(Yanfly.Parameters['Screen Width'] || 816);
Yanfly.Param.ScreenHeight = Number(Yanfly.Parameters['Screen Height'] || 624);
Yanfly.Param.ScaleBattleback = String(Yanfly.Parameters['Scale Battlebacks']);
Yanfly.Param.ScaleBattleback = eval(Yanfly.Param.ScaleBattleback);
Yanfly.Param.ScaleTitle = eval(String(Yanfly.Parameters['Scale Title']));
Yanfly.Param.ScaleGameOver = eval(String(Yanfly.Parameters['Scale Game Over']));
Yanfly.Param.OpenConsole = String(Yanfly.Parameters['Open Console']);
Yanfly.Param.OpenConsole = eval(Yanfly.Param.OpenConsole);
Yanfly.Param.ReposBattlers = String(Yanfly.Parameters['Reposition Battlers']);
Yanfly.Param.ReposBattlers = eval(Yanfly.Param.ReposBattlers);
Yanfly.Param.GameFontTimer = Number(Yanfly.Parameters['GameFont Load Timer']);
Yanfly.Param.UpdateRealScale = String(Yanfly.Parameters['Update Real Scale']);
Yanfly.Param.UpdateRealScale = eval(Yanfly.Param.UpdateRealScale);
Yanfly.Param.CollectionClear = String(Yanfly.Parameters['Collection Clear']);
Yanfly.Param.CollectionClear = eval(Yanfly.Param.CollectionClear);
Yanfly.Param.MaxGold = String(Yanfly.Parameters['Gold Max']);
Yanfly.Param.GoldFontSize = Number(Yanfly.Parameters['Gold Font Size']);
Yanfly.Icon.Gold = Number(Yanfly.Parameters['Gold Icon']);
Yanfly.Param.GoldOverlap = String(Yanfly.Parameters['Gold Overlap']);
Yanfly.Param.MaxItem = Number(Yanfly.Parameters['Default Max']);
Yanfly.Param.ItemQuantitySize = Number(Yanfly.Parameters['Quantity Text Size']);
Yanfly.Param.MaxLevel = Number(Yanfly.Parameters['Max Level']);
Yanfly.Param.EnemyMaxHp = Number(Yanfly.Parameters['Enemy MaxHP']);
Yanfly.Param.EnemyMaxMp = Number(Yanfly.Parameters['Enemy MaxMP']);
Yanfly.Param.EnemyParam = Number(Yanfly.Parameters['Enemy Parameter']);
Yanfly.Param.ActorMaxHp = Number(Yanfly.Parameters['Actor MaxHP']);
Yanfly.Param.ActorMaxMp = Number(Yanfly.Parameters['Actor MaxMP']);
Yanfly.Param.ActorParam = Number(Yanfly.Parameters['Actor Parameter']);
Yanfly.Param.AnimationRate = Number(Yanfly.Parameters['Animation Rate']);
Yanfly.Param.FlashTarget = eval(String(Yanfly.Parameters['Flash Target']));
Yanfly.Param.ShowEvTrans = String(Yanfly.Parameters['Show Events Transition']);
Yanfly.Param.ShowEvTrans = eval(Yanfly.Param.ShowEvTrans);
Yanfly.Param.ShowEvSnap = String(Yanfly.Parameters['Show Events Snapshot']);
Yanfly.Param.ShowEvSnap = eval(Yanfly.Param.ShowEvSnap);
Yanfly.Param.RefreshUpdateHp = String(Yanfly.Parameters['Refresh Update HP']);
Yanfly.Param.RefreshUpdateHp = eval(Yanfly.Param.RefreshUpdateHp);
Yanfly.Param.RefreshUpdateMp = String(Yanfly.Parameters['Refresh Update MP']);
Yanfly.Param.RefreshUpdateMp = eval(Yanfly.Param.RefreshUpdateMp);
Yanfly.Param.RefreshUpdateTp = String(Yanfly.Parameters['Refresh Update TP']);
Yanfly.Param.RefreshUpdateTp = eval(Yanfly.Param.RefreshUpdateTp);
Yanfly.Param.ChineseFont = String(Yanfly.Parameters['Chinese Font']);
Yanfly.Param.KoreanFont = String(Yanfly.Parameters['Korean Font']);
Yanfly.Param.DefaultFont = String(Yanfly.Parameters['Default Font']);
Yanfly.Param.FontSize = Number(Yanfly.Parameters['Font Size']);
Yanfly.Param.TextAlign = String(Yanfly.Parameters['Text Align']);
Yanfly.Param.DigitGroup = eval(String(Yanfly.Parameters['Digit Grouping']));
Yanfly.Param.LineHeight = Number(Yanfly.Parameters['Line Height']);
Yanfly.Param.IconWidth = Number(Yanfly.Parameters['Icon Width'] || 32);;
Yanfly.Param.IconHeight = Number(Yanfly.Parameters['Icon Height'] || 32);;
Yanfly.Param.FaceWidth = Number(Yanfly.Parameters['Face Width'] || 144);
Yanfly.Param.FaceHeight = Number(Yanfly.Parameters['Face Height'] || 144);
Yanfly.Param.WindowPadding = Number(Yanfly.Parameters['Window Padding']);
Yanfly.Param.TextPadding = Number(Yanfly.Parameters['Text Padding']);
Yanfly.Param.WindowOpacity = Number(Yanfly.Parameters['Window Opacity']);
Yanfly.Param.GaugeOutline = eval(String(Yanfly.Parameters['Gauge Outline']));
Yanfly.Param.GaugeHeight = Number(Yanfly.Parameters['Gauge Height']);
Yanfly.Param.MenuTpGauge = eval(String(Yanfly.Parameters['Menu TP Bar']));
Yanfly.Param.ColorNormal = Number(Yanfly.Parameters['Color: Normal']);
Yanfly.Param.ColorSystem = Number(Yanfly.Parameters['Color: System']);
Yanfly.Param.ColorCrisis = Number(Yanfly.Parameters['Color: Crisis']);
Yanfly.Param.ColorDeath = Number(Yanfly.Parameters['Color: Death']);
Yanfly.Param.ColorGaugeBack = Number(Yanfly.Parameters['Color: Gauge Back']);
Yanfly.Param.ColorHpGauge1 = Number(Yanfly.Parameters['Color: HP Gauge 1']);
Yanfly.Param.ColorHpGauge2 = Number(Yanfly.Parameters['Color: HP Gauge 2']);
Yanfly.Param.ColorMpGauge1 = Number(Yanfly.Parameters['Color: MP Gauge 1']);
Yanfly.Param.ColorMpGauge2 = Number(Yanfly.Parameters['Color: MP Gauge 2']);
Yanfly.Param.ColorMpCost = Number(Yanfly.Parameters['Color: MP Cost']);
Yanfly.Param.ColorPowerUp = Number(Yanfly.Parameters['Color: Power Up']);
Yanfly.Param.ColorPowerDown = Number(Yanfly.Parameters['Color: Power Down']);
Yanfly.Param.ColorTpGauge1 = Number(Yanfly.Parameters['Color: TP Gauge 1']);
Yanfly.Param.ColorTpGauge2 = Number(Yanfly.Parameters['Color: TP Gauge 2']);
Yanfly.Param.ColorTpCost = Number(Yanfly.Parameters['Color: TP Cost Color']);
Yanfly.Core.Bitmap_initialize = Bitmap.prototype.initialize;
Bitmap.prototype.initialize = function(width, height) {
Yanfly.Core.Bitmap_initialize.call(this, width, height);
this.fontFace = Yanfly.Param.DefaultFont;
};
Yanfly.Core.Bitmap_blt = Bitmap.prototype.blt;
Bitmap.prototype.blt = function(source, sx, sy, sw, sh, dx, dy, dw, dh) {
sx = Math.floor(sx);
sy = Math.floor(sy);
sw = Math.floor(sw);
sh = Math.floor(sh);
dx = Math.floor(dx);
dy = Math.floor(dy);
dw = Math.floor(dw);
dh = Math.floor(dh);
Yanfly.Core.Bitmap_blt.call(this, source, sx, sy, sw, sh, dx, dy, dw, dh);
};
Yanfly.Core.Bitmap_fillRect = Bitmap.prototype.fillRect;
Bitmap.prototype.fillRect = function(x, y, w, h, c) {
x = Math.floor(x);
y = Math.floor(y);
w = Math.floor(w);
h = Math.floor(h);
Yanfly.Core.Bitmap_fillRect.call(this, x, y, w, h, c);
};
Yanfly.Core.Bitmap_gradientFillRect = Bitmap.prototype.gradientFillRect;
Bitmap.prototype.gradientFillRect = function(x, y, w, h, c1, c2, ve) {
Yanfly.Core.Bitmap_gradientFillRect.call(this, x, y, w, h, c1, c2, ve);
};
Yanfly.Core.Bitmap_drawCircle = Bitmap.prototype.drawCircle;
Bitmap.prototype.drawCircle = function(x, y, r, c) {
x = Math.floor(x);
y = Math.floor(y);
Yanfly.Core.Bitmap_drawCircle.call(this, x, y, r, c);
};
Yanfly.Core.Bitmap_drawText = Bitmap.prototype.drawText;
Bitmap.prototype.drawText = function(text, x, y, mW, l, align) {
x = Math.floor(x);
y = Math.floor(y);
if (mW < 0) mW = 0;
mW = Math.floor(mW);
l = Math.floor(l);
Yanfly.Core.Bitmap_drawText.call(this, text, x, y, mW, l, align);
};
if (Yanfly.Param.UpdateRealScale) {
Graphics._updateRealScale = function() {
if (this._stretchEnabled) {
var h = window.innerWidth / this._width;
var v = window.innerHeight / this._height;
this._realScale = Math.min(h, v);
if (this._realScale >= 3) this._realScale = 3;
else if (this._realScale >= 2) this._realScale = 2;
else if (this._realScale >= 1.5) this._realScale = 1.5;
else if (this._realScale >= 1) this._realScale = 1;
else this._realScale = 0.5;
} else {
this._realScale = this._scale;
}
};
};
Graphics.printFullError = function(name, message, stack) {
stack = this.processErrorStackMessage(stack);
if (this._errorPrinter) {
this._errorPrinter.innerHTML =
this._makeFullErrorHtml(name, message, stack);
}
this._applyCanvasFilter();
this._clearUpperCanvas();
};
Graphics._makeFullErrorHtml = function(name, message, stack) {
var text = '';
for (var i = 2; i < stack.length; ++i) {
text += '<font color=white>' + stack[i] + '</font><br>';
}
return ('<font color="yellow"><b>' + stack[0] + '</b></font><br>' +
'<font color="yellow"><b>' + stack[1] + '</b></font><br>' + text);
};
Graphics.processErrorStackMessage = function(stack) {
var data = stack.split(/(?:\r\n|\r|\n)/);
data.unshift('Game has encountered a bug. Please report it.<br>');
for (var i = 1; i < data.length; ++i) {
data[i] = data[i].replace(/[\(](.*[\/])/, '(');
}
data.push('<br><font color="yellow"><b>Press F5 to restart the game.' +
'</b></font><br>');
return data;
};
Yanfly.Core.Graphics_updateErrorPrinter = Graphics._updateErrorPrinter;
Graphics._updateErrorPrinter = function() {
Yanfly.Core.Graphics_updateErrorPrinter.call(this);
this._errorPrinter.height = this._height * 0.5;
this._errorPrinter.style.textAlign = 'left';
this._centerElement(this._errorPrinter);
};
SceneManager.catchException = function(e) {
if (e instanceof Error) {
Graphics.printFullError(e.name, e.message, e.stack);
console.error(e.stack);
} else {
Graphics.printError('UnknownError', e);
}
AudioManager.stopAll();
this.stop();
};
Yanfly.Core.Input_shouldPreventDefault = Input._shouldPreventDefault;
Input._shouldPreventDefault = function(keyCode) {
if (keyCode === 9) return true;
return Yanfly.Core.Input_shouldPreventDefault.call(this, keyCode);
};
Yanfly.Core.Sprite_updateTransform = Sprite.prototype.updateTransform;
Sprite.prototype.updateTransform = function() {
Yanfly.Core.Sprite_updateTransform.call(this);
this.worldTransform.tx = Math.floor(this.worldTransform.tx);
this.worldTransform.ty = Math.floor(this.worldTransform.ty);
};
Yanfly.Core.ScreenSprite_initialize = ScreenSprite.prototype.initialize;
ScreenSprite.prototype.initialize = function() {
Yanfly.Core.ScreenSprite_initialize.call(this);
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.0') return;
this.scale.x = Graphics.boxWidth * 10;
this.scale.y = Graphics.boxHeight * 10;
this.anchor.x = 0.5;
this.anchor.y = 0.5;
this.x = 0;
this.y = 0;
};
Yanfly.Core.Window_refreshAllParts = Window.prototype._refreshAllParts;
Window.prototype._refreshAllParts = function() {
this._roundWhUp();
Yanfly.Core.Window_refreshAllParts.call(this);
};
Window.prototype._roundWhUp = function() {
this._width = Math.ceil(this._width);
this._height = Math.ceil(this._height);
};
Yanfly.Core.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.Core.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_CoreEngine) {
this.processCORENotetags1($dataItems);
this.processCORENotetags1($dataWeapons);
this.processCORENotetags1($dataArmors);
this.processCORENotetags2($dataEnemies);
this.processCORENotetags3($dataActors);
this.processCORENotetags4($dataClasses);
Yanfly._loaded_YEP_CoreEngine = true;
}
return true;
};
DataManager.processCORENotetags1 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.maxItem = Yanfly.Param.MaxItem;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:PRICE):[ ](\d+)>/i)) {
obj.price = parseInt(RegExp.$1);
} else if (line.match(/<(?:MAX ITEM):[ ](\d+)>/i)) {
obj.maxItem = Math.max(1, parseInt(RegExp.$1));
} else if (line.match(/<(.*):[ ]([\+\-]\d+)>/i)) {
var stat = String(RegExp.$1).toUpperCase();
var value = parseInt(RegExp.$2);
switch (stat) {
case 'HP':
case 'MAXHP':
case 'MAX HP':
obj.params[0] = value;
break;
case 'MP':
case 'MAXMP':
case 'MAX MP':
case 'SP':
case 'MAXSP':
case 'MAX SP':
obj.params[1] = value;
break;
case 'ATK':
case 'STR':
obj.params[2] = value;
break;
case 'DEF':
obj.params[3] = value;
break;
case 'MAT':
case 'INT' || 'SPI':
obj.params[4] = value;
break;
case 'MDF':
case 'RES':
obj.params[5] = value;
break;
case 'AGI':
case 'SPD':
obj.params[6] = value;
break;
case 'LUK':
obj.params[7] = value;
break;
case 'EXP':
case 'XP':
obj.exp = value;
break;
}
}
}
}
};
DataManager.processCORENotetags2 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:GOLD):[ ](\d+)>/i)) {
obj.gold = parseInt(RegExp.$1);
} else if (line.match(/<(.*):[ ](\d+)>/i)) {
var stat = String(RegExp.$1).toUpperCase();
var value = parseInt(RegExp.$2);
switch (stat) {
case 'HP':
case 'MAXHP':
case 'MAX HP':
obj.params[0] = value;
break;
case 'MP':
case 'MAXMP':
case 'MAX MP':
case 'SP':
case 'MAXSP':
case 'MAX SP':
obj.params[1] = value;
break;
case 'ATK':
case 'STR':
obj.params[2] = value;
break;
case 'DEF':
obj.params[3] = value;
break;
case 'MAT':
case 'INT':
case 'SPI':
obj.params[4] = value;
break;
case 'MDF':
case 'RES':
obj.params[5] = value;
break;
case 'AGI':
case 'SPD':
obj.params[6] = value;
break;
case 'LUK':
obj.params[7] = value;
break;
case 'EXP':
case 'XP':
obj.exp = value;
break;
}
}
}
}
};
DataManager.processCORENotetags3 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.maxLevel = Yanfly.Param.MaxLevel;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:MAX LEVEL):[ ](\d+)>/i)) {
obj.maxLevel = parseInt(RegExp.$1);
if (obj.maxLevel < 1) obj.maxLevel = 1;
} else if (line.match(/<(?:INITIAL LEVEL):[ ](\d+)>/i)) {
obj.initialLevel = parseInt(RegExp.$1);
if (obj.initialLevel < 1) obj.initialLevel = 1;
}
}
}
};
DataManager.processCORENotetags4 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.learnings.forEach(function(learning) {
if (learning.note.match(/<(?:LEARN LEVEL|LEARN AT LEVEL):[ ](\d+)>/i)) {
learning.level = parseInt(RegExp.$1);
if (learning.level < 1) obj.maxLevel = 1;
}
}, this);
}
};
Yanfly.Core.AudioManager_playSe = AudioManager.playSe;
AudioManager.playSe = function(se) {
this._frameSe = this._frameSe || [];
if (this.uniqueCheckSe(se)) {
Yanfly.Core.AudioManager_playSe.call(this, se);
this._frameSe.push(se);
}
};
AudioManager.uniqueCheckSe = function(se1) {
if (this._frameSe.contains(se1)) return false;
return true;
};
AudioManager.clearUniqueCheckSe = function() {
this._frameSe = [];
};
Yanfly.Core.SceneManager_updateInputData = SceneManager.updateInputData;
SceneManager.updateInputData = function() {
Yanfly.Core.SceneManager_updateInputData.call(this);
AudioManager.clearUniqueCheckSe();
};
SceneManager._screenWidth = Yanfly.Param.ScreenWidth;
SceneManager._screenHeight = Yanfly.Param.ScreenHeight;
SceneManager._boxWidth = Yanfly.Param.ScreenWidth;
SceneManager._boxHeight = Yanfly.Param.ScreenHeight
Yanfly.Core.SceneManager_run = SceneManager.run;
SceneManager.run = function(sceneClass) {
Yanfly.Core.SceneManager_run.call(this, sceneClass);
Yanfly.updateResolution();
if (!Utils.isNwjs()) return;
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return;
if (Yanfly.Param.OpenConsole) Yanfly.openConsole();
};
Yanfly.updateResolution = function() {
var resizeWidth = Yanfly.Param.ScreenWidth - window.innerWidth;
var resizeHeight = Yanfly.Param.ScreenHeight - window.innerHeight;
if (!Imported.ScreenResolution) {
window.moveBy(-1 * resizeWidth / 2, -1 * resizeHeight / 2);
window.resizeBy(resizeWidth, resizeHeight);
}
};
Yanfly.openConsole = function() {
Yanfly._openedConsole = true;
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
var _debugWindow = require('nw.gui').Window.get().showDevTools();
if (_debugWindow) _debugWindow.moveTo(0, 0);
window.focus();
}
};
Yanfly.Core.SceneManager_onKeyDown = SceneManager.onKeyDown;
SceneManager.onKeyDown = function(event) {
if (!event.ctrlKey && !event.altKey && event.keyCode === 116) {
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
var win = require('nw.gui').Window.get();
win.closeDevTools();
}
}
Yanfly.Core.SceneManager_onKeyDown.call(this, event);
};
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") {
Yanfly.openConsole = function() {
Yanfly._openedConsole = true;
if (!Yanfly.Param.OpenConsole) return;
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
var win = require('nw.gui').Window.get();
win.showDevTools();
setTimeout(this.focusWindow.bind(this, win), 500);
}
};
Yanfly.focusWindow = function(win) {
win.focus();
};
Yanfly.Core.Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
Yanfly.Core.Scene_Map_update.call(this);
if (!Yanfly._openedConsole) Yanfly.openConsole();
};
Yanfly.Core.Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
Yanfly.Core.Scene_Battle_update.call(this);
if (!Yanfly._openedConsole) Yanfly.openConsole();
};
};
Yanfly.Core.BattleManager_displayStartMessages =
BattleManager.displayStartMessages;
BattleManager.displayStartMessages = function() {
Yanfly.Core.BattleManager_displayStartMessages.call(this);
$gameTroop.members().forEach(function(enemy) {
enemy.recoverAll();
});
};
BattleManager.processEscape = function() {
$gameParty.performEscape();
SoundManager.playEscape();
var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
if (success) {
$gameParty.removeBattleStates();
this.displayEscapeSuccessMessage();
this._escaped = true;
this.processAbort();
} else {
this.displayEscapeFailureMessage();
this._escapeRatio += 0.1;
$gameParty.clearActions();
this.startTurn();
}
return success;
};
Game_BattlerBase.prototype.paramMax = function(paramId) {
if (paramId === 0) {
return Yanfly.Param.EnemyMaxHp;
} else if (paramId === 1) {
return Yanfly.Param.EnemyMaxMp;
} else {
return Yanfly.Param.EnemyParam;
}
};
Yanfly.Core.Game_BattlerBase_refresh = Game_BattlerBase.prototype.refresh;
Game_BattlerBase.prototype.mapRegenUpdateCheck = function(type) {
if ($gameParty.inBattle()) return true;
if (type === 'hp') {
return Yanfly.Param.RefreshUpdateHp;
} else if (type === 'mp') {
return Yanfly.Param.RefreshUpdateMp;
} else if (type === 'tp') {
return Yanfly.Param.RefreshUpdateTp;
}
};
Game_BattlerBase.prototype.setHp = function(hp) {
if (this._hp === hp) return;
this._hp = hp;
if (this.mapRegenUpdateCheck('hp')) {
this.refresh();
} else {
Yanfly.Core.Game_BattlerBase_refresh.call(this);
}
};
Game_BattlerBase.prototype.setMp = function(mp) {
if (this._mp === mp) return;
this._mp = mp;
if (this.mapRegenUpdateCheck('mp')) {
this.refresh();
} else {
Yanfly.Core.Game_BattlerBase_refresh.call(this);
}
};
Game_BattlerBase.prototype.setTp = function(tp) {
if (this._tp === tp) return;
this._tp = tp;
if (this.mapRegenUpdateCheck('tp')) {
this.refresh();
} else {
Yanfly.Core.Game_BattlerBase_refresh.call(this);
}
};
Game_Battler.prototype.onTurnEnd = function() {
this.clearResult();
this.regenerateAll();
this.updateStateTurns();
this.updateBuffTurns();
this.removeStatesAuto(2);
};
Yanfly.Core.Game_Actor_isMaxLevel = Game_Actor.prototype.isMaxLevel;
Game_Actor.prototype.isMaxLevel = function() {
if (this.maxLevel() === 0) return false;
return Yanfly.Core.Game_Actor_isMaxLevel.call(this);
};
Game_Actor.prototype.paramMax = function(paramId) {
if (paramId === 0) {
return Yanfly.Param.ActorMaxHp;
} else if (paramId === 1) {
return Yanfly.Param.ActorMaxMp;
} else {
return Yanfly.Param.ActorParam;
}
};
Yanfly.Core.Game_Actor_paramBase = Game_Actor.prototype.paramBase;
Game_Actor.prototype.paramBase = function(paramId) {
if (this.level > 99) {
var i = this.currentClass().params[paramId][99];
var j = this.currentClass().params[paramId][98];
i += (i - j) * (this.level - 99);
return i;
}
return Yanfly.Core.Game_Actor_paramBase.call(this, paramId);
};
Game_Actor.prototype.changeClass = function(classId, keepExp) {
if (keepExp) {
this._exp[classId] = this._exp[this._classId];
}
this._classId = classId;
this.changeExp(this._exp[this._classId] || 0, false);
this.refresh();
};
Game_Actor.prototype.learnSkill = function(skillId) {
if (!this._skills.contains(skillId)) {
this._skills.push(skillId);
this._skills.sort(function(a, b) {
return a - b;
});
}
};
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.4') {
Game_Actor.prototype.meetsUsableItemConditions = function(item) {
if($gameParty.inBattle() && !BattleManager.canEscape() &&
this.testEscape(item)){
return false;
}
return Game_BattlerBase.prototype.meetsUsableItemConditions.call(this, item);
};
};
Game_Party.prototype.maxGold = function() {
return eval(Yanfly.Param.MaxGold);
};
Game_Party.prototype.maxItems = function(item) {
if (!item) return 1;
return item.maxItem;
};
Game_Party.prototype.onPlayerWalk = function() {
var group = this.members();
var length = group.length;
for (var i = 0; i < length; ++i) {
var actor = group[i];
if (actor) actor.onPlayerWalk();
}
};
Yanfly.isPreventScreenJittering = function() {
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.5.0') return true;
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.4') return false;
return true;
};
if (Yanfly.isPreventScreenJittering()) {
Game_Map.prototype.displayX = function() {
return parseFloat(Math.floor(this._displayX *
this.tileWidth())) / this.tileWidth();
};
Game_Map.prototype.displayY = function() {
return parseFloat(Math.floor(this._displayY *
this.tileHeight())) / this.tileHeight();
};
};
Game_Map.prototype.adjustX = function(x) {
if (this.isLoopHorizontal() && x < this.displayX() -
(this.width() - this.screenTileX()) / 2) {
return x - this.displayX() + $dataMap.width;
} else {
return x - this.displayX();
}
};
Game_Map.prototype.adjustY = function(y) {
if (this.isLoopVertical() && y < this.displayY() -
(this.height() - this.screenTileY()) / 2) {
return y - this.displayY() + $dataMap.height;
} else {
return y - this.displayY();
}
};
Game_Map.prototype.updateEvents = function() {
if (_Live2DLoadFlame > 0) return false;
var group = this.events();
var length = group.length;
for (var i = 0; i < length; ++i) {
var ev = group[i];
if (ev) ev.update();
}
var group = this._commonEvents;
var length = group.length;
for (var i = 0; i < length; ++i) {
var ev = group[i];
if (ev) ev.update();
}
};
Game_Map.prototype.updateVehicles = function() {
var group = this._vehicles;
var length = group.length;
for (var i = 0; i < length; ++i) {
var vehicle = group[i];
if (vehicle) vehicle.update();
}
};
Game_Character.prototype.queueMoveRoute = function(moveRoute) {
this._originalMoveRoute = moveRoute;
this._originalMoveRouteIndex = 0;
};
Yanfly.Core.Game_Event_setMoveRoute =
Game_Event.prototype.setMoveRoute;
Game_Character.prototype.setMoveRoute = function(moveRoute) {
if (!this._moveRouteForcing) {
Yanfly.Core.Game_Event_setMoveRoute.call(this, moveRoute);
} else {
this.queueMoveRoute(moveRoute);
}
};
// Game_Character.prototype.processMoveCommand = function(command) {
// switch (command.code) {
// eval(params[0]);
// } catch (e) {
// Yanfly.Util.displayError(e, params[0], 'MOVE ROUTE SCRIPT ERROR');
// return Yanfly.Core.Game_Character_processMoveCommand.call(this, command);
Game_Event.prototype.isCollidedWithEvents = function(x, y) {
var events = $gameMap.eventsXyNt(x, y).filter(function(ev) {
return ev.isNormalPriority();
});
if (events.length <= 0) return false;
return this.isNormalPriority();
};
Game_Screen.prototype.updatePictures = function() {
var group = this._pictures;
var length = group.length;
for (var i = 0; i < length; ++i) {
var picture = group[i];
if (picture) picture.update();
}
};
Yanfly.Core.Game_Action_testItemEffect = Game_Action.prototype.testItemEffect;
Game_Action.prototype.testItemEffect = function(target, effect) {
switch (effect.code) {
case Game_Action.EFFECT_LEARN_SKILL:
return target.isActor() && !target._skills.contains(effect.dataId);
default:
return Yanfly.Core.Game_Action_testItemEffect.call(this, target, effect);
}
};
Game_Action.prototype.evalDamageFormula = function(target) {
var item = this.item();
var a = this.subject();
var b = target;
var v = $gameVariables._data;
var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
try {
var value = Math.max(eval(item.damage.formula), 0) * sign;
if (isNaN(value)) value = 0;
return value;
} catch (e) {
Yanfly.Util.displayError(e, item.damage.formula, 'DAMAGE FORMULA ERROR');
return 0;
}
};
Yanfly.Core.Game_Interpreter_command111 =
Game_Interpreter.prototype.command111;
Game_Interpreter.prototype.command111 = function() {
var result = false;
switch (this._params[0]) {
case 0:
if (this._params[2] === 0) {
result = $gameSwitches.value(this._params[1]);
} else {
result = !$gameSwitches.value(this._params[1]);
}
this._branch[this._indent] = result;
if (this._branch[this._indent] === false) this.skipBranch();
return true
break;
case 2:
if (this._eventId > 0) {
var key = [this._mapId, this._eventId, this._params[1]];
if (this._params[2] === 0) {
result = $gameSelfSwitches.value(key);
} else {
result = !$gameSelfSwitches.value(key);
}
}
this._branch[this._indent] = result;
if (this._branch[this._indent] === false) this.skipBranch();
return true
break;
case 12:
var code = this._params[1];
try {
result = !!eval(code);
} catch (e) {
result = false;
Yanfly.Util.displayError(e, code, 'CONDITIONAL BRANCH SCRIPT ERROR');
}
this._branch[this._indent] = result;
if (this._branch[this._indent] === false) this.skipBranch();
return true
break;
}
return Yanfly.Core.Game_Interpreter_command111.call(this);
};
// Game_Interpreter.prototype.command122 = function() {
// switch (this._params[3]) {
// value = eval(code);
// } catch (e) {
// Yanfly.Util.displayError(e, code, 'CONTROL VARIABLE SCRIPT ERROR');
// for (var i = this._params[0]; i <= this._params[1]; i++) {
// this.operateVariable(i, this._params[2], value);
// return Yanfly.Core.Game_Interpreter_command122.call(this);
Game_Interpreter.prototype.command355 = function() {
var script = this.currentCommand().parameters[0] + '\n';
while (this.nextEventCode() === 655) {
this._index++;
script += this.currentCommand().parameters[0] + '\n';
}
try {
eval(script);
} catch (e) {
Yanfly.Util.displayError(e, script, 'SCRIPT CALL ERROR');
}
return true;
};
Yanfly.Core.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Yanfly.Core.Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'GainGold') {
$gameParty.gainGold(parseInt(args[0]));
}
if (command === 'LoseGold') {
$gameParty.loseGold(parseInt(args[0]));
}
};
Scene_Base.prototype.clearChildren = function() {
while (this.children.length > 0) {
this.removeChild(this.children[0]);
}
};
if (Yanfly.Param.CollectionClear) {
Yanfly.Core.Scene_Base_terminate = Scene_Base.prototype.terminate;
Scene_Base.prototype.terminate = function() {
Yanfly.Core.Scene_Base_terminate.call(this);
if (this._bypassFirstClear) return;
this.clearChildren();
};
Yanfly.Core.Scene_Title_terminate = Scene_Title.prototype.terminate;
Scene_Title.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Title_terminate.call(this);
this.clearChildren();
};
Yanfly.Core.Scene_Map_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Map_terminate.call(this);
this.clearChildren();
};
Yanfly.Core.Scene_Battle_terminate = Scene_Battle.prototype.terminate;
Scene_Battle.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Battle_terminate.call(this);
this.clearChildren();
};
Yanfly.Core.Scene_Options_terminate = Scene_Options.prototype.terminate;
Scene_Options.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Options_terminate.call(this);
this.clearChildren();
};
Yanfly.Core.Scene_Load_terminate = Scene_Load.prototype.terminate;
Scene_Load.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Load_terminate.call(this);
this.clearChildren();
};
Yanfly.Core.Scene_Gameover_terminate = Scene_Gameover.prototype.terminate;
Scene_Gameover.prototype.terminate = function() {
this._bypassFirstClear = true;
Yanfly.Core.Scene_Gameover_terminate.call(this);
this.clearChildren();
};
};
Scene_Boot.prototype.isGameFontLoaded = function() {
if (Graphics.isFontLoaded('GameFont')) {
return true;
} else if (Yanfly.Param.GameFontTimer <= 0) {
return false;
} else {
var elapsed = Date.now() - this._startDate;
if (elapsed >= Yanfly.Param.GameFontTimer) {
throw new Error('Failed to load GameFont');
} else {
return false;
}
}
};
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") {
Scene_Item.prototype.update = function() {
Scene_ItemBase.prototype.update.call(this);
};
};
Yanfly.Core.Scene_Title_start = Scene_Title.prototype.start;
Scene_Title.prototype.start = function() {
Yanfly.Core.Scene_Title_start.call(this);
if (Yanfly.Param.ScaleTitle) this.rescaleTitle();
};
Scene_Title.prototype.rescaleTitle = function() {
this.rescaleTitleSprite(this._backSprite1);
this.rescaleTitleSprite(this._backSprite2);
};
Scene_Title.prototype.rescaleTitleSprite = function(sprite) {
if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) {
return setTimeout(this.rescaleTitleSprite.bind(this, sprite), 5);
}
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var ratioX = width / sprite.bitmap.width;
var ratioY = height / sprite.bitmap.height;
if (ratioX > 1.0) sprite.scale.x = ratioX;
if (ratioY > 1.0) sprite.scale.y = ratioY;
this.centerSprite(sprite);
};
if (Yanfly.Param.ShowEvTrans) {
Scene_Map.prototype.startEncounterEffect = function() {
this._encounterEffectDuration = this.encounterEffectSpeed();
};
};
Yanfly.Core.Scene_Map_snapForBattleBackground =
Scene_Map.prototype.snapForBattleBackground;
Scene_Map.prototype.snapForBattleBackground = function() {
if (!Yanfly.Param.ShowEvSnap) this._spriteset.hideCharacters();
Yanfly.Core.Scene_Map_snapForBattleBackground.call(this);
if (Yanfly.Param.ShowEvTrans) this._spriteset.showCharacters();
};
Yanfly.Core.Scene_Gameover_start = Scene_Gameover.prototype.start;
Scene_Gameover.prototype.start = function() {
Yanfly.Core.Scene_Gameover_start.call(this);
if (Yanfly.Param.ScaleGameOver) this.rescaleBackground();
};
Scene_Gameover.prototype.rescaleBackground = function() {
this.rescaleImageSprite(this._backSprite);
};
Scene_Gameover.prototype.rescaleImageSprite = function(sprite) {
if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) {
return setTimeout(this.rescaleImageSprite.bind(this, sprite), 5);
}
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var ratioX = width / sprite.bitmap.width;
var ratioY = height / sprite.bitmap.height;
if (ratioX > 1.0) sprite.scale.x = ratioX;
if (ratioY > 1.0) sprite.scale.y = ratioY;
this.centerSprite(sprite);
};
Scene_Gameover.prototype.centerSprite = function(sprite) {
sprite.x = Graphics.width / 2;
sprite.y = Graphics.height / 2;
sprite.anchor.x = 0.5;
sprite.anchor.y = 0.5;
};
Sprite_Animation.prototype.setupRate = function() {
this._rate = Yanfly.Param.AnimationRate;
};
if (!Yanfly.Param.FlashTarget) {
Yanfly.Core.Sprite_Battler_updateSelectionEffect =
Sprite_Battler.prototype.updateSelectionEffect;
Sprite_Battler.prototype.updateSelectionEffect = function() {
if (this._battler.isActor()) {
Yanfly.Core.Sprite_Battler_updateSelectionEffect.call(this);
} else {
if (this._battler.isSelected()) this.startEffect('whiten');
}
};
};
if (Yanfly.Param.ReposBattlers) {
Yanfly.Core.Sprite_Actor_setActorHome = Sprite_Actor.prototype.setActorHome;
Sprite_Actor.prototype.setActorHome = function(index) {
Yanfly.Core.Sprite_Actor_setActorHome.call(this, index);
this._homeX += Graphics.boxWidth - 816;
this._homeY += Graphics.boxHeight - 624;
};
};
Sprite_Actor.prototype.retreat = function() {
this.startMove(1200, 0, 120);
};
if (Yanfly.Param.ReposBattlers) {
Yanfly.Core.Sprite_Enemy_setBattler = Sprite_Enemy.prototype.setBattler;
Sprite_Enemy.prototype.setBattler = function(battler) {
Yanfly.Core.Sprite_Enemy_setBattler.call(this, battler);
if (!this._enemy._alteredScreenY) {
this._homeY += Math.floor((Graphics.boxHeight - 624) / 2);
this._enemy._screenY = this._homeY;
this._enemy._alteredScreenY = true;
}
if ($gameSystem.isSideView()) return;
if (!this._enemy._alteredScreenX) {
this._homeX += (Graphics.boxWidth - 816) / 2;
this._enemy._screenX = this._homeX;
this._enemy._alteredScreenX = true;
}
};
};
Sprite_StateIcon._iconWidth = Yanfly.Param.IconWidth;
Sprite_StateIcon._iconHeight = Yanfly.Param.IconHeight;
Sprite_Button.prototype.isButtonTouched = function() {
var x = this.canvasToLocalX(TouchInput.x) + (this.anchor.x * this.width);
var y = this.canvasToLocalY(TouchInput.y) + (this.anchor.y * this.height);
return x >= 0 && y >= 0 && x < this.width && y < this.height;
};
function Sprite_Battleback() {
this.initialize.apply(this, arguments);
}
Sprite_Battleback.prototype = Object.create(Sprite.prototype);
Sprite_Battleback.prototype.constructor = Sprite_Battleback;
Sprite_Battleback.prototype.initialize = function(bitmapName, type) {
Sprite.prototype.initialize.call(this);
this._bitmapName = bitmapName;
this._battlebackType = type;
this.createBitmap();
};
Sprite_Battleback.prototype.createBitmap = function() {
if (this._bitmapName === '') {
this.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight);
} else {
if (this._battlebackType === 1) {
this.bitmap = ImageManager.loadBattleback1(this._bitmapName);
} else {
this.bitmap = ImageManager.loadBattleback2(this._bitmapName);
}
this.scaleSprite();
}
};
Sprite_Battleback.prototype.scaleSprite = function() {
if (this.bitmap.width <= 0) return setTimeout(this.scaleSprite.bind(this), 5);
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
if (this.bitmap.width < width) {
this.scale.x = width / this.bitmap.width;
}
if (this.bitmap.height < height) {
this.scale.y = height / this.bitmap.height;
}
this.anchor.x = 0.5;
this.x = Graphics.boxWidth / 2;
if ($gameSystem.isSideView()) {
this.anchor.y = 1;
this.y = Graphics.boxHeight;
} else {
this.anchor.y = 0.5;
this.y = Graphics.boxHeight / 2;
}
};
Yanfly.Core.Sprite_Character_updateHalfBodySprites =
Sprite_Character.prototype.updateHalfBodySprites;
Sprite_Character.prototype.updateHalfBodySprites = function() {
Yanfly.Core.Sprite_Character_updateHalfBodySprites.call(this);
if (this._bushDepth > 0) {
this._upperBody.blendMode = this.blendMode;
this._lowerBody.blendMode = this.blendMode;
}
};
Spriteset_Map.prototype.hideCharacters = function() {
for (var i = 0; i < this._characterSprites.length; i++) {
var sprite = this._characterSprites[i];
if (!sprite.isTile()) sprite.hide();
}
};
Spriteset_Map.prototype.showCharacters = function() {
for (var i = 0; i < this._characterSprites.length; i++) {
var sprite = this._characterSprites[i];
if (!sprite.isTile()) sprite.show();
}
};
if (Yanfly.Param.ScaleBattleback) {
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.2') {
Spriteset_Battle.prototype.createBattleback = function() {
this._back1Sprite = new Sprite_Battleback(this.battleback1Name(), 1);
this._back2Sprite = new Sprite_Battleback(this.battleback2Name(), 2);
this._battleField.addChild(this._back1Sprite);
this._battleField.addChild(this._back2Sprite);
};
Spriteset_Battle.prototype.updateBattleback = function() {
};
} else {
Yanfly.Core.Spriteset_Battle_locateBattleback =
Spriteset_Battle.prototype.locateBattleback;
Spriteset_Battle.prototype.locateBattleback = function() {
var sprite1 = this._back1Sprite;
var sprite2 = this._back2Sprite;
if (sprite1.bitmap.width <= 0) return;
if (sprite2.bitmap.width <= 0) return;
if (this._rescaledBattlebackSprite) return;
this._rescaledBattlebackSprite = true;
Yanfly.Core.Spriteset_Battle_locateBattleback.call(this);
var height = this._battleField.height;
sprite1.origin.y = sprite1.x + sprite1.bitmap.height - height;
sprite2.origin.y = sprite1.y + sprite2.bitmap.height - height;
this.rescaleBattlebacks();
};
Spriteset_Battle.prototype.rescaleBattlebacks = function() {
this.rescaleBattlebackSprite(this._back1Sprite);
this.rescaleBattlebackSprite(this._back2Sprite);
};
Spriteset_Battle.prototype.rescaleBattlebackSprite = function(sprite) {
if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) return;
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var ratioX = width / sprite.bitmap.width;
var ratioY = height / sprite.bitmap.height;
if (ratioX > 1.0) {
sprite.scale.x = ratioX;
sprite.anchor.x = 0.5;
sprite.x = width / 2;
}
if (ratioY > 1.0) {
sprite.scale.y = ratioY;
sprite.origin.y = 0;
sprite.y = 0;
}
};
}
}
Window_Base._iconWidth = Yanfly.Param.IconWidth;
Window_Base._iconHeight = Yanfly.Param.IconHeight;
Window_Base._faceWidth = Yanfly.Param.FaceWidth;
Window_Base._faceHeight = Yanfly.Param.FaceHeight;
Window_Base.prototype.lineHeight = function() {
return Yanfly.Param.LineHeight;
};
Window_Base.prototype.drawTextEx = function(text, x, y) {
if (text) {
this.resetFontSettings();
var textState = { index: 0, x: x, y: y, left: x };
textState.text = this.convertEscapeCharacters(text);
textState.height = this.calcTextHeight(textState, false);
while (textState.index < textState.text.length) {
this.processCharacter(textState);
}
return textState.x - x;
} else {
return 0;
}
};
Window_Base.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height + this.lineHeight());
};
Window_Base.prototype.standardFontFace = function() {
if ($gameSystem.isChinese()) {
return Yanfly.Param.ChineseFont;
} else if ($gameSystem.isKorean()) {
return Yanfly.Param.KoreanFont;
} else {
return Yanfly.Param.DefaultFont;
}
};
Window_Base.prototype.standardFontSize = function() {
return Yanfly.Param.FontSize;
};
Window_Base.prototype.standardPadding = function() {
return Yanfly.Param.WindowPadding;
};
Window_Base.prototype.textPadding = function() {
return Yanfly.Param.TextPadding;
};
Window_Base.prototype.standardBackOpacity = function() {
return Yanfly.Param.WindowOpacity;
};
Window_Base.prototype.normalColor = function() {
return this.textColor(Yanfly.Param.ColorNormal);
};
Window_Base.prototype.systemColor = function() {
return this.textColor(Yanfly.Param.ColorSystem);
};
Window_Base.prototype.crisisColor = function() {
return this.textColor(Yanfly.Param.ColorCrisis);
};
Window_Base.prototype.deathColor = function() {
return this.textColor(Yanfly.Param.ColorDeath);
};
Window_Base.prototype.gaugeBackColor = function() {
return this.textColor(Yanfly.Param.ColorGaugeBack);
};
Window_Base.prototype.hpGaugeColor1 = function() {
return this.textColor(Yanfly.Param.ColorHpGauge1);
};
Window_Base.prototype.hpGaugeColor2 = function() {
return this.textColor(Yanfly.Param.ColorHpGauge2);
};
Window_Base.prototype.mpGaugeColor1 = function() {
return this.textColor(Yanfly.Param.ColorMpGauge1);
};
Window_Base.prototype.mpGaugeColor2 = function() {
return this.textColor(Yanfly.Param.ColorMpGauge2);
};
Window_Base.prototype.mpCostColor = function() {
return this.textColor(Yanfly.Param.ColorMpCost);
};
Window_Base.prototype.powerUpColor = function() {
return this.textColor(Yanfly.Param.ColorPowerUp);
};
Window_Base.prototype.powerDownColor = function() {
return this.textColor(Yanfly.Param.ColorPowerDown);
};
Window_Base.prototype.tpGaugeColor1 = function() {
return this.textColor(Yanfly.Param.ColorTpGauge1);
};
Window_Base.prototype.tpGaugeColor2 = function() {
return this.textColor(Yanfly.Param.ColorTpGauge2);
};
Window_Base.prototype.tpCostColor = function() {
return this.textColor(Yanfly.Param.ColorTpCost);
};
Window_Base.prototype.drawGauge = function(dx, dy, dw, rate, color1, color2) {
var color3 = this.gaugeBackColor();
var fillW = Math.floor(dw * rate).clamp(0, dw);
var gaugeH = this.gaugeHeight();
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
if (Yanfly.Param.GaugeOutline) {
color3.paintOpacity = this.translucentOpacity();
this.contents.fillRect(dx, gaugeY - 1, dw, gaugeH, color3);
fillW = Math.max(fillW - 2, 0);
gaugeH -= 2;
dx += 1;
} else {
var fillW = Math.floor(dw * rate);
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
}
this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
};
Window_Base.prototype.gaugeHeight = function() {
return Yanfly.Param.GaugeHeight;
};
Window_Base.prototype.drawActorLevel = function(actor, x, y) {
this.changeTextColor(this.systemColor());
var dw1 = this.textWidth(TextManager.levelA);
this.drawText(TextManager.levelA, x, y, dw1);
this.resetTextColor();
var level = Yanfly.Util.toGroup(actor.level);
var dw2 = this.textWidth(Yanfly.Util.toGroup(actor.maxLevel()));
this.drawText(level, x + dw1, y, dw2, 'right');
};
Window_Base.prototype.drawCurrentAndMax = function(current, max, x, y,
width, color1, color2) {
var labelWidth = this.textWidth('HP');
var valueWidth = this.textWidth(Yanfly.Util.toGroup(max));
var slashWidth = this.textWidth('/');
var x1 = x + width - valueWidth;
var x2 = x1 - slashWidth;
var x3 = x2 - valueWidth;
if (x3 >= x + labelWidth) {
this.changeTextColor(color1);
this.drawText(Yanfly.Util.toGroup(current), x3, y, valueWidth,
'right');
this.changeTextColor(color2);
this.drawText('/', x2, y, slashWidth, 'right');
this.drawText(Yanfly.Util.toGroup(max), x1, y, valueWidth, 'right');
} else {
this.changeTextColor(color1);
this.drawText(Yanfly.Util.toGroup(current), x1, y, valueWidth,
'right');
}
};
Window_Base.prototype.drawActorTp = function(actor, x, y, width) {
width = width || 96;
var color1 = this.tpGaugeColor1();
var color2 = this.tpGaugeColor2();
this.drawGauge(x, y, width, actor.tpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.tpA, x, y, 44);
this.changeTextColor(this.tpColor(actor));
this.drawText(Yanfly.Util.toGroup(actor.tp), x + width - 64, y, 64,
'right');
};
Window_Base.prototype.drawActorSimpleStatus = function(actor, x, y, width) {
var lineHeight = this.lineHeight();
var xpad = Window_Base._faceWidth + (2 * Yanfly.Param.TextPadding);
var x2 = x + xpad;
var width2 = Math.max(180, width - xpad - this.textPadding());
this.drawActorName(actor, x, y);
this.drawActorLevel(actor, x, y + lineHeight * 1);
this.drawActorIcons(actor, x, y + lineHeight * 2);
this.drawActorClass(actor, x2, y, width2);
this.drawActorHp(actor, x2, y + lineHeight * 1, width2);
this.drawActorMp(actor, x2, y + lineHeight * 2, width2);
if (Yanfly.Param.MenuTpGauge) {
this.drawActorTp(actor, x2, y + lineHeight * 3, width2);
}
};
Window_Base.prototype.drawCurrencyValue = function(value, unit, wx, wy, ww) {
this.resetTextColor();
this.contents.fontSize = Yanfly.Param.GoldFontSize;
if (this.usingGoldIcon(unit)) {
var cx = Window_Base._iconWidth;
} else {
var cx = this.textWidth(unit);
}
var text = Yanfly.Util.toGroup(value);
if (this.textWidth(text) > ww - cx) {
text = Yanfly.Param.GoldOverlap;
}
this.drawText(text, wx, wy, ww - cx - 4, 'right');
if (this.usingGoldIcon(unit)) {
this.drawIcon(Yanfly.Icon.Gold, wx + ww - Window_Base._iconWidth, wy + 2);
} else {
this.changeTextColor(this.systemColor());
this.drawText(unit, wx, wy, ww, 'right');
}
this.resetFontSettings();
};
Window_Base.prototype.usingGoldIcon = function(unit) {
if (unit !== TextManager.currencyUnit) return false;
return Yanfly.Icon.Gold > 0;
};
Window_Command.prototype.itemTextAlign = function() {
return Yanfly.Param.TextAlign;
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
this.changePaintOpacity(actor.isBattleMember());
var fw = Window_Base._faceWidth;
this.drawActorFace(actor, rect.x + 1, rect.y + 1, fw, rect.height - 2);
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
var xpad = Yanfly.Param.WindowPadding + Window_Base._faceWidth;
var x = rect.x + xpad;
if (!Yanfly.Param.MenuTpGauge) {
var y = Math.floor(rect.y + rect.height / 2 - this.lineHeight() * 1.5);
} else {
var y = Math.floor(rect.y);
}
var width = rect.width - x - this.textPadding();
this.drawActorSimpleStatus(actor, x, y, width);
};
Window_ItemList.prototype.numberWidth = function() {
return this.textWidth('\u00d70,000');
};
Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
if (!this.needsNumber()) return;
var numItems = Yanfly.Util.toGroup($gameParty.numItems(item));
this.contents.fontSize = Yanfly.Param.ItemQuantitySize;
this.drawText('\u00d7' + numItems, x, y, width, 'right');
this.resetFontSettings();
};
Window_SkillStatus.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
var w = this.width - this.padding * 2;
var h = this.height - this.padding * 2;
if (!Yanfly.Param.MenuTpGauge) {
var y = h / 2 - this.lineHeight() * 1.5;
} else {
var y = 0;
}
var xpad = Yanfly.Param.WindowPadding + Window_Base._faceWidth;
var width = w - xpad - this.textPadding();
this.drawActorFace(this._actor, 0, 0, Window_Base._faceWidth, h);
this.drawActorSimpleStatus(this._actor, xpad, y, width);
}
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
if (this._actor.skillTpCost(skill) > 0) {
this.changeTextColor(this.tpCostColor());
var skillcost = Yanfly.Util.toGroup(this._actor.skillTpCost(skill));
this.drawText(skillcost, x, y, width, 'right');
} else if (this._actor.skillMpCost(skill) > 0) {
this.changeTextColor(this.mpCostColor());
var skillcost = Yanfly.Util.toGroup(this._actor.skillMpCost(skill));
this.drawText(skillcost, x, y, width, 'right');
}
};
Window_EquipStatus.prototype.drawCurrentParam = function(x, y, paramId) {
this.resetTextColor();
var actorparam = Yanfly.Util.toGroup(this._actor.param(paramId));
this.drawText(actorparam, x, y, 48, 'right');
};
Window_EquipStatus.prototype.drawNewParam = function(x, y, paramId) {
var newValue = this._tempActor.param(paramId);
var diffvalue = newValue - this._actor.param(paramId);
var actorparam = Yanfly.Util.toGroup(newValue);
this.changeTextColor(this.paramchangeTextColor(diffvalue));
this.drawText(actorparam, x, y, 48, 'right');
};
Window_SkillType.prototype.makeCommandList = function() {
if (this._actor) {
var skillTypes = this._actor.addedSkillTypes();
skillTypes.sort(function(a, b){return a-b});
skillTypes.forEach(function(stypeId) {
var name = $dataSystem.skillTypes[stypeId];
this.addCommand(name, 'skill', true, stypeId);
}, this);
}
};
Window_ActorCommand.prototype.addSkillCommands = function() {
var skillTypes = this._actor.addedSkillTypes();
skillTypes.sort(function(a, b){return a-b});
skillTypes.forEach(function(stypeId) {
var name = $dataSystem.skillTypes[stypeId];
this.addCommand(name, 'skill', true, stypeId);
}, this);
};
Window_Status.prototype.drawParameters = function(x, y) {
var lineHeight = this.lineHeight();
for (var i = 0; i < 6; i++) {
var paramId = i + 2;
var y2 = y + lineHeight * i;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y2, 160);
this.resetTextColor();
var actorParam = Yanfly.Util.toGroup(this._actor.param(paramId));
var dw = this.textWidth(Yanfly.Util.toGroup(this._actor.paramMax(i + 2)));
this.drawText(actorParam, x + 160, y2, dw, 'right');
}
};
Window_Status.prototype.drawExpInfo = function(x, y) {
var lineHeight = this.lineHeight();
var expTotal = TextManager.expTotal.format(TextManager.exp);
var expNext = TextManager.expNext.format(TextManager.level);
var value1 = this._actor.currentExp();
var value2 = this._actor.nextRequiredExp();
if (this._actor.isMaxLevel()) {
value1 = '-------';
value2 = '-------';
} else {
value1 = Yanfly.Util.toGroup(value1);
value2 = Yanfly.Util.toGroup(value2);
}
this.changeTextColor(this.systemColor());
this.drawText(expTotal, x, y + lineHeight * 0, 270);
this.drawText(expNext, x, y + lineHeight * 2, 270);
this.resetTextColor();
this.drawText(value1, x, y + lineHeight * 1, 270, 'right');
this.drawText(value2, x, y + lineHeight * 3, 270, 'right');
};
Window_ShopBuy.prototype.drawItem = function(index) {
var item = this._data[index];
var rect = this.itemRect(index);
rect.width -= this.textPadding();
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, rect.width);
this.contents.fontSize = Yanfly.Param.GoldFontSize;
var itemPrice = Yanfly.Util.toGroup(this.price(item));
this.drawText(itemPrice, rect.x, rect.y, rect.width, 'right');
this.changePaintOpacity(true);
this.resetFontSettings();
};
Window_ShopNumber.prototype.drawNumber = function() {
var x = this.cursorX();
var y = this.itemY();
var width = this.cursorWidth() - this.textPadding();
this.resetTextColor();
var itemNumber = Yanfly.Util.toGroup(this._number);
this.drawText(itemNumber, x, y, width, 'right');
};
Window_NameEdit.prototype.faceWidth = function() {
return Window_Base._faceWidth;
};
Window_BattleStatus.prototype.gaugeAreaWidth = function() {
return this.width / 2 + this.standardPadding();
};
Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
var minIconArea = Window_Base._iconWidth * 2;
var nameLength = this.textWidth('0') * 16 + 6;
var iconWidth = Math.max(rect.width - nameLength, minIconArea);
var nameWidth = rect.width - iconWidth;
this.drawActorName(actor, rect.x + 0, rect.y, nameWidth);
this.drawActorIcons(actor, rect.x + nameWidth, rect.y, iconWidth);
};
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
var totalArea = this.gaugeAreaWidth() - 30;
var hpW = Math.floor(parseInt(totalArea * 108 / 300));
var otW = Math.floor(parseInt(totalArea * 96 / 300));
this.drawActorHp(actor, rect.x + 0, rect.y, hpW);
this.drawActorMp(actor, rect.x + hpW + 15, rect.y, otW);
this.drawActorTp(actor, rect.x + hpW + otW + 30, rect.y, otW);
};
Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
var totalArea = this.gaugeAreaWidth() - 15;
var hpW = Math.floor(parseInt(totalArea * 201 / 315));
var otW = Math.floor(parseInt(totalArea * 114 / 315));
this.drawActorHp(actor, rect.x + 0, rect.y, hpW);
this.drawActorMp(actor, rect.x + hpW + 15, rect.y, otW);
};
Window_BattleLog.prototype.showNormalAnimation = function(targets,
animationId, mirror) {
var animation = $dataAnimations[animationId];
if (animation) {
if (animation.position === 3) {
targets.forEach(function(target) {
target.startAnimation(animationId, mirror, 0);
});
} else {
var delay = this.animationBaseDelay();
var nextDelay = this.animationNextDelay();
targets.forEach(function(target) {
target.startAnimation(animationId, mirror, delay);
delay += nextDelay;
});
}
}
};
Yanfly.Util = Yanfly.Util || {};
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.5.0') {
Yanfly.Util.toGroup = function(inVal) {
if (typeof inVal === 'string') return inVal;
if (!Yanfly.Param.DigitGroup) return inVal;
try {
return inVal.toLocaleString('en');
}catch(ex){
return inVal;
}
return inVal.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
});
};
} else {
Yanfly.Util.toGroup = function(inVal) {
if (typeof inVal !== 'string') { inVal = String(inVal); }
if (!Yanfly.Param.DigitGroup) return inVal;
try {
return inVal.toLocaleString('en');
} catch (ex) {
return inVal;
}
return inVal.replace(/(^|[^\w.])(\d{4,})/g, function($0, $1, $2) {
return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,");
});
};
}
Yanfly.Util.displayError = function(e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return;
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
require('nw.gui').Window.get().showDevTools();
}
}
};