设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 12375|回复: 20
打印 上一主题 下一主题

[原创发布] 自动战斗插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
跳转到指定楼层
1
发表于 2018-9-13 23:14:28 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 魏玉龙 于 2018-9-14 17:17 编辑

玩别人做的游戏时,刷野怪有点疲了,就随手写了个自动战斗插件!需要的尽管拿去!

JAVASCRIPT 代码复制下载
  1. /*:
  2.  * AutoBattle.js
  3.  * @plugindesc 自动战斗
  4.  * @author 魏玉龙
  5.  * @since 2018.09.12
  6.  * @version 1.0
  7.  *
  8.  * @param enabled
  9.  * @desc 开启自动战斗
  10.  * @default true
  11.  *
  12.  * @param command
  13.  * @desc 命令显示文字
  14.  * @default 自动
  15.  *
  16.  * @param continous
  17.  * @desc 是否连续的自动战斗
  18.  * @default false
  19.  *
  20.  * @param skipMessage
  21.  * @desc 跳过战斗中的消息
  22.  * @default false
  23.  *
  24.  * @help
  25.  * 此插件提供以下插件命令:
  26.  *
  27.  * AutoBattle enable
  28.  *   开启自动战斗
  29.  *
  30.  * AutoBattle disable
  31.  *   关闭自动战斗
  32.  *
  33.  * AutoBattle continous true/false
  34.  *   是否开启连续的自动战斗
  35.  *
  36.  * AutoBattle skipMessage true/false
  37.  *   是否跳过战斗中的消息
  38.  *
  39.  */
  40.  
  41. (function () {
  42.   var parameters = PluginManager.parameters('AutoBattle');
  43.   var autoBattle = {
  44.     enabled: JSON.parse(parameters['enabled'] || true),
  45.     command: String(parameters['command'] || '自动'),
  46.     continous: JSON.parse(parameters['continous'] || false),
  47.     skipMessage: JSON.parse(parameters['skipMessage'] || false)
  48.   };
  49.  
  50.   var Game_Temp_prototype_initialize = Game_Temp.prototype.initialize;
  51.   Game_Temp.prototype.initialize = function () {
  52.     Game_Temp_prototype_initialize.call(this);
  53.     this._continousAutoBattle = false;
  54.   };
  55.  
  56.   var Scene_Battle_prototype_update = Scene_Battle.prototype.update;
  57.   Scene_Battle.prototype.update = function () {
  58.     Scene_Battle_prototype_update.call(this);
  59.     if ($gameTemp._continousAutoBattle && (Input.isTriggered('escape') || Input.isTriggered('cancel'))) {
  60.       SoundManager.playCancel();
  61.       $gameTemp._continousAutoBattle = false;
  62.     }
  63.   }
  64.  
  65.   var Scene_Battle_prototype_createAllWindows = Scene_Battle.prototype.createAllWindows;
  66.   Scene_Battle.prototype.createAllWindows = function () {
  67.     if (!autoBattle.continous) {
  68.       $gameTemp._continousAutoBattle = false;
  69.     }
  70.     Scene_Battle_prototype_createAllWindows.call(this);
  71.   };
  72.  
  73.   var Scene_Battle_prototype_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  74.   Scene_Battle.prototype.createPartyCommandWindow = function () {
  75.     Scene_Battle_prototype_createPartyCommandWindow.call(this);
  76.     if (autoBattle.enabled) {
  77.       this._partyCommandWindow.setHandler('auto', this.commandAutoBattle.bind(this));
  78.     }
  79.   };
  80.  
  81.   var Scene_Battle_prototype_startPartyCommandSelection = Scene_Battle.prototype.startPartyCommandSelection;
  82.   Scene_Battle.prototype.startPartyCommandSelection = function () {
  83.     if ($gameTemp._continousAutoBattle && !SceneManager.isSceneChanging()) {
  84.       this.commandAutoBattle.call(this);
  85.     } else {
  86.       Scene_Battle_prototype_startPartyCommandSelection.call(this)
  87.     }
  88.   };
  89.   Scene_Battle.prototype.commandAutoBattle = function () {
  90.     $gameParty.battleMembers().forEach(function (member) {
  91.       if (member.canInput()) {
  92.         member.makeAutoBattleActions();
  93.       }
  94.     });
  95.     $gameTemp._continousAutoBattle = true;
  96.     this._partyCommandWindow.deactivate();
  97.     BattleManager.startTurn();
  98.   };
  99.   Scene_Battle.prototype.refreshAutobattlerStatusWindow = function () {
  100.     $gameParty.battleMembers().forEach(function (member) {
  101.       if (member.isAutoBattle()) {
  102.         this._statusWindow.drawItem(member.index)
  103.       }
  104.     });
  105.   };
  106.  
  107.   var Window_Message_prototype_startPause = Window_Message.prototype.startPause;
  108.   Window_Message.prototype.startPause = function () {
  109.     if ($gameParty.inBattle() && $gameTemp._continousAutoBattle && autoBattle.skipMessage) {
  110.       this.terminateMessage();
  111.     } else {
  112.       Window_Message_prototype_startPause.call(this);
  113.     }
  114.   }
  115.  
  116.   var Window_PartyCommand_prototype_makeCommandList = Window_PartyCommand.prototype.makeCommandList;
  117.   Window_PartyCommand.prototype.makeCommandList = function () {
  118.     Window_PartyCommand_prototype_makeCommandList.call(this);
  119.     if (autoBattle.enabled) {
  120.       this.addCommand(autoBattle.command, 'auto');
  121.     }
  122.   };
  123.  
  124.   var Game_Interpreter_prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  125.   Game_Interpreter.prototype.pluginCommand = function (command, args) {
  126.     Game_Interpreter_prototype_pluginCommand.call(this, command, args);
  127.     if (command === "AutoBattle") {
  128.       switch (args) {
  129.         case 'enable':
  130.           autoBattle.enabled = true;
  131.           break
  132.         case 'disable':
  133.           autoBattle.enabled = false;
  134.           break
  135.         case 'continous':
  136.           autoBattle.continous = JSON.parse(args[1]);
  137.           break
  138.         case 'skipMessage':
  139.           autoBattle.continous = JSON.parse(args[1]);
  140.           break
  141.       }
  142.     }
  143.   };
  144. })();

