赞 | 7 |
VIP | 20 |
好人卡 | 0 |
积分 | 16 |
经验 | 11472 |
最后登录 | 2024-7-10 |
在线时间 | 526 小时 |
Lv3.寻梦者 宛若
- 梦石
- 0
- 星屑
- 1568
- 在线时间
- 526 小时
- 注册时间
- 2007-8-19
- 帖子
- 1493
|
- #==============================================================================
- # ■ Scene_Equip
- #------------------------------------------------------------------------------
- # 处理装备画面的类。
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- # equip_index : 装备索引
- #--------------------------------------------------------------------------
- def equip_begin(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @equip_index = equip_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def equip_main
- # 获取角色
- @actor = $game_party.actors[@actor_index]
- # 生成窗口
- @help_equip_window = Window_Help.new
- @left_window = Window_EquipLeft.new(@actor)
- @right_window = Window_EquipRight.new(@actor)
- @item_equip_window1 = Window_EquipItem.new(@actor, 0)
- @item_equip_window2 = Window_EquipItem.new(@actor, 1)
- @item_equip_window3 = Window_EquipItem.new(@actor, 2)
- @item_equip_window4 = Window_EquipItem.new(@actor, 3)
- @item_equip_window5 = Window_EquipItem.new(@actor, 4)
- # 生成窗口
- @help_equip_window.z = 10000
- @left_window.z = 10000
- @right_window.z = 10000
- @item_equip_window1.z = 10000
- @item_equip_window2.z = 10000
- @item_equip_window3.z = 10000
- @item_equip_window4.z = 10000
- @item_equip_window5.z = 10000
- # 关联帮助窗口
- @right_window.help_window = @help_equip_window
- @item_equip_window1.help_window = @help_equip_window
- @item_equip_window2.help_window = @help_equip_window
- @item_equip_window3.help_window = @help_equip_window
- @item_equip_window4.help_window = @help_equip_window
- @item_equip_window5.help_window = @help_equip_window
- # 设置光标位置
- @right_window.index = @equip_index
- @breaker = false
- equip_refresh
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- equip_update
- # 如果画面切换的话的就中断循环
- if @breaker
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @help_equip_window.dispose
- @left_window.dispose
- @right_window.dispose
- @item_equip_window1.dispose
- @item_equip_window2.dispose
- @item_equip_window3.dispose
- @item_equip_window4.dispose
- @item_equip_window5.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def equip_refresh
- # 设置物品窗口的可视状态
- @item_equip_window1.visible = (@right_window.index == 0)
- @item_equip_window2.visible = (@right_window.index == 1)
- @item_equip_window3.visible = (@right_window.index == 2)
- @item_equip_window4.visible = (@right_window.index == 3)
- @item_equip_window5.visible = (@right_window.index == 4)
- # 获取当前装备中的物品
- item1 = @right_window.item
- # 设置当前的物品窗口到 @item_equip_window
- case @right_window.index
- when 0
- @item_equip_window = @item_equip_window1
- when 1
- @item_equip_window = @item_equip_window2
- when 2
- @item_equip_window = @item_equip_window3
- when 3
- @item_equip_window = @item_equip_window4
- when 4
- @item_equip_window = @item_equip_window5
- end
- # 右窗口被激活的情况下
- if @right_window.active
- # 删除变更装备后的能力
- @left_window.set_new_parameters(nil, nil, nil)
- end
- # 物品窗口被激活的情况下
- if @item_equip_window.active
- # 获取现在选中的物品
- item2 = @item_equip_window.item
- # 变更装备
- last_hp = @actor.hp
- last_sp = @actor.sp
- @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
- # 获取变更装备后的能力值
- new_atk = @actor.atk
- new_pdef = @actor.pdef
- new_mdef = @actor.mdef
- # 返回到装备
- @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
- @actor.hp = last_hp
- @actor.sp = last_sp
- # 描画左窗口
- @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def equip_update
- # 刷新窗口
- @left_window.update
- @right_window.update
- @item_equip_window.update
- equip_refresh
- # 右侧窗口被激活的情况下: 调用 update_right
- if @right_window.active
- update_right
- return
- end
- # 物品窗口被激活的情况下: 调用 update_item
- if @item_equip_window.active
- update_item
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (右侧窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_right
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- #$scene = Scene_Menu.new(2)
- @breaker = true
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 固定装备的情况下
- if @actor.equip_fix?(@right_window.index)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活物品窗口
- @right_window.active = false
- @item_equip_window.active = true
- @item_equip_window.index = 0
- return
- end
- # 按下 R 键的情况下
- if Input.trigger?(Input::R)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至下一位角色
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 切换到别的装备画面
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- # 按下 L 键的情况下
- if Input.trigger?(Input::L)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至上一位角色
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 切换到别的装备画面
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (物品窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_item
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活右侧窗口
- @right_window.active = true
- @item_equip_window.active = false
- @item_equip_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏装备 SE
- $game_system.se_play($data_system.equip_se)
- # 获取物品窗口现在选择的装备数据
- item = @item_equip_window.item
- # 变更装备
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- # 激活右侧窗口
- @right_window.active = true
- @item_equip_window.active = false
- @item_equip_window.index = -1
- # 再生成右侧窗口、物品窗口的内容
- @right_window.refresh
- @item_equip_window.refresh
- return
- end
- end
- end
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 初始化战斗用的各种暂时数据
- $game_temp.in_battle = true
- $game_temp.battle_turn = 0
- $game_temp.battle_event_flags.clear
- $game_temp.battle_abort = false
- $game_temp.battle_main_phase = false
- $game_temp.battleback_name = $game_map.battleback_name
- $game_temp.forcing_battler = nil
- # 初始化战斗用事件解释器
- $game_system.battle_interpreter.setup(nil, 0)
- # 准备队伍
- @troop_id = $game_temp.battle_troop_id
- $game_troop.setup(@troop_id)
- # 生成角色命令窗口
- s1 = $data_system.words.attack
- s2 = $data_system.words.skill
- s3 = $data_system.words.guard
- s4 = $data_system.words.item
- s5 = "装备"
- @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
- @actor_command_window.y = 160 #此处修改Y坐标,自己DIY,丰衣足食
- @actor_command_window.back_opacity = 160
- @actor_command_window.active = false
- @actor_command_window.visible = false
- # 生成其它窗口
- @party_command_window = Window_PartyCommand.new
- @help_window = Window_Help.new
- @help_window.back_opacity = 160
- @help_window.visible = false
- @status_window = Window_BattleStatus.new
- @message_window = Window_Message.new
- # 生成活动块
- @spriteset = Spriteset_Battle.new
- # 初始化等待计数
- @wait_count = 0
- # 执行过渡
- if $data_system.battle_transition == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $data_system.battle_transition)
- end
- # 开始自由战斗回合
- start_phase1
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 刷新地图
- $game_map.refresh
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @actor_command_window.dispose
- @party_command_window.dispose
- @help_window.dispose
- @status_window.dispose
- @message_window.dispose
- if @skill_window != nil
- @skill_window.dispose
- end
- if @item_window != nil
- @item_window.dispose
- end
- if @result_window != nil
- @result_window.dispose
- end
- # 释放活动块
- @spriteset.dispose
- # 标题画面切换中的情况
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end
- # 战斗测试或者游戏结束以外的画面切换中的情况
- if $BTEST and not $scene.is_a?(Scene_Gameover)
- $scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (角色命令回合 : 基本命令)
- #--------------------------------------------------------------------------
- def update_phase3_basic_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 转向前一个角色的指令输入
- phase3_prior_actor
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 角色指令窗口光标位置分之
- case @actor_command_window.index
- when 0 # 攻击
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 0
- # 开始选择敌人
- start_enemy_select
- when 1 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 1
- # 开始选择特技
- start_skill_select
- when 2 # 防御
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 1
- # 转向下一位角色的指令输入
- phase3_next_actor
- when 3 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 2
- # 开始选择物品
- start_item_select
- when 4
- if @active_battler.is_a?(Game_Actor)
- $game_system.se_play($data_system.decision_se)
- equip_begin(@active_battler.id-1)
- equip_main
- Graphics.transition
- end
- end
- return
- end
- end
- end
复制代码 SceneInScene |
评分
-
查看全部评分
|