Project1

标题: 图标怎么无法消失? [打印本页]

作者: lxmstc    时间: 2008-4-16 20:33
标题: 图标怎么无法消失?
我用了轩辕剑美化脚本,可为什么一用金蚕王后就变成这样,那个图标无法消失了.

作者: 禾西    时间: 2008-4-16 20:35
沒有dispose
作者: lxmstc    时间: 2008-4-16 20:40
楼上能说具体点吗?
作者: 9244579    时间: 2008-4-16 20:42
图标没释放
作者: lxmstc    时间: 2008-4-16 20:45
怎么解决啊?
作者: lxmstc    时间: 2008-4-16 22:57
谁能解决一下啊?
作者: lxmstc    时间: 2008-4-16 23:22
求求各位了,到底要改哪里啊?
作者: TERENCE    时间: 2008-4-17 01:07
有关图标的脚本请LZ帖出来吧!!
要不然人家是不知道哪里要改!!
作者: lxmstc    时间: 2008-4-17 02:24
  1. #==============================================================================
  2. # ■ Window_Equip
  3. #------------------------------------------------------------------------------
  4. #  装备物品大图标显示。
  5. #==============================================================================

  6. class Window_Equip < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(145, 402, 200, 200)
  12.     @item = nil
  13.     @item_id = -1
  14.     self.contents = Bitmap.new(width - 32, height - 32)
  15.     self.opacity = 0
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh
  22.     if @item != nil
  23.       if @item != @item_id
  24.         self.contents.clear
  25.         bitmap = Bitmap.new("Graphics/system/menu/Item/" + @item.name + ".png")
  26.         pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  27.         self.contents.blt(0, 0, bitmap, pic_rect)
  28.         @item_id = @item
  29.       end
  30.     else
  31.       @item_id = nil
  32.       self.contents.clear
  33.       bitmap = Bitmap.new("Graphics/system/menu/Item/空.png")
  34.       pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  35.       self.contents.blt(0, 0, bitmap, pic_rect)
  36.     end
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 设置物品
  40.   #--------------------------------------------------------------------------
  41.   def set_item(item)
  42.     @item = item
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 规位
  46.   #--------------------------------------------------------------------------
  47.   def set_item_id
  48.     @item_id = nil
  49.   end
  50. end
复制代码
  1. #==============================================================================
  2. # ■ Window_Item_New
  3. #------------------------------------------------------------------------------
  4. #  物品画面、战斗画面、显示浏览物品的窗口。
  5. #==============================================================================

  6. class Window_Item_New < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(160, 64, 480, 352)
  12.     @column_max = 2
  13.     refresh
  14.     self.index = 0
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 获取物品
  18.   #--------------------------------------------------------------------------
  19.   def item
  20.     return @data[self.index]
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 刷新
  24.   #--------------------------------------------------------------------------
  25.   def refresh
  26.     if self.contents != nil
  27.       self.contents.dispose
  28.       self.contents = nil
  29.     end
  30.     @data = []
  31.     # 添加报务
  32.     for i in 1...$data_items.size
  33.       if $game_party.item_number(i) > 0
  34.         @data.push($data_items[i])
  35.       end
  36.     end
  37.     # 在战斗中以外添加武器、防具
  38.     unless $game_temp.in_battle
  39.       for i in 1...$data_weapons.size
  40.         if $game_party.weapon_number(i) > 0
  41.           @data.push($data_weapons[i])
  42.         end
  43.       end
  44.       for i in 1...$data_armors.size
  45.         if $game_party.armor_number(i) > 0
  46.           @data.push($data_armors[i])
  47.         end
  48.       end
  49.     end
  50.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  51.     @item_max = @data.size
  52.     if @item_max > 0
  53.       self.contents = Bitmap.new(width - 32, row_max * 32)
  54.       for i in 0...@item_max
  55.         draw_item(i)
  56.       end
  57.     end
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 描绘项目
  61.   #     index : 项目编号
  62.   #--------------------------------------------------------------------------
  63.   def draw_item(index)
  64.     item = @data[index]
  65.     case item
  66.     when RPG::Item
  67.       number = $game_party.item_number(item.id)
  68.     when RPG::Weapon
  69.       number = $game_party.weapon_number(item.id)
  70.     when RPG::Armor
  71.       number = $game_party.armor_number(item.id)
  72.     end
  73.     if item.is_a?(RPG::Item) and
  74.        $game_party.item_can_use?(item.id)
  75.       self.contents.font.color = normal_color
  76.     else
  77.       self.contents.font.color = disabled_color
  78.     end
  79.     x = 4 + index % 2 * (self.width / 2)
  80.     y = index / 2 * 32
  81.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  82.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  83.     bitmap = RPG::Cache.icon(item.icon_name)
  84.     opacity = self.contents.font.color == normal_color ? 255 : 128
  85.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  86.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  87.     self.contents.draw_text(x + self.width / @column_max - 72, y, 16, 32, ":", 1)
  88.     self.contents.draw_text(x + self.width / @column_max - 64, y, 24, 32, number.to_s, 2)
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 刷新帮助文本
  92.   #--------------------------------------------------------------------------
  93.   def update_help
  94.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  95.   end
  96. end
复制代码
  1. #==============================================================================
  2. # ■ Window_Help
  3. #------------------------------------------------------------------------------
  4. #  特技及物品的说明、角色的状态显示的窗口。
  5. #==============================================================================

  6. class Window_Help_New < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(137, 480 - 96, 520,128)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.z = 9999
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 设置文本
  17.   #     text  : 窗口显示的字符串
  18.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  19.   #--------------------------------------------------------------------------
  20.   def set_text(text, align = 0)
  21.     # 如果文本和对齐方式的至少一方与上次的不同
  22.     if text != @text or align != @align
  23.       # 再描绘文本
  24.       self.opacity = 0
  25.       self.contents.clear
  26.       self.contents.font.color.set(0,0,0)
  27.       src_rect = Rect.new(0, 0, 560, 128)
  28.       back_help = Bitmap.new("Graphics/system/menu/back/menu_back_help.png")
  29.       self.contents.blt(-45, 0, back_help, src_rect, 255)
  30.       self.contents.draw_text(112, 0, 8 * 48, 96, text, align)
  31.       @text = text
  32.       @align = align
  33.       @actor = nil
  34.     end
  35.     self.visible = true
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 设置角色
  39.   #     actor : 要显示状态的角色
  40.   #--------------------------------------------------------------------------
  41.   def set_actor(actor)
  42.     if actor != @actor
  43.       self.contents.clear
  44.       draw_actor_name(actor, 4, 0)
  45.       draw_actor_state(actor, 140, 0)
  46.       draw_actor_hp(actor, 284, 0)
  47.       draw_actor_sp(actor, 460, 0)
  48.       @actor = actor
  49.       @text = nil
  50.       self.visible = true
  51.     end
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 设置敌人
  55.   #     enemy : 要显示名字和状态的敌人
  56.   #--------------------------------------------------------------------------
  57.   def set_enemy(enemy)
  58.     text = enemy.name
  59.     state_text = make_battler_state_text(enemy, 112, false)
  60.     if state_text != ""
  61.       text += "  " + state_text
  62.     end
  63.     set_text(text, 1)
  64.   end
  65. end
复制代码

应该就是上面三个了吧
第一个是Window_Equip_Icon
第二个是Window_Item New!
第三个是Window_Help New!
作者: TERENCE    时间: 2008-4-17 02:33
用到场景类(Scene_Xxxx)的脚本也貼出來吧
.dispose通常都写在这里面
作者: lxmstc    时间: 2008-4-17 02:44
  1. #==============================================================================
  2. # ■ Scene_Skill
  3. #------------------------------------------------------------------------------
  4. #  处理特技画面的类。
  5. #==============================================================================

  6. class Scene_Skill
  7.   include OPACITY_66RPG
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     actor_index : 角色索引
  11.   #--------------------------------------------------------------------------
  12.   def initialize(actor_index = 0, equip_index = 0)
  13.     @actor_index = actor_index
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 主处理
  17.   #--------------------------------------------------------------------------
  18.   def main
  19.     create_screen
  20.     # 获取角色
  21.     @actor = $game_party.actors[@actor_index]
  22.     # 生成帮助窗口、状态窗口、特技窗口
  23.     @help_window = Window_Help.new
  24.     @status_window = Window_SkillStatus.new(@actor)
  25.     @skill_window = Window_Skill.new(@actor)
  26.     # 关联帮助窗口
  27.     @skill_window.help_window = @help_window
  28.     # 生成目标窗口 (设置为不可见・不活动)
  29.     @target_window = Window_Target.new
  30.     @target_window.visible = false
  31.     @target_window.active = false
  32.     testname = @actor.battler_name+"_h.png"
  33.     if FileTest.exist?("Graphics/battlers/#{testname}")
  34.       sp = Sprite.new
  35.       sp.bitmap=Bitmap.new("Graphics/battlers/#{testname}")
  36.       sp.x = 640-sp.bitmap.width
  37.       sp.opacity = 120
  38.     end   
  39.     # 执行过渡
  40.     Graphics.transition
  41.     # 主循环
  42.     loop do
  43.       # 刷新游戏画面
  44.       Graphics.update
  45.       # 刷新输入信息
  46.       Input.update
  47.       # 刷新画面
  48.       update
  49.       # 如果画面切换的话就中断循环
  50.       if $scene != self
  51.         break
  52.       end
  53.     end
  54.     # 准备过渡
  55.     Graphics.freeze
  56.     # 释放窗口
  57.     @help_window.dispose
  58.     @status_window.dispose
  59.     @skill_window.dispose
  60.     @target_window.dispose
  61.     dispose_screen
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 刷新画面
  65.   #--------------------------------------------------------------------------
  66.   def update
  67.     # 刷新窗口
  68.     @help_window.update
  69.     @status_window.update
  70.     @skill_window.update
  71.     @target_window.update
  72.     # 特技窗口被激活的情况下: 调用 update_skill
  73.     if @skill_window.active
  74.       update_skill
  75.       return
  76.     end
  77.     # 目标窗口被激活的情况下: 调用 update_target
  78.     if @target_window.active
  79.       update_target
  80.       return
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 刷新画面 (特技窗口被激活的情况下)
  85.   #--------------------------------------------------------------------------
  86.   def update_skill
  87.     # 按下 B 键的情况下
  88.     if Input.trigger?(Input::B)
  89.       # 演奏取消 SE
  90.       $game_system.se_play($data_system.cancel_se)
  91.       # 切换到菜单画面
  92.       $scene = Scene_Menu.new(1)
  93.       return
  94.     end
  95.     # 按下 C 键的情况下
  96.     if Input.trigger?(Input::C)
  97.       # 获取特技窗口现在选择的特技的数据
  98.       @skill = @skill_window.skill
  99.       # 不能使用的情况下
  100.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  101.         # 演奏冻结 SE
  102.         $game_system.se_play($data_system.buzzer_se)
  103.         return
  104.       end
  105.       # 演奏确定 SE
  106.       $game_system.se_play($data_system.decision_se)
  107.       # 效果范围是我方的情况下
  108.       if @skill.scope >= 3
  109.         # 激活目标窗口
  110.         @skill_window.active = false
  111.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  112.         @target_window.visible = true
  113.         @target_window.active = true
  114.         # 设置效果范围 (单体/全体) 的对应光标位置
  115.         if @skill.scope == 4 || @skill.scope == 6
  116.           @target_window.index = -1
  117.         elsif @skill.scope == 7
  118.           @target_window.index = @actor_index - 10
  119.         else
  120.           @target_window.index = 0
  121.         end
  122.       # 效果在我方以外的情况下
  123.       else
  124.         # 公共事件 ID 有效的情况下
  125.         if @skill.common_event_id > 0
  126.           # 预约调用公共事件
  127.           $game_temp.common_event_id = @skill.common_event_id
  128.           # 演奏特技使用时的 SE
  129.           $game_system.se_play(@skill.menu_se)
  130.           # 消耗 SP
  131.           @actor.sp -= @skill.sp_cost
  132.           # 再生成各窗口的内容
  133.           @status_window.refresh
  134.           @skill_window.refresh
  135.           @target_window.refresh
  136.           # 切换到地图画面
  137.           $scene = Scene_Map.new
  138.           return
  139.         end
  140.       end
  141.       return
  142.     end
  143.     # 按下 R 键的情况下
  144.     if Input.trigger?(Input::R)
  145.       # 演奏光标 SE
  146.       $game_system.se_play($data_system.cursor_se)
  147.       # 移至下一位角色
  148.       @actor_index += 1
  149.       @actor_index %= $game_party.actors.size
  150.       # 切换到别的特技画面
  151.       $scene = Scene_Skill.new(@actor_index)
  152.       return
  153.     end
  154.     # 按下 L 键的情况下
  155.     if Input.trigger?(Input::L)
  156.       # 演奏光标 SE
  157.       $game_system.se_play($data_system.cursor_se)
  158.       # 移至上一位角色
  159.       @actor_index += $game_party.actors.size - 1
  160.       @actor_index %= $game_party.actors.size
  161.       # 切换到别的特技画面
  162.       $scene = Scene_Skill.new(@actor_index)
  163.       return
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 刷新画面 (目标窗口被激活的情况下)
  168.   #--------------------------------------------------------------------------
  169.   def update_target
  170.     # 按下 B 键的情况下
  171.     if Input.trigger?(Input::B)
  172.       # 演奏取消 SE
  173.       $game_system.se_play($data_system.cancel_se)
  174.       # 删除目标窗口
  175.       @skill_window.active = true
  176.       @target_window.visible = false
  177.       @target_window.active = false
  178.       return
  179.     end
  180.     # 按下 C 键的情况下
  181.     if Input.trigger?(Input::C)
  182.       # 因为 SP 不足而无法使用的情况下
  183.       unless @actor.skill_can_use?(@skill.id)
  184.         # 演奏冻结 SE
  185.         $game_system.se_play($data_system.buzzer_se)
  186.         return
  187.       end
  188.       # 目标是全体的情况下
  189.       if @target_window.index == -1
  190.         # 对同伴全体应用特技使用效果
  191.         used = false
  192.         for i in $game_party.actors
  193.           used |= i.skill_effect(@actor, @skill)
  194.         end
  195.       end
  196.       # 目标是使用者的情况下
  197.       if @target_window.index <= -2
  198.         # 对目标角色应用特技的使用效果
  199.         target = $game_party.actors[@target_window.index + 10]
  200.         used = target.skill_effect(@actor, @skill)
  201.       end
  202.       # 目标是单体的情况下
  203.       if @target_window.index >= 0
  204.         # 对目标角色应用特技的使用效果
  205.         target = $game_party.actors[@target_window.index]
  206.         used = target.skill_effect(@actor, @skill)
  207.       end
  208.       # 使用特技的情况下
  209.       if used
  210.         # 演奏特技使用时的 SE
  211.         $game_system.se_play(@skill.menu_se)
  212.         # 消耗 SP
  213.         @actor.sp -= @skill.sp_cost
  214.         # 再生成各窗口内容
  215.         @status_window.refresh
  216.         @skill_window.refresh
  217.         @target_window.refresh
  218.         # 全灭的情况下
  219.         if $game_party.all_dead?
  220.           # 切换到游戏结束画面
  221.           $scene = Scene_Gameover.new
  222.           return
  223.         end
  224.         # 公共事件 ID 有效的情况下
  225.         if @skill.common_event_id > 0
  226.           # 预约调用公共事件
  227.           $game_temp.common_event_id = @skill.common_event_id
  228.           # 切换到地图画面
  229.           $scene = Scene_Map.new
  230.           return
  231.         end
  232.       end
  233.       # 无法使用特技的情况下
  234.       unless used
  235.         # 演奏冻结 SE
  236.         $game_system.se_play($data_system.buzzer_se)
  237.       end
  238.       return
  239.     end
  240.   end
  241. end
