查看: 3962|回复: 6

[已经解决] 請問有沒有辦法移動戰鬥中人物的位子

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

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

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

×
就是衡版戰鬥開始時,腳色預先站的地方
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-2-16 10:19:53 | 显示全部楼层
本帖最后由 tseyik 于 2016-2-16 10:24 编辑

事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license
http://woodpenguin.web.fc2.com/MV_Plugin/CommonBattle.html
20151120000340.jpg
Image002.png
Image003.png
Image004.png
範本 74M

MPP_CommonBattle.js
  1. //=============================================================================
  2. // MPP_CommonBattle.js
  3. //=============================================================================
  4. // Copyright (c) 2015 Mokusei Penguin
  5. // Released under the MIT license
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. //=============================================================================

  8. /*:
  9. * @plugindesc 【MPP ver.1.0】戦闘アクションの処理をコモンイベントによる処理に変更します。
  10. * @author 木星ペンギン
  11. *
  12. * @help ※アクティブタイムバトル(MPP_ActiveTimeBattle.js)と併用する場合、
  13. *  こちらのプラグインが下になるように導入してください。
  14. *
  15. * ●戦闘行動の実行時に呼び出されるコモンイベント名
  16. * 指定した名前のコモンイベントが呼び出されます。
  17. *
  18. * 使用するスキル・アイテムのメモ欄に
  19. *   <cbCommonId:n>
  20. * と記述した場合、n番のコモンイベントが優先して呼び出されます。
  21. *
  22. * ●待機時の移動処理を行うコモンイベント名
  23. * 指定した名前のコモンイベントが呼び出されます。
  24. * 各キャラクターが自身を使用者として実行します。
  25. *
  26. * 使用者のメモ欄に
  27. *   <cbRefreshId:n>
  28. * と記述した場合、n番のコモンイベントが優先して呼び出されます。
  29. *
  30. *
  31. * ●戦闘開始時の移動処理を行うコモンイベント名
  32. * 指定した名前のコモンイベントが呼び出されます。
  33. *
  34. * 使用者のメモ欄に
  35. *   <cbEntryId:n>
  36. * と記述した場合、n番のコモンイベントが優先して呼び出されます。
  37. *
  38. *
  39. * ●勝利時、逃走時、敗北時のコモンイベント
  40. * 条件を満たした際に実行されます。
  41. * 使用者はいません。対象は味方全体となります。
  42. *
  43. *
  44. * ●イベント用のアクター
  45. * 指定したIDのアクターはイベント用として戦闘マップに配置されます。
  46. * ここで指定したアクターをパーティメンバーに入れないでください。
  47. *
  48. *
  49. * ●アクティブタイムバトルと併用する際の注意点
  50. *  1.イベント実行中も時間が止まることはありません。
  51. *    プラグインコマンド
  52. *      AtWait (true/false)
  53. *    を実行することで時間を止めるかどうかを設定できます。
  54. *  
  55. *  2.[逃走状態で逃走モーションを行うかどうか]や
  56. *    [コマンド入力中に前進するかどうか]といった
  57. *    キャラクターの行動を扱う設定は無効となります。
  58. *    コモンイベントの内容を修正してください。
  59. *
  60. *
  61. * その他、細かな仕様は下記のURLを参照してください。
  62. * [url]http://woodpenguin.web.fc2.com/MV_Plugin/CommonBattle.html[/url]
  63. *
  64. * ================================
  65. * 制作 : 木星ペンギン
  66. * URL : [url]http://woodpenguin.blog.fc2.com/[/url]
  67. *
  68. * @param Execute Action
  69. * @desc 戦闘行動の実行時に呼び出されるコモンイベント名
  70. * @default ●戦闘行動の実行
  71. *
  72. * @param Actor Refresh
  73. * @desc アクターの待機時の移動処理を行うコモンイベント名
  74. * @default ●アクター待機
  75. *
  76. * @param Enemy Refresh
  77. * @desc エネミーの待機時の移動処理を行うコモンイベント名
  78. * @default ●エネミー待機
  79. *
  80. * @param Battle Start
  81. * @desc 戦闘開始時の処理を行うコモンイベント名
  82. * @default ●戦闘開始
  83. *
  84. * @param Process Victory
  85. * @desc 戦闘勝利時に呼び出されるコモンイベント名
  86. * @default ●勝利の処理
  87. *
  88. * @param Process Escape
  89. * @desc 逃走時に呼び出されるコモンイベント名
  90. * @default ●逃走の処理
  91. *
  92. * @param Process Defeat
  93. * @desc 逃走時に呼び出されるコモンイベント名
  94. * @default ●敗北の処理
  95. *
  96. * @param Event Actors
  97. * @desc イベント用のアクターID
  98. * (カンマで区切ってください)
  99. *
  100. * @param Upper Message Row
  101. * @desc 戦闘中にメッセージウィンドウを上に表示させたときの行数
  102. * @default 1
  103. *
  104. * @param Pace X
  105. * @desc X軸の1歩の移動距離
  106. * @default 48
  107. *
  108. * @param Pace Y
  109. * @desc Y軸の1歩の移動距離
  110. * @default 16
  111. *
  112. * @param === Pop Icon ===
  113. *
  114. * @param Icon Set Name
  115. * @desc アイコン画像のファイル名
  116. * @default IconSet
  117. *
  118. * @param Icon Width
  119. * @desc アイコンの幅
  120. * @default 32
  121. *
  122. * @param Icon Height
  123. * @desc アイコンの高さ
  124. * @default 32
  125. *
  126. */

  127. function Game_ComBatInterpreter() {
  128.     this.initialize.apply(this, arguments);
  129. }

  130. (function() {

  131. var parameters = PluginManager.parameters('MPP_CommonBattle');
  132. var MPPlugin = {
  133.     atb_plugin:$plugins.some(function(plugin) {
  134.         return (plugin.name === 'MPP_ActiveTimeBattle' && plugin.status);
  135.     }),

  136.     executeAction:(parameters['Execute Action'] || '●戦闘行動の実行'),
  137.     actorRefresh:(parameters['Actor Refresh'] || '●アクター待機'),
  138.     enemyRefresh:(parameters['Enemy Refresh'] || '●エネミー待機'),

  139.     battleStart:(parameters['Battle Start'] || '●戦闘開始'),
  140.     processVictory:(parameters['Process Victory'] || '●勝利の処理'),
  141.     processEscape:(parameters['Process Escape'] || '●逃走の処理'),
  142.     processDefeat:(parameters['Process Defeat'] || '●敗北の処理'),

  143.     eventActors:(parameters['Event Actors'] || '').split(",").map(Number),
  144.    
  145.     upperMessageRow:Number(parameters['Upper Message Row'] || 1),
  146.    
  147.     paceX:Number(parameters['Pace X'] || 48),
  148.     paceY:Number(parameters['Pace Y'] || 16),
  149.    
  150.     // Pop Icon
  151.     iconSetName:parameters['Icon Set Name'] || '',
  152.     iconWidth:Number(parameters['Icon Width'] || 32),
  153.     iconHeight:Number(parameters['Icon Height'] || 32)
  154.    
  155. };

  156. var Alias = {};

  157. //-----------------------------------------------------------------------------
  158. // ComBat

  159. function ComBat() {
  160.     throw new Error('This is a static class');
  161. }

  162. ComBat._characters = [];

  163. ComBat.getCommonEvent = function(commonName, commonId) {
  164.     var result;
  165.     if (commonId) {
  166.         result = $dataCommonEvents[commonId];
  167.         if (!result) {
  168.             alert("コモンイベントID\n  " + commonId + "\nが見つかりませんでした。");
  169.         }
  170.     } else {
  171.         result = this.getCommonByName(commonName);
  172.     }
  173.     return result;
  174. };

  175. ComBat.getCommonByName = function(name) {
  176.     for (var i = $dataCommonEvents.length - 1; i > 0; i--) {
  177.         var event = $dataCommonEvents[i];
  178.         if (event.name === name) {
  179.             return event;
  180.         }
  181.     }
  182.     alert("コモンイベント名\n  " + name + "\nが見つかりませんでした。");
  183.     return null;
  184. };

  185. ComBat.setCharacter = function(index, character) {
  186.     this._characters[index] = character;
  187. };

  188. ComBat.getCharacter = function(index) {
  189.     return this._characters[index];
  190. };

  191. ComBat.clearCharacter = function() {
  192.     this._characters = [];
  193. };

  194. ComBat.isCharacter = function(character) {
  195.     return this._characters.contains(character);
  196. };

  197. //-----------------------------------------------------------------------------
  198. // BattleManager

  199. //10
  200. Alias.BaMa_setup = BattleManager.setup;
  201. BattleManager.setup = function(troopId, canEscape, canLose) {
  202.     Alias.BaMa_setup.call(this, troopId, canEscape, canLose);
  203.     ComBat.clearCharacter();
  204.     this._userWait = false;
  205. };

  206. BattleManager.setUserWait = function(wait) {
  207.     if (this._userWait !== wait) {
  208.         this._userWait = wait;
  209.         this.clearActor();
  210.     }
  211. };

  212. BattleManager.isEvantWait = function() {
  213.     if (MPPlugin.atb_plugin) {
  214.         return this._userWait;
  215.     } else {
  216.         return $gameMessage.isBusy();
  217.     }
  218. };

  219. //150
  220. BattleManager.updateEventMain = function() {
  221.     //$gameTroop.updateInterpreter();
  222.     $gameParty.requestMotionRefresh();
  223.     if ($gameTroop.isEventRunning() || this.checkBattleEnd()) {
  224.         return true;
  225.     }
  226.     $gameTroop.setupBattleEvent();
  227.     if ($gameTroop.isEventRunning() || SceneManager.isSceneChanging()) {
  228.         return true;
  229.     }
  230.     return false;
  231. };

  232. //220
  233. BattleManager.startBattle = function() {
  234.     this._phase = 'start';
  235.     $gameSystem.onBattleStart();
  236.     $gameParty.onBattleStart();
  237.     $gameTroop.onBattleStart();
  238.     //this.displayStartMessages();
  239.     $gameTroop.setupBattleEvent();
  240.     if (!$gameTroop.isEventRunning()) {
  241.         var event = ComBat.getCommonByName(MPPlugin.battleStart);
  242.         if (event) {
  243.             var selfVar = {};
  244.             $gameTroop.setupInterpreter(event.list, selfVar);
  245.         }
  246.     }
  247.     if (MPPlugin.atb_plugin) {
  248.         this.setupAllBattlerAt();
  249.         this.startTurn();
  250.     }
  251. };

  252. //369
  253. BattleManager.startAction = function() {
  254.     var subject = this._subject;
  255.     var action = subject.currentAction();
  256.     var targets = action.makeTargets();
  257.     this._phase = 'action';
  258.     this._action = action;
  259.     this._targets = targets;
  260.     this._action.applyGlobal();

  261.     var item = this._action.item();
  262.     var commonId = item ? Number(item.meta.cbCommonId) : undefined;
  263.     var event = ComBat.getCommonEvent(MPPlugin.executeAction, commonId);
  264.     if (event) {
  265.         var selfVar = {
  266.             user:      subject,
  267.             allTargets:targets,
  268.             target:    targets[0],
  269.             item:      item,
  270.             action:    action
  271.         };
  272.         $gameTroop.setupInterpreter(event.list, selfVar);
  273.     }
  274. };

  275. //382
  276. BattleManager.updateAction = function() {
  277.     if (!$gameTroop.isEventRunning()) {
  278.         this.endAction();
  279.     }
  280. };

  281. BattleManager.callLogMethod = function(args) {
  282.     this._logWindow.push.apply(this._logWindow, args);
  283. };

  284. //493
  285. BattleManager.processVictory = function() {
  286.     $gameParty.removeBattleStates();
  287.     this.startCommon(MPPlugin.processVictory);
  288.     this.endBattle(0);
  289. };

  290. //505
  291. BattleManager.processEscape = function() {
  292.     this.startCommon(MPPlugin.processEscape);
  293.     if (!MPPlugin.atb_plugin) this.startTurn();
  294. };

  295. BattleManager.judgeEscape = function() {
  296.     var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  297.     if (success) {
  298.         this._escaped = true;
  299.     } else {
  300.         this._escapeRatio += 0.1;
  301.     }
  302.     return success;
  303. };

  304. //528
  305. BattleManager.processDefeat = function() {
  306.     this.startCommon(MPPlugin.processDefeat);
  307.     this.endBattle(2);
  308. };

  309. BattleManager.startCommon = function(name) {
  310.     var event = ComBat.getCommonByName(name);
  311.     if (event) {
  312.         var selfVar = {
  313.             allTargets:$gameParty.members().clone()
  314.         };
  315.         $gameTroop.setupInterpreter(event.list, selfVar);
  316.     }
  317. };

  318. //-----------------------------------------------------------------------------
  319. // Game_BattlerBase

  320. Game_BattlerBase.prototype.allMetadata = function(name) {
  321.     return this.traitObjects().map(function(obj) {
  322.         return obj.meta[name];
  323.     }).filter(Boolean);
  324. };

  325. Game_BattlerBase.prototype.allMetaNumbers = function(name) {
  326.     return this.allMetadata(name).map(Number);
  327. };

  328. Game_BattlerBase.prototype.metadataIncludes = function(name, n) {
  329.     if (n === undefined) {
  330.         return this.allMetadata(name).length > 0;
  331.     } else {
  332.         return this.allMetaNumbers(name).contains(n);
  333.     }
  334. };

  335. Game_BattlerBase.prototype.metadataPi = function(name) {
  336.     return Math.floor(this.allMetaNumbers(name).reduce(function(r, n) {
  337.         return r * n / 100;
  338.     }, 100));
  339. };

  340. Game_BattlerBase.prototype.metadataSum = function(name) {
  341.     return this.allMetaNumbers(name).reduce(function(r, n) {
  342.         return r + n;
  343.     }, 0);
  344. };

  345. Game_BattlerBase.prototype.metadataMax = function(name) {
  346.     return this.allMetaNumbers(name).reduce(function(r, n) {
  347.         if (r === 0 || r < n) r = n;
  348.         return r;
  349.     }, 0);
  350. };

  351. Game_BattlerBase.prototype.metadataMin = function(name) {
  352.     return this.allMetaNumbers(name).reduce(function(r, n) {
  353.         if (r === 0 || r > n) r = n;
  354.         return r;
  355.     }, 0);
  356. };

  357. //-----------------------------------------------------------------------------
  358. // Game_Battler

  359. Game_Battler.prototype.getCharacter = function() {
  360.     return null;
  361. };

  362. Game_Battler.prototype.direction = function() {
  363.     var character = this.getCharacter();
  364.     return character ? character.direction() : 0;
  365. };

  366. Game_Battler.prototype.animeMirror = function() {
  367.     return this.direction() === 6;
  368. };

  369. Game_Battler.prototype.homeX = function() {
  370.     var character = this.getCharacter();
  371.     return character ? character.homeX() : 0;
  372. };

  373. Game_Battler.prototype.homeY = function() {
  374.     var character = this.getCharacter();
  375.     return character ? character.homeY() : 0;
  376. };

  377. Game_Battler.prototype.moveX = function() {
  378.     var character = this.getCharacter();
  379.     return character ? character.moveX() : 0;
  380. };

  381. Game_Battler.prototype.moveY = function() {
  382.     var character = this.getCharacter();
  383.     return character ? character.moveY() : 0;
  384. };

  385. Game_Battler.prototype.realX = function() {
  386.     var character = this.getCharacter();
  387.     return character ? character.realX() : 0;
  388. };

  389. Game_Battler.prototype.realY = function() {
  390.     var character = this.getCharacter();
  391.     return character ? character.realY() : 0;
  392. };

  393. Game_Battler.prototype.height = function() {
  394.     var character = this.getCharacter();
  395.     return character ? character.height : 0;
  396. };

  397. Game_Battler.prototype.width = function() {
  398.     var character = this.getCharacter();
  399.     return character ? character.width : 0;
  400. };

  401. Game_Battler.prototype.isMoving = function() {
  402.     var character = this.getCharacter();
  403.     return character && character.isMoving();
  404. };

  405. Game_Battler.prototype.inHomePosition = function() {
  406.     var character = this.getCharacter();
  407.     return character && character.inHomePosition();
  408. };

  409. Game_Battler.prototype.isSurrounded = function() {
  410.     var left = false;
  411.     var right = false;
  412.     var homeX = this.homeX();
  413.     var members = this.opponentsUnit().aliveMembers();
  414.     for (var i = 0; i < members.length; i++) {
  415.         members[i].homeX() < homeX ? left = true : right = true;
  416.         if (left && right) return true;
  417.     }
  418.     return false;
  419. };
  420. //-----------------------------------------------------------------------------
  421. // Game_Actor

  422. Game_Actor.prototype.getCharacter = function() {
  423.     var index = 1;
  424.     if (MPPlugin.eventActors.contains(this.actorId())) {
  425.         index += MPPlugin.eventActors.indexOf(this.actorId()) + 16;
  426.     } else {
  427.         index += this.index();
  428.     }
  429.     return ComBat.getCharacter(index);
  430. };

  431. Game_Actor.prototype.attackMotionType = function(index) {
  432.     var weapons = this.weapons();
  433.     var wtypeId = weapons[index] ? weapons[index].wtypeId : 0;
  434.     var attackMotion = $dataSystem.attackMotions[wtypeId];
  435.     return attackMotion ? attackMotion.type : -1;
  436. };

  437. Game_Actor.prototype.performSubAttack = function() {
  438.     var weapons = this.weapons();
  439.     var wtypeId = weapons[1] ? weapons[1].wtypeId : 0;
  440.     var attackMotion = $dataSystem.attackMotions[wtypeId];
  441.     if (attackMotion) {
  442.         if (attackMotion.type === 0) {
  443.             this.requestMotion('thrust');
  444.         } else if (attackMotion.type === 1) {
  445.             this.requestMotion('swing');
  446.         } else if (attackMotion.type === 2) {
  447.             this.requestMotion('missile');
  448.         }
  449.         this.startWeaponAnimation(attackMotion.weaponImageId);
  450.     }
  451. };

  452. //-----------------------------------------------------------------------------
  453. // Game_Enemy

  454. Game_Enemy.prototype.getCharacter = function() {
  455.     var index = this.index() + 9;
  456.     return ComBat.getCharacter(index);
  457. };

  458. //-----------------------------------------------------------------------------
  459. // Game_Unit

  460. Game_Unit.prototype.isSurrounded = function() {
  461.     return this.aliveMembers().some(function(member) {
  462.         return member.isSurrounded();
  463.     });
  464. };

  465. //-----------------------------------------------------------------------------
  466. // Game_Troop

  467. //5184
  468. Alias.GaTr_initialize = Game_Troop.prototype.initialize;
  469. Game_Troop.prototype.initialize = function() {
  470.     Alias.GaTr_initialize.call(this);
  471.     this._interpreter = new Game_ComBatInterpreter();
  472. };

  473. Game_Troop.prototype.setupInterpreter = function(list, selfVar) {
  474.     this._interpreter.setup(list, selfVar);
  475. };

  476. //-----------------------------------------------------------------------------
  477. // Game_ComBatInterpreter

  478. Game_ComBatInterpreter.prototype = Object.create(Game_Interpreter.prototype);
  479. Game_ComBatInterpreter.prototype.constructor = Game_ComBatInterpreter;

  480. Game_ComBatInterpreter.prototype.initialize = function(depth) {
  481.     Game_Interpreter.prototype.initialize.call(this, depth);
  482. };

  483. Game_ComBatInterpreter.prototype.clear = function() {
  484.     Game_Interpreter.prototype.clear.call(this);
  485.     this._selfVar = null;
  486. };

  487. Game_ComBatInterpreter.prototype.setup = function(list, selfVar) {
  488.     Game_Interpreter.prototype.setup.call(this, list)
  489.     this._selfVar = selfVar || {};
  490. };

  491. Game_ComBatInterpreter.prototype.updateWaitMode = function() {
  492.     var waiting = false;
  493.     switch (this._waitMode) {
  494.     case 'bmBusy':
  495.         waiting = BattleManager.isBusy();
  496.         break;
  497.     default:
  498.         return Game_Interpreter.prototype.updateWaitMode.call(this);
  499.     }
  500.     if (!waiting) this._waitMode = '';
  501.     return waiting;
  502. };

  503. Game_ComBatInterpreter.prototype.character = function(param) {
  504.     if (param < 0) {
  505.         if (this._selfVar.target) {
  506.             return this._selfVar.target.getCharacter();
  507.         }
  508.     } else if (param === 0) {
  509.         if (this._selfVar.user) {
  510.             return this._selfVar.user.getCharacter();
  511.         }
  512.     } else {
  513.         return ComBat.getCharacter(param);
  514.     }
  515.     return null;
  516. };

  517. // Conditional Branch
  518. Game_ComBatInterpreter.prototype.command111 = function() {
  519.     var result = false;
  520.     if (this._params[0] === 12) {
  521.         var v = $gameVariables._data;
  522.         var selfVar = this._selfVar;
  523.         var user = selfVar.user;
  524.         var allTargets = selfVar.allTargets;
  525.         var target = selfVar.target;
  526.         var item = selfVar.item;
  527.         var action = selfVar.action;
  528.         result = !!eval(this._params[1]);
  529.         this._branch[this._indent] = result;
  530.         if (this._branch[this._indent] === false) {
  531.             this.skipBranch();
  532.         }
  533.         return true;
  534.     } else {
  535.         return Game_Interpreter.prototype.command111.call(this);
  536.     }
  537. };

  538. // Control Variables
  539. Game_ComBatInterpreter.prototype.command122 = function() {
  540.     if (this._params[3] === 4) {
  541.         var v = $gameVariables._data;
  542.         var selfVar = this._selfVar;
  543.         var user = selfVar.user;
  544.         var allTargets = selfVar.allTargets;
  545.         var target = selfVar.target;
  546.         var item = selfVar.item;
  547.         var action = selfVar.action;
  548.         var value = eval(this._params[4]);
  549.         for (var i = this._params[0]; i <= this._params[1]; i++) {
  550.             this.operateVariable(i, this._params[2], value);
  551.         }
  552.         return true;
  553.     } else {
  554.         return Game_Interpreter.prototype.command122.call(this);
  555.     }
  556. };

  557. Game_ComBatInterpreter.prototype.gameDataOperand = function(type, param1, param2) {
  558.     if (type === 5) {
  559.         var character = this.character(param1);
  560.         if (character) {
  561.             switch (param2) {
  562.             case 0:  // Map X
  563.                 return character.moveX();
  564.             case 1:  // Map Y
  565.                 return character.moveY();
  566.             case 2:  // Direction
  567.                 return character.direction();
  568.             case 3:  // Screen X
  569.                 return character.x;
  570.             case 4:  // Screen Y
  571.                 return character.y;
  572.             }
  573.         }
  574.         return 0;
  575.     } else {
  576.         return Game_Interpreter.prototype.gameDataOperand.call(this, type, param1, param2);
  577.     }
  578. };

  579. Game_ComBatInterpreter.prototype.setupChild = function(list) {
  580.     this._childInterpreter = new Game_ComBatInterpreter(this._depth + 1);
  581.     this._childInterpreter.setup(list, this._selfVar);
  582. };

  583. // Set Movement Route
  584. Game_ComBatInterpreter.prototype.command205 = function() {
  585.     this._character = this.character(this._params[0]);
  586.     if (this._character) {
  587.         this._character.forceMoveRoute(this._params[1], this._selfVar);
  588.         if (this._params[1].wait) {
  589.             this.setWaitMode('route');
  590.         }
  591.     }
  592.     return true;
  593. };

  594. // Script
  595. Game_ComBatInterpreter.prototype.command355 = function() {
  596.     var script = this.currentCommand().parameters[0] + '\n';
  597.     while (this.nextEventCode() === 655) {
  598.         this._index++;
  599.         script += this.currentCommand().parameters[0] + '\n';
  600.     }
  601.     try {
  602.         var v = $gameVariables._data;
  603.         var selfVar = this._selfVar;
  604.         var user = selfVar.user;
  605.         var allTargets = selfVar.allTargets;
  606.         var target = selfVar.target;
  607.         var item = selfVar.item;
  608.         var action = selfVar.action;
  609.         eval(script);
  610.     } catch (e) {
  611.         if ($gameTemp.isPlaytest()) {
  612.             var text = "以下のスクリプトでエラーが発生しました。\n\n";
  613.             text += script;
  614.             alert(text);
  615.         }
  616.     }
  617.     return true;
  618. };

  619. // Plugin Command
  620. Game_ComBatInterpreter.prototype.command356 = function() {
  621.     try {
  622.         Game_Interpreter.prototype.command356.call(this);
  623.     } catch (e) {
  624.         if ($gameTemp.isPlaytest()) {
  625.             var text = "以下のプラグインコマンドでエラーが発生しました。\n\n";
  626.             text += this._params[0];
  627.             alert(text);
  628.         }
  629.     }
  630.     return true;
  631. };

  632. Game_ComBatInterpreter.SetUser = 'SetUser';
  633. Game_ComBatInterpreter.SetAllTargets = 'SetAllTargets';
  634. Game_ComBatInterpreter.AddTarget = 'AddTarget';
  635. Game_ComBatInterpreter.DeleteTarget = 'DeleteTarget';
  636. Game_ComBatInterpreter.SetTarget = 'SetTarget';
  637. Game_ComBatInterpreter.SetItem = 'SetItem';
  638. Game_ComBatInterpreter.UseItem = 'UseItem';
  639. Game_ComBatInterpreter.LogWindow = 'LogWindow';
  640. Game_ComBatInterpreter.ShowAnimation = 'ShowAnimation';
  641. Game_ComBatInterpreter.ShowAnimationToTarget = 'ShowAnimationToTarget';
  642. Game_ComBatInterpreter.ShowNormalAnimation = 'ShowNormalAnimation';
  643. Game_ComBatInterpreter.WaitBusy = 'WaitBusy';
  644. Game_ComBatInterpreter.ActionApply = 'ActionApply';
  645. Game_ComBatInterpreter.CounterApply = 'CounterApply';
  646. Game_ComBatInterpreter.RefreshStatus = 'RefreshStatus';
  647. Game_ComBatInterpreter.UsedCommon = 'UsedCommon';
  648. Game_ComBatInterpreter.AddLog = 'AddLog';
  649. Game_ComBatInterpreter.AtWait = 'AtWait';

  650. Game_ComBatInterpreter.prototype.pluginCommand = function(command, args) {
  651.     Game_Interpreter.prototype.pluginCommand.call(this, command, args);
  652.     var v = $gameVariables._data;
  653.     var selfVar = this._selfVar;
  654.     var user = selfVar.user;
  655.     var allTargets = selfVar.allTargets;
  656.     var target = selfVar.target;
  657.     var item = selfVar.item;
  658.     var action = selfVar.action;
  659.     var GCBI = Game_ComBatInterpreter;
  660.     switch (command) {
  661.     case GCBI.SetUser:
  662.         var newUser;
  663.         var value = eval(args[1]);
  664.         switch (args[0]) {
  665.         case 'party':
  666.             newUser = $gameParty.members()[value];
  667.             break;
  668.         case 'troop':
  669.             newUser = $gameTroop.members()[value];
  670.             break;
  671.         default:
  672.             newUser = value;
  673.             break;
  674.         }
  675.         if (newUser && (newUser.isActor() || newUser.isEnemy())) {
  676.             this._selfVar.user = newUser;
  677.             action.setSubject(newUser);
  678.         }
  679.         break;
  680.     case GCBI.SetAllTargets:
  681.         var newAllTargets;
  682.         switch (args[0]) {
  683.         case 'party':
  684.             switch (args[1]) {
  685.             case 'alive':
  686.                 newAllTargets = $gameParty.aliveMembers().clone();
  687.                 break;
  688.             case 'dead':
  689.                 newAllTargets = $gameParty.deadMembers().clone();
  690.                 break;
  691.             default:
  692.                 newAllTargets = $gameParty.members().clone();
  693.                 break;
  694.             }
  695.             break;
  696.         case 'troop':
  697.             switch (args[1]) {
  698.             case 'alive':
  699.                 newAllTargets = $gameTroop.aliveMembers().clone();
  700.                 break;
  701.             case 'dead':
  702.                 newAllTargets = $gameTroop.deadMembers().clone();
  703.                 break;
  704.             default:
  705.                 newAllTargets = $gameTroop.members().clone();
  706.                 break;
  707.             }
  708.             break;
  709.         case 'refresh':
  710.             newAllTargets = action.makeTargets();
  711.             break;
  712.         default:
  713.             newAllTargets = eval(args[1]);
  714.             break;
  715.         }
  716.         if (Array.isArray(newAllTargets)) {
  717.             this._selfVar.allTargets = newAllTargets;
  718.         }
  719.         break;
  720.     case GCBI.AddTarget:
  721.         var newTarget = eval(args[0]);
  722.         if (newTarget) {
  723.             if (args[1] === 'true') {
  724.                 this._selfVar.allTargets.unshift(newTarget);
  725.             } else {
  726.                 this._selfVar.allTargets.push(newTarget);
  727.             }
  728.         }
  729.         break;
  730.     case GCBI.DeleteTarget:
  731.         var battler = eval(args[0]);
  732.         this._selfVar.allTargets = allTargets.filter(function(target) {
  733.             return target !== battler;
  734.         });
  735.         break;
  736.     case GCBI.SetTarget:
  737.         var newTarget;
  738.         var value = eval(args[1]);
  739.         switch (args[0]) {
  740.         case 'party':
  741.             newTarget = $gameParty.members()[value];
  742.             break;
  743.         case 'troop':
  744.             newTarget = $gameTroop.members()[value];
  745.             break;
  746.         case 'shift':
  747.             newTarget = allTargets.shift();
  748.             break;
  749.         default:
  750.             newTarget = value;
  751.             break;
  752.         }
  753.         if (!newTarget || newTarget.isActor() || newTarget.isEnemy()) {
  754.             this._selfVar.target = newTarget;
  755.         }
  756.         break;
  757.     case GCBI.SetItem:
  758.         var value = eval(args[1]);
  759.         switch (args[0]) {
  760.         case 'item':
  761.             this._selfVar.item = $dataSkills[value];
  762.             break;
  763.         case 'skill':
  764.             this._selfVar.item = $dataItems[value];
  765.             break;
  766.         }
  767.         action.setItemObject(this._selfVar.item);
  768.         break;
  769.     case GCBI.UseItem:
  770.         user.useItem(item);
  771.         BattleManager.refreshStatus();
  772.         break;
  773.     case GCBI.LogWindow:
  774.         for (var i = 1; i < args.length; i++) {
  775.             args[i] = eval(args[i]);
  776.         }
  777.         BattleManager.callLogMethod(args);
  778.         this.wait(1);
  779.         break;
  780.     case GCBI.ShowAnimation:
  781.         var param = ['showAnimation', user, allTargets.clone(), item.animationId];
  782.         BattleManager.callLogMethod(param);
  783.         break;
  784.     case GCBI.ShowAnimationToTarget:
  785.         var param = ['showAnimation', user, [target], item.animationId];
  786.         BattleManager.callLogMethod(param);
  787.         break;
  788.     case GCBI.ShowNormalAnimation:
  789.         var param = ['showNormalAnimation', allTargets.clone()];
  790.         param[2] =  eval(args[0]);
  791.         param[3] =  eval(args[1]) || false;
  792.         BattleManager.callLogMethod(param);
  793.         break;
  794.     case GCBI.WaitBusy:
  795.         this.setWaitMode('bmBusy');
  796.         //this.wait(1);
  797.         break;
  798.     case GCBI.ActionApply:
  799.         var actionTarget = args[0] ? eval(args[0]) : target;
  800.         action.apply(actionTarget);
  801.         break;
  802.     case GCBI.CounterApply:
  803.         var counterAction = new Game_Action(target);
  804.         counterAction.setAttack();
  805.         counterAction.apply(user);
  806.         break;
  807.     case GCBI.RefreshStatus:
  808.         BattleManager.refreshStatus();
  809.         break;
  810.     case GCBI.UsedCommon:
  811.         var commonTarget = eval(args[0]);
  812.         if (commonTarget) {
  813.             var character = commonTarget.getCharacter();
  814.             if (character) {
  815.                 character.setCommon(args[1], args[2]);
  816.             }
  817.         }
  818.         break;
  819.     case GCBI.AddLog:
  820.         var param = ['push', 'addText', args[0]];
  821.         BattleManager.callLogMethod(param);
  822.         param = ['push', 'waitForNewLine'];
  823.         BattleManager.callLogMethod(param);
  824.         break;
  825.     case GCBI.AtWait:
  826.         BattleManager.setUserWait(args[0] === 'true');
  827.         break;
  828.     }
  829. };

  830. //-----------------------------------------------------------------------------
  831. // Sprite_Battler

  832. //465
  833. Alias.SpBa_initMembers = Sprite_Battler.prototype.initMembers;
  834. Sprite_Battler.prototype.initMembers = function() {
  835.     Alias.SpBa_initMembers.call(this);
  836.     this._interpreter = new Game_ComBatInterpreter();
  837.     this._direction = 4;
  838.    
  839.     this._moveRoute = null;
  840.     this._moveRouteIndex = 0;
  841.    
  842.     this._jumpCount = 0;
  843.     this._jumpPeak = 0;
  844.     this._jumpRate = 5;
  845.    
  846.     this._scaleX = 1;
  847.     this._scaleY = 1;
  848.     this._targetScaleX = 1;
  849.     this._targetScaleY = 1;
  850.     this._scaleDuration = 0;
  851.    
  852.     this._altitude = 0;
  853.     this._targetAltitude = 0;
  854.     this._altitudeDuration = 0;
  855.    
  856.     this._encloseSpeed = 0;
  857.     this._encloseType = 0;
  858.     this._encloseBaseCharacter = null;
  859.     this._encloseXRate = 1;
  860.     this._encloseYRate = 1;
  861.     this._encloseAngle = 0;
  862.     this._encloseDistance = 0;
  863.    
  864.     this._motionAnime = true;
  865.     this._waitCount = 0;
  866.     this._selfVar = {};
  867.     this._shadowVisible = true;
  868.     this.cbZ = 20;
  869. };

  870. Sprite_Battler.prototype.homeX = function() {
  871.     return this._homeX;
  872. };

  873. Sprite_Battler.prototype.homeY = function() {
  874.     return this._homeY;
  875. };

  876. Sprite_Battler.prototype.moveX = function() {
  877.     return this._homeX + this._targetOffsetX;
  878. };

  879. Sprite_Battler.prototype.moveY = function() {
  880.     return this._homeY + this._targetOffsetY;
  881. };

  882. Sprite_Battler.prototype.realX = function() {
  883.     return this._homeX + this._offsetX;
  884. };

  885. Sprite_Battler.prototype.realY = function() {
  886.     return this._homeY + this._offsetY;
  887. };

  888. //524
  889. Alias.SpBa_updateMove = Sprite_Battler.prototype.updateMove;
  890. Sprite_Battler.prototype.updateMove = function() {
  891.     if (this._jumpCount > 0) {
  892.         var c = this._jumpCount;
  893.         this._offsetX = (this._offsetX * (c - 1) + this._targetOffsetX) / c;
  894.         this._offsetY = (this._offsetY * (c - 1) + this._targetOffsetY) / c;
  895.         this._jumpCount--;
  896.     } else {
  897.         Alias.SpBa_updateMove.call(this);
  898.     }
  899.     this.updateAltitude();
  900.     this.updateEnclose();
  901. };

  902. Sprite_Battler.prototype.direction = function() {
  903.     return this._direction;
  904. };

  905. Sprite_Battler.prototype.reverseDir = function(d) {
  906.     return 10 - d;
  907. };

  908. Sprite_Battler.prototype.setDirection = function(d) {
  909.     if (d === 4 || d === 6) {
  910.         this._direction = d;
  911.     }
  912. };

  913. Sprite_Battler.prototype.isMirror = function() {
  914.     return false;
  915. };

  916. Sprite_Battler.prototype.startMotion = function() {
  917. };

  918. Sprite_Battler.prototype.startWeapon = function() {
  919. };

  920. Sprite_Battler.prototype.jumpHeight = function() {
  921.     var height = (this._jumpPeak * this._jumpPeak -
  922.             Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2;
  923.     return Math.floor(height * this._jumpRate);
  924. };

  925. Sprite_Battler.prototype.getCharacter = function(param) {
  926.     if (param === -2) {
  927.         return this;
  928.     } else if (param === -1) {
  929.         if (this._selfVar.target) {
  930.             return this._selfVar.target.getCharacter();
  931.         }
  932.     } else if (param === 0) {
  933.         if (this._selfVar.user) {
  934.             return this._selfVar.user.getCharacter();
  935.         }
  936.     } else if (param > 0) {
  937.         return ComBat.getCharacter(param);
  938.     }
  939.     return null;
  940. };

  941. Sprite_Battler.prototype.isMoveRouteForcing = function() {
  942.     return !!this._moveRoute;
  943. };

  944. Sprite_Battler.prototype.forceMoveRoute = function(moveRoute, selfVar) {
  945.     if (this._battler) {
  946.         this._moveRoute = moveRoute;
  947.         this._moveRouteIndex = 0;
  948.         this._waitCount = 0;
  949.         this._selfVar = selfVar;
  950.     }
  951. };

  952. //490
  953. Alias.SpBa_update = Sprite_Battler.prototype.update;
  954. Sprite_Battler.prototype.update = function() {
  955.     Alias.SpBa_update.call(this);
  956.     this._interpreter.update();
  957.     if (this._battler) {
  958.         this.updateBalloon();
  959.         this.updateZoom();
  960.         this.updateEcho();
  961.     }
  962.     if (this._moveRoute) {
  963.         this.updateRoutineMove();
  964.     }
  965. };

  966. //509
  967. Alias.SpBa_updatePosition = Sprite_Battler.prototype.updatePosition;
  968. Sprite_Battler.prototype.updatePosition = function() {
  969.     Alias.SpBa_updatePosition.call(this);
  970.     this.y -=  this.jumpHeight() + this._altitude;
  971.     this.scale.x = this._scaleX * (this.isMirror() ? -1 : 1);
  972.     this.scale.y = this._scaleY;
  973. };

  974. Sprite_Battler.prototype.updateRoutineMove = function() {
  975.     if (this._waitCount > 0) {
  976.         this._waitCount--;
  977.         if (this._waitCount > 0) {
  978.             return;
  979.         }
  980.     }
  981.     do {
  982.         var command = this._moveRoute.list[this._moveRouteIndex];
  983.         if (command) {
  984.             this.processMoveCommand(command);
  985.             this.advanceMoveRouteIndex();
  986.         } else {
  987.             break;
  988.         }
  989.     } while (this._moveRoute && this._waitCount === 0 && this._moveRouteIndex > 0);
  990. };

  991. Sprite_Battler.prototype.processMoveCommand = function(command) {
  992.     var gc = Game_Character;
  993.     var params = command.parameters;
  994.     switch (command.code) {
  995.     case gc.ROUTE_END:
  996.         this.processRouteEnd();
  997.         break;
  998.     case gc.ROUTE_MOVE_DOWN:
  999.         this.moveStraight(2);
  1000.         break;
  1001.     case gc.ROUTE_MOVE_LEFT:
  1002.         this.moveStraight(4);
  1003.         break;
  1004.     case gc.ROUTE_MOVE_RIGHT:
  1005.         this.moveStraight(6);
  1006.         break;
  1007.     case gc.ROUTE_MOVE_UP:
  1008.         this.moveStraight(8);
  1009.         break;
  1010.     case gc.ROUTE_MOVE_LOWER_L:
  1011.         this.moveDiagonally(4, 2);
  1012.         break;
  1013.     case gc.ROUTE_MOVE_LOWER_R:
  1014.         this.moveDiagonally(6, 2);
  1015.         break;
  1016.     case gc.ROUTE_MOVE_UPPER_L:
  1017.         this.moveDiagonally(4, 8);
  1018.         break;
  1019.     case gc.ROUTE_MOVE_UPPER_R:
  1020.         this.moveDiagonally(6, 8);
  1021.         break;
  1022.     case gc.ROUTE_MOVE_RANDOM:
  1023.         this.moveRandom();
  1024.         break;
  1025.     case gc.ROUTE_MOVE_TOWARD:
  1026.         this.moveTowardCharacter(this._selfVar.target);
  1027.         break;
  1028.     case gc.ROUTE_MOVE_AWAY:
  1029.         this.moveAwayFromCharacter(this._selfVar.target);
  1030.         break;
  1031.     case gc.ROUTE_MOVE_FORWARD:
  1032.         this.moveStraight(this.direction());
  1033.         break;
  1034.     case gc.ROUTE_MOVE_BACKWARD:
  1035.         this.moveStraight(this.reverseDir(this.direction()));
  1036.         break;
  1037.     case gc.ROUTE_JUMP:
  1038.         this.startJump(params[0], params[1]);
  1039.         this._waitCount = this._jumpCount;
  1040.         break;
  1041.     case gc.ROUTE_WAIT:
  1042.         this._waitCount = params[0];
  1043.         break;
  1044. //    case gc.ROUTE_TURN_DOWN:
  1045. //        this.setDirection(2);
  1046. //        break;
  1047.     case gc.ROUTE_TURN_LEFT:
  1048.         this.setDirection(4);
  1049.         break;
  1050.     case gc.ROUTE_TURN_RIGHT:
  1051.         this.setDirection(6);
  1052.         break;
  1053. //    case gc.ROUTE_TURN_UP:
  1054. //        this.setDirection(8);
  1055. //        break;
  1056. //    case gc.ROUTE_TURN_90D_R:
  1057. //        this.turnRight90();
  1058. //        break;
  1059. //    case gc.ROUTE_TURN_90D_L:
  1060. //        this.turnLeft90();
  1061. //        break;
  1062.     case gc.ROUTE_TURN_180D:
  1063.         this.turn180();
  1064.         break;
  1065. //    case gc.ROUTE_TURN_90D_R_L:
  1066. //        this.turnRightOrLeft90();
  1067. //        break;
  1068.     case gc.ROUTE_TURN_RANDOM:
  1069.         this.turnRandom();
  1070.         break;
  1071.     case gc.ROUTE_TURN_TOWARD:
  1072.         this.turnTowardCharacter(-1);
  1073.         break;
  1074.     case gc.ROUTE_TURN_AWAY:
  1075.         this.turnAwayFromCharacter(-1);
  1076.         break;
  1077.     case gc.ROUTE_SWITCH_ON:
  1078.         $gameSwitches.setValue(params[0], true);
  1079.         break;
  1080.     case gc.ROUTE_SWITCH_OFF:
  1081.         $gameSwitches.setValue(params[0], false);
  1082.         break;
  1083. //    case gc.ROUTE_CHANGE_SPEED:
  1084. //        this.setMoveSpeed(params[0]);
  1085. //        break;
  1086. //    case gc.ROUTE_CHANGE_FREQ:
  1087. //        this.setMoveFrequency(params[0]);
  1088. //        break;
  1089.     case gc.ROUTE_WALK_ANIME_ON:
  1090.         this._motionAnime = true;
  1091.         this._weaponSprite._weaponAnime = true;
  1092.         break;
  1093.     case gc.ROUTE_WALK_ANIME_OFF:
  1094.         this._motionAnime = false;
  1095.         this._weaponSprite._weaponAnime = false;
  1096.         break;
  1097.     case gc.ROUTE_STEP_ANIME_ON:
  1098.         this._motionAnime = true;
  1099.         this._weaponSprite._weaponAnime = true;
  1100.         break;
  1101.     case gc.ROUTE_STEP_ANIME_OFF:
  1102.         this._motionAnime = false;
  1103.         this._weaponSprite._weaponAnime = false;
  1104.         break;
  1105. //    case gc.ROUTE_DIR_FIX_ON:
  1106. //        this._directionFix = true;
  1107. //        break;
  1108. //    case gc.ROUTE_DIR_FIX_OFF:
  1109. //        this._directionFix = false;
  1110. //        break;
  1111. //    case gc.ROUTE_THROUGH_ON:
  1112. //        this.setThrough(true);
  1113. //        break;
  1114. //    case gc.ROUTE_THROUGH_OFF:
  1115. //        this.setThrough(false);
  1116. //        break;
  1117.     case gc.ROUTE_TRANSPARENT_ON:
  1118.         this.hide();
  1119.         break;
  1120.     case gc.ROUTE_TRANSPARENT_OFF:
  1121.         this.show();
  1122.         break;
  1123. //    case gc.ROUTE_CHANGE_IMAGE:
  1124. //        this.setImage(params[0], params[1]);
  1125. //        break;
  1126. //    case gc.ROUTE_CHANGE_OPACITY:
  1127. //        this.setOpacity(params[0]);
  1128. //        break;
  1129. //    case gc.ROUTE_CHANGE_BLEND_MODE:
  1130. //        this.setBlendMode(params[0]);
  1131. //        break;
  1132.     case gc.ROUTE_PLAY_SE:
  1133.         AudioManager.playSe(params[0]);
  1134.         break;
  1135.     case gc.ROUTE_SCRIPT:
  1136.         try {
  1137.             var user = this._selfVar.user;
  1138.             var allTargets = this._selfVar.allTargets;
  1139.             var target = this._selfVar.target;
  1140.             var item = this._selfVar.item;
  1141.             var action = this._selfVar.action;
  1142.             var selfVar = this._selfVar;
  1143.             var script = this.convertMethod(params[0]);
  1144.             eval(script);
  1145.         } catch (e) {
  1146.             if ($gameTemp.isPlaytest()) {
  1147.                 var text = "以下のスクリプトでエラーが発生しました。\n\n";
  1148.                 text += params[0];
  1149.                 alert(text);
  1150.             }
  1151.         }
  1152.         break;
  1153.     }
  1154. };

  1155. Sprite_Battler.prototype.convertMethod = function(text) {
  1156.     text = text.replace(/^home\(/g, 'this.setHome(');
  1157.     text = text.replace(/^move\(/g, 'this.startMove(');
  1158.     text = text.replace(/^jump\(/g, 'this.startJump(');
  1159.     text = text.replace(/^motion\(/g, 'this.startMotion(');
  1160.     text = text.replace(/^weapon\(/g, 'this.startWeapon(');
  1161.     text = text.replace(/^zoom\(/g, 'this.startZoom(');
  1162.     text = text.replace(/^alt\(/g, 'this.startAltitude(');
  1163.     text = text.replace(/^shadowOn/g, 'this.shadowOn()');
  1164.     text = text.replace(/^shadowOff/g, 'this.shadowOff()');
  1165.     text = text.replace(/^turn\(/g, 'this.turnTowardCharacter(');
  1166.     text = text.replace(/^icon\(/g, 'this.startIcon(');
  1167.     text = text.replace(/^iconMove\(/g, 'this.startIconMove(');
  1168.     text = text.replace(/^iconRotation\(/g, 'this.startIconRotation(');
  1169.     text = text.replace(/^iconZoom\(/g, 'this.startIconZoom(');
  1170.     text = text.replace(/^echoOn/g, 'this.startEcho()');
  1171.     text = text.replace(/^echoOff/g, 'this.endEcho()');
  1172.     text = text.replace(/^enclose\(/g, 'this.startEnclose(');
  1173.     return text;
  1174. };

  1175. Sprite_Battler.prototype.xWithDirection = function(x, d) {
  1176.     return x + (d === 6 ? 1 : d === 4 ? -1 : 0);
  1177. };

  1178. Sprite_Battler.prototype.yWithDirection = function(y, d) {
  1179.     return y + (d === 2 ? 1 : d === 8 ? -1 : 0);
  1180. };

  1181. Sprite_Battler.prototype.directionSign = function() {
  1182.     return this._direction === 4 ? -1 : 1;
  1183. };

  1184. Sprite_Battler.prototype.xWithSign = function(x, dir) {
  1185.     var character = this.getCharacter(dir);
  1186.     var sign = character ? character.directionSign() : 1;
  1187.     return x * sign;
  1188. };

  1189. //610
  1190. Alias.SpBa_startMove = Sprite_Battler.prototype.startMove;
  1191. Sprite_Battler.prototype.startMove = function(x, y, d, home, dir) {
  1192.     x = Math.floor(x * MPPlugin.paceX);
  1193.     y = Math.floor(y * MPPlugin.paceY);
  1194.     if (home === undefined) home = -2;
  1195.     if (dir === undefined) dir = -2;
  1196.     var character = this.getCharacter(home) || this;
  1197.     x = this.xWithSign(x, dir);
  1198.     x += character.homeX() - this.homeX();
  1199.     y += character.homeY() - this.homeY();
  1200.     Alias.SpBa_startMove.call(this, x, y, d);
  1201. };

  1202. Sprite_Battler.prototype.moveStraight = function(d) {
  1203.     var x = this.xWithDirection(this._offsetX / MPPlugin.paceX, d);
  1204.     var y = this.yWithDirection(this._offsetY / MPPlugin.paceY, d);
  1205.     this.startMove(x, y, 12, -2, -3);
  1206.     this._waitCount = 12;
  1207. };

  1208. Sprite_Battler.prototype.moveDiagonally = function(horz, vert) {
  1209.     var x = this.xWithDirection(this._offsetX / MPPlugin.paceX, horz);
  1210.     var y = this.yWithDirection(this._offsetY / MPPlugin.paceY, vert);
  1211.     this.startMove(x, y, 17, -2, -3);
  1212.     this._waitCount = 17;
  1213. };

  1214. Sprite_Battler.prototype.startJump = function(x, y, count, rate, home, dir) {
  1215.     x = Math.floor(x * MPPlugin.paceX);
  1216.     y = Math.floor(y * MPPlugin.paceY);
  1217.     if (rate === undefined) rate = 1;
  1218.     if (home === undefined) home = -2;
  1219.     if (dir === undefined) dir = -2;
  1220.     var character = this.getCharacter(home) || this;
  1221.     x = this.xWithSign(x, dir);
  1222.     x += character.homeX() - this.homeX();
  1223.     y += character.homeY() - this.homeY();
  1224.     this._targetOffsetX = x;
  1225.     this._targetOffsetY = y;
  1226.     if (!count) {
  1227.         var xPlus = (x - this._offsetX) / MPPlugin.paceX;
  1228.         var yPlus = (y - this._offsetY) / MPPlugin.paceY;
  1229.         var distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus));
  1230.         this._jumpPeak = 5 + distance;
  1231.         this._jumpCount = this._jumpPeak * 2;
  1232.     } else {
  1233.         this._jumpCount = count;
  1234.         this._jumpPeak = this._jumpCount / 2;
  1235.     }
  1236.     this._jumpRate = rate;
  1237. };

  1238. Sprite_Battler.prototype.moveRandom = function() {
  1239.     this.moveStraight(2 + Math.randomInt(4) * 2);
  1240. };

  1241. Sprite_Battler.prototype.moveTowardCharacter = function(character) {
  1242.     if (!character) return;
  1243.     if (!ComBat.isCharacter(character)) {
  1244.         character = character.getCharacter();
  1245.         if (!character) return;
  1246.     }
  1247.     var sx = this.realX() - character.realX();
  1248.     this.moveStraight(sx > 0 ? 4 : 6);
  1249. };

  1250. Sprite_Battler.prototype.moveAwayFromCharacter = function(character) {
  1251.     if (!character) return;
  1252.     if (!ComBat.isCharacter(character)) {
  1253.         character = character.getCharacter();
  1254.         if (!character) return;
  1255.     }
  1256.     var sx = this.realX() - character.realX();
  1257.     this.moveStraight(sx > 0 ? 6 : 4);
  1258. };

  1259. Sprite_Battler.prototype.turnTowardCharacter = function(param) {
  1260.     var character = this.getCharacter(param);
  1261.     if (!character) return;
  1262.     var sx = this.realX() - character.realX();
  1263.     if (sx !== 0) this.setDirection(sx > 0 ? 4 : 6);
  1264. };

  1265. Sprite_Battler.prototype.turnAwayFromCharacter = function(param) {
  1266.     var character = this.getCharacter(param);
  1267.     if (!character) return;
  1268.     var sx = this.realX() - character.realX();
  1269.     if (sx !== 0) this.setDirection(sx > 0 ? 6 : 4);
  1270. };

  1271. Sprite_Battler.prototype.processRouteEnd = function() {
  1272.     this._moveRouteIndex = -1;
  1273.     if (!this._moveRoute.repeat) {
  1274.         this._moveRoute = null;
  1275.         this._moveRouteIndex = 0;
  1276.     }
  1277. };

  1278. Sprite_Battler.prototype.advanceMoveRouteIndex = function() {
  1279.     var moveRoute = this._moveRoute;
  1280.     if (moveRoute) {
  1281.         var numCommands = moveRoute.list.length - 1;
  1282.         this._moveRouteIndex++;
  1283.         if (moveRoute.repeat && this._moveRouteIndex >= numCommands) {
  1284.             this._moveRouteIndex = 0;
  1285.         }
  1286.     }
  1287. };

  1288. Sprite_Battler.prototype.turn180 = function() {
  1289.     this.setDirection(this.reverseDir(this.direction()));
  1290. };

  1291. Sprite_Battler.turnRandom = function() {
  1292.     this.setDirection(4 + Math.randomInt(2) * 2);
  1293. };

  1294. Sprite_Battler.prototype.requestBalloon = function(balloonId) {
  1295.     if (!this._balloonSprite) {
  1296.         this._balloonSprite = new Sprite_Balloon();
  1297.     }
  1298.     this._balloonSprite.setup(balloonId);
  1299.     //this.parent.addChild(this._balloonSprite);
  1300. };

  1301. Sprite_Battler.prototype.updateBalloon = function() {
  1302.     if (this._balloonSprite) {
  1303.         this._balloonSprite.x = this.x;
  1304.         this._balloonSprite.y = this.y - this.height;
  1305.         if (!this._balloonSprite.isPlaying()) {
  1306.             this.endBalloon();
  1307.         }
  1308.     }
  1309. };

  1310. Sprite_Battler.prototype.endBalloon = function() {
  1311.     if (this._balloonSprite) {
  1312.         this.parent.removeChild(this._balloonSprite);
  1313.         this._balloonSprite = null;
  1314.     }
  1315. };

  1316. Sprite_Battler.prototype.isBalloonPlaying = function() {
  1317.     return !!this._balloonSprite;
  1318. };

  1319. Sprite_Battler.prototype.requestAnimation = function(animationId) {
  1320.     var animation = $dataAnimations[animationId];
  1321.     this.startAnimation(animation, false, 0);
  1322. };

  1323. Sprite_Battler.prototype.setCommon = function(commonName, methodName) {
  1324.     if (this._battler) {
  1325.         var commonId = 0;
  1326.         if (methodName) {
  1327.             commonId = this._battler.metadataMax(methodName);
  1328.         }
  1329.         var commonEvent = ComBat.getCommonEvent(commonName, commonId);
  1330.         if (commonEvent) {
  1331.             var selfVar = {
  1332.                 user:      this._battler,
  1333.                 allTargets:[]
  1334.             };
  1335.             this._interpreter.setup(commonEvent.list, selfVar);
  1336.         }
  1337.     }
  1338. };

  1339. //183
  1340. Alias.SpBa_isMoving = Sprite_Battler.prototype.isMoving;
  1341. Sprite_Battler.prototype.isMoving = function() {
  1342.     return Alias.SpBa_isMoving.call(this) || this._jumpCount > 0;
  1343. };

  1344. Sprite_Battler.prototype.shadowOn = function() {
  1345.     this._shadowVisible = true;
  1346. };

  1347. Sprite_Battler.prototype.shadowOff = function() {
  1348.     this._shadowVisible = false;
  1349. };

  1350. Sprite_Battler.prototype.updateZoom = function() {
  1351.     if (this._scaleDuration > 0) {
  1352.         var d = this._scaleDuration;
  1353.         this._scaleX = (this._scaleX * (d - 1) + this._targetScaleX) / d;
  1354.         this._scaleY = (this._scaleY * (d - 1) + this._targetScaleY) / d;
  1355.         this._scaleDuration--;
  1356.     }
  1357. };

  1358. Sprite_Battler.prototype.startZoom = function(scaleX, scaleY, duration) {
  1359.     this._targetScaleX = scaleX;
  1360.     this._targetScaleY = scaleY;
  1361.     this._scaleDuration = duration;
  1362.     if (this._scaleDuration === 0) {
  1363.         this._scaleX = this._targetScaleX;
  1364.         this._scaleY = this._targetScaleY;
  1365.     }
  1366. };

  1367. Sprite_Battler.prototype.updateAltitude = function() {
  1368.     if (this._altitudeDuration > 0) {
  1369.         var d = this._altitudeDuration;
  1370.         this._altitude = (this._altitude * (d - 1) + this._targetAltitude) / d;
  1371.         this._altitudeDuration--;
  1372.     }
  1373. };

  1374. Sprite_Battler.prototype.startAltitude = function(altitude, duration) {
  1375.     this._targetAltitude = altitude;
  1376.     this._altitudeDuration = duration;
  1377.     if (this._altitudeDuration === 0) {
  1378.         this._altitude = this._targetAltitude;
  1379.     }
  1380. };

  1381. Sprite_Battler.prototype.startIcon = function(iconIndex) {
  1382.     if (iconIndex === 0 && this._popIconSprite) {
  1383.         this.removeChild(this._popIconSprite);
  1384.         this._popIconSprite = null;
  1385.     } else if (iconIndex > 0) {
  1386.         if (!this._popIconSprite) {
  1387.             this._popIconSprite = new Sprite_PopIcon();
  1388.             this.addChild(this._popIconSprite);
  1389.         }
  1390.         this._popIconSprite.setIcon(iconIndex);
  1391.     }
  1392. };

  1393. Sprite_Battler.prototype.startIconMove = function(x, y, duration) {
  1394.     if (this._popIconSprite) {
  1395.         this._popIconSprite.startMove(x, y, duration);
  1396.     }
  1397. };

  1398. Sprite_Battler.prototype.startIconRotation = function(speed) {
  1399.     if (this._popIconSprite) {
  1400.         this._popIconSprite.startRotation(speed);
  1401.     }
  1402. };

  1403. Sprite_Battler.prototype.startIconZoom = function(scaleX, scaleY, duration) {
  1404.     if (this._popIconSprite) {
  1405.         this._popIconSprite.startZoom(scaleX, scaleY, duration);
  1406.     }
  1407. };

  1408. Sprite_Battler.prototype.startEcho = function() {
  1409.     if (!this._echoSprites) {
  1410.         var sprites = [];
  1411.         for (var i = 0; i < 3; i++) {
  1412.             sprites[i] = new Sprite();
  1413.             sprites[i].anchor.x = 0.5;
  1414.             sprites[i].anchor.y = 1;
  1415.             sprites[i].setColorTone([-96, -96, 96, 0]);
  1416.             sprites[i].opacity = 160;
  1417.             sprites[i].cbZ = 15;
  1418.             this.parent.addChild(sprites[i]);
  1419.         }
  1420.         this._echoSprites = sprites;
  1421.         this._echoData = [];
  1422.     }
  1423. };

  1424. Sprite_Battler.prototype.endEcho = function() {
  1425.     if (this._echoSprites) {
  1426.         var sprites = this._echoSprites;
  1427.         for (var i = 0; i < sprites.length; i++) {
  1428.             this.parent.removeChild(sprites[i]);
  1429.         }
  1430.         this._echoSprites = null;
  1431.         this._echoData = null;
  1432.     }
  1433. };

  1434. Sprite_Battler.prototype.updateEcho = function() {
  1435.     if (this._echoSprites) {
  1436.         var sprites = this._echoSprites;
  1437.         for (var i = 0; i < sprites.length; i++) {
  1438.             this.setEchoData(sprites[i], this._echoData[i * 5 + 5]);
  1439.         }
  1440.         this._echoData.unshift(this.createEchoData());
  1441.         if (this._echoData.length > 18) {
  1442.             this._echoData.pop();
  1443.         }
  1444.     }
  1445. };

  1446. Sprite_Battler.prototype.setEchoData = function(sprite, data) {
  1447. };

  1448. Sprite_Battler.prototype.createEchoData = function() {
  1449. };

  1450. Sprite_Battler.prototype.startEnclose = function(speed, type, base, dir, xRate, yRate) {
  1451.     this._encloseSpeed = speed;
  1452.     if (type === undefined) type = 0;
  1453.     if (base === undefined) base = -2;
  1454.     if (dir === undefined) dir = -2;
  1455.     if (xRate === undefined) xRate = 1;
  1456.     if (yRate === undefined) yRate = 1;
  1457.     var character = this.getCharacter(dir);
  1458.     this._encloseSpeed = speed * (character ? character.directionSign() : 1);
  1459.     this._encloseType = type;
  1460.     this._encloseBaseCharacter = this.getCharacter(base) || this;
  1461.     this._encloseXRate = xRate;
  1462.     this._encloseYRate = yRate;
  1463.     if (xRate && yRate) {
  1464.         this._encloseAngle = 0;
  1465.         this._encloseDistance = 0;
  1466.     } else {
  1467.         var character = this._encloseBaseCharacter;
  1468.         if (this._encloseType === 0) {
  1469.             var dx = (this.moveX() - character.homeX()) * this._encloseXRate;
  1470.             var dy = (this.moveY() - character.homeY()) * this._encloseYRate;
  1471.         } else {
  1472.             var dx = (this.moveX() - character.realX()) * this._encloseXRate;
  1473.             var dy = (this.moveY() - character.realY()) * this._encloseYRate;
  1474.         }
  1475.         if (dx || dy) {
  1476.             this._encloseAngle = Math.atan2(dx, dy) * 180 / Math.PI;
  1477.             this._encloseDistance = -dx || -dy;
  1478.         } else {
  1479.             this._encloseAngle = 0;
  1480.             this._encloseDistance = 0;
  1481.         }
  1482.     }
  1483. };

  1484. Sprite_Battler.prototype.updateEnclose = function() {
  1485.     if (this._encloseSpeed !== 0) {
  1486.         var character = this._encloseBaseCharacter;
  1487.         var radian, distance;
  1488.         if (this._encloseXRate && this._encloseYRate) {
  1489.             if (this._encloseType === 0) {
  1490.                 var dx = (this.realX() - character.homeX()) / this._encloseXRate;
  1491.                 var dy = (this.realY() - character.homeY()) / this._encloseYRate;
  1492.             } else {
  1493.                 var dx = (this.realX() - character.realX()) / this._encloseXRate;
  1494.                 var dy = (this.realY() - character.realY()) / this._encloseYRate;
  1495.             }
  1496.             if (dx || dy) {
  1497.                 radian = Math.atan2(dx, dy) - this._encloseSpeed * Math.PI / 180;
  1498.                 distance = Math.sqrt(dx * dx + dy * dy);
  1499.             } else {
  1500.                 radian = 0;
  1501.                 distance = 0;
  1502.             }
  1503.         } else {
  1504.             this._encloseAngle -= this._encloseSpeed;
  1505.             this._encloseAngle = this._encloseAngle.mod(360);
  1506.             radian = this._encloseAngle * Math.PI / 180;
  1507.             distance = this._encloseDistance;
  1508.         }
  1509.         var ox = distance * Math.sin(radian) * this._encloseXRate;
  1510.         var oy = distance * Math.cos(radian) * this._encloseYRate;
  1511.         this._offsetX = ox + character.homeX() - this.homeX();
  1512.         this._offsetY = oy + character.homeY() - this.homeY();
  1513.     }
  1514. };

  1515. //-----------------------------------------------------------------------------
  1516. // Sprite_Actor

  1517. //39
  1518. Alias.SpAc_initMembers = Sprite_Actor.prototype.initMembers;
  1519. Sprite_Actor.prototype.initMembers = function() {
  1520.     Alias.SpAc_initMembers.call(this);
  1521.     this._motionSpeed = 0;
  1522.     this._motionRestore = true;
  1523.     this._direction = 4;
  1524. };

  1525. //91
  1526. Sprite_Actor.prototype.moveToStartPosition = function() {
  1527. };

  1528. //107
  1529. Alias.SpAc_updateShadow = Sprite_Actor.prototype.updateShadow;
  1530. Sprite_Actor.prototype.updateShadow = function() {
  1531.     Alias.SpAc_updateShadow.call(this);
  1532.     this._shadowSprite.visible = this._shadowSprite.visible && this._shadowVisible;
  1533.     this._shadowSprite.y = this.jumpHeight() + this._altitude;
  1534. };

  1535. Sprite_Actor.prototype.startWeaponAnimation = function(imageId, wait) {
  1536.     this._weaponSprite.setup(imageId, wait);
  1537. };

  1538. //132
  1539. Alias.SpAc_startMotion = Sprite_Actor.prototype.startMotion;
  1540. Sprite_Actor.prototype.startMotion = function(motionType, loopType, speed, restore) {
  1541.     if (loopType === undefined) loopType = false;
  1542.     if (speed === undefined) speed = 12;
  1543.     if (restore === undefined) restore = true;
  1544.     if (typeof motionType === "string") {
  1545.         var lastMotion = this._motion;
  1546.         Alias.SpAc_startMotion.call(this, motionType);
  1547.         if (lastMotion !== this._motion) {
  1548.             this._motionSpeed = 12;
  1549.             this._motionRestore = true;
  1550.         }
  1551.     } else {
  1552.         this._motion = { index: motionType,  loop: loopType  };
  1553.         this._motionSpeed = speed;
  1554.         this._motionRestore = restore;
  1555.         this._motionCount = 0;
  1556.         this._pattern = 0;
  1557.     }
  1558. };

  1559. Sprite_Battler.prototype.startWeapon = function(weaponImageId, rate) {
  1560.     this._weaponSprite.setup(weaponImageId, rate);
  1561. };

  1562. //141
  1563. Sprite_Actor.prototype.updateTargetPosition = function() {
  1564. };

  1565. //191
  1566. Sprite_Actor.prototype.updateMotionCount = function() {
  1567.     if (this._motion && this._motionAnime && this.motionSpeed() > 0 &&
  1568.             ++this._motionCount >= this.motionSpeed()) {
  1569.         if (this._motion.loop) {
  1570.             this._pattern = (this._pattern + 1) % 4;
  1571.         } else if (this._pattern < 2) {
  1572.             this._pattern++;
  1573.         } else if (this._motionRestore) {
  1574.             this.refreshMotion();
  1575.         }
  1576.         this._motionCount = 0;
  1577.     }
  1578. };

  1579. //204
  1580. Sprite_Actor.prototype.motionSpeed = function() {
  1581.     return this._motionSpeed;
  1582. };

  1583. //208
  1584. Sprite_Actor.prototype.refreshMotion = function() {
  1585.     if (!this._interpreter.isRunning()) {
  1586.         this.setCommon(MPPlugin.actorRefresh, 'cbRefreshId');
  1587.     }
  1588. };

  1589. //234
  1590. Sprite_Actor.prototype.startEntryMotion = function() {
  1591. };

  1592. Sprite_Actor.prototype.isMirror = function() {
  1593.     return this._direction === 6;
  1594. };

  1595. //256
  1596. Sprite_Actor.prototype.onMoveEnd = function() {
  1597.     Sprite_Battler.prototype.onMoveEnd.call(this);
  1598. };

  1599. //263
  1600. Alias.SpAc_damageOffsetX = Sprite_Actor.prototype.damageOffsetX;
  1601. Sprite_Actor.prototype.damageOffsetX = function() {
  1602.     return Alias.SpAc_damageOffsetX.call(this) * -this.directionSign();
  1603. };

  1604. Sprite_Actor.prototype.setEchoData = function(sprite, data) {
  1605.     if (data) {
  1606.         var bitmap = data.bitmap;
  1607.         sprite.bitmap = bitmap;
  1608.         sprite.x = data.x;
  1609.         sprite.y = data.y;
  1610.         if (bitmap) {
  1611.             var motionIndex = data.index;
  1612.             var pattern = data.pattern;
  1613.             var cw = bitmap.width / 9;
  1614.             var ch = bitmap.height / 6;
  1615.             var cx = Math.floor(motionIndex / 6) * 3 + pattern;
  1616.             var cy = motionIndex % 6;
  1617.             sprite.setFrame(cx * cw, cy * ch, cw, ch);
  1618.         }
  1619.         sprite.scale = data.scale;
  1620.         sprite.rotation = data.rotation;
  1621.     }
  1622. };

  1623. Sprite_Actor.prototype.createEchoData = function() {
  1624.         return {
  1625.             bitmap:  this._mainSprite.bitmap,
  1626.             x:       this.x,
  1627.             y:       this.y,
  1628.             index:   this._motion ? this._motion.index : 0,
  1629.             pattern: this._pattern < 3 ? this._pattern : 1,
  1630.             scale:   this.scale.clone(),
  1631.             rotation:this.rotation
  1632.         };
  1633. };

  1634. //-----------------------------------------------------------------------------
  1635. // Sprite_Enemy

  1636. //940
  1637. Alias.SpEn_setBattler = Sprite_Enemy.prototype.setBattler;
  1638. Sprite_Enemy.prototype.setBattler = function(battler) {
  1639.     Alias.SpEn_setBattler.call(this, battler);
  1640.     this._direction = 6;
  1641. };

  1642. Sprite_Enemy.prototype.isMirror = function() {
  1643.     return this._direction === 4;
  1644. };

  1645. //943
  1646. Alias.SpEn_update = Sprite_Enemy.prototype.update;
  1647. Sprite_Enemy.prototype.update = function() {
  1648.     Alias.SpEn_update.call(this);
  1649.     if (this._enemy && this._enemy.isMotionRefreshRequested()) {
  1650.         this.refreshMotion();
  1651.         this._enemy.clearMotion();
  1652.     }
  1653. };

  1654. Sprite_Enemy.prototype.refreshMotion = function() {
  1655.     this.setCommon(MPPlugin.enemyRefresh, 'cbRefreshId');
  1656. };

  1657. Sprite_Enemy.prototype.setEchoData = function(sprite, data) {
  1658.     if (data) {
  1659.         sprite.bitmap = data.bitmap;
  1660.         sprite.x = this.xWithSign(data.x - this.x, -2);
  1661.         sprite.y = data.y - this.y;
  1662.         sprite.scale = data.scale;
  1663.         sprite.rotation = data.rotation;
  1664.     }
  1665. };

  1666. Sprite_Enemy.prototype.createEchoData = function() {
  1667.     return {
  1668.         bitmap:this.bitmap,
  1669.         x:     this.x,
  1670.         y:     this.y,
  1671.         scale:   this.scale.clone(),
  1672.         rotation:this.rotation
  1673.     };
  1674. };

  1675. //-----------------------------------------------------------------------------
  1676. // Sprite_Weapon

  1677. //13
  1678. Alias.SpWe_initialize = Sprite_Weapon.prototype.initialize;
  1679. Sprite_Weapon.prototype.initialize = function() {
  1680.     Alias.SpWe_initialize.call(this);
  1681.     this._animationWait = 12;
  1682.     this._weaponAnime = true;
  1683. };

  1684. //27
  1685. Alias.SpWe_setup = Sprite_Weapon.prototype.setup;
  1686. Sprite_Weapon.prototype.setup = function(weaponImageId, wait) {
  1687.     this._animationWait = wait || 12;
  1688.     Alias.SpWe_setup.call(this, weaponImageId);
  1689. };

  1690. //35
  1691. Sprite_Weapon.prototype.update = function() {
  1692.     Sprite_Base.prototype.update.call(this);
  1693.     if (this._weaponAnime) {
  1694.         this._animationCount++;
  1695.     }
  1696.     if (this._animationCount >= this.animationWait()) {
  1697.         this.updatePattern();
  1698.         this.updateFrame();
  1699.         this._animationCount = 0;
  1700.     }
  1701. };

  1702. //45
  1703. Sprite_Weapon.prototype.animationWait = function() {
  1704.     return this._animationWait;
  1705. };

  1706. //-----------------------------------------------------------------------------
  1707. // Sprite_PopIcon

  1708. function Sprite_PopIcon() {
  1709.     this.initialize.apply(this, arguments);
  1710. }

  1711. Sprite_PopIcon.prototype = Object.create(Sprite.prototype);
  1712. Sprite_PopIcon.prototype.constructor = Sprite_PopIcon;

  1713. Sprite_PopIcon.prototype.initialize = function() {
  1714.     Sprite.prototype.initialize.call(this);
  1715.     this.initMembers();
  1716.     this.loadBitmap();
  1717. };

  1718. Sprite_PopIcon.prototype.initMembers = function() {
  1719.     this._iconIndex = 0;
  1720.     this._targetX = 0;
  1721.     this._targetY = 0;
  1722.     this._moveDuration = 0;
  1723.     this._rotationSpeed = 0;
  1724.     this._targetScaleX = 1;
  1725.     this._targetScaleY = 1;
  1726.     this._scaleDuration = 0;
  1727.     this.anchor.x = 0.5;
  1728.     this.anchor.y = 0.5;
  1729. };

  1730. Sprite_PopIcon.prototype.loadBitmap = function() {
  1731.     this.bitmap = ImageManager.loadSystem(MPPlugin.iconSetName);
  1732.     this.setFrame(0, 0, 0, 0);
  1733. };

  1734. Sprite_PopIcon.prototype.setIcon = function(iconIndex) {
  1735.     this._iconIndex = iconIndex;
  1736.     this.updateFrame();
  1737. };

  1738. Sprite_PopIcon.prototype.startMove = function(x, y, duration) {
  1739.     this._targetX = x;
  1740.     this._targetY = y;
  1741.     this._moveDuration = duration;
  1742.     if (duration === 0) {
  1743.         this.x = x;
  1744.         this.y = y;
  1745.     }
  1746. };

  1747. Sprite_PopIcon.prototype.startRotation = function(speed) {
  1748.     this._rotationSpeed = speed * Math.PI / 180;
  1749. };

  1750. Sprite_PopIcon.prototype.startZoom = function(scaleX, scaleY, duration) {
  1751.     this._targetScaleX = scaleX;
  1752.     this._targetScaleY = scaleY;
  1753.     this._scaleDuration = duration;
  1754.     if (duration === 0) {
  1755.         this.scale.x = scaleX;
  1756.         this.scale.y = scaleY;
  1757.     }
  1758. };

  1759. Sprite_PopIcon.prototype.update = function() {
  1760.     Sprite.prototype.update.call(this);
  1761.     if (this._moveDuration > 0) {
  1762.         var d = this._moveDuration;
  1763.         this.x = (this.x * (d - 1) + this._targetX) / d;
  1764.         this.y = (this.y * (d - 1) + this._targetY) / d;
  1765.         this._moveDuration--;
  1766.     }
  1767.     if (this._rotationSpeed) {
  1768.         this.rotation = (this.rotation + this._rotationSpeed).mod(Math.PI * 2);
  1769.     }
  1770.     if (this._scaleDuration) {
  1771.         var d = this._scaleDuration;
  1772.         this.scale.x = (this.scale.x * (d - 1) + this._targetScaleX) / d;
  1773.         this.scale.y = (this.scale.y * (d - 1) + this._targetScaleY) / d;
  1774.         this._scaleDuration--;
  1775.     }
  1776. };

  1777. Sprite_PopIcon.prototype.updateFrame = function() {
  1778.     var pw = MPPlugin.iconWidth;
  1779.     var ph = MPPlugin.iconHeight;
  1780.     var sx = this._iconIndex % 16 * pw;
  1781.     var sy = Math.floor(this._iconIndex / 16) * ph;
  1782.     this.setFrame(sx, sy, pw, ph);
  1783. };


  1784. //-----------------------------------------------------------------------------
  1785. // Spriteset_Battle

  1786. //18
  1787. Alias.SpsetBa_createLowerLayer = Spriteset_Battle.prototype.createLowerLayer;
  1788. Spriteset_Battle.prototype.createLowerLayer = function() {
  1789.     Alias.SpsetBa_createLowerLayer.call(this);
  1790.     this.createEvents();
  1791.     this.setupCharacter();
  1792. };

  1793. Spriteset_Battle.prototype.createEvents = function() {
  1794.     this._eventSprites = [];
  1795.     for (var i = 0; i < MPPlugin.eventActors.length; i++) {
  1796.         var actor = $gameActors.actor(MPPlugin.eventActors[i]);
  1797.         if (actor) {
  1798.             this._eventSprites[i] = new Sprite_Actor(actor);
  1799.             this._eventSprites[i].shadowOff();
  1800.             this._battleField.addChild(this._eventSprites[i]);
  1801.         }
  1802.     }
  1803. };

  1804. Spriteset_Battle.prototype.setupCharacter = function() {
  1805.     for (var i = 0; i < this._actorSprites.length; i++) {
  1806.         ComBat.setCharacter(i + 1, this._actorSprites[i]);
  1807.     }
  1808.     for (var i = 0; i < this._enemySprites.length; i++) {
  1809.         var enemy = this._enemySprites[i]._enemy;
  1810.         ComBat.setCharacter(enemy.index() + 9, this._enemySprites[i]);
  1811.     }
  1812.     for (var i = 0; i < this._eventSprites.length; i++) {
  1813.         ComBat.setCharacter(i + 17, this._eventSprites[i]);
  1814.     }
  1815. };

  1816. //33
  1817. Alias.SpsetBa_update = Spriteset_Battle.prototype.update;
  1818. Spriteset_Battle.prototype.update = function() {
  1819.     Alias.SpsetBa_update.call(this);
  1820.     this.sortBfChildren();
  1821. };

  1822. //51
  1823. Alias.SpsetBa_createBattleback = Spriteset_Battle.prototype.createBattleback;
  1824. Spriteset_Battle.prototype.createBattleback = function() {
  1825.     Alias.SpsetBa_createBattleback.call(this);
  1826.     this._back1Sprite.cbZ = 10;
  1827.     this._back2Sprite.cbZ = 10;
  1828. };

  1829. Spriteset_Battle.prototype.sortBfChildren = function() {
  1830.     this._battleField.children.sort(this._compareChildOrder.bind(this));
  1831. };

  1832. Spriteset_Battle.prototype._compareChildOrder = function(a, b) {
  1833.     if (!a.cbZ) {
  1834.         return 1;
  1835.     } else if (!b.cbZ) {
  1836.         return -1;
  1837.     } else if (a.cbZ !== b.cbZ) {
  1838.         return a.cbZ - b.cbZ;
  1839.     } else if (a.y !== b.y) {
  1840.         return a.y - b.y;
  1841.     } else {
  1842.         return a.spriteId - b.spriteId;
  1843.     }
  1844. };

  1845. //-----------------------------------------------------------------------------
  1846. // Window_Message

  1847. //108
  1848. Alias.WiMe_updatePlacement = Window_Message.prototype.updatePlacement;
  1849. Window_Message.prototype.updatePlacement = function() {
  1850.     Alias.WiMe_updatePlacement.call(this);
  1851.     if ($gameParty.inBattle()) {
  1852.         if (this._positionType === 0) {
  1853.             this.height = this.fittingHeight(MPPlugin.upperMessageRow);
  1854.         } else {
  1855.             this.height = this.windowHeight();
  1856.         }
  1857.     }
  1858.     Alias.WiMe_updatePlacement.call(this);
  1859. };

  1860. //-----------------------------------------------------------------------------
  1861. // Scene_Battle

  1862. //29
  1863. Alias.ScBa_prototype = Scene_Battle.prototype.update;
  1864. Scene_Battle.prototype.update = function() {
  1865.     $gameTroop.updateInterpreter();
  1866.     Alias.ScBa_prototype.call(this);
  1867. };

  1868. //58
  1869. Alias.ScBa_changeInputWindow = Scene_Battle.prototype.changeInputWindow;
  1870. Scene_Battle.prototype.changeInputWindow = function() {
  1871.     if (!BattleManager._userWait) {
  1872.         Alias.ScBa_changeInputWindow.call(this);
  1873.     }
  1874. };

  1875. //82
  1876. Alias.ScBa_terminate = Scene_Battle.prototype.terminate;
  1877. Scene_Battle.prototype.terminate = function() {
  1878.     Alias.ScBa_terminate.call(this);
  1879.     ComBat.clearCharacter();
  1880. };

  1881. //94
  1882. Scene_Battle.prototype.updateStatusWindow = function() {
  1883.     if (BattleManager.isEvantWait()) {
  1884.         this._statusWindow.close();
  1885.         this._partyCommandWindow.close();
  1886.         this._actorCommandWindow.close();
  1887.     } else if (this.isActive() && !this._messageWindow.isClosing()) {
  1888.         this._statusWindow.open();
  1889.     }
  1890. };

  1891. })();
复制代码


回复

使用道具 举报

梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
 楼主| 发表于 2016-2-16 12:26:06 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

範例沒辦法下載

点评

范例可以下,在左上角 下载那个图标选项那里  发表于 2016-2-16 12:58
回复

使用道具 举报

梦石
0
星屑
497
在线时间
266 小时
注册时间
2015-12-8
回帖
729
 楼主| 发表于 2016-2-16 16:12:23 | 显示全部楼层
小叮鈴 发表于 2016-2-16 12:26
範例沒辦法下載

我知道阿,ダウンロード中文意思是下載 問題點了無法顯示網頁

点评

去下个翻墙软件,推荐Lantern,方便快捷,找准正版,很多第三方带插件的  发表于 2016-2-18 23:47
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-2-20 13:06:37 | 显示全部楼层
本帖最后由 tseyik 于 2016-2-20 16:14 编辑

サイドビューのアクター配置設定
http://i.gmobb.jp/nekoma/rpg_tkool/
@help
* プラグインコマンド:
*   SetActorHomeX 式        # 角色X座標的計算式。
*   SetActorHomeY 式        # 角色Y座標的計算式。
*
* プラグインコマンド例:
*   SetActorHomeX 600 + index * 32
*   : 式中用index、自動計算各個角色的数値
*   : 先頭角色為「0番目」、以降+1。
*
* プラグインコマンド例(応用編):
*   SetActorHomeX (index == 0) ? 100 : 200
*   : 「indexが0時為100。以外為200」
*   
*   SetActorHomeX (index == 0 || index == 1) ? 100 : 200
*   : 「indexが0和1時為100。以外為200」
*   
*   SetActorHomeX (index == 0) ? 100 : (index == 1) ? 200 : 300
*   : 「indexが0時為100。indexが1時為200。以外為300」
*/
例
Cbnu1p-UEAEF-bA.png
Cbnu1puVAAADF-s.png







回复

使用道具 举报

梦石
0
星屑
50
在线时间
44 小时
注册时间
2015-12-27
回帖
42
发表于 2016-2-22 09:09:04 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

这个插件好
回复

使用道具 举报

梦石
0
星屑
1225
在线时间
564 小时
注册时间
2014-11-30
回帖
126
发表于 2016-3-28 22:29:49 | 显示全部楼层
tseyik 发表于 2016-2-16 10:19
事件戦鬥
可和同作者的ATB戦鬥併用
Released under the MIT license

不会用这个,不会怎么设置坐标,按你上面的公式也搞不对,在范本里一关闭ATB脚本就错,我不想用ATB的,自己无法单独使用这个坐标脚本,能不能写个使用方法出来,非常需要这个脚本
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部