当自动战斗插件和ATC插件并存,出现冲突怎么办?
/** * Created by Gilles on 01.11.2015. * @email: *//*: * @plugindesc Allows Auto Attack in Battle. The players will always choose the enemy with the lowest hp * @author Gilles Meyer * * @param Auto Attack Text Party * @desc The text which will appear in the Party command Menu * @default Auto Attack * * @param Auto Attack Text Actor * @desc The text which will appear in the Actor command Menu * @default Auto Attack * * * */(function() {var parameters = PluginManager.parameters('AutoBattlePlugin');var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "自动");var autoAttackActorText = String(parameters['Auto Attack Text Actor'] || "自动");var getEnemyWithLowestHP = function(enemies) { var enemyIndex = 0; for(var i=1; i < enemies.length; i++) { if(enemies.hp < enemies.hp || enemies.hp == 0) { enemyIndex = i; } } return enemyIndex;}; Scene_Battle.prototype.commandAutoFight = function() { this.selectNextCommand(); do { this.commandAutoAttack.apply(this, arguments); } while(BattleManager.isInputting()); this._actorCommandWindow.deactivate();};Scene_Battle.prototype.commandAutoAttack = function() { BattleManager.inputtingAction().setAttack(); var enemyIndex = getEnemyWithLowestHP(this._enemyWindow._enemies); var action = BattleManager.inputtingAction(); action.setTarget(enemyIndex); this.selectNextCommand();};// ## Autofight for Party Window_PartyCommand.prototype.makeCommandList = function() { this.addCommand(TextManager.fight,'fight'); // Needs rework this.addCommand(autoAttackPartyText,'autofight'); this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());};var _Scene_Battle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;Scene_Battle.prototype.createPartyCommandWindow = function() { _Scene_Battle_createPartyCommandWindow.apply(this, arguments); this._partyCommandWindow.setHandler('autofight',this.commandAutoFight.bind(this));};// ## Autofight for each Actorvar Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;Scene_Battle.prototype.createActorCommandWindow = function() { Scene_Battle_createActorCommandWindow.call(this,arguments); this._actorCommandWindow.setHandler('autoattack', this.commandAutoAttack.bind(this));};var _Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;Window_ActorCommand.prototype.makeCommandList = function() { if(this._actor) { this.addCommand(autoAttackActorText, 'autoattack', this._actor.canAttack()); } _Window_ActorCommand_makeCommandList.call(this, arguments);};})();复制代码本帖来自P1论坛作者索里,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=385896若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]