复制代码
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #==============================================================================
  5. # ■ Harts_Window_EquipTitle
  6. #==============================================================================
  7. class Harts_Window_EquipTitle < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初期化
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 160, 64)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.contents.clear
  15.     self.contents.font.color = normal_color
  16.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.equip, 1)
  17.   end
  18. end

  19. #==============================================================================
  20. # ■ Harts_Window_EquipCommand
  21. #==============================================================================

  22. class Harts_Window_EquipCommand < Window_Selectable
  23.   #--------------------------------------------------------------------------
  24.   # ● 初期化
  25.   #--------------------------------------------------------------------------
  26.   def initialize
  27.     super(160, 0, 480, 64)
  28.     self.contents = Bitmap.new(width - 32, height - 32)
  29.     @item_max = 3
  30.     @column_max = 3
  31.     @commands = ["手动装备", "自动装备", "结束"]
  32.     refresh
  33.     self.index = 0
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新
  37.   #--------------------------------------------------------------------------
  38.   def refresh
  39.     self.contents.clear
  40.     for i in 0...@item_max
  41.     draw_item(i, normal_color)
  42.     end
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 項目描画
  46.   # index : 項目番号
  47.   # color : 文字色
  48.   #--------------------------------------------------------------------------
  49.   def draw_item(index, color)
  50.     self.contents.font.color = color
  51.     x = index * 160 + 4
  52.     self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
  53.   end
  54. end

  55. #==============================================================================
  56. # ■ Harts_Window_EquipItem
  57. #==============================================================================

  58. class Harts_Window_EquipItem < Window_Selectable
  59.   #--------------------------------------------------------------------------
  60.   # ● 初期化
  61.   # actor : 角色
  62.   # equip_type : 装備部位 (0~3)
  63.   #--------------------------------------------------------------------------
  64.   def initialize(actor, equip_type)
  65.     super(272, 256, 368, 160)
  66.     @actor = actor
  67.     @equip_type = equip_type
  68.     @column_max = 1
  69.     refresh
  70.     self.active = false
  71.     self.index = -1
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 物品取得
  75.   #--------------------------------------------------------------------------
  76.   def item
  77.     return @data[self.index]
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 最強id取得
  81.   #--------------------------------------------------------------------------
  82.   def max_item_id
  83.     if @equip_type == 0
  84.       if @actor.weapon_id == 0
  85.         max = 0
  86.       else
  87.         max = $data_weapons[@actor.weapon_id].atk
  88.       end
  89.     elsif @equip_type == 1
  90.       if @actor.armor1_id == 0
  91.         max = 0
  92.       else
  93.         max = $data_armors[@actor.armor1_id].pdef
  94.       end
  95.     elsif @equip_type == 2
  96.       if @actor.armor2_id == 0
  97.         max = 0
  98.       else
  99.         max = $data_armors[@actor.armor2_id].pdef
  100.       end
  101.     elsif @equip_type == 3
  102.       if @actor.armor3_id == 0
  103.         max = 0
  104.       else
  105.         max = $data_armors[@actor.armor3_id].pdef
  106.       end
  107.     end
  108.     for i in [email protected]
  109.       if @equip_type == 0
  110.         if max <= $data_weapons[@data[i].id].atk
  111.           max = $data_weapons[@data[i].id].atk
  112.           item_id = @data[i].id
  113.         end
  114.       elsif @equip_type >= 1
  115.         if max <= $data_armors[@data[i].id].pdef
  116.           max = $data_armors[@data[i].id].pdef
  117.           item_id = @data[i].id
  118.         end
  119.       end
  120.     end
  121.     return item_id
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新
  125.   #--------------------------------------------------------------------------
  126.   def refresh
  127.     if self.contents != nil
  128.       self.contents.dispose
  129.       self.contents = nil
  130.     end
  131.     @data = []
  132.     # 装備可能的武器追加
  133.     if @equip_type == 0
  134.       weapon_set = $data_classes[@actor.class_id].weapon_set
  135.       for i in 1...$data_weapons.size
  136.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  137.           @data.push($data_weapons[i])
  138.         end
  139.       end
  140.     end
  141.     # 装備可能的防具追加
  142.     if @equip_type >= 1
  143.       armor_set = $data_classes[@actor.class_id].armor_set
  144.       for i in 1...$data_armors.size
  145.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  146.           if $data_armors[i].kind == @equip_type-1
  147.             @data.push($data_armors[i])
  148.           end
  149.         end
  150.       end
  151.     end
  152.     # 空白追加
  153.     @data.push(nil)
  154.     # 全項目描画
  155.     @item_max = @data.size
  156.     self.contents = Bitmap.new(width - 32, row_max * 32)
  157.     for i in 0...@item_max-1
  158.       draw_item(i)
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 項目描画
  163.   # index : 項目编号
  164.   #--------------------------------------------------------------------------
  165.   def draw_item(index)
  166.     item = @data[index]
  167.     x = 4
  168.     y = index * 32
  169.     case item
  170.     when RPG::Weapon
  171.       number = $game_party.weapon_number(item.id)
  172.     when RPG::Armor
  173.       number = $game_party.armor_number(item.id)
  174.     end
  175.     bitmap = RPG::Cache.icon(item.icon_name)
  176.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  177.     self.contents.font.color = normal_color
  178.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  179.     self.contents.draw_text(x + 280, y, 16, 32, ":", 1)
  180.     self.contents.draw_text(x + 296, y, 24, 32, number.to_s, 2)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 帮助更新
  184.   #--------------------------------------------------------------------------
  185.   def update_help
  186.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  187.   end
  188. end

  189. #==============================================================================
  190. # ■ Harts_Window_EquipLeft
  191. #==============================================================================

  192. class Harts_Window_EquipLeft < Window_Base
  193.   #--------------------------------------------------------------------------
  194.   # ● 初期化
  195.   # actor : 角色
  196.   #--------------------------------------------------------------------------
  197.   def initialize(actor)
  198.     super(0, 64, 272, 352)
  199.     self.contents = Bitmap.new(width - 32, height - 32)
  200.     @actor = actor
  201.     refresh
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● リフレッシュ
  205.   #--------------------------------------------------------------------------
  206.   def refresh
  207.     self.contents.clear
  208.     draw_actor_graphic(@actor, 32, 64)
  209.     draw_actor_name(@actor, 4 + 96, 0)
  210.     draw_actor_level(@actor, 4 + 96, 32)
  211.     draw_actor_parameter(@actor, 4, 80, 0)
  212.     draw_actor_parameter(@actor, 4, 112, 1)
  213.     draw_actor_parameter(@actor, 4, 144, 2)
  214.     draw_actor_parameter(@actor, 4, 192, 3)
  215.     draw_actor_parameter(@actor, 4, 224, 4)
  216.     draw_actor_parameter(@actor, 4, 256, 5)
  217.     draw_actor_parameter(@actor, 4, 288, 6)
  218.     if @new_atk != nil and @new_atk != @actor.atk
  219.       if @new_atk > @actor.atk
  220.         self.contents.font.color = system_color
  221.       else
  222.         self.contents.font.color = disabled_color
  223.       end
  224.       self.contents.draw_text(160, 80, 40, 32, "→", 1)
  225.       self.contents.draw_text(200, 80, 36, 32, @new_atk.to_s, 2)
  226.     end
  227.     if @new_pdef != nil and @new_pdef != @actor.pdef
  228.       if @new_pdef > @actor.pdef
  229.         self.contents.font.color = system_color
  230.       else
  231.         self.contents.font.color = disabled_color
  232.       end
  233.       self.contents.draw_text(160, 112, 40, 32, "→", 1)
  234.       self.contents.draw_text(200, 112, 36, 32, @new_pdef.to_s, 2)
  235.     end
  236.     if @new_mdef != nil and @new_mdef != @actor.mdef
  237.       if @new_mdef > @actor.mdef
  238.         self.contents.font.color = system_color
  239.       else
  240.         self.contents.font.color = disabled_color
  241.       end
  242.       self.contents.draw_text(160, 144, 40, 32, "→", 1)
  243.       self.contents.draw_text(200, 144, 36, 32, @new_mdef.to_s, 2)
  244.     end
  245.     if @new_str != nil and @new_str != @actor.str
  246.       if @new_str > @actor.str
  247.         self.contents.font.color = system_color
  248.       else
  249.         self.contents.font.color = disabled_color
  250.       end
  251.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  252.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  253.     end
  254.     if @new_dex != nil and @new_dex != @actor.dex
  255.       if @new_dex > @actor.dex
  256.         self.contents.font.color = system_color
  257.       else
  258.         self.contents.font.color = disabled_color
  259.       end
  260.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  261.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  262.     end
  263.     if @new_agi != nil and @new_agi != @actor.agi
  264.       if @new_agi > @actor.agi
  265.         self.contents.font.color = system_color
  266.       else
  267.         self.contents.font.color = disabled_color
  268.       end
  269.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  270.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  271.     end
  272.     if @new_int != nil and @new_int != @actor.int
  273.       if @new_int > @actor.int
  274.         self.contents.font.color = system_color
  275.       else
  276.         self.contents.font.color = disabled_color
  277.       end
  278.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  279.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  280.     end
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 装備変更後設定
  284.   # new_atk : 装備変更後攻撃力
  285.   # new_pdef : 装備変更後物理防御
  286.   # new_mdef : 装備変更後魔法防御
  287.   #--------------------------------------------------------------------------
  288.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
  289.     if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
  290.       @new_atk = new_atk
  291.       @new_pdef = new_pdef
  292.       @new_mdef = new_mdef
  293.       @new_str = new_str
  294.       @new_dex = new_dex
  295.       @new_agi = new_agi
  296.       @new_int = new_int
  297.       refresh
  298.     end
  299.   end
  300. end

  301. #==============================================================================
  302. # ■ Harts_Scene_Equip
  303. #==============================================================================

  304. class Scene_Equip
  305.   include OPACITY_66RPG
  306.   #--------------------------------------------------------------------------
  307.   # ● 初期化
  308.   # actor_index : 角色编号
  309.   # equip_index : 装備编号
  310.   #--------------------------------------------------------------------------
  311.   def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
  312.     @actor_index = actor_index
  313.     @equip_index = equip_index
  314.     @command_index = command_index
  315.     @equip_active = equip_active
  316.     @command_active = command_active
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 主处理
  320.   #--------------------------------------------------------------------------
  321.   def main
  322.     create_screen
  323.     @actor = $game_party.actors[@actor_index]
  324.     @title_window = Harts_Window_EquipTitle.new
  325.     @command_window = Harts_Window_EquipCommand.new
  326.     @help_window = Window_Help.new
  327.     @help_window.y = 416
  328.     @left_window = Harts_Window_EquipLeft.new(@actor)
  329.     @right_window = Window_EquipRight.new(@actor)
  330.     @item_window0 = Harts_Window_EquipItem.new(@actor, -1)
  331.     @item_window1 = Harts_Window_EquipItem.new(@actor, 0)
  332.     @item_window2 = Harts_Window_EquipItem.new(@actor, 1)
  333.     @item_window3 = Harts_Window_EquipItem.new(@actor, 2)
  334.     @item_window4 = Harts_Window_EquipItem.new(@actor, 3)
  335.     @item_window5 = Harts_Window_EquipItem.new(@actor, 4)
  336.     @right_window.help_window = @help_window
  337.     @item_window0.help_window = @help_window
  338.     @item_window1.help_window = @help_window
  339.     @item_window2.help_window = @help_window
  340.     @item_window3.help_window = @help_window
  341.     @item_window4.help_window = @help_window
  342.     @item_window5.help_window = @help_window
  343.     @command_window.index = @command_index
  344.     @right_window.index = @equip_index
  345.     @command_window.active = @command_active
  346.     @right_window.active = @equip_active
  347.     testname = @actor.battler_name+"_h.png"
  348.     if FileTest.exist?("Graphics/battlers/#{testname}")
  349.       sp = Sprite.new
  350.       sp.bitmap=Bitmap.new("Graphics/battlers/#{testname}")
  351.       sp.opacity = 120
  352.     end   
  353.     refresh
  354.     Graphics.transition
  355.     loop do
  356.       Graphics.update
  357.       Input.update
  358.       update
  359.       if $scene != self
  360.         break
  361.       end
  362.     end
  363.     # トランジション準備
  364.     Graphics.freeze
  365.     # ウィンドウを解放
  366.     @title_window.dispose
  367.     @command_window.dispose
  368.     @help_window.dispose
  369.     @left_window.dispose
  370.     @right_window.dispose
  371.     @item_window0.dispose
  372.     @item_window1.dispose
  373.     @item_window2.dispose
  374.     @item_window3.dispose
  375.     @item_window4.dispose
  376.     @item_window5.dispose
  377.     dispose_screen
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 刷新
  381.   #--------------------------------------------------------------------------
  382.   def refresh
  383.     @item_window0.visible = (@right_window.index == -1)
  384.     @item_window1.visible = (@right_window.index == 0)
  385.     @item_window2.visible = (@right_window.index == 1)
  386.     @item_window3.visible = (@right_window.index == 2)
  387.     @item_window4.visible = (@right_window.index == 3)
  388.     @item_window5.visible = (@right_window.index == 4)
  389.     item1 = @right_window.item
  390.     case @right_window.index
  391.     when -1
  392.       @item_window = @item_window0
  393.     when 0
  394.       @item_window = @item_window1
  395.     when 1
  396.       @item_window = @item_window2
  397.     when 2
  398.       @item_window = @item_window3
  399.     when 3
  400.       @item_window = @item_window4
  401.     when 4
  402.       @item_window = @item_window5
  403.     end
  404.     if @right_window.active
  405.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
  406.     end
  407.     if @item_window.active
  408.       item2 = @item_window.item
  409.       last_hp = @actor.hp
  410.       last_sp = @actor.sp
  411.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  412.       new_atk = @actor.atk
  413.       new_pdef = @actor.pdef
  414.       new_mdef = @actor.mdef
  415.       new_str = @actor.str
  416.       new_dex = @actor.dex
  417.       new_agi = @actor.agi
  418.       new_int = @actor.int
  419.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  420.       @actor.hp = last_hp
  421.       @actor.sp = last_sp
  422.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
  423.     end
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 更新
  427.   #--------------------------------------------------------------------------
  428.   def update
  429.     @title_window.update
  430.     @command_window.update
  431.     @left_window.update
  432.     @right_window.update
  433.     @item_window.update
  434.     refresh
  435.     if @command_window.active
  436.       update_command
  437.       return
  438.     end
  439.     if @right_window.active
  440.       update_right
  441.       return
  442.     end
  443.     if @item_window.active
  444.       update_item
  445.       return
  446.     end
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● 更新
  450.   #--------------------------------------------------------------------------
  451.   def update_command
  452.     # 按下B的场合
  453.     if Input.trigger?(Input::B)
  454.       # 音效演奏
  455.       $game_system.se_play($data_system.cancel_se)
  456.       # 画面切换
  457.       $scene = Scene_Menu.new(2)
  458.       return
  459.     end
  460.     # 按下C的场合
  461.     if Input.trigger?(Input::C)
  462.       case @command_window.index
  463.       # 装備的場合
  464.       when 0
  465.         # 音效演奏
  466.         $game_system.se_play($data_system.decision_se)
  467.         @right_window.active = true
  468.         @command_window.active = false
  469.         @right_window.index = 0
  470.         @command_window.index = -1
  471.         return
  472.         # 最強装備的場合 
  473.       when 1
  474.         # 音效演奏
  475.         $game_system.se_play($data_system.equip_se)
  476.         # 最強装備的取得
  477.         max_weapon_id = @item_window1.max_item_id
  478.         max_armor1_id = @item_window2.max_item_id
  479.         max_armor2_id = @item_window3.max_item_id
  480.         max_armor3_id = @item_window4.max_item_id
  481.         # 最強装備执行
  482.         @actor.equip(0, max_weapon_id)
  483.         @actor.equip(1, max_armor1_id)
  484.         @actor.equip(2, max_armor2_id)
  485.         @actor.equip(3, max_armor3_id)
  486.         @right_window.refresh
  487.         @left_window.refresh
  488.         @item_window1.refresh
  489.         @item_window2.refresh
  490.         @item_window3.refresh
  491.         @item_window4.refresh
  492.         return
  493.       when 2
  494.         # 音效演奏
  495.         $game_system.se_play($data_system.cancel_se)
  496.         # 画面切换
  497.         $scene = Scene_Menu.new(2)
  498.         return
  499.       end
  500.     end
  501.     # 按下R的场合
  502.     if Input.trigger?(Input::R)
  503.       # 音效演奏
  504.       $game_system.se_play($data_system.cursor_se)
  505.       @actor_index += 1
  506.       @actor_index %= $game_party.actors.size
  507.       # 画面切换
  508.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  509.       return
  510.     end
  511.     # 按下L的场合
  512.     if Input.trigger?(Input::L)
  513.       # 音效演奏
  514.       $game_system.se_play($data_system.cursor_se)
  515.       @actor_index += $game_party.actors.size - 1
  516.       @actor_index %= $game_party.actors.size
  517.         # 画面切换
  518.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  519.       return
  520.     end
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● 更新右边窗口
  524.   #--------------------------------------------------------------------------
  525.   def update_right
  526.     # 按下B的场合
  527.     if Input.trigger?(Input::B)
  528.       # 音效演奏
  529.       $game_system.se_play($data_system.cancel_se)
  530.       @right_window.active = false
  531.       @command_window.active = true
  532.       @right_window.index = -1
  533.       @command_window.index = 0
  534.       return
  535.     end
  536.     # 按下C的场合
  537.     if Input.trigger?(Input::C)
  538.       # 装備固定时
  539.       if @actor.equip_fix?(@right_window.index)
  540.         # 音效演奏
  541.         $game_system.se_play($data_system.buzzer_se)
  542.         return
  543.       end
  544.       # 音效演奏
  545.       $game_system.se_play($data_system.decision_se)
  546.       @right_window.active = false
  547.       @item_window.active = true
  548.       @item_window.index = 0
  549.       return
  550.     end
  551.     # 按下R的场合
  552.     if Input.trigger?(Input::R)
  553.       # 音效演奏
  554.       $game_system.se_play($data_system.cursor_se)
  555.       @actor_index += 1
  556.       @actor_index %= $game_party.actors.size
  557.       # 画面切换
  558.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  559.       return
  560.     end
  561.     # 按下L的场合
  562.     if Input.trigger?(Input::L)
  563.       # 音效演奏
  564.       $game_system.se_play($data_system.cursor_se)
  565.       @actor_index += $game_party.actors.size - 1
  566.       @actor_index %= $game_party.actors.size
  567.       # 画面切换
  568.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  569.       return
  570.     end
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● 更新物品
  574.   #--------------------------------------------------------------------------
  575.   def update_item
  576.     # 按下B的场合
  577.     if Input.trigger?(Input::B)
  578.       # 音效演奏
  579.       $game_system.se_play($data_system.cancel_se)
  580.       @right_window.active = true
  581.       @item_window.active = false
  582.       @item_window.index = -1
  583.       return
  584.     end
  585.     # 按下C的场合
  586.     if Input.trigger?(Input::C)
  587.       # 音效演奏
  588.       $game_system.se_play($data_system.equip_se)
  589.       item = @item_window.item
  590.       # 装備変更
  591.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  592.       @right_window.active = true
  593.       @item_window.active = false
  594.       @item_window.index = -1
  595.       # 刷新
  596.       @right_window.refresh
  597.       @item_window.refresh
  598.       return
  599.     end
  600.   end
  601. end
