本帖最后由 alexncf125 于 2024-1-13 22:41 编辑
佬看看这样改会出bug么?
BattleManager.forceAction = function ( battler) {
// this._actionForcedBattler = battler; // 此行移除
var index = this ._actionBattlers.indexOf ( battler) ;
if ( index >= 0 ) {
this ._actionBattlers.splice ( index, 1 ) ;
}
// 以下是新增內容
var actionBattlers = this ._actionBattlers;
actionBattlers.splice ( 0 , 0 , battler) ;
actionBattlers.forEach ( function ( b) {
b.makeSpeed ( ) ;
} ) ;
actionBattlers.sort ( function ( a, b) {
return b.speed ( ) - a.speed ( ) ;
} ) ;
this ._actionBattlers = actionBattlers;
// 以上是新增內容
} ;
BattleManager.forceAction = function ( battler) {
// this._actionForcedBattler = battler; // 此行移除
var index = this ._actionBattlers.indexOf ( battler) ;
if ( index >= 0 ) {
this ._actionBattlers.splice ( index, 1 ) ;
}
// 以下是新增內容
var actionBattlers = this ._actionBattlers;
actionBattlers.splice ( 0 , 0 , battler) ;
actionBattlers.forEach ( function ( b) {
b.makeSpeed ( ) ;
} ) ;
actionBattlers.sort ( function ( a, b) {
return b.speed ( ) - a.speed ( ) ;
} ) ;
this ._actionBattlers = actionBattlers;
// 以上是新增內容
} ;
BattleManager.processTurn = function ( ) {
var subject = this ._subject;
var action = subject.currentAction ( ) ;
if ( action) {
// 以下是新增內容
if ( action._forcing) {
action._forcing = false ;
this ._subject = this .getNextSubject ( ) ;
return ;
}
// 以上是新增內容
action.prepare ( ) ;
if ( action.isValid ( ) ) {
this .startAction ( ) ;
}
subject.removeCurrentAction ( ) ;
} else {
subject.onAllActionsEnd ( ) ;
this .refreshStatus ( ) ;
this ._logWindow.displayAutoAffectedStatus ( subject) ;
this ._logWindow.displayCurrentState ( subject) ;
this ._logWindow.displayRegeneration ( subject) ;
this ._subject = this .getNextSubject ( ) ;
}
} ;
BattleManager.processTurn = function ( ) {
var subject = this ._subject;
var action = subject.currentAction ( ) ;
if ( action) {
// 以下是新增內容
if ( action._forcing) {
action._forcing = false ;
this ._subject = this .getNextSubject ( ) ;
return ;
}
// 以上是新增內容
action.prepare ( ) ;
if ( action.isValid ( ) ) {
this .startAction ( ) ;
}
subject.removeCurrentAction ( ) ;
} else {
subject.onAllActionsEnd ( ) ;
this .refreshStatus ( ) ;
this ._logWindow.displayAutoAffectedStatus ( subject) ;
this ._logWindow.displayCurrentState ( subject) ;
this ._logWindow.displayRegeneration ( subject) ;
this ._subject = this .getNextSubject ( ) ;
}
} ;