查看: 7533|回复: 8

[已经解决] 求教敌人动态战斗插件的bug怎么弄

[复制链接]
梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
发表于 2015-11-8 23:35:49 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 余烬之中 于 2015-11-24 12:40 编辑

鼠标选择不了敌人,只能键盘选择
不知道啥冲突

AnimatedSVEnemies.js
  1. //=============================================================================
  2. // AnimatedSVEnemies.js
  3. // Version: 1.12.11 - Live and Reloaded
  4. //=============================================================================

  5. var Imported = Imported || {};
  6. Imported.AnimatedSVEnemies = true;

  7. var Rexal = Rexal || {};
  8. Rexal.ASVE = Rexal.ASVE || {};
  9. /*:
  10. * @plugindesc Version: 1.12.11 - Live and Reloaded
  11. * - Lets enemies be animated!
  12. * @author Rexal
  13. *

  14.   * @param Debug
  15. * @desc Log to the Console(F8)?
  16. * @default true

  17. * @param No Movement
  18. * @desc Prevents enemies from moving whenever they perform an action.
  19. * @default false

  20. * @param Enemies Celebrate
  21. * @desc Enemies will celebrate over your demise.
  22. * @default true

  23.   * @param SV Enemies Collapse
  24. * @desc All SV Enemies will collapse after death.
  25. * @default false

  26. * @param Static Enemies Breathe
  27. * @desc Static Enemies have a breathing effect
  28. * @default true

  29. * @param AGI Effects Breathing
  30. * @desc Static Enemies with a higher AGI stat will breathe faster.
  31. * @default true

  32. * @param Scale Statics by Distance
  33. * @desc Static Enemies will be smaller the further away they are in the background
  34. * @default true

  35.   * @param Damage Slows Down Breathing
  36. * @desc Breathing slows down the more damage they take
  37. * @default true

  38.   * @help

  39. --------------------------------------------------------------------------------
  40. Notetags
  41. ================================================================================


  42. ---------------------------[SV Battlers]---------------------------------

  43. [SV Animated]
  44. - Sets the enemy to use the an SV Actor sprite. These are located in the sv_actors
  45. folder. Make sure that there's a sprite in that folder that matches the name
  46. of the enemy's image you used.

  47. [Collapse]
  48. - Lets the SV Enemy use collapse animations regardless of parameter settings.

  49. [No Collapse]
  50. - Prevents the SV Enemy from using collapse animations regardless of parameter settings.

  51. SV Motion: motion
  52. - Sets the enemy to use this motion when attacking. If you don't know what motions
  53. you can use, refer to the motion list at the bottom of the help section.

  54.   SV Weapon: id
  55. - "Equips" the enemy with this weapon.

  56. Ex: SV Weapon: 1


  57.   ----------------------------[Static Battlers]---------------------------------

  58. [Breathless]
  59. -This enemy doesn't breathe. Useful for golems and evil walls.

  60. [Float]
  61. -Makes enemies have a floating effect similar to rm2k3's.

  62. Breath Control: speedScale,xScale,yScale
  63. -Sets the speed of the sine wave and how many times the size of the sprite it's
  64.   allowed to go width-wise and height-wise.
  65.   
  66.   You'll have to play around with the values a bit until it looks right. The
  67.   example below is the default settings.

  68. Ex: Breath Control: 50,5,25


  69. -----------------------------------[Both]---------------------------------------

  70. Enemy Scale: amount

  71. multiplies the size of the enemy by this amount.


  72. --------------------------------------------------------------------------------
  73. Version Log
  74. ================================================================================
  75.   
  76. v1 - Initial Version

  77. v1.05 - Many fixes
  78. - Fixed issue with enemies not playing the right animations when more than one
  79. enemy is on the screen.
  80. - Misc. Fixes that I've forgotten about.
  81. - Added SV Weapon, which lets you play a weapon animation(currently backwards).
  82. This is not yet compatible with my other script: Sprite Weapons Enhanced.
  83. - Added a param that stops enemies from moving.

  84.   v1.075 - Deep breaths
  85. - Static enemies breathe now!
  86. - Added a bunch of stuff to control the breathing. (notetags do not work!)

  87.    v1.08 - Fixed Breathing
  88. - The breathing notetags work now! Yay!
  89. - Added [Float]

  90.    v1.1 - Live and Reloaded
  91.    
  92.   -Breathing slows down the less hp an enemy has. (orignally they just breathed less)
  93.   - Added an option that lets enemies scale down the further into the background they are.
  94.   - Fixed the weapons!
  95.   - Enemies can celebrate your demise.
  96.   - Fixed the Flash Target bug.
  97.   - SV Enemies can collapse.
  98.   - SV Enemies will properly appear
  99.   - Enemies have a proper escape animation.
  100.   - Enemies are now properly positioned.
  101.   - You can now scale the enemies however you want.
  102.   
  103.    v1.101 -
  104.    
  105.    - Added a parameter to prevent enemies from breathing slower the more damage they take.
  106.    
  107.    v1.11 -
  108.    
  109.    - Fixed the positioning. SORRY!
  110.    
  111.    v1.111 -
  112.    - No comment.
  113.       v1.113 -
  114.    Fixed the weapons.
  115.    
  116.    v1.12 -
  117.    - Completely rewrote crucial portions of the script.
  118.    - Note tags are no longer case-sensitive.
  119.    - Fixed the positioning officially.
  120.    - Fixed the floating issue.
  121.       
  122.           v1.12.1 -
  123.    - Made SV Battlers recognizable as enemies.
  124.    - [SV] Overlays should be facing the right way now.
  125.           v1.12.11
  126.         -Fixed the weapon positions. AGAIN


  127. --------------------------------------------------------------------------------
  128. Motion List
  129. ================================================================================
  130. walk - Ready Animation
  131. wait - The Idle Animation
  132. chant - Magic Ready animation
  133. guard - The Guard Animation
  134. damage - Damage Animation
  135. evade - Miss! Animation
  136. thrust - Stabbing Animation
  137. swing - Swinging Animation
  138. missile - Shooting Animation
  139. skill - Physical Skill Use Animation
  140. spell - Magical Skill Use Animation
  141. item - Item Use Animation
  142. escape - Escape Animation
  143. victory - Victory Animation
  144. dying - The "Danger" Animation
  145. abnormal - The State Affected Animation
  146. sleep - The Sleeping Animation
  147. dead - The Dead Animation


  148. */

  149. Rexal.ASVE.Parameters = PluginManager.parameters('animatedSVEnemies');
  150. Rexal.ASVE.Debug = eval(String(Rexal.ASVE.Parameters['Debug']));
  151. Rexal.ASVE.NoMovement = eval(String(Rexal.ASVE.Parameters['No Movement']));
  152.   Rexal.ASVE.Breathe = eval(String(Rexal.ASVE.Parameters['Static Enemies Breathe']));
  153.   Rexal.ASVE.AGIB = eval(String(Rexal.ASVE.Parameters['AGI Effects Breathing']));
  154.   Rexal.ASVE.Celebration = eval(String(Rexal.ASVE.Parameters['Enemies Celebrate']));
  155.    Rexal.ASVE.DoCollapse = eval(String(Rexal.ASVE.Parameters['SV Enemies Collapse']));
  156. Rexal.ASVE.DamageSlow = eval(String(Rexal.ASVE.Parameters['Damage Slows Down Breathing']));
  157.      Rexal.ASVE.ScaleStatics = eval(String(Rexal.ASVE.Parameters['Scale Statics by Distance']));  
  158.   //-----------------------------------------------------------------------------
  159. // BattleManager
  160. //=============================================================================
  161.   
  162.   if(Rexal.ASVE.Celebration)
  163.   {  

  164.   BattleManager.processDefeat = function() {
  165.     if(Rexal.ASVE.Celebration)$gameTroop.performVictory();
  166.         this.displayDefeatMessage();
  167.     this.playDefeatMe();
  168.     if (this._canLose) {
  169.         this.replayBgmAndBgs();
  170.     } else {
  171.         AudioManager.stopBgm();
  172.     }
  173.     this.endBattle(2);
  174. };
  175.   }
  176.   
  177.   //-----------------------------------------------------------------------------
  178. // Game_Enemy
  179. //=============================================================================

  180.         Game_Enemy.prototype.performAttack = function() {
  181.                
  182.                
  183.                         if(this._weaponId == 0){this.requestMotion(this._motion);
  184.                         return;
  185.                         }
  186.                
  187.      var weapon = $dataWeapons[this._weaponId];
  188.     var wtypeId = weapon.wtypeId;
  189.     var attackMotion = $dataSystem.attackMotions[wtypeId];
  190.     if (attackMotion) {
  191.         if (attackMotion.type === 0) {
  192.             this.requestMotion('thrust');
  193.         } else if (attackMotion.type === 1) {
  194.             this.requestMotion('swing');
  195.         } else if (attackMotion.type === 2) {
  196.             this.requestMotion('missile');
  197.         }
  198.                
  199.                 if(this._motion != 'thrust')this.requestMotion(this._motion);
  200.                
  201.                 this.startWeaponAnimation(attackMotion.weaponImageId);
  202.     }
  203. };


  204. Game_Enemy.prototype.performAction = function(action) {
  205.     Game_Battler.prototype.performAction.call(this, action);
  206.     if (action.isAttack()) {
  207.         this.performAttack();
  208.     } else if (action.isGuard()) {
  209.         this.requestMotion('guard');
  210.     } else if (action.isMagicSkill()) {
  211.         this.requestMotion('spell');
  212.     } else if (action.isSkill()) {
  213.         this.requestMotion('skill');
  214.     } else if (action.isItem()) {
  215.         this.requestMotion('item');
  216.     }
  217. };

  218. Game_Enemy.prototype.performDamage = function() {
  219.     Game_Battler.prototype.performDamage.call(this);
  220.     if (this.isSpriteVisible()) {
  221.         this.requestMotion('damage');
  222.     } else {
  223.         $gameScreen.startShake(5, 5, 10);
  224.     }
  225.     SoundManager.playActorDamage();
  226. };

  227. Game_Enemy.prototype.performEvasion = function() {
  228.     Game_Battler.prototype.performEvasion.call(this);
  229.     this.requestMotion('evade');
  230. };

  231. Game_Enemy.prototype.performMagicEvasion = function() {
  232.     Game_Battler.prototype.performMagicEvasion.call(this);
  233.     this.requestMotion('evade');
  234. };

  235. Game_Enemy.prototype.performCounter = function() {
  236.     Game_Battler.prototype.performCounter.call(this);
  237.     this.performAttack();
  238. };

  239. Game_Enemy.prototype.performVictory = function() {
  240.     if (this.canMove()) {
  241.         this.requestMotion('victory');
  242.     }
  243. };


  244. Game_Enemy.prototype.makeActions = function() {
  245.     Game_Battler.prototype.makeActions.call(this);
  246.     if (this.numActions() > 0) {
  247.         var actionList = this.enemy().actions.filter(function(a) {
  248.             return this.isActionValid(a);
  249.         }, this);
  250.         if (actionList.length > 0) {
  251.             this.selectAllActions(actionList);
  252.         }
  253.     }
  254. this.setActionState('undecided');
  255. };


  256. Game_Enemy.prototype.performEscape = function() {
  257.     if (this.canMove()) {
  258.         this.requestMotion('escape');
  259.     }
  260. };

  261.        
  262. Game_Enemy.prototype.attackAnimationId = function() {

  263.   if(this._weaponId!=0)  return $dataWeapons[this._weaponId].animationId;
  264.   else
  265.           return 1;
  266. };

  267.   //-----------------------------------------------------------------------------
  268. // Game_Troop
  269. //=============================================================================
  270. Game_Troop.prototype.performVictory = function() {
  271.     this.members().forEach(function(enemy) {
  272.         enemy.performVictory();
  273.     });
  274. };
  275.   //-----------------------------------------------------------------------------
  276. // Sprite_Enemy
  277. //=============================================================================

  278. Sprite_Enemy.prototype.setBattler = function(battler) {
  279.     Sprite_Battler.prototype.setBattler.call(this, battler);
  280.     this._enemy = battler;
  281.     this.setHome(battler.screenX(), battler.screenY());
  282.     this._stateIconSprite.setup(battler);
  283. };
  284.        
  285. Sprite_Enemy.prototype.updateBitmap = function() {

  286.        


  287.         if(!this._enemy._breathless && Rexal.ASVE.Breathe){

  288.                 var a = 1;
  289.                 if(Rexal.ASVE.AGIB) a = this._enemy.agi/100+1;
  290.         var breathS = this._enemy._breath[0]/1000;
  291.         if(Rexal.ASVE.DamageSlow) breathS *= (this._enemy.hp/this._enemy.mhp)+.1;
  292.         var breathY = Math.cos(Graphics.frameCount*breathS*a)*(this._enemy._breath[2]/1000);
  293.         var breathX = Math.cos(Graphics.frameCount*breathS)*(this._enemy._breath[1]/1000);
  294.        
  295.         if(Rexal.ASVE.DamageSlow)breathY *= (this._enemy.hp/this._enemy.mhp);
  296.         var ss = Graphics.boxHeight/624+.1;
  297.         if(Rexal.ASVE.ScaleStatics)var s = ss*(this._homeY/Graphics.boxHeight)*this._enemy._scale;
  298.         else var s = this._enemy._scale;
  299.        
  300.        
  301.         this.scale.y = s+breathY;
  302.         this.scale.x = s+breathX;
  303.        
  304.         }
  305.        
  306.         if(this._enemy._floating && !this.isBusy)
  307.         {
  308.                 var f = Math.cos(Graphics.frameCount/50)*20;
  309.                 this.setHome(this._enemy.screenX(),this._enemy.screenY()+f);
  310.         }
  311.        
  312.             Sprite_Battler.prototype.updateBitmap.call(this);
  313.     var name = this._enemy.battlerName();
  314.     var hue = this._enemy.battlerHue();
  315.     if (this._battlerName !== name || this._battlerHue !== hue) {
  316.         this._battlerName = name;
  317.         this._battlerHue = hue;
  318.         this.loadBitmap(name, hue);
  319.         this.initVisibility();
  320.     }
  321. };


  322. Sprite_Enemy.prototype.stepForward = function() {
  323.    if(!Rexal.ASVE.NoMovement) this.startMove(48, 0, 12);
  324. };


  325.        
  326.                 Sprite_Enemy.prototype.setHome = function(x,y) {
  327.                        
  328.                         var dX = Graphics.boxWidth/816;
  329.                         var dY = Graphics.boxHeight/624;
  330.                        
  331.                         y*= dY;
  332.                         x*= dX;
  333.                        
  334.                         this._homeX = x;
  335.                         this._homeY = y + (Graphics.boxHeight - 624)/3;
  336.                         this.updatePosition();
  337.         };

  338.   //-----------------------------------------------------------------------------
  339. // Sprite_EnemyRex
  340. //=============================================================================

  341. function Sprite_EnemyRex() {
  342.     this.initialize.apply(this, arguments);
  343. }


  344. Sprite_EnemyRex.prototype = Object.create(Sprite_Actor.prototype);
  345. Sprite_EnemyRex.prototype.constructor = Sprite_EnemyRex;

  346. Sprite_EnemyRex.prototype.createWeaponSprite = function() {
  347.        
  348.     this._weaponSprite = new Sprite_Weapon();

  349.     this.addChild(this._weaponSprite);
  350. };


  351. Sprite_Actor.prototype.createStateSprite = function() {
  352.     this._stateSprite = new Sprite_StateOverlay();
  353.         this._stateSprite.scale.x  = -1;
  354.     this.addChild(this._stateSprite);
  355. };



  356. Sprite_EnemyRex.prototype.updateSelectionEffect = function() {
  357.        
  358.             var target = this._effectTarget;
  359.     if (this._battler.isSelected()) {
  360.         this._selectionEffectCount++;
  361.         if (this._selectionEffectCount % 30 < 15) {
  362.             target.setBlendColor([255, 255, 255, 64]);
  363.         } else {
  364.             target.setBlendColor([0, 0, 0, 0]);
  365.         }
  366.     } else if (this._selectionEffectCount > 0) {
  367.         this._selectionEffectCount = 0;
  368.         target.setBlendColor([0, 0, 0, 0]);
  369.     }
  370.        
  371. }

  372. Sprite_EnemyRex.prototype = Object.create(Sprite_Actor.prototype);
  373. Sprite_EnemyRex.prototype.constructor = Sprite_EnemyRex;

  374. Sprite_EnemyRex.prototype.initialize = function(battler) {
  375.     Sprite_Battler.prototype.initialize.call(this, battler);

  376. };

  377. Sprite_EnemyRex.prototype.loadBitmap = function(name, hue) {
  378.     if ($gameSystem.isSideView()) {
  379.         this.bitmap = ImageManager.loadSvActor(name,hue);
  380.     } else {
  381.         this.bitmap = ImageManager.loadEnemy(name, hue);
  382.     }
  383. };

  384. Sprite_EnemyRex.prototype.setBattler = function(battler) {
  385.     Sprite_Battler.prototype.setBattler.call(this, battler);
  386.     var changed = (battler !== this._actor);
  387.     if (changed) {
  388.         this._actor = battler;
  389.         if (battler) {
  390.             this.setActorHome(battler);
  391.         }
  392.         this.startEntryMotion();
  393.         this._stateSprite.setup(battler);
  394.     }
  395. };


  396. Sprite_EnemyRex.prototype.updateBitmap = function() {
  397.         this.updateEffect();
  398.     Sprite_Battler.prototype.updateBitmap.call(this);
  399.         var hue = this._actor.battlerHue();
  400.     var name = this._actor.battlerName();
  401.     if (this._battlerName !== name) {
  402.         this._battlerName = name;
  403.         this._mainSprite.bitmap = ImageManager.loadSvActor(name,hue);
  404.                 this._mainSprite.scale.x = -this._actor._scale;
  405.                 this._mainSprite.scale.y = this._actor._scale;
  406.     }
  407. };

  408. Sprite_EnemyRex.prototype.setupWeaponAnimation = function() {
  409.     if (this._actor.isWeaponAnimationRequested()) {
  410.         this._weaponSprite.setup(this._actor.weaponImageId() );
  411.                 this._weaponSprite.scale.x = -this._actor._scale;
  412.                 this._weaponSprite.scale.y = this._actor._scale;
  413.                 this._weaponSprite.x = -this._weaponSprite.x;
  414.         this._actor.clearWeaponAnimation();
  415.     }

  416. };

  417. Sprite_EnemyRex.prototype.setActorHome = function(battler) {
  418.                        
  419.                         var dX = Graphics.boxWidth/816;
  420.                         var dY = Graphics.boxHeight/624;
  421.        
  422.                         var x = battler.screenX()*dX;
  423.                         var y = battler.screenY()*dY;
  424.                        
  425.                         this._homeX = x;
  426.                         this._homeY = y + (Graphics.boxHeight - 624)/3;
  427.                         this.updatePosition();
  428.         };


  429. Sprite_EnemyRex.prototype.damageOffsetX = function() {
  430.     return 32;
  431. };

  432. Sprite_EnemyRex.prototype.stepForward = function() {
  433.    if(!Rexal.ASVE.NoMovement) this.startMove(48, 0, 12);
  434. };

  435. Sprite_EnemyRex.prototype.stepBack = function() {
  436.    if(!Rexal.ASVE.NoMovement) this.startMove(0, 0, 12);
  437. };

  438. Sprite_EnemyRex.prototype.retreat = function() {
  439.     this.startMove(300, 0, 30);
  440. };

  441. Sprite_EnemyRex.prototype.initVisibility = function() {
  442.     this._appeared = this._actor.isAlive();
  443.     if (!this._appeared) {
  444.         this.opacity = 0;
  445.     }
  446. };

  447. Sprite_EnemyRex.prototype.setupEffect = function() {
  448.                

  449.     if (this._appeared && this._actor.isEffectRequested()) {
  450.         this.startEffect(this._actor.effectType());
  451.         this._actor.clearEffect();
  452.     }
  453.     if (!this._appeared && this._actor.isAlive()) {
  454.         this.startEffect('appear');
  455.     } else if (this._appeared && this._actor.isHidden()) {
  456.         this.startEffect('disappear');
  457.     }
  458. };

  459. Sprite_EnemyRex.prototype.startEffect = function(effectType) {
  460.        
  461.     this._effectType = effectType;
  462.     switch (this._effectType) {
  463.     case 'appear':
  464.         this.startAppear();
  465.         break;
  466.     case 'disappear':
  467.         this.startDisappear();
  468.         break;
  469.     case 'whiten':
  470.         this.startWhiten();
  471.         break;
  472.     case 'blink':
  473.         this.startBlink();
  474.         break;
  475.     case 'collapse':
  476.      if(this._actor._collapse)   this.startCollapse();
  477.         break;
  478.     case 'bossCollapse':
  479.         this.startBossCollapse();
  480.         break;
  481.     case 'instantCollapse':
  482.         this.startInstantCollapse();
  483.         break;
  484.     }
  485.     this.revertToNormal();
  486. };

  487. Sprite_EnemyRex.prototype.startAppear = function() {
  488.     this._effectDuration = 16;
  489.     this._appeared = true;
  490. };

  491. Sprite_EnemyRex.prototype.startDisappear = function() {
  492.     this._effectDuration = 32;
  493.     this._appeared = false;
  494. };

  495. Sprite_EnemyRex.prototype.startWhiten = function() {
  496.     this._effectDuration = 16;
  497. };

  498. Sprite_EnemyRex.prototype.startBlink = function() {
  499.     this._effectDuration = 20;
  500. };

  501. Sprite_EnemyRex.prototype.startCollapse = function() {
  502.     this._effectDuration = 32;
  503.     this._appeared = false;
  504. };

  505. Sprite_EnemyRex.prototype.startBossCollapse = function() {
  506.     this._effectDuration = this._mainSprite.height;
  507.     this._appeared = false;
  508. };

  509. Sprite_EnemyRex.prototype.startInstantCollapse = function() {
  510.     this._effectDuration = 16;
  511.     this._appeared = false;
  512. };

  513. Sprite_EnemyRex.prototype.updateEffect = function() {

  514.        
  515.     this.setupEffect();
  516.     if (this._effectDuration > 0) {
  517.         this._effectDuration--;
  518.         switch (this._effectType) {
  519.         case 'whiten':
  520.             this.updateWhiten();
  521.             break;
  522.         case 'blink':
  523.             this.updateBlink();
  524.             break;
  525.         case 'appear':
  526.             this.updateAppear();
  527.             break;
  528.         case 'disappear':
  529.             this.updateDisappear();
  530.             break;
  531.         case 'collapse':
  532.        if(this._actor._collapse)     this.updateCollapse();
  533.             break;
  534.         case 'bossCollapse':
  535.        if(this._actor._collapse)     this.updateBossCollapse();
  536.             break;
  537.         case 'instantCollapse':
  538.       if(this._actor._collapse)      this.updateInstantCollapse();
  539.             break;
  540.         }
  541.         if (this._effectDuration === 0) {
  542.             this._effectType = null;
  543.         }
  544.     }
  545. };


  546.        
  547. Sprite_EnemyRex.prototype.isEffecting = function() {
  548.    if(this._actor._collapse) return this._effectType !== null;
  549. };



  550. Sprite_EnemyRex.prototype.revertToNormal = function() {
  551.     this._shake = 0;
  552.     this.blendMode = 0;
  553.     this.opacity = 255;
  554.     this.setBlendColor([0, 0, 0, 0]);
  555. };

  556. Sprite_EnemyRex.prototype.updateWhiten = function() {
  557.     var alpha = 128 - (16 - this._effectDuration) * 10;
  558.     this.setBlendColor([255, 255, 255, alpha]);
  559. };

  560. Sprite_EnemyRex.prototype.updateBlink = function() {
  561.     this.opacity = (this._effectDuration % 10 < 5) ? 255 : 0;
  562. };

  563. Sprite_EnemyRex.prototype.updateAppear = function() {
  564.             this.setHome(this._homeX,this._homeY);
  565.                     this.opacity = (16 - this._effectDuration) * 16;
  566. };

  567. Sprite_EnemyRex.prototype.updateDisappear = function() {
  568.             this.setHome(this._homeX-10,this._homeY);
  569.     this.opacity = 256 - (32 - this._effectDuration) * 10;
  570. };

  571. Sprite_Enemy.prototype.updateAppear = function() {
  572.             this.setHome(this._homeX,this._homeY);
  573.                                     this.opacity = (16 - this._effectDuration) * 16;
  574. };

  575. Sprite_Enemy.prototype.updateDisappear = function() {
  576.             this.setHome(this._homeX-10,this._homeY);
  577.     this.opacity = 256 - (32 - this._effectDuration) * 10;
  578. };

  579. Sprite_EnemyRex.prototype.updateCollapse = function() {
  580.     this.blendMode = Graphics.BLEND_ADD;
  581.     this.setBlendColor([255, 128, 128, 128]);
  582.     this.opacity *= this._effectDuration / (this._effectDuration + 1);
  583. };

  584. Sprite_EnemyRex.prototype.updateBossCollapse = function() {
  585.     this._shake = this._effectDuration % 2 * 4 - 2;
  586.     this.blendMode = Graphics.BLEND_ADD;
  587.     this.opacity *= this._effectDuration / (this._effectDuration + 1);
  588.     this.setBlendColor([255, 255, 255, 255 - this.opacity]);
  589.     if (this._effectDuration % 20 === 19) {
  590.         SoundManager.playBossCollapse2();
  591.     }
  592. };

  593. Sprite_EnemyRex.prototype.updateInstantCollapse = function() {
  594.     this.opacity = 0;
  595. };

  596. Sprite_EnemyRex.prototype.damageOffsetX = function() {
  597.     return 0;
  598. };

  599. Sprite_EnemyRex.prototype.damageOffsetY = function() {
  600.     return -8;
  601. };

  602.   //-----------------------------------------------------------------------------
  603. // Spriteset_Battle
  604. //=============================================================================

  605. Spriteset_Battle.prototype.createEnemies = function() {
  606.     var enemies = $gameTroop.members();
  607.     var sprites = [];
  608.     for (var i = 0; i < enemies.length; i++) {
  609.         var enemy = enemies[i];
  610.         var baseEnemy = $dataEnemies[enemies[i].enemyId()];
  611.        
  612.         Rexal.ASVE.processEnemyNoteTag(baseEnemy);
  613.         Rexal.ASVE.processEnemyData(enemy,baseEnemy);
  614.        
  615.     if(enemy._animated)  
  616.         {
  617.                 sprites[i] = new Sprite_EnemyRex(enemies[i]);
  618.                 sprites[i]._enemy = sprites[i]._actor;
  619.                 sprites[i].opacity = 0;
  620.         }
  621.         else
  622.                 sprites[i] = new Sprite_Enemy(enemies[i]);
  623.        
  624.     }
  625.        
  626.     sprites.sort(this.compareEnemySprite.bind(this));
  627.     for (var j = 0; j < sprites.length; j++) {
  628.         this._battleField.addChild(sprites[j]);
  629.     }
  630.     this._enemySprites = sprites;
  631. };


  632. // Spriteset_Battle.prototype.updateActors = function() {
  633.     // var members = $gameParty.battleMembers();
  634.             // var enemies = $gameTroop.members();
  635.                
  636.                     // for (var i = 0; i < this._enemySprites.length; i++) {
  637.         // this._enemySprites[i].setBattler(enemies[i]);
  638.     // }
  639.                
  640.     // for (var i = 0; i < this._actorSprites.length; i++) {
  641.         // this._actorSprites[i].setBattler(members[i]);
  642.     // }
  643. // };


  644.   //-----------------------------------------------------------------------------
  645. // Rex Functions
  646. //=============================================================================

  647. Object.defineProperties(Game_Enemy.prototype, {
  648.   animated: { get: function() { return this._animated; }, configurable: true },
  649.   motion: { get: function() { return this._motion; }, configurable: true },
  650.   weaponid: { get: function() { return this._weaponId; }, configurable: true },
  651.   breathless: { get: function() { return this._breathless; }, configurable: true },
  652.   floating: { get: function() { return this._float; }, configurable: true },
  653.   scale: { get: function() { return this._scale; }, configurable: true },
  654.   collapse: { get: function() { return this._collapse; }, configurable: true },
  655.   breath: { get: function() { return this._breath; }, configurable: true }
  656. });

  657. Rexal.log = function(message,type){
  658. if(!Rexal.ASVE.Debug) return;
  659. if(!type) type = 'log';

  660. switch (type) {
  661.        

  662.         case 'log' :
  663.         console.log(message);
  664.         break;
  665.        
  666.         case 'info' :
  667.         console.debug(message);
  668.         break;
  669.        
  670.         case 'warn' :
  671.         console.warn(message);
  672.         break;
  673.        
  674.         case 'error' :
  675.         console.error(message);
  676.         break;
  677. }

  678. }

  679. Rexal.ASVE.processEnemyData = function(obj,obj2) {
  680. obj._breath = [];
  681. obj._animated = obj2.animated;
  682. obj._motion = obj2.motion;
  683. obj._weaponId = obj2.weaponid;
  684. obj._breathless = obj2.breathless;
  685. obj._floating = obj2.floating;
  686. obj._scale = obj2.scale;
  687. obj._breath[0] = obj2.breath[0];
  688. obj._breath[1] = obj2.breath[1];
  689. obj._breath[2] = obj2.breath[2];
  690. obj._collapse = obj2.collapse;
  691. }

  692. Rexal.ASVE.processEnemyNoteTag = function(obj) {

  693. Rexal.log('reading ' + obj.name + '...');

  694. obj.motion = 'thrust';
  695. obj.weaponid = 0;
  696. obj.collapse = Rexal.ASVE.DoCollapse;
  697. obj.breath = [50,5,25];
  698. obj.scale = 1.0;

  699. if(obj == null)return;

  700.                 var notedata = obj.note.split(/[\r\n]+/);

  701.                 for (var i = 0; i < notedata.length; i++) {
  702.                 var line = notedata[i];
  703.                 var lines = line.split(': ');
  704.                
  705.                 switch (lines[0].toLowerCase()) {
  706.                
  707.                 case '[sv animated]' :
  708.         obj.animated = true;
  709.                 Rexal.log(obj.name + ' is using SV Battler sprites','info');
  710.                 break;
  711.                
  712.                 case 'sv motion' :
  713.         obj.motion = lines[1].toLowerCase();
  714.                 Rexal.log(obj.name + "'s attack motion is:" + obj.motion,'info');
  715.                 break;
  716.                
  717.                 case 'sv weapon' :
  718.         obj.weaponid = parseInt(lines[1]);
  719.                 Rexal.log(obj.name + " has weapon " + $dataWeapons[obj.weaponid].name,'info');
  720.                 break;
  721.                
  722.                 case '[breathless]' :
  723.         obj.breathless = true;
  724.                 Rexal.log(obj.name + " is breathless.",'info');
  725.                 break;       
  726.                
  727.                 case '[float]' :
  728.                 obj.floating = true;
  729.                 Rexal.log(obj.name + " floats.",'info');
  730.                 break;       
  731.                
  732.                 case '[collapse]' :
  733.                 obj.collapse = true;
  734.                 Rexal.log(obj.name + " can collapse.",'info');               
  735.                 break;       
  736.                
  737.                 case '[no collapse]' :
  738.                 obj.collapse = false;
  739.                 Rexal.log(obj.name + " cannot collapse.",'info');       
  740.                 break;
  741.                
  742.                 case 'breath control' :
  743.                
  744.                 var lines2 = lines[1].split(',');
  745.                 obj.breath[0] = parseInt(lines2[0]);
  746.                 obj.breath[1] = parseInt(lines2[1]);
  747.                 obj.breath[2] = parseInt(lines2[2]);
  748.                 Rexal.log(obj.name + "'s breath control: " + obj.breath,'info');
  749.                 break;
  750.                
  751.                 case 'enemy scale' :
  752.                 obj.scale = parseFloat(lines[1]);
  753.                 Rexal.log(obj.name + " is " + obj.scale +"x bigger than normal.",'info');
  754.                 }
  755.                
  756.                        
  757.                 }
  758.                 return obj;
  759. };
