Project1
标题: 逃跑菜单并入ActorCommand的问题 [打印本页]
作者: doranikofu 时间: 2015-11-18 14:51
标题: 逃跑菜单并入ActorCommand的问题
不太喜欢默认的逃跑选项的位置在PartyCommand,于是把逃跑并入了ActorCommand跟攻击物品技能放在一起
使用Yanfly的插件的话,战斗开始的时候自动跳过partycommand那个战斗还是逃跑的菜单直接进入角色行动。
稍微改一下ActorCommand加入逃跑,并且屏蔽掉退回上一层菜单就可以了,修改如下
Scene_Battle.prototype.createActorCommandWindow = function() {
this._actorCommandWindow = new Window_ActorCommand();
this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
// this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
// 加入逃跑选项
this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
this.addWindow(this._actorCommandWindow);
//this._actorCommandWindow.opacity = 150;
};
Window_ActorCommand.prototype.makeCommandList = function() {
if (this._actor) {
this.addAttackCommand();
this.addSkillCommands();
this.addGuardCommand();
this.addItemCommand();
//加入逃跑选项
this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
}
};
Scene_Battle.prototype.createActorCommandWindow = function() {
this._actorCommandWindow = new Window_ActorCommand();
this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
// this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
// 加入逃跑选项
this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
this.addWindow(this._actorCommandWindow);
//this._actorCommandWindow.opacity = 150;
};
Window_ActorCommand.prototype.makeCommandList = function() {
if (this._actor) {
this.addAttackCommand();
this.addSkillCommands();
this.addGuardCommand();
this.addItemCommand();
//加入逃跑选项
this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
}
};
回合制的时候没有任何问题,然而ATB的模式问题来了。
如果逃跑失败的话,atb就不会继续更新,然后战斗就停留在逃跑失败的状态无法继续。翻了半天js也没找到究竟是哪个地方的问题。默认的在partycommand里面逃跑没有这个问题。应该是turn的计算哪里错了导致没有继续。这次代码一层套一层感觉很难找到哪里有问题。不知道有木有熟悉Yanfly的ATB的菊苣指点一下。。。
Yanfly的逃跑的函数是这个
BattleManager.processEscapeATB = function() {
$gameParty.performEscape();
SoundManager.playEscape();
var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
if (success) {
$gameParty.removeBattleStates();
this.displayEscapeSuccessMessage();
this._escaped = true;
this.processAbort();
} else {
this.displayEscapeFailureMessage();
this._escapeRatio += this._escapeFailBoost;
$gameParty.clearActions();
this.startTurn();
this.processFailEscapeATB();
}
return success;
};
BattleManager.processEscapeATB = function() {
$gameParty.performEscape();
SoundManager.playEscape();
var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
if (success) {
$gameParty.removeBattleStates();
this.displayEscapeSuccessMessage();
this._escaped = true;
this.processAbort();
} else {
this.displayEscapeFailureMessage();
this._escapeRatio += this._escapeFailBoost;
$gameParty.clearActions();
this.startTurn();
this.processFailEscapeATB();
}
return success;
};
然后那个默认的startTurn在ATB模式下是直接被跳过了,没有搞懂到底咋继续的。。。
Yanfly.ATB.BattleManager_startTurn = BattleManager.startTurn;
BattleManager.startTurn = function() {
if (this.isATB()) return;
Yanfly.ATB.BattleManager_startTurn.call(this);
};
Yanfly.ATB.BattleManager_startTurn = BattleManager.startTurn;
BattleManager.startTurn = function() {
if (this.isATB()) return;
Yanfly.ATB.BattleManager_startTurn.call(this);
};
作者: trentswd 时间: 2015-12-7 22:13
本帖最后由 trentswd 于 2015-12-7 22:36 编辑
原因是
actor->party party->actor 菜单切换的时候做了一些处理
所以要把这些处理给弄好Scene_Battle.prototype.createActorCommandWindow = function() {
this._actorCommandWindow = new Window_ActorCommand();
this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
// this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
// 加入逃跑选项
this._actorCommandWindow.setHandler('escape', this.commandEscapeActor.bind(this));
this.addWindow(this._actorCommandWindow);
//this._actorCommandWindow.opacity = 150;
};
Scene_Battle.prototype.commandEscapeActor = function() {
var actorIndex = BattleManager._actorIndex;
BattleManager.selectNextCommand();
BattleManager._actorIndex = actorIndex;
this.commandEscape();
}
Window_ActorCommand.prototype.makeCommandList = function() {
if (this._actor) {
this.addAttackCommand();
this.addSkillCommands();
this.addGuardCommand();
this.addItemCommand();
//加入逃跑选项
this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
}
};
Scene_Battle.prototype.createActorCommandWindow = function() {
this._actorCommandWindow = new Window_ActorCommand();
this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
// this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
// 加入逃跑选项
this._actorCommandWindow.setHandler('escape', this.commandEscapeActor.bind(this));
this.addWindow(this._actorCommandWindow);
//this._actorCommandWindow.opacity = 150;
};
Scene_Battle.prototype.commandEscapeActor = function() {
var actorIndex = BattleManager._actorIndex;
BattleManager.selectNextCommand();
BattleManager._actorIndex = actorIndex;
this.commandEscape();
}
Window_ActorCommand.prototype.makeCommandList = function() {
if (this._actor) {
this.addAttackCommand();
this.addSkillCommands();
this.addGuardCommand();
this.addItemCommand();
//加入逃跑选项
this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
}
};
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |