| 赞 | 15 |
| VIP | |
| 好人卡 | |
| 积分 | 3 |
| 经验 | |
| 最后登录 | 2026-5-25 |
| 在线时间 | 217 小时 |
- 梦石
- 0
- 星屑
- 296
- 在线时间
- 217 小时
- 注册时间
- 2008-12-18
- 回帖
- 30
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 魏玉龙 于 2018-9-14 17:17 编辑
玩别人做的游戏时,刷野怪有点疲了,就随手写了个自动战斗插件!需要的尽管拿去!
[pre lang="javascript" file="AutoBattle.js"]
/*:
* AutoBattle.js
* @plugindesc 自动战斗
* @author 魏玉龙
* @since 2018.09.12
* @version 1.0
*
* @param enabled
* @desc 开启自动战斗
* @default true
*
* @param command
* @desc 命令显示文字
* @default 自动
*
* @param continous
* @desc 是否连续的自动战斗
* @default false
*
* @param skipMessage
* @desc 跳过战斗中的消息
* @default false
*
* @help
* 此插件提供以下插件命令:
*
* AutoBattle enable
* 开启自动战斗
*
* AutoBattle disable
* 关闭自动战斗
*
* AutoBattle continous true/false
* 是否开启连续的自动战斗
*
* AutoBattle skipMessage true/false
* 是否跳过战斗中的消息
*
*/
(function () {
var parameters = PluginManager.parameters('AutoBattle');
var autoBattle = {
enabled: JSON.parse(parameters['enabled'] || true),
command: String(parameters['command'] || '自动'),
continous: JSON.parse(parameters['continous'] || false),
skipMessage: JSON.parse(parameters['skipMessage'] || false)
};
var Game_Temp_prototype_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function () {
Game_Temp_prototype_initialize.call(this);
this._continousAutoBattle = false;
};
var Scene_Battle_prototype_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function () {
Scene_Battle_prototype_update.call(this);
if ($gameTemp._continousAutoBattle && (Input.isTriggered('escape') || Input.isTriggered('cancel'))) {
SoundManager.playCancel();
$gameTemp._continousAutoBattle = false;
}
}
var Scene_Battle_prototype_createAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function () {
if (!autoBattle.continous) {
$gameTemp._continousAutoBattle = false;
}
Scene_Battle_prototype_createAllWindows.call(this);
};
var Scene_Battle_prototype_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
Scene_Battle.prototype.createPartyCommandWindow = function () {
Scene_Battle_prototype_createPartyCommandWindow.call(this);
if (autoBattle.enabled) {
this._partyCommandWindow.setHandler('auto', this.commandAutoBattle.bind(this));
}
};
var Scene_Battle_prototype_startPartyCommandSelection = Scene_Battle.prototype.startPartyCommandSelection;
Scene_Battle.prototype.startPartyCommandSelection = function () {
if ($gameTemp._continousAutoBattle && !SceneManager.isSceneChanging()) {
this.commandAutoBattle.call(this);
} else {
Scene_Battle_prototype_startPartyCommandSelection.call(this)
}
};
Scene_Battle.prototype.commandAutoBattle = function () {
$gameParty.battleMembers().forEach(function (member) {
if (member.canInput()) {
member.makeAutoBattleActions();
}
});
$gameTemp._continousAutoBattle = true;
this._partyCommandWindow.deactivate();
BattleManager.startTurn();
};
Scene_Battle.prototype.refreshAutobattlerStatusWindow = function () {
$gameParty.battleMembers().forEach(function (member) {
if (member.isAutoBattle()) {
this._statusWindow.drawItem(member.index)
}
});
};
var Window_Message_prototype_startPause = Window_Message.prototype.startPause;
Window_Message.prototype.startPause = function () {
if ($gameParty.inBattle() && $gameTemp._continousAutoBattle && autoBattle.skipMessage) {
this.terminateMessage();
} else {
Window_Message_prototype_startPause.call(this);
}
}
var Window_PartyCommand_prototype_makeCommandList = Window_PartyCommand.prototype.makeCommandList;
Window_PartyCommand.prototype.makeCommandList = function () {
Window_PartyCommand_prototype_makeCommandList.call(this);
if (autoBattle.enabled) {
this.addCommand(autoBattle.command, 'auto');
}
};
var Game_Interpreter_prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
Game_Interpreter_prototype_pluginCommand.call(this, command, args);
if (command === "AutoBattle") {
switch (args) {
case 'enable':
autoBattle.enabled = true;
break
case 'disable':
autoBattle.enabled = false;
break
case 'continous':
autoBattle.continous = JSON.parse(args[1]);
break
case 'skipMessage':
autoBattle.continous = JSON.parse(args[1]);
break
}
}
};
})();[/pre] |
评分
-
查看全部评分
|