复制代码

作者: lxmstc    时间: 2008-4-17 02:45
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.      $game_party.actors.each do |battler|
  12.        battler.damage = nil
  13.        battler.animation_id = 0
  14.      end
  15.     # 初始化战斗用的各种暂时数据
  16.     $game_temp.in_battle = true
  17.     $game_temp.battle_turn = 0
  18.     $game_temp.battle_event_flags.clear
  19.     $game_temp.battle_abort = false
  20.     $game_temp.battle_main_phase = false
  21.     $game_temp.battleback_name = $game_map.battleback_name
  22.     $game_temp.forcing_battler = nil
  23.     # 初始化战斗用事件解释器
  24.     $game_system.battle_interpreter.setup(nil, 0)
  25.     # 准备队伍
  26.     @troop_id = $game_temp.battle_troop_id
  27.     $game_troop.setup(@troop_id)
  28.     # 生成角色命令窗口
  29.     s1 = $data_system.words.attack
  30.     s2 = $data_system.words.skill
  31.     s3 = $data_system.words.guard
  32.     s4 = $data_system.words.item
  33.     s5 = "逃跑"
  34.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
  35.     @actor_command_window.y = 128
  36.     @actor_command_window.back_opacity = 160
  37.     @actor_command_window.active = false
  38.     @actor_command_window.visible = false
  39.     # 生成其它窗口
  40.     @party_command_window = Window_PartyCommand.new
  41.     @help_window = Window_Help.new
  42.     @help_window.back_opacity = 160
  43.     @help_window.visible = false
  44.     @help_window.enemy = nil
  45.     @status_window = Window_BattleStatus.new
  46.     @message_window = Window_Message.new
  47.     # 生成活动块
  48.     @spriteset = Spriteset_Battle.new
  49.     # 初始化等待计数
  50.     @wait_count = 0
  51.     # 执行过渡
  52.     if $data_system.battle_transition == ""
  53.       Graphics.transition(20)
  54.     else
  55.       Graphics.transition(40, "Graphics/Transitions/" +
  56.         $data_system.battle_transition)
  57.     end
  58.     # 开始自由战斗回合
  59.     start_phase1
  60.     # 主循环
  61.     loop do
  62.       # 刷新游戏画面
  63.       Graphics.update
  64.       # 刷新输入信息
  65.       Input.update
  66.       # 刷新画面
  67.       update
  68.       # 如果画面切换的话就中断循环
  69.       if $scene != self
  70.         break
  71.       end
  72.     end
  73.     # 刷新地图
  74.     $game_map.refresh
  75.     # 准备过渡
  76.     Graphics.freeze
  77.     # 释放窗口
  78.     @actor_command_window.dispose
  79.     @party_command_window.dispose
  80.     @help_window.dispose
  81.     @status_window.dispose
  82.     @message_window.dispose
  83.     if @skill_window != nil
  84.       @skill_window.dispose
  85.     end
  86.     if @item_window != nil
  87.       @item_window.dispose
  88.     end
  89.     if @result_window != nil
  90.       @result_window.dispose
  91.     end
  92.     # 释放活动块
  93.     @spriteset.dispose
  94.     # 标题画面切换中的情况
  95.     if $scene.is_a?(Scene_Title)
  96.       # 淡入淡出画面
  97.       Graphics.transition
  98.       Graphics.freeze
  99.     end
  100.     # 战斗测试或者游戏结束以外的画面切换中的情况
  101.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  102.       $scene = nil
  103.     end
  104.      $game_party.actors.each do |battler|
  105.        battler.damage = nil
  106.        battler.animation_id = 0
  107.      end
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 胜负判定
  111.   #--------------------------------------------------------------------------
  112.   def judge
  113.     # 全灭判定是真、并且同伴人数为 0 的情况下
  114.     if $game_party.all_dead? or $game_party.actors.size == 0
  115.       # 允许失败的情况下
  116.       if $game_temp.battle_can_lose
  117.         # 还原为战斗开始前的 BGM
  118.         $game_system.bgm_play($game_temp.map_bgm)
  119.         # 战斗结束
  120.         battle_end(2)
  121.         # 返回 true
  122.         return true
  123.       end
  124.       # 设置游戏结束标志
  125.       $game_temp.gameover = true
  126.       # 返回 true
  127.       return true
  128.     end
  129.     # 如果存在任意 1 个敌人就返回 false
  130.     for enemy in $game_troop.enemies
  131.       if enemy.exist?
  132.         return false
  133.       end
  134.     end
  135.     # 开始结束战斗回合 (胜利)
  136.     start_phase5
  137.     # 返回 true
  138.     return true
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 战斗结束
  142.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  143.   #--------------------------------------------------------------------------
  144.   def battle_end(result)
  145.     # 清除战斗中标志
  146.     $game_temp.in_battle = false
  147.     # 清除全体同伴的行动
  148.     $game_party.clear_actions
  149.     # 解除战斗用状态
  150.     for actor in $game_party.actors
  151.       actor.remove_states_battle
  152.     end
  153.     # 清除敌人
  154.     $game_troop.enemies.clear
  155.     # 调用战斗返回调用
  156.     if $game_temp.battle_proc != nil
  157.       $game_temp.battle_proc.call(result)
  158.       $game_temp.battle_proc = nil
  159.     end
  160.     # 切换到地图画面
  161.     $scene = Scene_Map.new
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 设置战斗事件
  165.   #--------------------------------------------------------------------------
  166.   def setup_battle_event
  167.     # 正在执行战斗事件的情况下
  168.     if $game_system.battle_interpreter.running?
  169.       return
  170.     end
  171.     # 搜索全部页的战斗事件
  172.     for index in 0...$data_troops[@troop_id].pages.size
  173.       # 获取事件页
  174.       page = $data_troops[@troop_id].pages[index]
  175.       # 事件条件可以参考 c
  176.       c = page.condition
  177.       # 没有指定任何条件的情况下转到下一页
  178.       unless c.turn_valid or c.enemy_valid or
  179.              c.actor_valid or c.switch_valid
  180.         next
  181.       end
  182.       # 执行完毕的情况下转到下一页
  183.       if $game_temp.battle_event_flags[index]
  184.         next
  185.       end
  186.       # 确认回合条件
  187.       if c.turn_valid
  188.         n = $game_temp.battle_turn
  189.         a = c.turn_a
  190.         b = c.turn_b
  191.         if (b == 0 and n != a) or
  192.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  193.           next
  194.         end
  195.       end
  196.       # 确认敌人条件
  197.       if c.enemy_valid
  198.         enemy = $game_troop.enemies[c.enemy_index]
  199.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  200.           next
  201.         end
  202.       end
  203.       # 确认角色条件
  204.       if c.actor_valid
  205.         actor = $game_actors[c.actor_id]
  206.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  207.           next
  208.         end
  209.       end
  210.       # 确认开关条件
  211.       if c.switch_valid
  212.         if $game_switches[c.switch_id] == false
  213.           next
  214.         end
  215.       end
  216.       # 设置事件
  217.       $game_system.battle_interpreter.setup(page.list, 0)
  218.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  219.       if page.span <= 1
  220.         # 设置执行结束标志
  221.         $game_temp.battle_event_flags[index] = true
  222.       end
  223.       return
  224.     end
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 刷新画面
  228.   #--------------------------------------------------------------------------
  229.   def update
  230.     # 执行战斗事件中的情况下
  231.     if $game_system.battle_interpreter.running?
  232.       # 刷新解释器
  233.       $game_system.battle_interpreter.update
  234.       # 强制行动的战斗者不存在的情况下
  235.       if $game_temp.forcing_battler == nil
  236.         # 执行战斗事件结束的情况下
  237.         unless $game_system.battle_interpreter.running?
  238.           # 继续战斗的情况下、再执行战斗事件的设置
  239.           unless judge
  240.             setup_battle_event
  241.           end
  242.         end
  243.         # 如果不是结束战斗回合的情况下
  244.         if @phase != 5
  245.           # 刷新状态窗口
  246.           @status_window.refresh
  247.         end
  248.       end
  249.     end
  250.     # 系统 (计时器)、刷新画面
  251.     $game_system.update
  252.     $game_screen.update
  253.     # 计时器为 0 的情况下
  254.     if $game_system.timer_working and $game_system.timer == 0
  255.       # 中断战斗
  256.       $game_temp.battle_abort = true
  257.     end
  258.     # 刷新窗口
  259.     @help_window.update
  260.     @party_command_window.update
  261.     @actor_command_window.update
  262.     @status_window.update
  263.     @message_window.update
  264.     # 刷新活动块
  265.     @spriteset.update
  266.     # 处理过渡中的情况下
  267.     if $game_temp.transition_processing
  268.       # 清除处理过渡中标志
  269.       $game_temp.transition_processing = false
  270.       # 执行过渡
  271.       if $game_temp.transition_name == ""
  272.         Graphics.transition(20)
  273.       else
  274.         Graphics.transition(40, "Graphics/Transitions/" +
  275.           $game_temp.transition_name)
  276.       end
  277.     end
  278.     # 显示信息窗口中的情况下
  279.     if $game_temp.message_window_showing
  280.       return
  281.     end
  282.     # 显示效果中的情况下
  283.     if @spriteset.effect?
  284.       return
  285.     end
  286.     # 游戏结束的情况下
  287.     if $game_temp.gameover
  288.       # 切换到游戏结束画面
  289.       $scene = Scene_Gameover.new
  290.       return
  291.     end
  292.     # 返回标题画面的情况下
  293.     if $game_temp.to_title
  294.       # 切换到标题画面
  295.       $scene = Scene_Title.new
  296.       return
  297.     end
  298.     # 中断战斗的情况下
  299.     if $game_temp.battle_abort
  300.       # 还原为战斗前的 BGM
  301.       $game_system.bgm_play($game_temp.map_bgm)
  302.       # 战斗结束
  303.       battle_end(1)
  304.       return
  305.     end
  306.     # 等待中的情况下
  307.     if @wait_count > 0
  308.       # 减少等待计数
  309.       @wait_count -= 1
  310.       return
  311.     end
  312.     # 强制行动的角色存在、
  313.     # 并且战斗事件正在执行的情况下
  314.     if $game_temp.forcing_battler == nil and
  315.        $game_system.battle_interpreter.running?
  316.       return
  317.     end
  318.     # 回合分支
  319.     case @phase
  320.     when 1  # 自由战斗回合
  321.       update_phase1
  322.     when 2  # 同伴命令回合
  323.       update_phase2
  324.     when 3  # 角色命令回合
  325.       update_phase3
  326.     when 4  # 主回合
  327.       update_phase4
  328.     when 5  # 战斗结束回合
  329.       update_phase5
  330.     end
  331.   end
  332. end
