#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def update_loadcraft
@craft_window.update
@equip_icon.set_item(@craft_window.recipe)
@equip_icon.refresh
@ingredients_window.update
if $game_party.recipes.size > 0
@result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
@ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
@craft_window.recipe.ingredient_types,
@craft_window.recipe.quantities)
end
if @craft_window.active
update_craft
return
end
if @yes_no_window.active
confirm_update
return
end
end
#--------------------------------------------------------------------------
def update_craft
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@scene = 99
return
end
if Input.trigger?(Input::C) and $game_party.recipes.size != 0
@recipe = @craft_window.recipe
if @recipe.have
$game_system.se_play($data_system.decision_se)
@yes_no_window.active = true
@craft_window.active = false
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
def update_status
if @command_window.index == 4 and @stagg != @status_window.index
# 演奏确定 SE
# 切换到状态画面
# 获取角色
@actor = $game_party.actors[@status_window.index]
# 生成状态窗口
if @stagg != -1
@status_status_window.dispose
end
@stagg = @status_window.index
@status_status_window = Window_Status_New.new(@actor)
@status_update = true
end
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
if @command_window.index == 4
@status_status_window.dispose
@stagg = -1
end
# 激活命令窗口
@command_window.active = true
@status_window.active = false
@status_window.index = -2
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 1 # 特技
# 本角色的行动限制在 2 以上的情况下
if $game_party.actors[@status_window.index].restriction >= 2
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@window_index = @status_window.index
@actor = $game_party.actors[@status_window.index]
# 生成帮助窗口、状态窗口、特技窗口
@skill_help_window = Window_Help_New_Skill.new
@skill_window = Window_Skill_New.new(@actor)
#........................................................................
@skill_window_icon = Window_Skill_Icon.new
@skill_window_icon.y = 402
#........................................................................
# 关联帮助窗口
@skill_window.help_window = @skill_help_window
@status_window.active = false
@skill_update = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 物品刷新
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@item_help_window.dispose
@item_window.dispose
#........................................................................
@equip_window.dispose
#........................................................................
@item_update = false
@command_window.active = true
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口当前选中的物品数据
@item = @item_window.item
# 不使用物品的情况下
unless @item.is_a?(RPG::Item)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 不能使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @item.scope >= 3
# 激活目标窗口
@item_window.active = false
@status_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @item.scope == 4 || @item.scope == 6
@status_window.index = -1
else
@status_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@item_window.draw_item(@item_window.index)
end
@item_help_window.dispose
@item_window.dispose
#........................................................................
@equip_window.dispose
#........................................................................
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
end
def update_item_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 由于物品用完而不能使用的场合
unless $game_party.item_can_use?(@item.id)
# 再次生成物品窗口的内容
@item_window.refresh
end
# 删除目标窗口
@item_window.active = true
@status_window.index = -2
@status_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 如果物品用完的情况下
if $game_party.item_number(@item.id) == 0
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @status_window.index == -1
# 对同伴全体应用物品使用效果
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# 目标是单体的情况下
if @status_window.index >= 0
# 对目标角色应用物品的使用效果
target = $game_party.actors[@status_window.index]
used = target.item_effect(@item)
end
# 使用物品的情况下
if used
# 演奏物品使用时的 SE
$game_system.se_play(@item.menu_se)
# 消耗品的情况下
if @item.consumable
# 使用的物品数减 1
$game_party.lose_item(@item.id, 1)
# 再描绘物品窗口的项目
@item_window.draw_item(@item_window.index)
end
# 再生成目标窗口的内容
@status_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @item.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @item.common_event_id
@item_help_window.dispose
@item_window.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用物品的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# ● 技能刷新
#--------------------------------------------------------------------------
def update_skill
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@skill_help_window.dispose
@skill_window.dispose
@skill_window_icon.dispose
@skill_update = false
@status_window.active = true
@status_window.index = @window_index
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技窗口现在选择的特技的数据
@skill = @skill_window.skill
# 不能使用的情况下
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @skill.scope >= 3
# 激活目标窗口
@skill_window.active = false
@status_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @skill.scope == 4 || @skill.scope == 6
@status_window.index = -1
elsif @skill.scope == 7
@status_window.index = @actor_index - 10
else
@status_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
# 消耗 SP
@actor.sp -= @skill.sp_cost
# 再生成各窗口的内容
@skill_window.refresh
@status_window.refresh
@skill_help_window.dispose
@skill_window.dispose
@skill_window_icon.dispose
@back_skill.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
end
def update_skill_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 删除目标窗口
@skill_window.active = true
@status_window.index = -2
@status_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 因为 SP 不足而无法使用的情况下
unless @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @status_window.index == -1
# 对同伴全体应用特技使用效果
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# 目标是使用者的情况下
if @status_window.index <= -2
# 对目标角色应用特技的使用效果
target = $game_party.actors[@status_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# 目标是单体的情况下
if @status_window.index >= 0
# 对目标角色应用特技的使用效果
target = $game_party.actors[@status_window.index]
used = target.skill_effect(@actor, @skill)
end
# 使用特技的情况下
if used
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
#-----修正------------------------------------------------------
@actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
# SP 消費
@actor.sp -= @actor.skill_sp_cost[@skill.id]
#---------------------------------------------------------------
# 再生成各窗口内容
@status_window.refresh
@skill_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
@skill_help_window.dispose
@skill_window.dispose
@back_skill.dispose
# 释放窗口
@item_window.dispose
# @back_item.dispose
@status_window.dispose
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用特技的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# ● 装备刷新
#--------------------------------------------------------------------------
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@equip_help_window.dispose
@equip_right_window.dispose
@equip_item_window1.dispose
@equip_item_window2.dispose
@equip_item_window3.dispose
@equip_item_window4.dispose
@equip_item_window5.dispose
@equip_item_window6.dispose
@equip_item_window7.dispose
@equip_item_window8.dispose
#........................................................................
@equip_window.dispose
#........................................................................
@equip_update = false
@status_window1.active = true
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@equip_right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@equip_right_window.active = false
@equip_item_window.active = true
@equip_window.set_item_id
@equip_item_window.index = 0
return
end
end
def update_equip_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@equip_right_window.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
@equip_window.set_item_id
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 获取物品窗口现在选择的装备数据
item = @equip_item_window.item
# 变更装备
@actor.equip(@equip_right_window.index, item == nil ? 0 : item.id)
# 激活右侧窗口
@equip_right_window.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
@equip_window.set_item_id
# 再生成右侧窗口、物品窗口的内容
@equip_right_window.refresh
if @equip_right_window.index == 6 or @equip_right_window.index == 7
@equip_item_window7.refresh
@equip_item_window8.refresh
else
@equip_item_window.refresh
end
return
end
end
def update_status1
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活命令窗口
@command_window.active = true
@status_window1.active = false
@status_window1.index = -1
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@equip_index = 0
@actor = $game_party.actors[@status_window1.index]
@equip_help_window = Window_Help_New.new
@equip_help_window.x = 137
@equip_help_window.y = 480 - 64 - 32 - 8
@equip_right_window = Window_EquipRight_New.new(@actor)
@equip_item_window1 = Window_EquipItem_New.new(@actor, 0)
@equip_item_window2 = Window_EquipItem_New.new(@actor, 1)
@equip_item_window3 = Window_EquipItem_New.new(@actor, 2)
@equip_item_window4 = Window_EquipItem_New.new(@actor, 3)
@equip_item_window5 = Window_EquipItem_New.new(@actor, 4)
@equip_item_window6 = Window_EquipItem_New.new(@actor, 5)
@equip_item_window7 = Window_EquipItem_New.new(@actor, 6)
@equip_item_window8 = Window_EquipItem_New.new(@actor, 6)
#........................................................................
@equip_window = Window_Equip.new
@equip_window.y = 394
@equip_window.set_item_id
#........................................................................
# 关联帮助窗口
@equip_right_window.help_window = @equip_help_window
@equip_item_window1.help_window = @equip_help_window
@equip_item_window2.help_window = @equip_help_window
@equip_item_window3.help_window = @equip_help_window
@equip_item_window4.help_window = @equip_help_window
@equip_item_window5.help_window = @equip_help_window
@equip_item_window6.help_window = @equip_help_window
@equip_item_window7.help_window = @equip_help_window
@equip_item_window8.help_window = @equip_help_window
# 设置光标位置
@equip_right_window.index = @equip_index
@status_window1.active = false
@equip_update = true
# 设置物品窗口的可视状态
@equip_item_window1.visible = (@equip_right_window.index == 0)
@equip_item_window2.visible = (@equip_right_window.index == 1)
@equip_item_window3.visible = (@equip_right_window.index == 2)
@equip_item_window4.visible = (@equip_right_window.index == 3)
@equip_item_window5.visible = (@equip_right_window.index == 4)
@equip_item_window6.visible = (@equip_right_window.index == 5)
@equip_item_window7.visible = (@equip_right_window.index == 6)
@equip_item_window8.visible = (@equip_right_window.index == 7)
# 获取当前装备中的物品
item1 = @equip_right_window.item
# 设置当前的物品窗口到 @item_window
@equip_window.set_item_id
case @equip_right_window.index
when 0
@equip_item_window = @equip_item_window1
when 1
@equip_item_window = @equip_item_window2
when 2
@equip_item_window = @equip_item_window3
when 3
@equip_item_window = @equip_item_window4
when 4
@equip_item_window = @equip_item_window5
when 5
@equip_item_window = @equip_item_window6
when 6
@equip_item_window = @equip_item_window7
when 7
@equip_item_window = @equip_item_window8
end
# 右窗口被激活的情况下
if @equip_right_window.active
# 删除变更装备后的能力
@status_window1.set_new_parameters(nil, nil, nil)
end
# 物品窗口被激活的情况下
if @equip_item_window.active
# 获取现在选中的物品
item2 = @equip_item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@equip_right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# 返回到装备
@actor.equip(@equip_right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@status_window1.set_new_parameters(new_atk, new_pdef, new_mdef)
#........................................................................
@equip_window.set_item(item2)
#........................................................................
end
end
end
#--------------------------------------------------------------------------
# ● 状态刷新
#--------------------------------------------------------------------------
def update_status_status
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@status_status_window.dispose
@bgstatus.dispose
@status_update = false
@status_window.active = true
return
end
end
def update_system
@system_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@system_window.dispose
@sys_update = false
@command_window.active = true
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
case @system_window.index
when 0
@bgm_window = Window_BGM_Volume.new(80, ["0%", "17%", "34%", "50%", "67%", "84%", "100%"])
@currentbgm_window = Window_CurrentBGM_Volume.new
@system_window.active = false
when 1
@sfx_window = Window_SFX_Volume.new(80, ["0%", "17%", "34%", "50%", "67%", "84%", "100%"])
@currentsfx_window = Window_CurrentSFX_Volume.new
@system_window.active = false
when 2
@system_window.dispose
$scene = Scene_Save.new
when 3
@system_window.dispose
$scene = Scene_Load.new(true)
when 4
@end_window = Window_EndCommand.new
@system_window.active = false
end
return
end
end
def update_bgm
@bgm_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@system_window.active = true
@bgm_window.dispose
@currentbgm_window.dispose
return
end
if Input.trigger?(Input::C)
case @bgm_window.index
when 0
$game_system.bgm_volume = 0
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 1
$game_system.bgm_volume = 17
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 2
$game_system.bgm_volume = 34
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 3
$game_system.bgm_volume = 50
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 4
$game_system.bgm_volume = 67
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 5
$game_system.bgm_volume = 84
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
when 6
$game_system.bgm_volume = 100
$game_system.bgm_play($game_system.bgm_memorize)
@currentbgm_window.refresh
end
return
end
end
def update_sfx
@sfx_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@sfx_window.dispose
@currentsfx_window.dispose
@system_window.active = true
return
end
if Input.trigger?(Input::C)
case @sfx_window.index
when 0
$game_system.se_volume = 0
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 1
$game_system.se_volume = 17
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 2
$game_system.se_volume = 34
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 3
$game_system.se_volume = 50
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 4
$game_system.se_volume = 67
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 5
$game_system.se_volume = 84
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
when 6
$game_system.se_volume = 100
$game_system.se_play($data_system.decision_se)
@currentsfx_window.refresh
end
$game_map.autoplay
return
end
end
def update_end
@end_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@end_window.dispose
@system_window.active = true
return
end
if Input.trigger?(Input::C)
case @end_window.index
when 0
@end_window.dispose
@system_window.dispose
command_to_title
when 1
command_shutdown
end
return
end
end
def command_to_title
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
end