按您的方法去查看了一下,大概意思就是
Game_Battler 1里面先把速度值确认出来#-------------------------------------------------------------------------- # ● 确定动作速度 #-------------------------------------------------------------------------- def make_action_speed @current_action.speed = agi + rand(10 + agi / 4) end
#--------------------------------------------------------------------------
# ● 确定动作速度
#--------------------------------------------------------------------------
def make_action_speed
@current_action.speed = agi + rand(10 + agi / 4)
end
然后
#-------------------------------------------------------------------------- # ● 生成行动循序 #-------------------------------------------------------------------------- def make_action_orders # 初始化序列 @action_battlers @action_battlers = [] # 添加敌人到 @action_battlers 序列 for enemy in $game_troop.enemies @action_battlers.push(enemy) end # 添加角色到 @action_battlers 序列 for actor in $game_party.actors @action_battlers.push(actor) end # 确定全体的行动速度 for battler in @action_battlers battler.make_action_speed end # 按照行动速度从大到小排列 @action_battlers.sort! {|a,b| b.current_action.speed - a.current_action.speed } end
#--------------------------------------------------------------------------
# ● 生成行动循序
#--------------------------------------------------------------------------
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = []
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
end
# 添加角色到 @action_battlers 序列
for actor in $game_party.actors
@action_battlers.push(actor)
end
# 确定全体的行动速度
for battler in @action_battlers
battler.make_action_speed
end
# 按照行动速度从大到小排列
@action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
这里就是对参与战斗的ID进行速度值确认,然后按大小来判定先后顺序是吧
那这里最后一句的b.current_action.speed - a.current_action.speed是什么意思呢 |