复制代码
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 2)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7. #--------------------------------------------------------------------------
  8. # ● 开始自由战斗回合
  9. #--------------------------------------------------------------------------
  10. def start_phase1
  11.    # 转移到回合 1
  12.    @phase = 1
  13.    # 清除全体同伴的行动
  14.    $game_party.clear_actions
  15.    # 设置战斗事件
  16.    setup_battle_event
  17. end
  18. #--------------------------------------------------------------------------
  19. # ● 刷新画面 (自由战斗回合)
  20. #--------------------------------------------------------------------------
  21. def update_phase1
  22.    # 胜败判定
  23.    if judge
  24.      # 胜利或者失败的情况下 : 过程结束
  25.      return
  26.    end
  27.    # 开始同伴命令回合
  28.    start_phase2
  29. end
  30. #--------------------------------------------------------------------------
  31. # ● 开始同伴命令回合
  32. #--------------------------------------------------------------------------
  33. def start_phase2
  34.    # 转移到回合 2
  35.    @phase = 2
  36.    # 设置角色为非选择状态
  37.    @actor_index = -1
  38.    @active_battler = nil
  39.     # 有效化同伴指令窗口
  40.     @party_command_window.active = true
  41.     @party_command_window.visible = true
  42.    # 无效化角色指令窗口
  43.    @actor_command_window.active = false
  44.    @actor_command_window.visible = false
  45.    # 清除主回合标志
  46.    $game_temp.battle_main_phase = false
  47.    # 清除全体同伴的行动
  48.    $game_party.clear_actions
  49.    # 不能输入命令的情况下
  50.    unless $game_party.inputable?
  51.      # 开始主回合
  52.      start_phase4
  53.    end
  54. end
  55. #--------------------------------------------------------------------------
  56. # ● 刷新画面 (同伴命令回合)
  57. #--------------------------------------------------------------------------
  58. def update_phase2

  59.       # 演奏确定 SE
  60.       $game_system.se_play($data_system.decision_se)
  61.       # 开始角色的命令回合
  62.       start_phase3

  63.     end

  64.   end
  65. #--------------------------------------------------------------------------
  66. # ● 画面更新 (同伴指令回合 : 逃跑)
  67. #--------------------------------------------------------------------------
  68. def update_phase2_escape
  69.    # 计算敌人速度的平均值
  70.    enemies_agi = 0
  71.    enemies_number = 0
  72.    for enemy in $game_troop.enemies
  73.      if enemy.exist?
  74.        enemies_agi += enemy.agi
  75.        enemies_number += 1
  76.      end
  77.    end
  78.    if enemies_number > 0
  79.      enemies_agi /= enemies_number
  80.    end
  81.    # 计算角色速度的平均值
  82.    actors_agi = 0
  83.    actors_number = 0
  84.    for actor in $game_party.actors
  85.      if actor.exist?
  86.        actors_agi += actor.agi
  87.        actors_number += 1
  88.      end
  89.    end
  90.    if actors_number > 0
  91.      actors_agi /= actors_number
  92.    end
  93.    # 逃跑成功判定
  94.    success = rand(100) < 50 * actors_agi / enemies_agi
  95.    # 成功逃跑的情况下
  96.    if success        
  97.      # 演奏逃跑 SE
  98.      $game_system.se_play($data_system.escape_se)
  99.      # 还原为战斗开始前的 BGM
  100.      $game_system.bgm_play($game_temp.map_bgm)
  101.      # 战斗结束
  102.      $game_system.windowskin_name = "skin2"
  103.      #####################################################################
  104.      #####################################################################
  105.      #common_event = $data_common_events[18]
  106.      #$game_system.battle_interpreter.setup(common_event.list, 0)
  107.      #####################################################################
  108.      #####################################################################
  109.      $fff = 0
  110.      battle_end(1)
  111.    # 逃跑失败的情况下
  112.    else
  113.      # 清除全体同伴的行动
  114.      $game_party.clear_actions
  115.       @help_window.set_text("逃跑失败", 1)#显示『逃走失败』字样
  116.       @wait_count = 40
  117.      # 开始主回合
  118.      start_phase4
  119.    end
  120. end
  121. #--------------------------------------------------------------------------
  122. # ● 开始结束战斗回合
  123. #--------------------------------------------------------------------------
  124. def start_phase5
  125.    # 转移到回合 5
  126.    @phase = 5
  127.    # 演奏战斗结束 ME
  128.    $game_system.me_play($game_system.battle_end_me)
  129.    # 还原为战斗开始前的 BGM
  130.    $game_system.bgm_play($game_temp.map_bgm)
  131.    # 初始化 EXP、金钱、宝物
  132.    @exp = 0
  133.    gold = 0
  134.    treasures = []
  135.    # 循环
  136.    for enemy in $game_troop.enemies
  137.      # 敌人不是隐藏状态的情况下
  138.      unless enemy.hidden
  139.        # 获得 EXP、增加金钱
  140.        @exp += enemy.exp
  141.        gold += enemy.gold
  142.        # 出现宝物判定
  143.        if rand(100) < enemy.treasure_prob
  144.          if enemy.item_id > 0
  145.            treasures.push($data_items[enemy.item_id])
  146.          end
  147.          if enemy.weapon_id > 0
  148.            treasures.push($data_weapons[enemy.weapon_id])
  149.          end
  150.          if enemy.armor_id > 0
  151.            treasures.push($data_armors[enemy.armor_id])
  152.          end
  153.        end
  154.      end
  155.    end
  156.    # 限制宝物数为 6 个
  157.    treasures = treasures[0..5]
  158. #==================
  159.     # 准备过渡
  160.     Graphics.freeze
  161.     # 生成战斗胜利图形
  162.     @sprite = Sprite.new
  163.     @sprite.z = 9999
  164.     @sprite.bitmap = RPG::Cache.gameover("win")
  165.     # 执行过渡
  166.     Graphics.transition(40)
  167.     @wait_count = 40
  168.     # 准备过渡
  169.     Graphics.freeze
  170.     # 释放战斗胜利图形
  171.     @sprite.bitmap.dispose
  172.     # 执行过渡
  173.     Graphics.transition(40)
  174. #=======================
  175.    # 获得金钱
  176.    $game_party.gain_gold(gold)
  177.    # 获得宝物
  178.    for item in treasures
  179.      case item
  180.      when RPG::Item
  181.        $game_party.gain_item(item.id, 1)
  182.      when RPG::Weapon
  183.        $game_party.gain_weapon(item.id, 1)
  184.      when RPG::Armor
  185.        $game_party.gain_armor(item.id, 1)
  186.      end
  187.    end
  188.    # 生成战斗结果窗口
  189.    @result_window = Window_BattleResult.new(@exp, gold, treasures)
  190.     # 获得 EXP
  191.     for i in 0...$game_party.actors.size
  192.       actor = $game_party.actors[i]
  193.       if actor.cant_get_exp? == false
  194.         last_level = actor.level
  195.         actor.exp += @exp
  196.         if actor.level > last_level
  197.           @status_window.level_up(i)
  198.         end
  199.       end
  200.     end
  201.    # 设置等待计数
  202.    @phase5_wait_count = 1
  203. end
  204. #--------------------------------------------------------------------------
  205. # ● 画面更新 (结束战斗回合)
  206. #--------------------------------------------------------------------------
  207. def update_phase5
  208.   
  209. #  next_phase_ok = false
  210. #  # 次のアクターへ
  211. #  @phase5_i = -1 if @phase5_i == nil
  212. #  @phase5_i += 1
  213. #  if @phase5_i < $game_party.actors.size
  214. #  actor = $game_party.actors[@phase5_i]
  215. #  # 変身状態の味方がいるか判別し、それを解除する
  216. #  if actor.metamor_target != nil
  217. #  actor.animation_id = 17 # 戦闘終了変身解除時のアニメーションID
  218. #  actor.animation_hit = true
  219. #  actor.battler_name = actor.battler_name_original
  220. #  actor.metamor_target = nil
  221.   # ステータスウィンドウをリフレッシュ
  222. #  @status_window.refresh
  223.   # アニメーションの長さにかかわらず、最低 4 フレーム待つ
  224. #  @wait_count = 4
  225. #  end
  226. #  else
  227. #  next_phase_ok = true
  228. #  end
  229.   #if next_phase_ok
  230.    # 等待计数大于 0 的情况下
  231.    if @phase5_wait_count > 0
  232.      # 减少等待计数
  233.      @phase5_wait_count -= 1
  234.      # 等待计数为 0 的情况下
  235.      if @phase5_wait_count == 0
  236.        # 显示结果窗口
  237.        @result_window.visible = true
  238.        # 清除主回合标志
  239.        $game_temp.battle_main_phase = false
  240.        # 刷新状态窗口
  241.        @status_window.refresh        
  242.         #####################################################################
  243.         #####################################################################
  244.         #common_event = $data_common_events[18]
  245.         #$game_system.battle_interpreter.setup(common_event.list, 0)
  246.         #####################################################################
  247.         #####################################################################
  248.      end
  249.      return
  250.    end
  251.    # 按下 C 键的情况下
  252.    if Input.trigger?(Input::C)
  253.      # 关闭结果窗口
  254.      @result_window.visible = false
  255.      # 获得 EXP
  256.      #for i in 0...$game_party.actors.size
  257.       # actor = $game_party.actors[i]
  258.       # if actor.cant_get_exp? == false
  259.        #  last_level = actor.level
  260.        #  actor.exp += @exp
  261.        #  if actor.level > last_level
  262.        #   @status_window.level_up(i)
  263.        #  end
  264.       # end
  265.      #end
  266.      # 战斗结束
  267.      $fff = 0
  268.      battle_end(0)
  269.    end   
  270.   end
复制代码

作者: lxmstc    时间: 2008-4-17 02:47
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 3)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始角色命令回合
  9.   #--------------------------------------------------------------------------
  10.   def start_phase3
  11.     # 转移到回合 3
  12.     @phase = 3
  13.     # 设置觉得为非选择状态
  14.     @actor_index = -1
  15.     @active_battler = nil
  16.     # 输入下一个角色的命令
  17.     phase3_next_actor
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 转到输入下一个角色的命令
  21.   #--------------------------------------------------------------------------
  22.   def phase3_next_actor
  23.     # 循环
  24.     begin
  25.       # 角色的明灭效果 OFF
  26.       if @active_battler != nil
  27.         @active_battler.blink = false
  28.       end
  29.       # 最后的角色的情况
  30.       if @actor_index == $game_party.actors.size-1
  31.         # 开始主回合
  32.         start_phase4
  33.         return
  34.       end
  35.       # 推进角色索引
  36.       @actor_index += 1
  37.       @active_battler = $game_party.actors[@actor_index]
  38.       @active_battler.blink = true
  39.     # 如果角色是在无法接受指令的状态就再试
  40.     end until @active_battler.inputable?
  41.     # 设置角色的命令窗口
  42.     phase3_setup_command_window
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 转向前一个角色的命令输入
  46.   #--------------------------------------------------------------------------
  47.   def phase3_prior_actor
  48.     # 循环
  49.     begin
  50.       # 角色的明灭效果 OFF
  51.       if @active_battler != nil
  52.         @active_battler.blink = false
  53.       end
  54.       # 最初的角色的情况下
  55.       if @actor_index == 0
  56.         # 开始同伴指令回合
  57.         start_phase2
  58.         return
  59.       end
  60.       # 返回角色索引
  61.       @actor_index -= 1
  62.       @active_battler = $game_party.actors[@actor_index]
  63.       @active_battler.blink = true
  64.     # 如果角色是在无法接受指令的状态就再试
  65.     end until @active_battler.inputable?
  66.     # 设置角色的命令窗口
  67.     phase3_setup_command_window
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 设置角色指令窗口
  71.   #--------------------------------------------------------------------------
  72.   def phase3_setup_command_window
  73.     # 同伴指令窗口无效化
  74. #    @party_command_window.active = false
  75. #    @party_command_window.visible = false
  76.     # 角色指令窗口无效化
  77.     @actor_command_window.active = true
  78.     @actor_command_window.visible = true
  79.     # 设置角色指令窗口的位置
  80.     @actor_command_window.x = @actor_index * 160
  81.     @actor_command_window.y = 230
  82.     @actor_command_window.z = 9999
  83.     # 设置索引为 0
  84.     @actor_command_window.index = 0
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 刷新画面 (角色命令回合)
  88.   #--------------------------------------------------------------------------
  89.   def update_phase3
  90.     # 敌人光标有效的情况下
  91.     if @enemy_arrow != nil
  92.       update_phase3_enemy_select
  93.     # 角色光标有效的情况下
  94.     elsif @actor_arrow != nil
  95.       update_phase3_actor_select
  96.     # 特技窗口有效的情况下
  97.     elsif @skill_window != nil
  98.       update_phase3_skill_select
  99.     # 物品窗口有效的情况下
  100.     elsif @item_window != nil
  101.       update_phase3_item_select      
  102.     # 修改by:lim
  103.       
  104.     #------------------------------------------------------------------------

  105.     elsif @actor_window != nil
  106.       
  107.       update_phase3_character_select

  108.     #------------------------------------------------------------------------
  109.     elsif @actor_command_window.active
  110.       update_phase3_basic_command
  111.     end
  112.   end
  113.     # 角色指令窗口有效的情况下
  114.     #elsif @actor_command_window.active
  115.       #update_phase3_basic_command
  116.     #end
  117.   #end
  118.   #--------------------------------------------------------------------------
  119.   # ● 刷新画面 (角色命令回合 : 基本命令)
  120.   #--------------------------------------------------------------------------
  121.   def update_phase3_basic_command
  122.     # 按下 B 键的情况下
  123.     if Input.trigger?(Input::B)
  124.       # 演奏取消 SE
  125.       $game_system.se_play($data_system.cancel_se)
  126.       # 转向前一个角色的指令输入
  127.       phase3_prior_actor
  128.       return
  129.     end
  130.     # 按下 C 键的情况下
  131.     if Input.trigger?(Input::C)
  132.       # 角色指令窗口光标位置分之
  133.       case @actor_command_window.index
  134.       when 0  # 攻击
  135.         # 演奏确定 SE
  136.         $game_system.se_play($data_system.decision_se)
  137.         # 设置行动
  138.         @active_battler.current_action.kind = 0
  139.         @active_battler.current_action.basic = 0
  140.         # 开始选择敌人
  141.         start_enemy_select
  142.       when 1  # 特技
  143.         # 演奏确定 SE
  144.         $game_system.se_play($data_system.decision_se)
  145.         # 设置行动
  146.         @active_battler.current_action.kind = 1
  147.         # 开始选择特技
  148.         start_skill_select
  149.       when 2  # 防御
  150.         # 演奏确定 SE
  151.         $game_system.se_play($data_system.decision_se)
  152.         # 设置行动
  153.         @active_battler.current_action.kind = 0
  154.         @active_battler.current_action.basic = 1
  155.         # 转向下一位角色的指令输入
  156.         phase3_next_actor
  157.       when 3  # 物品
  158.         # 演奏确定 SE
  159.         $game_system.se_play($data_system.decision_se)
  160.         # 设置行动
  161.         @active_battler.current_action.kind = 2
  162.         # 开始选择物品
  163.         start_item_select
  164.       when 4 #逃跑(添加内容)
  165.         # 不能逃跑的情况下
  166.         if $game_temp.battle_can_escape == false
  167.           # 演奏冻结 SE
  168.           $game_system.se_play($data_system.buzzer_se)
  169.           return
  170.         end
  171.         # 演奏确定 SE
  172.         $game_system.se_play($data_system.decision_se)
  173.         # 逃走处理
  174.         update_phase2_escape
  175.       end
  176.       return
  177.     end
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 刷新画面 (角色命令回合 : 选择特技)
  181.   #--------------------------------------------------------------------------
  182.   def update_phase3_skill_select
  183.     # 设置特技窗口为可视状态
  184.     @skill_window.visible = true
  185.     # 刷新特技窗口
  186.     @skill_window.update
  187.     # 按下 B 键的情况下
  188.     if Input.trigger?(Input::B)
  189.       # 演奏取消 SE
  190.       $game_system.se_play($data_system.cancel_se)
  191.       # 结束特技选择
  192.       end_skill_select
  193.       return
  194.     end
  195.     # 按下 C 键的情况下
  196.     if Input.trigger?(Input::C)
  197.       # 获取特技选择窗口现在选择的特技的数据
  198.       @skill = @skill_window.skill
  199.       # 无法使用的情况下
  200.       if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
  201.         # 演奏冻结 SE
  202.         $game_system.se_play($data_system.buzzer_se)
  203.         return
  204.       end
  205.       # 演奏确定 SE
  206.       $game_system.se_play($data_system.decision_se)
  207.       # 设置行动
  208.       @active_battler.current_action.skill_id = @skill.id
  209.       # 设置特技窗口为不可见状态
  210.       @skill_window.visible = false
  211.       # 效果范围是敌单体的情况下
  212.       if @skill.scope == 1
  213.         # 开始选择敌人
  214.         start_enemy_select
  215.       # 效果范围是我方单体的情况下
  216.       elsif @skill.scope == 3 or @skill.scope == 5
  217.         # 开始选择角色
  218.         start_actor_select
  219.       # 效果范围不是单体的情况下
  220.       else
  221.         # 选择特技结束
  222.         end_skill_select
  223.         # 转到下一位角色的指令输入
  224.         phase3_next_actor
  225.       end
  226.       return
  227.     end
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 刷新画面 (角色命令回合 : 选择物品)
  231.   #--------------------------------------------------------------------------
  232.   def update_phase3_item_select
  233.     # 设置物品窗口为可视状态
  234.     @item_window.visible = true
  235.     # 刷新物品窗口
  236.     @item_window.update
  237.     # 按下 B 键的情况下
  238.     if Input.trigger?(Input::B)
  239.       # 演奏取消 SE
  240.       $game_system.se_play($data_system.cancel_se)
  241.       # 选择物品结束
  242.       end_item_select
  243.       return
  244.     end
  245.     # 按下 C 键的情况下
  246.     if Input.trigger?(Input::C)
  247.       # 获取物品窗口现在选择的物品资料
  248.       @item = @item_window.item
  249.       # 无法使用的情况下
  250.       unless $game_party.item_can_use?(@item.id)
  251.         # 演奏冻结 SE
  252.         $game_system.se_play($data_system.buzzer_se)
  253.         return
  254.       end
  255.       # 演奏确定 SE
  256.       $game_system.se_play($data_system.decision_se)
  257.       # 设置行动
  258.       @active_battler.current_action.item_id = @item.id
  259.       # 设置物品窗口为不可见状态
  260.       @item_window.visible = false
  261.       # 效果范围是敌单体的情况下
  262.       if @item.scope == 1
  263.         # 开始选择敌人
  264.         start_enemy_select
  265.       # 效果范围是我方单体的情况下
  266.       elsif @item.scope == 3 or @item.scope == 5
  267.         # 开始选择角色
  268.         start_actor_select
  269.       # 效果范围不是单体的情况下
  270.       else
  271.         # 物品选择结束
  272.         end_item_select
  273.         # 转到下一位角色的指令输入
  274.         phase3_next_actor
  275.       end
  276.       return
  277.     end
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 刷新画面画面 (角色命令回合 : 选择敌人)
  281.   #--------------------------------------------------------------------------
  282.   def update_phase3_enemy_select
  283.     # 刷新敌人箭头
  284.     @enemy_arrow.update
  285.     # 按下 B 键的情况下
  286.     if Input.trigger?(Input::B)
  287.       # 演奏取消 SE
  288.       $game_system.se_play($data_system.cancel_se)
  289.       # 选择敌人结束
  290.       end_enemy_select
  291.       return
  292.     end
  293.     # 按下 C 键的情况下
  294.     if Input.trigger?(Input::C)
  295.       # 演奏确定 SE
  296.       $game_system.se_play($data_system.decision_se)
  297.       # 设置行动
  298.       @active_battler.current_action.target_index = @enemy_arrow.index
  299.       # 选择敌人结束
  300.       end_enemy_select
  301.       # 显示特技窗口中的情况下
  302.       if @skill_window != nil
  303.         # 结束特技选择
  304.         end_skill_select
  305.       end
  306.       # 显示物品窗口的情况下
  307.       if @item_window != nil
  308.         # 结束物品选择
  309.         end_item_select
  310.       end
  311.       # 转到下一位角色的指令输入
  312.       phase3_next_actor
  313.     end
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 画面更新 (角色指令回合 : 选择角色)
  317.   #--------------------------------------------------------------------------
  318.   def update_phase3_actor_select
  319.     # 刷新角色箭头
  320.     @actor_arrow.update
  321.     # 按下 B 键的情况下
  322.     if Input.trigger?(Input::B)
  323.       # 演奏取消 SE
  324.       $game_system.se_play($data_system.cancel_se)
  325.       # 选择角色结束
  326.       end_actor_select
  327.       return
  328.     end
  329.     # 按下 C 键的情况下
  330.     if Input.trigger?(Input::C)
  331.       # 演奏确定 SE
  332.       $game_system.se_play($data_system.decision_se)
  333.       # 设置行动
  334.       @active_battler.current_action.target_index = @actor_arrow.index
  335.       # 选择角色结束
  336.       end_actor_select
  337.       # 显示特技窗口中的情况下
  338.       if @skill_window != nil
  339.         # 结束特技选择
  340.         end_skill_select
  341.       end
  342.       # 显示物品窗口的情况下
  343.       if @item_window != nil
  344.         # 结束物品选择
  345.         end_item_select
  346.       end
  347.       # 转到下一位角色的指令输入
  348.       phase3_next_actor
  349.     end
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 开始选择敌人
  353.   #--------------------------------------------------------------------------
  354.   def start_enemy_select
  355.     # 生成敌人箭头
  356.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  357.     # 关联帮助窗口
  358.     @enemy_arrow.help_window = @help_window
  359.     # 无效化角色指令窗口
  360.     @actor_command_window.active = false
  361.     @actor_command_window.visible = false
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 结束选择敌人
  365.   #--------------------------------------------------------------------------
  366.   def end_enemy_select
  367.     # 释放敌人箭头
  368.     @enemy_arrow.dispose
  369.     @enemy_arrow = nil
  370.     # 指令为 [战斗] 的情况下
  371. #   if @actor_command_window.index == 0
  372.       # 有效化角色指令窗口
  373.       @actor_command_window.active = true
  374.       @actor_command_window.visible = true
  375.       # 隐藏帮助窗口
  376.       @help_window.visible = false
  377.     end
  378. #  end
  379.   #--------------------------------------------------------------------------
  380.   # ● 开始选择角色
  381.   #--------------------------------------------------------------------------
  382.   def start_actor_select
  383.     # 生成角色箭头
  384.     @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
  385.     @actor_arrow.index = @actor_index
  386.     # 关联帮助窗口
  387. #    @actor_arrow.help_window = @help_window
  388.     # 无效化角色指令窗口
  389.     @actor_command_window.active = false
  390.     @actor_command_window.visible = false
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ● 结束选择角色
  394.   #--------------------------------------------------------------------------
  395.   def end_actor_select
  396.     # 释放角色箭头
  397.     @actor_arrow.dispose
  398.     @actor_arrow = nil
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 开始选择特技
  402.   #--------------------------------------------------------------------------
  403.   def start_skill_select
  404.     # 生成特技窗口
  405.     @skill_window = Window_Skill.new(@active_battler)
  406.     @skill_window.z = 9999
  407.     # 关联帮助窗口
  408.     @skill_window.help_window = @help_window
  409.     # 无效化角色指令窗口
  410.     @actor_command_window.active = false
  411.     @actor_command_window.visible = false
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 选择特技结束
  415.   #--------------------------------------------------------------------------
  416.   def end_skill_select
  417.     # 释放特技窗口
  418.     @skill_window.dispose
  419.     @skill_window = nil
  420.     # 隐藏帮助窗口
  421.     @help_window.visible = false
  422.     # 有效化角色指令窗口
  423.     @actor_command_window.active = true
  424.     @actor_command_window.visible = true
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # ● 开始选择物品
  428.   #--------------------------------------------------------------------------
  429.   def start_item_select
  430.     # 生成物品窗口
  431.     @item_window = Window_Item.new
  432.     @item_window.z = 9999
  433.     # 关联帮助窗口
  434.     @item_window.help_window = @help_window
  435.     # 无效化角色指令窗口
  436.     @actor_command_window.active = false
  437.     @actor_command_window.visible = false
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # ● 结束选择物品
  441.   #--------------------------------------------------------------------------
  442.   def end_item_select
  443.     # 释放物品窗口
  444.     @item_window.dispose
  445.     @item_window = nil
  446.     # 隐藏帮助窗口
  447.     @help_window.visible = false
  448.     # 有效化角色指令窗口
  449.     @actor_command_window.active = true
  450.     @actor_command_window.visible = true
  451.   end
  452. end
