查看: 1211|回复: 2

[已经过期] 跳舞機插件問題

[复制链接]
梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
发表于 2016-2-18 15:16:40 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 小叮鈴 于 2016-2-18 15:27 编辑

https://atelierrgss.wordpress.com/rmv-theatrhythm/

這個插件 用了半天就是不成功

1.jpg

會出現這情況,怎麼回事?

我也把圖片複製到/ IMG / Theatrhythm /了

然而我發現跟YEP的HP插件有關 貌似血條的問題
http://yanfly.moe/2015/11/21/yep-30-visual-hp-gauges/

但是我把怪物設定為
<Hide HP Gauge>

不顯示血條 依然還是出錯


  1. //=============================================================================
  2. // MOG_Theatrhythm.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.2) Minigame baseado no jogo Final Fantasy Theatrhythm.
  6. * @author Moghunter
  7. *
  8. * @param >> MAIN ===================
  9. * @desc
  10. * @default
  11. *
  12. * @param Points Variable ID
  13. * @desc Definição da variável que ficara guardada a quantidade de Pontos.
  14. * @default 5
  15. *
  16. * @param Result Switch ID
  17. * @desc Definição da switch que corresponde a vitória ou derrota do minigame.
  18. * @default 10
  19. *
  20. * @param Score Base
  21. * @desc Definição do valor basico dos pontos.
  22. * @default 10
  23. *
  24. * @param Chain Bonus
  25. * @desc Definição do valor dos pontos ganhos fazer combos.
  26. * @default 5
  27. *
  28. * @param Critical Bonus Percentage
  29. * @desc Definição da porcentagem ao fazer danos críticos.
  30. * @default 1.5  
  31. *
  32. * @param Max Chain Bonus Percentage
  33. * @desc Definição da porcentagem ganho no resultado final.
  34. * @default 0.01
  35. *
  36. * @param Miss Dmg Percentage
  37. * @desc Definição da porcentagem de dano ao errar ou deixar o botão passar.
  38. * @default 0
  39. *
  40. * @param BP Base Value
  41. * @desc Definição do valor base do Battle Power.
  42. * @default 50
  43. *
  44. * @param Enemy Atk Animation
  45. * @desc Definição da animação padrão do ataque inimigo.
  46. * @default 1
  47. *
  48. * @param >> POSITION ===================
  49. * @desc
  50. * @default
  51. *
  52. * @param Actor X-Axis
  53. * @desc Definição X-Axis personagem.
  54. * @default 700  
  55. *
  56. * @param Actor Y-Axis
  57. * @desc Definição Y-Axis personagem.
  58. * @default 320
  59. *
  60. * @param Actor Space Y
  61. * @desc Definição espaço entre os personagens.
  62. * @default 80
  63. *
  64. * @param Enemy X-Axis
  65. * @desc Definição da posição X-axis do inimigo.
  66. * @default 180  
  67. *
  68. * @param Enemy Y-Axis
  69. * @desc Definição da posição Y-axis do inimigo.
  70. * @default 340
  71. *
  72. * @param Button Layout X
  73. * @desc Definição X-Axis do layout dos botões.
  74. * @default -62
  75. *
  76. * @param Button Layout Y
  77. * @desc Definição Y-Axis do layout dos botões.
  78. * @default 5
  79. *
  80. * @param Button Flash X
  81. * @desc Definição X-Axis do flash.
  82. * @default -140
  83. *
  84. * @param Button Flash Y
  85. * @desc Definição Y-Axis do flash.
  86. * @default -1
  87. *
  88. * @param String X
  89. * @desc Definição X-Axis das palavras dos botões.
  90. * @default 130
  91. *
  92. * @param String Y
  93. * @desc Definição Y-Axis das palavras dos botões.
  94. * @default 0
  95. *
  96. * @param Face X
  97. * @desc Definição X-Axis da face do personagem.
  98. * @default 420
  99. *
  100. * @param Face Y
  101. * @desc Definição Y-Axis da face do personagem.
  102. * @default 5     
  103. *
  104. * @param Enemy HP Gauge X
  105. * @desc Definição X-Axis do HP inimigo.
  106. * @default 17           
  107. *
  108. * @param Enemy HP Gauge Y
  109. * @desc Definição Y-Axis do HP inimigo.
  110. * @default 600
  111. *
  112. * @param Enemy HP Number X
  113. * @desc Definição Y-Axis do HP inimigo.
  114. * @default 280
  115. *
  116. * @param Enemy HP Number Y
  117. * @desc Definição Y-Axis do HP inimigo.
  118. * @default 575
  119. *
  120. * @param Party HP Gauge X
  121. * @desc Definição X-Axis do HP do grupo.
  122. * @default 573
  123. *
  124. * @param Party HP Gauge Y
  125. * @desc Definição Y-Axis do HP do grupo.
  126. * @default 30
  127. *
  128. * @param Party HP Number X
  129. * @desc Definição X-Axis do HP do grupo.
  130. * @default 790
  131. *
  132. * @param Party HP Number Y
  133. * @desc Definição Y-Axis do HP do grupo.
  134. * @default 32
  135. *
  136. * @param Score X
  137. * @desc Definição X-Axis dos pontos.
  138. * @default 300
  139. *
  140. * @param Score Y
  141. * @desc Definição Y-Axis dos pontos.
  142. * @default 10
  143. *
  144. * @param Chain X
  145. * @desc Definição X-Axis do Combo.
  146. * @default 430
  147. *
  148. * @param Chain Y
  149. * @desc Definição Y-Axis do Combo.
  150. * @default 130
  151. *
  152. * @param Chain Number X
  153. * @desc Definição X-Axis do numero do Combo.
  154. * @default 0
  155. *
  156. * @param Chain Number Y
  157. * @desc Definição Y-Axis do numero do Combo.
  158. * @default 20  
  159. *
  160. * @param BP Party X
  161. * @desc Definição X-axis do BP.
  162. * @default 615
  163. *
  164. * @param BP Party Y
  165. * @desc Definição Y-axis do BP.
  166. * @default 95
  167. *
  168. * @param BP Enemy X
  169. * @desc Definição X-axis do BP.
  170. * @default -70
  171. *
  172. * @param BP Enemy Y
  173. * @desc Definição Y-axis do BP.
  174. * @default 515
  175. *
  176. * @param Phase X
  177. * @desc Definição X-axis da fase.
  178. * @default 0
  179. *
  180. * @param Phase Y
  181. * @desc Definição Y-axis da fase.
  182. * @default 192
  183. *
  184. * @param Result X
  185. * @desc Definição X-axis do resultado.
  186. * @default 520
  187. *
  188. * @param Result Y
  189. * @desc Definição Y-axis do resultado.
  190. * @default 240
  191. *
  192. * @param Result Font Size
  193. * @desc Definição do tamanho da fonte.
  194. * @default 28
  195. *
  196. * @param Total X
  197. * @desc Definição X-axis do total.
  198. * @default 200  
  199. *
  200. * @param Total Y
  201. * @desc Definição Y-axis do total.
  202. * @default 330
  203. *
  204. * @param Total Font Size
  205. * @desc Definição do tamanho da fonte.
  206. * @default 32
  207. *
  208. * @param E Name X
  209. * @desc Definição X-axis do nome do inimigo.
  210. * @default 300
  211. *
  212. * @param E Name Y
  213. * @desc Definição X-axis do nome do inimigo.
  214. * @default 575
  215. *
  216. * @param E Name Font Size
  217. * @desc Definição do tamanho da fonte.
  218. * @default 24
  219. *
  220. * @help  
  221. * =============================================================================
  222. * +++ MOG - Theatrhythm (v1.2) +++
  223. * By Moghunter
  224. * [url]https://atelierrgss.wordpress.com/[/url]
  225. * =============================================================================
  226. * Minigame baseado no jogo Final Fantasy Theatrhythm.
  227. * Os pontos ganhos ao final do mini game serão gravados em uma variável onde
  228. * poderão posteriormente ser usados durante o jogo.
  229. * =============================================================================
  230. * É necessário ter as imagens básicas do sistema gravas na pasta:
  231. *
  232. * /img/theatrhythm/
  233. *
  234. * =============================================================================
  235. * Para chamar a cena use o comando abaixo.
  236. *
  237. * theatrhythm : EnemyID : Speed
  238. *
  239. * Exemplo
  240. *
  241. * theatrhythm : 1 : 5
  242. *
  243. * =============================================================================
  244. * Para definir uma animação específica de ataque do inimigo use o comentário
  245. * abaixo na caixa de notas do inimigo.
  246. *
  247. * Theatrhythm Action Animation: X
  248. *
  249. * =============================================================================
  250. * HITSTÓRICO
  251. * =============================================================================
  252. * (v1.2) - Correção do Crash relativo as Tags.
  253. * (v1.1) - Correção de prosseguir os comandos de eventos antes da cena do
  254. *          Theatrhythm terminar.
  255. *        - Adicionado a switch de resultado do minigame.
  256. *
  257. */

  258. //=============================================================================
  259. // ** PLUGIN PARAMETERS
  260. //=============================================================================
  261.   var Imported = Imported || {};
  262.   Imported.MOG_Theatrhythm = true;
  263.   var Moghunter = Moghunter || {};

  264.    Moghunter.parameters = PluginManager.parameters('MOG_Theatrhythm');  
  265.         Moghunter.theatrhythm_variable_id = Number(Moghunter.parameters['Points Variable ID'] || 5);
  266.         Moghunter.theatrhythm_base_score = Number(Moghunter.parameters['Score Base'] || 10);
  267.         Moghunter.theatrhythm_chain_bonus = Number(Moghunter.parameters['Chain Bonus'] || 5);       
  268.         Moghunter.theatrhythm_critical_bonus = Number(Moghunter.parameters['Critical Bonus Percentage'] || 1.5);
  269.         Moghunter.theatrhythm_result_chain_bonus = Number(Moghunter.parameters['Max Chain Bonus Percentage'] || 0.01);                   
  270.         Moghunter.theatrhythm_miss_dmg_per = Number(Moghunter.parameters['Miss Dmg Percentage'] || 0);
  271.         Moghunter.theatrhythm_bp_base_value = Number(Moghunter.parameters['BP Base Value'] || 50);
  272.         Moghunter.theatrhythm_enemy_atk_ani = Number(Moghunter.parameters['Enemy Atk Animation'] || 1);  
  273.     Moghunter.theatrhythm_actor_x = Number(Moghunter.parameters['Actor X-Axis'] || 700);
  274.         Moghunter.theatrhythm_actor_y = Number(Moghunter.parameters['Actor Y-Axis'] || 320);
  275.         Moghunter.theatrhythm_actor_spc_y = Number(Moghunter.parameters['Actor Space Y'] || 80);                       
  276.         Moghunter.theatrhythm_enemy_x = Number(Moghunter.parameters['Enemy X-Axis'] || 180);
  277.         Moghunter.theatrhythm_enemy_y = Number(Moghunter.parameters['Enemy Y-Axis'] || 340);                               
  278.         Moghunter.theatrhythm_button_layout_x = Number(Moghunter.parameters['Button Layout X'] || -62);
  279.         Moghunter.theatrhythm_button_layout_y = Number(Moghunter.parameters['Button Layout Y'] || 5);       
  280.     Moghunter.theatrhythm_button_flash_x = Number(Moghunter.parameters['Button Flash X'] || -140);
  281.     Moghunter.theatrhythm_button_flash_y = Number(Moghunter.parameters['Button Flash Y'] || -1);
  282.     Moghunter.theatrhythm_string_x = Number(Moghunter.parameters['String X'] || 130);
  283.         Moghunter.theatrhythm_string_y = Number(Moghunter.parameters['String Y'] || 0);
  284.     Moghunter.theatrhythm_face_x = Number(Moghunter.parameters['Face X'] || 420);
  285.         Moghunter.theatrhythm_face_y = Number(Moghunter.parameters['Face Y'] || 5);               
  286.         Moghunter.theatrhythm_time_meter_x = Number(Moghunter.parameters['Enemy HP Gauge X'] || 17);
  287.         Moghunter.theatrhythm_time_meter_y = Number(Moghunter.parameters['Enemy HP Gauge Y'] || 600);       
  288.         Moghunter.theatrhythm_enemy_hp_number_x = Number(Moghunter.parameters['Enemy HP Number X'] || 280);
  289.         Moghunter.theatrhythm_enemy_hp_number_y = Number(Moghunter.parameters['Enemy HP Number Y'] || 575);       
  290.         Moghunter.theatrhythm_hp_meter_x = Number(Moghunter.parameters['Party HP Gauge X'] || 573);
  291.         Moghunter.theatrhythm_hp_meter_y = Number(Moghunter.parameters['Party HP Gauge Y'] || 30);               
  292.         Moghunter.theatrhythm_actor_hp_number_x = Number(Moghunter.parameters['Party HP Number X'] || 790);
  293.         Moghunter.theatrhythm_actor_hp_number_y = Number(Moghunter.parameters['Party HP Number Y'] || 32);               
  294.         Moghunter.theatrhythm_score_x = Number(Moghunter.parameters['Score X'] || 300);
  295.         Moghunter.theatrhythm_score_y = Number(Moghunter.parameters['Score Y'] || 10);               
  296.         Moghunter.theatrhythm_chain_x = Number(Moghunter.parameters['Chain X'] || 430);
  297.         Moghunter.theatrhythm_chain_y = Number(Moghunter.parameters['Chain Y'] || 130);                       
  298.         Moghunter.theatrhythm_chain_number_x = Number(Moghunter.parameters['Chain Number X'] || 0);
  299.         Moghunter.theatrhythm_chain_number_y = Number(Moghunter.parameters['Chain Number Y'] || 20);       
  300.         Moghunter.theatrhythm_bp_visible = String(Moghunter.parameters['BP Visible'] || true);       
  301.         Moghunter.theatrhythm_bp_party_x = Number(Moghunter.parameters['BP Party X'] || 615);
  302.     Moghunter.theatrhythm_bp_party_y = Number(Moghunter.parameters['BP Party Y'] || 95);
  303.         Moghunter.theatrhythm_bp_enemy_x = Number(Moghunter.parameters['BP Enemy X'] || -70);
  304.     Moghunter.theatrhythm_bp_enemy_y = Number(Moghunter.parameters['BP Enemy Y'] || 515);               
  305.         Moghunter.theatrhythm_phase_x = Number(Moghunter.parameters['Phase X'] || 0);
  306.         Moghunter.theatrhythm_phase_y = Number(Moghunter.parameters['Phase Y'] || 192);               
  307.         Moghunter.theatrhythm_result_x = Number(Moghunter.parameters['Result X'] || 520);
  308.         Moghunter.theatrhythm_result_y = Number(Moghunter.parameters['Result Y'] || 240);
  309.         Moghunter.theatrhythm_result_font_size = Number(Moghunter.parameters['Result Font Size'] || 28);       
  310.         Moghunter.theatrhythm_result_total_x = Number(Moghunter.parameters['Total X'] || 200);
  311.         Moghunter.theatrhythm_result_total_y = Number(Moghunter.parameters['Total Y'] || 330);
  312.         Moghunter.theatrhythm_result_total_font_size = Number(Moghunter.parameters['Total Font Size'] || 32);
  313.         Moghunter.theatrhythm_name_x = Number(Moghunter.parameters['E Name X'] || 300);
  314.         Moghunter.theatrhythm_name_y = Number(Moghunter.parameters['E Name Y'] || 575);
  315.         Moghunter.theatrhythm_name_font_size = Number(Moghunter.parameters['E Name Font Size'] || 24);
  316.         Moghunter.theatrhythm_result_switch_id = Number(Moghunter.parameters['Result Switch ID'] || 10);
  317.        
  318. //=============================================================================
  319. // ** Load Theatrhythm
  320. //=============================================================================       
  321. ImageManager.loadTheatrhythm = function(filename) {
  322.     return this.loadBitmap('img/theatrhythm/', filename, 0, true);
  323. };

  324. //=============================================================================
  325. // ** Game_Interpreter
  326. //=============================================================================       

  327. //==============================
  328. // * PluginCommand
  329. //==============================
  330. var _alias_mog_Theatrhythm_pluginCommand = Game_Interpreter.prototype.pluginCommand
  331. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  332.         _alias_mog_Theatrhythm_pluginCommand.call(this,command, args)
  333.         if (command === "theatrhythm")  {
  334.                  if (args.length >= 4) {               
  335.                  var enemy_id = Math.min(Math.max(args[1],1),$dataEnemies.length - 1);                 
  336.                      var speed = Math.min(Math.max(args[3],1),20);
  337.                      $gameSystem._theatrhythm_data = [enemy_id,speed];
  338.                          $gameSystem._theatrhythm_start = true;
  339.                          this.wait(10);
  340.             };
  341.     };       
  342.         return true;
  343. };

  344. //=============================================================================
  345. // ** Scene Map
  346. //=============================================================================       

  347. //==============================
  348. // * update
  349. //==============================
  350. var _alias_mog_theatrhythm_scmap_update = Scene_Map.prototype.update
  351. Scene_Map.prototype.update = function() {
  352.         _alias_mog_theatrhythm_scmap_update.call(this);
  353.         if ($gameSystem._theatrhythm_start) {this.execute_theatrhythm()};
  354. };

  355. //==============================
  356. // * execute theatrhythm
  357. //==============================
  358. Scene_Map.prototype.execute_theatrhythm = function() {
  359.                 $gameSystem._theatrhythm_start = false;
  360.                 this.startFadeOut(this.fadeSpeed());
  361.                 $gameSystem.theatrhythm();
  362. };

  363. //=============================================================================
  364. // ** Scene_System
  365. //=============================================================================       

  366. //==============================
  367. // * Theatrhythm
  368. //==============================
  369. var _alias_mog_theatrhythm_gsy_initialize = Game_System.prototype.initialize
  370. Game_System.prototype.initialize = function() {
  371.     _alias_mog_theatrhythm_gsy_initialize.call(this);       
  372.         this._theatrhythm = false;
  373.         this._theatrhythm_start = false;
  374.         this._theatrhythm_data = [1,1];
  375.         this._theatrhythm_phase = 0;
  376.         this._theatrhythm_miss_dmg = false;
  377.         this._theatrhythm_key_data = [null,0,0,0];
  378.         this._theatrhythm_chain_data = [0,0];
  379.         this._theatrhythm_score_data = [0,0];               
  380.         Input.keyMapper[65] = 'a';
  381.     Input.keyMapper[83] = 's';
  382. };

  383. //==============================
  384. // * Theatrhythm
  385. //==============================
  386. Game_System.prototype.theatrhythm = function() {
  387.         if ($gameParty.battleMembers().length === 0) {return};
  388.     SceneManager.push(Scene_Theatrhythm);
  389. };

  390. //=============================================================================
  391. // ** Game Battler
  392. //=============================================================================       

  393. //==============================
  394. // * Notetags
  395. //==============================
  396. Game_Battler.prototype.notetags = function() {
  397.         if (this.isEnemy()) {return this.enemy().note.split(/[\r\n]+/)};
  398.         if (this.isActor()) {return this.actor().note.split(/[\r\n]+/)};
  399. };

  400. //==============================
  401. // ** iniMembers
  402. //==============================
  403. var _alias_mog_theatrhythm_gbattler_initMembers = Game_Battler.prototype.initMembers;
  404. Game_Battler.prototype.initMembers = function() {
  405.         _alias_mog_theatrhythm_gbattler_initMembers.call(this);
  406.         this._motion_damage_duration = 0;
  407.         this._motion_damage_xy = [0,0];
  408.         this._theatrhythm_ani_id = Math.max(Moghunter.theatrhythm_enemy_atk_ani,1);
  409.         this.clear_action_data();
  410. };

  411. //==============================
  412. // ** Clear Action Data
  413. //==============================
  414. Game_Battler.prototype.clear_action_data = function() {
  415.         this._motion_action_data = [0,0,0,0];
  416.         this._motion_action_xy = [0,0];
  417.         this._motion_action_scale = [0,0];
  418.         this._motion_action_rotation = 0;
  419. };
  420. //==============================
  421. // ** Motion Shake
  422. //==============================
  423. Game_Battler.prototype.motion_shake = function() {
  424.         this._motion_damage_duration = 30;
  425. };

  426. //=============================================================================
  427. // ** Game Actor
  428. //=============================================================================       

  429. //==============================
  430. // * isSpriteVisible
  431. //==============================
  432. Game_Actor.prototype.isSpriteVisible = function() {
  433.         if ($gameSystem._theatrhythm) {return true};
  434.    return $gameSystem.isSideView();
  435. };

  436. //=============================================================================
  437. // ** Game Enemy
  438. //=============================================================================       

  439. //==============================
  440. // * Setup
  441. //==============================
  442. var _alias_mog_theatrhythm_setup = Game_Enemy.prototype.setup;
  443. Game_Enemy.prototype.setup = function(enemyId, x, y) {
  444.         _alias_mog_theatrhythm_setup.call(this,enemyId, x, y);
  445.     this.notetags().forEach(function(note) {
  446.          var note_data = note.split(': ')
  447.                  if (note_data[0].toLowerCase() == "theatrhythm action animation"){
  448.                          var par = note_data[1].split(':');
  449.                      this._theatrhythm_ani_id = Number(par[0]);
  450.                  };
  451.         },this);
  452. };

  453. //=============================================================================
  454. // ** Sprite Battler
  455. //=============================================================================       

  456. //==============================
  457. // * Update Position
  458. //==============================
  459. var _alias_mog_theatrhythm_sprbtr_updatePosition = Sprite_Battler.prototype.updatePosition;
  460. Sprite_Battler.prototype.updatePosition = function() {
  461.         _alias_mog_theatrhythm_sprbtr_updatePosition.call(this);
  462.         if ( $gameSystem._theatrhythm) {this.update_theatrhythm()};
  463. };

  464. //==============================
  465. // * Update Position
  466. //==============================
  467. Sprite_Battler.prototype.update_theatrhythm = function() {               
  468.         if (!Imported.MOG_BattlerMotion) {
  469.                 if (this._battler) {
  470.                         if (this._battler._motion_damage_duration > 0) {this.update_motion_damage()};
  471.                         if (this._battler._motion_action_data[0] === 7) {this.update_action_move_right();};
  472.                         this.x += this._battler._motion_action_xy[0];
  473.                         this.y += this._battler._motion_action_xy[1];
  474.             };
  475.         };
  476.         if (this._battler.isEnemy() && $gameSystem._theatrhythm_phase === 10) {this.opacity -= 5}
  477. };

  478. //==============================
  479. // * Update Motion Damage
  480. //==============================
  481. Sprite_Battler.prototype.update_motion_damage = function() {
  482.          this._battler._motion_damage_xy[0] = (Math.random() * 12) - 6;
  483.          this._battler._motion_damage_duration -= 1;
  484.          if (this._battler._motion_damage_duration <= 0) {this._battler._motion_damage_xy = [0,0]};
  485.          this.x += this._battler._motion_damage_xy[0];
  486. };

  487. //==============================
  488. // * Update Move Right
  489. //==============================
  490. Sprite_Battler.prototype.update_action_move_right = function() {
  491.       this._battler._motion_action_data[1] += 1
  492.           if (this._battler._motion_action_data[1] < 15) {
  493.                   this._battler._motion_action_xy[0] += 6;
  494.           }       
  495.           else if (this._battler._motion_action_data[1] < 30) {        
  496.                   this._battler._motion_action_xy[0] -= 6;
  497.           }
  498.           else {
  499.               this._battler.clear_action_data();
  500.       };
  501. };

  502. //=============================================================================
  503. // ** Scene_Theatrhythm
  504. //=============================================================================       
  505. function Scene_Theatrhythm() {
  506.     this.initialize.apply(this, arguments);
  507. }

  508. Scene_Theatrhythm.prototype = Object.create(Scene_Base.prototype);
  509. Scene_Theatrhythm.prototype.constructor = Scene_Theatrhythm;

  510. //==============================
  511. // * Initialize
  512. //==============================
  513. Scene_Theatrhythm.prototype.initialize = function() {
  514.     Scene_Base.prototype.initialize.call(this);       
  515.         $gameSystem._theatrhythm = true;
  516.         $gameSystem._theatrhythm_phase = 0;
  517.         $gameSystem._theatrhythm_miss_dmg = false;
  518.         $gameSystem._theatrhythm_key_data = [null,0,0,0];
  519.         $gameSystem._theatrhythm_chain_data[0] = 0;
  520.         $gameSystem._theatrhythm_score_data[0] = 0;
  521.         this._result_data = [0,0];
  522.         BattleManager.saveBgmAndBgs();
  523.         AudioManager.fadeOutBgm(2);
  524.         AudioManager.stopBgs();
  525.         $gameSwitches._data[Moghunter.theatrhythm_result_switch_id] = false;
  526.         if (!$gameVariables._data[Moghunter.theatrhythm_variable_id]) {
  527.              $gameVariables._data[Moghunter.theatrhythm_variable_id] = 0;
  528.         };
  529.         this._battlers = $gameParty.battleMembers()
  530.         for (var i = 0; i <  $gameParty.battleMembers().length; i++) {$gameParty.battleMembers()[i].recoverAll();};
  531.         this._time = [0,3000];
  532.         this._score = [-1,0,0];
  533.         this._chain_dt = [0,0];       
  534.         this._wait_time = 0;
  535.         this._phase = [0,0,0];
  536.         this._target_id = 0;
  537.         this._enemy_ref = false;
  538.     this.createDisplayObjects();
  539.         this.set_battler_parameters();
  540.         this.startFadeIn(60, false);
  541. };

  542. //==============================
  543. // * Set Battler Parameters
  544. //==============================
  545. Scene_Theatrhythm.prototype.set_battler_parameters = function() {
  546.         this._enemy_hp = [this._enemy.hp,this._enemy.hp]
  547.         this._enemy_atk = this._enemy.atk + this._enemy.mat;
  548.         this._enemy_def = (this._enemy.def + this._enemy.mdf) / 2;
  549.         this._enemy_bp = Math.floor(((this._enemy_hp[0] / 30) + this._enemy_atk + this._enemy_def) / 3)
  550.         this._enemy_bp *= Moghunter.theatrhythm_bp_base_value;
  551.         this._party_hp = [0,0];
  552.         this._party_atk = 0;
  553.         this._party_def = 0;
  554.         for (var i = 0; i < this._battlers.length; i++) {
  555.                  this._party_hp[0] += this._battlers[i].hp;
  556.                  this._party_hp[1] += this._battlers[i].mhp;
  557.                  this._party_atk += this._battlers[i].atk;
  558.                  this._party_atk += this._battlers[i].mat;
  559.                  this._party_def += this._battlers[i].def / 2;
  560.                  this._party_def += this._battlers[i].mdf / 2;
  561.         };
  562.         this._party_hp[0] /= this._battlers.length;
  563.         this._party_hp[1] /= this._battlers.length;
  564.         this._party_atk /= this._battlers.length;
  565.         this._party_def /= this._battlers.length;
  566.         this._party_bp = Math.floor(((this._party_hp[0] / 10) + this._party_atk + this._party_def) / 3)
  567.         this._party_bp *= Moghunter.theatrhythm_bp_base_value;
  568. };

  569. //==============================
  570. // * Load Images
  571. //==============================
  572. Scene_Theatrhythm.prototype.load_images = function() {
  573.          this._buttons_img = ImageManager.loadTheatrhythm("Theatrhythm_A");       
  574.          this._layout_buttons_img = ImageManager.loadTheatrhythm("Theatrhythm_B");
  575.      this._layout_buttons_img2 = ImageManager.loadTheatrhythm("Theatrhythm_C");
  576.          this._string_img = ImageManager.loadTheatrhythm("Theatrhythm_D");
  577.          this._layout_img = ImageManager.loadTheatrhythm("Theatrhythm_E");
  578.          this._time_meter_img = ImageManager.loadTheatrhythm("Theatrhythm_F");
  579.          this._hp_meter_img = ImageManager.loadTheatrhythm("Theatrhythm_G");
  580.          this._score_img = ImageManager.loadTheatrhythm("Theatrhythm_H");
  581.          this._chain_img = ImageManager.loadTheatrhythm("Theatrhythm_I");
  582.          this._chain_number_img = ImageManager.loadTheatrhythm("Theatrhythm_J");
  583.          this._hp_number_1_img = ImageManager.loadTheatrhythm("Theatrhythm_L");
  584.          this._phase_img = ImageManager.loadTheatrhythm("Theatrhythm_M");
  585.          this._damage_img = ImageManager.loadTheatrhythm("Theatrhythm_N");
  586. };

  587. //==============================
  588. // * CreateDisplayObjects
  589. //==============================
  590. Scene_Theatrhythm.prototype.createDisplayObjects = function() {
  591.         this.load_images();
  592.         this._spriteField = new Sprite();       
  593.         this.addChild(this._spriteField);
  594.         this._spriteHudBase = new Sprite();
  595.         this.addChild(this._spriteHudBase);
  596.     this.createScenario();
  597.         this.createActors();
  598.         this.createEnemy();
  599.         this.createLayoutBase();
  600.         this.createLayoutButtons();       
  601.         this.createLayout();
  602.         this.createFace();
  603.         this.createTimeMeter();
  604.         this.createEnemyHpNumber();
  605.         this.createHpMeter();
  606.         this.createActorHpNumber();
  607.         this.createEnemyName();
  608.         this.createScore();
  609.         this.createChain();
  610.         this.createBattlePower();
  611.         this.createDamage();
  612.         this.createPhaseSprite();
  613.         this.createText();
  614. };

  615. //==============================
  616. // * createLayout
  617. //==============================
  618. Scene_Theatrhythm.prototype.createLayout = function() {       
  619.      this._layout = new Sprite(this._layout_img);
  620.          this._spriteHudBase.addChild(this._layout);       
  621. };

  622. //==============================
  623. // * createPhaseSprite
  624. //==============================
  625. Scene_Theatrhythm.prototype.createPhaseSprite = function() {       
  626.      this._phase_sprite_data = [-1,-1]
  627.      this._phase_sprite = new Sprite(this._phase_img);
  628.          this._phase_sprite.x = Moghunter.theatrhythm_phase_x;
  629.          this._phase_sprite.y = Moghunter.theatrhythm_phase_y;
  630.          this._phase_sprite.anchor.x = 0.5;
  631.          this._phase_sprite.anchor.y = 0.5;
  632.          this._phase_sprite.opacity = 0;
  633.          this.refresh_phase_sprite(0);
  634.          this._spriteHudBase.addChild(this._phase_sprite);       
  635. };

  636. //==============================
  637. // * Refresh Phase Sprite
  638. //==============================
  639. Scene_Theatrhythm.prototype.refresh_phase_sprite = function(type) {
  640.          this._phase_sprite.opacity = 0;
  641.          this._phase_sprite.scale.x = 2;
  642.          this._phase_sprite.scale.y = 2;
  643.          this._phase_sprite.setFrame(0,type * this._phase_sprite_data[1],this._phase_sprite_data[0],this._phase_sprite_data[1]);
  644. };

  645. //==============================
  646. // * createText
  647. //==============================
  648. Scene_Theatrhythm.prototype.createText = function() {       
  649.      this._text_sprite = new Sprite(new Bitmap(200,160));
  650.          this._text_sprite.anchor.x = 0.5;
  651.          this._text_sprite.anchor.y = 0.5;
  652.          this._text_sprite.x = Moghunter.theatrhythm_result_x + 100;
  653.          this._text_sprite.y = Moghunter.theatrhythm_result_y + 50;
  654.          this._text_sprite.bitmap.fontSize = Moghunter.theatrhythm_result_font_size;
  655.          this._spriteHudBase.addChild(this._text_sprite);
  656.      this._text2_sprite = new Sprite(new Bitmap(200,100));
  657.          this._text2_sprite.anchor.x = 0.5;
  658.          this._text2_sprite.anchor.y = 0.5;
  659.          this._text2_sprite.x = Moghunter.theatrhythm_result_total_x + 100;
  660.          this._text2_sprite.y = Moghunter.theatrhythm_result_total_y + 50;
  661.          this._text2_sprite.bitmap.fontSize = Moghunter.theatrhythm_result_total_font_size;
  662.          this._spriteHudBase.addChild(this._text2_sprite);                 
  663. };

  664. //==============================
  665. // * createBattlePower
  666. //==============================
  667. Scene_Theatrhythm.prototype.createBattlePower = function() {       
  668.     this._bp_visible = false;
  669.     if (Moghunter.theatrhythm_bp_visible === "true") {this._bp_visible = true};
  670.     this._battlePower = [];
  671.         for (var i = 0; i < 2; i++) {
  672.                  this._battlePower[i] = new Sprite(new Bitmap(250,32));                 
  673.                  this._battlePower[i].bitmap.fontSize = 20;
  674.                  this._spriteHudBase.addChild(this._battlePower[i]);
  675.         };
  676.         this._battlePower[0].x = Moghunter.theatrhythm_bp_enemy_x;
  677.         this._battlePower[0].y = Moghunter.theatrhythm_bp_enemy_y;
  678.         this._battlePower[1].x = Moghunter.theatrhythm_bp_party_x;
  679.         this._battlePower[1].y = Moghunter.theatrhythm_bp_party_y;
  680. };

  681. //==============================
  682. // * createEnemyName
  683. //==============================
  684. Scene_Theatrhythm.prototype.createEnemyName = function() {       
  685.     this._enemyName = new Sprite(new Bitmap(200,32))
  686.         this._enemyName.x = Moghunter.theatrhythm_name_x;
  687.         this._enemyName.y = Moghunter.theatrhythm_name_y;
  688.         this._enemyName.bitmap.fontSize = Moghunter.theatrhythm_name_font_size;
  689.         this._enemyName.bitmap.drawText(this._enemySprite._enemy.name(),0,0,200,32,"left")
  690.         this._spriteHudBase.addChild(this._enemyName);
  691. };

  692. //==============================
  693. // * createScore
  694. //==============================
  695. Scene_Theatrhythm.prototype.createScore = function() {       
  696.      this._point = [];
  697.          this._point_data = [-1,-1];
  698.      for (var i = 0; i < 7; i++) {
  699.            this._point[i] = new Sprite(this._score_img);
  700.            this._point[i].visible = false;
  701.            this._point[i].y = Moghunter.theatrhythm_score_y;
  702.            this._spriteHudBase.addChild(this._point[i]);
  703.          };
  704. };

  705. //==============================
  706. // * Update Dif
  707. //==============================
  708. Scene_Theatrhythm.prototype.update_dif = function(value,real_value,speed) {
  709.         if (value == real_value) {return value};
  710.         var dnspeed = 1 + (Math.abs(value - real_value) / speed);
  711.         if (value > real_value) {value -= dnspeed;
  712.             if (value < real_value) {value = real_value};}
  713.     else if (value < real_value) {value  += dnspeed;
  714.             if (value  > real_value) {value  = real_value};               
  715.     };
  716.         return Math.floor(value);
  717. };

  718. //==============================
  719. // * Refresh Number
  720. //==============================
  721. Scene_Theatrhythm.prototype.refresh_number = function(sprites,value,img_data,x) {
  722.         if (value > 9999999) {value = 9999999};
  723.     numbers = Math.abs(value).toString().split("");  
  724.            for (var i = 0; i < sprites.length ; i++) {sprites[i].visible = false;
  725.            sprites[i].visible = true;
  726.            if (i < numbers.length) {
  727.                    var n = Number(numbers[i]);
  728.                    sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
  729.                    var nx = -(img_data[0] * i) + (img_data[0] *  numbers.length);
  730.                    sprites[i].x = x - nx;
  731.            } else {
  732.                   var n = 0;
  733.                   sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
  734.                   var nx = -(img_data[0] * i) + (img_data[0] *  (sprites.length + numbers.length));
  735.                   sprites[i].x = x - nx;
  736.            };
  737.     };
  738. };

  739. //==============================
  740. // * Update Score
  741. //==============================
  742. Scene_Theatrhythm.prototype.update_score = function() {       
  743.         var dif_number = this.update_dif(this._score[0],this._score[1],20)
  744.         if (this._score[0] != dif_number) {this._score[0] = dif_number;
  745.         this.refresh_number(this._point,this._score[0] ,this._point_data,this._point_data[2]);};
  746. };

  747. //==============================
  748. // * createEnemyHPNumber
  749. //==============================
  750. Scene_Theatrhythm.prototype.createEnemyHpNumber = function() {       
  751.      this._enemyHp_Old = 0;
  752.      this._enemyHpNumber = [];
  753.          this._enemyHpNumber_data = [-1,-1];
  754.      for (var i = 0; i < 6; i++) {
  755.            this._enemyHpNumber[i] = new Sprite(this._hp_number_1_img);
  756.            this._enemyHpNumber[i].visible = false;
  757.            this._enemyHpNumber[i].x = Moghunter.theatrhythm_enemy_hp_number_x;
  758.            this._enemyHpNumber[i].y = Moghunter.theatrhythm_enemy_hp_number_y;
  759.            this._spriteHudBase.addChild(this._enemyHpNumber[i]);
  760.          };
  761. };

  762. //==============================
  763. // * Update EnemyHpNumber
  764. //==============================
  765. Scene_Theatrhythm.prototype.update_enemyHpNumber = function() {       
  766.         var dif_number = this.update_dif(this._enemyHp_Old,this._enemy_hp[0],20)
  767.         if (this._enemyHp_Old != dif_number) {this._enemyHp_Old = dif_number;
  768.         this.refresh_number(this._enemyHpNumber,this._enemyHp_Old ,this._enemyHpNumber_data,this._enemyHpNumber_data[2]);};
  769. };

  770. //==============================
  771. // * createDamage
  772. //==============================
  773. Scene_Theatrhythm.prototype.createDamage = function() {
  774.      this._damages = [[],[]];
  775.          this._damage_data = [-1,-1];
  776.      for (var i = 0; i < 2; i++) {
  777.            for (var n = 0; n < 4; n++) {
  778.               this._damages[i][n] = new Sprite(this._damage_img);
  779.               this._damages[i][n].visible = false;       
  780.           this._spriteHudBase.addChild(this._damages[i][n]);
  781.            };
  782.          };
  783. };

  784. //==============================
  785. // * Refresh Damage
  786. //==============================
  787. Scene_Theatrhythm.prototype.refresh_damage = function(i,value) {
  788.         if (value > 9999) {value = 9999};
  789.         if (i === 1 && this._party_hp <= 0) {return};
  790.         if (i === 1 && !this._actorSprites[this._target_id]) {return};
  791.     numbers = Math.abs(value).toString().split("");         
  792.         for (var r = 0; r < this._damages[i].length; r++) {
  793.             this._damages[i][r].visible = false;
  794.             if (r >= numbers.length) {return};
  795.                 this._damages[i][r].visible = true;
  796.                 this._damages[i][r].opacity = 255;
  797.                 var n = Number(numbers[r]);
  798.                 this._damages[i][r].setFrame(n * this._damage_data[0], 0, this._damage_data[0], this._damage_data[1]);
  799.                 var nx = -(this._damage_data[0] * r) + ((this._damage_data[0]  / 2) *  numbers.length);
  800.                 if (i === 0) {
  801.                     this._damages[i][r].x = this._enemySprite.x - nx;               
  802.                     this._damages[i][r].y = this._enemySprite.y - (this._enemySprite.bitmap.height / 2);
  803.                 } else {       
  804.                         this._damages[i][r].x = this._actorSprites[this._target_id].x - nx;
  805.                         this._damages[i][r].y = this._actorSprites[this._target_id].y - 24;
  806.                 };
  807.         };
  808. };

  809. //==============================
  810. // * Update Damage
  811. //==============================
  812. Scene_Theatrhythm.prototype.update_damage = function(i,value) {
  813.          for (var i = 0; i < 2; i++) {
  814.            for (var n = 0; n < 4; n++) {
  815.               if (this._damages[i][n].opacity > 0) {
  816.                    this._damages[i][n].opacity -= 3;
  817.                       this._damages[i][n].y -= 2;
  818.                   };
  819.            };
  820.          };
  821. };

  822. //==============================
  823. // * createActorHPNumber
  824. //==============================
  825. Scene_Theatrhythm.prototype.createActorHpNumber = function() {       
  826.      this._actorHp_Old = 0;
  827.      this._actorHpNumber = [];
  828.          this._actorHpNumber_data = [-1,-1];
  829.      for (var i = 0; i < 5; i++) {
  830.            this._actorHpNumber[i] = new Sprite(this._hp_number_1_img);
  831.            this._enemyHpNumber[i].visible = false;
  832.            this._actorHpNumber[i].x = Moghunter.theatrhythm_actor_hp_number_x;
  833.            this._actorHpNumber[i].y = Moghunter.theatrhythm_actor_hp_number_y;
  834.            this._spriteHudBase.addChild(this._actorHpNumber[i]);
  835.          };
  836. };

  837. //==============================
  838. // * Update ActorHpNumber
  839. //==============================
  840. Scene_Theatrhythm.prototype.update_actorHpNumber = function() {
  841.         var dif_number = this.update_dif(this._actorHp_Old,this._party_hp[0],20)
  842.         if (this._actorHp_Old != dif_number) {this._actorHp_Old = dif_number;
  843.         this.refresh_number(this._actorHpNumber,this._actorHp_Old ,this._actorHpNumber_data,this._actorHpNumber_data[2]);};
  844. };

  845. //==============================
  846. // * createLayout
  847. //==============================
  848. Scene_Theatrhythm.prototype.createChain = function() {       
  849.      this._chain = new Sprite(this._chain_img);
  850.          this._chain_data = [-1,-1];
  851.          this._chain.x = Moghunter.theatrhythm_chain_x;
  852.          this._chain.y = Moghunter.theatrhythm_chain_y;
  853.          this._chain.anchor.x = 0.5;
  854.          this._chain.anchor.y = 0.5;
  855.          this._chain.opacity = 0;
  856.          this._spriteHudBase.addChild(this._chain);
  857.          this._chain_number = [];
  858.          this._chain_number_data = [-1,-1];
  859.          for (var i = 0; i < 3; i++) {
  860.                   this._chain_number[i] = new Sprite(this._chain_number_img);
  861.                   this._chain_number[i].anchor.x = 0.5;
  862.                   this._chain_number[i].anchor.y = 0.5;                 
  863.                   this._chain_number[i].opacity = 0;
  864.                   this._spriteHudBase.addChild(this._chain_number[i]);
  865.          };
  866. };

  867. //==============================
  868. // * Refresh Chain
  869. //==============================
  870. Scene_Theatrhythm.prototype.refresh_chain = function(sprites,value,img_data,x) {
  871.         if (value > 999) {value = 999};
  872.         this._chain_dt[0] = value;
  873.         if (this._chain_dt[0] > this._chain_dt[1]) {this._chain_dt[1] = this._chain_dt[0]};
  874.     numbers = Math.abs(value).toString().split("");  
  875.            for (var i = 0; i < sprites.length ; i++) {sprites[i].visible = false;
  876.            if (i < numbers.length) {
  877.                    sprites[i].visible = true;
  878.                    sprites[i].opacity = 255;
  879.                    var n = Number(numbers[i]);
  880.                    sprites[i].setFrame(n * img_data[0], 0, img_data[0], img_data[1]);
  881.                    var nx = -(img_data[0] * i) + (img_data[0] *  numbers.length);
  882.                    sprites[i].x = (x - nx)
  883.            };
  884.     };
  885. };

  886. //==============================
  887. // * Update Chain
  888. //==============================
  889. Scene_Theatrhythm.prototype.update_chain = function() {
  890.          if (this._chain_dt[0]  != $gameSystem._theatrhythm_chain_data[0])        {
  891.                  this._chain_dt[0] = $gameSystem._theatrhythm_chain_data[0];
  892.                  if (this._chain_dt[0] > 0) {
  893.                          this._chain.scale.x = 2.0;
  894.                          this._chain.scale.y = this._chain.scale.x;
  895.                          this._chain.opacity = 255;
  896.              this.refresh_chain(this._chain_number,this._chain_dt[0],this._chain_number_data,this._chain_number_data[2]);
  897.                  };
  898.          };
  899.           if (this._chain_dt[0] === 0 || $gameSystem._theatrhythm_phase != 1) {this._chain.opacity -= 15};
  900.           if (this._chain.scale.x > 1.00) {this._chain.scale.x -= 0.1};         
  901.           this._chain.scale.y = this._chain.scale.x;
  902.       for (var i = 0; i < this._chain_number.length ; i++) {
  903.              this._chain_number[i].opacity = this._chain.opacity;
  904.                  this._chain_number[i].scale.x = this._chain.scale.x;
  905.                  this._chain_number[i].scale.y = this._chain_number[i].scale.x;
  906.           };
  907. };

  908. //==============================
  909. // * createTimeMeter
  910. //==============================
  911. Scene_Theatrhythm.prototype.createHpMeter = function() {       
  912.      this._hp_meter = new Sprite(this._hp_meter_img);
  913.          this._hp_meter_data = [-1,-1,0,0];
  914.          this._hp_meter.x = Moghunter.theatrhythm_hp_meter_x;
  915.          this._hp_meter.y = Moghunter.theatrhythm_hp_meter_y;
  916.          this._hp_meter.visible = false;
  917.          this._spriteHudBase.addChild(this._hp_meter);       
  918. };

  919. //==============================
  920. // * createTimeMeter
  921. //==============================
  922. Scene_Theatrhythm.prototype.update_hp_meter = function() {
  923.         this._hp_meter_data[2] += 3;
  924.         if (this._hp_meter_data[2]  > this._hp_meter_data[3]) {this._hp_meter_data[2] = 0};
  925.     var meter_rate = this._hp_meter_data[0] * this._party_hp[0] / this._party_hp[1];
  926.         this._hp_meter.setFrame(this._hp_meter_data[2],0, meter_rate, this._hp_meter_data[1]);
  927. };

  928. //==============================
  929. // * createTimeMeter
  930. //==============================
  931. Scene_Theatrhythm.prototype.createTimeMeter = function() {       
  932.      this._meter = new Sprite(this._time_meter_img);
  933.          this._meter_data = [-1,-1,0,0];
  934.          this._meter.x = Moghunter.theatrhythm_time_meter_x;
  935.          this._meter.y = Moghunter.theatrhythm_time_meter_y;
  936.          this._meter.visible = false;
  937.          this._spriteHudBase.addChild(this._meter);       
  938. };

  939. //==============================
  940. // * createTimeMeter
  941. //==============================
  942. Scene_Theatrhythm.prototype.update_time_meter = function() {
  943.         this._meter_data[2] += 15;
  944.         if (this._meter_data[2]  > this._meter_data[3]) {this._meter_data[2] = 0};
  945.     var meter_rate = this._meter_data[0] * this._enemy_hp[0] / this._enemy_hp[1];
  946.         this._meter.setFrame(this._meter_data[2],0, meter_rate, this._meter_data[1]);
  947. };
  948.        
  949. //==============================
  950. // * createFace
  951. //==============================
  952. Scene_Theatrhythm.prototype.createFace = function() {       
  953.      this._face_img = ImageManager.loadFace(this._battlers[0].faceName())
  954.      this._face = new Sprite(this._face_img);
  955.          this._face.x = Moghunter.theatrhythm_face_x;
  956.          this._face.y = Moghunter.theatrhythm_face_y;
  957.      var pw = Window_Base._faceWidth;
  958.      var ph = Window_Base._faceHeight;       
  959.      var sx = this._battlers[0].faceIndex() % 4 * pw;
  960.      var sy = Math.floor(this._battlers[0].faceIndex() / 4) * ph;         
  961.          this._face.setFrame(sx,sy,pw,ph);
  962.          this._face.scale.x = 64 / Window_Base._faceWidth;
  963.          this._face.scale.y = this._face.scale.x;
  964.          this._spriteHudBase.addChild(this._face);
  965. };

  966. //==============================
  967. // * createStrings
  968. //==============================
  969. Scene_Theatrhythm.prototype.createStrings = function() {                 
  970.          this._strings = [];
  971.          this._strings_data =  [this._string_img.width,this._string_img.height / 3];
  972.          for (var i = 0; i < this._layout_buttons2.length; i++) {
  973.                   this._strings[i] = new Sprite(this._string_img);
  974.                   this._strings[i].x = this._layout_buttons2[i].x + Moghunter.theatrhythm_string_x;
  975.                   this._strings[i].y = this._layout_buttons2[i].y + Moghunter.theatrhythm_string_y;
  976.                   this._strings[i].anchor.x = 0.5;
  977.                   this._strings[i].anchor.y = 0.5;
  978.                   this._spriteHudBase.addChild(this._strings[i]);       
  979.                   this.refresh_string(i,-1);
  980.          };
  981. };
  982.          
  983. //==============================
  984. // * refresh String
  985. //==============================
  986. Scene_Theatrhythm.prototype.refresh_string = function(i,type) {       
  987.        this._strings[i].opacity = 255;
  988.            this._strings[i].scale.x = 1.00;
  989.            this._strings[i].scale.y = 1.00;
  990.        this._strings[i].setFrame(0,this._strings_data[1] * type,this._strings_data[0],this._strings_data[1])
  991. };
  992.          
  993. //==============================
  994. // * createLayoutBase
  995. //==============================
  996. Scene_Theatrhythm.prototype.createLayoutBase = function() {
  997.      this._layoutBase = new Sprite();
  998.          this._spriteHudBase.addChild(this._layoutBase);
  999. };

  1000. //==============================
  1001. // * createLayoutButtons
  1002. //==============================
  1003. Scene_Theatrhythm.prototype.createLayoutButtons = function() {
  1004.          this._buttons_position = [[],[],[],[]];
  1005.      this._layout_buttons = [];
  1006.          this._layout_buttons2 = [];
  1007.          this._layout_buttons_data = [-1,-1,-1,-1]
  1008.      for (var i = 0; i < this._actorSprites.length; i++) {
  1009.          this._layout_buttons[i] = new Sprite(this._layout_buttons_img2);
  1010.                  this._layout_buttons[i].anchor.x = 0.5;
  1011.                  this._layout_buttons[i].anchor.y = 0.5;
  1012.                  this._layout_buttons[i].blendMode = 1;
  1013.                  this._layout_buttons[i].opacity = 0;
  1014.                  this._layout_buttons[i].visible = false;
  1015.              this._spriteHudBase.addChild(this._layout_buttons[i]);
  1016.          this._layout_buttons2[i] = new Sprite(this._layout_buttons_img);
  1017.                  this._layout_buttons2[i].anchor.x = 0.5;
  1018.                  this._layout_buttons2[i].anchor.y = 0.5;
  1019.                  this._layout_buttons2[i].opacity = 0;
  1020.                  this._layout_buttons2[i].visible = false;
  1021.              this._spriteHudBase.addChild(this._layout_buttons2[i]);                 
  1022.          };
  1023. };

  1024. //==============================
  1025. // * createLayoutButtons
  1026. //==============================
  1027. Scene_Theatrhythm.prototype.update_layout_buttons = function() {
  1028.     for (var i = 0; i < this._layout_buttons.length; i++) {
  1029.        if ($gameSystem._theatrhythm_phase != 1) {this._layout_buttons2[i].opacity -= 10;
  1030.            } else {this._layout_buttons2[i].opacity += 10};
  1031.         };
  1032. };

  1033. //==============================
  1034. // * createLayoutButtons
  1035. //==============================
  1036. Scene_Theatrhythm.prototype.createButtons = function() {
  1037.      this._sprite_buttons = new Sprite_TKeys(this._buttons_img,this._buttons_position);
  1038.          this._spriteHudBase.addChild(this._sprite_buttons);
  1039. };

  1040. //==============================
  1041. // * getSpriteData
  1042. //==============================
  1043. Scene_Theatrhythm.prototype.getSpriteData = function() {
  1044.           this._layout_buttons_data[0] = this._layout_buttons_img.width / 2;
  1045.           this._layout_buttons_data[1] = this._layout_buttons_img.height / 2;
  1046.           this._layout_buttons_data[2] = Moghunter.theatrhythm_actor_x + Moghunter.theatrhythm_button_layout_x - this._layout_buttons_data[0];
  1047.           this._layout_buttons_data[3] = Moghunter.theatrhythm_actor_y + Moghunter.theatrhythm_button_layout_y - this._layout_buttons_data[1];
  1048.           for (var i = 0; i < this._layout_buttons.length; i++) {
  1049.              this._layout_buttons[i].x = this._layout_buttons_data[2] + Moghunter.theatrhythm_button_flash_x;
  1050.              this._layout_buttons[i].y = this._layout_buttons_data[3]  + (Moghunter.theatrhythm_actor_spc_y * i) + Moghunter.theatrhythm_button_flash_y;
  1051.                  this._layout_buttons[i].visible = true;
  1052.              this._layout_buttons2[i].x = this._layout_buttons_data[2];
  1053.              this._layout_buttons2[i].y = this._layout_buttons_data[3]  + (Moghunter.theatrhythm_actor_spc_y * i);
  1054.                  this._layout_buttons2[i].visible = true;                 
  1055.                  
  1056.                  this._buttons_position[i] = [this._layout_buttons2[i].x,this._layout_buttons2[i].y]
  1057.           };
  1058.       this._meter_data = [this._meter.bitmap.width / 3,this._meter.bitmap.height,0,(this._meter.bitmap.width / 3) * 2];
  1059.           this._meter.visible = true;
  1060.       this._hp_meter_data = [this._hp_meter.bitmap.width / 3,this._hp_meter.bitmap.height,0,(this._hp_meter.bitmap.width / 3) * 2];
  1061.           this._hp_meter.visible = true;
  1062.       this._point_data = [this._score_img.width / 10,this._score_img.height,Moghunter.theatrhythm_score_x];
  1063.           this._enemyHpNumber_data = [this._hp_number_1_img.width / 10,this._hp_number_1_img.height,Moghunter.theatrhythm_enemy_hp_number_x];
  1064.           this._actorHpNumber_data = [this._hp_number_1_img.width / 10,this._hp_number_1_img.height,Moghunter.theatrhythm_actor_hp_number_x];
  1065.           this._chain_data = [this._chain_img.width,this._chain_img.height];          
  1066.           this._chain.x = Moghunter.theatrhythm_chain_x + this._chain_data[0] / 2;
  1067.           this._chain.y = Moghunter.theatrhythm_chain_y + this._chain_data[1] / 2;
  1068.       this._chain_number_data = [this._chain_number_img.width / 10, this._chain_number_img.height,
  1069.       Moghunter.theatrhythm_chain_x + Moghunter.theatrhythm_chain_number_x,Moghunter.theatrhythm_chain_y + Moghunter.theatrhythm_chain_number_y];          
  1070.           for (var i = 0; i < this._chain_number.length; i++) {
  1071.                    this._chain_number[i].x = this._chain_number_data[2];
  1072.                   this._chain_number[i].y = this._chain_number_data[3];
  1073.             };         
  1074.           if (this._bp_visible) {
  1075.           this._battlePower[0].bitmap.drawText(this._enemy_bp,0,0,250,32,"center");
  1076.               this._battlePower[1].bitmap.drawText(this._party_bp,0,0,250,32,"center")        ;
  1077.           };
  1078.       this._phase_sprite_data = [this._phase_img.width,this._phase_img.height / 4]
  1079.           this._phase_sprite.x += this._phase_sprite_data[0] / 2;
  1080.           this._phase_sprite.y += this._phase_sprite_data[1] / 2;
  1081.           this._damage_data = [this._damage_img.width / 10,this._damage_img.height];
  1082.           this.createButtons();
  1083.           this.createStrings();
  1084. };

  1085. //==============================
  1086. // * createSpriteset
  1087. //==============================
  1088. Scene_Theatrhythm.prototype.createScenario = function() {
  1089.     this._back1Sprite = new TilingSprite();
  1090.         this._back1Sprite.move(0, 0, Graphics.width, Graphics.height);
  1091.         this._back1Sprite.anchor.x = 0.5;
  1092.         this._back1Sprite.anchor.y = 0.5;
  1093.         this._spriteField.addChild(this._back1Sprite);       
  1094.     this._back2Sprite = new TilingSprite();
  1095.         this._back2Sprite.anchor.x = 0.5;
  1096.         this._back2Sprite.anchor.y = 0.5;       
  1097.         this._spriteField.addChild(this._back2Sprite);
  1098.     this._back2Sprite.move(0, 0, Graphics.width, Graphics.height);
  1099.         this.refresh_background();
  1100. };

  1101. //==============================
  1102. // * RefreshBackground
  1103. //==============================
  1104. Scene_Theatrhythm.prototype.refresh_background = function() {
  1105.         this._back1Sprite.bitmap = ImageManager.loadBattleback1($gameMap.battleback1Name());
  1106.         this._back2Sprite.bitmap = ImageManager.loadBattleback2($gameMap.battleback2Name());
  1107.         this._back1Sprite.x = Graphics.width / 2;
  1108.         this._back1Sprite.y = Graphics.height / 2;
  1109.         this._back2Sprite.x = Graphics.width / 2;
  1110.         this._back2Sprite.y = Graphics.height / 2;
  1111. };

  1112. //==============================
  1113. // * Create Actors
  1114. //==============================
  1115. Scene_Theatrhythm.prototype.createActors = function() {
  1116.     this._actorSprites = [];
  1117.         this._actorSprites_Data = [-1,-1,-1,-1]
  1118.     for (var i = 0; i < this._battlers.length; i++) {
  1119.         this._actorSprites[i] = new Sprite_Actor();
  1120.         this._spriteField.addChild(this._actorSprites[i]);
  1121.     };
  1122. };

  1123. //==============================
  1124. // * Create Enemy
  1125. //==============================
  1126. Scene_Theatrhythm.prototype.createEnemy = function() {
  1127.         if (Imported.MOG_BattlerMotion) {
  1128.             this._sprite_shadow = new SpriteBattlerShadow();       
  1129.             this._spriteField.addChild(this._sprite_shadow);
  1130.         };
  1131.     this._enemy = new Game_Enemy($gameSystem._theatrhythm_data[0],Moghunter.theatrhythm_enemy_x, Moghunter.theatrhythm_enemy_y);               
  1132.     this._enemySprite = new Sprite_Enemy(this._enemy);
  1133.         this._spriteField.addChild(this._enemySprite);
  1134.         if (Imported.MOG_BattlerMotion) {           
  1135.             this._enemySprite.add_shadow(this._sprite_shadow);
  1136.         };
  1137. };
  1138.        
  1139. //==============================
  1140. // * Update Actors
  1141. //==============================
  1142. Scene_Theatrhythm.prototype.updateActors = function() {
  1143.     for (var i = 0; i < this._actorSprites.length; i++) {               
  1144.         this._actorSprites[i].setBattler(this._battlers[i]);                       
  1145.     };
  1146. };

  1147. //==============================
  1148. // * Update Actors
  1149. //==============================
  1150. Scene_Theatrhythm.prototype.update_commands = function() {
  1151.         if (Input.isTriggered("a")) {this.check_key(0)}
  1152.         else if (Input.isTriggered("s")) {this.check_key(1)}
  1153.         else if (Input.isTriggered("ok")) {this.check_key(2)}
  1154.         else if (Input.isTriggered("cancel")) {this.check_key(3)}
  1155.         else if (Input.isTriggered("up")) {this.check_key(4)}
  1156.         else if (Input.isTriggered("right")) {this.check_key(5)}
  1157.         else if (Input.isTriggered("left")) {this.check_key(6)}
  1158.         else if (Input.isTriggered("down")) {this.check_key(7)};
  1159. };

  1160. //==============================
  1161. // * Check Key
  1162. //==============================
  1163. Scene_Theatrhythm.prototype.check_key = function(key) {
  1164.         SoundManager.playCursor();
  1165.         this._sprite_buttons.keyisValid(key);
  1166.         if ($gameSystem._theatrhythm_key_data[0] != null) {this.refresh_effect();};
  1167. };

  1168. //==============================
  1169. // * Refresh Effect
  1170. //==============================
  1171. Scene_Theatrhythm.prototype.refresh_effect = function() {
  1172.          var pos_id = $gameSystem._theatrhythm_key_data[0];
  1173.          var string_id = $gameSystem._theatrhythm_key_data[1];
  1174.          if (!this._layout_buttons[pos_id]) {
  1175.                  $gameSystem._theatrhythm_key_data[0] = null;
  1176.                  $gameSystem._theatrhythm_key_data[1] = 0;                 
  1177.                  return;
  1178.          };
  1179.      this._layout_buttons[pos_id].opacity = 255;
  1180.          this.refresh_string(pos_id, string_id);         
  1181.          if (string_id != 0) {this.execute_hit_enemy(pos_id, string_id)}
  1182.          else {this.execute_missed()};
  1183.          $gameSystem._theatrhythm_key_data[0] = null;
  1184.      $gameSystem._theatrhythm_key_data[1] = 0;
  1185. };

  1186. //==============================
  1187. // * Execute Hit Enemy
  1188. //==============================
  1189. Scene_Theatrhythm.prototype.execute_hit_enemy = function(pos_id, string_id) {
  1190.          var ani_id = this._battlers[pos_id].attackAnimationId1();
  1191.          this._enemySprite._enemy.startAnimation(ani_id, false, 0);
  1192.          this._enemySprite._enemy.motion_shake();
  1193.          $gameSystem._theatrhythm_chain_data[0] += 1;
  1194.          if ($gameSystem._theatrhythm_chain_data[1] < $gameSystem._theatrhythm_chain_data[0]) {
  1195.                  $gameSystem._theatrhythm_chain_data[1] = $gameSystem._theatrhythm_chain_data[0]};
  1196.          if (this._result_data[0] < $gameSystem._theatrhythm_chain_data[0]) {this._result_data[0] = $gameSystem._theatrhythm_chain_data[0]};         
  1197.          this.add_score();
  1198.          this.execute_damage(0);
  1199. };

  1200. //==============================
  1201. // * Execute Hit Actor
  1202. //==============================
  1203. Scene_Theatrhythm.prototype.execute_hit_actor = function(pos_id, string_id) {       
  1204.          if (this._enemySprite._enemy._motion_action_data[0] != 0) { return };
  1205.      this._enemySprite._enemy.clear_action_data();
  1206.      this._enemySprite._enemy._motion_action_data[0] = 7;         
  1207.          if (this._party_hp[0] > 0) {
  1208.              this._target_id = Math.randomInt(this._battlers.length);
  1209.        this._battlers[this._target_id].startAnimation(this._enemySprite._enemy._theatrhythm_ani_id, false, 0);
  1210.          this._battlers[this._target_id].motion_shake();
  1211.       } else {
  1212.                   for (var i = 0; i < this._battlers.length; i++) {
  1213.             this._battlers[i].startAnimation(this._enemySprite._enemy._theatrhythm_ani_id, false, 0);
  1214.               this._battlers[i].motion_shake();                          
  1215.                   };
  1216.           };
  1217.           this.execute_damage(1);
  1218. };

  1219. //==============================
  1220. // * Execute Missed
  1221. //==============================
  1222. Scene_Theatrhythm.prototype.execute_missed = function(pos_id, string_id) {
  1223.          $gameSystem._theatrhythm_chain_data[0] = 0;
  1224.      this.execute_miss_damage();
  1225. };

  1226. //==============================
  1227. // * Execute Miss Damage
  1228. //==============================
  1229. Scene_Theatrhythm.prototype.execute_miss_damage = function(pos_id, string_id) {
  1230.          if ($gameSystem._theatrhythm_phase != 1) {return};
  1231.          $gameSystem._theatrhythm_miss_dmg = false;
  1232.          var dmg = this._party_hp[1] * Math.abs(Moghunter.theatrhythm_miss_dmg_per) / 100
  1233.          this._party_hp[0] -= dmg;
  1234.          this.execute_hit_actor()
  1235.          if (this._party_hp[0] <= 0) {this._party_hp[0] = 0;this.battle_end(11)};
  1236. };

  1237. //==============================
  1238. // * Execute Damage
  1239. //==============================
  1240. Scene_Theatrhythm.prototype.execute_damage = function(target) {
  1241.         if ($gameSystem._theatrhythm_phase != 1) {return};
  1242.     if (target === 0) {
  1243.                 var dmg = Math.max((this._party_atk - this._enemy_def),1);
  1244.                 if ($gameSystem._theatrhythm_key_data[1] == 2) {dmg *= Moghunter.theatrhythm_critical_bonus};
  1245.                 this._enemy_hp[0] -= Math.floor(dmg);
  1246.                 if (this._enemy_hp[0] <= 0) {this._enemy_hp[0] = 0; this._enemySprite._enemy.performCollapse();this.battle_end(10)};
  1247.         } else {
  1248.                 var dmg = Math.max((this._enemy_atk - this._party_def),1);
  1249.                 this._party_hp[0] -= Math.floor(dmg);
  1250.                 if (this._party_hp[0] <= 0) {this._party_hp[0] = 0;this.battle_end(11)};
  1251.         };
  1252.         this.refresh_damage(target,Math.floor(dmg));
  1253. };

  1254. //==============================
  1255. // * Battle_End
  1256. //==============================
  1257. Scene_Theatrhythm.prototype.battle_end = function(type) {
  1258.         if ($gameSystem._theatrhythm_phase != 1) {return};
  1259.         if (type === 10) {
  1260.              $gameSwitches._data[Moghunter.theatrhythm_result_switch_id] = true;
  1261.         } else {
  1262.                 $gameSwitches._data[Moghunter.theatrhythm_result_switch_id] = false;
  1263.         };               
  1264.         $gameSystem._theatrhythm_phase = type;
  1265.         if (type === 10) {
  1266.                 for (var i = 0; i < this._battlers.length; i++) {               
  1267.                 this._battlers[i].performVictory();}
  1268.         } else {
  1269.                 $gameParty.requestMotionRefresh();
  1270.         };
  1271. };

  1272. //==============================
  1273. // * Add Score
  1274. //==============================
  1275. Scene_Theatrhythm.prototype.add_score = function() {
  1276.         var value = Moghunter.theatrhythm_base_score + (Moghunter.theatrhythm_chain_bonus * $gameSystem._theatrhythm_chain_data[0])
  1277.         if ($gameSystem._theatrhythm_key_data[1] == 2) {value *= Moghunter.theatrhythm_critical_bonus};
  1278.     this._score[1] += Math.floor(value);
  1279.         if ($gameSystem._theatrhythm_score_data[1] < this.score()) {$gameSystem._theatrhythm_score_data[1] = this.score()};
  1280. };

  1281. //==============================
  1282. // * Chain Bonus
  1283. //==============================
  1284. Scene_Theatrhythm.prototype.chainBonus = function() {
  1285.          return Math.floor((this._result_data[0] * Moghunter.theatrhythm_result_chain_bonus) * this.score())
  1286. };

  1287. //==============================
  1288. // * Score
  1289. //==============================
  1290. Scene_Theatrhythm.prototype.score = function() {
  1291.         return Math.floor(this._score[1])
  1292. };

  1293. //==============================
  1294. // * Set Total
  1295. //==============================
  1296. Scene_Theatrhythm.prototype.set_total = function() {
  1297.         var n = this.score() + this._enemy_bp + this.chainBonus();
  1298.         return Math.floor(n);
  1299. };

  1300. //==============================
  1301. // * Update Phase
  1302. //==============================
  1303. Scene_Theatrhythm.prototype.update_phase = function() {
  1304.     switch ($gameSystem._theatrhythm_phase) {
  1305.                 case 0:
  1306.             this.update_start_phase();
  1307.             break;
  1308.                 case 10:
  1309.             this.update_victory_phase();
  1310.             break;
  1311.                 case 11:
  1312.             this.update_defeat_phase();
  1313.             break;       
  1314.    };   
  1315.    this._phase_sprite.scale.y = this._phase_sprite.scale.x;
  1316. };

  1317. //==============================
  1318. // * Update Start Phase
  1319. //==============================
  1320. Scene_Theatrhythm.prototype.update_start_phase = function() {
  1321.     switch (this._phase[0]) {
  1322.                 case 0:
  1323.                 this.refresh_phase_sprite(0);
  1324.                         this._phase[0] = 1;
  1325.                  break;
  1326.                 case 1:
  1327.                 this._phase_sprite.opacity += 3;
  1328.                         if (this._phase_sprite.scale.x > 1.00) {this._phase_sprite.scale.x -= 0.02};
  1329.                     if (this._phase_sprite.opacity >= 255) {this._phase[0] = 2};
  1330.                 break;
  1331.                 case 2:
  1332.                     if (Input.isTriggered("ok") || Input.isTriggered("cancel") || TouchInput.isTriggered()) {
  1333.                                 SoundManager.playCursor();this._phase[0] = 3;BattleManager.playBattleBgm()};
  1334.                     break;        
  1335.                 case 3:
  1336.                         this._phase_sprite.opacity -= 3;
  1337.                         this._phase_sprite.scale.x += 0.02;
  1338.                         if (this._phase_sprite.opacity <= 0) {$gameSystem._theatrhythm_phase = 1;this._phase[0] = 4};
  1339.                     break;                                
  1340.         };
  1341. };

  1342. //==============================
  1343. // * Update Victory Phase
  1344. //==============================
  1345. Scene_Theatrhythm.prototype.update_victory_phase = function() {
  1346.    switch (this._phase[1]) {
  1347.                 case 0:
  1348.                 this.refresh_phase_sprite(1);
  1349.                         this._phase[1] = 1;
  1350.                         AudioManager.fadeOutBgm(1);
  1351.                  break;
  1352.                 case 1:
  1353.                 this._phase_sprite.opacity += 3;
  1354.                         if (this._phase_sprite.scale.x > 1.00) {this._phase_sprite.scale.x -= 0.02}
  1355.                     if (this._phase_sprite.opacity >= 255) {this._phase[1] = 3;BattleManager.playVictoryMe()};
  1356.                 break;
  1357.                 case 2:
  1358.                     if (Input.isTriggered("ok") || Input.isTriggered("cancel") || TouchInput.isTriggered()) {
  1359.                                 SoundManager.playCursor();this._phase[1] = 3};
  1360.                     break;        
  1361.                 case 3:
  1362.                     this._phase_sprite.opacity -= 3;
  1363.                         this._phase_sprite.scale.x += 0.02;       
  1364.                         if (this._phase_sprite.opacity <= 0) {this.display_result()};       
  1365.                         break;                       
  1366.                 case 4:
  1367.                 this._phase_sprite.opacity += 3;                       
  1368.                         if (this._phase_sprite.scale.x > 1.00) {this._phase_sprite.scale.x -= 0.02}
  1369.                     if (this._phase_sprite.opacity >= 255) {this._phase[1] = 5};
  1370.                 break;                       
  1371.                 case 5:
  1372.                     if (Input.isTriggered("ok") || Input.isTriggered("cancel") || TouchInput.isTriggered()) {
  1373.                                 SoundManager.playCursor();this._phase[1] = 6};
  1374.                     break;                       
  1375.                 case 6:       
  1376.                         this._phase_sprite.opacity -= 3;                       
  1377.                         if (this._phase_sprite.opacity <= 0) {this.fadeOutAll();$gameSystem._theatrhythm_phase = 12;this._phase[1] = 7;SceneManager.pop()};
  1378.                     break;                                
  1379.         };
  1380.         this._text_sprite.opacity = this._phase_sprite.opacity;       
  1381.         this._text_sprite.scale.x = this._phase_sprite.scale.x;
  1382.         this._text_sprite.scale.y = this._phase_sprite.scale.y;
  1383.         this._text2_sprite.opacity = this._phase_sprite.opacity;
  1384.         this._text2_sprite.scale.x = this._phase_sprite.scale.x;
  1385.         this._text2_sprite.scale.y = this._phase_sprite.scale.y;               
  1386. };

  1387. //==============================
  1388. // * Display Result
  1389. //==============================
  1390. Scene_Theatrhythm.prototype.display_result = function() {
  1391.         this._phase[1] = 4;
  1392.         this.refresh_phase_sprite(3);
  1393.         this.gain_rewards();
  1394.     this.draw_result();
  1395. };

  1396. //==============================
  1397. // * Gain Rewards
  1398. //==============================
  1399. Scene_Theatrhythm.prototype.gain_rewards = function() {
  1400.    $gameVariables._data[Moghunter.theatrhythm_variable_id] += this.set_total();
  1401. };

  1402. //==============================
  1403. // * Draw Result
  1404. //==============================
  1405. Scene_Theatrhythm.prototype.draw_result = function() {
  1406.         this._text_sprite.bitmap.drawText(this.score(),0,0,200,32,"right");
  1407.         this._text_sprite.bitmap.drawText("(" + String(this._result_data[0]) + ") " + String(this.chainBonus()),0,32,200,32,"right");
  1408.         this._text_sprite.bitmap.drawText(this._enemy_bp,0,64,200,32,"right");
  1409.         this._text_sprite.bitmap.drawText(this.set_total(),0,96,200,32,"right");
  1410.         this._text2_sprite.bitmap.drawText($gameVariables._data[Moghunter.theatrhythm_variable_id],0,0,200,100,"left");
  1411. };

  1412. //==============================
  1413. // * Update Defeat Phase
  1414. //==============================
  1415. Scene_Theatrhythm.prototype.update_defeat_phase = function() {
  1416.     switch (this._phase[2]) {
  1417.                 case 0:
  1418.                 this.refresh_phase_sprite(2);
  1419.                         this._phase[2] = 1;
  1420.                         AudioManager.fadeOutBgm(2);
  1421.                  break;
  1422.                 case 1:
  1423.                 this._phase_sprite.opacity += 3;
  1424.                         if (this._phase_sprite.scale.x > 1.00) {this._phase_sprite.scale.x -= 0.02};
  1425.                     if (this._phase_sprite.opacity >= 255) {this._phase[2] = 2};
  1426.                 break;
  1427.                 case 2:
  1428.                     if (Input.isTriggered("ok") || Input.isTriggered("cancel") || TouchInput.isTriggered()) {
  1429.                                 SoundManager.playCursor();this._phase[2] = 3};
  1430.                     break;        
  1431.                 case 3:
  1432.                         this._phase_sprite.opacity -= 3;
  1433.                         this._phase_sprite.scale.x += 0.02;
  1434.                         if (this._phase_sprite.opacity <= 0) {this.fadeOutAll();$gameSystem._theatrhythm_phase = 12;this._phase[2] = 4;SceneManager.pop();}
  1435.                     break;                                
  1436.         };
  1437. };

  1438. //==============================
  1439. // * Refresh Enemy Position
  1440. //==============================
  1441. Scene_Theatrhythm.prototype.refresh_enemy_position = function() {
  1442.       this._enemySprite._homeY += this._enemySprite.bitmap.height / 2;
  1443.           this._enemy_ref = true;
  1444. };

  1445. //==============================
  1446. // * Terminate
  1447. //==============================
  1448. Scene_Theatrhythm.prototype.terminate = function() {
  1449.         Scene_Base.prototype.terminate.call(this);
  1450.         BattleManager.replayBgmAndBgs();
  1451.         $gameSystem._theatrhythm = false;
  1452. };

  1453. //==============================
  1454. // * Update
  1455. //==============================
  1456. Scene_Theatrhythm.prototype.update = function() {
  1457.     Scene_Base.prototype.update.call(this);
  1458.     this.updateActors();       
  1459.         if (this._layout_buttons_data[0] === -1) {
  1460.                 if (this._layout_buttons_img.isReady()) {this.getSpriteData()};
  1461.                 return;
  1462.         };
  1463.         this.update_layout_buttons();
  1464.         for (var i = 0; i < this._layout_buttons.length; i++) {
  1465.                 this._layout_buttons[i].opacity -= 5;
  1466.                 this._strings[i].opacity -= 10;
  1467.                 if (this._strings[i].opacity > 0) {this._strings[i].scale.x += 0.05}
  1468.                 this._strings[i].scale.y = this._strings[i].scale.x;
  1469.         };
  1470.          if (!this._enemy_ref && this._enemySprite.bitmap.isReady()) {this.refresh_enemy_position()};
  1471.         if (this._meter_data[0] != -1) {this.update_time_meter()};
  1472.         if (this._hp_meter_data[0] != -1) {this.update_hp_meter()};
  1473.         if (this._point_data[0] != -1) {this.update_score();};
  1474.         if (this._enemyHpNumber_data[0] != -1) {this.update_enemyHpNumber()};
  1475.         if (this._actorHpNumber_data[0] != -1) {this.update_actorHpNumber()};
  1476.         if (this._chain_data[0] != -1) {this.update_chain();};
  1477.         if (this._damage_data[0] != -1) {this.update_damage()};
  1478.         if ($gameSystem._theatrhythm_phase === 1) {this.update_commands();};
  1479.         if ($gameSystem._theatrhythm_miss_dmg) {this.execute_miss_damage();};
  1480.         this.update_phase();
  1481. };

  1482. //=============================================================================
  1483. // ** Sprite TKeys
  1484. //=============================================================================       
  1485. function Sprite_TKeys() {
  1486.     this.initialize.apply(this, arguments);
  1487. }

  1488. Sprite_TKeys.prototype = Object.create(Sprite_Base.prototype);
  1489. Sprite_TKeys.prototype.constructor = Sprite_TKeys;

  1490. //==============================
  1491. // * Initialize
  1492. //==============================
  1493. Sprite_TKeys.prototype.initialize = function(img,pos) {
  1494.     Sprite_Base.prototype.initialize.call(this);
  1495.         this._image = img;
  1496.         this._cw = this._image.width  / 8;
  1497.         this._ch =  this._image.height;
  1498.         this._positions = pos;
  1499.         this._keys_speed = $gameSystem._theatrhythm_data[1];
  1500.         this._button_ok= null;
  1501.         this._batlers = $gameParty.battleMembers();
  1502.         this._limit = [this._positions[0][0] + this._cw + (this._cw / 4),
  1503.                        this._positions[0][0] + (this._cw * 3),
  1504.                                    this._positions[0][0] + this._cw + (this._cw),
  1505.                                    this._positions[0][0] + (this._cw * 2) + (this._cw / 3),
  1506.                                    Graphics.boxWidth + this._cw,
  1507.                                    ];
  1508.         this.create_keys();
  1509. };

  1510. //==============================
  1511. // * Create Keys
  1512. //==============================
  1513. Sprite_TKeys.prototype.create_keys = function() {
  1514.    this._keys = [];   
  1515.    this._keys_c = [];
  1516.    this._keys_f = [];
  1517.    this._keys_i = [];
  1518.    this._keys_h = [];
  1519.    this._keys_r = [];
  1520.    this._keys_s = [];
  1521.    for (var i = 0; i < 6; i++) {
  1522.              this._keys_c[i] = 0;
  1523.                  this._keys_f[i] = false;
  1524.                  this._keys_h[i] = 0;
  1525.                  this._keys_i[i] = this.key_space(i);
  1526.                  this._keys_r[i] = false;
  1527.                  this._keys_s[i] = false;
  1528.              this._keys[i] = new Sprite(this._image)
  1529.                  this._keys[i].x = this._limit[4];
  1530.                  this._keys[i].anchor.x = 0.5;
  1531.                  this._keys[i].anchor.y = 0.5;
  1532.                  this._keys[i].opacity = 0;
  1533.                  this.addChild(this._keys[i]);                 
  1534.    };
  1535. };

  1536. //==============================
  1537. // * Key Space
  1538. //==============================
  1539. Sprite_TKeys.prototype.key_space = function(i) {
  1540.          return ((this._cw +  Graphics.boxWidth / 4) / this._keys_speed) * i;
  1541. };

  1542. //==============================
  1543. // * Refresh Keys
  1544. //==============================
  1545. Sprite_TKeys.prototype.refresh_keys = function(i) {
  1546.         this._keysX = [];
  1547.         for (var e = 0; e < this._keys.length; e++) {this._keysX.push(this._keys[e].x);};
  1548.         this._keysX.sort(function(a, b){return a-b});
  1549.         var difX = (this._keys[i].x - this._limit[4]);
  1550.         this._keys_f[i] = false;
  1551.         this._keys_c[i] = Math.randomInt(8);
  1552.         this._keys_h[i] = Math.randomInt(this._batlers.length);
  1553.         this._keys_r[i] = true;
  1554.         this._keys_s[i] = false;
  1555.         var h = this._positions[this._keys_h[i]][1];
  1556.         this._keys[i].setFrame(this._cw * this._keys_c[i],0,this._cw,this._ch)
  1557.         this._keys[i].x = -(this._cw + this._keys_i[i] - difX);
  1558.         this._keys[i].y = h;
  1559.         this._keys[i].scale.x = 1.00;
  1560.         this._keys[i].scale.y = 1.00;
  1561.         this._keys[i].opacity = 0;
  1562.         if (this._keys[i].x > (this._keysX[0] - (this._cw +  Graphics.boxWidth / 6)) ) {this._keys[i].x = (this._keysX[0] - (this._cw +  Graphics.boxWidth / 6))};
  1563. };

  1564. //==============================
  1565. // * KeysisValid
  1566. //==============================
  1567. Sprite_TKeys.prototype.keyisValid = function(key) {
  1568.         for (var i = 0; i < this._keys.length; i++) {
  1569.              if (this.checkKey(key,i,0)) {this.execute_ok(i,key)};
  1570.         };
  1571.         if ($gameSystem._theatrhythm_key_data[0] == null) {
  1572.                 for (var i = 0; i < this._keys.length; i++) {
  1573.                    this.execute_miss(key,i);
  1574.                 };
  1575.     };
  1576. };

  1577. //==============================
  1578. // * Execute Miss
  1579. //==============================
  1580. Sprite_TKeys.prototype.execute_miss = function(key,i) {
  1581.         if ($gameSystem._theatrhythm_key_data[0] != null) {return};
  1582.         var keys_temp = [];
  1583.         for (var e = 0; e < this._keys.length; e++) {
  1584.                 if (this._keys[e].x <= this._limit[1]) {keys_temp.push([this._keys[e].x,this._keys_h[e]]);};
  1585.         };
  1586.         keys_temp.sort(function(a, b){return b[0]-a[0]});
  1587.         $gameSystem._theatrhythm_key_data[0] = keys_temp[0][1];
  1588.         $gameSystem._theatrhythm_key_data[1] = 0;
  1589. };

  1590. //==============================
  1591. // * Execute OK
  1592. //==============================
  1593. Sprite_TKeys.prototype.execute_ok = function(i,key) {
  1594.         if (!this._batlers[this._keys_h[i]]) {return};
  1595.     this._batlers[this._keys_h[i]].performAttack();
  1596.         $gameSystem._theatrhythm_key_data[0] = this._keys_h[i];
  1597.          if (this.checkKey(key,i,1)) {$gameSystem._theatrhythm_key_data[1] = 2}
  1598.          else {$gameSystem._theatrhythm_key_data[1] = 1};
  1599.          this._keys_f[i] = true;
  1600. };

  1601. //==============================
  1602. // * checkKey
  1603. //==============================
  1604. Sprite_TKeys.prototype.checkKey = function(key,i,type) {
  1605.         if (this._keys_f[i]) {return false};
  1606.         if (key != this._keys_c[i]) {return false};
  1607.         if (type === 0) {
  1608.             if (this._keys[i].x < this._limit[0]) {return false};
  1609.             if (this._keys[i].x > this._limit[1]) {return false};
  1610.         } else {
  1611.             if (this._keys[i].x < this._limit[2]) {return false};
  1612.             if (this._keys[i].x > this._limit[3]) {return false};        
  1613.         };
  1614.     return true;
  1615. };

  1616. //==============================
  1617. // * Update
  1618. //==============================
  1619. Sprite_TKeys.prototype.update = function(i) {
  1620.     Sprite_Base.prototype.update.call(this);
  1621.         for (var i = 0; i < this._keys.length; i++) {this.update_keys(i)};
  1622. };

  1623. //==============================
  1624. // * Update Keys
  1625. //==============================
  1626. Sprite_TKeys.prototype.update_keys = function(i) {
  1627.         if (this._keys_i[i] > 0) {this._keys_i[i] -= 1;return};
  1628.         if ($gameSystem._theatrhythm_phase != 1) {this._keys[i].opacity -= 10; return;};
  1629.         if (this._keys_f[i]) {this.update_fade(i);}
  1630.         else {this.update_position(i)                  
  1631.         };
  1632.         if (this.need_reset_key(i)) {this.refresh_keys(i)};       
  1633. };       

  1634. //==============================
  1635. // * Update Keys
  1636. //==============================
  1637. Sprite_TKeys.prototype.update_position = function(i) {
  1638.         this._keys[i].x += this._keys_speed;
  1639.         if (this._keys[i].x > this._limit[1] && this._keys[i].opacity > 0) {this._keys[i].opacity -= 7;
  1640.              if (!this._keys_s[i] && this._keys_r[i]) {this.slow_pressed(i);}
  1641.         }
  1642.         else {
  1643.              this._keys[i].opacity += 25;
  1644.         };
  1645. };
  1646.        
  1647. //==============================
  1648. // * Update Keys
  1649. //==============================
  1650. Sprite_TKeys.prototype.update_fade = function(i) {
  1651.         this._keys[i].scale.x += 0.05;
  1652.         this._keys[i].scale.y = this._keys[i].scale.x;
  1653.         this._keys[i].opacity -= 25;
  1654. };
  1655.        
  1656. //==============================
  1657. // * Slow Pressed
  1658. //==============================
  1659. Sprite_TKeys.prototype.slow_pressed = function(i) {       
  1660.    this._keys_s[i] = true;
  1661.    $gameSystem._theatrhythm_chain_data[0] = 0;
  1662.    $gameSystem._theatrhythm_miss_dmg = true;
  1663. };
  1664.        
  1665. //==============================
  1666. // * Update Keys
  1667. //==============================
  1668. Sprite_TKeys.prototype.need_reset_key = function(i) {
  1669.         if (this._keys[i].x > this._limit[4]) {return true};
  1670.         if (this._keys[i].opacity === 0) {return true};
  1671.         return false;
  1672. };

  1673. //=============================================================================
  1674. // ** Sprite Actor
  1675. //=============================================================================       
  1676. var _alias_mog_Theatrhythm_updateTargetPosition = Sprite_Actor.prototype.updateTargetPosition;
  1677. Sprite_Actor.prototype.updateTargetPosition = function() {
  1678.         if ($gameSystem._theatrhythm) {return};
  1679.         _alias_mog_Theatrhythm_updateTargetPosition.call(this);
  1680. };

  1681. //==============================
  1682. // * setActorHome
  1683. //==============================
  1684. var _alias_mog_Theatrhythm_setActorHome = Sprite_Actor.prototype.setActorHome;
  1685. Sprite_Actor.prototype.setActorHome = function(index) {
  1686.     if ($gameSystem._theatrhythm) {this.setHome(Moghunter.theatrhythm_actor_x, Moghunter.theatrhythm_actor_y + index * Moghunter.theatrhythm_actor_spc_y);return};
  1687.         _alias_mog_Theatrhythm_setActorHome.call(this,index);
  1688. };

  1689. //==============================
  1690. // * refreshMotion
  1691. //==============================
  1692. var _alias_mog_Theatrhythm_refreshMotion = Sprite_Actor.prototype.refreshMotion;
  1693. Sprite_Actor.prototype.refreshMotion = function() {
  1694.         if ($gameSystem._theatrhythm) {this.refreshMotion_Theatrhythm();return};
  1695.         _alias_mog_Theatrhythm_refreshMotion.call(this);
  1696. };
  1697.        
  1698. //==============================
  1699. // * refreshMotion_Theatrhythm
  1700. //==============================
  1701. Sprite_Actor.prototype.refreshMotion_Theatrhythm = function() {       
  1702.     var actor = this._actor;
  1703.     if (actor) {
  1704.                  if ($gameSystem._theatrhythm_phase === 11) {
  1705.             this.startMotion('dead');
  1706.          } else {
  1707.             this.startMotion('walk');
  1708.          };
  1709.     };
  1710. };
复制代码
梦石
0
星屑
245
在线时间
219 小时
注册时间
2015-9-24
回帖
138
发表于 2016-2-18 16:56:15 | 显示全部楼层
不是有demo吗
回复

使用道具 举报

梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
 楼主| 发表于 2016-2-18 17:17:50 | 显示全部楼层
chenyilindzh 发表于 2016-2-18 16:56
不是有demo吗

甚麼demo? 不懂?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部