Advertisement
Guest User

Untitled

a guest
Apr 16th, 2016
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // MOG_BattleCommands.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc (v1.0) Comandos de batalhas animados por imagens.
  7.  * @author Moghunter
  8.  *
  9.  * @param Mode
  10.  * @desc Definição do tipo de comando.
  11.  * 0 - Normal     1 - Ring Menu
  12.  * @default 1
  13.  *
  14.  * @param Layout X-axis
  15.  * @desc Definição X-Axis da imagem.
  16.  * @default 22
  17.  *
  18.  * @param Layout Y-axis
  19.  * @desc Definição Y-Axis da imagem.
  20.  * @default 15
  21.  *
  22.  * @param Com X-axis
  23.  * @desc Definição X-Axis da imagem.
  24.  * @default 0
  25.  *
  26.  * @param Com Y-axis
  27.  * @desc Definição Y-Axis da imagem.
  28.  * @default 0
  29.  *
  30.  * @param Arrow
  31.  * @desc Ativar a imagem das flechas.
  32.  * @default false
  33.  *
  34.  * @param Arrow X-axis
  35.  * @desc Definição X-Axis da imagem.
  36.  * @default 5
  37.  *
  38.  * @param Arrow Y-axis
  39.  * @desc Definição Y-Axis da imagem.
  40.  * @default 0
  41.  *
  42.  * @param Zoom Animation
  43.  * @desc Ativar o efeito de zoom.
  44.  * @default true
  45.  *
  46.  * @param Zoom Rate
  47.  * @desc Poder do zoom.
  48.  * @default 1.30
  49.  *
  50.  * @param Zoom Speed
  51.  * @desc Velocidade do zoom.
  52.  * @default 0.015
  53.  *
  54.  * @param Zoom Loop
  55.  * @desc Ativar loop na animação do zoom.
  56.  * @default true
  57.  *
  58.  * @param Slide Animation
  59.  * @desc Ativar animação de deslize.
  60.  * @default false
  61.  *
  62.  * @param Slide X
  63.  * @desc Definição da distância X.
  64.  * @default 0
  65.  *
  66.  * @param Slide Y
  67.  * @desc Definição da distância Y.
  68.  * @default 0
  69.  *
  70.  * @param Com Name
  71.  * @desc Ativar o nome do comando.
  72.  * @default true
  73.  *
  74.  * @param Com Name X-axis
  75.  * @desc Definição X-Axis do nome.
  76.  * @default 55
  77.  *
  78.  * @param Com Name Y-axis
  79.  * @desc Definição Y-Axis do nome.
  80.  * @default 75
  81.  *
  82.  * @param Com Font Size
  83.  * @desc Definição do tamanho da fonte.
  84.  * @default 22
  85.  *
  86.  * @param Cursor
  87.  * @desc Ativar cursor.
  88.  * @default false
  89.  *
  90.  * @param Cursor X-axis
  91.  * @desc Definição X-Axis do cursor.
  92.  * @default 0
  93.  *
  94.  * @param Cursor Y-axis
  95.  * @desc Definição X-Axis do cursor.
  96.  * @default 0
  97.  *
  98.  * @param Cursor Slide
  99.  * @desc Ativar a animação de deslize.
  100.  * @default false
  101.  *
  102.  * @param Row Max
  103.  * @desc Definição da quantidade comandos visíveis.
  104.  * @default 4
  105.  *
  106.  * @param Ring Range
  107.  * @desc Definição da circunferência do circulo.
  108.  * @default 70
  109.  *
  110.  * @param Ring Motion
  111.  * @desc Ativar animação de movimento.
  112.  * @default true
  113.  *
  114.  * @param Pi Range
  115.  * @desc Definição do valor do PI.
  116.  * @default 2.0
  117.  *
  118.  * @param Side Input
  119.  * @desc Ativar Input para o lado direito e esquerdo.
  120.  * @default true
  121.  *
  122.  * @help  
  123.  * =============================================================================
  124.  * +++ MOG - Battle Commands (v1.0) +++
  125.  * By Moghunter
  126.  * https://atelierrgss.wordpress.com/
  127.  * =============================================================================
  128.  * Comandos de batalhas animados por imagens.
  129.  * Este plugin requer o MOG_BattleHud para funcionar.
  130.  *
  131.  * =============================================================================
  132.  * As imagens dos comandos deverão ser gravados na pasta /img/battlecommands/
  133.  * O nomes das imagens deverão seguir a seguinte nomeação.
  134.  *
  135.  * Com_ + COMMAND NAME.png
  136.  *
  137.  * Exemplo
  138.  *
  139.  * Com_Attack.png
  140.  * Com_Guard.png
  141.  * Com_Magic.png
  142.  * ...
  143.  *
  144.  * =============================================================================
  145.  *
  146.  */
  147.  
  148. //=============================================================================
  149. // ** PLUGIN PARAMETERS
  150. //=============================================================================
  151.   var Imported = Imported || {};
  152.   Imported.MOG_BattleCommands = true;
  153.   var Moghunter = Moghunter || {};
  154.  
  155.     Moghunter.parameters = PluginManager.parameters('MOG_BattleCommands');
  156.     Moghunter.bcom_mode = Number(Moghunter.parameters['Mode'] || 1);
  157.     Moghunter.bcom_lay_x = Number(Moghunter.parameters['Layout X-axis'] || 22);
  158.     Moghunter.bcom_lay_y = Number(Moghunter.parameters['Layout Y-axis'] || 15);
  159.     Moghunter.bcom_com_x = Number(Moghunter.parameters['Com X-axis'] || 0);
  160.     Moghunter.bcom_com_y = Number(Moghunter.parameters['Com Y-axis'] || 0);
  161.     Moghunter.bcom_arrow = String(Moghunter.parameters['Arrow'] || false);
  162.     Moghunter.bcom_arrow_x = Number(Moghunter.parameters['Arrow X-axis'] || 5);
  163.     Moghunter.bcom_arrow_y = Number(Moghunter.parameters['Arrow Y-axis'] || 0);
  164.     Moghunter.bcom_row_max = Number(Moghunter.parameters['Row Max'] || 4);
  165.     Moghunter.bcom_zoom_effect = String(Moghunter.parameters['Zoom Animation'] || true);
  166.     Moghunter.bcom_zoom_rate = Number(Moghunter.parameters['Zoom Rate'] || 1.30);
  167.     Moghunter.bcom_zoom_speed = Number(Moghunter.parameters['Zoom Speed'] || 0.015);
  168.     Moghunter.bcom_zoom_loop = String(Moghunter.parameters['Zoom Loop'] || true);
  169.     Moghunter.bcom_slide_effect = String(Moghunter.parameters['Slide Animation'] || false);
  170.     Moghunter.bcom_slide_x = Number(Moghunter.parameters['Slide X'] || 0);
  171.     Moghunter.bcom_slide_y = Number(Moghunter.parameters['Slide Y'] || 0);
  172.     Moghunter.bcom_com_name = String(Moghunter.parameters['Com Name'] || true);
  173.     Moghunter.bcom_com_name_x = Number(Moghunter.parameters['Com Name X-axis'] || 55);
  174.     Moghunter.bcom_com_name_y = Number(Moghunter.parameters['Com Name Y-axis'] || 75);
  175.     Moghunter.bcom_com_font_size = Number(Moghunter.parameters['Com Font Sizew'] || 22);
  176.     Moghunter.bcom_ring_range = Number(Moghunter.parameters['Ring Range'] || 70);
  177.     Moghunter.bcom_pi_range = Number(Moghunter.parameters['Pi Range'] || 2.0);
  178.     Moghunter.bcom_ring_anime = String(Moghunter.parameters['Ring Motion'] || true);
  179.     Moghunter.bcom_side_input = String(Moghunter.parameters['Side Input'] || true);
  180.     Moghunter.bcom_cursor = String(Moghunter.parameters['Cursor'] || false);   
  181.     Moghunter.bcom_cursor_x = Number(Moghunter.parameters['Cursor X-axis'] || 0);
  182.     Moghunter.bcom_cursor_y = Number(Moghunter.parameters['Cursor Y-axis'] || 0)
  183.     Moghunter.bcom_cursor_slide = String(Moghunter.parameters['Cursor Slide'] || false);
  184.    
  185. if (Imported.MOG_BattleHud) {
  186. //=============================================================================
  187. // ** ImageManager
  188. //=============================================================================
  189.  
  190. //==============================
  191. // * BHud
  192. //==============================
  193. ImageManager.loadBcom = function(filename) {
  194.     return this.loadBitmap('img/battlecommands/', filename, 0, true);
  195. }; 
  196.  
  197. //=============================================================================
  198. // ** Game_Temp
  199. //=============================================================================
  200.  
  201. //==============================
  202. // * Initialize
  203. //==============================
  204. var _alias_mog_bcom_temp_initialize = Game_Temp.prototype.initialize;
  205. Game_Temp.prototype.initialize = function() {
  206.     _alias_mog_bcom_temp_initialize.call(this);
  207.     this._bcom_need_refresh = false;
  208. };
  209.  
  210. //=============================================================================
  211. // ** Game_Interpreter
  212. //=============================================================================
  213.  
  214. //==============================
  215. // * Command129
  216. //==============================
  217. var _alias_mog_bcom_command129 = Game_Interpreter.prototype.command129;
  218. Game_Interpreter.prototype.command129 = function() {   
  219.     _alias_mog_bcom_command129.call(this); 
  220.     $gameTemp._bcom_need_refresh = true;
  221.     return true;
  222. };
  223.  
  224. //=============================================================================
  225. // ** Window Command
  226. //=============================================================================
  227.  
  228. //==============================
  229. // * Initialize
  230. //==============================
  231. var _alias_mog_bcom_wcom_initialize = Window_ActorCommand.prototype.initialize;
  232. Window_ActorCommand.prototype.initialize = function(x, y) {
  233.     _alias_mog_bcom_wcom_initialize.call(this,x, y);
  234.     if (!this._com_images) {this.battle_commands_initialize()};
  235. };
  236.  
  237. //==============================
  238. // * Battle Com Initialize
  239. //==============================
  240. Window_ActorCommand.prototype.battle_commands_initialize = function() {
  241.     var old_actor = this._actor;
  242.     this.com_pic_initialize();
  243.     this.get_full_list();
  244.     this.load_com_images();
  245.     this.create_com_sprites();
  246.     this._actor = old_actor;
  247.     this._old_visible = this.visible;
  248. };
  249.  
  250. //==============================
  251. // * Load Com Images
  252. //==============================
  253. Window_ActorCommand.prototype.com_pic_initialize = function() {
  254.     this.com_sprites_clear();
  255.     this._com_mode_b = Math.min(Math.max(Moghunter.bcom_mode,0),1);
  256.     this._com_list = [];
  257.     this._com_images = [];
  258.     this._com_sprites = [];
  259.     this._com_index = this._index;
  260.     this._max_com = 0;
  261.     this._wh = [0,0];
  262.     this._zoom = [0,0];
  263.     this._np = [0,0];
  264.     this._arrow_slide = [0,0,0];
  265.     this._arrow_org_y = [0,0];
  266.     this._cursor_nxy = [0,0];
  267.     this._cursor_slide = false;
  268.     this.sel_time = 0;
  269.     this._side = [];
  270.     this._side_m = [0,0];
  271.     this._ring_move = false;
  272.     this._side_input = false;
  273.     if (String(Moghunter.bcom_side_input) === "true") {this._side_input = true};
  274.     if (String(Moghunter.bcom_ring_anime) === "true") {this._ring_move = true};
  275.     this._rol_range = Moghunter.bcom_ring_range;
  276.     this._pi = Moghunter.bcom_pi_range * Math.PI;
  277.     if (String(Moghunter.bcom_slide_effect) === "true") {this._side_m = [Moghunter.bcom_slide_x, Moghunter.bcom_slide_y]}; 
  278.     this._row_max = Math.max(Moghunter.bcom_row_max - 1,1)
  279.     this._zoom_speed = Math.max(Moghunter.bcom_zoom_speed,0.001)
  280.     this._zoom_rate = Math.max(Moghunter.bcom_zoom_rate,1.00)    
  281.     this._zoom_effect = false;
  282.     if (String(Moghunter.bcom_zoom_effect) === "true") {this._zoom_effect = true};
  283.     this._loop_zoom_effect = false;
  284.     if (String(Moghunter.bcom_zoom_loop) === "true") {this._loop_zoom_effect = true};
  285. };
  286.  
  287. //==============================
  288. // * Com Sprites Clear
  289. //==============================
  290. Window_ActorCommand.prototype.com_sprites_clear = function() {
  291.     if (this._com_sprites) {
  292.         for (var i = 0; i < this._com_sprites.length; i++) {
  293.              this.removeChild(this._com_sprites[i]);
  294.         };
  295.     };
  296. };
  297.  
  298. //==============================
  299. // * get Full List
  300. //==============================
  301. Window_ActorCommand.prototype.get_full_list = function() {
  302.     for (var i = 0; i < $gameParty.battleMembers().length; i++) {
  303.           this._actor = $gameParty.battleMembers()[i];
  304.           this.makeCommandList();
  305.           this._com_list[i] = this._list;
  306.           this._com_images[i] = [];      
  307.           this.clearCommandList();
  308.           this._actor = null;
  309.     }; 
  310. };
  311.  
  312. //==============================
  313. // * Load Com Images
  314. //==============================
  315. Window_ActorCommand.prototype.load_com_images = function() {
  316.     for (var i = 0; i < this._com_list.length; i++) {
  317.          if (this._max_com < this._com_list[i].length) {this._max_com = this._com_list[i].length}
  318.          for (var r = 0; r < this._com_list[i].length; r++) {
  319.               this._com_images[i].push(ImageManager.loadBcom("Com_" + this._com_list[i][r].name));
  320.          };
  321.     };
  322.     this._layout_img = ImageManager.loadBcom("Layout");
  323.     this._cursor_b_img = ImageManager.loadBcom("Cursor");
  324.     if (String(Moghunter.bcom_arrow) === "true") {this._arrow_img = ImageManager.loadBcom("Arrow")};
  325. };
  326.  
  327. //==============================
  328. // * Create Com Sprites
  329. //==============================
  330. Window_ActorCommand.prototype.create_com_sprites = function() {
  331.     this.create_layout();
  332.     this.create_commands();
  333.     if (String(Moghunter.bcom_cursor) === "true") {this.create_cursor()};
  334.     if (String(Moghunter.bcom_arrow) === "true") {this.create_arrows()};
  335.     if (String(Moghunter.bcom_com_name) === "true") {this.create_com_name()};
  336. };
  337.  
  338. //==============================
  339. // * Create Layout
  340. //==============================
  341. Window_ActorCommand.prototype.create_layout = function() { 
  342.     this._layout = new Sprite(this._layout_img);
  343.     this._layout.x = Moghunter.bcom_lay_x;
  344.     this._layout.y = Moghunter.bcom_lay_y;
  345.     this.addChild(this._layout);
  346. };
  347.  
  348. //==============================
  349. // * Create Cursor
  350. //==============================
  351. Window_ActorCommand.prototype.create_cursor = function() { 
  352.     this._cursor_b = new Sprite(this._cursor_b_img);
  353.     this._cursor_b.anchor.x = 0.5;
  354.     this._cursor_b.anchor.y = 0.5; 
  355.     this._cursor_b_s = [0,0,0,0,0];
  356.     if (String(Moghunter.bcom_cursor_slide) === "true") {this._cursor_slide = true};
  357.     this.addChild(this._cursor_b);
  358. };
  359.  
  360. //==============================
  361. // * Update Cursor B
  362. //==============================
  363. Window_ActorCommand.prototype.update_cursor_b = function() {   
  364.     if (this._cursor_slide) {this.update_cursor_slide()};
  365.     var nx = this._cursor_nxy[0] + Moghunter.bcom_cursor_x + this._cursor_b_s[2];
  366.     var ny = this._cursor_nxy[1] + Moghunter.bcom_cursor_y;
  367.     this._cursor_b.x = this.sprite_move_to(this._cursor_b.x,nx,this.com_move_speed());
  368.     this._cursor_b.y = this.sprite_move_to(this._cursor_b.y,ny,this.com_move_speed());
  369. };
  370.  
  371. //==============================
  372. // * Update Cursor Slide
  373. //==============================
  374. Window_ActorCommand.prototype.update_cursor_slide = function() {   
  375.      this._cursor_b_s[4] += 1;
  376.      if (this._cursor_b_s[4] < 2) {return};
  377.      this._cursor_b_s[4] = 0;
  378.      this._cursor_b_s[3] += 1;
  379.      if (this._cursor_b_s[3] < 15) {this._cursor_b_s[2] += 1}
  380.      else if (this._cursor_b_s[3] < 30) {this._cursor_b_s[2] -= 1}
  381.      else {this._cursor_b_s[2] = 0 ;this._cursor_b_s[3] = 0};      
  382.  
  383. };
  384.  
  385. //==============================
  386. // * Create Commands
  387. //==============================
  388. Window_ActorCommand.prototype.create_commands = function() {   
  389.     for (var i = 0; i < this._max_com; i++) {
  390.          this._com_sprites[i] = new Sprite();
  391.          this._com_sprites[i].anchor.x = 0.5;
  392.          this._com_sprites[i].anchor.y = 0.5;
  393.          this.addChild(this._com_sprites[i]);
  394.          this._side[i] = [0,0];
  395.     };
  396. };
  397.  
  398. //==============================
  399. // * Create Arrows
  400. //==============================
  401. Window_ActorCommand.prototype.create_arrows = function() { 
  402.     if (this._com_mode_b === 1) {return}
  403.     this._arrow = [];
  404.     for (var i = 0; i < 2; i++) {
  405.          this._arrow[i] = new Sprite(this._arrow_img);
  406.          this._arrow[i].anchor.x = 0.5;
  407.          this._arrow[i].anchor.y = 0.5;      
  408.          this.addChild(this._arrow[i]);
  409.     };
  410. };
  411.  
  412. //==============================
  413. // * Create Com Name
  414. //==============================
  415. Window_ActorCommand.prototype.create_com_name = function() {   
  416.     this._com_name = new Sprite(new Bitmap(90,32))
  417.     this._com_name.x = Moghunter.bcom_com_name_x + 45;
  418.     this._com_name.y = Moghunter.bcom_com_name_y + 16;
  419.     this._com_name.bitmap.fontSize = Moghunter.bcom_com_font_size;
  420.     this.addChild(this._com_name);
  421. };
  422.  
  423. //==============================
  424. // * Refresh Com Name
  425. //==============================
  426. Window_ActorCommand.prototype.refresh_com_name = function() {
  427.     this._com_name.bitmap.clear();
  428.     this._com_name.opacity = 0;
  429.     this._com_name.anchor.x = 0.5;
  430.     this._com_name.anchor.y = 0.5;
  431.     this._com_name.bitmap.drawText(this.command_name(),0,0,this._com_name.bitmap.width,32,"center");
  432. };
  433.  
  434. //==============================
  435. // * Refresh Index
  436. //==============================
  437. Window_ActorCommand.prototype.refresh_index = function() {
  438.     this._com_index = this._index;
  439.     if (this._com_name) {this.refresh_com_name();}
  440. };
  441.  
  442. //==============================
  443. // * makeCommandList
  444. //==============================
  445. var _alias_mog_bcom_wcom_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
  446. Window_ActorCommand.prototype.makeCommandList = function() {
  447.     _alias_mog_bcom_wcom_makeCommandList.call(this);
  448.     if (BattleManager._actorIndex >= 0 && this._com_sprites) {this.refresh_com_sprites()};
  449. };
  450.    
  451. //==============================
  452. // * Refresh Com Sprites
  453. //==============================
  454. Window_ActorCommand.prototype.refresh_com_sprites = function() {
  455.     this._com_index = -1;
  456.     this._wh = [0,0];
  457.     this._zoom = [0,0];
  458.     this.refresh_bitmap_com();
  459.     this._layout.opacity = 0;
  460.     if (this._arrow) {this.refresh_arrow_position()};
  461.     this.position_clear();
  462.     this.update_battle_commands();
  463.     if (this._com_mode_b === 1) {this.refresh_ring_command()};
  464. };
  465.  
  466. //==============================
  467. // * Refresh Bitmap Com
  468. //==============================
  469. Window_ActorCommand.prototype.refresh_bitmap_com = function() {
  470.     for (var i = 0; i < this.maxCom(); i++) {
  471.         this._com_sprites[i].bitmap = this._com_images[BattleManager._actorIndex][i];
  472.         this._wh[0] = this.width / 2;
  473.         if (this._wh[1] < this._com_sprites[i].bitmap.height) {this._wh[1] = this._com_sprites[i].bitmap.height};          
  474.     };
  475.     for (var i = 0; i < this.maxCom(); i++) {  
  476.         this._com_sprites[i].x = this._wh[0] + Moghunter.bcom_com_x;
  477.         this._com_sprites[i].y = this._wh[1] + (this._wh[1] * i) + Moghunter.bcom_com_y;   
  478.     };
  479. };
  480.  
  481. //==============================
  482. // * Refresh Arrow Position
  483. //==============================
  484. Window_ActorCommand.prototype.refresh_arrow_position = function() {
  485.     this._arrow_org_y = [-Moghunter.bcom_arrow_y,this._wh[1] * ((this.limit_rows_sp() + 2)) + Moghunter.bcom_arrow_y];
  486.     this._arrow[0].x = this._wh[0] + Moghunter.bcom_arrow_x;
  487.     this._arrow[0].y = this._arrow_org_y[0];
  488.     this._arrow[1].x = this._wh[0] + Moghunter.bcom_arrow_x;;
  489.     this._arrow[1].y = this._arrow_org_y[1];
  490.     this._arrow[1].scale.y = -1;
  491. };
  492.  
  493. //==============================
  494. // * Update Arrow Visible
  495. //==============================
  496. Window_ActorCommand.prototype.update_arrow_visible = function() {
  497.     this._arrow[0].visible = false;
  498.     this._arrow[1].visible = false;
  499.     if (this._index > this.limit_rows_sp()) { this._arrow[0].visible = true};
  500.     if (this.maxCom() > (this.limit_rows_sp() + 1)) {this._arrow[1].visible = true;
  501.        if (this._index === (this.maxCom() - 1)) {this._arrow[1].visible = false}
  502.     };
  503.  
  504. };
  505.  
  506. //==============================
  507. // * Position Clear
  508. //==============================
  509. Window_ActorCommand.prototype.position_clear = function() {
  510.     this._old_visible = this.visible;
  511.     for (var i = 0; i < this._com_sprites.length; i++) {
  512.         this._com_sprites[i].opacity = 0;
  513.     };     
  514.     for (var i = 0; i < this.maxCom(); i++) {
  515.         if (this._com_mode_b === 0) {
  516.             this.position_clear_mode_0(i);
  517.         } else {
  518.             this._com_sprites[i].x = this._wh[0];
  519.             this._com_sprites[i].y = this._wh[1] + (this._wh[1] * i);
  520.         };
  521.         this._com_sprites[i].scale.x = 1.00;
  522.         this._com_sprites[i].scale.y > 1.00;
  523.     };
  524.     if (this._com_mode_b === 1) {this.refresh_ring_command()};
  525.     if (this._com_name) {this._com_name.opacity = 0};  
  526. };
  527.  
  528. //==============================
  529. // * Position Clear Mode 0
  530. //==============================
  531. Window_ActorCommand.prototype.position_clear_mode_0 = function(i) {
  532.   if (this._index > this.limit_rows_sp()) {
  533.            if (i >= this._index - this.limit_rows_sp() && i <= this._index) {
  534.              this._com_sprites[i].opacity = this.translucentOpacity();
  535.            } else {
  536.              this._com_sprites[i].opacity = 0;
  537.            };
  538.    } else {
  539.           if (i > this.limit_rows_sp()) {
  540.               this._com_sprites[i].opacity = 0;
  541.           } else {
  542.               this._com_sprites[i].opacity = this.translucentOpacity();
  543.           };
  544.    };
  545. };
  546.  
  547. //==============================
  548. // * processWheel
  549. //==============================
  550. Window_ActorCommand.prototype.processWheel = function() {
  551.     if (this.isOpenAndActive()) {
  552.         var threshold = 20;
  553.         if (TouchInput.wheelY >= threshold) {
  554.             this._index++;
  555.             SoundManager.playCursor();
  556.             if (this._index > (this.maxCom() - 1)) {this._index = 0};          
  557.         };
  558.         if (TouchInput.wheelY <= -threshold) {
  559.             this._index--;
  560.             SoundManager.playCursor();
  561.             if (this._index < 0) {this._index = (this.maxCom() - 1)};
  562.         };
  563.     };
  564. };
  565.  
  566. //==============================
  567. // * Update Input Commands
  568. //==============================
  569. Window_ActorCommand.prototype.update_input_commands = function() {
  570.       if (this._side_input) {this.update_side_input()};
  571. };
  572.  
  573. //==============================
  574. // * Update Side Input
  575. //==============================
  576. Window_ActorCommand.prototype.update_side_input = function() {
  577.     if (this.isOpenAndActive()) {
  578.     if (Input.isRepeated('right')) {
  579.         SoundManager.playCursor();
  580.         if (this._com_mode_b === 1) {
  581.             this._index--;     
  582.             if (this._index < 0) {this._index = (this.maxCom() - 1)};
  583.         } else {
  584.             this._index++;     
  585.             if (this._index > (this.maxCom() - 1)) {this._index = 0};      
  586.         }
  587.     };
  588.     if (Input.isRepeated('left')) {
  589.         SoundManager.playCursor();
  590.         if (this._com_mode_b === 1) {
  591.             this._index++;     
  592.             if (this._index > (this.maxCom() - 1)) {this._index = 0};  
  593.         } else {
  594.             this._index--;     
  595.             if (this._index < 0) {this._index = (this.maxCom() - 1)};  
  596.         }
  597.  
  598.     };
  599.     };
  600. };
  601.  
  602. //==============================
  603. // * LineHeight
  604. //==============================
  605. Window_ActorCommand.prototype.lineHeight = function() {
  606.     return 1;
  607. };
  608.  
  609. //==============================
  610. // * Max Com
  611. //==============================
  612. Window_ActorCommand.prototype.maxCom = function() {
  613.     if (!this._list) {return 0};
  614.     return this._list.length;
  615. };
  616.  
  617. //==============================
  618. // * Limit Rows SP
  619. //==============================
  620. Window_ActorCommand.prototype.limit_rows_sp = function() {
  621.     if (this._com_mode_b === 1) {this.maxCom()};
  622.     return this._row_max;
  623. };
  624.  
  625. //==============================
  626. // * Com Fade Speed
  627. //==============================
  628. Window_ActorCommand.prototype.com_fade_speed = function() {
  629.     return 20;
  630. };
  631.  
  632. //==============================
  633. // * Com Move Speed
  634. //==============================
  635. Window_ActorCommand.prototype.com_move_speed = function() {
  636.     if (this._com_mode_b === 1) {return 5};
  637.     return 20;
  638. };
  639.  
  640. //==============================
  641. // * Com Zoom Speed
  642. //==============================
  643. Window_ActorCommand.prototype.com_zoom_speed = function() {
  644.     return this._zoom_speed;
  645. };
  646.  
  647. //==============================
  648. // * Com Zoom Rate
  649. //==============================
  650. Window_ActorCommand.prototype.com_zoom_rate = function() {
  651.     return this._zoom_rate;
  652. };
  653.  
  654. //==============================
  655. // * Limit Height
  656. //==============================
  657. Window_ActorCommand.prototype.limit_height = function(i) {
  658.     if (this._index >= this.limit_rows_sp()) {
  659.        return (this._index - this.limit_rows_sp()) * this._wh[1];
  660.     };
  661.     return 0;
  662. };
  663.  
  664. //==============================
  665. // * Command Name
  666. //==============================
  667. Window_ActorCommand.prototype.command_name = function() {
  668.     if (!this._list || !this._list[this._index]) {return ""};
  669.     return this._list[this._index].name;
  670. };
  671.  
  672. //==============================
  673. // * Update Com Sprites
  674. //==============================
  675. Window_ActorCommand.prototype.update_battle_commands = function() {
  676.     this.contentsOpacity = 0;
  677.     this.opacity = 0;
  678.     if (this._com_index != this._index) {this.refresh_index()};
  679.     for (var i = 0; i < this._com_sprites.length; i++) {
  680.         if (i <= this.maxCom()) {
  681.             this._com_sprites[i].visible = true;
  682.             this.update_commands(i);
  683.         } else {    
  684.             this._com_sprites[i].opacity = 0;
  685.             this._com_sprites[i].visible = false;
  686.         };
  687.     };
  688.     if (this._old_visible != this.visible) {this.position_clear()};
  689.     if (this._arrow) {this.update_arrow()};
  690.     if (this._cursor_b) {this.update_cursor_b()};
  691.     if (this._com_name) {this._com_name.opacity += this.com_fade_speed()};
  692.     this._layout.opacity += this.com_fade_speed();
  693.     this.update_input_commands();
  694. };
  695.  
  696. //==============================
  697. // * Update Arrow
  698. //==============================
  699. Window_ActorCommand.prototype.update_arrow = function() {
  700.     this.update_arrow_slide();
  701.     this.update_arrow_visible();
  702.     this._arrow[0].y = this._arrow_org_y[0] - this._arrow_slide[0];
  703.     this._arrow[1].y = this._arrow_org_y[1] + this._arrow_slide[0];
  704. }; 
  705.  
  706. //==============================
  707. // * Update Arrow
  708. //==============================
  709. Window_ActorCommand.prototype.update_arrow_slide = function() {
  710.     this._arrow_slide[2] ++
  711.     if (this._arrow_slide[2] < 2) {return};
  712.     this._arrow_slide[2] = 0
  713.     this._arrow_slide[1] += 0.5;
  714.     if (this._arrow_slide[1] < 5) {
  715.         this._arrow_slide[0] += 1;
  716.     } else if (this._arrow_slide[1] < 10) {
  717.         this._arrow_slide[0] -= 1
  718.     } else {
  719.         this._arrow_slide = [0,0];
  720.     };
  721. };
  722.  
  723. //==============================
  724. // * Sprite Move To
  725. //==============================
  726. Window_ActorCommand.prototype.sprite_move_to = function(value,real_value,speed) {
  727.     if (value == real_value) {return value};
  728.     var dnspeed = 5 + (Math.abs(value - real_value) / speed);
  729.     if (value > real_value) {value -= dnspeed;
  730.         if (value < real_value) {value = real_value};}
  731.     else if (value < real_value) {value  += dnspeed;
  732.         if (value  > real_value) {value  = real_value};    
  733.     };
  734.     return Math.floor(value);
  735. };
  736.  
  737. //==============================
  738. // * Update Commands
  739. //==============================
  740. Window_ActorCommand.prototype.update_commands = function(i) {
  741.       this.update_position(i);
  742.       this.update_effect_selection(i);
  743. };
  744.  
  745. //==============================
  746. // * Update Ring Command
  747. //==============================
  748. Window_ActorCommand.prototype.update_ring_command = function(i,c_index) {
  749.       if (i >= this.maxCom()) {this._com_sprites[i].visible = false};
  750.       var rol_index = 1 / this.maxCom();
  751.       if (this._ring_move) {var si = c_index}
  752.       else {var si = 0};
  753.       var now_p = rol_index * (si - i);
  754.       var r_p = this._pi * -now_p;
  755.       this._wh[0] = Math.floor(this._rol_range * Math.sin(r_p));
  756.       this._wh[1] = -Math.floor(this._rol_range * Math.cos(r_p));
  757. };
  758.  
  759. //==============================
  760. // * Refresh Ring Position
  761. //==============================
  762. Window_ActorCommand.prototype.refresh_ring_command = function() {
  763.     for (var i = 0; i < this._com_sprites.legth; i++) {
  764.         this._com_sprites[i].visible = false;
  765.     };
  766.     for (var i = 0; i < this.maxCom(); i++) {
  767.         this.update_ring_command(i,i)
  768.         this._com_sprites[i].x = this.width / 2 + Moghunter.bcom_com_x;
  769.         this._com_sprites[i].y = this.height / 2 + Moghunter.bcom_com_y;   
  770.         this._com_sprites[i].visible = true;
  771.         this._com_sprites[i].opacity = 0;
  772.     };
  773. };
  774.  
  775. //==============================
  776. // * Update Position
  777. //==============================
  778. Window_ActorCommand.prototype.update_position = function(i) {
  779.     if (this._com_mode_b === 0) {
  780.         this._np[0] = this._wh[0] + Moghunter.bcom_com_x + this._side[i][0];
  781.         this._np[1] = this._wh[1] + (this._wh[1] * i) - this.limit_height() + Moghunter.bcom_com_y + this._side[i][1];
  782.     } else {
  783.         this.update_ring_command(i,this._index);
  784.         this._np[0] = (this.width / 2) + this._wh[0] + Moghunter.bcom_com_x + this._side[i][0];
  785.         this._np[1] = (this.height / 2) + this._wh[1] + Moghunter.bcom_com_y + this._side[i][1];       
  786.     };
  787.     this._com_sprites[i].x = this.sprite_move_to(this._com_sprites[i].x,this._np[0],this.com_move_speed());
  788.     this._com_sprites[i].y = this.sprite_move_to(this._com_sprites[i].y,this._np[1],this.com_move_speed());
  789. };
  790.  
  791. //==============================
  792. // * Update Effect Selection
  793. //==============================
  794. Window_ActorCommand.prototype.update_effect_selection = function(i) {  
  795.     if (this._index === i) {
  796.         this.update_on_index(i);
  797.     } else {
  798.         this.update_off_index(i);
  799.     };
  800.     this._com_sprites[i].scale.y = this._com_sprites[i].scale.x;
  801. };
  802.  
  803. //==============================
  804. // * Update On Index
  805. //==============================
  806. Window_ActorCommand.prototype.update_on_index = function(i) {
  807.     this._side[i] = [this._side_m[0],this._side_m[1]];
  808.     this._cursor_nxy = [this._com_sprites[i].x - (this._com_sprites[i].bitmap.width / 2),this._com_sprites[i].y];
  809.     this._com_sprites[i].opacity += this.com_fade_speed();
  810.     if (this._zoom_effect) {this.update_zoom_effect(i);};
  811. };
  812.  
  813. //==============================
  814. // * Update Off Index
  815. //==============================
  816. Window_ActorCommand.prototype.update_off_index = function(i) { 
  817.    this._side[i] = [0,0];
  818.    if (this._com_sprites[i].opacity > this.translucentOpacity()){this._com_sprites[i].opacity -= this.com_fade_speed()};
  819.    if (this._com_mode_b === 0) {this.update_off_mode_0(i)
  820.    } else {if (this._com_sprites[i].opacity < this.translucentOpacity()){this._com_sprites[i].opacity += this.com_fade_speed()};
  821.    };
  822.    if (this._com_sprites[i].scale.x > 1.00){this._com_sprites[i].scale.x -= this.com_zoom_speed()};
  823. };
  824.  
  825. //==============================
  826. // * Update Off Mode 0
  827. //==============================
  828. Window_ActorCommand.prototype.update_off_mode_0 = function(i) {
  829.    if (this._index > this.limit_rows_sp()) {
  830.            if (i >= this._index - this.limit_rows_sp() && i <= this._index) {
  831.              if (this._com_sprites[i].opacity < this.translucentOpacity()){this._com_sprites[i].opacity += this.com_fade_speed()};
  832.            } else {
  833.              this._com_sprites[i].opacity -= this.com_fade_speed();
  834.            };
  835.    } else {
  836.           if (i > this.limit_rows_sp()) {
  837.               this._com_sprites[i].opacity -= this.com_fade_speed();
  838.           } else {
  839.               if (this._com_sprites[i].opacity < this.translucentOpacity()){this._com_sprites[i].opacity += this.com_fade_speed()};
  840.           };
  841.    };
  842. };
  843.  
  844. //==============================
  845. // * Update Zoom Effect
  846. //==============================
  847. Window_ActorCommand.prototype.update_zoom_effect = function(i) {   
  848.      if (this._zoom[0] === 0) {
  849.          if (this._com_sprites[i].scale.x < this.com_zoom_rate()) {this._com_sprites[i].scale.x += this.com_zoom_speed()};
  850.          if (this._loop_zoom_effect && this._com_sprites[i].scale.x >= this.com_zoom_rate()) {this._zoom[0] = 1};
  851.      } else {
  852.          this._com_sprites[i].scale.x -= this.com_zoom_speed();
  853.          if (this._com_sprites[i].scale.x <= 1.00) {this._zoom[0] = 0};
  854.      };
  855. };
  856.  
  857. //==============================
  858. // * Process Touch
  859. //==============================
  860. Window_ActorCommand.prototype.processTouch = function() {
  861.     if (this.isOpenAndActive()) {
  862.         if (TouchInput.isCancelled()) {
  863.             if (this.isCancelEnabled()) {
  864.                 this.processCancel();
  865.             };
  866.         } else if (TouchInput.isTriggered() && this.isTouchedInsideCom()) {
  867.             this.sel_time = 5;
  868.         };     
  869.     };
  870. };
  871.  
  872. //==============================
  873. // * Process Touch
  874. //==============================
  875. Window_ActorCommand.prototype.isTouchedInsideCom = function() {
  876.     for (var i = 0; i < this._com_sprites.length; i++) {
  877.         if (this._com_sprites[i].visible && this._com_sprites[i].opacity > 25) {
  878.         if (TouchInput.x > this.x + this._com_sprites[i].x - (this._com_sprites[i].bitmap.width / 2) &&
  879.             TouchInput.x < this.x + this._com_sprites[i].x + this._com_sprites[i].bitmap.width - (this._com_sprites[i].bitmap.width / 2) &&
  880.             TouchInput.y > this.y + this._com_sprites[i].y - (this._com_sprites[i].bitmap.height / 2) &&
  881.             TouchInput.y < this.y + this._com_sprites[i].y + this._com_sprites[i].bitmap.height - (this._com_sprites[i].bitmap.height / 2))
  882.             {this._index = i ;return true};
  883.         };
  884.     }; 
  885.     return false;
  886. };
  887.  
  888. //==============================
  889. // * Update Wait Selection
  890. //==============================
  891. Window_ActorCommand.prototype.update_wait_selection = function() {
  892.     this.sel_time--;
  893.     if (this.sel_time === 0) { this.processOk();};
  894.     if (BattleManager._actorIndex >= 0) {this.update_battle_commands()};
  895. };
  896.  
  897. //==============================
  898. // * Update
  899. //==============================
  900. var _alias_mog_bcom_wcom_update = Window_ActorCommand.prototype.update;
  901. Window_ActorCommand.prototype.update = function() {
  902.     if ($gameTemp._bcom_need_refresh) {$gameTemp._bcom_need_refresh = false;this.battle_commands_initialize()};
  903.     if (this.sel_time > 0) {this.update_wait_selection();return;};
  904.     _alias_mog_bcom_wcom_update.call(this);
  905.     if (BattleManager._actorIndex >= 0) {this.update_battle_commands()};
  906. };
  907.  
  908. //==============================
  909. // * Set Mcursor Data
  910. //==============================
  911. Window_ActorCommand.prototype.set_mcursor_data = function() {
  912. };
  913.  
  914. //==============================
  915. // * Create Layout Window
  916. //==============================
  917. var _alias_mog_bcom_sbat_create_layout_window = Scene_Battle.prototype.create_layout_window
  918. Scene_Battle.prototype.create_layout_window = function() {
  919.     _alias_mog_bcom_sbat_create_layout_window.call(this)
  920.     if (this._com_layout) {this.removeChild(this._com_layout)};
  921. };
  922.  
  923. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement