赞 | 673 |
VIP | 62 |
好人卡 | 144 |
积分 | 335 |
经验 | 110435 |
最后登录 | 2024-11-1 |
在线时间 | 5108 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 33493
- 在线时间
- 5108 小时
- 注册时间
- 2012-11-19
- 帖子
- 4878
|
由于没有其他脚本,不能测试,只能估摸着改- #==============================================================================
- # ■ Scene_菜单系统
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_菜单系统
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # menu_index : 命令光标的初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成活动块
- @spriteset = Spriteset_Map.new
- # 生成命令窗口
- s1 = "对话"
- s2 = "乘降"
- s3 = "强度"
- s4 = "工具"
- s5 = "装备"
- s6 = "炮弹"
- s7 = "调查"
- s8 = "模式"
- @command_window = Window_窗口命令.new(200, [s1, s2, s3, s4, s5, s6, s7, s8],2,35)
- @command_window.index = 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
- # 生成金钱窗口
- @gold_window = Window_Gold.new
- @gold_window.x = 482
- @gold_window.y = - 2
- # 生成状态窗口
- @status_window = Window_MenuStatus.new
- @status_window.x = 186
- @status_window.y = 312
- # 生成地图名窗口
- @mapname_window = Window_Mapname.new
- @mapname_window.x = -2
- @mapname_window.y = -2
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- if map_load_move_can? == false
- $game_switches[19] = true
- else
- $game_switches[19] = false
- end
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @gold_window.dispose
- @status_window.dispose
- @mapname_window.dispose
- @spriteset.dispose
-
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @status_window.update
- $game_player.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @status_window.active
- update_status
- 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 # 对话
- $game_system.se_play($data_system.decision_se)
- check_event_trigger_here([0])
- check_event_trigger_there([0,1,2])
- $scene = Scene_Map.new
- when 1 # 乘降
- $game_system.se_play($data_system.decision_se)
- $game_temp.common_event_id = 3
- $scene = Scene_Map.new
- when 2 # 强度
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- $scene = Scene_Status.new
- #@status_window.index = 0
- when 3 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
- when 4 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 5 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- $game_temp.common_event_id = 4
-
- when 6 # 调查
- $game_system.se_play($data_system.decision_se)
- if check_event_trigger_here([0]) == true or check_event_trigger_there([0,1,2]) == true
- check_event_trigger_here([0])
- check_event_trigger_there([0,1,2])
- else
- if $game_switches[1] == false #开关控制
- $game_player.animation_id = 93
- $game_temp.message_text = "这里什么也没有。"
- end
- end
- $scene = Scene_Map.new
- when 7 # 系统
- # 演奏确定 SE
-
- # 切换到游戏结束画面
- $scene = Scene_End.new
- end
- return
- end
- end
- #-----------------------------------------------------------------------------
- def check_event_trigger_there(triggers)
- @players[0].check_event_trigger_there(triggers)
- end
- #--------------------------------------------------------------------------
- # ● 同位置的事件启动判定
- #--------------------------------------------------------------------------
- def check_event_trigger_here(triggers)
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 全部事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == $game_player.x and event.y == $game_player.y and triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是同位置的事件
- if not event.jumping? and event.over_trigger? and event.is_npc?
- event.start
- result = true
- end
- end
- end
- $game_temp.message_text = "面前没有人!" unless result
- return result
- end
- #--------------------------------------------------------------------------
- # ● 正面事件的启动判定
- #--------------------------------------------------------------------------
- def check_event_trigger_there(triggers)
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 计算正面坐标
- new_x = $game_player.x + ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
- new_y = $game_player.y + ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
- # 全部事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == new_x and event.y == new_y and
- triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger? and event.is_npc?
- event.start
- result = true
- end
- end
- end
- # 找不到符合条件的事件的情况下
- if result == false
- # 正面的元件是计数器的情况下
- if $game_map.counter?(new_x, new_y)
- # 计算 1 元件里侧的坐标
- new_x += ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
- new_y += ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
- # 全事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == new_x and event.y == new_y and
- triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger? and event.is_npc?
- event.start
- result = true
- end
- end
- end
- end
- end
- $game_temp.message_text = "面前没有人!" unless result
- return result
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 5 # 特技
- # 本角色的行动限制在 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)
- # 切换到特技画面
- $scene = Scene_Skill.new(@status_window.index)
- when 4 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Equip.new(@status_window.index)
- when 2 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 是否超重判定
- #--------------------------------------------------------------------------
- def map_load_move_can?
- # 主人公乘车载重判定
- if $game_variables[41] > 0
- weight = 0
- load = 0
- actor = $game_actors[$game_variables[41] + 20]
- return false if actor.hp == 0
- if actor.weapon_id >= 1
- weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
- weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
- end
- if actor.armor1_id >= 1
- weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
- weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
- end
- if actor.armor2_id >= 1
- weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
- weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
- end
- if actor.armor4_id >= 1
- load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
- load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
- else
- return false
- end
- if actor.armor3_id >= 1
- weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
- weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
- else
- return false
- end
- if actor.armor5_id >= 1
- weight += $data_armors[actor.armor5_id + 1].agi_plus
- end
- weight += $game_actors[actor.id + 50].agi
- load *= 10
- weight *= 10
- weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
- a = load - weight
- return false if a < 0
- end
- # 二号位置乘车载重判定
- if $game_variables[42] > 0 and $game_variables[11] > 0
- actor = $game_actors[$game_variables[42] + 20]
- weight = 0
- load = 0
- return false if actor.hp == 0
- if actor.weapon_id >= 1
- weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
- weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
- end
- if actor.armor1_id >= 1
- weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
- weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
- end
- if actor.armor2_id >= 1
- weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
- weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
- end
- if actor.armor4_id >= 1
- load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
- load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
- else
- return false
- end
- if actor.armor3_id >= 1
- weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
- weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
- else
- return false
- end
- if actor.armor5_id >= 1
- weight += $data_armors[actor.armor5_id + 1].agi_plus
- end
- weight += $game_actors[actor.id + 50].agi
- load *= 10
- weight *= 10
- weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
- a = load - weight
- return false if a < 0
- end
- # 三号位置乘车载重判定
- if $game_variables[43] > 0 and $game_variables[12] > 0
- actor = $game_actors[$game_variables[43] + 20]
- weight = 0
- load = 0
- return false if actor.hp == 0
- if actor.weapon_id >= 1
- weight += $data_weapons[actor.weapon_id + 2].agi_plus if $data_weapons[actor.weapon_id].atk != 0
- weight += $data_weapons[actor.weapon_id + 1].agi_plus if $data_weapons[actor.weapon_id].atk == 0
- end
- if actor.armor1_id >= 1
- weight += $data_armors[actor.armor1_id + 2].agi_plus if $data_armors[actor.armor1_id].str_plus != 0
- weight += $data_armors[actor.armor1_id + 1].agi_plus if $data_armors[actor.armor1_id].str_plus == 0
- end
- if actor.armor2_id >= 1
- weight += $data_armors[actor.armor2_id + 2].agi_plus if $data_armors[actor.armor2_id].int_plus != 0
- weight += $data_armors[actor.armor2_id + 1].agi_plus if $data_armors[actor.armor2_id].int_plus == 0
- end
- if actor.armor4_id >= 1
- load += $data_armors[actor.armor4_id + 2].agi_plus if $data_armors[actor.armor4_id].eva != 0
- load += $data_armors[actor.armor4_id + 1].agi_plus if $data_armors[actor.armor4_id].eva == 0
- else
- return false
- end
- if actor.armor3_id >= 1
- weight += $data_armors[actor.armor3_id + 2].agi_plus if $data_armors[actor.armor3_id].dex_plus != 0
- weight += $data_armors[actor.armor3_id + 1].agi_plus if $data_armors[actor.armor3_id].dex_plus == 0
- else
- return false
- end
- if actor.armor5_id >= 1
- weight += $data_armors[actor.armor5_id + 1].agi_plus
- end
- weight += $game_actors[actor.id + 50].agi
- load *= 10
- weight *= 10
- weight += actor.hp - $game_actors[actor.id + 50].maxhp if actor.hp >= $game_actors[actor.id + 50].maxhp
- a = load - weight
- return false if a < 0
- end
- return true
- end
- end
- #==============================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- def is_npc?
- return true if @event.name == "npc"
- return true if @list[0].code == 108 and @list[0].parameters[0] == "npc"
- return false
- end
- end
- #==============================================================================
复制代码 |
|