复制代码

作者: lxmstc    时间: 2008-4-17 02:48
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始主回合
  9.   #--------------------------------------------------------------------------
  10.   def start_phase4
  11.     # 转移到回合 4
  12.     @phase = 4
  13.     # 回合数计数
  14.     $game_temp.battle_turn += 1
  15.     # 搜索全页的战斗事件
  16.     for index in 0...$data_troops[@troop_id].pages.size
  17.       # 获取事件页
  18.       page = $data_troops[@troop_id].pages[index]
  19.       # 本页的范围是 [回合] 的情况下
  20.       if page.span == 1
  21.         # 设置已经执行标志
  22.         $game_temp.battle_event_flags[index] = false
  23.       end
  24.     end
  25.     # 设置角色为非选择状态
  26.     @actor_index = -1
  27.     @active_battler = nil
  28.     # 有效化同伴指令窗口
  29.     @party_command_window.active = false
  30.     @party_command_window.visible = false
  31.     # 无效化角色指令窗口
  32.    
  33.     @actor_command_window.active = false
  34.     @actor_command_window.visible = false
  35.     # 设置主回合标志
  36.     $game_temp.battle_main_phase = true
  37.     # 生成敌人行动
  38.     for enemy in $game_troop.enemies
  39.       enemy.make_action
  40.     end
  41.     # 生成行动顺序
  42.     make_action_orders
  43.     # 移动到步骤 1
  44.     @phase4_step = 1
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 生成行动循序
  48.   #--------------------------------------------------------------------------
  49.   def make_action_orders
  50.     # 初始化序列 @action_battlers
  51.     @action_battlers = []
  52.     # 添加敌人到 @action_battlers 序列
  53.     for enemy in $game_troop.enemies
  54.       @action_battlers.push(enemy)
  55.     end
  56.     # 添加角色到 @action_battlers 序列
  57.     for actor in $game_party.actors
  58.       @action_battlers.push(actor)
  59.     end
  60.     # 确定全体的行动速度
  61.     for battler in @action_battlers
  62.       battler.make_action_speed
  63.     end
  64.     # 按照行动速度从大到小排列
  65.     @action_battlers.sort! {|a,b|
  66.       b.current_action.speed - a.current_action.speed }
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 刷新画面 (主回合)
  70.   #--------------------------------------------------------------------------
  71.   def update_phase4
  72.     case @phase4_step
  73.     when 1
  74.       update_phase4_step1
  75.     when 2
  76.       update_phase4_step2
  77.     when 3
  78.       update_phase4_step3
  79.     when 4
  80.       update_phase4_step4
  81.     when 5
  82.       update_phase4_step5
  83.     when 6
  84.       update_phase4_step6
  85.     end
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  89.   #--------------------------------------------------------------------------
  90.   def update_phase4_step1
  91.     # 隐藏帮助窗口
  92.     @help_window.visible = false
  93.     @help_window.enemy = nil
  94.     # 判定胜败
  95.     if judge
  96.       # 胜利或者失败的情况下 : 过程结束
  97.       return
  98.     end
  99.     # 强制行动的战斗者不存在的情况下
  100.     if $game_temp.forcing_battler == nil
  101.       # 设置战斗事件
  102.       setup_battle_event
  103.       # 执行战斗事件中的情况下
  104.       if $game_system.battle_interpreter.running?
  105.         return
  106.       end
  107.     end
  108.     # 强制行动的战斗者存在的情况下
  109.     if $game_temp.forcing_battler != nil
  110.       # 在头部添加后移动
  111.       @action_battlers.delete($game_temp.forcing_battler)
  112.       @action_battlers.unshift($game_temp.forcing_battler)
  113.     end
  114.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  115.     if @action_battlers.size == 0
  116.       # 开始同伴命令回合
  117.       start_phase2
  118.       return
  119.     end
  120.     # 初始化动画 ID 和公共事件 ID
  121.     @animation1_id = 0
  122.     @animation2_id = 0
  123.     @common_event_id = 0
  124.     # 未行动的战斗者移动到序列的头部
  125.     @active_battler = @action_battlers.shift
  126.     # 如果已经在战斗之外的情况下
  127.     if @active_battler.index == nil
  128.       return
  129.     end
  130.     # 自然解除状态
  131.     @active_battler.remove_states_auto
  132.     # 刷新状态窗口
  133.     @status_window.refresh
  134.     # 移至步骤 2
  135.     #print "phase4_step = 2"
  136.     @phase4_step = 2
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  140.   #--------------------------------------------------------------------------
  141.   def update_phase4_step2
  142.    
  143.     # 如果不是强制行动
  144.     unless @active_battler.current_action.forcing
  145.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  146.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  147.         # 设置行动为攻击
  148.         @active_battler.current_action.kind = 0
  149.         @active_battler.current_action.basic = 0
  150.       end
  151.       # 限制为 [不能行动] 的情况下
  152.       if @active_battler.restriction == 4
  153.         # 清除行动强制对像的战斗者
  154.         $game_temp.forcing_battler = nil
  155.         # 移至步骤 1
  156.         @phase4_step = 1
  157.         return
  158.       end
  159.     end
  160.     # 清除对像战斗者
  161.     @target_battlers = []
  162.     # 行动种类分支
  163.     case @active_battler.current_action.kind
  164.     when 0  # 基本
  165.       #if @active_battler.current_action.basic != 1
  166.         make_basic_action_result
  167.       #end
  168.     when 1  # 特技
  169.       make_skill_action_result
  170.     when 2  # 物品
  171.       
  172.       make_item_action_result
  173.     when 10  # 杂项菜单
  174.       ##jkka
  175.     when 11
  176.       make_throw_action_result
  177.     end
  178.     # 移至步骤 3
  179.     if @phase4_step == 2
  180.       @phase4_step = 3
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 生成投掷行动结果
  185.   #--------------------------------------------------------------------------
  186.   def make_throw_action_result
  187.    
  188.     $choice = 4
  189.     if @active_battler.is_a?(Game_Actor)
  190.      $actname = @active_battler.battler_name
  191.      
  192.      
  193.    else
  194.      $actname = @active_battler.battler_name
  195.    end     
  196.     # 获取物品
  197.     data = @active_battler.current_action.item_id[0] ? $data_items : $data_weapons
  198.     @item = data[@active_battler.current_action.item_id[1]]
  199.     # 因为物品耗尽而无法使用的情况下
  200.     if @active_battler.current_action.item_id[0]
  201.       unless $game_party.item_can_use?(@item.id)
  202.         # 移至步骤 1
  203.         @phase4_step = 1
  204.         return
  205.       end
  206.       # 消耗品的情况下
  207.       if @item.consumable
  208.         # 使用的物品减 1
  209.         $game_party.lose_item(@item.id, 1)
  210.       end
  211.       # 设置公共事件 ID
  212.       @common_event_id = @item.common_event_id
  213.       # 在帮助窗口显示物品名
  214.       @help_window.set_text(@item.name, 1)
  215.       # 设置动画 ID
  216.       if active_battler.index == 0
  217.          @animation1_id = 163
  218.       else
  219.          @animation1_id = 245
  220.          if $game_switches[90] == true
  221.             @animation1_id = 545
  222.          end
  223.       end   
  224.       
  225.       
  226.          
  227.         @animation2_id = @item.animation2_id
  228.         
  229.       # 确定对像
  230.       index = @active_battler.current_action.target_index
  231.       target = $game_party.smooth_target_actor(index)
  232.       # 设置对像侧战斗者
  233.       set_target_battlers(@item.scope)
  234.     else
  235.       # 在帮助窗口显示物品名
  236.       @help_window.set_text(@item.name, 1)
  237.       # 确定对像
  238.       index = @active_battler.current_action.target_index
  239.       target = $game_party.smooth_target_actor(index)
  240.        # 设置动画 ID
  241.       if active_battler.index == 0
  242.          @animation1_id = 163
  243.       else
  244.          @animation1_id = 245
  245.          if $game_switches[90] == true
  246.             @animation1_id = 545
  247.          end
  248.       end   
  249.       @animation2_id = 620
  250.       
  251.       # 设置对像侧战斗者
  252.       set_target_battlers(1)
  253.     end
  254.     # 应用物品效果
  255.     for target in @target_battlers
  256.       target.item_effect(@item)
  257.     end
  258.   end
  259.   

  260.   #--------------------------------------------------------------------------
  261.   # ● 生成基本行动结果
  262.   #--------------------------------------------------------------------------
  263.   def make_basic_action_result
  264.     $choice = 1
  265.     # 攻击的情况下
  266.     if @active_battler.current_action.basic == 0
  267.       # 设置攻击 ID
  268.       @animation1_id = @active_battler.animation1_id
  269.       @animation2_id = @active_battler.animation2_id
  270.       # 行动方的战斗者是敌人的情况下
  271.       if @active_battler.is_a?(Game_Enemy)
  272.         if @active_battler.restriction == 3
  273.           target = $game_troop.random_target_enemy  
  274.         elsif @active_battler.restriction == 2
  275.           target = $game_party.random_target_actor
  276.         else
  277.           index = @active_battler.current_action.target_index
  278.           target = $game_party.smooth_target_actor(index)
  279.         end
  280.       end
  281.       # 行动方的战斗者是角色的情况下
  282.       if @active_battler.is_a?(Game_Actor)
  283.         if @active_battler.restriction == 3
  284.           target = $game_party.random_target_actor
  285.         elsif @active_battler.restriction == 2
  286.           target = $game_troop.random_target_enemy
  287.         else
  288.           index = @active_battler.current_action.target_index
  289.           target = $game_troop.smooth_target_enemy(index)
  290.         end
  291.       end
  292.       # 设置对像方的战斗者序列
  293.       @target_battlers = [target]
  294.       # 应用通常攻击效果
  295.       for target in @target_battlers
  296.         target.attack_effect(@active_battler)
  297.       end
  298.       return
  299.     end
  300.     # 防御的情况下
  301.     if @active_battler.current_action.basic == 1
  302.       # 帮助窗口显示"防御"
  303.         @help_window.set_text($data_system.words.guard, 1)
  304.       # ——回复。可以改为SP。
  305.         @active_battler.damage = -@active_battler.maxhp * 0.2
  306.         @active_battler.damage = -@active_battler.maxsp * 0.1
  307.         @active_battler.damage = @active_battler.damage.to_i
  308.         @active_battler.hp -= @active_battler.damage
  309.       # 回復值的表示
  310.         @target_battlers.push(@active_battler)
  311.        return
  312.     end

  313.     # 逃跑的情况下
  314.     if @active_battler.is_a?(Game_Enemy) and
  315.        @active_battler.current_action.basic == 2
  316.       #  帮助窗口显示"逃跑"
  317.       @help_window.set_text("逃跑", 1)
  318.       # 逃跑
  319.       @active_battler.escape
  320.       return
  321.     end
  322.     # 什么也不做的情况下
  323.     if @active_battler.current_action.basic == 3
  324.       # 清除强制行动对像的战斗者
  325.       $game_temp.forcing_battler = nil
  326.       # 移至步骤 1
  327.       @phase4_step = 1
  328.       return
  329.     end
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 设置物品或特技对像方的战斗者
  333.   #     scope : 特技或者是物品的范围
  334.   #--------------------------------------------------------------------------
  335.   def set_target_battlers(scope)
  336.    
  337.     # 行动方的战斗者是敌人的情况下
  338.     if @active_battler.is_a?(Game_Enemy)
  339.       # 效果范围分支
  340.       case scope
  341.       when 1  # 敌单体
  342.         index = @active_battler.current_action.target_index
  343.         @target_battlers.push($game_party.smooth_target_actor(index))
  344.       when 2  # 敌全体
  345.         for actor in $game_party.actors
  346.           if actor.exist?
  347.             @target_battlers.push(actor)
  348.           end
  349.         end
  350.       when 3  # 我方单体
  351.         index = @active_battler.current_action.target_index
  352.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  353.       when 4  # 我方全体
  354.         for enemy in $game_troop.enemies
  355.           if enemy.exist?
  356.             @target_battlers.push(enemy)
  357.           end
  358.         end
  359.       when 5  # 我方单体 (HP 0)
  360.         index = @active_battler.current_action.target_index
  361.         enemy = $game_troop.enemies[index]
  362.         if enemy != nil and enemy.hp0?
  363.           @target_battlers.push(enemy)
  364.         end
  365.       when 6  # 我方全体 (HP 0)
  366.         for enemy in $game_troop.enemies
  367.           if enemy != nil and enemy.hp0?
  368.             @target_battlers.push(enemy)
  369.           end
  370.         end
  371.       when 7  # 使用者
  372.         @target_battlers.push(@active_battler)
  373.       end
  374.     end
  375.     # 行动方的战斗者是角色的情况下
  376.     if @active_battler.is_a?(Game_Actor)
  377.       # 效果范围分支
  378.       case scope
  379.       when 1  # 敌单体
  380.         index = @active_battler.current_action.target_index
  381.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  382.       when 2  # 敌全体
  383.         for enemy in $game_troop.enemies
  384.           if enemy.exist?
  385.             @target_battlers.push(enemy)
  386.           end
  387.         end
  388.       when 3  # 我方单体
  389.         index = @active_battler.current_action.target_index
  390.         @target_battlers.push($game_party.smooth_target_actor(index))
  391.       when 4  # 我方全体
  392.         for actor in $game_party.actors
  393.           if actor.exist?
  394.             @target_battlers.push(actor)
  395.           end
  396.         end
  397.       when 5  # 我方单体 (HP 0)
  398.         index = @active_battler.current_action.target_index
  399.         actor = $game_party.actors[index]
  400.         if actor != nil and actor.hp0?
  401.           @target_battlers.push(actor)
  402.         end
  403.       when 6  # 我方全体 (HP 0)
  404.         for actor in $game_party.actors
  405.           if actor != nil and actor.hp0?
  406.             @target_battlers.push(actor)
  407.           end
  408.         end
  409.       when 7  # 使用者
  410.         @target_battlers.push(@active_battler)
  411.       end
  412.     end
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 生成特技行动结果
  416.   #--------------------------------------------------------------------------
  417.   def make_skill_action_result
  418.     $choice = 2
  419.     # 获取特技
  420.     @skill = $data_skills[@active_battler.current_action.skill_id]
  421.     # 如果不是强制行动
  422.     unless @active_battler.current_action.forcing
  423.       # 因为 SP 耗尽而无法使用的情况下
  424.       unless @active_battler.skill_can_use?(@skill.id)
  425.         # 清除强制行动对像的战斗者
  426.         $game_temp.forcing_battler = nil
  427.         # 移至步骤 1
  428.         @phase4_step = 1
  429.         return
  430.       end
  431.     end
  432.     # 消耗 SP
  433.     @active_battler.sp -= @skill.sp_cost
  434.     # 刷新状态窗口
  435.     @status_window.refresh
  436.     # 在帮助窗口显示特技名
  437.     @help_window.set_text(@skill.name, 1)
  438.     # 设置动画 ID
  439.     @animation1_id = @skill.animation1_id
  440.     if $game_switches[90] == true
  441.         if @animation1_id == 242 or  @animation1_id == 244 or  @animation1_id == 245
  442.            @animation1_id = @animation1_id + 300
  443.        end
  444.    
  445.         if @animation1_id == 251 or  @animation1_id == 261 or  @animation1_id == 271
  446.            @animation1_id = @animation1_id + 300
  447.         end
  448.          
  449.         if @animation1_id == 273 or  @animation1_id == 275 or  @animation1_id == 281
  450.            @animation1_id = @animation1_id + 300
  451.       end
  452.         if @animation1_id == 283 or  @animation1_id == 285 or  @animation1_id == 291
  453.            @animation1_id = @animation1_id + 300
  454.          end
  455.         if @animation1_id == 293
  456.            @animation1_id = @animation1_id + 300
  457.       end      
  458.     end
  459.     @animation2_id = @skill.animation2_id
  460.     # 设置公共事件 ID
  461.     @common_event_id = @skill.common_event_id
  462.     # 设置对像侧战斗者
  463.     set_target_battlers(@skill.scope)
  464.    
  465.     ########### 公共事件 ID 有效的情况下###########(提前动画)
  466.     if @common_event_id > 0 and @common_event_id != 72
  467.       # 设置事件
  468.      
  469.       common_event = $data_common_events[@common_event_id]
  470.       $game_system.battle_interpreter.setup(common_event.list, 0)
  471.     end
  472.      
  473.     # 应用特技效果
  474.     for target in @target_battlers
  475.       target.skill_effect(@active_battler, @skill)
  476.     end
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 生成物品行动结果
  480.   #--------------------------------------------------------------------------
  481.   def make_item_action_result
  482.     $choice = 3
  483.    
  484.     if @throw_s == 1
  485.    
  486.     # 获取物品
  487.     data = @active_battler.current_action.item_id[0] ? $data_items : $data_weapons
  488.     @item = data[@active_battler.current_action.item_id[1]]
  489.     # 因为物品耗尽而无法使用的情况下
  490.     if @active_battler.current_action.item_id[0]
  491.       unless $game_party.item_can_use?(@item.id)
  492.         # 移至步骤 1
  493.         @phase4_step = 1
  494.         return
  495.       end
  496.       # 消耗品的情况下
  497.       if @item.consumable
  498.         # 使用的物品减 1
  499.         $game_party.lose_item(@item.id, 1)
  500.       end
  501.     # 在帮助窗口显示物品名
  502.     @help_window.set_text(@item.name, 1)
  503.       # 设置公共事件 ID
  504.       @common_event_id = @item.common_event_id
  505.       
  506.       # 设置动画 ID
  507.       if active_battler.index == 0
  508.          @animation1_id = 620
  509.       else
  510.          @animation1_id = 245
  511.       if $game_switches[90] == true
  512.             @animation1_id = 545
  513.          end
  514.       end   
  515.       @animation2_id = @item.animation2_id
  516.       # 确定对像
  517.       index = @active_battler.current_action.target_index
  518.       target = $game_party.smooth_target_actor(index)
  519.       # 设置对像侧战斗者
  520.       set_target_battlers(@item.scope)
  521.     else
  522.       
  523.       # 设置动画 ID
  524.       if active_battler.index == 0
  525.          @animation1_id = 620
  526.       else
  527.          @animation1_id = 245
  528.       if $game_switches[90] == true
  529.             @animation1_id = 545
  530.          end
  531.       end   
  532.       @animation2_id = @item.animation2_id
  533.       
  534.       # 确定对像
  535.       index = @active_battler.current_action.target_index
  536.       target = $game_party.smooth_target_actor(index)
  537.       # 设置对像侧战斗者
  538.       set_target_battlers(1)
  539.     end
  540.     if @common_event_id > 0 and @common_event_id != 72
  541.       # 设置事件
  542.       @animation1_id = 0
  543.       common_event = $data_common_events[@common_event_id]
  544.       $game_system.battle_interpreter.setup(common_event.list, 0)

  545.   end
  546.     # 应用物品效果
  547.     for target in @target_battlers
  548.       target.item_effect(@item)
  549.     end
  550.   #end
  551.    
  552. else
  553.    
  554.    
  555.     # 获取物品
  556.     @item = $data_items[@active_battler.current_action.item_id]
  557.     # 因为物品耗尽而无法使用的情况下
  558.     unless $game_party.item_can_use?(@item.id)
  559.       # 移至步骤 1
  560.       @phase4_step = 1
  561.       return
  562.     end
  563.     # 消耗品的情况下
  564.     #print "make"
  565.     if @item.consumable
  566.       # 使用的物品减 1
  567.       $game_party.lose_item(@item.id, 1)
  568.     end
  569.     # 在帮助窗口显示物品名
  570.     @help_window.set_text(@item.name, 1)
  571.    
  572.     # 设置动画 ID
  573.     if active_battler.index == 0
  574.          @animation1_id = 163
  575.       else
  576.          @animation1_id = 245
  577.          if $game_switches[90] == true
  578.             @animation1_id = 545
  579.          end
  580.       end   
  581.     @animation2_id = @item.animation2_id
  582.     # 设置公共事件 ID
  583.     @common_event_id = @item.common_event_id
  584.     # 确定对像
  585.     index = @active_battler.current_action.target_index
  586.     target = $game_party.smooth_target_actor(index)
  587.     # 设置对像侧战斗者
  588.     set_target_battlers(@item.scope)
  589.     ########### 公共事件 ID 有效的情况下###########(提前动画)
  590.     if @common_event_id > 0 and @common_event_id != 72
  591.       # 设置事件
  592.       @animation1_id = 0
  593.       common_event = $data_common_events[@common_event_id]
  594.       $game_system.battle_interpreter.setup(common_event.list, 0)

  595.   end
  596.     # 应用物品效果
  597.     for target in @target_battlers
  598.       target.item_effect(@item)
  599.     end
  600.   end
  601. end
  602.    



  603. ##--------------------------------------------------------------------------
  604. # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  605. #--------------------------------------------------------------------------
  606. def update_phase4_step3
  607.   
  608.    # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  609.    if @animation1_id == 0
  610.       @active_battler.white_flash = false
  611.    else
  612.      @active_battler.animation_id = @animation1_id
  613.      @active_battler.animation_hit = true
  614.    end
  615.    # 效果范围是敌方的情况下
  616.    if $choice != 2
  617.      # 对像方动画
  618.      for target in @target_battlers
  619.        target.animation_id = @animation2_id
  620.        target.animation_hit = (target.damage != "Miss")
  621.      end
  622.    end
  623.    if $choice == 2
  624.      if @skill.scope <= 2
  625.      for target in @target_battlers
  626.        target.animation_id = @animation2_id
  627.        target.animation_hit = (target.damage != "Miss")
  628.      end     
  629.    end
  630. end
  631.    # 移至步骤 4
  632.    @phase4_step = 4
  633. end
  634. #--------------------------------------------------------------------------
  635. # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  636. #--------------------------------------------------------------------------
  637. def update_phase4_step4
  638.    # 效果范围是我方的情况下
  639. if $choice == 2
  640.     if @skill.scope >= 3
  641.      # 对像方动画
  642.      for target in @target_battlers
  643.        target.animation_id = @animation2_id
  644.        target.animation_hit = (target.damage != "Miss")
  645.      end
  646.    end
  647.   end
  648.    # 限制动画长度、最低 8 帧
  649.    @wait_count = 8
  650.    # 移至步骤 5
  651.    @phase4_step = 5
  652. end


  653.   #--------------------------------------------------------------------------
  654.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  655.   #--------------------------------------------------------------------------
  656.   def update_phase4_step5
  657.     # 隐藏帮助窗口
  658.     @help_window.visible = false
  659.     @help_window.enemy = nil
  660.     # 刷新状态窗口
  661.     @status_window.refresh
  662.     # 显示伤害
  663.     for target in @target_battlers
  664.       if target.damage != nil
  665.         target.damage_pop = true
  666.       end
  667.     end
  668.     # 移至步骤 6
  669.     @phase4_step = 6
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  673.   #--------------------------------------------------------------------------
  674.    def update_phase4_step6
  675.     # 清除强制行动对像的战斗者
  676.     $game_temp.forcing_battler = nil
  677.     # 对于一些后执行战斗事件
  678.     if  @common_event_id == 72
  679.       # 设置事件
  680.       common_event = $data_common_events[@common_event_id]
  681.       $game_system.battle_interpreter.setup(common_event.list, 0)
  682.     end
  683.     # 连续伤害的退后
  684.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  685.        @active_battler.slip_damage_effect
  686.        @active_battler.damage_pop = true
  687.      end   
  688.     if @active_battler.state?(61) and @active_battler.hp >0  #-恢复魔法
  689.       @active_battler.damage=-@active_battler.maxhp * 5 / 100 #恢复生命百分比,这里设置为10%,也可设置固定值
  690.       @active_battler.damage=@active_battler.damage.to_i
  691.       @active_battler.hp-=@active_battler.damage
  692.       @active_battler.animation_id = 648 #自动补血动画编号
  693.       @active_battler.damage_pop = true
  694.     end   
  695.     if @active_battler.state?(62) and @active_battler.hp >0  #-恢复魔法
  696.       @active_battler.damage=-@active_battler.maxsp * 5 / 100 #恢复生命百分比,这里设置为10%,也可设置固定值
  697.       @active_battler.damage=@active_battler.damage.to_i
  698.       @active_battler.sp-=@active_battler.damage
  699.       @active_battler.animation_id = 648 #自动补血动画编号
  700.       @active_battler.damage_pop = true
  701.     end   
  702.     if @active_battler.state?(63) and @active_battler.hp >0  #-恢复魔法
  703.       @active_battler.damage=-@active_battler.maxhp*2/100 #恢复生命百分比,这里设置为10%,也可设置固定值
  704.       @active_battler.damage=@active_battler.damage.to_i
  705.       @active_battler.hp-=@active_battler.damage
  706.       @active_battler.animation_id = 648 #自动补血动画编号
  707.       @active_battler.damage_pop = true
  708.     end      
  709.     if @active_battler.state?(64) and @active_battler.hp >0  #-恢复魔法
  710.       @active_battler.damage=-@active_battler.maxhp*15/100 #恢复生命百分比,这里设置为10%,也可设置固定值
  711.       @active_battler.damage=@active_battler.damage.to_i
  712.       @active_battler.hp-=@active_battler.damage
  713.       @active_battler.animation_id = 648 #自动补血动画编号
  714.       @active_battler.damage_pop = true
  715.     end   
  716.     if @active_battler.state?(65) and @active_battler.hp >0  #-恢复魔法
  717.       @active_battler.damage=-@active_battler.maxsp*2/100 #恢复生命百分比,这里设置为10%,也可设置固定值
  718.       @active_battler.damage=@active_battler.damage.to_i
  719.       @active_battler.sp-=@active_battler.damage
  720.       @active_battler.animation_id = 648 #自动补血动画编号
  721.       @active_battler.damage_pop = true
  722.     end   
  723.     if @active_battler.state?(66) and @active_battler.hp >0  #-恢复魔法
  724.       @active_battler.damage=-@active_battler.maxsp*15/100 #恢复生命百分比,这里设置为10%,也可设置固定值
  725.       @active_battler.damage=@active_battler.damage.to_i
  726.       @active_battler.sp-=@active_battler.damage
  727.       @active_battler.animation_id = 648 #自动补血动画编号
  728.       @active_battler.damage_pop = true
  729.     end         
  730.     if @active_battler.state?(67) and @active_battler.hp >0  #-恢复魔法
  731.       @active_battler.damage=-@active_battler.maxsp/10 #恢复生命百分比,这里设置为10%,也可设置固定值
  732.       @active_battler.damage=@active_battler.damage.to_i
  733.       @active_battler.sp-=@active_battler.damage
  734.       @active_battler.animation_id = 648 #自动补血动画编号
  735.       @active_battler.damage_pop = true
  736.     end      
  737.     if @active_battler.state?(68) and @active_battler.hp >0  #-恢复魔法
  738.       @active_battler.damage=-@active_battler.maxhp/10 #恢复生命百分比,这里设置为10%,也可设置固定值
  739.       @active_battler.damage=@active_battler.damage.to_i
  740.       @active_battler.hp-=@active_battler.damage
  741.       @active_battler.animation_id = 648 #自动补血动画编号
  742.       @active_battler.damage_pop = true
  743.     end     
  744.     # 如果不是结束战斗回合的情况下
  745.     if @phase != 5
  746.       # 刷新状态窗口
  747.       @status_window.refresh
  748.     end
  749.     # 移至步骤 1
  750.     @phase4_step = 1
  751.   end
  752. end