复制代码
梦石
0
星屑
90
在线时间
387 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-11-8 23:41:34 | 显示全部楼层
我用这插件没遇到这个bug,估计不是这个插件的问题


ps 如果你用了yep battle engine core 那还要用yep补丁https://raw.githubusercontent.co ... anflyEnginePatch.js

点评

老大,我传了我的整个包,帮忙看看吧,谢谢  发表于 2015-11-9 17:57
谢谢,我去试试看  发表于 2015-11-9 00:11
吸吸
回复

使用道具 举报

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
 楼主| 发表于 2015-11-9 00:18:47 | 显示全部楼层
本帖最后由 余烬之中 于 2015-11-24 12:42 编辑
trentswd 发表于 2015-11-8 23:41
我用这插件没遇到这个bug,估计不是这个插件的问题


还是不行,啥情况,郁闷了
我用的YEP_BattleEngineCore,是版本的问题?

YEP_BattleEngineCore.js
  1. //=============================================================================
  2. // Yanfly Engine Plugins - Battle Engine Core
  3. // YEP_BattleEngineCore.js
  4. //=============================================================================

  5. var Imported = Imported || {};
  6. Imported.YEP_BattleEngineCore = true;

  7. var Yanfly = Yanfly || {};
  8. Yanfly.BEC = Yanfly.BEC || {};

  9. //=============================================================================
  10. /*:
  11. * @plugindesc v1.11 Have more control over the flow of the battle system
  12. * with this plugin and alter various aspects to your liking.
  13. * @author Yanfly Engine Plugins
  14. *
  15. * @param ---General---
  16. * @default
  17. *
  18. * @param Action Speed
  19. * @desc This is the formula used for an action's base speed.
  20. * Default: agi + Math.randomInt(Math.floor(5 + agi / 4))
  21. * @default agi
  22. *
  23. * @param Default System
  24. * @desc This is the default battle system your game uses.
  25. * Default: dtb
  26. * @default dtb
  27. *
  28. * @param ---Escape---
  29. * @default
  30. *
  31. * @param Escape Ratio
  32. * @desc This is the formula used to determine escape success.
  33. * Default: 0.5 * $gameParty.agility() / $gameTroop.agility()
  34. * @default 0.5 * $gameParty.agility() / $gameTroop.agility()
  35. *
  36. * @param Fail Escape Boost
  37. * @desc Each time the player fails escape, increase the success
  38. * rate by this much. Default: 0.1
  39. * @default 0.1
  40. *
  41. * @param ---Animation---
  42. * @default
  43. *
  44. * @param Animation Base Delay
  45. * @desc This sets the base delay in between animations.
  46. * Default: 8
  47. * @default 0
  48. *
  49. * @param Animation Next Delay
  50. * @desc This sets the sequential delay in between animations.
  51. * Default: 12
  52. * @default 0
  53. *
  54. * @param Certain Hit Animation
  55. * @desc Default animation to play for certain hit skills.
  56. * Use 0 if you wish for no animation.
  57. * @default 120
  58. *
  59. * @param Physical Animation
  60. * @desc Default animation to play for physical skills.
  61. * Use 0 if you wish for no animation.
  62. * @default 52
  63. *
  64. * @param Magical Animation
  65. * @desc Default animation to play for magical skills.
  66. * Use 0 if you wish for no animation.
  67. * @default 51
  68. *
  69. * @param Enemy Attack Animation
  70. * @desc This is the default attack animation played by enemies.
  71. * Default: 0
  72. * @default 39
  73. *
  74. * @param Reflect Animation
  75. * @desc The animation used when magic attacks are reflected.
  76. * @default 42
  77. *
  78. * @param Motion Waiting
  79. * @desc Play animations after performing an action or during?
  80. * During - false     After - true     Default: false
  81. * @default false
  82. *
  83. * @param ---Frontview---
  84. * @default
  85. *
  86. * @param Front Position X
  87. * @desc This formula determines the actor's home X position.
  88. * Default: 0
  89. * @default Graphics.boxWidth / 8 + Graphics.boxWidth / 4 * index
  90. *
  91. * @param Front Position Y
  92. * @desc This formula determines the actor's home Y position.
  93. * Default: 0
  94. * @default Graphics.boxHeight - 180
  95. *
  96. * @param Front Actor Sprite
  97. * @desc Show the actor battle sprite in frontview?
  98. * NO - false     YES - true     Default - false
  99. * @default false
  100. *
  101. * @param Front Sprite Priority
  102. * @desc Give actor sprites the priority of always being on top?
  103. * 0 - Normal   1 - Actors on Top   2 - Enemies on Top
  104. * @default 1
  105. *
  106. * @param ---Sideview---
  107. * @default
  108. *
  109. * @param Home Position X
  110. * @desc This formula determines the actor's home X position.
  111. * Default: 600 + index * 32
  112. * @default Graphics.boxWidth - 216 + index * 32
  113. *
  114. * @param Home Position Y
  115. * @desc This formula determines the actor's home Y position.
  116. * Default: 280 + index * 48
  117. * @default Graphics.boxHeight - 344 + index * 48
  118. *
  119. * @param Side Sprite Priority
  120. * @desc Give actor sprites the priority of always being on top?
  121. * 0 - Normal   1 - Actors on Top   2 - Enemies on Top
  122. * @default 1
  123. *
  124. * @param ---Sprites---
  125. * @default
  126. *
  127. * @param Default X Anchor
  128. * @desc Default value used for your sprites's X Anchor.
  129. * Default: 0.5
  130. * @default 0.5
  131. *
  132. * @param Default Y Anchor
  133. * @desc Default value used for your sprites's Y Anchor.
  134. * Default: 1.0
  135. * @default 1.0
  136. *
  137. * @param Step Distance
  138. * @desc This is the distance a unit steps forward for actions.
  139. * Default: 48
  140. * @default 48
  141. *
  142. * @param Flinch Distance
  143. * @desc In sideview, when a unit takes damage or dodges, it will
  144. * flinch a certain distance in pixels.
  145. * @default 12
  146. *
  147. * @param Show Shadows
  148. * @desc Do you wish to have shadows appear under actors?
  149. * NO - false     YES - true
  150. * @default true
  151. *
  152. * @param ---Damage Popups---
  153. * @default
  154. *
  155. * @param Popup Duration
  156. * @desc Adjusts how many frames a popup will stay visible for.
  157. * Default: 90
  158. * @default 128
  159. *
  160. * @param Newest Popup Bottom
  161. * @desc Places the newest popup at the bottom of a group.
  162. * NO - false     YES - true
  163. * @default true
  164. *
  165. * @param Popup Overlap Rate
  166. * @desc When multiple damage popups appear, they cover each other.
  167. * Use this to change the buffer rate amount for each sprite.
  168. * @default 0.9
  169. *
  170. * @param Critical Popup
  171. * @desc Adjusts the popup's flashing color for critical hits.
  172. * Default: 255, 0, 0, 160
  173. * @default 255, 0, 0, 160
  174. *
  175. * @param Critical Duration
  176. * @desc How many frames the flashing will remain for a critical.
  177. * Default: 60
  178. * @default 60
  179. *
  180. * @param ---Tick-Settings---
  181. * @default
  182. *
  183. * @param Timed States
  184. * @desc If the battle system is Tick-based, use time instead of
  185. * turns for states? NO - false   YES - true
  186. * @default true
  187. *
  188. * @param Timed Buffs
  189. * @desc If the battle system is Tick-based, use time instead of
  190. * turns for buffs? NO - false   YES - true
  191. * @default true
  192. *
  193. * @param Turn Time
  194. * @desc How many ticks must past to equal 1 turn?
  195. * @default 100
  196. *
  197. * @param ---Window Settings---
  198. * @default
  199. *
  200. * @param Lower Windows
  201. * @desc Places the skill and item windows at the screen's bottom.
  202. * OFF - false     ON - true
  203. * @default true
  204. *
  205. * @param Window Rows
  206. * @desc For lower windows, how many rows of items do you wish for
  207. * the windows to display?
  208. * @default 4
  209. *
  210. * @param Command Window Rows
  211. * @desc Sets the number of rows for each command window to display.
  212. * Default: 4
  213. * @default 4
  214. *
  215. * @param Command Alignment
  216. * @desc Sets the text alignment for the Party/Actor Commands.
  217. * Default: left
  218. * @default center
  219. *
  220. * @param Start Actor Command
  221. * @desc Starts turn with the Actor Command Window instead of Party.
  222. * OFF - false     ON - true
  223. * @default true
  224. *
  225. * @param ---Selection Help---
  226. * @default
  227. *
  228. * @param Select Help Window
  229. * @desc When selecting actors and enemies, show the help window?
  230. * NO - false     YES - true
  231. * @default true
  232. *
  233. * @param User Help Text
  234. * @desc The singular form of 'User' used in a help window.
  235. * @default User
  236. *
  237. * @param Ally Help Text
  238. * @desc The singular form of 'Ally' used in a help window.
  239. * @default Ally
  240. *
  241. * @param Allies Help Text
  242. * @desc The plural form of 'Allies' used in a help window.
  243. * @default Allies
  244. *
  245. * @param Enemy Help Text
  246. * @desc The singular form of 'Enemy' used in a help window.
  247. * @default Enemy
  248. *
  249. * @param Enemies Help Text
  250. * @desc The plural form of 'Enemy' used in a help window.
  251. * @default Enemies
  252. *
  253. * @param All Help Text
  254. * @desc When selecting a entire group of targets.
  255. * %1 - Target Group (Allies or Enemies)
  256. * @default All %1
  257. *
  258. * @param Random Help Text
  259. * @desc When selecting a random selection of targets.
  260. * %1 - Target Group (Allies or Enemies)     %2 - Number
  261. * @default %2 Random %1
  262. *
  263. * @param ---Enemy Select---
  264. * @default
  265. *
  266. * @param Visual Enemy Select
  267. * @desc Replaces the enemy selection screen with a more visual one.
  268. * OFF - false     ON - true
  269. * @default true
  270. *
  271. * @param Show Enemy Name
  272. * @desc Show enemy names with Visual Enemy Select.
  273. * OFF - false     ON - true
  274. * @default true
  275. *
  276. * @param Enemy Font Size
  277. * @desc Changes the font size used to display enemy names.
  278. * Default: 28
  279. * @default 20
  280. *
  281. * @param Enemy Auto Select
  282. * @desc Changes what enemy is automatically selected at first.
  283. * LEFT - 0     RIGHT - this.furthestRight()
  284. * @default this.furthestRight()
  285. *
  286. * @param ---Actor Select---
  287. * @default
  288. *
  289. * @param Visual Actor Select
  290. * @desc Allows you to click the actor on screen to select it.
  291. * OFF - false     ON - true
  292. * @default true
  293. *
  294. * @param ---Battle Log---
  295. * @default
  296. *
  297. * @param Show Emerge Text
  298. * @desc Shows the battle start text for enemies appearing.
  299. * OFF - false     ON - true
  300. * @default false
  301. *
  302. * @param Show Pre-Emptive Text
  303. * @desc Shows the text for getting a pre-emptive attack.
  304. * OFF - false     ON - true
  305. * @default true
  306. *
  307. * @param Show Surprise Text
  308. * @desc Shows the text for getting a surprise attack.
  309. * OFF - false     ON - true
  310. * @default true
  311. *
  312. * @param Optimize Speed
  313. * @desc Cuts log base line process to optimize the battle speed.
  314. * OFF - false     ON - true
  315. * @default true
  316. *
  317. * @param Show Action Text
  318. * @desc Displays full action text or a simplified version of it.
  319. * SIMPLE - false     FULL - true
  320. * @default false
  321. *
  322. * @param Show State Text
  323. * @desc Shows all text regarding states.
  324. * OFF - false     ON - true
  325. * @default false
  326. *
  327. * @param Show Buff Text
  328. * @desc Shows all text regarding buffs.
  329. * OFF - false     ON - true
  330. * @default false
  331. *
  332. * @param Show Counter Text
  333. * @desc Shows text regarding counter attacks.
  334. * OFF - false     ON - true
  335. * @default true
  336. *
  337. * @param Show Reflect Text
  338. * @desc Shows text regarding reflected spells.
  339. * OFF - false     ON - true
  340. * @default true
  341. *
  342. * @param Show Substitute Text
  343. * @desc Shows text regarding substituted damage.
  344. * OFF - false     ON - true
  345. * @default true
  346. *
  347. * @param Show Fail Text
  348. * @desc Shows text regarding failed attacks.
  349. * OFF - false     ON - true
  350. * @default false
  351. *
  352. * @param Show Critical Text
  353. * @desc Shows text regarding critical hits.
  354. * OFF - false     ON - true
  355. * @default false
  356. *
  357. * @param Show Miss Text
  358. * @desc Shows text regarding missed attacks.
  359. * OFF - false     ON - true
  360. * @default false
  361. *
  362. * @param Show Evasion Text
  363. * @desc Shows text regarding evaded attacks.
  364. * OFF - false     ON - true
  365. * @default false
  366. *
  367. * @param Show HP Text
  368. * @desc Shows text regarding HP damage or heals.
  369. * OFF - false     ON - true
  370. * @default false
  371. *
  372. * @param Show MP Text
  373. * @desc Shows text regarding MP damage or heals.
  374. * OFF - false     ON - true
  375. * @default false
  376. *
  377. * @param Show TP Text
  378. * @desc Shows text regarding TP damage or heals.
  379. * OFF - false     ON - true
  380. * @default false
  381. *
  382. * @help
  383. * ============================================================================
  384. * Introduction
  385. * ============================================================================
  386. *
  387. * This plugin alters the various aspects of the default battle system,
  388. * allowing it to be more streamlined like most modern RPG's and less clunky
  389. * like older RPG's. This ranges from choosing what text will appear in the
  390. * battle log window at the top and how it will be displayed.
  391. *
  392. * ============================================================================
  393. * Battle Messages
  394. * ============================================================================
  395. *
  396. * When changing "Terms" and the "Messages" that appear in battle, inserting
  397. * the following tag anywhere in the message will cause the message to center
  398. * itself in the battle log.
  399. *
  400. *   <CENTER>
  401. *   This tag must be all caps in order for the battle log window to recognize
  402. *   it as an instruction to center the displayed battle text message.
  403. *
  404. * ============================================================================
  405. * Battle Windows
  406. * ============================================================================
  407. *
  408. * There's various options to adjust the window settings found in the battle
  409. * system to make navigating the battle system more intuitive. Such options
  410. * include starting the turns with the Actor Command Window instead of the
  411. * Party Command Window (the Fight/Escape Window). The Party Command Window is
  412. * still accessible but only by pressing cancel on the first actor's window.
  413. *
  414. * ============================================================================
  415. * Battle Order
  416. * ============================================================================
  417. *
  418. * The battle turn order is also fixed, too. This way, any battlers that Have
  419. * their AGI value changed over the course of battle will reflect those changes
  420. * during the current turn rather than the following turn. The action speed
  421. * calculation can also be adjusted and finetuned to have the random factor of
  422. * its speed calculation formula removed, too, making AGI actually worthwhile
  423. * as a tactical parameter.
  424. *
  425. * ============================================================================
  426. * Multiple Hits
  427. * ============================================================================
  428. *
  429. * Multi-hit action will no longer end prematurely if the target dies midway
  430. * through the action. This is done through toggling immortal states. To make
  431. * use of feature, make sure your database has an Immortal State somewhere. If
  432. * you do not wish to use this feature, set the Parameter for Immortal State ID
  433. * to 0 instead.
  434. *
  435. * ============================================================================
  436. * Popup Revamp
  437. * ============================================================================
  438. *
  439. * Although the damage popups may still look the same as the default ones from
  440. * MV, the process in which they're created is now different to streamline the
  441. * damage popup process. Before, popups would only appear one a time with a
  442. * frame's different at minimum in order for them to show. Now, any actions
  443. * that occur at the same frame will now all show popups at the same frame,
  444. * making for smoother and less clunky damage popups.
  445. *
  446. * ============================================================================
  447. * Common Events
  448. * ============================================================================
  449. *
  450. * Common Events will now occur at the end of each action regardless of whether
  451. * or not the enemy party is still alive. With proper placing of the action
  452. * sequence tags, you can make the skill's common event occur in the middle of
  453. * an action, too. However, keep in mind if you force an action in the middle
  454. * of another action, the remainder of the former action's sequence list will
  455. * become null and void in favor of the new forced action.
  456. *
  457. * ============================================================================
  458. * Casting Animations
  459. * ============================================================================
  460. *
  461. * Casting Animations help provide visual hints for players either by letting
  462. * them know which battler is going to perform an action or what type of skill
  463. * that action will be. This plugin enables skills to have casting animations
  464. * that can be modified universally or customized for each individual skill.
  465. *
  466. * Skill Notetag:
  467. *   <Cast Animation: x>
  468. *   Sets the skill's cast animation to animation ID x. Setting x to zero will
  469. *   cause the skill to not have any animaton at all.
  470. *
  471. * ============================================================================
  472. * Changing Battle Systems
  473. * ============================================================================
  474. *
  475. * While the player is not in battle, you can change the battle system using a
  476. * Plugin Command. With only this plugin, there is only one battle system
  477. * included: the default battle system.
  478. *
  479. * Plugin Command:
  480. *   setBattleSys DTB      Sets battle system to Default Turn Battle.
  481. *
  482. * Other future plugins may include other battle systems that may utilize the
  483. * Battle Engine Core.
  484. *
  485. * ============================================================================
  486. * Sideview Actions
  487. * ============================================================================
  488. *
  489. * In RPG Maker MV's default battle system, both the sideview and the frontview
  490. * settings do not display counterattacks, reflected magic attacks, nor any
  491. * case of substituting for battle members. The Battle Engine Core provides
  492. * games that are using the sideview settings small amounts of animations to
  493. * relay information to the player in a more visual sense.
  494. *
  495. * Magic Reflection will also display a reflection animation to indicate the
  496. * battler has reflection properties. This animation can be changed in the
  497. * parameters, but certain actors, classes, enemies, weapons, armors, and
  498. * states can display a unique kind of animation for reflection if desired.
  499. *
  500. * Actor, Class, Enemy, Weapon, Armor, and State Notetag:
  501. *   <Reflect Animation ID: x>
  502. *   Changes the user's reflect animation to x. This will take priority in the
  503. *   following order: Actor, Class, Enemy, Weapon, Armor, State, Default.
  504. *
  505. * Sometimes, you don't want your enemies to be able to move. Or you don't want
  506. * certain actors to be able to move. They're just stationary for whatever
  507. * reason. To accomplish that, you can use this notetag to forbid the battler
  508. * from moving.
  509. *
  510. * Actor, Class, Enemy, Weapon, Armor, and State Notetag:
  511. *   <Sprite Cannot Move>
  512. *   Prevents the battler's sprite from moving. This will take priority in the
  513. *   following order: Actor, Class, Enemy, Weapon, Armor, and State. If an
  514. *   enemy is unable to move when it performs an action, it will flash white as
  515. *   if it normally does in front view.
  516. *
  517. * ============================================================================
  518. * Custom Sideview Battler Anchor
  519. * ============================================================================
  520. *
  521. * Sideview battlers are generally centered horizontally, and grounded at their
  522. * feet. However, not all sideview battler spritesheets work this way. In the
  523. * event you have a sideview battler that doesn't conform to those standards,
  524. * you can 'anchor' them a different way.
  525. *
  526. * Actor Notetags:
  527. *   <Anchor X: y.z>
  528. *   <Anchor Y: y.z>
  529. *   This sets the anchor location for the actor's sideview battler at y.z.
  530. *   By default, the X anchor is 0.5 while the Y anchor is 1.0. If you want
  531. *   the X anchor to be a bit more to the left, make it less than 0.5. Make it
  532. *   more than 0.5 to make the X anchor more towards the right. To raise the
  533. *   Y anchor, set the number value to less than 1.0. Keep adjusting until you
  534. *   find that perfect anchor setting.
  535. *
  536. * ============================================================================
  537. * Action Sequences
  538. * ============================================================================
  539. *
  540. * The Yanfly Engine Plugins - Battle Engine Core includes the capability of
  541. * using custom action sequences. Action sequences are basic instructions for
  542. * the game to creating a customized skill both visually and mechanically.
  543. * The Battle Engine Core, however, will only include the most basic of action
  544. * sequences so the instructions on how to create a custom action sequence will
  545. * be included in the Help file on future extension plugins for this plugin.
  546. *
  547. * ============================================================================
  548. * Changelog
  549. * ============================================================================
  550. *
  551. * Version 1.11:
  552. * - Fixed a bug that didn't show HP/MP Regeneration.
  553. *
  554. * Version 1.10:
  555. * - Removed immortal state dependancy. Immortality is now its own setting.
  556. * - Added more abbreviated variables for action speed calculation.
  557. * - Fixed a bug where all-scope attacks would reveal Appear-Halfway enemies.
  558. * - Fixed a bug where the battle wouldn't end if the final enemy was killed
  559. * by state damage.
  560. *
  561. * Version 1.09:
  562. * - Fixed a undefined actor bug for refreshing the status window.
  563. * - Added 'Show Shadows' parameter to the plugin settings.
  564. * - Reworked the default action sequences so that forced actions do not appear
  565. * on top of each other and party-heal animations occur simultaneously.
  566. *
  567. * Version 1.08:
  568. * - Fixed a bug where battlers gaining HP/MP in the damage formula for
  569. * themselves wouldn't trigger popups.
  570. * - Fixed a bug where if the party failed to escape from battle, states that
  571. * would be removed by battle still get removed. *Fixed by Emjenoeg*
  572. * - Fixed a bug where instant death skills didn't work.
  573. * - Changed Sprite Priority settings to decide whether actors, enemies, or
  574. * neither would always be on top.
  575. *
  576. * Version 1.07:
  577. * - Optimized status window to refresh at a minimum.
  578. * - Set up frame work for future plugins:
  579. * - Added 'Escape Ratio' and 'Fail Escape Boost' to parameters to allow users
  580. * to set the escape ratio they want.
  581. * - Added 'Front Sprite Priority' and 'Side Sprite Priority' to parameters to
  582. * dictate if actor sprites are always on top.
  583. * - Added 'Tick-Settings' category for tick-based battle systems.
  584. *
  585. * Version 1.06:
  586. * - Fixed a bug that causes dead actors at the start of battle to not spawn.
  587. * - Fixed a bug where the help window on an empty slot would show the
  588. * previous skill's message.
  589. *
  590. * Version 1.05:
  591. * - Added new target typing: Character X, which allows you to select
  592. * specifically the actor with an actor ID of X if he/she/it is in the party.
  593. * - Fixed a bug that prevented Miss and Evade popups from showing.
  594. *
  595. * Version 1.04:
  596. * - Fixed a bug where popups didn't show under certain animation types.
  597. * - Fixed certain battler motions from not refreshing correctly.
  598. * - Actions with no scope will not trigger the confirmation selection window.
  599. *
  600. * Version 1.03:
  601. * - Added 'Wait for Effect' action sequence.
  602. * - Actions now wait for effects (such as collapsing) to be done before
  603. * continuing on with battle or to end battle.
  604. *
  605. * Version 1.02:
  606. * - Fixed a bug where the help window would retain descriptions on no skills.
  607. * - Synched up weapons with actor sprites so they would occur simultaneously.
  608. * - Fixed an issue where requesting certain motions from enemies that don't
  609. * exist would cause them to crash.
  610. *
  611. * Version 1.01:
  612. * - Skills and items that affect both HP and MP will now show popups for both.
  613. *
  614. * Version 1.00:
  615. * - Finished plugin!
  616. */
  617. //=============================================================================

  618. //=============================================================================
  619. // Parameter Variables
  620. //=============================================================================

  621. Yanfly.Parameters = PluginManager.parameters('YEP_BattleEngineCore');
  622. Yanfly.Param = Yanfly.Param || {};

  623. Yanfly.Param.BECSystem = String(Yanfly.Parameters['Default System']);
  624. Yanfly.Param.BECEscRatio = String(Yanfly.Parameters['Escape Ratio']);
  625. Yanfly.Param.BECEscFail = String(Yanfly.Parameters['Fail Escape Boost']);
  626. Yanfly.Param.CastCertHit = Number(Yanfly.Parameters['Certain Hit Animation']);
  627. Yanfly.Param.CastPhysical = Number(Yanfly.Parameters['Physical Animation']);
  628. Yanfly.Param.CastMagical = Number(Yanfly.Parameters['Magical Animation']);
  629. Yanfly.Param.EnemyAtkAni = Number(Yanfly.Parameters['Enemy Attack Animation']);
  630. Yanfly.Param.BECOptSpeed = String(Yanfly.Parameters['Optimize Speed']);
  631. Yanfly.Param.BECEmergeText = String(Yanfly.Parameters['Show Emerge Text']);
  632. Yanfly.Param.BECPreEmpText = String(Yanfly.Parameters['Show Pre-Emptive Text']);
  633. Yanfly.Param.BECSurpText = String(Yanfly.Parameters['Show Surprise Text']);
  634. Yanfly.Param.BECPopupOverlap = String(Yanfly.Parameters['Popup Overlap Rate']);
  635. Yanfly.Param.BECNewPopBottom = String(Yanfly.Parameters['Newest Popup Bottom']);
  636. Yanfly.Param.BECStartActCmd = String(Yanfly.Parameters['Start Actor Command']);
  637. Yanfly.Param.BECSelectHelp = String(Yanfly.Parameters['Select Help Window']);
  638. Yanfly.Param.BECHelpUserTx = String(Yanfly.Parameters['User Help Text']);
  639. Yanfly.Param.BECHelpAllyTx = String(Yanfly.Parameters['Ally Help Text']);
  640. Yanfly.Param.BECHelpAlliesTx = String(Yanfly.Parameters['Allies Help Text']);
  641. Yanfly.Param.BECHelpEnemyTx = String(Yanfly.Parameters['Enemy Help Text']);
  642. Yanfly.Param.BECHelpEnemiesTx = String(Yanfly.Parameters['Enemies Help Text']);
  643. Yanfly.Param.BECHelpAllTx = String(Yanfly.Parameters['All Help Text']);
  644. Yanfly.Param.BECHelpRandTx = String(Yanfly.Parameters['Random Help Text']);
  645. Yanfly.Param.BECFrontPosX = String(Yanfly.Parameters['Front Position X']);
  646. Yanfly.Param.BECFrontPosY = String(Yanfly.Parameters['Front Position Y']);
  647. Yanfly.Param.BECFrontSprite = String(Yanfly.Parameters['Front Actor Sprite']);
  648. Yanfly.Param.BECFrSpPrio = String(Yanfly.Parameters['Front Sprite Priority']);
  649. Yanfly.Param.BECHomePosX = String(Yanfly.Parameters['Home Position X']);
  650. Yanfly.Param.BECHomePosY = String(Yanfly.Parameters['Home Position Y']);
  651. Yanfly.Param.BECSideSpPrio = String(Yanfly.Parameters['Side Sprite Priority']);
  652. Yanfly.Param.BECAnchorX = Number(Yanfly.Parameters['Default X Anchor']);
  653. Yanfly.Param.BECAnchorY = Number(Yanfly.Parameters['Default Y Anchor']);
  654. Yanfly.Param.BECStepDist = Number(Yanfly.Parameters['Step Distance']);
  655. Yanfly.Param.BECFlinchDist = Number(Yanfly.Parameters['Flinch Distance']);
  656. Yanfly.Param.BECShowShadows = String(Yanfly.Parameters['Show Shadows']);
  657. Yanfly.Param.BECPopupDur = String(Yanfly.Parameters['Popup Duration']);
  658. Yanfly.Param.BECCritPopup = String(Yanfly.Parameters['Critical Popup']);
  659. Yanfly.Param.BECCritDur = String(Yanfly.Parameters['Critical Duration']);
  660. Yanfly.Param.BECActionSpeed = String(Yanfly.Parameters['Action Speed']);
  661. Yanfly.Param.BECReflectAni = Number(Yanfly.Parameters['Reflect Animation']);
  662. Yanfly.Param.BECMotionWait = String(Yanfly.Parameters['Motion Waiting']);
  663. Yanfly.Param.BECTimeStates = String(Yanfly.Parameters['Timed States']);
  664. Yanfly.Param.BECTimeBuffs = String(Yanfly.Parameters['Timed Buffs']);
  665. Yanfly.Param.BECTurnTime = Number(Yanfly.Parameters['Turn Time']);
  666. Yanfly.Param.BECLowerWindows = String(Yanfly.Parameters['Lower Windows']);
  667. Yanfly.Param.BECEnemySelect = String(Yanfly.Parameters['Visual Enemy Select']);
  668. Yanfly.Param.BECActorSelect = String(Yanfly.Parameters['Visual Actor Select']);
  669. Yanfly.Param.BECWindowRows = String(Yanfly.Parameters['Window Rows']);
  670. Yanfly.Param.BECEnemyFontSize = Number(Yanfly.Parameters['Enemy Font Size']);
  671. Yanfly.Param.BECShowEnemyName = String(Yanfly.Parameters['Show Enemy Name']);
  672. Yanfly.Param.BECEnemyAutoSel = String(Yanfly.Parameters['Enemy Auto Select']);
  673. Yanfly.Param.BECCommandAlign = String(Yanfly.Parameters['Command Alignment']);
  674. Yanfly.Param.BECCommandRows = String(Yanfly.Parameters['Command Window Rows']);
  675. Yanfly.Param.BECAniBaseDel = String(Yanfly.Parameters['Animation Base Delay']);
  676. Yanfly.Param.BECAniNextDel = String(Yanfly.Parameters['Animation Next Delay']);
  677. Yanfly.Param.BECFullActText = String(Yanfly.Parameters['Show Action Text']);
  678. Yanfly.Param.BECShowCntText = String(Yanfly.Parameters['Show Counter Text']);
  679. Yanfly.Param.BECShowRflText = String(Yanfly.Parameters['Show Reflect Text']);
  680. Yanfly.Param.BECShowSubText = String(Yanfly.Parameters['Show Substitute Text']);
  681. Yanfly.Param.BECShowFailText = String(Yanfly.Parameters['Show Fail Text']);
  682. Yanfly.Param.BECShowCritText = String(Yanfly.Parameters['Show Critical Text']);
  683. Yanfly.Param.BECShowMissText = String(Yanfly.Parameters['Show Miss Text']);
  684. Yanfly.Param.BECShowEvaText = String(Yanfly.Parameters['Show Evasion Text']);
  685. Yanfly.Param.BECShowHpText = String(Yanfly.Parameters['Show HP Text']);
  686. Yanfly.Param.BECShowMpText = String(Yanfly.Parameters['Show MP Text']);
  687. Yanfly.Param.BECShowTpText = String(Yanfly.Parameters['Show TP Text']);
  688. Yanfly.Param.BECShowStateText = String(Yanfly.Parameters['Show State Text']);
  689. Yanfly.Param.BECShowBuffText = String(Yanfly.Parameters['Show Buff Text']);

  690. //=============================================================================
  691. // DataManager
  692. //=============================================================================

  693. Yanfly.BEC.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  694. DataManager.isDatabaseLoaded = function() {
  695.     if (!Yanfly.BEC.DataManager_isDatabaseLoaded.call(this)) return false;
  696.                 this.processMELODYNotetags($dataSkills);
  697.                 this.processMELODYNotetags($dataItems);
  698.                 this.processBECNotetags1($dataSkills);
  699.                 this.processBECNotetags2($dataSkills);
  700.                 this.processBECNotetags2($dataItems);
  701.                 this.processBECNotetags3($dataEnemies);
  702.                 this.processBECNotetags4($dataActors);
  703.                 this.processBECNotetags4($dataClasses);
  704.                 this.processBECNotetags4($dataWeapons);
  705.                 this.processBECNotetags4($dataArmors);
  706.                 this.processBECNotetags4($dataEnemies);
  707.                 this.processBECNotetags4($dataStates);
  708.                 this.processBECNotetags5($dataActors);
  709.                 return true;
  710. };

  711. DataManager.processMELODYNotetags = function(group) {
  712.   for (var n = 1; n < group.length; n++) {
  713.                 var obj = group[n];
  714.     if (obj.actionsMade) continue;
  715.     obj.actionsMade = true;
  716.     var notedata = obj.note.split(/[\r\n]+/);

  717.     var actionType = 0;
  718.                 this.setDefaultActions(obj);

  719.                 for (var i = 0; i < notedata.length; i++) {
  720.                         var line = notedata[i];
  721.                         if (line.match(/<(?:SETUP ACTION|setup)>/i)) {
  722.         actionType = 1;
  723.         obj.setupActions = [];
  724.                         } else if (line.match(/<\/(?:SETUP ACTION|setup)>/i)) {
  725.         var actionType = 0;
  726.       } else if (line.match(/<(?:WHOLE ACTION|whole)>/i)) {
  727.         actionType = 2;
  728.         obj.wholeActions = [];
  729.       } else if (line.match(/<\/(?:WHOLE ACTION|whole)>/i)) {
  730.         var actionType = 0;
  731.       } else if (line.match(/<(?:TARGET ACTION|target)>/i)) {
  732.         actionType = 3;
  733.         obj.targetActions = [];
  734.       } else if (line.match(/<\/(?:TARGET ACTION|target)>/i)) {
  735.         var actionType = 0;
  736.       } else if (line.match(/<(?:FOLLOW ACTION|follow)>/i)) {
  737.         actionType = 4;
  738.         obj.followActions = [];
  739.       } else if (line.match(/<\/(?:FOLLOW ACTION|follow)>/i)) {
  740.         var actionType = 0;
  741.       } else if (line.match(/<(?:FINISH ACTION|finish)>/i)) {
  742.         actionType = 5;
  743.         obj.finishActions = [];
  744.       } else if (line.match(/<\/(?:FINISH ACTION|finish)>/i)) {
  745.         var actionType = 0;
  746.       } else {
  747.         this.convertSequenceLine(obj, line, actionType);
  748.       }
  749.                 }
  750.         }
  751. };

  752. Yanfly.BEC.DefaultActionSetup = [
  753.     ['CLEAR BATTLE LOG'],
  754.     ['DISPLAY ACTION'],
  755.                 ['IMMORTAL', ['TARGETS', 'TRUE']],
  756.     ['PERFORM START'],
  757.     ['WAIT FOR MOVEMENT'],
  758.     ['CAST ANIMATION'],
  759.     ['WAIT FOR ANIMATION']
  760. ];
  761. Yanfly.BEC.DefaultActionWhole = [
  762.                 ['PERFORM ACTION'],
  763. ];
  764. Yanfly.BEC.DefaultActionTarget = [
  765.                 ['PERFORM ACTION'],
  766. ];
  767. if (eval(Yanfly.Param.BECMotionWait)) {
  768.   Yanfly.BEC.DefaultActionWhole.push(['MOTION WAIT', ['USER']]);
  769.   Yanfly.BEC.DefaultActionTarget.push(['MOTION WAIT', ['USER']]);
  770. } else {
  771.   Yanfly.BEC.DefaultActionWhole.push(['WAIT', [10]]);
  772.   Yanfly.BEC.DefaultActionTarget.push(['WAIT', [10]]);
  773. };
  774. Yanfly.BEC.DefaultActionWhole.push(['ACTION ANIMATION']);
  775. Yanfly.BEC.DefaultActionWhole.push(['WAIT FOR ANIMATION']);
  776. Yanfly.BEC.DefaultActionTarget.push(['ACTION ANIMATION']);
  777. Yanfly.BEC.DefaultActionTarget.push(['WAIT FOR ANIMATION']);
  778. Yanfly.BEC.DefaultActionFollow = [
  779. ];
  780. Yanfly.BEC.DefaultActionFinish = [
  781.                 ['IMMORTAL', ['TARGETS', 'FALSE']],
  782.                 ['WAIT FOR NEW LINE'],
  783.                 ['CLEAR BATTLE LOG'],
  784.                 ['PERFORM FINISH'],
  785.     ['WAIT FOR MOVEMENT'],
  786.     ['WAIT FOR EFFECT'],
  787.                 ['ACTION COMMON EVENT'],
  788. ];
  789. DataManager.setDefaultActions = function(obj) {
  790.                 obj.setupActions = Yanfly.BEC.DefaultActionSetup.slice();
  791.                 if (this.isWholeAction(obj)) {
  792.                         obj.wholeActions = Yanfly.BEC.DefaultActionWhole.slice();
  793.                         this.addActionEffects(obj, obj.wholeActions);
  794.       obj.targetActions = [];
  795.                 } else {
  796.       obj.wholeActions = [];
  797.                         obj.targetActions = Yanfly.BEC.DefaultActionTarget.slice();
  798.                         this.addActionEffects(obj, obj.targetActions);
  799.                 }
  800.                 obj.followActions = Yanfly.BEC.DefaultActionFollow.slice();
  801.                 obj.finishActions = Yanfly.BEC.DefaultActionFinish.slice();
  802. };

  803. DataManager.isWholeAction = function(obj) {
  804.         if (obj.animationId > 0 && $dataAnimations[obj.animationId]) {
  805.                 var animation = $dataAnimations[obj.animationId];
  806.                 if (animation.position === 3) return true;
  807.                 if (animation.position !== 3 && [2, 8, 10].contains(obj.scope)) return true;
  808.         }
  809.         return false;
  810. };

  811. DataManager.addActionEffects = function(obj, array) {
  812.                 for (;;) {
  813.                         array[array.length] = ['ACTION EFFECT'];
  814.                         array[array.length] = ['DEATH BREAK'];
  815.                         obj.repeats -= 1;
  816.                         if (obj.repeats <= 0) break;
  817.                         array[array.length] = ['WAIT', [8]];
  818.                 }
  819.                 obj.repeats = 1;
  820. };

  821. Yanfly.BEC.SeqType6 =
  822.         /[ ]*(.*):[ ](.*),[ ](.*),[ ](.*),[ ](.*),[ ](.*),[ ](.*)/i;
  823. Yanfly.BEC.SeqType5 =
  824.         /[ ]*(.*):[ ](.*),[ ](.*),[ ](.*),[ ](.*),[ ](.*)/i;
  825. Yanfly.BEC.SeqType4 =
  826.         /[ ]*(.*):[ ](.*),[ ](.*),[ ](.*),[ ](.*)/i;
  827. Yanfly.BEC.SeqType3 =
  828.         /[ ]*(.*):[ ](.*),[ ](.*),[ ](.*)/i;
  829. Yanfly.BEC.SeqType2 =
  830.         /[ ]*(.*):[ ](.*),[ ](.*)/i;
  831. Yanfly.BEC.SeqType1 =
  832.         /[ ]*(.*):[ ](.*)/i;
  833. Yanfly.BEC.SeqType0 =
  834.         /[ ]*(.*)/i;
  835. DataManager.convertSequenceLine = function(obj, line, actionType) {
  836.         if (actionType <= 0 || actionType > 5) return;
  837.   Yanfly.BEC.SeqType;
  838.   var seqArgs;
  839.   if (line.match(Yanfly.BEC.SeqType6)) {
  840.     Yanfly.BEC.SeqType = RegExp.$1;
  841.     seqArgs =
  842.                         [RegExp.$2, RegExp.$3, RegExp.$4, RegExp.$5, RegExp.$6, RegExp.$7];
  843.   } else if (line.match(Yanfly.BEC.SeqType5)) {
  844.     Yanfly.BEC.SeqType = RegExp.$1;
  845.     seqArgs = [RegExp.$2, RegExp.$3, RegExp.$4, RegExp.$5, RegExp.$6];
  846.   } else if (line.match(Yanfly.BEC.SeqType4)) {
  847.     Yanfly.BEC.SeqType = RegExp.$1;
  848.     seqArgs = [RegExp.$2, RegExp.$3, RegExp.$4, RegExp.$5];
  849.   } else if (line.match(Yanfly.BEC.SeqType3)) {
  850.     Yanfly.BEC.SeqType = RegExp.$1;
  851.     seqArgs = [RegExp.$2, RegExp.$3, RegExp.$4];
  852.   } else if (line.match(Yanfly.BEC.SeqType2)) {
  853.     Yanfly.BEC.SeqType = RegExp.$1;
  854.     seqArgs = [RegExp.$2, RegExp.$3];
  855.   } else if (line.match(Yanfly.BEC.SeqType1)) {
  856.     Yanfly.BEC.SeqType = RegExp.$1;
  857.     seqArgs = [RegExp.$2];
  858.   } else if (line.match(Yanfly.BEC.SeqType0)) {
  859.     Yanfly.BEC.SeqType = RegExp.$1;
  860.     seqArgs = [];
  861.   } else {
  862.     return;
  863.   }
  864.   var array = [Yanfly.BEC.SeqType, seqArgs];
  865.   if (actionType === 1) obj.setupActions[obj.setupActions.length] = array;
  866.   if (actionType === 2) obj.wholeActions[obj.wholeActions.length] = array;
  867.   if (actionType === 3) obj.targetActions[obj.targetActions.length] = array;
  868.   if (actionType === 4) obj.followActions[obj.followActions.length] = array;
  869.   if (actionType === 5) obj.finishActions[obj.finishActions.length] = array;
  870. };

  871. DataManager.processBECNotetags1 = function(group) {
  872.         var note1 = /<(?:CAST ANIMATION|cast ani):[ ](\d+)>/i;
  873.         for (var n = 1; n < group.length; n++) {
  874.                 var obj = group[n];
  875.                 var notedata = obj.note.split(/[\r\n]+/);

  876.     obj.castAnimation = 0;
  877.     if (obj.hitType === 0) obj.castAnimation = Yanfly.Param.CastCertHit;
  878.     if (obj.hitType === 1) obj.castAnimation = Yanfly.Param.CastPhysical;
  879.     if (obj.hitType === 2) obj.castAnimation = Yanfly.Param.CastMagical;

  880.                 for (var i = 0; i < notedata.length; i++) {
  881.                         var line = notedata[i];
  882.                         if (line.match(note1)) {
  883.                                 obj.castAnimation = parseInt(RegExp.$1);
  884.                         }
  885.                 }
  886.         }
  887. };

  888. DataManager.processBECNotetags2 = function(group) {
  889.         var note1 = /<(?:ACTION COPY):[ ](.*):[ ]*(\d+)>/i;
  890.         for (var n = 1; n < group.length; n++) {
  891.                 var obj = group[n];
  892.                 var notedata = obj.note.split(/[\r\n]+/);

  893.     for (var i = 0; i < notedata.length; i++) {
  894.                         var line = notedata[i];
  895.                         if (line.match(note1)) {
  896.                                 var text = String(RegExp.$1).toUpperCase();
  897.                                 var target;
  898.                                 if (['I', 'ITEM'].contains(text)) {
  899.                                         target = $dataItems[parseInt(RegExp.$2)];
  900.                                 } else if (['S', 'SKILL'].contains(text)) {
  901.                                         target = $dataSkills[parseInt(RegExp.$2)];
  902.                                 }
  903.                                 if (target) {
  904.                                         obj.setupActions = target.setupActions.slice();
  905.                                         obj.wholeActions = target.wholeActions.slice();
  906.                                         obj.targetActions = target.targetActions.slice();
  907.                                         obj.followActions = target.followActions.slice();
  908.                                         obj.finishActions = target.finishActions.slice();
  909.                                 }
  910.                         }
  911.                 }
  912.         }
  913. };

  914. DataManager.processBECNotetags3 = function(group) {
  915.         var note1 = /<(?:ATTACK ANIMATION|attack ani):[ ](\d+)>/i;
  916.         for (var n = 1; n < group.length; n++) {
  917.                 var obj = group[n];
  918.                 var notedata = obj.note.split(/[\r\n]+/);

  919.     obj.attackAnimationId = Yanfly.Param.EnemyAtkAni;

  920.                 for (var i = 0; i < notedata.length; i++) {
  921.                         var line = notedata[i];
  922.                         if (line.match(note1)) {
  923.                                 obj.attackAnimationId = parseInt(RegExp.$1);
  924.                         }
  925.                 }
  926.         }
  927. };

  928. DataManager.processBECNotetags4 = function(group) {
  929.   var note1 = /<(?:REFLECT ANIMATION|reflect ani):[ ](\d+)>/i;
  930.         for (var n = 1; n < group.length; n++) {
  931.                 var obj = group[n];
  932.                 var notedata = obj.note.split(/[\r\n]+/);

  933.     obj.reflectAnimationId = 0;
  934.                 obj.spriteCannotMove = false;

  935.                 for (var i = 0; i < notedata.length; i++) {
  936.                         var line = notedata[i];
  937.                         if (line.match(note1)) {
  938.         obj.reflectAnimationId = parseInt(RegExp.$1);
  939.                         } else if (line.match(/<(?:SPRITE CANNOT MOVE)>/i)) {
  940.                                 obj.spriteCannotMove = true;
  941.                         }
  942.                 }
  943.         }
  944. };

  945. DataManager.processBECNotetags5 = function(group) {
  946.         for (var n = 1; n < group.length; n++) {
  947.                 var obj = group[n];
  948.                 var notedata = obj.note.split(/[\r\n]+/);

  949.     obj.anchorX = Yanfly.Param.BECAnchorX;
  950.     obj.anchorY = Yanfly.Param.BECAnchorY;

  951.                 for (var i = 0; i < notedata.length; i++) {
  952.                         var line = notedata[i];
  953.                         if (line.match(/<(?:ANCHOR X):[ ](\d+)[.](\d+)>/i)) {
  954.                                 obj.anchorX = eval(String(RegExp.$1) + '.' + String(RegExp.$2));
  955.                         } else if (line.match(/<(?:ANCHOR Y):[ ](\d+)[.](\d+)>/i)) {
  956.                                 obj.anchorY = eval(String(RegExp.$1) + '.' + String(RegExp.$2));
  957.                         }
  958.                 }
  959.         }
  960. };

  961. //=============================================================================
  962. // BattleManager
  963. //=============================================================================

  964. Yanfly.BEC.BattleManager_initMembers = BattleManager.initMembers;
  965. BattleManager.initMembers = function() {
  966.     Yanfly.BEC.BattleManager_initMembers.call(this);
  967.     this._forceSelection = false;
  968.     this._allSelection = false;
  969. };

  970. BattleManager.isBattleSystem = function(value) {
  971.     return value.toLowerCase() === $gameSystem.getBattleSystem();
  972. };

  973. BattleManager.isDTB = function() {
  974.     return this.isBattleSystem('dtb');
  975. };

  976. BattleManager.isTurnBased = function() {
  977.     if (this.isDTB()) return true;
  978.     return false;
  979. };

  980. BattleManager.isTickBased = function() {
  981.     return !this.isTurnBased();
  982. };

  983. BattleManager.tickRate = function() {
  984.     return 1;
  985. };

  986. BattleManager.forceSelection = function() {
  987.     this._forceSelection = true;
  988. };

  989. BattleManager.isForceSelection = function() {
  990.     return this._forceSelection;
  991. };

  992. BattleManager.resetSelection = function() {
  993.     this._forceSelection = false;
  994. };

  995. BattleManager.startAllSelection = function() {
  996.     this._allSelection = true;
  997. };

  998. BattleManager.isAllSelection = function() {
  999.      return this._allSelection && BattleManager.isInputting();
  1000. };

  1001. BattleManager.stopAllSelection = function() {
  1002.     this._allSelection = false;
  1003. };

  1004. Yanfly.BEC.BattleManager_makeEscapeRatio = BattleManager.makeEscapeRatio;
  1005. BattleManager.makeEscapeRatio = function() {
  1006.     if (this.isDTB()) {
  1007.       this._escapeRatio = eval(Yanfly.Param.BECEscRatio);
  1008.       this._escapeFailBoost = eval(Yanfly.Param.BECEscFail);
  1009.     } else {
  1010.       this._escapeFailBoost = 0.1;
  1011.       Yanfly.BEC.BattleManager_makeEscapeRatio.call(this);
  1012.     }
  1013. };

  1014. BattleManager.timeBasedStates = function() {
  1015.                 if (!$gameParty.inBattle()) return false;
  1016.                 if (this.isTurnBased()) return false;
  1017.                 if (this._timeBasedStates !== undefined) return this._timeBasedStates;
  1018.                 this._timeBasedStates = eval(Yanfly.Param.BECTimeStates);
  1019.                 return this._timeBasedStates;
  1020. };

  1021. BattleManager.timeBasedBuffs = function() {
  1022.                 if (!$gameParty.inBattle()) return false;
  1023.                 if (this.isTurnBased()) return false;
  1024.                 if (this._timeBasedBuffs !== undefined) return this._timeBasedBuffs;
  1025.                 this._timeBasedBuffs = eval(Yanfly.Param.BECTimeBuffs);
  1026.                 return this._timeBasedBuffs;
  1027. };

  1028. BattleManager.displayStartMessages = function() {
  1029.     if (eval(Yanfly.Param.BECEmergeText)) {
  1030.       $gameTroop.enemyNames().forEach(function(name) {
  1031.           $gameMessage.add(TextManager.emerge.format(name));
  1032.       });
  1033.     }
  1034.     if (this._preemptive && eval(Yanfly.Param.BECPreEmpText)) {
  1035.         $gameMessage.add(TextManager.preemptive.format($gameParty.name()));
  1036.     } else if (this._surprise && eval(Yanfly.Param.BECSurpText)) {
  1037.         $gameMessage.add(TextManager.surprise.format($gameParty.name()));
  1038.     }
  1039. };

  1040. BattleManager.registerSprite = function(battler, sprite) {
  1041.   if (!this._registeredSprites) this._registeredSprites = {};
  1042.   if (battler.isActor()) var id = 100000 + battler.actorId();
  1043.   if (battler.isEnemy()) var id = 200000 + battler.index();
  1044.   this._registeredSprites[id] = sprite;
  1045. };

  1046. BattleManager.getSprite = function(battler) {
  1047.   if (!this._registeredSprites) this._registeredSprites = {};
  1048.   if (battler.isActor()) var id = 100000 + battler.actorId();
  1049.   if (battler.isEnemy()) var id = 200000 + battler.index();
  1050.   return this._registeredSprites[id];
  1051. };

  1052. BattleManager.setSpritePriority = function() {
  1053.     if ($gameSystem.isSideView()) {
  1054.       this._spritePriority = eval(Yanfly.Param.BECSideSpPrio);
  1055.     } else {
  1056.       this._spritePriority = eval(Yanfly.Param.BECFrontSprite);
  1057.     }
  1058.     if (this._spritePriority === false) this._spritePriority = 0;
  1059.     if (this._spritePriority === true) this._spritePriority = 1;
  1060. };

  1061. BattleManager.getSpritePriority = function() {
  1062.     if (!this._spritePriority) this.setSpritePriority();
  1063.     return this._spritePriority;
  1064. };

  1065. BattleManager.changeActor = function(newActorIndex, lastActorActionState) {
  1066.     var lastActor = this.actor();
  1067.     this._actorIndex = newActorIndex;
  1068.     var newActor = this.actor();
  1069.     if (lastActor) {
  1070.         lastActor.setActionState(lastActorActionState);
  1071.         lastActor.spriteReturnHome();
  1072.     }
  1073.     if (newActor) {
  1074.         newActor.setActionState('inputting');
  1075.         newActor.spriteStepForward();
  1076.     }
  1077. };

  1078. Yanfly.BEC.BattleManager_checkBattleEnd = BattleManager.checkBattleEnd;
  1079. BattleManager.checkBattleEnd = function() {
  1080.     if (this._phase === 'actionList' || this._phase === 'actionTargetList' ||
  1081.                         $gameTroop.isEventRunning()) return false;
  1082.     return Yanfly.BEC.BattleManager_checkBattleEnd.call(this);
  1083. };

  1084. Yanfly.BEC.BattleManager_processVictory = BattleManager.processVictory;
  1085. BattleManager.processVictory = function() {
  1086.     this._logWindow.clear();
  1087.                 Yanfly.BEC.BattleManager_processVictory.call(this);
  1088. };

  1089. BattleManager.processEscape = function() {
  1090.     $gameParty.performEscape();
  1091.     SoundManager.playEscape();
  1092.     var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  1093.     if (success) {
  1094.         $gameParty.removeBattleStates();
  1095.         $gameParty.performEscapeSuccess();
  1096.         this.displayEscapeSuccessMessage();
  1097.         this._escaped = true;
  1098.         this.processAbort();
  1099.     } else {
  1100.         this.displayEscapeFailureMessage();
  1101.         this._escapeRatio += this._escapeFailBoost;
  1102.         $gameParty.clearActions();
  1103.         this.startTurn();
  1104.     }
  1105.     return success;
  1106. };

  1107. BattleManager.startTurn = function() {
  1108.     this._phase = 'turn';
  1109.     this.clearActor();
  1110.     $gameTroop.increaseTurn();
  1111.     $gameParty.onTurnStart();
  1112.     $gameTroop.onTurnStart();
  1113.     this._performedBattlers = [];
  1114.     this.makeActionOrders();
  1115.     $gameParty.requestMotionRefresh();
  1116.     this._logWindow.startTurn();
  1117.     this._subject = this.getNextSubject();
  1118. };

  1119. Yanfly.BEC.BattleManager_endTurn = BattleManager.endTurn;
  1120. BattleManager.endTurn = function() {
  1121.     if (this._spriteset.isPopupPlaying()) return;
  1122.     Yanfly.BEC.BattleManager_endTurn.call(this);
  1123. };

  1124. BattleManager.getNextSubject = function() {
  1125.     if ($gameTroop.turnCount() <= 0) return;
  1126.     this._performedBattlers = this._performedBattlers || [];
  1127.     this.makeActionOrders();
  1128.     for (;;) {
  1129.         var battlerArray = [];
  1130.         for (var i = 0; i < this._actionBattlers.length; ++i) {
  1131.           var obj = this._actionBattlers[i];
  1132.           if (!this._performedBattlers.contains(obj)) battlerArray.push(obj);
  1133.         }
  1134.         this._actionBattlers = battlerArray;
  1135.         var battler = this._actionBattlers.shift();
  1136.         if (!battler) return null;
  1137.         if (battler.isBattleMember() && battler.isAlive()) {
  1138.             this._performedBattlers.push(battler);
  1139.             return battler;
  1140.         }
  1141.     }
  1142. };

  1143. BattleManager.update = function() {
  1144.     if (!this.isBusy() && !this.updateEvent()) {
  1145.         switch (this._phase) {
  1146.         case 'start':
  1147.             this.startInput();
  1148.             break;
  1149.         case 'turn':
  1150.             this.updateTurn();
  1151.             break;
  1152.         case 'action':
  1153.             this.updateAction();
  1154.             break;
  1155.                                 case 'phaseChange':
  1156.                                                 this.updatePhase();
  1157.                                                 break;
  1158.                                 case 'actionList':
  1159.                                                 this.updateActionList()
  1160.                                                 break;
  1161.         case 'actionTargetList':
  1162.                                                 this.updateActionTargetList()
  1163.                                                 break;
  1164.         case 'turnEnd':
  1165.             this.updateTurnEnd();
  1166.             break;
  1167.         case 'battleEnd':
  1168.             this.updateBattleEnd();
  1169.             break;
  1170.         }
  1171.     }
  1172. };

  1173. BattleManager.updateEvent = function() {
  1174.     if (this._processingForcedAction) return false;
  1175.     switch (this._phase) {
  1176.     case 'start':
  1177.     case 'turn':
  1178.     case 'turnEnd':
  1179.     case 'actionList':
  1180.     case 'actionTargetList':
  1181.       if (this.isActionForced()) {
  1182.         this.processForcedAction();
  1183.         return true;
  1184.       } else {
  1185.         return this.updateEventMain();
  1186.       }
  1187.     }
  1188.     return this.checkAbort();
  1189. };

  1190. Yanfly.BEC.BattleManager_processForcedAction =
  1191.     BattleManager.processForcedAction;
  1192. BattleManager.processForcedAction = function() {
  1193.     if (this._actionForcedBattler) this._processingForcedAction = true;
  1194.     Yanfly.BEC.BattleManager_processForcedAction.call(this);
  1195. };

  1196. BattleManager.updateAction = function() {
  1197.     var target = this._targets.shift();
  1198.     if (target) {
  1199.         this.invokeAction(this._subject, target);
  1200.     } else {
  1201.         if (this._returnPhase === 'target') {
  1202.           this._targets = [this._individualTargets[0]];
  1203.           this._phase = 'actionTargetList';
  1204.         } else {
  1205.           this._targets = this._allTargets.slice();
  1206.           this._phase = 'actionList';
  1207.         }
  1208.     }
  1209. };

  1210. BattleManager.invokeAction = function(subject, target) {
  1211.     if (!eval(Yanfly.Param.BECOptSpeed))        this._logWindow.push('pushBaseLine');
  1212.     if (Math.random() < this._action.itemCnt(target)) {
  1213.         this.invokeCounterAttack(subject, target);
  1214.     } else if (Math.random() < this._action.itemMrf(target)) {
  1215.         this.invokeMagicReflection(subject, target);
  1216.     } else {
  1217.         this.invokeNormalAction(subject, target);
  1218.     }
  1219.     subject.setLastTarget(target);
  1220.     if (!eval(Yanfly.Param.BECOptSpeed)) this._logWindow.push('popBaseLine');
  1221. };

  1222. BattleManager.invokeCounterAttack = function(subject, target) {
  1223.     var action = new Game_Action(target);
  1224.     this._logWindow.displayCounter(target);
  1225.                 action.setAttack();
  1226.     action.apply(subject);
  1227.     this._logWindow.displayActionResults(subject, subject);
  1228.     if (subject.isDead()) subject.performCollapse();
  1229. };

  1230. Yanfly.BEC.BattleManager_invokeMagicReflection =
  1231.     BattleManager.invokeMagicReflection;
  1232. BattleManager.invokeMagicReflection = function(subject, target) {
  1233.     Yanfly.BEC.BattleManager_invokeMagicReflection.call(this, subject, target);
  1234.     if (subject.isDead()) subject.performCollapse();
  1235. };

  1236. BattleManager.updatePhase = function() {
  1237.     var phase = this._phaseSteps.shift();
  1238.                 if (phase) this.createPhaseChanges();
  1239.                 switch (phase) {
  1240.                 case 'setup':
  1241.                         this.createSetupActions();
  1242.                         break;
  1243.                 case 'whole':
  1244.                         this.createWholeActions();
  1245.                         break;
  1246.                 case 'target':
  1247.                         this.createTargetActions();
  1248.                         break;
  1249.                 case 'follow':
  1250.                         this.createFollowActions();
  1251.                         break;
  1252.                 case 'finish':
  1253.                         this.createFinishActions();
  1254.                         break;
  1255.                 default:
  1256.       this.endAction();
  1257.                         break;
  1258.                 }
  1259. };

  1260. BattleManager.createPhaseChanges = function() {
  1261.                 this._phase = 'actionList';
  1262.                 this._targets = this._allTargets.slice();
  1263.                 this._conditionFlags = [];
  1264.                 this._trueFlags = [];
  1265. };

  1266. BattleManager.createSetupActions = function() {
  1267.                 $gameTemp.clearActionSequenceSettings();
  1268.                 this._returnPhase = 'setup';
  1269.                 this._actionList = this._action.item().setupActions.slice();
  1270. };

  1271. BattleManager.createWholeActions = function() {
  1272.                 this._returnPhase = 'whole';
  1273.                 this._actionList = this._action.item().wholeActions.slice();
  1274. };

  1275. BattleManager.createTargetActions = function() {
  1276.                 this._returnPhase = 'target';
  1277.                 this._phase = 'actionTargetList';
  1278.                 this._targets = [this._individualTargets[0]];
  1279.                 this._actionList = this._action.item().targetActions.slice();
  1280. };

  1281. BattleManager.createFollowActions = function() {
  1282.                 this._returnPhase = 'follow';
  1283.                 this._actionList = this._action.item().followActions.slice();
  1284. };

  1285. BattleManager.createFinishActions = function() {
  1286.                 this._returnPhase = 'finish';
  1287.                 this._actionList = this._action.item().finishActions.slice();
  1288. };

  1289. Yanfly.BEC.BattleManager_endAction = BattleManager.endAction;
  1290. BattleManager.endAction = function() {
  1291.     this._processingForcedAction = false;
  1292.     Yanfly.BEC.BattleManager_endAction.call(this);
  1293. };

  1294. BattleManager.updateActionList = function() {
  1295.                 for (;;) {
  1296.       this._actSeq = this._actionList.shift();
  1297.                   if (this._actSeq) {
  1298.                                 if (!this.actionConditionsMet(this._actSeq)) continue;
  1299.                                 var seqName = this._actSeq[0].toUpperCase();
  1300.                           if (!this.processActionSequence(seqName, this._actSeq[1])) {
  1301.           break;
  1302.         }
  1303.                   } else {
  1304.                           this._phase = 'phaseChange';
  1305.         break;
  1306.                   }
  1307.     }
  1308. };

  1309. BattleManager.updateActionTargetList = function() {
  1310.                 for (;;) {
  1311.       this._actSeq = this._actionList.shift();
  1312.                   if (this._actSeq) {
  1313.         if (!this.actionConditionsMet(this._actSeq)) continue;
  1314.                                 var seqName = this._actSeq[0].toUpperCase();
  1315.                                 if (!this.processActionSequence(seqName, this._actSeq[1])) {
  1316.           break;
  1317.         }
  1318.       } else if (this._individualTargets.length > 0) {
  1319.         this._individualTargets.shift();
  1320.         if (this._individualTargets.length > 0) {
  1321.           this._targets = [this._individualTargets[0]];
  1322.           this._actionList = this._action.item().targetActions.slice();
  1323.         } else {
  1324.           this._phase = 'phaseChange';
  1325.           break;
  1326.         }
  1327.                   } else {
  1328.         this._phase = 'phaseChange';
  1329.         break;
  1330.                   }
  1331.     }
  1332. };

  1333. BattleManager.startAction = function() {
  1334.     var subject = this._subject;
  1335.     subject.onAllActionsEnd();
  1336.     var action = subject.currentAction();
  1337.     this._action = action;
  1338.                 var targets = action.makeTargets();
  1339.     this._targets = targets;
  1340.                 this._allTargets = targets.slice();
  1341.     this._individualTargets = targets.slice();
  1342.                 this._phase = 'phaseChange';
  1343.                 this._phaseSteps = ['setup', 'whole', 'target', 'follow', 'finish'];
  1344.                 this._returnPhase = '';
  1345.                 this._actionList = [];
  1346.     subject.useItem(this._action.item());
  1347.     this._action.applyGlobal();
  1348.     this._logWindow.startAction(this._subject, this._action, this._targets);
  1349. };

  1350. BattleManager.processActionSequence = function(actionName, actionArgs) {
  1351.                 // NO ACTION
  1352.                 if (actionName === '') {
  1353.                         return true;
  1354.                 }
  1355.     // ACTION ANIMATION
  1356.                 if (actionName === 'ACTION ANIMATION') {
  1357.                         return this.actionActionAnimation(actionArgs);
  1358.                 }
  1359.     // ACTION EFFECT
  1360.                 if (actionName === 'ACTION COMMON EVENT') {
  1361.       return this.actionActionCommonEvent();
  1362.                 }
  1363.     // ACTION EFFECT
  1364.                 if (actionName === 'ACTION EFFECT') {
  1365.       return this.actionActionEffect(actionArgs);
  1366.                 }
  1367.                 // ANI WAIT: frames
  1368.           if (['ANI WAIT', 'ANIWAIT', 'ANIMATION WAIT'].contains(actionName)) {
  1369.             return this.actionAniWait(actionArgs[0]);
  1370.           }
  1371.     // CAST ANIMATION
  1372.                 if (actionName === 'CAST ANIMATION') {
  1373.                         return this.actionCastAnimation();
  1374.                 }
  1375.                 // CLEAR BATTLE LOG
  1376.                 if (actionName === 'CLEAR BATTLE LOG') {
  1377.                         return this.actionClearBattleLog();
  1378.                 }
  1379.     // DEATH BREAK
  1380.                 if (actionName === 'DEATH BREAK') {
  1381.                         return this.actionDeathBreak();
  1382.                 }
  1383.                 // DISPLAY ACTION
  1384.                 if (actionName === 'DISPLAY ACTION') {
  1385.                         return this.actionDisplayAction();
  1386.                 }
  1387.                 // IF condition
  1388.                 if (actionName.match(/IF[ ](.*)/i)) {
  1389.                         return this.actionIfConditions(actionName, actionArgs);
  1390.                 }
  1391.     // IMMORTAL: targets, true/false
  1392.                 if (actionName === 'IMMORTAL') {
  1393.                         return this.actionImmortal(actionArgs);
  1394.                 }
  1395.                 // MOTION WAIT
  1396.                 if (actionName === 'MOTION WAIT') {
  1397.       return this.actionMotionWait(actionArgs);
  1398.                 }
  1399.     // PERFORM ACTION
  1400.                 if (actionName === 'PERFORM ACTION') {
  1401.                         return this.actionPerformAction();
  1402.                 }
  1403.                 // PERFORM FINISH
  1404.                 if (actionName === 'PERFORM FINISH') {
  1405.                         return this.actionPerformFinish();
  1406.                 }
  1407.                 // PERFORM START
  1408.                 if (actionName === 'PERFORM START') {
  1409.                         return this.actionPerformStart();
  1410.                 }
  1411.                 // WAIT: frames
  1412.           if (actionName === 'WAIT') {
  1413.             return this.actionWait(actionArgs[0]);
  1414.           }
  1415.     // WAIT FOR ANIMATION
  1416.                 if (actionName === 'WAIT FOR ANIMATION') {
  1417.                         return this.actionWaitForAnimation();
  1418.                 }
  1419.     // WAIT FOR EFFECT
  1420.                 if (actionName === 'WAIT FOR EFFECT') {
  1421.                         return this.actionWaitForEffect();
  1422.                 }
  1423.                 // WAIT FOR MOVEMENT
  1424.                 if (actionName === 'WAIT FOR MOVEMENT') {
  1425.                         return this.actionWaitForMovement();
  1426.                 }
  1427.                 // WAIT FOR NEW LINE
  1428.                 if (actionName === 'WAIT FOR NEW LINE') {
  1429.                         return this.actionWaitForNewLine();
  1430.                 }
  1431.     // WAIT FOR POPUPS
  1432.                 if (actionName === 'WAIT FOR POPUPS') {
  1433.                         return this.actionWaitForPopups();
  1434.                 }
  1435.                 return false;
  1436. };

  1437. BattleManager.makeActionTargets = function(string) {
  1438.                 var targets = []
  1439.     string = string.toUpperCase()
  1440.     if (['SUBJECT', 'USER'].contains(string)) {
  1441.       return [this._subject];
  1442.     }
  1443.     if (['TARGET', 'TARGETS'].contains(string)) {
  1444.       var group = this._targets;
  1445.       for (var i = 0; i < group.length; ++i) {
  1446.         var target = group[i];
  1447.         if (target) targets.push(target);
  1448.       }
  1449.       return targets;
  1450.     }
  1451.     if (['ACTORS', 'EXISTING ACTORS', 'ALIVE ACTORS'].contains(string)) {
  1452.       var group = $gameParty.aliveMembers();
  1453.       for (var i = 0; i < group.length; ++i) {
  1454.         var target = group[i];
  1455.         if (target) targets.push(target);
  1456.       }
  1457.       return targets;
  1458.     }
  1459.     if (['ACTORS ALL', 'ALL ACTORS', 'PARTY'].contains(string)) {
  1460.       var group = $gameParty.battleMembers();
  1461.       for (var i = 0; i < group.length; ++i) {
  1462.         var target = group[i];
  1463.         if (target) targets.push(target);
  1464.       }
  1465.       return targets;
  1466.     }
  1467.     if (['DEAD ACTORS', 'DEAD ACTOR'].contains(string)) {
  1468.       var group = $gameParty.deadMembers();
  1469.       for (var i = 0; i < group.length; ++i) {
  1470.         var target = group[i];
  1471.         if (target) targets.push(target);
  1472.       }
  1473.       return targets;
  1474.     }
  1475.     if (['ACTORS NOT USER', 'ACTORS NOT SUBJECT'].contains(string)) {
  1476.       var group = $gameParty.aliveMembers();
  1477.       for (var i = 0; i < group.length; ++i) {
  1478.         var target = group[i];
  1479.         if (target && target !== this._subject) targets.push(target);
  1480.       }
  1481.       return targets;
  1482.     }
  1483.     if (['ENEMIES', 'EXISTING ENEMIES', 'ALIVE ENEMIES', 'TROOP',
  1484.     'TROOPS'].contains(string)) {
  1485.       var group = $gameTroop.aliveMembers();
  1486.       for (var i = 0; i < group.length; ++i) {
  1487.         var target = group[i];
  1488.         if (target) targets.push(target);
  1489.       }
  1490.       return targets;
  1491.     }
  1492.     if (['ENEMIES ALL', 'ALL ENEMIES'].contains(string)) {
  1493.       var group = $gameTroop.members();
  1494.       for (var i = 0; i < group.length; ++i) {
  1495.         var target = group[i];
  1496.         if (target) targets.push(target);
  1497.       }
  1498.       return targets;
  1499.     }
  1500.     if (['DEAD ENEMIES', 'DEAD ENEMY'].contains(string)) {
  1501.       var group = $gameTroop.deadMembers();
  1502.       for (var i = 0; i < group.length; ++i) {
  1503.         var target = group[i];
  1504.         if (target) targets.push(target);
  1505.       }
  1506.       return targets;
  1507.     }
  1508.     if (['ENEMIES NOT USER', 'ENEMIES NOT SUBJECT', 'TROOP NOT USER',
  1509.     'TROOP NOT SUBJECT'].contains(string)) {
  1510.       var group = $gameTroop.aliveMembers();
  1511.       for (var i = 0; i < group.length; ++i) {
  1512.         var target = group[i];
  1513.         if (target && target !== this._subject) targets.push(target);
  1514.       }
  1515.       return targets;
  1516.     }
  1517.     if (string.match(/ACTOR[ ](\d+)/i)) {
  1518.       var target = $gameParty.battleMembers()[parseInt(RegExp.$1)];
  1519.       if (target) return [target];
  1520.     }
  1521.     if (string.match(/ENEMY[ ](\d+)/i)) {
  1522.       var target = $gameTroop.members()[parseInt(RegExp.$1)];
  1523.       if (target) return [target];
  1524.     }
  1525.     if (['FRIEND', 'FRIENDS', 'ALLIES'].contains(string)) {
  1526.       var group = this._action.friendsUnit().aliveMembers();
  1527.       for (var i = 0; i < group.length; ++i) {
  1528.         var target = group[i];
  1529.         if (target) targets.push(target);
  1530.       }
  1531.       return targets;
  1532.     }
  1533.     if (['ALL FRIENDS', 'ALL ALLIES'].contains(string)) {
  1534.       var group = this._action.friendsUnit().members();
  1535.       for (var i = 0; i < group.length; ++i) {
  1536.         var target = group[i];
  1537.         if (target) targets.push(target);
  1538.       }
  1539.       return targets;
  1540.     }
  1541.     if (['DEAD FRIEND', 'DEAD FRIENDS', 'DEAD ALLIES'].contains(string)) {
  1542.       var group = this._action.friendsUnit().deadMembers();
  1543.       for (var i = 0; i < group.length; ++i) {
  1544.         var target = group[i];
  1545.         if (target) targets.push(target);
  1546.       }
  1547.       return targets;
  1548.     }
  1549.     if (['OPPONENT', 'OPPONENTS', 'RIVALS', 'FOES'].contains(string)) {
  1550.       var group = this._action.opponentsUnit().aliveMembers();
  1551.       for (var i = 0; i < group.length; ++i) {
  1552.         var target = group[i];
  1553.         if (target) targets.push(target);
  1554.       }
  1555.       return targets;
  1556.     }
  1557.     if (['ALL OPPONENTS', 'ALL RIVALS', 'ALL FOES'].contains(string)) {
  1558.       var group = this._action.opponentsUnit().members();
  1559.       for (var i = 0; i < group.length; ++i) {
  1560.         var target = group[i];
  1561.         if (target) targets.push(target);
  1562.       }
  1563.       return targets;
  1564.     }
  1565.     if (['DEAD OPPONENT', 'DEAD OPPONENTS', 'DEAD RIVALS',
  1566.     'DEAD FOES'].contains(string)) {
  1567.       var group = this._action.opponentsUnit().deadMembers();
  1568.       for (var i = 0; i < group.length; ++i) {
  1569.         var target = group[i];
  1570.         if (target) targets.push(target);
  1571.       }
  1572.       return targets;
  1573.     }
  1574.     if (['FRIENDS NOT USER', 'ALLIES NOT USER'].contains(string)) {
  1575.       var group = this._action.friendsUnit().aliveMembers();
  1576.       for (var i = 0; i < group.length; ++i) {
  1577.         var target = group[i];
  1578.         if (target && target !== this._subject) targets.push(target);
  1579.       }
  1580.       return targets;
  1581.     }
  1582.     if (string.match(/(?:FRIEND|ALLY)[ ](\d+)/i)) {
  1583.       var target = this._action.friendsUnit().members()[parseInt(RegExp.$1)];
  1584.       if (target) return [target];
  1585.     }
  1586.     if (string.match(/(?:OPPONENT|FOE|RIVAL)[ ](\d+)/i)) {
  1587.       var target = this._action.opponentsUnit().members()[parseInt(RegExp.$1)]
  1588.       if (target) return [target];
  1589.     }
  1590.     if (['ALL ALIVE'].contains(string)) {
  1591.       var group = this._action.friendsUnit().aliveMembers();
  1592.       group = group.concat(this._action.opponentsUnit().aliveMembers());
  1593.       for (var i = 0; i < group.length; ++i) {
  1594.         var target = group[i];
  1595.         if (target) targets.push(target);
  1596.       }
  1597.       return targets;
  1598.     }
  1599.     if (['ALL MEMBERS'].contains(string)) {
  1600.       var group = this._action.friendsUnit().members();
  1601.       group = group.concat(this._action.opponentsUnit().members());
  1602.       for (var i = 0; i < group.length; ++i) {
  1603.         var target = group[i];
  1604.         if (target) targets.push(target);
  1605.       }
  1606.       return targets;
  1607.     }
  1608.     if (['ALL DEAD'].contains(string)) {
  1609.       var group = this._action.friendsUnit().deadMembers();
  1610.       group = group.concat(this._action.opponentsUnit().deadMembers());
  1611.       for (var i = 0; i < group.length; ++i) {
  1612.         var target = group[i];
  1613.         if (target) targets.push(target);
  1614.       }
  1615.       return targets;
  1616.     }
  1617.     if (['ALL NOT USER'].contains(string)) {
  1618.       var group = this._action.friendsUnit().aliveMembers();
  1619.       group = group.concat(this._action.opponentsUnit().aliveMembers());
  1620.       for (var i = 0; i < group.length; ++i) {
  1621.         var target = group[i];
  1622.         if (target && target !== this._subject) targets.push(target);
  1623.       }
  1624.       return targets;
  1625.     }
  1626.     if (['FOCUS', 'PARTICIPANTS'].contains(string)) {
  1627.       var group = this._targets;
  1628.       for (var i = 0; i < group.length; ++i) {
  1629.         var target = group[i];
  1630.         if (target) targets.push(target);
  1631.       }
  1632.       if (!targets.contains(this._subject)) targets.push(this._subject);
  1633.       return targets;
  1634.     }
  1635.     if (['NOT FOCUS', 'NONPARTICIPANTS'].contains(string)) {
  1636.       var group = this._action.friendsUnit().aliveMembers();
  1637.       group = group.concat(this._action.opponentsUnit().aliveMembers());
  1638.       for (var i = 0; i < group.length; ++i) {
  1639.         var target = group[i];
  1640.         if (target) {
  1641.           if (target === this._subject) continue;
  1642.           if (this._targets.contains(target)) continue;
  1643.           targets.push(target);
  1644.         }
  1645.       }
  1646.       return targets;
  1647.     }
  1648.     if (string.match(/(?:CHAR|CHARA|CHARACTER)[ ](\d+)/i)) {
  1649.       var actorId = parseInt(RegExp.$1);
  1650.       var actor = $gameActors.actor(actorId);
  1651.       if (actor && $gameParty.battleMembers().contains(actor)) {
  1652.         return [actor];
  1653.       }
  1654.     }
  1655.                 return targets;
  1656. };

  1657. BattleManager.actionConditionsMet = function(actSeq) {
  1658.     var ci = this._conditionFlags.length - 1;
  1659.     var actionName = actSeq[0];
  1660.     var actionArgs = actSeq[1];
  1661.     var subject = this._subject;
  1662.     var user = this._subject;
  1663.     var target = this._targets[0];
  1664.                 var targets = this._targets;
  1665.     var action = this._action;
  1666.     var item = this._action.item();
  1667.     if (actionName.match(/ELSE[ ]*(.*)/i)) {
  1668.       if (this._conditionFlags.length <= 0) return false;
  1669.       if (this._conditionFlags[ci]) {
  1670.         this._conditionFlags[ci] = false;
  1671.         this._trueFlags[ci] = true;
  1672.       } else if (!this._conditionFlags[ci] && !this._trueFlags[ci]) {
  1673.         this._conditionFlags[ci] = true;
  1674.         this._trueFlags[ci] = true;
  1675.       }
  1676.       return false;
  1677.     } else if (actionName.match(/ELSE[ ]IF[ ](.*)/i)) {
  1678.       if (this._conditionFlags.length <= 0) return false;
  1679.       if (this._conditionFlags[ci]) {
  1680.         this._conditionFlags[ci] = false;
  1681.         this._trueFlags[ci] = true;
  1682.       } else if (!this._conditionFlags[ci] && !this._trueFlags[ci]) {
  1683.         var text = String(RegExp.$1);
  1684.         this._conditionFlags[ci] = eval('(' + text + ')');
  1685.         this._trueFlags[ci] = eval('(' + text + ')');
  1686.       }
  1687.       return false;
  1688.     } else if (actionName.toUpperCase() === 'END') {
  1689.       if (this._conditionFlags.length <= 0) return false;
  1690.       this._conditionFlags.pop();
  1691.       this._trueFlags.pop();
  1692.       return false;
  1693.     }
  1694.     if (this._conditionFlags.length > 0) return this._conditionFlags[ci];
  1695.     return true
  1696. };

  1697. BattleManager.actionActionAnimation = function(actionArgs) {
  1698.     if (actionArgs && actionArgs[0]) {
  1699.       var targets = this.makeActionTargets(actionArgs[0]);
  1700.     } else {
  1701.       var targets = this._targets;
  1702.     }
  1703.     var mirror = false;
  1704.     if (actionArgs && actionArgs[1]) {
  1705.       if (actionArgs[1].toUpperCase() === 'MIRROR') mirror = true;
  1706.     }
  1707.     var subject = this._subject;
  1708.     var group = targets.filter(Yanfly.Util.onlyUnique);
  1709.     var aniId = this._action.item().animationId;
  1710.     if (aniId < 0) {
  1711.       if (mirror) {
  1712.         this._logWindow.showActorAtkAniMirror(subject, group);
  1713.       } else {
  1714.         this._logWindow.showAttackAnimation(subject, group);
  1715.       }
  1716.     } else {
  1717.       this._logWindow.showNormalAnimation(group, aniId, mirror);
  1718.     }
  1719.     return true;
  1720. };

  1721. BattleManager.actionActionCommonEvent = function() {
  1722.     this._action.item().effects.forEach(function(effect) {
  1723.         if (effect.code === Game_Action.EFFECT_COMMON_EVENT) {
  1724.             $gameTemp.reserveCommonEvent(effect.dataId);
  1725.         }
  1726.     }, this);
  1727.     return false;
  1728. };

  1729. BattleManager.actionActionEffect = function(actionArgs) {
  1730.     if (actionArgs && actionArgs[0]) {
  1731.       var targets = this.makeActionTargets(actionArgs[0]);
  1732.     } else {
  1733.       var targets = this._targets;
  1734.     }
  1735.     targets.forEach(function(target) {
  1736.       if (target !== undefined) {
  1737.         var alreadyDead = target.isDead();
  1738.         this.invokeAction(this._subject, target);
  1739.         if (target.isDead() && !alreadyDead) {
  1740.             target.performCollapse();
  1741.         }
  1742.       }
  1743.     }, this);
  1744.     return true;
  1745. };

  1746. BattleManager.actionAniWait = function(frames) {
  1747.     frames *= Yanfly.Param.AnimationRate || 4;
  1748.     this._logWindow._waitCount = parseInt(frames);
  1749.     return false;
  1750. };

  1751. BattleManager.actionCastAnimation = function() {
  1752.   if (!$gameSystem.isSideView() && this._subject.isActor()) return true;
  1753.         if (!this._action.isAttack() && !this._action.isGuard() &&
  1754.         this._action.isSkill()) {
  1755.     if (this._action.item().castAnimation > 0) {
  1756.       var ani = $dataAnimations[this._action.item().castAnimation]
  1757.                         this._logWindow.showAnimation(this._subject, [this._subject],
  1758.         this._action.item().castAnimation);
  1759.     }
  1760.   }
  1761.   return true;
  1762. };


  1763. BattleManager.actionClearBattleLog = function() {
  1764.     this._logWindow.clear();
  1765.     return false;
  1766. };

  1767. BattleManager.actionDeathBreak = function() {
  1768.     if (this._subject.isDead() || this._subject.hp <= 0) {
  1769.       this._targets = [];
  1770.       this._actionList = [];
  1771.       this._individualTargets = [];
  1772.       this._phase = 'phaseChange';
  1773.       return false;
  1774.     }
  1775.     return true;
  1776. };

  1777. BattleManager.actionDisplayAction = function() {
  1778.     this._logWindow.displayAction(this._subject, this._action.item());
  1779.     return false;
  1780. };

  1781. BattleManager.actionIfConditions = function(actionName, actionArgs) {
  1782.   var subject = this._subject;
  1783.   var user = this._subject;
  1784.   var target = this._targets[0];
  1785.         var targets = this._targets;
  1786.   var action = this._action;
  1787.   var item = this._action.item();
  1788.   var actionName = this._actSeq[0];
  1789.   if (actionName.match(/IF[ ](.*)/i)) {
  1790.     var text = String(RegExp.$1);
  1791.     this._conditionFlags.push(eval(text));
  1792.     this._trueFlags.push(false);
  1793.     var ci = this._conditionFlags.length;
  1794.   }
  1795.   return true;
  1796. };

  1797. BattleManager.actionImmortal = function(actionArgs) {
  1798.                 var targets =
  1799.                         this.makeActionTargets(actionArgs[0]).filter(Yanfly.Util.onlyUnique);
  1800.                 var value = eval(String(actionArgs[1]).toLowerCase());
  1801.                 targets.forEach(function (target) {
  1802.                         if (value) {
  1803.                                 target.addImmortal();
  1804.                         } else {
  1805.         var alreadyDead = target.isDead();
  1806.         target.removeImmortal();
  1807.                         }
  1808.                 }, this);
  1809.     return true;
  1810. };

  1811. BattleManager.actionMotionWait = function(actionArgs) {
  1812.     var targets = this.makeActionTargets(actionArgs[0]);
  1813.                 if (targets[0].isActor() && targets[0].isSpriteVisible()) {
  1814.                         this._logWindow._waitCount += 12;
  1815.                         return false;
  1816.                 }
  1817.     return true;
  1818. };

  1819. BattleManager.actionPerformAction = function() {
  1820.     this._logWindow.performAction(this._subject, this._action);
  1821.                 if (this._subject.isActor() && this._subject.isSpriteVisible) {
  1822.                         this._logWindow._waitCount += 20;
  1823.                         return false;
  1824.                 }
  1825.     return true;
  1826. };

  1827. BattleManager.actionPerformFinish = function() {
  1828.     this._logWindow.performActionEnd(this._subject);
  1829.     $gameParty.aliveMembers().forEach(function(member) {
  1830.       member.spriteReturnHome();
  1831.     });
  1832.     $gameTroop.aliveMembers().forEach(function(member) {
  1833.       member.spriteReturnHome();
  1834.     });
  1835.     return true;
  1836. };

  1837. BattleManager.actionPerformStart = function() {
  1838.     this._logWindow.performActionStart(this._subject, this._action);
  1839.     return true;
  1840. };

  1841. BattleManager.actionWait = function(frames) {
  1842.     this._logWindow._waitCount = parseInt(frames);
  1843.     return false;
  1844. };

  1845. BattleManager.actionWaitForAnimation = function() {
  1846.     this._logWindow.waitForAnimation();
  1847.     return false;
  1848. };

  1849. BattleManager.actionWaitForEffect = function() {
  1850.     this._logWindow.waitForEffect();
  1851.     return false;
  1852. };

  1853. BattleManager.actionWaitForMovement = function() {
  1854.     this._logWindow.waitForMovement();
  1855.     return false;
  1856. };

  1857. BattleManager.actionWaitForNewLine = function() {
  1858.     this._logWindow.waitForNewLine();
  1859.     return false;
  1860. };

  1861. BattleManager.actionWaitForPopups = function() {
  1862.     this._logWindow.waitForPopups();
  1863.     return false;
  1864. };

  1865. //=============================================================================
  1866. // Sprite_Battler
  1867. //=============================================================================

  1868. Yanfly.BEC.Sprite_Battler_initMembers = Sprite_Battler.prototype.initMembers;
  1869. Sprite_Battler.prototype.initMembers = function() {
  1870.     Yanfly.BEC.Sprite_Battler_initMembers.call(this);
  1871.                 this.adjustAnchor();
  1872.                 this.setZ();
  1873. };

  1874. Sprite_Battler.prototype.adjustAnchor = function() {
  1875.     this.anchor.x = 0.5;
  1876.     this.anchor.y = 1.0;
  1877. };

  1878. Sprite_Battler.prototype.setZ = function() {
  1879.     this.z = 1;
  1880. };

  1881. Sprite_Battler.prototype.setupDamagePopup = function() {
  1882.     if (this._battler.isDamagePopupRequested()) {
  1883.         if (this._battler.isSpriteVisible()) {
  1884.             var sprite = new Sprite_Damage();
  1885.             sprite.x = this.x + this.damageOffsetX();
  1886.             sprite.y = this.y + this.damageOffsetY();
  1887.             sprite.setup(this._battler);
  1888.             this.pushDamageSprite(sprite);
  1889.                                                 BattleManager._spriteset.addChild(sprite);
  1890.         }
  1891.     } else {
  1892.       this._battler.clearDamagePopup();
  1893.       this._battler.clearResult();
  1894.     }
  1895. };

  1896. Sprite_Battler.prototype.pushDamageSprite = function(sprite) {
  1897.     var heightBuffer = eval(Yanfly.Param.BECPopupOverlap);
  1898.                 if (eval(Yanfly.Param.BECNewPopBottom)) {
  1899.                         this._damages.push(sprite);
  1900.       this._damages.forEach(function(spr) {
  1901.         for (var i = 0; i < spr.children.length; i++) {
  1902.                                         childSprite = spr.children[i];
  1903.                                         childSprite.anchor.y += heightBuffer;
  1904.                                 }
  1905.                         }, this);
  1906.                 } else {
  1907.                         this._damages.push(sprite);
  1908.                         heightBuffer *= this._damages.length
  1909.                         for (var i = 0; i < sprite.children.length; i++) {
  1910.                                 childSprite = sprite.children[i];
  1911.                                 childSprite.anchor.y += heightBuffer;
  1912.                         }
  1913.                 }
  1914. };

  1915. Yanfly.BEC.Sprite_Battler_setBattler = Sprite_Battler.prototype.setBattler;
  1916. Sprite_Battler.prototype.setBattler = function(battler) {
  1917.     Yanfly.BEC.Sprite_Battler_setBattler.call(this, battler);
  1918.     if (battler) battler.setBattler(this);
  1919. };

  1920. Yanfly.BEC.Sprite_Battler_startMove = Sprite_Battler.prototype.startMove;
  1921. Sprite_Battler.prototype.startMove = function(x, y, duration) {
  1922.     if (this._battler && !this._battler.spriteCanMove()) return;
  1923.                 Yanfly.BEC.Sprite_Battler_startMove.call(this, x, y, duration);
  1924. };

  1925. Sprite_Battler.prototype.stepForward = function() {
  1926.     this.startMove(Yanfly.Param.BECStepDist, 0, 12);
  1927. };

  1928. Sprite_Battler.prototype.stepBack = function() {
  1929.     this.startMove(0, 0, 12);
  1930. };

  1931. Sprite_Battler.prototype.stepFlinch = function() {
  1932.     var flinchX = this.x - this._homeX - Yanfly.Param.BECFlinchDist;
  1933.                 this.startMove(flinchX, 0, 6);
  1934. };

  1935. Sprite_Battler.prototype.stepSubBack = function() {
  1936.                 var backX = -1 * this.width / 2;
  1937.                 this.startMove(backX, 0, 6);
  1938. };

  1939. Sprite_Battler.prototype.stepToSubstitute = function(focus) {
  1940.     var target = focus.battler();
  1941.                 var targetX = (this.x - this._homeX) + (target._homeX - this._homeX);
  1942.                 var targetY = (this.y - this._homeY) + (target._homeY - this._homeY);;
  1943.                 if (focus.isActor()) targetX -= this._mainSprite.width / 2;
  1944.                 if (focus.isEnemy()) targetX += this.width / 2;
  1945.                 this.startMove(targetX, targetY, 1);
  1946. };

  1947. Sprite_Battler.prototype.startMotion = function(motionType) {
  1948. };

  1949. Sprite_Battler.prototype.forceMotion = function(motionType) {
  1950. };

  1951. Sprite_Battler.prototype.refreshMotion = function() {
  1952. };

  1953. Sprite_Battler.prototype.startActionMotion = function() {
  1954. };

  1955. Sprite_Battler.prototype.moveForward = function(distance, frames) {
  1956.     if (this._battler.isActor()) distance *= -1;
  1957.     var moveX = this.x - this._homeX + distance;
  1958.     var moveY = this.y - this._homeY;
  1959.     this.startMove(moveX, moveY, frames);
  1960. };

  1961. Sprite_Battler.prototype.moveToPoint = function(pointX, pointY, frames) {
  1962.                 var targetX = pointX - this._homeX;
  1963.     var targetY = pointY - this._homeY;
  1964.     this.startMove(targetX, targetY, frames);
  1965. };

  1966. Sprite_Battler.prototype.setMirror = function(value) {
  1967.     if (this.scale.x > 0 && value) this.scale.x *= -1;
  1968.     if (this.scale.x < 0 && !value) this.scale.x *= -1;
  1969. };

  1970. Sprite_Battler.prototype.isPopupPlaying = function() {
  1971.     if (this._damages.length > 0) {
  1972.       for (var i = 0; i < this._damages.length; ++i) {
  1973.         return this._damages[i].isPlaying();
  1974.       }
  1975.     }
  1976.     return false;
  1977. };

  1978. //=============================================================================
  1979. // Sprite_Actor
  1980. //=============================================================================

  1981. Sprite_Actor.prototype.initialize = function(battler) {
  1982.     Sprite_Battler.prototype.initialize.call(this, battler);
  1983. };

  1984. Yanfly.BEC.Sprite_Actor_updateShadow = Sprite_Actor.prototype.updateShadow;
  1985. Sprite_Actor.prototype.updateShadow = function() {
  1986.     if (this._hideShadows === undefined) {
  1987.       this._hideShadows = eval(Yanfly.Param.BECShowShadows);
  1988.     }
  1989.     if (!this._hideShadows) return this._shadowSprite.visible = false;
  1990.     Yanfly.BEC.Sprite_Actor_updateShadow.call(this);
  1991. };

  1992. Sprite_Actor.prototype.setActorHome = function(index) {
  1993.     if ($gameSystem.isSideView()) {
  1994.       var homeX = eval(Yanfly.Param.BECHomePosX);
  1995.                   var homeY = eval(Yanfly.Param.BECHomePosY);
  1996.     } else {
  1997.       var homeX = eval(Yanfly.Param.BECFrontPosX);
  1998.                   var homeY = eval(Yanfly.Param.BECFrontPosY);
  1999.     }
  2000.     this._checkAliveStatus = false;
  2001.     if ($gameParty.battleMembers()[index]) {
  2002.       var actor = $gameParty.battleMembers()[index];
  2003.       if (actor.isAlive()) this._checkAliveStatus = true;
  2004.     }
  2005.                 this.setHome(homeX, homeY);
  2006.     this.moveToStartPosition();
  2007. };

  2008. Sprite_Actor.prototype.moveToStartPosition = function() {
  2009.     if ($gameSystem.isSideView() && this._checkAliveStatus) {
  2010.       this.startMove(300, 0, 0);
  2011.     }
  2012. };

  2013. Sprite_Actor.prototype.setupMotion = function() {
  2014. };

  2015. Sprite_Actor.prototype.forceMotion = function(motionType) {
  2016.     var newMotion = Sprite_Actor.MOTIONS[motionType];
  2017.     this._motion = newMotion;
  2018.     this._motionCount = 0;
  2019.     this._pattern = 0;
  2020. };

  2021. Sprite_Actor.prototype.updateTargetPosition = function() {
  2022. };

  2023. Sprite_Actor.prototype.updateMotion = function() {
  2024.     this.updateMotionCount();
  2025. };

  2026. Sprite_Actor.prototype.onMoveEnd = function() {
  2027.     Sprite_Battler.prototype.onMoveEnd.call(this);
  2028. };

  2029. Sprite_Actor.prototype.stepForward = function() {
  2030.     this.startMove(-Yanfly.Param.BECStepDist, 0, 12);
  2031. };

  2032. Sprite_Actor.prototype.stepFlinch = function() {
  2033.                 var flinchX = this.x - this._homeX + Yanfly.Param.BECFlinchDist;
  2034.                 this.startMove(flinchX, 0, 6);
  2035. };

  2036. Sprite_Actor.prototype.stepSubBack = function() {
  2037.     var backX = this._mainSprite.width / 2;
  2038.                 this.startMove(backX, 0, 6);
  2039. };

  2040. Yanfly.BEC.Sprite_Actor_updateBitmap = Sprite_Actor.prototype.updateBitmap;
  2041. Sprite_Actor.prototype.updateBitmap = function() {
  2042.     var name = this._actor.battlerName();
  2043.     var needUpdate = false;
  2044.     if (this._battlerName !== name) needUpdate = true;
  2045.     Yanfly.BEC.Sprite_Actor_updateBitmap.call(this);
  2046.     if (needUpdate) this.adjustAnchor();
  2047. };

  2048. Sprite_Actor.prototype.adjustAnchor = function() {
  2049.     if (!this._mainSprite) return;
  2050.                 this._mainSprite.anchor.x = this._actor.anchorX();
  2051.     this._mainSprite.anchor.y = this._actor.anchorY();
  2052. };

  2053. //=============================================================================
  2054. // Sprite_Weapon
  2055. //=============================================================================

  2056. Yanfly.BEC.Sprite_Weapon_setup = Sprite_Weapon.prototype.setup;
  2057. Sprite_Weapon.prototype.setup = function(weaponImageId) {
  2058.     Yanfly.BEC.Sprite_Weapon_setup.call(this, weaponImageId);
  2059.     this._animationCount -= 1; // Synch with sprite
  2060. };

  2061. //=============================================================================
  2062. // Sprite_Damage
  2063. //=============================================================================

  2064. Yanfly.BEC.Sprite_Damage_initialize = Sprite_Damage.prototype.initialize;
  2065. Sprite_Damage.prototype.initialize = function() {
  2066.     Yanfly.BEC.Sprite_Damage_initialize.call(this);
  2067.     this._duration = eval(Yanfly.Param.BECPopupDur);
  2068. };

  2069. Sprite_Damage.prototype.setup = function(target) {
  2070.     var result = target.shiftDamagePopup();
  2071.     if (result.missed || result.evaded) {
  2072.       this.createMiss();
  2073.     } else if (result.hpAffected) {
  2074.       this.createDigits(0, result.hpDamage);
  2075.     } else if (target.isAlive() && result.mpDamage !== 0) {
  2076.       this.createDigits(2, result.mpDamage);
  2077.     }
  2078.     if (result.critical) {
  2079.       this.setupCriticalEffect();
  2080.     }
  2081. };

  2082. Sprite_Damage.prototype.setupCriticalEffect = function() {
  2083.     this._flashColor = eval('[' + Yanfly.Param.BECCritPopup + ']');
  2084.     this._flashDuration = eval(Yanfly.Param.BECCritDur);
  2085. };

  2086. //=============================================================================
  2087. // Spriteset_Battle
  2088. //=============================================================================

  2089. Spriteset_Battle.prototype.isBusy = function() {
  2090.     return false;
  2091. };

  2092. Yanfly.BEC.Spriteset_Battle_update = Spriteset_Battle.prototype.update;
  2093. Spriteset_Battle.prototype.update = function() {
  2094.     Yanfly.BEC.Spriteset_Battle_update.call(this);
  2095.     this.updateZCoordinates();
  2096. };

  2097. Spriteset_Battle.prototype.updateZCoordinates = function() {
  2098.     this._battleField.children.sort(this.battleFieldDepthCompare);
  2099. };

  2100. Spriteset_Battle.prototype.battleFieldDepthCompare = function(a, b) {
  2101.     var priority = BattleManager.getSpritePriority();
  2102.     if (a._battler && b._battler && priority !== 0) {
  2103.       if (priority === 1) {
  2104.         if (a._battler.isActor() && b._battler.isEnemy()) return 1;
  2105.         if (a._battler.isEnemy() && b._battler.isActor()) return -1;
  2106.       } else if (priority === 2) {
  2107.         if (a._battler.isActor() && b._battler.isEnemy()) return -1;
  2108.         if (a._battler.isEnemy() && b._battler.isActor()) return 1;
  2109.       }
  2110.     }
  2111.     if (a.z < b.z) return -1;
  2112.     if (a.z > b.z) return 1;
  2113.     if (a.y < b.y) return -1;
  2114.     if (a.y > b.y) return 1;
  2115.     return 0;
  2116. };

  2117. Spriteset_Battle.prototype.isPopupPlaying = function() {
  2118.     return this.battlerSprites().some(function(sprite) {
  2119.         return sprite.isPopupPlaying();
  2120.     });
  2121. };

  2122. //=============================================================================
  2123. // Game_Temp
  2124. //=============================================================================

  2125. Game_Temp.prototype.clearActionSequenceSettings = function() {
  2126. };

  2127. //=============================================================================
  2128. // Game_System
  2129. //=============================================================================

  2130. Yanfly.BEC.Game_System_initialize = Game_System.prototype.initialize;
  2131. Game_System.prototype.initialize = function() {
  2132.     Yanfly.BEC.Game_System_initialize.call(this);
  2133.     this.initBattleSystem();
  2134. };

  2135. Game_System.prototype.initBattleSystem = function() {
  2136.     this._battleSystem = Yanfly.Param.BECSystem.toLowerCase();
  2137. };

  2138. Game_System.prototype.getBattleSystem = function() {
  2139.     if (this._battleSystem === undefined) this.initBattleSystem();
  2140.     return this._battleSystem;
  2141. };

  2142. Game_System.prototype.setBattleSystem = function(type) {
  2143.     this._battleSystem = type.toLowerCase();
  2144. };

  2145. //=============================================================================
  2146. // Game_Interpreter
  2147. //=============================================================================

  2148. Yanfly.BEC.Game_Interpreter_pluginCommand =
  2149.     Game_Interpreter.prototype.pluginCommand;
  2150. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  2151.     Yanfly.BEC.Game_Interpreter_pluginCommand.call(this, command, args);
  2152.     if (command === 'setBattleSys' && !$gameParty.inBattle()) {
  2153.       this.setBattleSystem(args[0]);
  2154.     }
  2155. };

  2156. Game_Interpreter.prototype.setBattleSystem = function(value) {
  2157.     $gameSystem.setBattleSystem(value);
  2158. };

  2159. //=============================================================================
  2160. // Game_Action
  2161. //=============================================================================

  2162. Game_Action.prototype.speed = function() {
  2163.     var user = this.subject(); var a = user;
  2164.     var maxhp = user.mhp; var mhp = user.mhp; var hp = user.hp;
  2165.     var maxmp = user.mmp; var mmp = user.mmp; var mp = user.mp;
  2166.     var maxtp = user.maxTp(); var mtp = user.maxTp(); var tp = user.tp;
  2167.     var atk = user.atk; var def = user.def; var mat = user.mat;
  2168.     var int = user.mat; var mdf = user.mdf; var res = user.res;
  2169.     var agi = user.agi; var luk = user.luk;
  2170.     var speed = eval(Yanfly.Param.BECActionSpeed);
  2171.     if (this.item()) speed += this.item().speed;
  2172.     if (this.isAttack()) speed += this.subject().attackSpeed();
  2173.     return speed;
  2174. };

  2175. Yanfly.BEC.Game_Action_apply = Game_Action.prototype.apply;
  2176. Game_Action.prototype.apply = function(target) {
  2177.     target._result = null;
  2178.     target._result = new Game_ActionResult();
  2179.     this.subject()._result = null;
  2180.     this.subject()._result = new Game_ActionResult();
  2181.     Yanfly.BEC.Game_Action_apply.call(this, target);
  2182.     if ($gameParty.inBattle()) {
  2183.       target.startDamagePopup();
  2184.       target.performResultEffects();
  2185.       if (target !== this.subject()) this.subject().startDamagePopup();
  2186.     }
  2187. };

  2188. Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {
  2189.     var stateId = effect.dataId;
  2190.     var chance = effect.value1;
  2191.     if (!this.isCertainHit()) {
  2192.       chance *= target.stateRate(stateId);
  2193.       chance *= this.lukEffectRate(target);
  2194.     }
  2195.     if (Math.random() < chance) {
  2196.       if (stateId === target.deathStateId()) {
  2197.         if (target.isImmortal()) target.removeImmortal();
  2198.       }
  2199.       target.addState(stateId);
  2200.       this.makeSuccess(target);
  2201.     }
  2202. };

  2203. Yanfly.BEC.Game_Action_applyGlobal = Game_Action.prototype.applyGlobal;
  2204. Game_Action.prototype.applyGlobal = function() {
  2205.     if ($gameParty.inBattle()) return;
  2206.     Yanfly.BEC.Game_Action_applyGlobal.call(this);
  2207. };

  2208. Yanfly.BEC.Game_Action_needsSelection = Game_Action.prototype.needsSelection;
  2209. Game_Action.prototype.needsSelection = function() {
  2210.     if ($gameParty.inBattle() && this.item().scope === 0) return false;
  2211.     if ($gameParty.inBattle() && BattleManager.isForceSelection()) return true;
  2212.     return Yanfly.BEC.Game_Action_needsSelection.call(this);
  2213. };

  2214. //=============================================================================
  2215. // Game_BattlerBase
  2216. //=============================================================================

  2217. Game_BattlerBase.prototype.requestStatusRefresh = function() {
  2218.     this._statusRefreshRequested = true;
  2219. };

  2220. Game_BattlerBase.prototype.isStatusRefreshRequested = function() {
  2221.     return this._statusRefreshRequested;
  2222. };

  2223. Game_BattlerBase.prototype.completetStatusRefreshRequest = function() {
  2224.     this._statusRefreshRequested = false;
  2225. };

  2226. Game_BattlerBase.prototype.updateStateTicks = function() {
  2227.     for (var i = 0; i < this._states.length; ++i) {
  2228.       var stateId = this._states[i];
  2229.       var state = $dataStates[stateId];
  2230.       if (!state) continue;
  2231.       if (state.autoRemovalTiming === 0) continue;
  2232.       if (!this._stateTurns[stateId]) continue;
  2233.       var value = BattleManager.tickRate() / Yanfly.Param.BECTurnTime;
  2234.       this._stateTurns[stateId] -= value;
  2235.       if (this._stateTurns[stateId] <= 0) this.removeState(stateId);
  2236.     }
  2237. };

  2238. Game_BattlerBase.prototype.updateBuffTicks = function() {
  2239.     for (var i = 0; i < this._buffTurns.length; i++) {
  2240.       if (this._buffTurns[i] <= 0) continue;
  2241.       var value = BattleManager.tickRate() / Yanfly.Param.BECTurnTime;
  2242.       this._buffTurns[i] -= value;
  2243.       if (this._buffTurns[i] <= 0) this.removeBuff(i);
  2244.     }
  2245. };

  2246. Game_BattlerBase.prototype.timedTick = function() {
  2247.     return 1 * BattleManager.tickRate();
  2248. };

  2249. Yanfly.BEC.Game_BattlerBase_isStateResist =
  2250.     Game_BattlerBase.prototype.isStateResist;
  2251. Game_BattlerBase.prototype.isStateResist = function(stateId) {
  2252.     if (stateId === this.deathStateId() && this.isImmortal()) return true;
  2253.     return Yanfly.BEC.Game_BattlerBase_isStateResist.call(this, stateId);
  2254. };

  2255. Game_BattlerBase.prototype.isImmortal = function() {
  2256.     return this._immortalState;
  2257. };

  2258. //=============================================================================
  2259. // Game_Battler
  2260. //=============================================================================

  2261. Yanfly.BEC.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
  2262. Game_Battler.prototype.onBattleStart = function() {
  2263.     Yanfly.BEC.Game_Battler_onBattleStart.call(this);
  2264.     this._immortalState = false;
  2265. };

  2266. Yanfly.BEC.Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
  2267. Game_Battler.prototype.onBattleEnd = function() {
  2268.     Yanfly.BEC.Game_Battler_onBattleEnd.call(this);
  2269.     this._immortalState = false;
  2270. };

  2271. Yanfly.BEC.Game_Battler_isSelected = Game_Battler.prototype.isSelected;
  2272. Game_Battler.prototype.isSelected = function() {
  2273.     if ($gameParty.inBattle() && BattleManager.isAllSelection()) {
  2274.       if (!this.isAppeared()) return false;
  2275.       var action = BattleManager.inputtingAction();
  2276.       if (action && action.item()) {
  2277.         if (this.isDead() && this.isEnemy()) return false;
  2278.         if (this.isDead() && this.isActor()) return action.isForDeadFriend();
  2279.         if (action.isForFriend() && this.isActor()) return true;
  2280.         if (action.isForOpponent() && this.isEnemy()) return true;
  2281.       }
  2282.     }
  2283.     return Yanfly.BEC.Game_Battler_isSelected.call(this);
  2284. };

  2285. Yanfly.BEC.Game_Battler_regenerateAll = Game_Battler.prototype.regenerateAll;
  2286. Game_Battler.prototype.regenerateAll = function() {
  2287.     var lifeState = this.isAlive();
  2288.     Yanfly.BEC.Game_Battler_regenerateAll.call(this);
  2289.     if (this.isDead() && lifeState === true) {
  2290.       this.performCollapse();
  2291.     }
  2292.     if ($gameParty.inBattle()) this.startDamagePopup();
  2293. };

  2294. Game_Battler.prototype.addImmortal = function() {
  2295.     this._immortalState = true;
  2296. };

  2297. Game_Battler.prototype.removeImmortal = function() {
  2298.     var alreadyDead = this.isDead();
  2299.     this._immortalState = false;
  2300.     this.refresh();
  2301.     if (this.isDead() && !alreadyDead) this.performCollapse();
  2302. };

  2303. Game_Battler.prototype.clearDamagePopup = function() {
  2304.     this._damagePopup = [];
  2305. };

  2306. Game_Battler.prototype.isDamagePopupRequested = function() {
  2307.     if (!this._damagePopup) this.clearDamagePopup();
  2308.     return this._damagePopup.length > 0;
  2309. };

  2310. Game_Battler.prototype.startDamagePopup = function() {
  2311.     var result = this.result();
  2312.     if (result.missed || result.evaded) {
  2313.       var copyResult = JsonEx.makeDeepCopy(result);
  2314.       copyResult.hpAffected = false;
  2315.       copyResult.mpDamage = 0;
  2316.       this._damagePopup.push(copyResult);
  2317.     }
  2318.     if (result.hpAffected) {
  2319.       var copyResult = JsonEx.makeDeepCopy(result);
  2320.       copyResult.mpDamage = 0;
  2321.       this._damagePopup.push(copyResult);
  2322.     }
  2323.     if (result.mpDamage !== 0) {
  2324.       var copyResult = JsonEx.makeDeepCopy(result);
  2325.       copyResult.hpAffected = false;
  2326.       this._damagePopup.push(copyResult);
  2327.     }
  2328. };

  2329. Game_Battler.prototype.shiftDamagePopup = function() {
  2330.     if (!this._damagePopup) this.clearDamagePopup();
  2331.     return this._damagePopup.shift();
  2332. };

  2333. Yanfly.BEC.Game_Battler_performCollapse =
  2334.     Game_Battler.prototype.performCollapse;
  2335. Game_Battler.prototype.performCollapse = function() {
  2336.     Yanfly.BEC.Game_Battler_performCollapse.call(this);
  2337.     if ($gameParty.inBattle()) this.forceMotion('dead');
  2338. };

  2339. Game_Battler.prototype.performResultEffects = function() {
  2340.     var result = this.result();
  2341.     if (result.missed && result.physical) this.performMiss();
  2342.     if (result.evaded) {
  2343.       if (result.physical) {
  2344.         this.performEvasion();
  2345.       } else {
  2346.         this.performMagicEvasion();
  2347.       }
  2348.     }
  2349.     if (result.hpAffected) {
  2350.       if (result.hpDamage > 0 && !result.drain) {
  2351.         this.performDamage();
  2352.       }
  2353.       if (result.hpDamage < 0) {
  2354.         this.performRecovery();
  2355.       }
  2356.     }
  2357.     if (this.isAlive() && result.mpDamage !== 0 && result.mpDamage < 0) {
  2358.       this.performRecovery();
  2359.     }
  2360.     if (this.isAlive() && result.tpDamage !== 0 && result.tpDamage < 0) {
  2361.       this.performRecovery();
  2362.     }
  2363. };

  2364. Yanfly.BEC.Game_Battler_performDamage =
  2365.         Game_Battler.prototype.performDamage;
  2366. Game_Battler.prototype.performDamage = function() {
  2367.                 Yanfly.BEC.Game_Battler_performDamage.call(this);
  2368.                 this.performFlinch();
  2369. };

  2370. Yanfly.BEC.Game_Battler_performMiss = Game_Battler.prototype.performMiss;
  2371. Game_Battler.prototype.performMiss = function() {
  2372.     Yanfly.BEC.Game_Battler_performMiss.call(this);
  2373.                 this.performFlinch();
  2374. };

  2375. Yanfly.BEC.Game_Battler_performEvasion =
  2376.                 Game_Battler.prototype.performEvasion;
  2377. Game_Battler.prototype.performEvasion = function() {
  2378.     Yanfly.BEC.Game_Battler_performEvasion.call(this);
  2379.                 this.performFlinch();
  2380. };

  2381. Yanfly.BEC.Game_Battler_performMagicEvasion =
  2382.                 Game_Battler.prototype.performMagicEvasion;
  2383. Game_Battler.prototype.performMagicEvasion = function() {
  2384.     Yanfly.BEC.Game_Battler_performMagicEvasion.call(this);
  2385.                 this.performFlinch();
  2386. };

  2387. Game_Battler.prototype.performFlinch = function() {
  2388.                 if (this._flinched || !$gameSystem.isSideView()) return;
  2389.                 this._flinched = true;
  2390.                 this.spriteStepFlinch();
  2391. };

  2392. Yanfly.BEC.Game_Battler_performReflection =
  2393.                 Game_Battler.prototype.performReflection;
  2394. Game_Battler.prototype.performReflection = function() {
  2395.     Yanfly.BEC.Game_Battler_performReflection.call(this);
  2396.                 if (!$gameSystem.isSideView() && this.isActor()) return;
  2397.                 var animationId = this.reflectAnimationId();
  2398.                 var mirror = this.isActor();
  2399.                 this.startAnimation(animationId, mirror, 0);
  2400. };

  2401. Yanfly.BEC.Game_Battler_performSubstitute =
  2402.                 Game_Battler.prototype.performSubstitute;
  2403. Game_Battler.prototype.performSubstitute = function(target) {
  2404.                 Yanfly.BEC.Game_Battler_performSubstitute.call(this, target);
  2405.                 if (!$gameSystem.isSideView()) return;
  2406.                 this._flinched = true;
  2407.                 if (BattleManager._action.isForAll()) {
  2408.                         this.spriteStepForward();
  2409.                         target.spriteStepSubBack();
  2410.                 } else {
  2411.                         this.spriteStepToSubstitute(target);
  2412.                         target.spriteStepSubBack();
  2413.                 }
  2414. };

  2415. Game_Battler.prototype.setBattler = function(sprite) {
  2416.     BattleManager.registerSprite(this, sprite);
  2417. };

  2418. Game_Battler.prototype.battler = function() {
  2419.     return BattleManager.getSprite(this);
  2420. };

  2421. Game_Battler.prototype.requestMotion = function(motionType) {
  2422.     this._motionType = motionType;
  2423.     if (this.battler()) {
  2424.       this.battler().startMotion(motionType);
  2425.     }
  2426. };

  2427. Game_Battler.prototype.forceMotion = function(motionType) {
  2428.     this._motionType = motionType;
  2429.     if (this.battler()) {
  2430.       this.battler().forceMotion(motionType);
  2431.     }
  2432. };

  2433. Game_Battler.prototype.startWeaponAnimation = function(weaponImageId) {
  2434.     this._weaponImageId = weaponImageId;
  2435.     if (this.battler()) {
  2436.       this.battler().setupWeaponAnimation();
  2437.     }
  2438. };

  2439. Game_Battler.prototype.performActionStart = function(action) {
  2440.     if (!action.isGuard()) {
  2441.         this.setActionState('acting');
  2442.         this.spriteStepForward();
  2443.     }
  2444. };

  2445. Yanfly.BEC.Game_Battler_performActionEnd =
  2446.     Game_Battler.prototype.performActionEnd;
  2447. Game_Battler.prototype.performActionEnd = function() {
  2448.     Yanfly.BEC.Game_Battler_performActionEnd.call(this);
  2449.     this.spriteReturnHome();
  2450. };

  2451. Game_Battler.prototype.spriteStepForward = function() {
  2452.     if ($gameSystem.isSideView() && this.battler()) {
  2453.       this.battler().stepForward();
  2454.     }
  2455. };

  2456. Game_Battler.prototype.spriteStepBack = function() {
  2457.     if ($gameSystem.isSideView() && this.battler()) {
  2458.       this.battler().stepBack();
  2459.     }
  2460. };

  2461. Game_Battler.prototype.spriteStepSubBack = function() {
  2462.     if ($gameSystem.isSideView() && this.battler()) {
  2463.                         this.battler().stepSubBack();
  2464.     }
  2465. };

  2466. Game_Battler.prototype.spriteStepToSubstitute = function(target) {
  2467.     if ($gameSystem.isSideView() && this.battler()) {
  2468.       this.battler().stepToSubstitute(target);
  2469.     }
  2470. };

  2471. Game_Battler.prototype.spriteStepFlinch = function() {
  2472.     if ($gameSystem.isSideView() && this.battler()) {
  2473.       this.battler().stepFlinch();
  2474.     }
  2475. };

  2476. Game_Battler.prototype.spriteReturnHome = function() {
  2477.     if ($gameSystem.isSideView() && this.battler()) {
  2478.       this._flinched = false;
  2479.                         this.spriteFaceForward();
  2480.                         this.battler().stepBack();
  2481.       if (this.numActions() <= 0) {
  2482.         this.setActionState('undecided');
  2483.       }
  2484.       this.battler().refreshMotion();
  2485.     }
  2486. };

  2487. Game_Battler.prototype.reflectAnimationId = function() {
  2488.                 for (var i = 0; i < this.states().length; ++i) {
  2489.                         var state = this.states()[i];
  2490.                         if (state.reflectAnimationId > 0) return state.reflectAnimationId;
  2491.                 }
  2492.                 return Yanfly.Param.BECReflectAni;
  2493. };

  2494. Game_Battler.prototype.spriteCanMove = function() {
  2495.     if (!$gameSystem.isSideView()) return false;
  2496.                 for (var i = 0; i < this.states().length; ++i) {
  2497.                         var state = this.states()[i];
  2498.                         if (state.spriteCannotMove) return false;
  2499.                 }
  2500.                 return this.canMove();
  2501. };

  2502. Game_Battler.prototype.spritePosX = function() {
  2503.     if ($gameSystem.isSideView() && this.battler()) {
  2504.                         return this.battler().x;
  2505.                 } else if (this.battler()) {
  2506.                         return this.battler().x;
  2507.                 } else {
  2508.                         return 0;
  2509.                 }
  2510. };

  2511. Game_Battler.prototype.spritePosY = function() {
  2512.     if ($gameSystem.isSideView() && this.battler()) {
  2513.                         return this.battler().y;
  2514.                 } else if (this.battler()) {
  2515.                         return this.battler().y;
  2516.                 } else {
  2517.                         return 0;
  2518.                 }
  2519. };

  2520. Game_Battler.prototype.spriteWidth = function() {
  2521.     if ($gameSystem.isSideView() && this.battler()) {
  2522.                         return this.battler().width;
  2523.                 } else if (this.battler()) {
  2524.                         return this.battler().width;
  2525.                 } else {
  2526.                         return 1;
  2527.                 }
  2528. };

  2529. Game_Battler.prototype.spriteHeight = function() {
  2530.     if ($gameSystem.isSideView() && this.battler()) {
  2531.                         return this.battler().height;
  2532.                 } else if (this.battler()) {
  2533.                         return this.battler().height;
  2534.                 } else {
  2535.                         return 1;
  2536.                 }
  2537. };

  2538. Game_Battler.prototype.anchorX = function() {
  2539.     return Yanfly.Param.BECAnchorX;
  2540. };

  2541. Game_Battler.prototype.anchorY = function() {
  2542.     return Yanfly.Param.BECAnchorY;
  2543. };

  2544. Game_Battler.prototype.spriteHomeX = function() {
  2545.                 if ($gameSystem.isSideView() && this.battler()) {
  2546.                         return this.battler()._homeX;
  2547.                 } else {
  2548.                         return 0;
  2549.                 }
  2550. };

  2551. Game_Battler.prototype.spriteHomeY = function() {
  2552.                 if ($gameSystem.isSideView() && this.battler()) {
  2553.                         return this.battler()._homeY;
  2554.                 } else {
  2555.                         return 0;
  2556.                 }
  2557. };

  2558. Game_Battler.prototype.setMirror = function(value) {
  2559.     if ($gameSystem.isSideView() && this.battler() && this.spriteCanMove()) {
  2560.       this.battler().setMirror(value);
  2561.     }
  2562. };

  2563. Game_Battler.prototype.spriteFaceForward = function() {
  2564.     this.setMirror(false);
  2565. };

  2566. Game_Battler.prototype.spriteFaceBackward = function() {
  2567.     this.setMirror(true);
  2568. };

  2569. Game_Battler.prototype.spriteFacePoint = function(pointX, pointY) {
  2570.     if (this.spritePosX() > pointX) {
  2571.       this.spriteFaceBackward();
  2572.     } else {
  2573.       this.spriteFaceForward();
  2574.     }
  2575. };

  2576. Game_Battler.prototype.spriteFaceAwayPoint = function(pointX, pointY) {
  2577.     if (this.spritePosX() > pointX) {
  2578.       this.spriteFaceForward();
  2579.     } else {
  2580.       this.spriteFaceBackward();
  2581.     }
  2582. };

  2583. Game_Battler.prototype.spriteFaceTarget = function(target) {
  2584.     if (!target) return;
  2585.     var pointX = target.spritePosX();
  2586.     var pointY = target.spritePosY();
  2587.     this.spriteFacePoint(pointX, pointY);
  2588. };

  2589. Game_Battler.prototype.spriteFaceAwayTarget = function(target) {
  2590.     if (!target) return;
  2591.     var pointX = target.spritePosX();
  2592.     var pointY = target.spritePosY();
  2593.     this.spriteFaceAwayPoint(pointX, pointY);
  2594. };

  2595. Game_Battler.prototype.spriteFaceHome = function() {
  2596.     var pointX = this.spriteHomeX();
  2597.     var pointY = this.spriteHomeY();
  2598.     this.spriteFacePoint(pointX, pointY);
  2599. };

  2600. Game_Battler.prototype.spriteFaceAwayHome = function() {
  2601.     var pointX = target.spriteHomeX();
  2602.     var pointY = target.spriteHomeY();
  2603.     this.spriteFaceAwayPoint(pointX, pointY);
  2604. };

  2605. Game_Battler.prototype.attackMotion = function() {
  2606.     return 'thrust';
  2607. };

  2608. Game_Battler.prototype.performAttack = function() {
  2609. };

  2610. Game_Battler.prototype.requestMotionRefresh = function() {
  2611.     if (this.isDead() && this._motionType !== 'dead') {
  2612.       this.requestMotion('dead');
  2613.     }
  2614.     if (this.isDead() && this._motionType === 'dead') return;
  2615.     if (this._motionType === 'victory') return;
  2616.     if (this._motionType === 'escape' && !BattleManager.isInputting()) return;
  2617.     if (this._motionType === 'guard' && !BattleManager.isInputting()) return;
  2618.     this.clearMotion();
  2619.     if (this.battler() && BattleManager.isInputting()) {
  2620.       this.battler().refreshMotion();
  2621.     }
  2622. };

  2623. Game_Battler.prototype.onTurnStart = function() {
  2624. };

  2625. Game_Battler.prototype.onTurnEnd = function() {
  2626.     this.clearResult();
  2627.     this.regenerateAll();
  2628.     if (!BattleManager.timeBasedStates()) this.updateStateTurns();
  2629.     if (!BattleManager.timeBasedBuffs()) this.updateBuffTurns();
  2630.     this.removeStatesAuto(2);
  2631. };

  2632. Game_Battler.prototype.updateTick = function() {
  2633.     if (BattleManager.timeBasedStates()) this.updateStateTicks();
  2634.     if (BattleManager.timeBasedBuffs()) this.updateBuffTicks();
  2635. };

  2636. //=============================================================================
  2637. // Game_Actor
  2638. //=============================================================================

  2639. Yanfly.BEC.Game_Actor_refresh = Game_Actor.prototype.refresh;
  2640. Game_Actor.prototype.refresh = function() {
  2641.     Yanfly.BEC.Game_Actor_refresh.call(this);
  2642.     if ($gameParty.inBattle()) this.requestStatusRefresh();
  2643. };

  2644. Game_Actor.prototype.isSpriteVisible = function() {
  2645.     if ($gameSystem.isSideView()) return true;
  2646.     return eval(Yanfly.Param.BECFrontSprite);
  2647. };

  2648. Game_Actor.prototype.reflectAnimationId = function() {
  2649.                 if (this.actor().reflectAnimationId > 0) {
  2650.                         return this.actor().reflectAnimationId;
  2651.                 }
  2652.                 if (this.currentClass().reflectAnimationId > 0) {
  2653.                         return this.currentClass().reflectAnimationId;
  2654.                 }
  2655.                 for (var i = 0; i < this.equips().length; ++i) {
  2656.                         var equip = this.equips()[i];
  2657.                         if (equip && equip.reflectAnimationId > 0) {
  2658.                                 return equip.reflectAnimationId;
  2659.                         }
  2660.                 }
  2661.                 return Game_Battler.prototype.reflectAnimationId.call(this);
  2662. };

  2663. Game_Actor.prototype.spriteCanMove = function() {
  2664.                 if (this.actor().spriteCannotMove) return false;
  2665.                 if (this.currentClass().spriteCannotMove) return false;
  2666.                 for (var i = 0; i < this.equips().length; ++i) {
  2667.                         var equip = this.equips()[i];
  2668.                         if (equip && equip.spriteCannotMove) return false;
  2669.                 }
  2670.                 return Game_Battler.prototype.spriteCanMove.call(this);
  2671. };

  2672. Game_Actor.prototype.spriteWidth = function() {
  2673.     if ($gameSystem.isSideView() && this.battler()) {
  2674.                         return this.battler()._mainSprite.width;
  2675.                 } else {
  2676.                         return 1;
  2677.                 }
  2678. };

  2679. Game_Actor.prototype.spriteHeight = function() {
  2680.     if ($gameSystem.isSideView() && this.battler()) {
  2681.                         return this.battler()._mainSprite.height;
  2682.                 } else {
  2683.                         return 1;
  2684.                 }
  2685. };

  2686. Game_Actor.prototype.anchorX = function() {
  2687.     return this.actor().anchorX;
  2688. };

  2689. Game_Actor.prototype.anchorY = function() {
  2690.     return this.actor().anchorY;
  2691. };

  2692. Game_Actor.prototype.spriteFacePoint = function(pointX, pointY) {
  2693.     if (this.spritePosX() > pointX) {
  2694.       this.spriteFaceForward();
  2695.     } else {
  2696.       this.spriteFaceBackward();
  2697.     }
  2698. };

  2699. Game_Actor.prototype.spriteFaceAwayPoint = function(pointX, pointY) {
  2700.     if (this.spritePosX() > pointX) {
  2701.       this.spriteFaceBackward();
  2702.     } else {
  2703.       this.spriteFaceForward();
  2704.     }
  2705. };

  2706. Game_Actor.prototype.performAttack = function() {
  2707.     var weapons = this.weapons();
  2708.     var wtypeId = weapons[0] ? weapons[0].wtypeId : 0;
  2709.     var attackMotion = $dataSystem.attackMotions[wtypeId];
  2710.     if (attackMotion) {
  2711.       if (attackMotion.type === 0) {
  2712.         this.forceMotion('thrust');
  2713.       } else if (attackMotion.type === 1) {
  2714.         this.forceMotion('swing');
  2715.       } else if (attackMotion.type === 2) {
  2716.         this.forceMotion('missile');
  2717.       }
  2718.       this.startWeaponAnimation(attackMotion.weaponImageId);
  2719.     }
  2720. };

  2721. Game_Actor.prototype.attackMotion = function() {
  2722.     var weapons = this.weapons();
  2723.     var wtypeId = weapons[0] ? weapons[0].wtypeId : 0;
  2724.     var attackMotion = $dataSystem.attackMotions[wtypeId];
  2725.     if (attackMotion) {
  2726.       if (attackMotion.type === 0) {
  2727.         return 'thrust';
  2728.       } else if (attackMotion.type === 1) {
  2729.         return 'swing';
  2730.       } else if (attackMotion.type === 2) {
  2731.         return 'missile';
  2732.       }
  2733.     };
  2734.     return 'thrust';
  2735. };

  2736. Game_Actor.prototype.performEscapeSuccess = function() {
  2737.     if (this.battler()) {
  2738.       this.performEscape();
  2739.       this.battler().startMove(300, 0, 60);
  2740.     }
  2741. };

  2742. //=============================================================================
  2743. // Game_Enemy
  2744. //=============================================================================

  2745. Game_Enemy.prototype.performActionStart = function(action) {
  2746.     Game_Battler.prototype.performActionStart.call(this, action);
  2747.     if (!$gameSystem.isSideView() || !this.spriteCanMove()) {
  2748.       this.requestEffect('whiten');
  2749.     }
  2750. };

  2751. Yanfly.BEC.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
  2752. Game_Enemy.prototype.performDamage = function() {
  2753.     if ($gameSystem.isSideView()) {
  2754.                         Game_Battler.prototype.performDamage.call(this);
  2755.                         SoundManager.playEnemyDamage();
  2756.                 } else {
  2757.                         Yanfly.BEC.Game_Enemy_performDamage.call(this);
  2758.                 }
  2759. };

  2760. Game_Enemy.prototype.attackAnimationId = function() {
  2761.     return this.enemy().attackAnimationId;
  2762. };

  2763. Game_Enemy.prototype.reflectAnimationId = function() {
  2764.                 if (this.enemy().reflectAnimationId > 0) {
  2765.                         return this.enemy().reflectAnimationId;
  2766.                 }
  2767.                 return Game_Battler.prototype.reflectAnimationId.call(this);
  2768. };

  2769. Game_Enemy.prototype.spriteCanMove = function() {
  2770.                 if (this.enemy().spriteCannotMove) return false;
  2771.                 return Game_Battler.prototype.spriteCanMove.call(this);
  2772. };

  2773. //=============================================================================
  2774. // Game_Unit
  2775. //=============================================================================

  2776. Game_Unit.prototype.requestMotionRefresh = function() {
  2777.     for (var i = 0; i < this.members().length; ++i) {
  2778.       var member = this.members()[i];
  2779.       if (member) member.requestMotionRefresh();
  2780.     }
  2781. };

  2782. Game_Unit.prototype.onTurnStart = function() {
  2783.     for (var i = 0; i < this.members().length; ++i) {
  2784.       var member = this.members()[i];
  2785.       if (member) member.onTurnStart();
  2786.     }
  2787. };

  2788. Game_Unit.prototype.updateTick = function() {
  2789.     for (var i = 0; i < this.members().length; ++i) {
  2790.       var member = this.members()[i];
  2791.       if (member) member.updateTick();
  2792.     }
  2793. };

  2794. //=============================================================================
  2795. // Game_Party
  2796. //=============================================================================

  2797. Game_Party.prototype.performEscapeSuccess = function() {
  2798.     for (var i = 0; i < this.members().length; ++i) {
  2799.       var member = this.members()[i];
  2800.       if (member) member.performEscapeSuccess();
  2801.     }
  2802. };

  2803. //=============================================================================
  2804. // Scene_Battle
  2805. //=============================================================================

  2806. Yanfly.BEC.Scene_Battle_update = Scene_Battle.prototype.update;
  2807. Scene_Battle.prototype.update = function() {
  2808.     Yanfly.BEC.Scene_Battle_update.call(this);
  2809.     this.updateStatusWindowRequests();
  2810. };

  2811. Scene_Battle.prototype.updateStatusWindowRequests = function() {
  2812.     if (!this._statusWindow) return;
  2813.     if (this._statusWindow.isClosed()) return;
  2814.     this._statusWindow.updateStatusRequests();
  2815. };

  2816. Yanfly.BEC.Scene_Battle_createSkillWindow =
  2817.     Scene_Battle.prototype.createSkillWindow;
  2818. Scene_Battle.prototype.createSkillWindow = function() {
  2819.     Yanfly.BEC.Scene_Battle_createSkillWindow.call(this);
  2820.     if (eval(Yanfly.Param.BECLowerWindows)) {
  2821.                         this.adjustLowerWindow(this._skillWindow);
  2822.                 }
  2823. };

  2824. Yanfly.BEC.Scene_Battle_createItemWindow =
  2825.     Scene_Battle.prototype.createItemWindow;
  2826. Scene_Battle.prototype.createItemWindow = function() {
  2827.     Yanfly.BEC.Scene_Battle_createItemWindow.call(this);
  2828.     if (eval(Yanfly.Param.BECLowerWindows)) {
  2829.                         this.adjustLowerWindow(this._itemWindow);
  2830.                 }
  2831. };

  2832. Yanfly.BEC.Scene_Battle_createActorWindow =
  2833.                 Scene_Battle.prototype.createActorWindow;
  2834. Scene_Battle.prototype.createActorWindow = function() {
  2835.     Yanfly.BEC.Scene_Battle_createActorWindow.call(this);
  2836.     this._actorWindow.x = Graphics.boxWidth - this._actorWindow.width;
  2837.     if (eval(Yanfly.Param.BECSelectHelp)) {
  2838.       this._actorWindow.setHelpWindow(this._helpWindow);
  2839.     }
  2840. };

  2841. Yanfly.BEC.Scene_Battle_createEnemyWindow =
  2842.     Scene_Battle.prototype.createEnemyWindow;
  2843. Scene_Battle.prototype.createEnemyWindow = function() {
  2844.     Yanfly.BEC.Scene_Battle_createEnemyWindow.call(this);
  2845.     if (eval(Yanfly.Param.BECSelectHelp)) {
  2846.       this._enemyWindow.setHelpWindow(this._helpWindow);
  2847.     }
  2848. };

  2849. Scene_Battle.prototype.adjustLowerWindow = function(win) {
  2850.     win.height = win.fittingHeight(eval(Yanfly.Param.BECWindowRows));
  2851.     win.y = Graphics.boxHeight - win.height;
  2852. };

  2853. Yanfly.BEC.Scene_Battle_startPartyCommandSelection =
  2854.     Scene_Battle.prototype.startPartyCommandSelection;
  2855. Scene_Battle.prototype.startPartyCommandSelection = function() {
  2856.     if (this.isStartActorCommand()) {
  2857.       this.selectNextCommand();
  2858.     } else {
  2859.       Yanfly.BEC.Scene_Battle_startPartyCommandSelection.call(this);
  2860.     }
  2861. };

  2862. Scene_Battle.prototype.isStartActorCommand = function() {
  2863.     if (this._isStartActorCommand === undefined) {
  2864.       this._isStartActorCommand = eval(Yanfly.Param.BECStartActCmd)
  2865.     }
  2866.     return this._isStartActorCommand;
  2867. };

  2868. Yanfly.BEC.Scene_Battle_selectPreviousCommand =
  2869.     Scene_Battle.prototype.selectPreviousCommand;
  2870. Scene_Battle.prototype.selectPreviousCommand = function() {
  2871.     if (this.isStartActorCommand()) {
  2872.       BattleManager.selectPreviousCommand();
  2873.       if (BattleManager.isInputting() && BattleManager.actor()) {
  2874.         this.startActorCommandSelection();
  2875.       } else {
  2876.         Yanfly.BEC.Scene_Battle_startPartyCommandSelection.call(this);
  2877.       }
  2878.     } else {
  2879.       Yanfly.BEC.Scene_Battle_selectPreviousCommand.call(this);
  2880.     }
  2881. };

  2882. Yanfly.BEC.Scene_Battle_selectNextCommand =
  2883.     Scene_Battle.prototype.selectNextCommand;
  2884. Scene_Battle.prototype.selectNextCommand = function() {
  2885.     Yanfly.BEC.Scene_Battle_selectNextCommand.call(this);
  2886.     this._helpWindow.clear();
  2887.     BattleManager.stopAllSelection();
  2888. };

  2889. Yanfly.BEC.Scene_Battle_commandSkill = Scene_Battle.prototype.commandSkill;
  2890. Scene_Battle.prototype.commandSkill = function() {
  2891.     this._helpWindow.clear();
  2892.     Yanfly.BEC.Scene_Battle_commandSkill.call(this);
  2893. };

  2894. Yanfly.BEC.Scene_Battle_commandItem = Scene_Battle.prototype.commandItem;
  2895. Scene_Battle.prototype.commandItem = function() {
  2896.     this._helpWindow.clear();
  2897.     Yanfly.BEC.Scene_Battle_commandItem.call(this);
  2898. };

  2899. Yanfly.BEC.Scene_Battle_startActorCommandSelection =
  2900.                 Scene_Battle.prototype.startActorCommandSelection;
  2901. Scene_Battle.prototype.startActorCommandSelection = function() {
  2902.     Yanfly.BEC.Scene_Battle_startActorCommandSelection.call(this);
  2903.                 this._statusWindow.refresh();
  2904. };

  2905. Yanfly.BEC.Scene_Battle_selectActorSelection =
  2906.     Scene_Battle.prototype.selectActorSelection;
  2907. Scene_Battle.prototype.selectActorSelection = function() {
  2908.     if (eval(Yanfly.Param.BECSelectHelp)) this._helpWindow.show();
  2909.     this._helpWindow.clear();
  2910.     Yanfly.BEC.Scene_Battle_selectActorSelection.call(this);
  2911.     this._actorWindow.autoSelect();
  2912. };

  2913. Yanfly.BEC.Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel;
  2914. Scene_Battle.prototype.onActorCancel = function() {
  2915.     if (eval(Yanfly.Param.BECSelectHelp)) this._helpWindow.hide();
  2916.     this._helpWindow.clear();
  2917.     Yanfly.BEC.Scene_Battle_onActorCancel.call(this);
  2918.     BattleManager.stopAllSelection();
  2919. };

  2920. Yanfly.BEC.Scene_Battle_selectEnemySelection =
  2921.     Scene_Battle.prototype.selectEnemySelection;
  2922. Scene_Battle.prototype.selectEnemySelection = function() {
  2923.     if (eval(Yanfly.Param.BECSelectHelp)) this._helpWindow.show();
  2924.     this._helpWindow.clear();
  2925.     Yanfly.BEC.Scene_Battle_selectEnemySelection.call(this);
  2926.     this._enemyWindow.autoSelect();
  2927. };

  2928. Yanfly.BEC.Scene_Battle_onEnemyCancel = Scene_Battle.prototype.onEnemyCancel;
  2929. Scene_Battle.prototype.onEnemyCancel = function() {
  2930.     if (eval(Yanfly.Param.BECSelectHelp)) this._helpWindow.hide();
  2931.     this._helpWindow.clear();
  2932.     Yanfly.BEC.Scene_Battle_onEnemyCancel.call(this);
  2933.     BattleManager.stopAllSelection();
  2934. };

  2935. Yanfly.BEC.Scene_Battle_onSelectAction = Scene_Battle.prototype.onSelectAction;
  2936. Scene_Battle.prototype.onSelectAction = function() {
  2937.     if (eval(Yanfly.Param.BECSelectHelp)) BattleManager.forceSelection();
  2938.     this._helpWindow.clear();
  2939.     Yanfly.BEC.Scene_Battle_onSelectAction.call(this);
  2940.     if (eval(Yanfly.Param.BECSelectHelp)) BattleManager.resetSelection();
  2941. };

  2942. Yanfly.BEC.Scene_Battle_onSkillOk =
  2943.     Scene_Battle.prototype.onSkillOk;
  2944. Scene_Battle.prototype.onSkillOk = function() {
  2945.     this._helpWindow.clear();
  2946.     Yanfly.BEC.Scene_Battle_onSkillOk.call(this);
  2947. };

  2948. Yanfly.BEC.Scene_Battle_onSkillCancel =
  2949.     Scene_Battle.prototype.onSkillCancel;
  2950. Scene_Battle.prototype.onSkillCancel = function() {
  2951.     this._helpWindow.clear();
  2952.     Yanfly.BEC.Scene_Battle_onSkillCancel.call(this);
  2953. };

  2954. Yanfly.BEC.Scene_Battle_onItemOk =
  2955.     Scene_Battle.prototype.onItemOk;
  2956. Scene_Battle.prototype.onItemOk = function() {
  2957.     this._helpWindow.clear();
  2958.     Yanfly.BEC.Scene_Battle_onItemOk.call(this);
  2959. };

  2960. Yanfly.BEC.Scene_Battle_onItemCancel =
  2961.     Scene_Battle.prototype.onItemCancel;
  2962. Scene_Battle.prototype.onItemCancel = function() {
  2963.     this._helpWindow.clear();
  2964.     Yanfly.BEC.Scene_Battle_onItemCancel.call(this);
  2965. };

  2966. //=============================================================================
  2967. // Window_Help
  2968. //=============================================================================

  2969. Yanfly.BEC.Window_Help_clear = Window_Help.prototype.clear;
  2970. Window_Help.prototype.clear = function() {
  2971.     Yanfly.BEC.Window_Help_clear.call(this);
  2972.     this.contents.clear();
  2973. };

  2974. //=============================================================================
  2975. // Window_Selectable
  2976. //=============================================================================

  2977. Yanfly.BEC.Window_Selectable_isCursorMovable =
  2978.     Window_Selectable.prototype.isCursorMovable;
  2979. Window_Selectable.prototype.isCursorMovable = function() {
  2980.     if (this._inputLock) return false;
  2981.     return Yanfly.BEC.Window_Selectable_isCursorMovable.call(this);
  2982. };

  2983. //=============================================================================
  2984. // Window_Help
  2985. //=============================================================================

  2986. Window_Help.prototype.setBattler = function(battler) {
  2987.     this.contents.clear();
  2988.     this.clear();
  2989.     if (!$gameParty.inBattle()) return;
  2990.     if (!battler) return;
  2991.     var action = BattleManager.inputtingAction();
  2992.     if (this.specialSelectionText(action)) {
  2993.       this.drawSpecialSelectionText(action);
  2994.     } else {
  2995.       this.drawBattler(battler);
  2996.     }
  2997. };

  2998. Window_Help.prototype.specialSelectionText = function(action) {
  2999.     BattleManager.resetSelection();
  3000.     if (!action) return false;
  3001.     return !action.needsSelection();
  3002. };

  3003. Window_Help.prototype.drawBattler = function(battler) {
  3004.     var text = battler.name();
  3005.     var wx = 0;
  3006.     var wy = (this.contents.height - this.lineHeight()) / 2;
  3007.     this.drawText(text, wx, wy, this.contents.width, 'center');
  3008. };

  3009. Window_Help.prototype.drawSpecialSelectionText = function(action) {
  3010.     var wx = 0;
  3011.     var wy = (this.contents.height - this.lineHeight()) / 2;
  3012.     var text = '';
  3013.     if (action.isForUser()) {
  3014.       text = Yanfly.Param.BECHelpUserTx;
  3015.     } else if (action.isForRandom()) {
  3016.       BattleManager.startAllSelection();
  3017.       var fmt = Yanfly.Param.BECHelpRandTx;
  3018.       if (action.isForOpponent() && action.numTargets() !== 1) {
  3019.         var target = Yanfly.Param.BECHelpEnemiesTx;
  3020.       } else if (action.isForOpponent() && action.numTargets() === 1) {
  3021.         var target = Yanfly.Param.BECHelpEnemyTx;
  3022.       } else if (action.isForFriend() && action.numTargets() !== 1) {
  3023.         var target = Yanfly.Param.BECHelpAlliesTx;
  3024.       } else {
  3025.         var target = Yanfly.Param.BECHelpAllyTx;
  3026.       }
  3027.       text = fmt.format(target, Yanfly.Util.toGroup(action.numTargets()));
  3028.     } else if (action.isForAll()) {
  3029.       BattleManager.startAllSelection();
  3030.       var fmt = Yanfly.Param.BECHelpAllTx;
  3031.       if (action.isForOpponent()) {
  3032.         var target = Yanfly.Param.BECHelpEnemiesTx;
  3033.       } else {
  3034.         var target = Yanfly.Param.BECHelpAlliesTx;
  3035.       }
  3036.       text = fmt.format(target);
  3037.     }
  3038.     this.drawText(text, wx, wy, this.contents.width, 'center');
  3039. };

  3040. //=============================================================================
  3041. // Window_BattleActor
  3042. //=============================================================================

  3043. Window_BattleActor.prototype.autoSelect = function() {
  3044.     var action = BattleManager.inputtingAction();
  3045.     if (!action) return;
  3046.     this._inputLock = false;
  3047.     this._selectDead = false;
  3048.     if (action.isForUser()) {
  3049.       this.select(BattleManager.actor().index());
  3050.       this._inputLock = true;
  3051.     } else if (action.isForDeadFriend()) {
  3052.       this._selectDead = true;
  3053.     }
  3054. };

  3055. Window_BattleActor.prototype.isOkEnabled = function() {
  3056.     if (this._selectDead) return this.actor().isDead();
  3057.     return Window_Selectable.prototype.isOkEnabled.call(this);
  3058. };

  3059. Window_BattleActor.prototype.updateHelp = function() {
  3060.     if (!this._helpWindow) return;
  3061.     this._helpWindow.setBattler(this.actor());
  3062. };

  3063. Yanfly.BEC.Window_BattleActor_processTouch =
  3064.     Window_BattleActor.prototype.processTouch;
  3065. Window_BattleActor.prototype.processTouch = function() {
  3066.     if (eval(Yanfly.Param.BECActorSelect) && this.isOpenAndActive()) {
  3067.       if (TouchInput.isTriggered() && !this.isTouchedInsideFrame()) {
  3068.         if (this.getClickedActor() >= 0) {
  3069.           var index = this.getClickedActor();
  3070.           if (this.index() === index) {
  3071.             return this.processOk();
  3072.           } else {
  3073.             SoundManager.playCursor();
  3074.             return this.select(index);
  3075.           }
  3076.         }
  3077.       }
  3078.       if (TouchInput.isPressed() && !this.isTouchedInsideFrame()) {
  3079.         if (this.getClickedActor() >= 0) {
  3080.           var index = this.getClickedActor();
  3081.           if (this.index() !== index) {
  3082.             SoundManager.playCursor();
  3083.             return this.select(index);
  3084.           }
  3085.         }
  3086.       }
  3087.     }
  3088.     Yanfly.BEC.Window_BattleActor_processTouch.call(this);
  3089. };

  3090. Window_BattleActor.prototype.getClickedActor = function() {
  3091.     for (var i = 0; i < $gameParty.battleMembers().length; ++i) {
  3092.       var actor = $gameParty.battleMembers().reverse()[i];
  3093.       if (!actor) continue;
  3094.       if (this.isClickedActor(actor)) {
  3095.         if (this._selectDead && !actor.isDead()) continue;
  3096.         if (this._inputLock && actor.index() !== this.index()) continue;
  3097.         return actor.index();
  3098.       }
  3099.     }
  3100.     return -1;
  3101. };

  3102. Window_BattleActor.prototype.isClickedActor = function(actor) {
  3103.     if (!actor) return false;
  3104.     if (!actor.isSpriteVisible()) return false;
  3105.     var x = TouchInput.x;
  3106.     var y = TouchInput.y;
  3107.     var rect = new Rectangle();
  3108.     rect.width = actor.spriteWidth();
  3109.     rect.height = actor.spriteHeight();
  3110.     rect.x = actor.spritePosX() - rect.width / 2;
  3111.     rect.y = actor.spritePosY() - rect.height;
  3112.     return (x >= rect.x && y >= rect.y && x < rect.x + rect.width &&
  3113.       rect.y + rect.height);
  3114. };

  3115. //=============================================================================
  3116. // Window_BattleEnemy
  3117. //=============================================================================

  3118. Yanfly.DisableWebGLMask = false;

  3119. Yanfly.BEC.Window_BattleEnemy_initialize =
  3120.     Window_BattleEnemy.prototype.initialize;
  3121. Window_BattleEnemy.prototype.initialize = function(x, y) {
  3122.     if (eval(Yanfly.Param.BECEnemySelect)) {
  3123.       x = y = -500;
  3124.       this._ignoreMask = true;
  3125.     };
  3126.     Yanfly.BEC.Window_BattleEnemy_initialize.call(this, x, y);
  3127.     if (eval(Yanfly.Param.BECEnemySelect)) this.opacity = 0;
  3128. };

  3129. Yanfly.BEC.Window_BattleEnemy_windowWidth =
  3130.     Window_BattleEnemy.prototype.windowWidth;
  3131. Window_BattleEnemy.prototype.windowWidth = function() {
  3132.     if (eval(Yanfly.Param.BECEnemySelect)) return Graphics.boxWidth + 500;
  3133.     return Yanfly.BEC.Window_BattleEnemy_windowWidth.call(this);
  3134. };

  3135. Yanfly.BEC.Window_BattleEnemy_windowHeight =
  3136.     Window_BattleEnemy.prototype.windowHeight;
  3137. Window_BattleEnemy.prototype.windowHeight = function() {
  3138.   if (eval(Yanfly.Param.BECEnemySelect)) return Graphics.boxHeight + 500;
  3139.   return Yanfly.BEC.Window_BattleEnemy_windowHeight.call(this);
  3140. };

  3141. Yanfly.BEC.WindowLayer_webglMaskWindow =
  3142.                 WindowLayer.prototype._webglMaskWindow;
  3143. WindowLayer.prototype._webglMaskWindow = function(renderSession, win) {
  3144.     if (win._ignoreMask) return;
  3145.     Yanfly.BEC.WindowLayer_webglMaskWindow.call(this, renderSession, win);
  3146. };

  3147. Yanfly.BEC.Window_BattleEnemy_maxCols =
  3148.     Window_BattleEnemy.prototype.maxCols;
  3149. Window_BattleEnemy.prototype.maxCols = function() {
  3150.     if (eval(Yanfly.Param.BECEnemySelect)) return this.allowedTargets().length;
  3151.     return Yanfly.BEC.Window_BattleEnemy_maxCols.call(this);
  3152. };

  3153. Window_BattleEnemy.prototype.allowedTargets = function() {
  3154.     var targets = [];
  3155.     targets = targets.concat($gameTroop.aliveMembers());
  3156.     return targets;
  3157. };

  3158. Window_BattleEnemy.prototype.refresh = function() {
  3159.     this._enemies = $gameTroop.aliveMembers();
  3160.     this.sortTargets();
  3161.     Window_Selectable.prototype.refresh.call(this);
  3162. };

  3163. Window_BattleEnemy.prototype.sortTargets = function() {
  3164.                 this._enemies.sort(function(a, b) {
  3165.                                 if (a.spritePosX() == b.spritePosX()) {
  3166.                                         return a.spritePosY() - b.spritePosY();
  3167.                                 }
  3168.                                 return a.spritePosX() - b.spritePosX();
  3169.                 });
  3170. };

  3171. Window_BattleEnemy.prototype.drawItem = function(index) {
  3172.     this.resetTextColor();
  3173.     var name = this._enemies[index].name();
  3174.     if (eval(Yanfly.Param.BECEnemySelect)) {
  3175.       var rect = this.nameRect(index);
  3176.       var align = 'center';
  3177.     } else {
  3178.       var rect = this.itemRectForText(index);
  3179.       var align = 'left';
  3180.     }
  3181.     this.contents.fontSize = Yanfly.Param.BECEnemyFontSize;
  3182.     this.drawText(name, rect.x, rect.y, rect.width, align);
  3183.                 this.resetFontSettings();
  3184. };

  3185. Window_BattleEnemy.prototype.itemRect = function(index) {
  3186.     if (eval(Yanfly.Param.BECEnemySelect)) {
  3187.       var rect = new Rectangle();
  3188.                   var enemy = this._enemies[index];
  3189.                   var maxCols = this.maxCols();
  3190.       rect.width = enemy.spriteWidth();
  3191.       rect.height = enemy.spriteHeight();
  3192.                   var pad = this.standardPadding();
  3193.       rect.x = enemy.spritePosX() - rect.width / 2 - pad + 500;
  3194.       rect.y = enemy.spritePosY() - rect.height - pad + 500;
  3195.                   return rect;
  3196.     }
  3197.     return Window_Selectable.prototype.itemRect.call(this, index);
  3198. };

  3199. Window_BattleEnemy.prototype.nameRect = function(index) {
  3200.                 var rect = new Rectangle();
  3201.     if (!eval(Yanfly.Param.BECShowEnemyName)) return rect;
  3202.                 var enemy = this._enemies[index];
  3203.                 var maxCols = this.maxCols();
  3204.     this.contents.fontSize = Yanfly.Param.BECEnemyFontSize;
  3205.     var textSize = this.textWidth(' ' + enemy.name() + ' ');
  3206.                 rect.width = Math.max(enemy.spriteWidth(), textSize);
  3207.                 rect.height = this.lineHeight();
  3208.                 var pad = this.standardPadding();
  3209.                 rect.x = enemy.spritePosX() - rect.width / 2 - pad + 500;
  3210.                 rect.y = enemy.spritePosY() - enemy.spriteHeight() - pad + 500;
  3211.                 rect.y += enemy.spriteHeight() - this.lineHeight() -
  3212.                         this.standardPadding();
  3213.                 return rect;
  3214. };

  3215. Window_BattleEnemy.prototype.updateCursor = function() {
  3216.     if (eval(Yanfly.Param.BECEnemySelect)) {
  3217.       if (this._cursorAll) {
  3218.                             var allRowsHeight = this.maxRows() * this.itemHeight();
  3219.                             this.setCursorRect(0, 0, this.contents.width, allRowsHeight);
  3220.                             this.setTopRow(0);
  3221.             } else if (this.index() < 0) {
  3222.                             this.setCursorRect(0, 0, 0, 0);
  3223.             } else {
  3224.                             this.ensureCursorVisible();
  3225.                             var rect = this.nameRect(this.index());
  3226.                             this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
  3227.             }
  3228.     } else {
  3229.       Window_Selectable.prototype.updateCursor.call(this);
  3230.     }
  3231. };

  3232. Window_BattleEnemy.prototype.autoSelect = function() {
  3233.     var selectIndex = eval(Yanfly.Param.BECEnemyAutoSel);
  3234.     this.select(selectIndex);
  3235. };

  3236. Window_BattleEnemy.prototype.furthestRight = function() {
  3237.                 return this.maxItems() - 1;
  3238. };

  3239. Window_BattleEnemy.prototype.updateHelp = function() {
  3240.     if (!this._helpWindow) return;
  3241.     this._helpWindow.setBattler(this.enemy());
  3242. };

  3243. //=============================================================================
  3244. // Window_PartyCommand
  3245. //=============================================================================

  3246. Window_PartyCommand.prototype.itemTextAlign = function() {
  3247.     return Yanfly.Param.BECCommandAlign;
  3248. };

  3249. Window_PartyCommand.prototype.numVisibleRows = function() {
  3250.     return eval(Yanfly.Param.BECCommandRows);
  3251. };

  3252. //=============================================================================
  3253. // Window_ActorCommand
  3254. //=============================================================================

  3255. Window_ActorCommand.prototype.itemTextAlign = function() {
  3256.     return Yanfly.Param.BECCommandAlign;
  3257. };

  3258. Window_ActorCommand.prototype.numVisibleRows = function() {
  3259.     return eval(Yanfly.Param.BECCommandRows);
  3260. };

  3261. //=============================================================================
  3262. // Window_BattleStatus
  3263. //=============================================================================

  3264. Window_BattleStatus.prototype.numVisibleRows = function() {
  3265.     return eval(Yanfly.Param.BECCommandRows);
  3266. };

  3267. Window_BattleStatus.prototype.updateStatusRequests = function() {
  3268.     for (var i = 0; i < $gameParty.battleMembers().length; ++i) {
  3269.       var actor = $gameParty.battleMembers()[i];
  3270.       if (!actor) continue;
  3271.       if (actor.isStatusRefreshRequested()) this.processStatusRefresh(i);
  3272.     }
  3273. };

  3274. Window_BattleStatus.prototype.processStatusRefresh = function(index) {
  3275.     var actor = $gameParty.battleMembers()[index];
  3276.     if (!actor) return;
  3277.     var rect = this.itemRect(index);
  3278.     this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
  3279.     this.drawItem(index);
  3280.     actor.completetStatusRefreshRequest();
  3281. };

  3282. //=============================================================================
  3283. // Window_BattleLog
  3284. //=============================================================================

  3285. Yanfly.BEC.Window_BattleLog_isFastForward =
  3286.                 Window_BattleLog.prototype.isFastForward;
  3287. Window_BattleLog.prototype.isFastForward = function() {
  3288.     if (eval(Yanfly.Param.BECOptSpeed)) return true;
  3289.                 return Yanfly.BEC.Window_BattleLog_isFastForward.call(this);
  3290. };

  3291. Window_BattleLog.prototype.updateWaitCount = function() {
  3292.     if (this._waitCount > 0) {
  3293.         this._waitCount -= 1;
  3294.         if (this._waitCount < 0) {
  3295.             this._waitCount = 0;
  3296.         }
  3297.         return true;
  3298.     }
  3299.     return false;
  3300. };

  3301. Window_BattleLog.prototype.animationBaseDelay = function() {
  3302.     return eval(Yanfly.Param.BECAniBaseDel);
  3303. };

  3304. Window_BattleLog.prototype.animationNextDelay = function() {
  3305.     return eval(Yanfly.Param.BECAniNextDel);
  3306. };

  3307. Window_BattleLog.prototype.updateWaitMode = function() {
  3308.     var waiting = false;
  3309.     switch (this._waitMode) {
  3310.     case 'effect':
  3311.         waiting = this._spriteset.isEffecting();
  3312.         break;
  3313.     case 'movement':
  3314.         waiting = this._spriteset.isAnyoneMoving();
  3315.         break;
  3316.     case 'animation':
  3317.         waiting = this._spriteset.isAnimationPlaying();
  3318.         break;
  3319.     case 'popups':
  3320.         waiting = this._spriteset.isPopupPlaying();
  3321.         break;
  3322.     }
  3323.     if (!waiting) {
  3324.         this._waitMode = '';
  3325.     }
  3326.     return waiting;
  3327. };

  3328. Window_BattleLog.prototype.startAction = function(subject, action, targets) {
  3329. };

  3330. Window_BattleLog.prototype.endAction = function(subject) {
  3331. };

  3332. Window_BattleLog.prototype.waitForAnimation = function() {
  3333.     this.setWaitMode('animation');
  3334. };

  3335. Window_BattleLog.prototype.waitForEffect = function() {
  3336.     this.setWaitMode('effect');
  3337. };

  3338. Window_BattleLog.prototype.waitForPopups = function() {
  3339.     this.setWaitMode('popups');
  3340. };

  3341. Yanfly.BEC.Window_BattleLog_displayAction =
  3342.     Window_BattleLog.prototype.displayAction;
  3343. Window_BattleLog.prototype.displayAction = function(subject, item) {
  3344.     if (eval(Yanfly.Param.BECFullActText)) {
  3345.       Yanfly.BEC.Window_BattleLog_displayAction.call(this, subject, item);
  3346.     } else {
  3347.       this._actionIcon = item.iconIndex;
  3348.       this.push('addText', '<SIMPLE>' + item.name);
  3349.       if (item.message2) {
  3350.         this.push('addText', '<CENTER>' + item.message2.format(item.name));
  3351.       }
  3352.     }
  3353. };

  3354. Yanfly.BEC.Window_BattleLog_displayActionResults =
  3355.                 Window_BattleLog.prototype.displayActionResults;
  3356. Window_BattleLog.prototype.displayActionResults = function(subject, target) {
  3357.     if (eval(Yanfly.Param.BECOptSpeed)) {
  3358.                         if (target.result().used) {
  3359.                 this.displayCritical(target);
  3360.                                         this.displayDamage(target);
  3361.                                         this.displayAffectedStatus(target);
  3362.                                         this.displayFailure(target);
  3363.             }
  3364.                 } else {
  3365.                         Yanfly.BEC.Window_BattleLog_displayActionResults.call(this, subject,
  3366.                                         target);
  3367.                 }
  3368.     if (target.isDead()) target.performCollapse();
  3369. };

  3370. Yanfly.BEC.Window_BattleLog_drawLineText =
  3371.     Window_BattleLog.prototype.drawLineText;
  3372. Window_BattleLog.prototype.drawLineText = function(index) {
  3373.     if (this._lines[index].match('<CENTER>')) {
  3374.       this.drawCenterLine(index);
  3375.     } else if (this._lines[index].match('<SIMPLE>')) {
  3376.       this.drawSimpleActionLine(index);
  3377.     } else {
  3378.       Yanfly.BEC.Window_BattleLog_drawLineText.call(this, index);
  3379.     }
  3380. };

  3381. Window_BattleLog.prototype.drawCenterLine = function(index) {
  3382.     var text = this._lines[index].replace('<CENTER>', '');
  3383.     var rect = this.itemRectForText(index);
  3384.     this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
  3385.     this.drawText(text, rect.x, rect.y, Graphics.boxWidth, 'center');
  3386. };

  3387. Window_BattleLog.prototype.drawSimpleActionLine = function(index) {
  3388.     var text = this._lines[index].replace('<SIMPLE>', '');
  3389.     var rect = this.itemRectForText(index);
  3390.     this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
  3391.     if (this._actionIcon) {
  3392.       var tw = this.textWidth(text);
  3393.       var ix = (rect.width - tw) / 2 - 4;
  3394.       this.drawIcon(this._actionIcon, ix, rect.y + 2);
  3395.     }
  3396.     this.drawText(text, rect.x, rect.y, Graphics.boxWidth, 'center');
  3397. };

  3398. Window_BattleLog.prototype.displayCounter = function(target) {
  3399.     if (eval(Yanfly.Param.BECShowCntText)) {
  3400.                         this.addText(TextManager.counterAttack.format(target.name()));
  3401.                 }
  3402.                 target.performCounter();
  3403.                 this.showAttackAnimation(target, [BattleManager._subject]);
  3404.                 this.waitForAnimation();
  3405. };

  3406. Window_BattleLog.prototype.displayReflection = function(target) {
  3407.     if (eval(Yanfly.Param.BECShowRflText)) {
  3408.                         this.addText(TextManager.magicReflection.format(target.name()));
  3409.                 }
  3410.                 target.performReflection();
  3411.                 var animationId = BattleManager._action.item().animationId;
  3412.                 this.showNormalAnimation([BattleManager._subject], animationId);
  3413.                 this.waitForAnimation();
  3414. };

  3415. Window_BattleLog.prototype.displaySubstitute = function(substitute, target) {
  3416.     if (eval(Yanfly.Param.BECShowSubText)) {
  3417.                         var substName = substitute.name();
  3418.                         this.addText(TextManager.substitute.format(substName, target.name()));
  3419.                 }
  3420.                 substitute.performSubstitute(target);
  3421. };

  3422. Yanfly.BEC.Window_BattleLog_displayFailure =
  3423.     Window_BattleLog.prototype.displayFailure;
  3424. Window_BattleLog.prototype.displayFailure = function(target) {
  3425.     if (!eval(Yanfly.Param.BECShowFailText)) return;
  3426.     Yanfly.BEC.Window_BattleLog_displayFailure.call(this, target);
  3427. };

  3428. Yanfly.BEC.Window_BattleLog_displayCritical =
  3429.     Window_BattleLog.prototype.displayCritical;
  3430. Window_BattleLog.prototype.displayCritical = function(target) {
  3431.     if (!eval(Yanfly.Param.BECShowCritText)) return;
  3432.     Yanfly.BEC.Window_BattleLog_displayCritical.call(this, target);
  3433. };

  3434. Yanfly.BEC.Window_BattleLog_displayMiss =
  3435.     Window_BattleLog.prototype.displayMiss;
  3436. Window_BattleLog.prototype.displayMiss = function(target) {
  3437.     if (!eval(Yanfly.Param.BECShowMissText)) return;
  3438.     Yanfly.BEC.Window_BattleLog_displayMiss.call(this, target);
  3439. };

  3440. Yanfly.BEC.Window_BattleLog_displayEvasion =
  3441.     Window_BattleLog.prototype.displayEvasion;
  3442. Window_BattleLog.prototype.displayEvasion = function(target) {
  3443.     if (!eval(Yanfly.Param.BECShowEvaText)) return;
  3444.     Yanfly.BEC.Window_BattleLog_displayEvasion.call(this, target);
  3445. };

  3446. Yanfly.BEC.Window_BattleLog_displayHpDamage =
  3447.     Window_BattleLog.prototype.displayHpDamage;
  3448. Window_BattleLog.prototype.displayHpDamage = function(target) {
  3449.     if (!eval(Yanfly.Param.BECShowHpText)) return;
  3450.     Yanfly.BEC.Window_BattleLog_displayHpDamage.call(this, target);
  3451. };

  3452. Yanfly.BEC.Window_BattleLog_displayMpDamage =
  3453.     Window_BattleLog.prototype.displayMpDamage;
  3454. Window_BattleLog.prototype.displayMpDamage = function(target) {
  3455.     if (!eval(Yanfly.Param.BECShowMpText)) return;
  3456.     Yanfly.BEC.Window_BattleLog_displayMpDamage.call(this, target);
  3457. };

  3458. Yanfly.BEC.Window_BattleLog_displayTpDamage =
  3459.     Window_BattleLog.prototype.displayTpDamage;
  3460. Window_BattleLog.prototype.displayTpDamage = function(target) {
  3461.     if (!eval(Yanfly.Param.BECShowTpText)) return;
  3462.     Yanfly.BEC.Window_BattleLog_displayTpDamage.call(this, target);
  3463. };

  3464. Yanfly.BEC.Window_BattleLog_displayCurrentState =
  3465.     Window_BattleLog.prototype.displayCurrentState;
  3466. Window_BattleLog.prototype.displayCurrentState = function(subject) {
  3467.     if (!eval(Yanfly.Param.BECShowStateText)) return;
  3468.     Yanfly.BEC.Window_BattleLog_displayCurrentState.call(this, subject);
  3469. };

  3470. Yanfly.BEC.Window_BattleLog_displayAddedStates =
  3471.     Window_BattleLog.prototype.displayAddedStates;
  3472. Window_BattleLog.prototype.displayAddedStates = function(target) {
  3473.     if (!eval(Yanfly.Param.BECShowStateText)) return;
  3474.     Yanfly.BEC.Window_BattleLog_displayAddedStates.call(this, target);
  3475. };

  3476. Yanfly.BEC.Window_BattleLog_displayRemovedStates =
  3477.     Window_BattleLog.prototype.displayRemovedStates;
  3478. Window_BattleLog.prototype.displayRemovedStates = function(target) {
  3479.     if (!eval(Yanfly.Param.BECShowStateText)) return;
  3480.     Yanfly.BEC.Window_BattleLog_displayRemovedStates.call(this, target);
  3481. };

  3482. Yanfly.BEC.Window_BattleLog_displayChangedBuffs =
  3483.     Window_BattleLog.prototype.displayChangedBuffs;
  3484. Window_BattleLog.prototype.displayChangedBuffs = function(target) {
  3485.     if (!eval(Yanfly.Param.BECShowBuffText)) return;
  3486.     Yanfly.BEC.Window_BattleLog_displayChangedBuffs.call(this, target);
  3487. };

  3488. Window_BattleLog.prototype.popupDamage = function(target) {
  3489. };

  3490. Yanfly.BEC.Window_BattleLog_showEnemyAttackAnimation =
  3491.                 Window_BattleLog.prototype.showEnemyAttackAnimation;
  3492. Window_BattleLog.prototype.showEnemyAttackAnimation =
  3493. function(subject, targets) {
  3494.                 if ($gameSystem.isSideView()) {
  3495.                         this.showNormalAnimation(targets, subject.attackAnimationId(), false);
  3496.                 } else {
  3497.       this.showNormalAnimation(targets, subject.attackAnimationId(), false);
  3498.                         Yanfly.BEC.Window_BattleLog_showEnemyAttackAnimation.call(this, subject,
  3499.                                         targets);
  3500.                 }
  3501. };

  3502. Window_BattleLog.prototype.showActorAtkAniMirror = function(subject, targets) {
  3503.     this.showNormalAnimation(targets, subject.attackAnimationId1(), true);
  3504.     this.showNormalAnimation(targets, subject.attackAnimationId2(), false);
  3505. };

  3506. //=============================================================================
  3507. // New Function
  3508. //=============================================================================

  3509. Yanfly.Util = Yanfly.Util || {};

  3510. if (!Yanfly.Util.toGroup) {
  3511.                 Yanfly.Util.toGroup = function(inVal) {
  3512.                                 return inVal;
  3513.                 }
  3514. };

  3515. Yanfly.Util.getRange = function(n, m) {
  3516.     var result = [];
  3517.     for (var i = n; i <= m; ++i) result.push(i);
  3518.     return result;
  3519. };

  3520. Yanfly.Util.onlyUnique = function(value, index, self) {
  3521.     return self.indexOf(value) === index;
  3522. };

  3523. //=============================================================================
  3524. // End of File
  3525. //=============================================================================
