查看: 2813|回复: 5

[胡扯] 我想看看RMMZ的代码片段,找找和老版的区别。谁能贴一下?

[复制链接]
梦石
0
星屑
5615
在线时间
2571 小时
注册时间
2011-9-27
回帖
1059

极短23参与开拓者

发表于 2020-8-22 07:34:05 | 显示全部楼层 |阅读模式

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

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

×
谁买了MZ了,贴出代码让我看看呗。

别的不看了,就关心
最经典的事件解析类:
Game_Interpreter

看了这个,就了解一大半的内部操作了。

从平淡走向更平淡。
梦石
0
星屑
1919
在线时间
404 小时
注册时间
2014-7-7
回帖
209

开拓者

发表于 2020-8-22 08:02:35 | 显示全部楼层
本帖最后由 kklt 于 2020-8-22 08:06 编辑

有测试版可以下。
[fold=code]
  1. //-----------------------------------------------------------------------------
  2. // Game_Interpreter
  3. //
  4. // The interpreter for running event commands.

  5. function Game_Interpreter() {
  6.     this.initialize(...arguments);
  7. }

  8. Game_Interpreter.prototype.initialize = function(depth) {
  9.     this._depth = depth || 0;
  10.     this.checkOverflow();
  11.     this.clear();
  12.     this._branch = {};
  13.     this._indent = 0;
  14.     this._frameCount = 0;
  15.     this._freezeChecker = 0;
  16. };

  17. Game_Interpreter.prototype.checkOverflow = function() {
  18.     if (this._depth >= 100) {
  19.         throw new Error("Common event calls exceeded the limit");
  20.     }
  21. };

  22. Game_Interpreter.prototype.clear = function() {
  23.     this._mapId = 0;
  24.     this._eventId = 0;
  25.     this._list = null;
  26.     this._index = 0;
  27.     this._waitCount = 0;
  28.     this._waitMode = "";
  29.     this._comments = "";
  30.     this._characterId = 0;
  31.     this._childInterpreter = null;
  32. };

  33. Game_Interpreter.prototype.setup = function(list, eventId) {
  34.     this.clear();
  35.     this._mapId = $gameMap.mapId();
  36.     this._eventId = eventId || 0;
  37.     this._list = list;
  38.     this.loadImages();
  39. };

  40. Game_Interpreter.prototype.loadImages = function() {
  41.     // [Note] The certain versions of MV had a more complicated preload scheme.
  42.     //   However it is usually sufficient to preload face and picture images.
  43.     const list = this._list.slice(0, 200);
  44.     for (const command of list) {
  45.         switch (command.code) {
  46.             case 101: // Show Text
  47.                 ImageManager.loadFace(command.parameters[0]);
  48.                 break;
  49.             case 231: // Show Picture
  50.                 ImageManager.loadPicture(command.parameters[1]);
  51.                 break;
  52.         }
  53.     }
  54. };

  55. Game_Interpreter.prototype.eventId = function() {
  56.     return this._eventId;
  57. };

  58. Game_Interpreter.prototype.isOnCurrentMap = function() {
  59.     return this._mapId === $gameMap.mapId();
  60. };

  61. Game_Interpreter.prototype.setupReservedCommonEvent = function() {
  62.     if ($gameTemp.isCommonEventReserved()) {
  63.         const commonEvent = $gameTemp.retrieveCommonEvent();
  64.         if (commonEvent) {
  65.             this.setup(commonEvent.list);
  66.             return true;
  67.         }
  68.     }
  69.     return false;
  70. };

  71. Game_Interpreter.prototype.isRunning = function() {
  72.     return !!this._list;
  73. };

  74. Game_Interpreter.prototype.update = function() {
  75.     while (this.isRunning()) {
  76.         if (this.updateChild() || this.updateWait()) {
  77.             break;
  78.         }
  79.         if (SceneManager.isSceneChanging()) {
  80.             break;
  81.         }
  82.         if (!this.executeCommand()) {
  83.             break;
  84.         }
  85.         if (this.checkFreeze()) {
  86.             break;
  87.         }
  88.     }
  89. };

  90. Game_Interpreter.prototype.updateChild = function() {
  91.     if (this._childInterpreter) {
  92.         this._childInterpreter.update();
  93.         if (this._childInterpreter.isRunning()) {
  94.             return true;
  95.         } else {
  96.             this._childInterpreter = null;
  97.         }
  98.     }
  99.     return false;
  100. };

  101. Game_Interpreter.prototype.updateWait = function() {
  102.     return this.updateWaitCount() || this.updateWaitMode();
  103. };

  104. Game_Interpreter.prototype.updateWaitCount = function() {
  105.     if (this._waitCount > 0) {
  106.         this._waitCount--;
  107.         return true;
  108.     }
  109.     return false;
  110. };

  111. Game_Interpreter.prototype.updateWaitMode = function() {
  112.     let character = null;
  113.     let waiting = false;
  114.     switch (this._waitMode) {
  115.         case "message":
  116.             waiting = $gameMessage.isBusy();
  117.             break;
  118.         case "transfer":
  119.             waiting = $gamePlayer.isTransferring();
  120.             break;
  121.         case "scroll":
  122.             waiting = $gameMap.isScrolling();
  123.             break;
  124.         case "route":
  125.             character = this.character(this._characterId);
  126.             waiting = character && character.isMoveRouteForcing();
  127.             break;
  128.         case "animation":
  129.             character = this.character(this._characterId);
  130.             waiting = character && character.isAnimationPlaying();
  131.             break;
  132.         case "balloon":
  133.             character = this.character(this._characterId);
  134.             waiting = character && character.isBalloonPlaying();
  135.             break;
  136.         case "gather":
  137.             waiting = $gamePlayer.areFollowersGathering();
  138.             break;
  139.         case "action":
  140.             waiting = BattleManager.isActionForced();
  141.             break;
  142.         case "video":
  143.             waiting = Video.isPlaying();
  144.             break;
  145.         case "image":
  146.             waiting = !ImageManager.isReady();
  147.             break;
  148.     }
  149.     if (!waiting) {
  150.         this._waitMode = "";
  151.     }
  152.     return waiting;
  153. };

  154. Game_Interpreter.prototype.setWaitMode = function(waitMode) {
  155.     this._waitMode = waitMode;
  156. };

  157. Game_Interpreter.prototype.wait = function(duration) {
  158.     this._waitCount = duration;
  159. };

  160. Game_Interpreter.prototype.fadeSpeed = function() {
  161.     return 24;
  162. };

  163. Game_Interpreter.prototype.executeCommand = function() {
  164.     const command = this.currentCommand();
  165.     if (command) {
  166.         this._indent = command.indent;
  167.         const methodName = "command" + command.code;
  168.         if (typeof this[methodName] === "function") {
  169.             if (!this[methodName](command.parameters)) {
  170.                 return false;
  171.             }
  172.         }
  173.         this._index++;
  174.     } else {
  175.         this.terminate();
  176.     }
  177.     return true;
  178. };

  179. Game_Interpreter.prototype.checkFreeze = function() {
  180.     if (this._frameCount !== Graphics.frameCount) {
  181.         this._frameCount = Graphics.frameCount;
  182.         this._freezeChecker = 0;
  183.     }
  184.     if (this._freezeChecker++ >= 100000) {
  185.         return true;
  186.     } else {
  187.         return false;
  188.     }
  189. };

  190. Game_Interpreter.prototype.terminate = function() {
  191.     this._list = null;
  192.     this._comments = "";
  193. };

  194. Game_Interpreter.prototype.skipBranch = function() {
  195.     while (this._list[this._index + 1].indent > this._indent) {
  196.         this._index++;
  197.     }
  198. };

  199. Game_Interpreter.prototype.currentCommand = function() {
  200.     return this._list[this._index];
  201. };

  202. Game_Interpreter.prototype.nextEventCode = function() {
  203.     const command = this._list[this._index + 1];
  204.     if (command) {
  205.         return command.code;
  206.     } else {
  207.         return 0;
  208.     }
  209. };

  210. Game_Interpreter.prototype.iterateActorId = function(param, callback) {
  211.     if (param === 0) {
  212.         $gameParty.members().forEach(callback);
  213.     } else {
  214.         const actor = $gameActors.actor(param);
  215.         if (actor) {
  216.             callback(actor);
  217.         }
  218.     }
  219. };

  220. Game_Interpreter.prototype.iterateActorEx = function(param1, param2, callback) {
  221.     if (param1 === 0) {
  222.         this.iterateActorId(param2, callback);
  223.     } else {
  224.         this.iterateActorId($gameVariables.value(param2), callback);
  225.     }
  226. };

  227. Game_Interpreter.prototype.iterateActorIndex = function(param, callback) {
  228.     if (param < 0) {
  229.         $gameParty.members().forEach(callback);
  230.     } else {
  231.         const actor = $gameParty.members()[param];
  232.         if (actor) {
  233.             callback(actor);
  234.         }
  235.     }
  236. };

  237. Game_Interpreter.prototype.iterateEnemyIndex = function(param, callback) {
  238.     if (param < 0) {
  239.         $gameTroop.members().forEach(callback);
  240.     } else {
  241.         const enemy = $gameTroop.members()[param];
  242.         if (enemy) {
  243.             callback(enemy);
  244.         }
  245.     }
  246. };

  247. Game_Interpreter.prototype.iterateBattler = function(param1, param2, callback) {
  248.     if ($gameParty.inBattle()) {
  249.         if (param1 === 0) {
  250.             this.iterateEnemyIndex(param2, callback);
  251.         } else {
  252.             this.iterateActorId(param2, callback);
  253.         }
  254.     }
  255. };

  256. Game_Interpreter.prototype.character = function(param) {
  257.     if ($gameParty.inBattle()) {
  258.         return null;
  259.     } else if (param < 0) {
  260.         return $gamePlayer;
  261.     } else if (this.isOnCurrentMap()) {
  262.         return $gameMap.event(param > 0 ? param : this._eventId);
  263.     } else {
  264.         return null;
  265.     }
  266. };

  267. // prettier-ignore
  268. Game_Interpreter.prototype.operateValue = function(
  269.     operation, operandType, operand
  270. ) {
  271.     const value = operandType === 0 ? operand : $gameVariables.value(operand);
  272.     return operation === 0 ? value : -value;
  273. };

  274. Game_Interpreter.prototype.changeHp = function(target, value, allowDeath) {
  275.     if (target.isAlive()) {
  276.         if (!allowDeath && target.hp <= -value) {
  277.             value = 1 - target.hp;
  278.         }
  279.         target.gainHp(value);
  280.         if (target.isDead()) {
  281.             target.performCollapse();
  282.         }
  283.     }
  284. };

  285. // Show Text
  286. Game_Interpreter.prototype.command101 = function(params) {
  287.     if ($gameMessage.isBusy()) {
  288.         return false;
  289.     }
  290.     $gameMessage.setFaceImage(params[0], params[1]);
  291.     $gameMessage.setBackground(params[2]);
  292.     $gameMessage.setPositionType(params[3]);
  293.     $gameMessage.setSpeakerName(params[4]);
  294.     while (this.nextEventCode() === 401) {
  295.         // Text data
  296.         this._index++;
  297.         $gameMessage.add(this.currentCommand().parameters[0]);
  298.     }
  299.     switch (this.nextEventCode()) {
  300.         case 102: // Show Choices
  301.             this._index++;
  302.             this.setupChoices(this.currentCommand().parameters);
  303.             break;
  304.         case 103: // Input Number
  305.             this._index++;
  306.             this.setupNumInput(this.currentCommand().parameters);
  307.             break;
  308.         case 104: // Select Item
  309.             this._index++;
  310.             this.setupItemChoice(this.currentCommand().parameters);
  311.             break;
  312.     }
  313.     this.setWaitMode("message");
  314.     return true;
  315. };

  316. // Show Choices
  317. Game_Interpreter.prototype.command102 = function(params) {
  318.     if ($gameMessage.isBusy()) {
  319.         return false;
  320.     }
  321.     this.setupChoices(params);
  322.     this.setWaitMode("message");
  323.     return true;
  324. };

  325. Game_Interpreter.prototype.setupChoices = function(params) {
  326.     const choices = params[0].clone();
  327.     const cancelType = params[1] < choices.length ? params[1] : -2;
  328.     const defaultType = params.length > 2 ? params[2] : 0;
  329.     const positionType = params.length > 3 ? params[3] : 2;
  330.     const background = params.length > 4 ? params[4] : 0;
  331.     $gameMessage.setChoices(choices, defaultType, cancelType);
  332.     $gameMessage.setChoiceBackground(background);
  333.     $gameMessage.setChoicePositionType(positionType);
  334.     $gameMessage.setChoiceCallback(n => {
  335.         this._branch[this._indent] = n;
  336.     });
  337. };

  338. // When [**]
  339. Game_Interpreter.prototype.command402 = function(params) {
  340.     if (this._branch[this._indent] !== params[0]) {
  341.         this.skipBranch();
  342.     }
  343.     return true;
  344. };

  345. // When Cancel
  346. Game_Interpreter.prototype.command403 = function() {
  347.     if (this._branch[this._indent] >= 0) {
  348.         this.skipBranch();
  349.     }
  350.     return true;
  351. };

  352. // Input Number
  353. Game_Interpreter.prototype.command103 = function(params) {
  354.     if ($gameMessage.isBusy()) {
  355.         return false;
  356.     }
  357.     this.setupNumInput(params);
  358.     this.setWaitMode("message");
  359.     return true;
  360. };

  361. Game_Interpreter.prototype.setupNumInput = function(params) {
  362.     $gameMessage.setNumberInput(params[0], params[1]);
  363. };

  364. // Select Item
  365. Game_Interpreter.prototype.command104 = function(params) {
  366.     if ($gameMessage.isBusy()) {
  367.         return false;
  368.     }
  369.     this.setupItemChoice(params);
  370.     this.setWaitMode("message");
  371.     return true;
  372. };

  373. Game_Interpreter.prototype.setupItemChoice = function(params) {
  374.     $gameMessage.setItemChoice(params[0], params[1] || 2);
  375. };

  376. // Show Scrolling Text
  377. Game_Interpreter.prototype.command105 = function(params) {
  378.     if ($gameMessage.isBusy()) {
  379.         return false;
  380.     }
  381.     $gameMessage.setScroll(params[0], params[1]);
  382.     while (this.nextEventCode() === 405) {
  383.         this._index++;
  384.         $gameMessage.add(this.currentCommand().parameters[0]);
  385.     }
  386.     this.setWaitMode("message");
  387.     return true;
  388. };

  389. // Comment
  390. Game_Interpreter.prototype.command108 = function(params) {
  391.     this._comments = [params[0]];
  392.     while (this.nextEventCode() === 408) {
  393.         this._index++;
  394.         this._comments.push(this.currentCommand().parameters[0]);
  395.     }
  396.     return true;
  397. };

  398. // Conditional Branch
  399. Game_Interpreter.prototype.command111 = function(params) {
  400.     let result = false;
  401.     let value1, value2;
  402.     let actor, enemy, character;
  403.     switch (params[0]) {
  404.         case 0: // Switch
  405.             result = $gameSwitches.value(params[1]) === (params[2] === 0);
  406.             break;
  407.         case 1: // Variable
  408.             value1 = $gameVariables.value(params[1]);
  409.             if (params[2] === 0) {
  410.                 value2 = params[3];
  411.             } else {
  412.                 value2 = $gameVariables.value(params[3]);
  413.             }
  414.             switch (params[4]) {
  415.                 case 0: // Equal to
  416.                     result = value1 === value2;
  417.                     break;
  418.                 case 1: // Greater than or Equal to
  419.                     result = value1 >= value2;
  420.                     break;
  421.                 case 2: // Less than or Equal to
  422.                     result = value1 <= value2;
  423.                     break;
  424.                 case 3: // Greater than
  425.                     result = value1 > value2;
  426.                     break;
  427.                 case 4: // Less than
  428.                     result = value1 < value2;
  429.                     break;
  430.                 case 5: // Not Equal to
  431.                     result = value1 !== value2;
  432.                     break;
  433.             }
  434.             break;
  435.         case 2: // Self Switch
  436.             if (this._eventId > 0) {
  437.                 const key = [this._mapId, this._eventId, params[1]];
  438.                 result = $gameSelfSwitches.value(key) === (params[2] === 0);
  439.             }
  440.             break;
  441.         case 3: // Timer
  442.             if ($gameTimer.isWorking()) {
  443.                 if (params[2] === 0) {
  444.                     result = $gameTimer.seconds() >= params[1];
  445.                 } else {
  446.                     result = $gameTimer.seconds() <= params[1];
  447.                 }
  448.             }
  449.             break;
  450.         case 4: // Actor
  451.             actor = $gameActors.actor(params[1]);
  452.             if (actor) {
  453.                 const n = params[3];
  454.                 switch (params[2]) {
  455.                     case 0: // In the Party
  456.                         result = $gameParty.members().includes(actor);
  457.                         break;
  458.                     case 1: // Name
  459.                         result = actor.name() === n;
  460.                         break;
  461.                     case 2: // Class
  462.                         result = actor.isClass($dataClasses[n]);
  463.                         break;
  464.                     case 3: // Skill
  465.                         result = actor.hasSkill(n);
  466.                         break;
  467.                     case 4: // Weapon
  468.                         result = actor.hasWeapon($dataWeapons[n]);
  469.                         break;
  470.                     case 5: // Armor
  471.                         result = actor.hasArmor($dataArmors[n]);
  472.                         break;
  473.                     case 6: // State
  474.                         result = actor.isStateAffected(n);
  475.                         break;
  476.                 }
  477.             }
  478.             break;
  479.         case 5: // Enemy
  480.             enemy = $gameTroop.members()[params[1]];
  481.             if (enemy) {
  482.                 switch (params[2]) {
  483.                     case 0: // Appeared
  484.                         result = enemy.isAlive();
  485.                         break;
  486.                     case 1: // State
  487.                         result = enemy.isStateAffected(params[3]);
  488.                         break;
  489.                 }
  490.             }
  491.             break;
  492.         case 6: // Character
  493.             character = this.character(params[1]);
  494.             if (character) {
  495.                 result = character.direction() === params[2];
  496.             }
  497.             break;
  498.         case 7: // Gold
  499.             switch (params[2]) {
  500.                 case 0: // Greater than or equal to
  501.                     result = $gameParty.gold() >= params[1];
  502.                     break;
  503.                 case 1: // Less than or equal to
  504.                     result = $gameParty.gold() <= params[1];
  505.                     break;
  506.                 case 2: // Less than
  507.                     result = $gameParty.gold() < params[1];
  508.                     break;
  509.             }
  510.             break;
  511.         case 8: // Item
  512.             result = $gameParty.hasItem($dataItems[params[1]]);
  513.             break;
  514.         case 9: // Weapon
  515.             result = $gameParty.hasItem($dataWeapons[params[1]], params[2]);
  516.             break;
  517.         case 10: // Armor
  518.             result = $gameParty.hasItem($dataArmors[params[1]], params[2]);
  519.             break;
  520.         case 11: // Button
  521.             switch (params[2] || 0) {
  522.                 case 0:
  523.                     result = Input.isPressed(params[1]);
  524.                     break;
  525.                 case 1:
  526.                     result = Input.isTriggered(params[1]);
  527.                     break;
  528.                 case 2:
  529.                     result = Input.isRepeated(params[1]);
  530.                     break;
  531.             }
  532.             break;
  533.         case 12: // Script
  534.             result = !!eval(params[1]);
  535.             break;
  536.         case 13: // Vehicle
  537.             result = $gamePlayer.vehicle() === $gameMap.vehicle(params[1]);
  538.             break;
  539.     }
  540.     this._branch[this._indent] = result;
  541.     if (this._branch[this._indent] === false) {
  542.         this.skipBranch();
  543.     }
  544.     return true;
  545. };

  546. // Else
  547. Game_Interpreter.prototype.command411 = function() {
  548.     if (this._branch[this._indent] !== false) {
  549.         this.skipBranch();
  550.     }
  551.     return true;
  552. };

  553. // Loop
  554. Game_Interpreter.prototype.command112 = function() {
  555.     return true;
  556. };

  557. // Repeat Above
  558. Game_Interpreter.prototype.command413 = function() {
  559.     do {
  560.         this._index--;
  561.     } while (this.currentCommand().indent !== this._indent);
  562.     return true;
  563. };

  564. // Break Loop
  565. Game_Interpreter.prototype.command113 = function() {
  566.     let depth = 0;
  567.     while (this._index < this._list.length - 1) {
  568.         this._index++;
  569.         const command = this.currentCommand();
  570.         if (command.code === 112) {
  571.             depth++;
  572.         }
  573.         if (command.code === 413) {
  574.             if (depth > 0) {
  575.                 depth--;
  576.             } else {
  577.                 break;
  578.             }
  579.         }
  580.     }
  581.     return true;
  582. };

  583. // Exit Event Processing
  584. Game_Interpreter.prototype.command115 = function() {
  585.     this._index = this._list.length;
  586.     return true;
  587. };

  588. // Common Event
  589. Game_Interpreter.prototype.command117 = function(params) {
  590.     const commonEvent = $dataCommonEvents[params[0]];
  591.     if (commonEvent) {
  592.         const eventId = this.isOnCurrentMap() ? this._eventId : 0;
  593.         this.setupChild(commonEvent.list, eventId);
  594.     }
  595.     return true;
  596. };

  597. Game_Interpreter.prototype.setupChild = function(list, eventId) {
  598.     this._childInterpreter = new Game_Interpreter(this._depth + 1);
  599.     this._childInterpreter.setup(list, eventId);
  600. };

  601. // Label
  602. Game_Interpreter.prototype.command118 = function() {
  603.     return true;
  604. };

  605. // Jump to Label
  606. Game_Interpreter.prototype.command119 = function(params) {
  607.     const labelName = params[0];
  608.     for (let i = 0; i < this._list.length; i++) {
  609.         const command = this._list[i];
  610.         if (command.code === 118 && command.parameters[0] === labelName) {
  611.             this.jumpTo(i);
  612.             return;
  613.         }
  614.     }
  615.     return true;
  616. };

  617. Game_Interpreter.prototype.jumpTo = function(index) {
  618.     const lastIndex = this._index;
  619.     const startIndex = Math.min(index, lastIndex);
  620.     const endIndex = Math.max(index, lastIndex);
  621.     let indent = this._indent;
  622.     for (let i = startIndex; i <= endIndex; i++) {
  623.         const newIndent = this._list[i].indent;
  624.         if (newIndent !== indent) {
  625.             this._branch[indent] = null;
  626.             indent = newIndent;
  627.         }
  628.     }
  629.     this._index = index;
  630. };

  631. // Control Switches
  632. Game_Interpreter.prototype.command121 = function(params) {
  633.     for (let i = params[0]; i <= params[1]; i++) {
  634.         $gameSwitches.setValue(i, params[2] === 0);
  635.     }
  636.     return true;
  637. };

  638. // Control Variables
  639. Game_Interpreter.prototype.command122 = function(params) {
  640.     const startId = params[0];
  641.     const endId = params[1];
  642.     const operationType = params[2];
  643.     const operand = params[3];
  644.     let value = 0;
  645.     let randomMax = 1;
  646.     switch (operand) {
  647.         case 0: // Constant
  648.             value = params[4];
  649.             break;
  650.         case 1: // Variable
  651.             value = $gameVariables.value(params[4]);
  652.             break;
  653.         case 2: // Random
  654.             value = params[4];
  655.             randomMax = params[5] - params[4] + 1;
  656.             randomMax = Math.max(randomMax, 1);
  657.             break;
  658.         case 3: // Game Data
  659.             value = this.gameDataOperand(params[4], params[5], params[6]);
  660.             break;
  661.         case 4: // Script
  662.             value = eval(params[4]);
  663.             break;
  664.     }
  665.     for (let i = startId; i <= endId; i++) {
  666.         if (typeof value === "number") {
  667.             const realValue = value + Math.randomInt(randomMax);
  668.             this.operateVariable(i, operationType, realValue);
  669.         } else {
  670.             this.operateVariable(i, operationType, value);
  671.         }
  672.     }
  673.     return true;
  674. };

  675. Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) {
  676.     let actor, enemy, character;
  677.     switch (type) {
  678.         case 0: // Item
  679.             return $gameParty.numItems($dataItems[param1]);
  680.         case 1: // Weapon
  681.             return $gameParty.numItems($dataWeapons[param1]);
  682.         case 2: // Armor
  683.             return $gameParty.numItems($dataArmors[param1]);
  684.         case 3: // Actor
  685.             actor = $gameActors.actor(param1);
  686.             if (actor) {
  687.                 switch (param2) {
  688.                     case 0: // Level
  689.                         return actor.level;
  690.                     case 1: // EXP
  691.                         return actor.currentExp();
  692.                     case 2: // HP
  693.                         return actor.hp;
  694.                     case 3: // MP
  695.                         return actor.mp;
  696.                     case 12: // TP
  697.                         return actor.tp;
  698.                     default:
  699.                         // Parameter
  700.                         if (param2 >= 4 && param2 <= 11) {
  701.                             return actor.param(param2 - 4);
  702.                         }
  703.                 }
  704.             }
  705.             break;
  706.         case 4: // Enemy
  707.             enemy = $gameTroop.members()[param1];
  708.             if (enemy) {
  709.                 switch (param2) {
  710.                     case 0: // HP
  711.                         return enemy.hp;
  712.                     case 1: // MP
  713.                         return enemy.mp;
  714.                     case 10: // TP
  715.                         return enemy.tp;
  716.                     default:
  717.                         // Parameter
  718.                         if (param2 >= 2 && param2 <= 9) {
  719.                             return enemy.param(param2 - 2);
  720.                         }
  721.                 }
  722.             }
  723.             break;
  724.         case 5: // Character
  725.             character = this.character(param1);
  726.             if (character) {
  727.                 switch (param2) {
  728.                     case 0: // Map X
  729.                         return character.x;
  730.                     case 1: // Map Y
  731.                         return character.y;
  732.                     case 2: // Direction
  733.                         return character.direction();
  734.                     case 3: // Screen X
  735.                         return character.screenX();
  736.                     case 4: // Screen Y
  737.                         return character.screenY();
  738.                 }
  739.             }
  740.             break;
  741.         case 6: // Party
  742.             actor = $gameParty.members()[param1];
  743.             return actor ? actor.actorId() : 0;
  744.         case 8: // Last
  745.             return $gameTemp.lastActionData(param1);
  746.         case 7: // Other
  747.             switch (param1) {
  748.                 case 0: // Map ID
  749.                     return $gameMap.mapId();
  750.                 case 1: // Party Members
  751.                     return $gameParty.size();
  752.                 case 2: // Gold
  753.                     return $gameParty.gold();
  754.                 case 3: // Steps
  755.                     return $gameParty.steps();
  756.                 case 4: // Play Time
  757.                     return $gameSystem.playtime();
  758.                 case 5: // Timer
  759.                     return $gameTimer.seconds();
  760.                 case 6: // Save Count
  761.                     return $gameSystem.saveCount();
  762.                 case 7: // Battle Count
  763.                     return $gameSystem.battleCount();
  764.                 case 8: // Win Count
  765.                     return $gameSystem.winCount();
  766.                 case 9: // Escape Count
  767.                     return $gameSystem.escapeCount();
  768.             }
  769.             break;
  770.     }
  771.     return 0;
  772. };

  773. Game_Interpreter.prototype.operateVariable = function(
  774.     variableId,
  775.     operationType,
  776.     value
  777. ) {
  778.     try {
  779.         const oldValue = $gameVariables.value(variableId);
  780.         switch (operationType) {
  781.             case 0: // Set
  782.                 $gameVariables.setValue(variableId, value);
  783.                 break;
  784.             case 1: // Add
  785.                 $gameVariables.setValue(variableId, oldValue + value);
  786.                 break;
  787.             case 2: // Sub
  788.                 $gameVariables.setValue(variableId, oldValue - value);
  789.                 break;
  790.             case 3: // Mul
  791.                 $gameVariables.setValue(variableId, oldValue * value);
  792.                 break;
  793.             case 4: // Div
  794.                 $gameVariables.setValue(variableId, oldValue / value);
  795.                 break;
  796.             case 5: // Mod
  797.                 $gameVariables.setValue(variableId, oldValue % value);
  798.                 break;
  799.         }
  800.     } catch (e) {
  801.         $gameVariables.setValue(variableId, 0);
  802.     }
  803. };

  804. // Control Self Switch
  805. Game_Interpreter.prototype.command123 = function(params) {
  806.     if (this._eventId > 0) {
  807.         const key = [this._mapId, this._eventId, params[0]];
  808.         $gameSelfSwitches.setValue(key, params[1] === 0);
  809.     }
  810.     return true;
  811. };

  812. // Control Timer
  813. Game_Interpreter.prototype.command124 = function(params) {
  814.     if (params[0] === 0) {
  815.         // Start
  816.         $gameTimer.start(params[1] * 60);
  817.     } else {
  818.         // Stop
  819.         $gameTimer.stop();
  820.     }
  821.     return true;
  822. };

  823. // Change Gold
  824. Game_Interpreter.prototype.command125 = function(params) {
  825.     const value = this.operateValue(params[0], params[1], params[2]);
  826.     $gameParty.gainGold(value);
  827.     return true;
  828. };

  829. // Change Items
  830. Game_Interpreter.prototype.command126 = function(params) {
  831.     const value = this.operateValue(params[1], params[2], params[3]);
  832.     $gameParty.gainItem($dataItems[params[0]], value);
  833.     return true;
  834. };

  835. // Change Weapons
  836. Game_Interpreter.prototype.command127 = function(params) {
  837.     const value = this.operateValue(params[1], params[2], params[3]);
  838.     $gameParty.gainItem($dataWeapons[params[0]], value, params[4]);
  839.     return true;
  840. };

  841. // Change Armors
  842. Game_Interpreter.prototype.command128 = function(params) {
  843.     const value = this.operateValue(params[1], params[2], params[3]);
  844.     $gameParty.gainItem($dataArmors[params[0]], value, params[4]);
  845.     return true;
  846. };

  847. // Change Party Member
  848. Game_Interpreter.prototype.command129 = function(params) {
  849.     const actor = $gameActors.actor(params[0]);
  850.     if (actor) {
  851.         if (params[1] === 0) {
  852.             // Add
  853.             if (params[2]) {
  854.                 // Initialize
  855.                 $gameActors.actor(params[0]).setup(params[0]);
  856.             }
  857.             $gameParty.addActor(params[0]);
  858.         } else {
  859.             // Remove
  860.             $gameParty.removeActor(params[0]);
  861.         }
  862.     }
  863.     return true;
  864. };

  865. // Change Battle BGM
  866. Game_Interpreter.prototype.command132 = function(params) {
  867.     $gameSystem.setBattleBgm(params[0]);
  868.     return true;
  869. };

  870. // Change Victory ME
  871. Game_Interpreter.prototype.command133 = function(params) {
  872.     $gameSystem.setVictoryMe(params[0]);
  873.     return true;
  874. };

  875. // Change Save Access
  876. Game_Interpreter.prototype.command134 = function(params) {
  877.     if (params[0] === 0) {
  878.         $gameSystem.disableSave();
  879.     } else {
  880.         $gameSystem.enableSave();
  881.     }
  882.     return true;
  883. };

  884. // Change Menu Access
  885. Game_Interpreter.prototype.command135 = function(params) {
  886.     if (params[0] === 0) {
  887.         $gameSystem.disableMenu();
  888.     } else {
  889.         $gameSystem.enableMenu();
  890.     }
  891.     return true;
  892. };

  893. // Change Encounter
  894. Game_Interpreter.prototype.command136 = function(params) {
  895.     if (params[0] === 0) {
  896.         $gameSystem.disableEncounter();
  897.     } else {
  898.         $gameSystem.enableEncounter();
  899.     }
  900.     $gamePlayer.makeEncounterCount();
  901.     return true;
  902. };

  903. // Change Formation Access
  904. Game_Interpreter.prototype.command137 = function(params) {
  905.     if (params[0] === 0) {
  906.         $gameSystem.disableFormation();
  907.     } else {
  908.         $gameSystem.enableFormation();
  909.     }
  910.     return true;
  911. };

  912. // Change Window Color
  913. Game_Interpreter.prototype.command138 = function(params) {
  914.     $gameSystem.setWindowTone(params[0]);
  915.     return true;
  916. };

  917. // Change Defeat ME
  918. Game_Interpreter.prototype.command139 = function(params) {
  919.     $gameSystem.setDefeatMe(params[0]);
  920.     return true;
  921. };

  922. // Change Vehicle BGM
  923. Game_Interpreter.prototype.command140 = function(params) {
  924.     const vehicle = $gameMap.vehicle(params[0]);
  925.     if (vehicle) {
  926.         vehicle.setBgm(params[1]);
  927.     }
  928.     return true;
  929. };

  930. // Transfer Player
  931. Game_Interpreter.prototype.command201 = function(params) {
  932.     if ($gameParty.inBattle() || $gameMessage.isBusy()) {
  933.         return false;
  934.     }
  935.     let mapId, x, y;
  936.     if (params[0] === 0) {
  937.         // Direct designation
  938.         mapId = params[1];
  939.         x = params[2];
  940.         y = params[3];
  941.     } else {
  942.         // Designation with variables
  943.         mapId = $gameVariables.value(params[1]);
  944.         x = $gameVariables.value(params[2]);
  945.         y = $gameVariables.value(params[3]);
  946.     }
  947.     $gamePlayer.reserveTransfer(mapId, x, y, params[4], params[5]);
  948.     this.setWaitMode("transfer");
  949.     return true;
  950. };

  951. // Set Vehicle Location
  952. Game_Interpreter.prototype.command202 = function(params) {
  953.     let mapId, x, y;
  954.     if (params[1] === 0) {
  955.         // Direct designation
  956.         mapId = params[2];
  957.         x = params[3];
  958.         y = params[4];
  959.     } else {
  960.         // Designation with variables
  961.         mapId = $gameVariables.value(params[2]);
  962.         x = $gameVariables.value(params[3]);
  963.         y = $gameVariables.value(params[4]);
  964.     }
  965.     const vehicle = $gameMap.vehicle(params[0]);
  966.     if (vehicle) {
  967.         vehicle.setLocation(mapId, x, y);
  968.     }
  969.     return true;
  970. };

  971. // Set Event Location
  972. Game_Interpreter.prototype.command203 = function(params) {
  973.     const character = this.character(params[0]);
  974.     if (character) {
  975.         if (params[1] === 0) {
  976.             // Direct designation
  977.             character.locate(params[2], params[3]);
  978.         } else if (params[1] === 1) {
  979.             // Designation with variables
  980.             const x = $gameVariables.value(params[2]);
  981.             const y = $gameVariables.value(params[3]);
  982.             character.locate(x, y);
  983.         } else {
  984.             // Exchange with another event
  985.             const character2 = this.character(params[2]);
  986.             if (character2) {
  987.                 character.swap(character2);
  988.             }
  989.         }
  990.         if (params[4] > 0) {
  991.             character.setDirection(params[4]);
  992.         }
  993.     }
  994.     return true;
  995. };

  996. // Scroll Map
  997. Game_Interpreter.prototype.command204 = function(params) {
  998.     if (!$gameParty.inBattle()) {
  999.         if ($gameMap.isScrolling()) {
  1000.             this.setWaitMode("scroll");
  1001.             return false;
  1002.         }
  1003.         $gameMap.startScroll(params[0], params[1], params[2]);
  1004.         if (params[3]) {
  1005.             this.setWaitMode("scroll");
  1006.         }
  1007.     }
  1008.     return true;
  1009. };

  1010. // Set Movement Route
  1011. Game_Interpreter.prototype.command205 = function(params) {
  1012.     $gameMap.refreshIfNeeded();
  1013.     this._characterId = params[0];
  1014.     const character = this.character(this._characterId);
  1015.     if (character) {
  1016.         character.forceMoveRoute(params[1]);
  1017.         if (params[1].wait) {
  1018.             this.setWaitMode("route");
  1019.         }
  1020.     }
  1021.     return true;
  1022. };

  1023. // Get on/off Vehicle
  1024. Game_Interpreter.prototype.command206 = function() {
  1025.     $gamePlayer.getOnOffVehicle();
  1026.     return true;
  1027. };

  1028. // Change Transparency
  1029. Game_Interpreter.prototype.command211 = function(params) {
  1030.     $gamePlayer.setTransparent(params[0] === 0);
  1031.     return true;
  1032. };

  1033. // Show Animation
  1034. Game_Interpreter.prototype.command212 = function(params) {
  1035.     this._characterId = params[0];
  1036.     const character = this.character(this._characterId);
  1037.     if (character) {
  1038.         $gameTemp.requestAnimation([character], params[1]);
  1039.         if (params[2]) {
  1040.             this.setWaitMode("animation");
  1041.         }
  1042.     }
  1043.     return true;
  1044. };

  1045. // Show Balloon Icon
  1046. Game_Interpreter.prototype.command213 = function(params) {
  1047.     this._characterId = params[0];
  1048.     const character = this.character(this._characterId);
  1049.     if (character) {
  1050.         $gameTemp.requestBalloon(character, params[1]);
  1051.         if (params[2]) {
  1052.             this.setWaitMode("balloon");
  1053.         }
  1054.     }
  1055.     return true;
  1056. };

  1057. // Erase Event
  1058. Game_Interpreter.prototype.command214 = function() {
  1059.     if (this.isOnCurrentMap() && this._eventId > 0) {
  1060.         $gameMap.eraseEvent(this._eventId);
  1061.     }
  1062.     return true;
  1063. };

  1064. // Change Player Followers
  1065. Game_Interpreter.prototype.command216 = function(params) {
  1066.     if (params[0] === 0) {
  1067.         $gamePlayer.showFollowers();
  1068.     } else {
  1069.         $gamePlayer.hideFollowers();
  1070.     }
  1071.     $gamePlayer.refresh();
  1072.     return true;
  1073. };

  1074. // Gather Followers
  1075. Game_Interpreter.prototype.command217 = function() {
  1076.     if (!$gameParty.inBattle()) {
  1077.         $gamePlayer.gatherFollowers();
  1078.         this.setWaitMode("gather");
  1079.     }
  1080.     return true;
  1081. };

  1082. // Fadeout Screen
  1083. Game_Interpreter.prototype.command221 = function() {
  1084.     if ($gameMessage.isBusy()) {
  1085.         return false;
  1086.     }
  1087.     $gameScreen.startFadeOut(this.fadeSpeed());
  1088.     this.wait(this.fadeSpeed());
  1089.     return true;
  1090. };

  1091. // Fadein Screen
  1092. Game_Interpreter.prototype.command222 = function() {
  1093.     if ($gameMessage.isBusy()) {
  1094.         return false;
  1095.     }
  1096.     $gameScreen.startFadeIn(this.fadeSpeed());
  1097.     this.wait(this.fadeSpeed());
  1098.     return true;
  1099. };

  1100. // Tint Screen
  1101. Game_Interpreter.prototype.command223 = function(params) {
  1102.     $gameScreen.startTint(params[0], params[1]);
  1103.     if (params[2]) {
  1104.         this.wait(params[1]);
  1105.     }
  1106.     return true;
  1107. };

  1108. // Flash Screen
  1109. Game_Interpreter.prototype.command224 = function(params) {
  1110.     $gameScreen.startFlash(params[0], params[1]);
  1111.     if (params[2]) {
  1112.         this.wait(params[1]);
  1113.     }
  1114.     return true;
  1115. };

  1116. // Shake Screen
  1117. Game_Interpreter.prototype.command225 = function(params) {
  1118.     $gameScreen.startShake(params[0], params[1], params[2]);
  1119.     if (params[3]) {
  1120.         this.wait(params[2]);
  1121.     }
  1122.     return true;
  1123. };

  1124. // Wait
  1125. Game_Interpreter.prototype.command230 = function(params) {
  1126.     this.wait(params[0]);
  1127.     return true;
  1128. };

  1129. // Show Picture
  1130. Game_Interpreter.prototype.command231 = function(params) {
  1131.     const point = this.picturePoint(params);
  1132.     // prettier-ignore
  1133.     $gameScreen.showPicture(
  1134.         params[0], params[1], params[2], point.x, point.y,
  1135.         params[6], params[7], params[8], params[9]
  1136.     );
  1137.     return true;
  1138. };

  1139. // Move Picture
  1140. Game_Interpreter.prototype.command232 = function(params) {
  1141.     const point = this.picturePoint(params);
  1142.     // prettier-ignore
  1143.     $gameScreen.movePicture(
  1144.         params[0], params[2], point.x, point.y, params[6], params[7],
  1145.         params[8], params[9], params[10], params[12] || 0
  1146.     );
  1147.     if (params[11]) {
  1148.         this.wait(params[10]);
  1149.     }
  1150.     return true;
  1151. };

  1152. Game_Interpreter.prototype.picturePoint = function(params) {
  1153.     const point = new Point();
  1154.     if (params[3] === 0) {
  1155.         // Direct designation
  1156.         point.x = params[4];
  1157.         point.y = params[5];
  1158.     } else {
  1159.         // Designation with variables
  1160.         point.x = $gameVariables.value(params[4]);
  1161.         point.y = $gameVariables.value(params[5]);
  1162.     }
  1163.     return point;
  1164. };

  1165. // Rotate Picture
  1166. Game_Interpreter.prototype.command233 = function(params) {
  1167.     $gameScreen.rotatePicture(params[0], params[1]);
  1168.     return true;
  1169. };

  1170. // Tint Picture
  1171. Game_Interpreter.prototype.command234 = function(params) {
  1172.     $gameScreen.tintPicture(params[0], params[1], params[2]);
  1173.     if (params[3]) {
  1174.         this.wait(params[2]);
  1175.     }
  1176.     return true;
  1177. };

  1178. // Erase Picture
  1179. Game_Interpreter.prototype.command235 = function(params) {
  1180.     $gameScreen.erasePicture(params[0]);
  1181.     return true;
  1182. };

  1183. // Set Weather Effect
  1184. Game_Interpreter.prototype.command236 = function(params) {
  1185.     if (!$gameParty.inBattle()) {
  1186.         $gameScreen.changeWeather(params[0], params[1], params[2]);
  1187.         if (params[3]) {
  1188.             this.wait(params[2]);
  1189.         }
  1190.     }
  1191.     return true;
  1192. };

  1193. // Play BGM
  1194. Game_Interpreter.prototype.command241 = function(params) {
  1195.     AudioManager.playBgm(params[0]);
  1196.     return true;
  1197. };

  1198. // Fadeout BGM
  1199. Game_Interpreter.prototype.command242 = function(params) {
  1200.     AudioManager.fadeOutBgm(params[0]);
  1201.     return true;
  1202. };

  1203. // Save BGM
  1204. Game_Interpreter.prototype.command243 = function() {
  1205.     $gameSystem.saveBgm();
  1206.     return true;
  1207. };

  1208. // Resume BGM
  1209. Game_Interpreter.prototype.command244 = function() {
  1210.     $gameSystem.replayBgm();
  1211.     return true;
  1212. };

  1213. // Play BGS
  1214. Game_Interpreter.prototype.command245 = function(params) {
  1215.     AudioManager.playBgs(params[0]);
  1216.     return true;
  1217. };

  1218. // Fadeout BGS
  1219. Game_Interpreter.prototype.command246 = function(params) {
  1220.     AudioManager.fadeOutBgs(params[0]);
  1221.     return true;
  1222. };

  1223. // Play ME
  1224. Game_Interpreter.prototype.command249 = function(params) {
  1225.     AudioManager.playMe(params[0]);
  1226.     return true;
  1227. };

  1228. // Play SE
  1229. Game_Interpreter.prototype.command250 = function(params) {
  1230.     AudioManager.playSe(params[0]);
  1231.     return true;
  1232. };

  1233. // Stop SE
  1234. Game_Interpreter.prototype.command251 = function() {
  1235.     AudioManager.stopSe();
  1236.     return true;
  1237. };

  1238. // Play Movie
  1239. Game_Interpreter.prototype.command261 = function(params) {
  1240.     if ($gameMessage.isBusy()) {
  1241.         return false;
  1242.     }
  1243.     const name = params[0];
  1244.     if (name.length > 0) {
  1245.         const ext = this.videoFileExt();
  1246.         Video.play("movies/" + name + ext);
  1247.         this.setWaitMode("video");
  1248.     }
  1249.     return true;
  1250. };

  1251. Game_Interpreter.prototype.videoFileExt = function() {
  1252.     if (Utils.canPlayWebm()) {
  1253.         return ".webm";
  1254.     } else {
  1255.         return ".mp4";
  1256.     }
  1257. };

  1258. // Change Map Name Display
  1259. Game_Interpreter.prototype.command281 = function(params) {
  1260.     if (params[0] === 0) {
  1261.         $gameMap.enableNameDisplay();
  1262.     } else {
  1263.         $gameMap.disableNameDisplay();
  1264.     }
  1265.     return true;
  1266. };

  1267. // Change Tileset
  1268. Game_Interpreter.prototype.command282 = function(params) {
  1269.     const tileset = $dataTilesets[params[0]];
  1270.     const allReady = tileset.tilesetNames
  1271.         .map(tilesetName => ImageManager.loadTileset(tilesetName))
  1272.         .every(bitmap => bitmap.isReady());
  1273.     if (allReady) {
  1274.         $gameMap.changeTileset(params[0]);
  1275.         return true;
  1276.     } else {
  1277.         return false;
  1278.     }
  1279. };

  1280. // Change Battle Background
  1281. Game_Interpreter.prototype.command283 = function(params) {
  1282.     $gameMap.changeBattleback(params[0], params[1]);
  1283.     return true;
  1284. };

  1285. // Change Parallax
  1286. Game_Interpreter.prototype.command284 = function(params) {
  1287.     // prettier-ignore
  1288.     $gameMap.changeParallax(
  1289.         params[0], params[1], params[2], params[3], params[4]
  1290.     );
  1291.     return true;
  1292. };

  1293. // Get Location Info
  1294. Game_Interpreter.prototype.command285 = function(params) {
  1295.     let x, y, value;
  1296.     if (params[2] === 0) {
  1297.         // Direct designation
  1298.         x = params[3];
  1299.         y = params[4];
  1300.     } else if (params[2] === 1) {
  1301.         // Designation with variables
  1302.         x = $gameVariables.value(params[3]);
  1303.         y = $gameVariables.value(params[4]);
  1304.     } else {
  1305.         // Designation by a character
  1306.         const character = this.character(params[3]);
  1307.         x = character.x;
  1308.         y = character.y;
  1309.     }
  1310.     switch (params[1]) {
  1311.         case 0: // Terrain Tag
  1312.             value = $gameMap.terrainTag(x, y);
  1313.             break;
  1314.         case 1: // Event ID
  1315.             value = $gameMap.eventIdXy(x, y);
  1316.             break;
  1317.         case 2: // Tile ID (Layer 1)
  1318.         case 3: // Tile ID (Layer 2)
  1319.         case 4: // Tile ID (Layer 3)
  1320.         case 5: // Tile ID (Layer 4)
  1321.             value = $gameMap.tileId(x, y, params[1] - 2);
  1322.             break;
  1323.         default:
  1324.             // Region ID
  1325.             value = $gameMap.regionId(x, y);
  1326.             break;
  1327.     }
  1328.     $gameVariables.setValue(params[0], value);
  1329.     return true;
  1330. };

  1331. // Battle Processing
  1332. Game_Interpreter.prototype.command301 = function(params) {
  1333.     if (!$gameParty.inBattle()) {
  1334.         let troopId;
  1335.         if (params[0] === 0) {
  1336.             // Direct designation
  1337.             troopId = params[1];
  1338.         } else if (params[0] === 1) {
  1339.             // Designation with a variable
  1340.             troopId = $gameVariables.value(params[1]);
  1341.         } else {
  1342.             // Same as Random Encounters
  1343.             troopId = $gamePlayer.makeEncounterTroopId();
  1344.         }
  1345.         if ($dataTroops[troopId]) {
  1346.             BattleManager.setup(troopId, params[2], params[3]);
  1347.             BattleManager.setEventCallback(n => {
  1348.                 this._branch[this._indent] = n;
  1349.             });
  1350.             $gamePlayer.makeEncounterCount();
  1351.             SceneManager.push(Scene_Battle);
  1352.         }
  1353.     }
  1354.     return true;
  1355. };

  1356. // If Win
  1357. Game_Interpreter.prototype.command601 = function() {
  1358.     if (this._branch[this._indent] !== 0) {
  1359.         this.skipBranch();
  1360.     }
  1361.     return true;
  1362. };

  1363. // If Escape
  1364. Game_Interpreter.prototype.command602 = function() {
  1365.     if (this._branch[this._indent] !== 1) {
  1366.         this.skipBranch();
  1367.     }
  1368.     return true;
  1369. };

  1370. // If Lose
  1371. Game_Interpreter.prototype.command603 = function() {
  1372.     if (this._branch[this._indent] !== 2) {
  1373.         this.skipBranch();
  1374.     }
  1375.     return true;
  1376. };

  1377. // Shop Processing
  1378. Game_Interpreter.prototype.command302 = function(params) {
  1379.     if (!$gameParty.inBattle()) {
  1380.         const goods = [params];
  1381.         while (this.nextEventCode() === 605) {
  1382.             this._index++;
  1383.             goods.push(this.currentCommand().parameters);
  1384.         }
  1385.         SceneManager.push(Scene_Shop);
  1386.         SceneManager.prepareNextScene(goods, params[4]);
  1387.     }
  1388.     return true;
  1389. };

  1390. // Name Input Processing
  1391. Game_Interpreter.prototype.command303 = function(params) {
  1392.     if (!$gameParty.inBattle()) {
  1393.         if ($dataActors[params[0]]) {
  1394.             SceneManager.push(Scene_Name);
  1395.             SceneManager.prepareNextScene(params[0], params[1]);
  1396.         }
  1397.     }
  1398.     return true;
  1399. };

  1400. // Change HP
  1401. Game_Interpreter.prototype.command311 = function(params) {
  1402.     const value = this.operateValue(params[2], params[3], params[4]);
  1403.     this.iterateActorEx(params[0], params[1], actor => {
  1404.         this.changeHp(actor, value, params[5]);
  1405.     });
  1406.     return true;
  1407. };

  1408. // Change MP
  1409. Game_Interpreter.prototype.command312 = function(params) {
  1410.     const value = this.operateValue(params[2], params[3], params[4]);
  1411.     this.iterateActorEx(params[0], params[1], actor => {
  1412.         actor.gainMp(value);
  1413.     });
  1414.     return true;
  1415. };

  1416. // Change TP
  1417. Game_Interpreter.prototype.command326 = function(params) {
  1418.     const value = this.operateValue(params[2], params[3], params[4]);
  1419.     this.iterateActorEx(params[0], params[1], actor => {
  1420.         actor.gainTp(value);
  1421.     });
  1422.     return true;
  1423. };

  1424. // Change State
  1425. Game_Interpreter.prototype.command313 = function(params) {
  1426.     this.iterateActorEx(params[0], params[1], actor => {
  1427.         const alreadyDead = actor.isDead();
  1428.         if (params[2] === 0) {
  1429.             actor.addState(params[3]);
  1430.         } else {
  1431.             actor.removeState(params[3]);
  1432.         }
  1433.         if (actor.isDead() && !alreadyDead) {
  1434.             actor.performCollapse();
  1435.         }
  1436.         actor.clearResult();
  1437.     });
  1438.     return true;
  1439. };

  1440. // Recover All
  1441. Game_Interpreter.prototype.command314 = function(params) {
  1442.     this.iterateActorEx(params[0], params[1], actor => {
  1443.         actor.recoverAll();
  1444.     });
  1445.     return true;
  1446. };

  1447. // Change EXP
  1448. Game_Interpreter.prototype.command315 = function(params) {
  1449.     const value = this.operateValue(params[2], params[3], params[4]);
  1450.     this.iterateActorEx(params[0], params[1], actor => {
  1451.         actor.changeExp(actor.currentExp() + value, params[5]);
  1452.     });
  1453.     return true;
  1454. };

  1455. // Change Level
  1456. Game_Interpreter.prototype.command316 = function(params) {
  1457.     const value = this.operateValue(params[2], params[3], params[4]);
  1458.     this.iterateActorEx(params[0], params[1], actor => {
  1459.         actor.changeLevel(actor.level + value, params[5]);
  1460.     });
  1461.     return true;
  1462. };

  1463. // Change Parameter
  1464. Game_Interpreter.prototype.command317 = function(params) {
  1465.     const value = this.operateValue(params[3], params[4], params[5]);
  1466.     this.iterateActorEx(params[0], params[1], actor => {
  1467.         actor.addParam(params[2], value);
  1468.     });
  1469.     return true;
  1470. };

  1471. // Change Skill
  1472. Game_Interpreter.prototype.command318 = function(params) {
  1473.     this.iterateActorEx(params[0], params[1], actor => {
  1474.         if (params[2] === 0) {
  1475.             actor.learnSkill(params[3]);
  1476.         } else {
  1477.             actor.forgetSkill(params[3]);
  1478.         }
  1479.     });
  1480.     return true;
  1481. };

  1482. // Change Equipment
  1483. Game_Interpreter.prototype.command319 = function(params) {
  1484.     const actor = $gameActors.actor(params[0]);
  1485.     if (actor) {
  1486.         actor.changeEquipById(params[1], params[2]);
  1487.     }
  1488.     return true;
  1489. };

  1490. // Change Name
  1491. Game_Interpreter.prototype.command320 = function(params) {
  1492.     const actor = $gameActors.actor(params[0]);
  1493.     if (actor) {
  1494.         actor.setName(params[1]);
  1495.     }
  1496.     return true;
  1497. };

  1498. // Change Class
  1499. Game_Interpreter.prototype.command321 = function(params) {
  1500.     const actor = $gameActors.actor(params[0]);
  1501.     if (actor && $dataClasses[params[1]]) {
  1502.         actor.changeClass(params[1], params[2]);
  1503.     }
  1504.     return true;
  1505. };

  1506. // Change Actor Images
  1507. Game_Interpreter.prototype.command322 = function(params) {
  1508.     const actor = $gameActors.actor(params[0]);
  1509.     if (actor) {
  1510.         actor.setCharacterImage(params[1], params[2]);
  1511.         actor.setFaceImage(params[3], params[4]);
  1512.         actor.setBattlerImage(params[5]);
  1513.     }
  1514.     $gamePlayer.refresh();
  1515.     return true;
  1516. };

  1517. // Change Vehicle Image
  1518. Game_Interpreter.prototype.command323 = function(params) {
  1519.     const vehicle = $gameMap.vehicle(params[0]);
  1520.     if (vehicle) {
  1521.         vehicle.setImage(params[1], params[2]);
  1522.     }
  1523.     return true;
  1524. };

  1525. // Change Nickname
  1526. Game_Interpreter.prototype.command324 = function(params) {
  1527.     const actor = $gameActors.actor(params[0]);
  1528.     if (actor) {
  1529.         actor.setNickname(params[1]);
  1530.     }
  1531.     return true;
  1532. };

  1533. // Change Profile
  1534. Game_Interpreter.prototype.command325 = function(params) {
  1535.     const actor = $gameActors.actor(params[0]);
  1536.     if (actor) {
  1537.         actor.setProfile(params[1]);
  1538.     }
  1539.     return true;
  1540. };

  1541. // Change Enemy HP
  1542. Game_Interpreter.prototype.command331 = function(params) {
  1543.     const value = this.operateValue(params[1], params[2], params[3]);
  1544.     this.iterateEnemyIndex(params[0], enemy => {
  1545.         this.changeHp(enemy, value, params[4]);
  1546.     });
  1547.     return true;
  1548. };

  1549. // Change Enemy MP
  1550. Game_Interpreter.prototype.command332 = function(params) {
  1551.     const value = this.operateValue(params[1], params[2], params[3]);
  1552.     this.iterateEnemyIndex(params[0], enemy => {
  1553.         enemy.gainMp(value);
  1554.     });
  1555.     return true;
  1556. };

  1557. // Change Enemy TP
  1558. Game_Interpreter.prototype.command342 = function(params) {
  1559.     const value = this.operateValue(params[1], params[2], params[3]);
  1560.     this.iterateEnemyIndex(params[0], enemy => {
  1561.         enemy.gainTp(value);
  1562.     });
  1563.     return true;
  1564. };

  1565. // Change Enemy State
  1566. Game_Interpreter.prototype.command333 = function(params) {
  1567.     this.iterateEnemyIndex(params[0], enemy => {
  1568.         const alreadyDead = enemy.isDead();
  1569.         if (params[1] === 0) {
  1570.             enemy.addState(params[2]);
  1571.         } else {
  1572.             enemy.removeState(params[2]);
  1573.         }
  1574.         if (enemy.isDead() && !alreadyDead) {
  1575.             enemy.performCollapse();
  1576.         }
  1577.         enemy.clearResult();
  1578.     });
  1579.     return true;
  1580. };

  1581. // Enemy Recover All
  1582. Game_Interpreter.prototype.command334 = function(params) {
  1583.     this.iterateEnemyIndex(params[0], enemy => {
  1584.         enemy.recoverAll();
  1585.     });
  1586.     return true;
  1587. };

  1588. // Enemy Appear
  1589. Game_Interpreter.prototype.command335 = function(params) {
  1590.     this.iterateEnemyIndex(params[0], enemy => {
  1591.         enemy.appear();
  1592.         $gameTroop.makeUniqueNames();
  1593.     });
  1594.     return true;
  1595. };

  1596. // Enemy Transform
  1597. Game_Interpreter.prototype.command336 = function(params) {
  1598.     this.iterateEnemyIndex(params[0], enemy => {
  1599.         enemy.transform(params[1]);
  1600.         $gameTroop.makeUniqueNames();
  1601.     });
  1602.     return true;
  1603. };

  1604. // Show Battle Animation
  1605. Game_Interpreter.prototype.command337 = function(params) {
  1606.     let param = params[0];
  1607.     if (params[2]) {
  1608.         param = -1;
  1609.     }
  1610.     const targets = [];
  1611.     this.iterateEnemyIndex(param, enemy => {
  1612.         if (enemy.isAlive()) {
  1613.             targets.push(enemy);
  1614.         }
  1615.     });
  1616.     $gameTemp.requestAnimation(targets, params[1]);
  1617.     return true;
  1618. };

  1619. // Force Action
  1620. Game_Interpreter.prototype.command339 = function(params) {
  1621.     this.iterateBattler(params[0], params[1], battler => {
  1622.         if (!battler.isDeathStateAffected()) {
  1623.             battler.forceAction(params[2], params[3]);
  1624.             BattleManager.forceAction(battler);
  1625.             this.setWaitMode("action");
  1626.         }
  1627.     });
  1628.     return true;
  1629. };

  1630. // Abort Battle
  1631. Game_Interpreter.prototype.command340 = function() {
  1632.     BattleManager.abort();
  1633.     return true;
  1634. };

  1635. // Open Menu Screen
  1636. Game_Interpreter.prototype.command351 = function() {
  1637.     if (!$gameParty.inBattle()) {
  1638.         SceneManager.push(Scene_Menu);
  1639.         Window_MenuCommand.initCommandPosition();
  1640.     }
  1641.     return true;
  1642. };

  1643. // Open Save Screen
  1644. Game_Interpreter.prototype.command352 = function() {
  1645.     if (!$gameParty.inBattle()) {
  1646.         SceneManager.push(Scene_Save);
  1647.     }
  1648.     return true;
  1649. };

  1650. // Game Over
  1651. Game_Interpreter.prototype.command353 = function() {
  1652.     SceneManager.goto(Scene_Gameover);
  1653.     return true;
  1654. };

  1655. // Return to Title Screen
  1656. Game_Interpreter.prototype.command354 = function() {
  1657.     SceneManager.goto(Scene_Title);
  1658.     return true;
  1659. };

  1660. // Script
  1661. Game_Interpreter.prototype.command355 = function() {
  1662.     let script = this.currentCommand().parameters[0] + "\n";
  1663.     while (this.nextEventCode() === 655) {
  1664.         this._index++;
  1665.         script += this.currentCommand().parameters[0] + "\n";
  1666.     }
  1667.     eval(script);
  1668.     return true;
  1669. };

  1670. // Plugin Command MV (deprecated)
  1671. Game_Interpreter.prototype.command356 = function(params) {
  1672.     const args = params[0].split(" ");
  1673.     const command = args.shift();
  1674.     this.pluginCommand(command, args);
  1675.     return true;
  1676. };

  1677. Game_Interpreter.prototype.pluginCommand = function() {
  1678.     // deprecated
  1679. };

  1680. // Plugin Command
  1681. Game_Interpreter.prototype.command357 = function(params) {
  1682.     PluginManager.callCommand(this, params[0], params[1], params[3]);
  1683.     return true;
  1684. };

  1685. //-----------------------------------------------------------------------------
复制代码
[/fold]

没研究过,感觉就多了点注释的样子。

点评

多谢。  发表于 2020-8-22 08:37
cheap
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2020-8-22 12:51:21 | 显示全部楼层
本帖最后由 tseyik 于 2020-8-22 12:55 编辑

官方
RPG Maker MZ Core API
https://developer.rpgmakerweb.com/rpg-maker-mz/
擷取.JPG
TMJumpAction_top.jpg

点评

多谢  发表于 2020-8-24 13:42
几个小时前还打不开呢  发表于 2020-8-22 12:59
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部