#==============================================================================
# ■ Scene_Menu(修正)
#------------------------------------------------------------------------------
# 处理菜单画面的类。
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● 初始化对像
# menu_index : 命令光标的初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
@item_update = false
@skill_update = false
@equip_update = false
@status_update = false
@sys_update = false
@actor = $game_party.actors[0]
@changer = 0
@where = 0
@checker = 0
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@menu_equipenhanced_window = Window_ExtraEquip.new
@menu_equipenhanced_window.active = false
@menu_equipenhanced_window.visible = false
@screen = Spriteset_Map.new
# 生成命令窗口
@command_window = Window_MenuBar.new(@menu_index)
@command_window.contents = Bitmap.new("Graphics/System/bar.png")
@command_window.width = 672
@command_window.height = 128
@command_window.x = -16
@command_window.y = 0
@command_window.z = 3
@command_window.opacity = 0
# 同伴人数为 0 的情况下
if $game_party.actors.size == 0
# 物品、特技、装备、状态无效化
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# 禁止存档的情况下
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(4)
end
# 生成金钱窗口
@gold_window = Window_Gold_Menu.new
@gold_window.x = 480
@gold_window.y = 420
@gold_window.opacity = 0
# 生成状态窗口
@actorstatbg = Window_ActorStatBG.new
@actorstatbg.z = 4
@actorstatbg.x = -225-16
@actorstatus = Window_ActorStat.new
@actorstatus.z = 5
@actorstatus.x = -221-16
# 遮蔽窗口
@background_window = Window_BackGround.new
@background_window.z = 1
@background_window.x = 1132
@old_index = @menu_index
case @menu_index
when 0
@pic_now = 0
@command_window.contents = Bitmap.new("Graphics/System/barpics/item.png")
@background_window.contents = Bitmap.new("Graphics/System/BG_ITEM")
when 2
@command_window.contents = Bitmap.new("Graphics/System/barpics/skill.png")
@background_window.contents = Bitmap.new("Graphics/System/BG_SKILL")
when 1
@command_window.contents = Bitmap.new("Graphics/System/barpics/equip.png")
@background_window.contents = Bitmap.new("Graphics/System/BG_EQUIP")
when 3
@command_window.contents = Bitmap.new("Graphics/System/barpics/status.png")
@background_window.contents = Bitmap.new("Graphics/System/BG_STATUS")
when 4
@command_window.contents = Bitmap.new("Graphics/System/barpics/system.png")
@background_window.contents = Bitmap.new("Graphics/System/BG_SYS")
end
# 执行过渡
Graphics.transition
for i in 0..8
@actorstatbg.x += 25
@actorstatus.x += 25
@background_window.x -= 107
Graphics.update
end
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果切换画面就中断循环
if $scene != self
break
end
end
for i in 0..8
@actorstatbg.x -= 25
@actorstatus.x -= 25
@background_window.x += 107
Graphics.update
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@actorstatus.dispose
@background_window.dispose
@actorstatbg.dispose
@screen.dispose
@gold_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@command_window.update
@gold_window.update
if @menu_equipenhanced_window.active == true
update_extraequip
end
if @command_window.index != @old_index
case @command_window.index
when 0
if @pic_now != 0
@command_window.contents = Bitmap.new("Graphics/System/barpics/item.png")
@pic_now = 0
@background_window.contents = Bitmap.new("Graphics/System/BG_ITEM")
end
when 2
if @pic_now != 2
@command_window.contents = Bitmap.new("Graphics/System/barpics/skill.png")
@pic_now = 2
@background_window.contents = Bitmap.new("Graphics/System/BG_SKILL")
end
when 1
if @pic_now != 1
@command_window.contents = Bitmap.new("Graphics/System/barpics/equip.png")
@pic_now = 1
@background_window.contents = Bitmap.new("Graphics/System/BG_EQUIP")
end
when 3
if @pic_now != 3
@command_window.contents = Bitmap.new("Graphics/System/barpics/status.png")
@pic_now = 3
@background_window.contents = Bitmap.new("Graphics/System/BG_STATUS")
end
when 4
if @pic_now != 4
@command_window.contents = Bitmap.new("Graphics/System/barpics/system.png")
@pic_now = 4
@background_window.contents = Bitmap.new("Graphics/System/BG_SYS")
end
end
@old_index = @command_window.index
@old_index = @command_window.index
end
# 命令窗口被激活的情况下: 调用 update_command
if @command_window.active
update_command
return
end
# 状态窗口被激活的情况下: 调用 update_status
if @actorstatus.active
if @item_update
update_item_target
return
elsif @skill_update
update_skill_target
return
else
update_status
return
end
end
#----------------------------- 物品菜单 ---------------------------------
if @item_update
@item_help_window.update
@item_window.update
# 物品窗口被激活的情况下: 调用 update_item
if @item_window.active
update_item
return
end
#----------------------------- 奇术菜单 ---------------------------------
elsif @skill_update
# 刷新窗口
@skill_help_window.update
@skill_window.update
# 特技窗口被激活的情况下: 调用 update_skill
if @skill_window.active
update_skill
return
end
#----------------------------- 装备菜单 ---------------------------------
elsif @equip_update
@equip_right_window.update
@equip_item_window.update
# 设置物品窗口的可视状态
@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)
# 获取当前装备中的物品
item1 = @equip_right_window.item
# 设置当前的物品窗口到 @item_window
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
end
# 右窗口被激活的情况下
if @equip_right_window.active
# 删除变更装备后的能力
@equip_abilitychange_window.set_new_parameters(nil, nil, nil, nil, 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
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# 返回到装备
@actor.equip(@equip_right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@equip_abilitychange_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str ,new_dex, new_agi, new_int)
end
# 右侧窗口被激活的情况下: 调用 update_right
if @equip_right_window.active
update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @equip_item_window.active
update_equip_item
return
end
#----------------------------- 状态菜单 ---------------------------------
elsif @status_update
update_generalstatus
return
#----------------------------- 系统菜单 ---------------------------------
elsif @sys_update
if @end_window != nil and !@end_window.disposed?
update_end
elsif @bgm_window != nil and !@bgm_window.disposed? and @currentbgm_window != nil and !@currentbgm_window.disposed?
update_bgm
elsif @sfx_window != nil and !@sfx_window.disposed? and @currentsfx_window != nil and !@currentsfx_window.disposed?
update_sfx
elsif !@system_window.disposed?
update_system
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 同伴人数为 0、存档、游戏结束以外的场合
if $game_party.actors.size == 0 and @command_window.index < 4
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 命令窗口的光标位置分支
case @command_window.index
when 0 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 生成帮助窗口、物品窗口
@item_help_window = Window_ExtraHelp.new
@item_help_window.windowskin = RPG::Cache.windowskin("palskin")
@item_window = Window_SimpleItem.new
@item_window.back_opacity = 180
@item_window.windowskin = RPG::Cache.windowskin("palskin")
@item_pic = Window_ItemPicture.new #####
# 关联帮助窗口
@item_window.help_window = @item_help_window
# 生成目标窗口 (设置为不可见・不活动)
# 切换到物品画面
@item_update = true
@command_window.active = false
@item_window.active = true
when 2 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@actorstatus.active = true
@actorstatus.index = 0
when 1 # 装备
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@actorstatus.active = true
@actorstatus.index = 0
when 3 # 状态
@stagg = -1
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@actorstatus.active = true
@actorstatus.index = 0
when 4 # 天书
@status_update = false
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@system_window = Window_SysCommand.new
@command_window.active = false
@sys_update = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (屏幕左侧状态窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_status
if @command_window.index == 3 and @stagg != @actorstatus.index
# 演奏确定 SE
# 切换到状态画面
# 获取角色
@actor = $game_party.actors[@actorstatus.index]
# 生成状态窗口
if @stagg != -1
@generalstatus_window.dispose
end
@stagg = @actorstatus.index
@generalstatus_window = Window_ExtraStatus.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 == 3
@generalstatus_window.dispose
@stagg = -1
end
# Return to Sys or Main menu - BREW
if @command_window.index == 4 #System
@system_window.active = true
else
@command_window.active = true
end
@actorstatus.active = false
@actorstatus.index = -2
return
end
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (Input.trigger?(Input::DOWN)) or @actorstatus.index < $game_party.actors.size - 1
# 光标向下移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index + 1) % $game_party.actors.size
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在列之后的情况下
if (Input.trigger?(Input::UP)) or @actorstatus.index >= 1
# 光标向上移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index - 1 + $game_party.actors.size) % $game_party.actors.size
end
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 2 # 特技
# 本角色的行动限制在 2 以上的情况下
if $game_party.actors[@actorstatus.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 = @actorstatus.index
@actor = $game_party.actors[@actorstatus.index]
# 生成帮助窗口、特技窗口
@skill_help_window = Window_ExtraHelp.new
@skill_window = Window_Skill_New.new(@actor)
@skill_window.windowskin = RPG::Cache.windowskin("palskin")
# 关联帮助窗口
@skill_window.help_window = @skill_help_window
@actorstatus.active = false
@skill_update = true
when 1 #装备
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@equip_index = 0
@actor = $game_party.actors[@actorstatus.index]
@equip_help_window = Window_ExtraHelpEquip.new
@equip_abilitychange_window = Window_EquipLeft_New.new(@actor)
@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_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_right_window.index = @equip_index
@actorstatus.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)
# 获取当前装备中的物品
item1 = @equip_right_window.item
# 设置当前的物品窗口到 @item_window
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
end
# 右窗口被激活的情况下
if @equip_right_window.active
@equip_abilitychange_window.set_new_parameters(nil, nil, nil, nil, 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
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# 返回到装备
@actor.equip(@equip_right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@equip_abilitychange_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str ,new_dex, new_agi, new_int)
end
when 4 # system - BREW
if @system_window.index == 3 # Party
if @checker == 0
@changer = $game_party.actors[@actorstatus.index]
@where = @actorstatus.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@actorstatus.index]
$game_party.actors[@actorstatus.index] = @changer
@checker = 0
@actorstatus.refresh
$game_player.refresh
end
end
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (状态详细窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_generalstatus
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@generalstatus_window.dispose
@bgstatus.dispose
@status_update = false
@actorstatus.active = true
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_update = false
@actorstatus.active = true
@actorstatus.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
@actorstatus.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @skill.scope == 4 || @skill.scope == 6
@actorstatus.index = -1
elsif @skill.scope == 7
@actorstatus.index = @actor_index - 10
else
@actorstatus.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
@actorstatus.refresh
@actorstatbg.refresh
@skill_help_window.dispose
@skill_window.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
@actorstatus.index = -2
@actorstatus.active = false
return
end
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (Input.trigger?(Input::DOWN)) or @actorstatus.index < $game_party.actors.size - 1
# 光标向下移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index + 1) % $game_party.actors.size
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在列之后的情况下
if (Input.trigger?(Input::UP)) or @actorstatus.index >= 1
# 光标向上移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index - 1 + $game_party.actors.size) % $game_party.actors.size
end
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 @actorstatus.index == -1
# 对同伴全体应用特技使用效果
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# 目标是使用者的情况下
if @actorstatus.index <= -2
# 对目标角色应用特技的使用效果
target = $game_party.actors[@actorstatus.index + 10]
used = target.skill_effect(@actor, @skill)
end
# 目标是单体的情况下
if @actorstatus.index >= 0
# 对目标角色应用特技的使用效果
target = $game_party.actors[@actorstatus.index]
used = target.skill_effect(@actor, @skill)
end
# 使用特技的情况下
if used
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
# 再生成各窗口内容
@actorstatus.refresh
@actorstatbg.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
@actorstatus.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_abilitychange_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_update = false
@actorstatus.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_item_window.index = 0
return
end
# 当SHIFT按钮被按下的时候
if Input.trigger?(Input::SHIFT)
# 播放确定SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@equip_right_window.active = false
@menu_equipenhanced_window.visible = true
@menu_equipenhanced_window.active = true
return
end #if
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
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_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_extraequip
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (Input.trigger?(Input::DOWN)) or @menu_equipenhanced_window.index < 2 - 1
# 光标向下移动
$game_system.se_play($data_system.cursor_se)
@menu_equipenhanced_window.index = (@menu_equipenhanced_window.index + 1) % 2
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在列之后的情况下
if (Input.trigger?(Input::UP)) or @menu_equipenhanced_window.index >= 1
# 光标向上移动
$game_system.se_play($data_system.cursor_se)
@menu_equipenhanced_window.index = (@menu_equipenhanced_window.index + 1) % 2
end
end
# 当B键(Esc键)
if Input.trigger?(Input::B)
# 播放取消SE
$game_system.se_play($data_system.cancel_se)
# 切换至游戏主菜单
@menu_equipenhanced_window.active = false
@menu_equipenhanced_window.visible = false
@equip_right_window.active = true
return
end #if
# 当C键(空格键和回车键)被按下
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
case @menu_equipenhanced_window.index
when 0
for i in 0..4
@actor.equip(i, 0) unless @actor.equip_fix?(i)
next if @actor.equip_fix?(i)
case i
when 0
weapons = []
weapon_set = $data_classes[@actor.class_id].weapon_set
for k in 1...$data_weapons.size
if $game_party.weapon_number(k) > 0 && weapon_set.include?(k)
weapons.push($data_weapons[k])
end #if
end #for
next if weapons == []
weapons = weapons.reverse
strongest_weapon = weapons[0]
for weapon in weapons
strongest_weapon = weapon if strongest_weapon.atk < weapon.atk
end #for
@actor.equip(0, strongest_weapon.id)
when 1..4
armors = []
armor_set = $data_classes[@actor.class_id].armor_set
for j in 1...$data_armors.size
if $game_party.armor_number(j) > 0 && armor_set.include?(j)
if $data_armors[j].kind == i - 1
armors.push($data_armors[j])
end #if
end #if
end #for
next if armors == []
armors = armors.reverse
strongest_armor = armors[0]
for armor in armors
strongest_armor = armor if strongest_armor.pdef < armor.pdef
end #for
@actor.equip(i, strongest_armor.id)
end #case
end #for
when 1
for j in 0..4
@actor.equip(j, 0) unless @actor.equip_fix?(j)
end #for
end #case
@menu_equipenhanced_window.active = false
@menu_equipenhanced_window.visible = false
@equip_help_window.dispose
@equip_abilitychange_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_update = false
@actorstatus.active = true
return
end #if
end #def
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
@item_pic.set_item(@item_window.item) #####
@item_pic.refresh #####
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
@item_help_window.dispose
@item_window.dispose
@item_pic.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
@actorstatus.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @item.scope == 4 || @item.scope == 6
@actorstatus.index = -1
else
@actorstatus.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
@item_pic.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
@actorstatus.index = -2
@actorstatus.active = false
return
end
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在(项目数-列数)之前的情况下
if (Input.trigger?(Input::DOWN)) or @actorstatus.index < $game_party.actors.size - 1
# 光标向下移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index + 1) % $game_party.actors.size
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 列数不是 1 并且不与方向键下的按下状态重复的情况、
# 或光标位置在列之后的情况下
if (Input.trigger?(Input::UP)) or @actorstatus.index >= 1
# 光标向上移动
$game_system.se_play($data_system.cursor_se)
@actorstatus.index = (@actorstatus.index - 1 + $game_party.actors.size) % $game_party.actors.size
end
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 @actorstatus.index == -1
# 对同伴全体应用物品使用效果
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# 目标是单体的情况下
if @actorstatus.index >= 0
# 对目标角色应用物品的使用效果
target = $game_party.actors[@actorstatus.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
# 再生成目标窗口的内容
@actorstatus.refresh
@actorstatbg.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_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
@checker = 0
@system_window.active = false
@actorstatus.active = true
@actorstatus.index = 0
## Moved the rest to update_status - BREW
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
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
end