找回密码
 注册用户
查看: 557|回复: 1

[RMMZ] 【汉化】独立回合战斗行动

[复制链接]

88

主题

7

回帖

1277

积分

资深会员

积分
1277
发表于 2024-5-29 09:49:45 | 显示全部楼层 |阅读模式
使每个角色战斗行动在选择后立即执行


原地址:Individual Turn Battle System | RPG Maker Forums (rpgmakerweb.com)

预览:



汉化脚本:
  1. //=============================================================================
  2. // RPG Maker MZ - Individual Turn Battle System - Version 1.1
  3. //=============================================================================

  4. /*:
  5. * @target MZ
  6. * @plugindesc 实现战斗中单个角色的行动设定后立即执行的效果。
  7. * 汉化 by 烁灵 更多脚本请访问 www.hknmtt.com
  8. * @author Fomar0153
  9. *
  10. * @param Battle Turn Order Formula
  11. * @type string
  12. * @desc 战斗行动顺序计算公式
  13. * @default this.agi + Math.randomInt(this.agi / 2)
  14. *
  15. * @param Use Party Command Window
  16. * @type boolean
  17. * @desc 当在角色行动窗口中选择取消时,呼出队员行动窗口,而不是跳过回合
  18. * @default true
  19. *
  20. * @param Add Pass to Party Command Window
  21. * @type boolean
  22. * @desc 当时用队员行动窗口时,是否显示“跳过”选项
  23. * @default true
  24. *
  25. * @param Pass Command Name
  26. * @type string
  27. * @desc “跳过” 选项的文本
  28. * @default 跳过
  29. *
  30. * @help Fomar0153_IndividualTurnBattleSystem.js
  31. * 行动顺序公式的一些例子:
  32. * this.agi
  33. * 将按敏捷排序
  34. * this.agi + Math.randomInt(this.agi / 2)
  35. * 将按敏捷排序,同时增加一些随机性
  36. *
  37. * Version 1.0 -> 1.1
  38. * Bug fixes! Specifically to do with restrictions on status effects.
  39. */

  40. var Fomar = Fomar || {};
  41. Fomar.ITBS = {};

  42. Fomar.ITBS.parameters = PluginManager.parameters('Fomar0153_IndividualTurnBattleSystem');

  43. Fomar.ITBS.battleAgi = Fomar.ITBS.parameters["Battle Turn Order Formula"] || "this.agi";
  44. Fomar.ITBS.partyCommand = (Fomar.ITBS.parameters["Use Party Command Window"] == "true");
  45. Fomar.ITBS.passCommand = (Fomar.ITBS.parameters["Add Pass to Party Command Window"] == "true");
  46. Fomar.ITBS.passText = Fomar.ITBS.parameters["Pass Command Name"] || "Pass";

  47. (() => {

  48.   BattleManager.isTpb = function() {
  49.     return true;
  50.   };

  51.   Fomar.ITBS.BattleManager_initMembers = BattleManager.initMembers;
  52.   BattleManager.initMembers = function() {
  53.     Fomar.ITBS.BattleManager_initMembers.call(this);
  54.     this._battlers = [];
  55.   };

  56.   Fomar.ITBS.BattleManager_startBattle = BattleManager.startBattle;
  57.   BattleManager.startBattle = function() {
  58.     Fomar.ITBS.BattleManager_startBattle.call(this);
  59.     this._battlers = [];
  60.     $gameParty.aliveMembers().concat($gameTroop.aliveMembers()).forEach((member) => {
  61.       this._battlers.push(member);
  62.     });
  63.     this._battlers.sort(function(a, b) {
  64.       return b._battleAgi - a._battleAgi
  65.     });
  66.   };

  67.   BattleManager.updateTurn = function(timeActive) {
  68.     $gameParty.requestMotionRefresh();
  69.     if (!this._subject && !this._currentActor) {
  70.       this.updateTpb();
  71.     }
  72.     if (this._subject) {
  73.       this.processTurn();
  74.     }
  75.   };

  76.   BattleManager.updateTpb = function() {
  77.     $gameParty.members().concat($gameTroop.members()).forEach((member) => {
  78.       if (!member.isAlive()) {
  79.         this._battlers.remove(member);
  80.       } else {
  81.         if (!this._battlers.includes(member)) {
  82.           this._battlers.push(member);
  83.         }
  84.       }
  85.     });
  86.     if (this._battlers[0]) {
  87.       this._battlers[0].onTurnEnd();
  88.       if (this._battlers[0].isActor()) {
  89.         if (this._battlers[0].canMove()) {
  90.           if (this._battlers[0].canInput()) {
  91.             this._inputting = true;
  92.             this._currentActor = this._battlers[0];
  93.             this._currentActor.makeActions();
  94.             this.startActorInput();
  95.           } else {
  96.             this._subject = this._battlers[0];
  97.             this._subject.makeActions();
  98.           }
  99.         }
  100.       } else {
  101.         this._subject = this._battlers[0];
  102.         this._subject.makeActions();
  103.         $gameTroop.increaseTurn();
  104.       }
  105.       this._battlers.remove(this._battlers[0]);
  106.     }
  107.   };

  108.   BattleManager.updateTpbInput = function() {
  109.     // done elsewhere now
  110.   };

  111.   BattleManager.finishActorInput = function() {
  112.     if (this._currentActor) {
  113.       this._subject = this._currentActor;
  114.       this._inputting = false;
  115.     }
  116.   };

  117.   BattleManager.changeCurrentActor = function(forward) {
  118.       this._currentActor = null;
  119.   };

  120.   Fomar.ITBS.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
  121.   Game_Battler.prototype.onBattleStart = function(advantageous) {
  122.     Fomar.ITBS.Game_Battler_onBattleStart.call(this);
  123.     this._battleAgi = eval(Fomar.ITBS.battleAgi);
  124.     if (advantageous) {
  125.       this._battleAgi *= 2;
  126.     }
  127.   };

  128.   Game_Battler.prototype.canInput = function() {
  129.     return Game_BattlerBase.prototype.canInput.call(this);
  130.   };

  131.   Game_Battler.prototype.applyTpbPenalty = function() {
  132.     // surely failing to escape is penalty enough?
  133.   };

  134.   Window_StatusBase.prototype.placeTimeGauge = function(actor, x, y) {
  135.     // no time bar, thanks
  136.   };

  137.   Window_PartyCommand.prototype.makeCommandList = function() {
  138.     this.addCommand(TextManager.fight, "fight");
  139.     if (Fomar.ITBS.passCommand) {
  140.       this.addCommand(Fomar.ITBS.passText, "pass");
  141.     }
  142.     this.addCommand(TextManager.escape, "escape", BattleManager.canEscape());
  143.   };

  144.   Fomar.ITBS.Scene_Battle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  145.   Scene_Battle.prototype.createPartyCommandWindow = function() {
  146.     Fomar.ITBS.Scene_Battle_createPartyCommandWindow.call(this);
  147.     this._partyCommandWindow.setHandler("pass", this.commandPass.bind(this));
  148.   };

  149.   Scene_Battle.prototype.startPartyCommandSelection = function() {
  150.     this._statusWindow.show();
  151.     this._statusWindow.open();
  152.     this._actorCommandWindow.close();
  153.     this._partyCommandWindow.setup();
  154.   };

  155.   Scene_Battle.prototype.commandCancel = function() {
  156.     if (Fomar.ITBS.partyCommand) {
  157.       this.startPartyCommandSelection();
  158.     } else {
  159.       this.selectPreviousCommand();
  160.     }
  161.   };

  162.   Scene_Battle.prototype.commandFight = function() {
  163.     this._partyCommandWindow.close();
  164.     this._actorCommandWindow.open();
  165.     this._actorCommandWindow.activate();
  166.   };

  167.   Scene_Battle.prototype.commandPass = function() {
  168.     this.selectNextCommand();
  169.   };

  170.   Scene_Battle.prototype.commandEscape = function() {
  171.     BattleManager.processEscape();
  172.     this.selectNextCommand();
  173.   };

  174. })();
复制代码
使用方法:
在插件中启用即可,无插件指令。
回复

使用道具 举报

0

主题

1

回帖

7

积分

新手上路

积分
7
发表于 2024-8-14 10:35:57 | 显示全部楼层
太有用了,感谢!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册用户

本版积分规则

Archiver|QQ群: 48625831|爱上RPG|哈库纳玛塔塔 |网站地图 Clicky

GMT+8, 2024-11-22 12:09 , Processed in 0.064519 second(s), 19 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表