复制代码

作者: lxmstc    时间: 2008-4-17 02:50
  1. #==============================================================================
  2. # ■ Scene_Shop
  3. #------------------------------------------------------------------------------
  4. #  处理商店画面的类。
  5. #==============================================================================

  6. class Scene_Shop
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 生成帮助窗口
  12.     @help_window = Window_Help.new
  13.     # 生成指令窗口
  14.     @command_window = Window_ShopCommand.new
  15.     # 生成金钱窗口
  16.     @gold_window = Window_Gold.new
  17.     @gold_window.x = 480
  18.     @gold_window.y = 64
  19.     # 生成时间窗口
  20.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  21.     # 生成购买窗口
  22.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  23.     @buy_window.active = false
  24.     @buy_window.visible = false
  25.     @buy_window.help_window = @help_window
  26.     # 生成卖出窗口
  27.     @sell_window = Window_ShopSell.new
  28.     @sell_window.active = false
  29.     @sell_window.visible = false
  30.     @sell_window.help_window = @help_window
  31.     # 生成数量输入窗口
  32.     @number_window = Window_ShopNumber.new
  33.     @number_window.active = false
  34.     @number_window.visible = false
  35.     # 生成状态窗口
  36.     @status_window = Window_ShopStatus.new
  37.     @status_window.visible = false
  38.     # 执行过渡
  39.     Graphics.transition
  40.     # 主循环
  41.     loop do
  42.       # 刷新游戏画面
  43.       Graphics.update
  44.       # 刷新输入信息
  45.       Input.update
  46.       # 刷新画面
  47.       update
  48.       # 如果画面切换的话就中断循环
  49.       if $scene != self
  50.         break
  51.       end
  52.     end
  53.     # 准备过渡
  54.     Graphics.freeze
  55.     # 释放窗口
  56.     @help_window.dispose
  57.     @command_window.dispose
  58.     @gold_window.dispose
  59.     @dummy_window.dispose
  60.     @buy_window.dispose
  61.     @sell_window.dispose
  62.     @number_window.dispose
  63.     @status_window.dispose
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 刷新画面
  67.   #--------------------------------------------------------------------------
  68.   def update
  69.     # 刷新窗口
  70.     @help_window.update
  71.     @command_window.update
  72.     @gold_window.update
  73.     @dummy_window.update
  74.     @buy_window.update
  75.     @sell_window.update
  76.     @number_window.update
  77.     @status_window.update
  78.     # 指令窗口激活的情况下: 调用 update_command
  79.     if @command_window.active
  80.       update_command
  81.       return
  82.     end
  83.     # 购买窗口激活的情况下: 调用 update_buy
  84.     if @buy_window.active
  85.       update_buy
  86.       return
  87.     end
  88.     # 卖出窗口激活的情况下: 调用 update_sell
  89.     if @sell_window.active
  90.       update_sell
  91.       return
  92.     end
  93.     # 个数输入窗口激活的情况下: 调用 update_number
  94.     if @number_window.active
  95.       update_number
  96.       return
  97.     end
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 刷新画面 (指令窗口激活的情况下)
  101.   #--------------------------------------------------------------------------
  102.   def update_command
  103.     # 按下 B 键的情况下
  104.     if Input.trigger?(Input::B)
  105.       # 演奏取消 SE
  106.       $game_system.se_play($data_system.cancel_se)
  107.       # 切换到地图画面
  108.       $scene = Scene_Map.new
  109.       return
  110.     end
  111.     # 按下 C 键的情况下
  112.     if Input.trigger?(Input::C)
  113.       # 命令窗口光标位置分支
  114.       case @command_window.index
  115.       when 0  # 购买
  116.         # 演奏确定 SE
  117.         $game_system.se_play($data_system.decision_se)
  118.         # 窗口状态转向购买模式
  119.         @command_window.active = false
  120.         @dummy_window.visible = false
  121.         @buy_window.active = true
  122.         @buy_window.visible = true
  123.         @buy_window.refresh
  124.         @status_window.visible = true
  125.       when 1  # 卖出
  126.         # 演奏确定 SE
  127.         $game_system.se_play($data_system.decision_se)
  128.         # 窗口状态转向卖出模式
  129.         @command_window.active = false
  130.         @dummy_window.visible = false
  131.         @sell_window.active = true
  132.         @sell_window.visible = true
  133.         @sell_window.refresh
  134.       when 2  # 还价
  135.         #  不可以还价的情况下
  136.         if $game_switches[199] == false
  137.           # 演奏冻结 SE
  138.           $game_system.se_play($data_system.buzzer_se)
  139.         else
  140.           # 演奏确定 SE
  141.           $game_system.se_play($data_system.decision_se)
  142.           $game_switches[199] = false
  143.           # 切换到地图画面
  144.           $scene = Scene_Map.new
  145.         end
  146.       when 3  # 取消
  147.         # 演奏确定 SE
  148.         $game_system.se_play($data_system.decision_se)
  149.         # 切换到地图画面
  150.         $scene = Scene_Map.new
  151.       end
  152.       return
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 刷新画面 (购买窗口激活的情况下)
  157.   #--------------------------------------------------------------------------
  158.   def update_buy
  159.     # 设置状态窗口的物品
  160.     @status_window.item = @buy_window.item
  161.     # 按下 B 键的情况下
  162.     if Input.trigger?(Input::B)
  163.       # 演奏取消 SE
  164.       $game_system.se_play($data_system.cancel_se)
  165.       # 窗口状态转向初期模式
  166.       @command_window.active = true
  167.       @dummy_window.visible = true
  168.       @buy_window.active = false
  169.       @buy_window.visible = false
  170.       @status_window.visible = false
  171.       @status_window.item = nil
  172.       # 删除帮助文本
  173.       @help_window.set_text("")
  174.       return
  175.     end
  176.     # 按下 C 键的情况下
  177.     if Input.trigger?(Input::C)
  178.       # 获取物品
  179.       @item = @buy_window.item
  180.       # 物品无效的情况下、或者价格在所持金以上的情况下
  181.       if @item == nil or @item.price > $game_party.gold
  182.         # 演奏冻结 SE
  183.         $game_system.se_play($data_system.buzzer_se)
  184.         return
  185.       end        
  186.       # 获取物品所持数
  187.       case @item
  188.       when RPG::Item
  189.         number = $game_party.item_number(@item.id)
  190.       when RPG::Weapon
  191.         number = $game_party.weapon_number(@item.id)
  192.       when RPG::Armor
  193.         number = $game_party.armor_number(@item.id)
  194.       end
  195.       # 如果已经拥有了 99 个情况下
  196.       if number == 99
  197.         # 演奏冻结 SE
  198.         $game_system.se_play($data_system.buzzer_se)
  199.         return
  200.       end
  201.       # 演奏确定 SE
  202.       $game_system.se_play($data_system.decision_se)
  203.       # 计算可以最多购买的数量
  204.       max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  205.       max = [max, 99 - number].min
  206.       # 窗口状态转向数值输入模式
  207.       @buy_window.active = false
  208.       @buy_window.visible = false
  209.       @number_window.set(@item, max, @item.price)
  210.       @number_window.active = true
  211.       @number_window.visible = true
  212.     end
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 画面更新 (卖出窗口激活的情况下)
  216.   #--------------------------------------------------------------------------
  217.   def update_sell
  218.     # 按下 B 键的情况下
  219.     if Input.trigger?(Input::B)
  220.       # 演奏取消 SE
  221.       $game_system.se_play($data_system.cancel_se)
  222.       # 窗口状态转向初期模式
  223.       @command_window.active = true
  224.       @dummy_window.visible = true
  225.       @sell_window.active = false
  226.       @sell_window.visible = false
  227.       @status_window.item = nil
  228.       # 删除帮助文本
  229.       @help_window.set_text("")
  230.       return
  231.     end
  232.     # 按下 C 键的情况下
  233.     if Input.trigger?(Input::C)
  234.       # 获取物品
  235.       @item = @sell_window.item
  236.       # 设置状态窗口的物品
  237.       @status_window.item = @item
  238.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  239.       if @item == nil or @item.price == 0
  240.         # 演奏冻结 SE
  241.         $game_system.se_play($data_system.buzzer_se)
  242.         return
  243.       end
  244.       # 演奏确定 SE
  245.       $game_system.se_play($data_system.decision_se)
  246.       # 获取物品的所持数
  247.       case @item
  248.       when RPG::Item
  249.         number = $game_party.item_number(@item.id)
  250.       when RPG::Weapon
  251.         number = $game_party.weapon_number(@item.id)
  252.       when RPG::Armor
  253.         number = $game_party.armor_number(@item.id)
  254.       end
  255.       # 最大卖出个数 = 物品的所持数
  256.       max = number
  257.       # 窗口状态转向个数输入模式
  258.       @sell_window.active = false
  259.       @sell_window.visible = false
  260.       @number_window.set(@item, max, @item.price / 2)
  261.       @number_window.active = true
  262.       @number_window.visible = true
  263.       @status_window.visible = true
  264.     end
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 刷新画面 (个数输入窗口激活的情况下)
  268.   #--------------------------------------------------------------------------
  269.   def update_number
  270.     # 按下 B 键的情况下
  271.     if Input.trigger?(Input::B)
  272.       # 演奏取消 SE
  273.       $game_system.se_play($data_system.cancel_se)
  274.       # 设置个数输入窗口为不活动·非可视状态
  275.       @number_window.active = false
  276.       @number_window.visible = false
  277.       # 命令窗口光标位置分支
  278.       case @command_window.index
  279.       when 0  # 购买
  280.         # 窗口状态转向购买模式
  281.         @buy_window.active = true
  282.         @buy_window.visible = true
  283.       when 1  # 卖出
  284.         # 窗口状态转向卖出模式
  285.         @sell_window.active = true
  286.         @sell_window.visible = true
  287.         @status_window.visible = false
  288.       end
  289.       return
  290.     end
  291.     # 按下 C 键的情况下
  292.     if Input.trigger?(Input::C)
  293.       # 演奏商店 SE
  294.       $game_system.se_play($data_system.shop_se)
  295.       # 设置个数输入窗口为不活动·非可视状态
  296.       @number_window.active = false
  297.       @number_window.visible = false
  298.       # 命令窗口光标位置分支
  299.       case @command_window.index
  300.       when 0  # 购买
  301.         # 购买处理
  302.         $game_party.lose_gold(@number_window.number * @item.price)
  303.         case @item
  304.         when RPG::Item
  305.           $game_party.gain_item(@item.id, @number_window.number)
  306.         when RPG::Weapon
  307.           $game_party.gain_weapon(@item.id, @number_window.number)
  308.         when RPG::Armor
  309.           $game_party.gain_armor(@item.id, @number_window.number)
  310.         end
  311.         # 刷新各窗口
  312.         @gold_window.refresh
  313.         @buy_window.refresh
  314.         @status_window.refresh
  315.         # 窗口状态转向购买模式
  316.         @buy_window.active = true
  317.         @buy_window.visible = true
  318.       when 1  # 卖出
  319.         # 卖出处理
  320.         $game_party.gain_gold(@number_window.number * (@item.price / 2))
  321.         case @item
  322.         when RPG::Item
  323.           $game_party.lose_item(@item.id, @number_window.number)
  324.         when RPG::Weapon
  325.           $game_party.lose_weapon(@item.id, @number_window.number)
  326.         when RPG::Armor
  327.           $game_party.lose_armor(@item.id, @number_window.number)
  328.         end
  329.         # 刷新各窗口
  330.         @gold_window.refresh
  331.         @sell_window.refresh
  332.         @status_window.refresh
  333.         # 窗口状态转向卖出模式
  334.         @sell_window.active = true
  335.         @sell_window.visible = true
  336.         @status_window.visible = false
  337.       end
  338.       return
  339.     end
  340.   end
  341. end
