相关方法的定义内容:
#--------------------------------------------------------------------------
# ● 数据处理 增加 CP
#--------------------------------------------------------------------------
def add_battlers_cp
for battler in @now_battlers
next if battler.nil?
next if battler.dead?
next if battler.hidden
next if battler.cp >= @now_maxspeed
battler.cp += battler.agi
end
end
#--------------------------------------------------------------------------
# ● 设置输入命令的战斗者
#--------------------------------------------------------------------------
def set_input_action_battlers
for battler in @now_battlers
if battler.cp >= @now_maxspeed
@input_action_battlers.push(battler)
end
end
# 这一段是从 Scene_Battle 4 弄过来的 是决定战斗者的行动顺序的
if @input_action_battlers.size > 0
for battler in @input_action_battlers
battler.make_action_speed
end
if @input_action_battlers.size > 1
@input_action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
end
end
3.把满足如数命令的角色 进入回合3进入命令输入
进入输入命令 回合3
回合3需要修改的只有2个方法
#--------------------------------------------------------------------------
# ● 转到输入下一个角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 开始循环
begin
if @active_battler != nil
@active_battler.blink = false
end
如果 @actor_index的值已经达到了获得行动权战斗者数组的
# 最后的单元号
if @actor_index == @input_action_battlers.size-1
# 消耗这些战斗着的CP值
# 其实吧 这个东西不应该在这里消耗
# 因为在这里消耗的话就意味着 攻击/特技/物品/防御 消耗的是同样的CP了
# 不过话又说回来 很多人都是这样设置的。。。
for battler in @input_action_battlers
# 消耗的CP值就是CP槽的最大值
battler.cp -= @now_maxspeed
end
@cp_window.refresh(@now_maxspeed)
# 命令输入完了就进入 回合4
start_phase4
# 结束这个方法
return
end
# 当上面的这个条件分歧不满足的情况下 就推进 行动数组的索引
@actor_index += 1
# 代入战斗者
@active_battler = @input_action_battlers[@actor_index]
@active_battler.blink = true unless @active_battler.is_a?(Game_Enemy)
# 如果战斗者是敌人
if @active_battler.is_a?(Game_Enemy)
# 先初始化这个敌人的行动命令
@active_battler.current_action.clear
# 设置这个敌人的行动命令
# 或许放在这里设置有点不大好 。。就先放这里好了
# 如果想要写传说中的 AI 的话
# 搜索 def make_action
# 对这个方法进行修改
@active_battler.make_action
end
# 这个循环直到@active_battler为角色和这个角色可以输入命令的时候才结束
end until (@active_battler.is_a?(Game_Actor) and @active_battler.inputable?)
# 设置命令窗口 然后就开始给角色输入命令了
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 转向前一个角色的命令输入
#--------------------------------------------------------------------------
def phase3_prior_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
# 如果索引是数组的头部
if @actor_index == 0
# 重新开始回合3的流程
start_phase3
# 结束这个方法
return
end
@actor_index -= 1
@active_battler = @input_action_battlers[@actor_index]
@active_battler.blink = true unless @active_battler.is_a?(Game_Enemy)
# 这个循环直到@active_battler为角色和这个角色可以输入命令的时候才结束
end until (@active_battler.is_a?(Game_Actor) and @active_battler.inputable?)
phase3_setup_command_window
end
4.把输入了命令的战斗者进入回合4
就以目前的CP消耗的方法来说
回合4要修改的部位只有一个
把 start_phase4 简化成这样即可
#--------------------------------------------------------------------------
# ● 开始主回合
#--------------------------------------------------------------------------
def start_phase4
@phase = 4
$game_temp.battle_turn += 1
# 搜索全页的战斗事件
for index in 0...$data_troops[@troop_id].pages.size
# 获取事件页
page = $data_troops[@troop_id].pages[index]
# 本页的范围是 [回合] 的情况下
if page.span == 1
# 设置已经执行标志
$game_temp.battle_event_flags[index] = false
end
end
@actor_index = -1
@active_battler = nil
@actor_command_window.active = false
@actor_command_window.visible = false
$game_temp.battle_main_phase = true
# 把获得了行动权的战斗者转给 @action_battlers
@action_battlers = @input_action_battlers
@phase4_step = 1
end