复制代码
回复

使用道具 举报

世界坑化协会

梦石
0
星屑
9600
在线时间
1594 小时
注册时间
2007-3-13
回帖
5265

极短26参与极短25参与极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

发表于 2015-11-9 12:52:53 | 显示全部楼层
我用了LZ脚本产生了一个JS错误, undefined is not a function
忍卷NINMAKI游戏DEMO上线了~♪  点我下载  ☚
回复

使用道具 举报

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
 楼主| 发表于 2015-11-9 17:55:02 | 显示全部楼层
v2sam 发表于 2015-11-9 12:52
我用了LZ脚本产生了一个JS错误, undefined is not a function

我用的11月6号的包,帮忙看看哪里冲突了,谢谢

Yanfly Engine Plugins (English) 2015年11月06日.zip

177.97 KB, 下载次数: 79

点评

与程序猿无关  发表于 2015-11-9 23:16
我不是程序猿……  发表于 2015-11-9 18:05
回复

使用道具 举报

梦石
0
星屑
90
在线时间
387 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-11-9 20:53:59 | 显示全部楼层

点评

翻不了墙,能上传一个atb么,谢谢老大  发表于 2015-11-9 23:15
吸吸
回复

使用道具 举报

梦石
0
星屑
90
在线时间
387 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-11-9 23:23:26 | 显示全部楼层
所有的yep包

- YEP English -(5).rar

179.21 KB, 下载次数: 109

点评

用这个包还是有bug,咋回事?敌人用动态不显示受伤害的数值,用静态敌人攻击时直接undefined is not a function。我是按上面范例做的  发表于 2015-11-11 18:12
谢谢~  发表于 2015-11-10 05:55

评分

参与人数 2星屑 +30 梦石 +1 收起 理由
余烬之中 + 1 楼主真难伺候..
longshili + 30 塞糖

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
 楼主| 发表于 2015-11-11 15:45:12 | 显示全部楼层
trentswd 发表于 2015-11-9 23:23
所有的yep包

用这个包,发现个bug,就是敌方受到伤害不显示数值了,为啥?
回复

使用道具 举报

梦石
0
星屑
50
在线时间
171 小时
注册时间
2013-8-6
回帖
91
 楼主| 发表于 2015-11-11 18:57:33 | 显示全部楼层
trentswd 发表于 2015-11-9 23:23
所有的yep包

自己搞定了,去范例网站下了最新版覆盖就好了,修复了先前的bug
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部