复制代码
  1. #==============================================================================
  2. # ■ Scene_Gameover
  3. #------------------------------------------------------------------------------
  4. #  处理游戏结束画面的类。
  5. #==============================================================================

  6. class Scene_Gameover
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 停止 BGM、BGS
  12.     $game_system.bgm_play(nil)
  13.     $game_system.bgs_play(nil)
  14.     # 演奏游戏结束 ME
  15.     $game_system.me_play($data_system.gameover_me)
  16.     # 准备过渡
  17.     Graphics.freeze
  18.     # 生成游戏结束图形
  19.     @sprite2 = Sprite.new
  20.     @sprite2.z = 9577
  21.     @sprite2.bitmap = RPG::Cache.gameover($data_system.gameover_name+"_2")
  22.     # 执行过渡
  23.     Graphics.transition(60)
  24.     # 准备过渡
  25.     Graphics.freeze
  26.     # 释放游戏结束图形
  27.     @sprite2.bitmap.dispose
  28.     # 执行过度
  29.     Graphics.transition(60)
  30.     # 准备过渡
  31.     Graphics.freeze
  32.     # 生成游戏结束图形
  33.     @sprite = Sprite.new
  34.     @sprite.z = 9576
  35.     @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
  36.     # 执行过渡
  37.     Graphics.transition(120)
  38.     # 主循环
  39.     loop do
  40.       # 刷新游戏画面
  41.       Graphics.update
  42.       # 刷新输入信息
  43.       Input.update
  44.       # 刷新画面情报
  45.       update
  46.       # 如果画面被切换的话就中断循环
  47.       if $scene != self
  48.         break
  49.       end
  50.     end
  51.     # 准备过渡
  52.     Graphics.freeze
  53.     # 释放游戏结束图形
  54.     @sprite.bitmap.dispose
  55.     @sprite.dispose
  56.     @sprite2.dispose
  57.     # 执行过度
  58.     Graphics.transition(40)
  59.     # 准备过渡
  60.     Graphics.freeze
  61.     # 战斗测试的情况下
  62.     if $BTEST
  63.       $scene = nil
  64.     end
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 刷新画面
  68.   #--------------------------------------------------------------------------
  69.   def update
  70.     # 按下 C 键的情况下
  71.     if Input.trigger?(Input::C)
  72.       # 切换到标题画面
  73.       $scene = Scene_Title.new
  74.     end
  75.   end
  76. end
复制代码