评分

参与人数 2+2 收起 理由
heipai + 1 精品文章
白嫩白嫩的 + 1 塞糖

查看全部评分

Lv1.梦旅人

梦石
0
星屑
101
在线时间
17 小时
注册时间
2022-9-13
帖子
8
19
发表于 2022-9-14 21:46:48 | 只看该作者
谢谢大佬分享
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1598
在线时间
220 小时
注册时间
2022-2-3
帖子
160
18
发表于 2022-3-27 05:21:14 | 只看该作者
话说直接跳过战斗。。。不就是 物品+++ 经验值+++吗。。
我的联系方式Q: 1127808900
欢迎一起讨论任何问题
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2770
在线时间
601 小时
注册时间
2018-5-18
帖子
331
17
发表于 2022-3-4 10:06:35 | 只看该作者
大佬能写个支持AABS的战斗插件吗?
这个人很馋,什么都没有留下。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
168
在线时间
39 小时
注册时间
2021-6-16
帖子
30
16
发表于 2022-2-21 15:13:04 | 只看该作者
这个好哦,可以挂机刷装备了
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2770
在线时间
601 小时
注册时间
2018-5-18
帖子
331
15
发表于 2022-2-21 14:57:48 | 只看该作者
大佬你好,请问有mog的ABS战斗系统的自动战斗插件吗?
这个人很馋,什么都没有留下。。。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
587
在线时间
59 小时
注册时间
2020-2-5
帖子
15
14
发表于 2020-4-6 01:17:08 | 只看该作者
感谢,可以去试试挂机了

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
587
在线时间
59 小时
注册时间
2020-2-5
帖子
15
13
发表于 2020-4-6 00:40:07 | 只看该作者
这是挂机战斗插件?谢谢楼主的分享,抱走试试看

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
446
在线时间
51 小时
注册时间
2020-3-31
帖子
10
12
发表于 2020-4-5 23:53:03 | 只看该作者
收藏一下
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
699
在线时间
81 小时
注册时间
2019-7-23
帖子
17
11
发表于 2019-7-23 17:22:43 | 只看该作者
好棒 谢谢大大
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 13:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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