赞 | 22 |
VIP | 917 |
好人卡 | 110 |
积分 | 218 |
经验 | 288474 |
最后登录 | 2022-10-15 |
在线时间 | 6925 小时 |
Lv5.捕梦者 (版主)
- 梦石
- 20
- 星屑
- 1840
- 在线时间
- 6925 小时
- 注册时间
- 2012-12-14
- 帖子
- 11485
|
7楼
楼主 |
发表于 2013-7-15 21:14:38
|
只看该作者
- #==============================================================================
- # ■ Scene_Equip
- #------------------------------------------------------------------------------
- # 处理装备画面的类。
- #==============================================================================
- class Scene_Equip
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- # equip_index : 装备索引
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @equip_index = equip_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 获取角色
- [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.actors[@actor_index]
- # 生成窗口
- @help_window = Window_Help.new
- @left_window = Window_EquipLeft.new(@actor)
- @right_window = Window_EquipRight.new(@actor)
- @item_window1 = Window_EquipItem.new(@actor, 0)
- #@item_window2 = Window_EquipItem.new(@actor, 1)
- #@item_window3 = Window_EquipItem.new(@actor, 2)
- @item_window2 = Window_EquipItem.new(@actor, 3)
- @item_window3 = Window_EquipItem.new(@actor, 4)
- # 关联帮助窗口
- @right_window.help_window = @help_window
- @item_window1.help_window = @help_window
- #@item_window2.help_window = @help_window
- #@item_window3.help_window = @help_window
- @item_window2.help_window = @help_window
- @item_window3.help_window = @help_window
- # 设置光标位置
- @right_window.index = @equip_index
- refresh
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话的就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @help_window.dispose
- @left_window.dispose
- @right_window.dispose
- @item_window1.dispose
- #@item_window2.dispose
- #@item_window3.dispose
- @item_window2.dispose
- @item_window3.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- # 设置物品窗口的可视状态
- @item_window1.visible = (@right_window.index == 0)
- #@item_window2.visible = (@right_window.index == 1)
- # @item_window3.visible = (@right_window.index == 2)
- @item_window2.visible = (@right_window.index == 1)
- @item_window3.visible = (@right_window.index == 2)
- # 获取当前装备中的物品
- item1 = @right_window.item
- # 设置当前的物品窗口到 @item_window
- case @right_window.index
- when 0
- @item_window = @item_window1
- when 1
- @item_window = @item_window2
- when 2
- @item_window = @item_window3
- ##### 删除 when 3 和 when 4
- end
- # 右窗口被激活的情况下
- if @right_window.active
- # 删除变更装备后的能力
- @left_window.set_new_parameters(nil, nil, nil)
- end
- # 物品窗口被激活的情况下
- if @item_window.active
- # 获取现在选中的物品
- item2 = @item_window.item
- # 变更装备
- last_hp = @actor.hp
- last_sp = @actor.sp
- #############################################################
- case @right_window.index
- when 0
- @equip_type = 0
- when 1
- @equip_type = 3
- when 2
- @equip_type = 4
- end
- @actor.equip(@equip_type, item2 == nil ? 0 : item2.id)
- ##############################################################
- # 获取变更装备后的能力值
- new_atk = @actor.atk
- new_pdef = @actor.pdef
- new_mdef = @actor.mdef
- # 返回到装备
- @actor.equip(@equip_type, 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 update
- # 刷新窗口
- @left_window.update
- @right_window.update
- @item_window.update
- refresh
- # 右侧窗口被激活的情况下: 调用 update_right
- if @right_window.active
- update_right
- return
- end
- # 物品窗口被激活的情况下: 调用 update_item
- if @item_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)
- 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_window.active = true
- @item_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_window.active = false
- @item_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏装备 SE
- $game_system.se_play($data_system.equip_se)
- # 获取物品窗口现在选择的装备数据
- item = @item_window.item
- ######################
- case item
- when RPG::Weapon
- if @actor.weapon_id == 4
- $game_variables[1] -= 100
- $game_variables[2] -= 100
- $game_variables[3] -= 100
- end
- end
- if item == nil and @actor.weapon_id == 4
- $game_variables[1] -= 100
- $game_variables[2] -= 100
- $game_variables[3] -= 100
- end
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- item2 = @right_window.item #获取已装备的装备
- case item
- when RPG::Weapon
- if @actor.weapon_id == 4
- $game_variables[1] += 100
- $game_variables[2] += 100
- $game_variables[3] += 100
- end
- end
- ####
- case item
- when RPG::Armor
- if @actor.armor3_id == 4
- $game_variables[4] -= 50
- $game_variables[5] += 50
- $game_variables[6] -= 50
- end
- end
- if item == nil and @actor.armor3_id == 4
- $game_variables[4] -= 50
- $game_variables[5] += 50
- $game_variables[6] -= 50
- end
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- item2 = @right_window.item #获取已装备的装备
- case item
- when RPG::Armor
- if @actor.armor3_id == 4
- $game_variables[4] += 50
- $game_variables[5] -= 50
- $game_variables[6] += 50
- end
- end
- #######################
- @actor.equip(@right_window.index, item == nil ? 0 : item.id)
- # 变更装备
- # @actor.equip(@equip_type, item == nil ? 0 : item.id)
- # 激活右侧窗口
- @right_window.active = true
- @item_window.active = false
- @item_window.index = -1
- # 再生成右侧窗口、物品窗口的内容
- @right_window.refresh
- @item_window.refresh
- return
- end
- end
- end
复制代码 @芯☆淡茹水
请教一下,为什么4号装备装备上去,变量没有发生变化呢? |
|