以上就是我改过的全部Scene_XXXXX了
作者: TERENCE    时间: 2008-4-17 04:56
这里唯一需要检查到的脚本只有这个

  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #==============================================================================
  5. # ■ Harts_Window_EquipTitle
  6. #==============================================================================
  7. class Harts_Window_EquipTitle < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初期化
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 160, 64)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.contents.clear
  15.     self.contents.font.color = normal_color
  16.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.equip, 1)
  17.   end
  18. end

  19. #==============================================================================
  20. # ■ Harts_Window_EquipCommand
  21. #==============================================================================

  22. class Harts_Window_EquipCommand < Window_Selectable
  23.   #--------------------------------------------------------------------------
  24.   # ● 初期化
  25.   #--------------------------------------------------------------------------
  26.   def initialize
  27.     super(160, 0, 480, 64)
  28.     self.contents = Bitmap.new(width - 32, height - 32)
  29.     @item_max = 3
  30.     @column_max = 3
  31.     @commands = ["手动装备", "自动装备", "结束"]
  32.     refresh
  33.     self.index = 0
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新
  37.   #--------------------------------------------------------------------------
  38.   def refresh
  39.     self.contents.clear
  40.     for i in 0...@item_max
  41.     draw_item(i, normal_color)
  42.     end
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 項目描画
  46.   # index : 項目番号
  47.   # color : 文字色
  48.   #--------------------------------------------------------------------------
  49.   def draw_item(index, color)
  50.     self.contents.font.color = color
  51.     x = index * 160 + 4
  52.     self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
  53.   end
  54. end

  55. #==============================================================================
  56. # ■ Harts_Window_EquipItem
  57. #==============================================================================

  58. class Harts_Window_EquipItem < Window_Selectable
  59.   #--------------------------------------------------------------------------
  60.   # ● 初期化
  61.   # actor : 角色
  62.   # equip_type : 装備部位 (0~3)
  63.   #--------------------------------------------------------------------------
  64.   def initialize(actor, equip_type)
  65.     super(272, 256, 368, 160)
  66.     @actor = actor
  67.     @equip_type = equip_type
  68.     @column_max = 1
  69.     refresh
  70.     self.active = false
  71.     self.index = -1
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 物品取得
  75.   #--------------------------------------------------------------------------
  76.   def item
  77.     return @data[self.index]
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 最強id取得
  81.   #--------------------------------------------------------------------------
  82.   def max_item_id
  83.     if @equip_type == 0
  84.       if @actor.weapon_id == 0
  85.         max = 0
  86.       else
  87.         max = $data_weapons[@actor.weapon_id].atk
  88.       end
  89.     elsif @equip_type == 1
  90.       if @actor.armor1_id == 0
  91.         max = 0
  92.       else
  93.         max = $data_armors[@actor.armor1_id].pdef
  94.       end
  95.     elsif @equip_type == 2
  96.       if @actor.armor2_id == 0
  97.         max = 0
  98.       else
  99.         max = $data_armors[@actor.armor2_id].pdef
  100.       end
  101.     elsif @equip_type == 3
  102.       if @actor.armor3_id == 0
  103.         max = 0
  104.       else
  105.         max = $data_armors[@actor.armor3_id].pdef
  106.       end
  107.     end
  108.     for i in [email protected]
  109.       if @equip_type == 0
  110.         if max <= $data_weapons[@data[i].id].atk
  111.           max = $data_weapons[@data[i].id].atk
  112.           item_id = @data[i].id
  113.         end
  114.       elsif @equip_type >= 1
  115.         if max <= $data_armors[@data[i].id].pdef
  116.           max = $data_armors[@data[i].id].pdef
  117.           item_id = @data[i].id
  118.         end
  119.       end
  120.     end
  121.     return item_id
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新
  125.   #--------------------------------------------------------------------------
  126.   def refresh
  127.     if self.contents != nil
  128.       self.contents.dispose
  129.       self.contents = nil
  130.     end
  131.     @data = []
  132.     # 装備可能的武器追加
  133.     if @equip_type == 0
  134.       weapon_set = $data_classes[@actor.class_id].weapon_set
  135.       for i in 1...$data_weapons.size
  136.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  137.           @data.push($data_weapons[i])
  138.         end
  139.       end
  140.     end
  141.     # 装備可能的防具追加
  142.     if @equip_type >= 1
  143.       armor_set = $data_classes[@actor.class_id].armor_set
  144.       for i in 1...$data_armors.size
  145.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  146.           if $data_armors[i].kind == @equip_type-1
  147.             @data.push($data_armors[i])
  148.           end
  149.         end
  150.       end
  151.     end
  152.     # 空白追加
  153.     @data.push(nil)
  154.     # 全項目描画
  155.     @item_max = @data.size
  156.     self.contents = Bitmap.new(width - 32, row_max * 32)
  157.     for i in 0...@item_max-1
  158.       draw_item(i)
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 項目描画
  163.   # index : 項目编号
  164.   #--------------------------------------------------------------------------
  165.   def draw_item(index)
  166.     item = @data[index]
  167.     x = 4
  168.     y = index * 32
  169.     case item
  170.     when RPG::Weapon
  171.       number = $game_party.weapon_number(item.id)
  172.     when RPG::Armor
  173.       number = $game_party.armor_number(item.id)
  174.     end
  175.     bitmap = RPG::Cache.icon(item.icon_name)
  176.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  177.     self.contents.font.color = normal_color
  178.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  179.     self.contents.draw_text(x + 280, y, 16, 32, ":", 1)
  180.     self.contents.draw_text(x + 296, y, 24, 32, number.to_s, 2)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 帮助更新
  184.   #--------------------------------------------------------------------------
  185.   def update_help
  186.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  187.   end
  188. end

  189. #==============================================================================
  190. # ■ Harts_Window_EquipLeft
  191. #==============================================================================

  192. class Harts_Window_EquipLeft < Window_Base
  193.   #--------------------------------------------------------------------------
  194.   # ● 初期化
  195.   # actor : 角色
  196.   #--------------------------------------------------------------------------
  197.   def initialize(actor)
  198.     super(0, 64, 272, 352)
  199.     self.contents = Bitmap.new(width - 32, height - 32)
  200.     @actor = actor
  201.     refresh
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● リフレッシュ
  205.   #--------------------------------------------------------------------------
  206.   def refresh
  207.     self.contents.clear
  208.     draw_actor_graphic(@actor, 32, 64)
  209.     draw_actor_name(@actor, 4 + 96, 0)
  210.     draw_actor_level(@actor, 4 + 96, 32)
  211.     draw_actor_parameter(@actor, 4, 80, 0)
  212.     draw_actor_parameter(@actor, 4, 112, 1)
  213.     draw_actor_parameter(@actor, 4, 144, 2)
  214.     draw_actor_parameter(@actor, 4, 192, 3)
  215.     draw_actor_parameter(@actor, 4, 224, 4)
  216.     draw_actor_parameter(@actor, 4, 256, 5)
  217.     draw_actor_parameter(@actor, 4, 288, 6)
  218.     if @new_atk != nil and @new_atk != @actor.atk
  219.       if @new_atk > @actor.atk
  220.         self.contents.font.color = system_color
  221.       else
  222.         self.contents.font.color = disabled_color
  223.       end
  224.       self.contents.draw_text(160, 80, 40, 32, "→", 1)
  225.       self.contents.draw_text(200, 80, 36, 32, @new_atk.to_s, 2)
  226.     end
  227.     if @new_pdef != nil and @new_pdef != @actor.pdef
  228.       if @new_pdef > @actor.pdef
  229.         self.contents.font.color = system_color
  230.       else
  231.         self.contents.font.color = disabled_color
  232.       end
  233.       self.contents.draw_text(160, 112, 40, 32, "→", 1)
  234.       self.contents.draw_text(200, 112, 36, 32, @new_pdef.to_s, 2)
  235.     end
  236.     if @new_mdef != nil and @new_mdef != @actor.mdef
  237.       if @new_mdef > @actor.mdef
  238.         self.contents.font.color = system_color
  239.       else
  240.         self.contents.font.color = disabled_color
  241.       end
  242.       self.contents.draw_text(160, 144, 40, 32, "→", 1)
  243.       self.contents.draw_text(200, 144, 36, 32, @new_mdef.to_s, 2)
  244.     end
  245.     if @new_str != nil and @new_str != @actor.str
  246.       if @new_str > @actor.str
  247.         self.contents.font.color = system_color
  248.       else
  249.         self.contents.font.color = disabled_color
  250.       end
  251.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  252.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  253.     end
  254.     if @new_dex != nil and @new_dex != @actor.dex
  255.       if @new_dex > @actor.dex
  256.         self.contents.font.color = system_color
  257.       else
  258.         self.contents.font.color = disabled_color
  259.       end
  260.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  261.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  262.     end
  263.     if @new_agi != nil and @new_agi != @actor.agi
  264.       if @new_agi > @actor.agi
  265.         self.contents.font.color = system_color
  266.       else
  267.         self.contents.font.color = disabled_color
  268.       end
  269.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  270.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  271.     end
  272.     if @new_int != nil and @new_int != @actor.int
  273.       if @new_int > @actor.int
  274.         self.contents.font.color = system_color
  275.       else
  276.         self.contents.font.color = disabled_color
  277.       end
  278.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  279.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  280.     end
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 装備変更後設定
  284.   # new_atk : 装備変更後攻撃力
  285.   # new_pdef : 装備変更後物理防御
  286.   # new_mdef : 装備変更後魔法防御
  287.   #--------------------------------------------------------------------------
  288.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
  289.     if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
  290.       @new_atk = new_atk
  291.       @new_pdef = new_pdef
  292.       @new_mdef = new_mdef
  293.       @new_str = new_str
  294.       @new_dex = new_dex
  295.       @new_agi = new_agi
  296.       @new_int = new_int
  297.       refresh
  298.     end
  299.   end
  300. end

  301. #==============================================================================
  302. # ■ Harts_Scene_Equip
  303. #==============================================================================

  304. class Scene_Equip
  305.   include OPACITY_66RPG
  306.   #--------------------------------------------------------------------------
  307.   # ● 初期化
  308.   # actor_index : 角色编号
  309.   # equip_index : 装備编号
  310.   #--------------------------------------------------------------------------
  311.   def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
  312.     @actor_index = actor_index
  313.     @equip_index = equip_index
  314.     @command_index = command_index
  315.     @equip_active = equip_active
  316.     @command_active = command_active
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 主处理
  320.   #--------------------------------------------------------------------------
  321.   def main
  322.     create_screen
  323.     @actor = $game_party.actors[@actor_index]
  324.     @title_window = Harts_Window_EquipTitle.new
  325.     @command_window = Harts_Window_EquipCommand.new
  326.     @help_window = Window_Help.new
  327.     @help_window.y = 416
  328.     @left_window = Harts_Window_EquipLeft.new(@actor)
  329.     @right_window = Window_EquipRight.new(@actor)
  330.     @item_window0 = Harts_Window_EquipItem.new(@actor, -1)
  331.     @item_window1 = Harts_Window_EquipItem.new(@actor, 0)
  332.     @item_window2 = Harts_Window_EquipItem.new(@actor, 1)
  333.     @item_window3 = Harts_Window_EquipItem.new(@actor, 2)
  334.     @item_window4 = Harts_Window_EquipItem.new(@actor, 3)
  335.     @item_window5 = Harts_Window_EquipItem.new(@actor, 4)
  336.     @right_window.help_window = @help_window
  337.     @item_window0.help_window = @help_window
  338.     @item_window1.help_window = @help_window
  339.     @item_window2.help_window = @help_window
  340.     @item_window3.help_window = @help_window
  341.     @item_window4.help_window = @help_window
  342.     @item_window5.help_window = @help_window
  343.     @command_window.index = @command_index
  344.     @right_window.index = @equip_index
  345.     @command_window.active = @command_active
  346.     @right_window.active = @equip_active
  347.     testname = @actor.battler_name+"_h.png"
  348.     if FileTest.exist?("Graphics/battlers/#{testname}")
  349.       sp = Sprite.new
  350.       sp.bitmap=Bitmap.new("Graphics/battlers/#{testname}")
  351.       sp.opacity = 120
  352.     end   
  353.     refresh
  354.     Graphics.transition
  355.     loop do
  356.       Graphics.update
  357.       Input.update
  358.       update
  359.       if $scene != self
  360.         break
  361.       end
  362.     end
  363.     # トランジション準備
  364.     Graphics.freeze
  365.     # ウィンドウを解放
  366.     @title_window.dispose
  367.     @command_window.dispose
  368.     @help_window.dispose
  369.     @left_window.dispose
  370.     @right_window.dispose
  371.     @item_window0.dispose
  372.     @item_window1.dispose
  373.     @item_window2.dispose
  374.     @item_window3.dispose
  375.     @item_window4.dispose
  376.     @item_window5.dispose
  377.     dispose_screen
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 刷新
  381.   #--------------------------------------------------------------------------
  382.   def refresh
  383.     @item_window0.visible = (@right_window.index == -1)
  384.     @item_window1.visible = (@right_window.index == 0)
  385.     @item_window2.visible = (@right_window.index == 1)
  386.     @item_window3.visible = (@right_window.index == 2)
  387.     @item_window4.visible = (@right_window.index == 3)
  388.     @item_window5.visible = (@right_window.index == 4)
  389.     item1 = @right_window.item
  390.     case @right_window.index
  391.     when -1
  392.       @item_window = @item_window0
  393.     when 0
  394.       @item_window = @item_window1
  395.     when 1
  396.       @item_window = @item_window2
  397.     when 2
  398.       @item_window = @item_window3
  399.     when 3
  400.       @item_window = @item_window4
  401.     when 4
  402.       @item_window = @item_window5
  403.     end
  404.     if @right_window.active
  405.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
  406.     end
  407.     if @item_window.active
  408.       item2 = @item_window.item
  409.       last_hp = @actor.hp
  410.       last_sp = @actor.sp
  411.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  412.       new_atk = @actor.atk
  413.       new_pdef = @actor.pdef
  414.       new_mdef = @actor.mdef
  415.       new_str = @actor.str
  416.       new_dex = @actor.dex
  417.       new_agi = @actor.agi
  418.       new_int = @actor.int
  419.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  420.       @actor.hp = last_hp
  421.       @actor.sp = last_sp
  422.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
  423.     end
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 更新
  427.   #--------------------------------------------------------------------------
  428.   def update
  429.     @title_window.update
  430.     @command_window.update
  431.     @left_window.update
  432.     @right_window.update
  433.     @item_window.update
  434.     refresh
  435.     if @command_window.active
  436.       update_command
  437.       return
  438.     end
  439.     if @right_window.active
  440.       update_right
  441.       return
  442.     end
  443.     if @item_window.active
  444.       update_item
  445.       return
  446.     end
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● 更新
  450.   #--------------------------------------------------------------------------
  451.   def update_command
  452.     # 按下B的场合
  453.     if Input.trigger?(Input::B)
  454.       # 音效演奏
  455.       $game_system.se_play($data_system.cancel_se)
  456.       # 画面切换
  457.       $scene = Scene_Menu.new(2)
  458.       return
  459.     end
  460.     # 按下C的场合
  461.     if Input.trigger?(Input::C)
  462.       case @command_window.index
  463.       # 装備的場合
  464.       when 0
  465.         # 音效演奏
  466.         $game_system.se_play($data_system.decision_se)
  467.         @right_window.active = true
  468.         @command_window.active = false
  469.         @right_window.index = 0
  470.         @command_window.index = -1
  471.         return
  472.         # 最強装備的場合 
  473.       when 1
  474.         # 音效演奏
  475.         $game_system.se_play($data_system.equip_se)
  476.         # 最強装備的取得
  477.         max_weapon_id = @item_window1.max_item_id
  478.         max_armor1_id = @item_window2.max_item_id
  479.         max_armor2_id = @item_window3.max_item_id
  480.         max_armor3_id = @item_window4.max_item_id
  481.         # 最強装備执行
  482.         @actor.equip(0, max_weapon_id)
  483.         @actor.equip(1, max_armor1_id)
  484.         @actor.equip(2, max_armor2_id)
  485.         @actor.equip(3, max_armor3_id)
  486.         @right_window.refresh
  487.         @left_window.refresh
  488.         @item_window1.refresh
  489.         @item_window2.refresh
  490.         @item_window3.refresh
  491.         @item_window4.refresh
  492.         return
  493.       when 2
  494.         # 音效演奏
  495.         $game_system.se_play($data_system.cancel_se)
  496.         # 画面切换
  497.         $scene = Scene_Menu.new(2)
  498.         return
  499.       end
  500.     end
  501.     # 按下R的场合
  502.     if Input.trigger?(Input::R)
  503.       # 音效演奏
  504.       $game_system.se_play($data_system.cursor_se)
  505.       @actor_index += 1
  506.       @actor_index %= $game_party.actors.size
  507.       # 画面切换
  508.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  509.       return
  510.     end
  511.     # 按下L的场合
  512.     if Input.trigger?(Input::L)
  513.       # 音效演奏
  514.       $game_system.se_play($data_system.cursor_se)
  515.       @actor_index += $game_party.actors.size - 1
  516.       @actor_index %= $game_party.actors.size
  517.         # 画面切换
  518.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  519.       return
  520.     end
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● 更新右边窗口
  524.   #--------------------------------------------------------------------------
  525.   def update_right
  526.     # 按下B的场合
  527.     if Input.trigger?(Input::B)
  528.       # 音效演奏
  529.       $game_system.se_play($data_system.cancel_se)
  530.       @right_window.active = false
  531.       @command_window.active = true
  532.       @right_window.index = -1
  533.       @command_window.index = 0
  534.       return
  535.     end
  536.     # 按下C的场合
  537.     if Input.trigger?(Input::C)
  538.       # 装備固定时
  539.       if @actor.equip_fix?(@right_window.index)
  540.         # 音效演奏
  541.         $game_system.se_play($data_system.buzzer_se)
  542.         return
  543.       end
  544.       # 音效演奏
  545.       $game_system.se_play($data_system.decision_se)
  546.       @right_window.active = false
  547.       @item_window.active = true
  548.       @item_window.index = 0
  549.       return
  550.     end
  551.     # 按下R的场合
  552.     if Input.trigger?(Input::R)
  553.       # 音效演奏
  554.       $game_system.se_play($data_system.cursor_se)
  555.       @actor_index += 1
  556.       @actor_index %= $game_party.actors.size
  557.       # 画面切换
  558.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  559.       return
  560.     end
  561.     # 按下L的场合
  562.     if Input.trigger?(Input::L)
  563.       # 音效演奏
  564.       $game_system.se_play($data_system.cursor_se)
  565.       @actor_index += $game_party.actors.size - 1
  566.       @actor_index %= $game_party.actors.size
  567.       # 画面切换
  568.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  569.       return
  570.     end
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● 更新物品
  574.   #--------------------------------------------------------------------------
  575.   def update_item
  576.     # 按下B的场合
  577.     if Input.trigger?(Input::B)
  578.       # 音效演奏
  579.       $game_system.se_play($data_system.cancel_se)
  580.       @right_window.active = true
  581.       @item_window.active = false
  582.       @item_window.index = -1
  583.       return
  584.     end
  585.     # 按下C的场合
  586.     if Input.trigger?(Input::C)
  587.       # 音效演奏
  588.       $game_system.se_play($data_system.equip_se)
  589.       item = @item_window.item
  590.       # 装備変更
  591.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  592.       @right_window.active = true
  593.       @item_window.active = false
  594.       @item_window.index = -1
  595.       # 刷新
  596.       @right_window.refresh
  597.       @item_window.refresh
  598.       return
  599.     end
  600.   end
  601. end
复制代码

禾西所提出.dispose的问题,
但我检查好像没有问题,
不知道哪里错了{/pz}

LZ可能要等等了!!
.........
SORRY幫不上忙!!另请高人去~~~
禾西很强....等明天禾西来再问好了...
作者: lxmstc    时间: 2008-5-10 06:03
把LS说的有问题的脚本换回原始的脚本可还是不行啊?好心人帮忙解释下啊!到底哪个脚本是控制这方面的啊?
作者: lxmstc    时间: 2008-5-10 06:55
已经解决了,抱歉给大家添麻烦了




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1