设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2276|回复: 3
打印 上一主题 下一主题

[已经解决] 品分类脚本和新增装备脚本怎么整合

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
556 小时
注册时间
2010-11-18
帖子
774
跳转到指定楼层
1
发表于 2015-9-18 00:00:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
5星屑
本帖最后由 s196050 于 2015-9-18 00:02 编辑

物品分类脚本 和这个新增装备脚本怎么整合,或者 如何调用新增的“项链”“鞋子”今日物品分类

或者 165~176行应该怎么写
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #------------------------------------------------------------------------------
  7. #  アイテム画面で、タイトルを表示するウィンドウ。
  8. #==============================================================================
  9. class Harts_Window_ItemTitle < Window_Base
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(0, 0, 160, 64)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.contents.clear
  17.     self.contents.font.color = normal_color
  18.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  19.   end
  20. end
  21. #==============================================================================
  22. # ■ Harts_Window_ItemCommand
  23. #------------------------------------------------------------------------------
  24. #  アイテムの種別選択を行うウィンドウです。
  25. #==============================================================================
  26. class Harts_Window_ItemCommand < Window_Selectable
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 64, 160, 360)
  32.     self.contents = Bitmap.new(width - 32, height - 32)
  33.     @item_max = 10
  34.     @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, "戒指", "项链","鞋","特殊道具"]
  35.     refresh
  36.     self.index = 0
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● リフレッシュ
  40.   #--------------------------------------------------------------------------
  41.   def refresh
  42.     self.contents.clear
  43.     for i in 0...@item_max
  44.     draw_item(i, normal_color)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 項目の描画
  49.   # index : 項目番号
  50.   # color : 文字色
  51.   #--------------------------------------------------------------------------
  52.   def draw_item(index, color)
  53.     self.contents.font.color = color
  54.     y = index * 32
  55.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● ヘルプテキスト更新
  59.   #--------------------------------------------------------------------------
  60.   def update_help
  61.     case self.index
  62.     when 0
  63.       @text = @commands[0]
  64.     when 1
  65.       @text = @commands[1]
  66.     when 2
  67.       @text = @commands[2]
  68.     when 3
  69.       @text = @commands[3]
  70.     when 4
  71.       @text = @commands[4]
  72.     when 5
  73.       @text = @commands[5]
  74.     when 6
  75.       @text = @commands[6]
  76.     when 7
  77.       @text = @commands[7]
  78.     when 8
  79.       @text = @commands[8]
  80.     when 9
  81.       @text = @commands[9]  
  82.     end
  83.     @help_window.set_text(@text)
  84.   end
  85. end
  86. #==============================================================================
  87. # ■ Window_Item
  88. #------------------------------------------------------------------------------
  89. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  90. #==============================================================================
  91. class Harts_Window_ItemList < Window_Selectable
  92.   #--------------------------------------------------------------------------
  93.   # ● オブジェクト初期化
  94.   #--------------------------------------------------------------------------
  95.   def initialize
  96.     super(160, 0, 480, 416)
  97.     refresh
  98.     self.index = 0
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● アイテムの取得
  102.   #--------------------------------------------------------------------------
  103.   def item
  104.     return @data[self.index]
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● リフレッシュ
  108.   #--------------------------------------------------------------------------
  109.   def refresh
  110.     if self.contents != nil
  111.       self.contents.dispose
  112.       self.contents = nil
  113.     end
  114.     @data = []
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● アイテム一覧設定
  118.   # command : 選択中のコマンド
  119.   #--------------------------------------------------------------------------
  120.   def set_item(command)
  121.     refresh
  122.     case command
  123.     when 0
  124.       for i in 1...$data_items.size
  125.         if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
  126.           @data.push($data_items[i])
  127.         end
  128.       end
  129.     when 1
  130.       for i in 1...$data_items.size
  131.         if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
  132.           @data.push($data_items[i])
  133.         end
  134.       end
  135.     when 2
  136.       for i in 1...$data_weapons.size
  137.         if $game_party.weapon_number(i) > 0
  138.           @data.push($data_weapons[i])
  139.         end
  140.       end
  141.     when 3
  142.       for i in 1...$data_armors.size
  143.         if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
  144.           @data.push($data_armors[i])
  145.         end
  146.       end
  147.     when 4
  148.       for i in 1...$data_armors.size
  149.         if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
  150.           @data.push($data_armors[i])
  151.         end
  152.       end
  153.     when 5
  154.       for i in 1...$data_armors.size
  155.         if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
  156.           @data.push($data_armors[i])
  157.         end
  158.       end
  159.     when 6
  160.       for i in 1...$data_armors.size
  161.         if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
  162.           @data.push($data_armors[i])
  163.         end
  164.       end
  165.    # when 7
  166.       #for i in 1...$data_items.size
  167.         #if $data_armors[i].kind == 4 and $game_party.armor_number(id)  > 0
  168.           #@data.push($data_armors[i])
  169.         #end
  170.       #end
  171.     #when 8
  172.       #for i in 1...$data_items.size
  173.         #if $data_armors[i].kind == 5 and $game_party.armor_number(id)  > 0
  174.           #@data.push($data_armors[i])
  175.         #end
  176.       #end
  177.     when 9
  178.       for i in 1...$data_items.size
  179.         if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
  180.           @data.push($data_items[i])
  181.         end
  182.       end   
  183.     end
  184.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  185.     @item_max = @data.size
  186.     if @item_max > 0
  187.       self.contents = Bitmap.new(width - 32, row_max * 32)
  188.       self.contents.clear
  189.       for i in 0...@item_max
  190.         draw_item(i)
  191.       end
  192.     end
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● 種類別アイテム数の取得
  196.   #--------------------------------------------------------------------------
  197.   def item_number
  198.     return @item_max
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 項目の描画
  202.   # index : 項目番号
  203.   #--------------------------------------------------------------------------
  204.   def draw_item(index)
  205.     item = @data[index]
  206.     case item
  207.     when RPG::Item
  208.       number = $game_party.item_number(item.id)
  209.     when RPG::Weapon
  210.       number = $game_party.weapon_number(item.id)
  211.     when RPG::Armor
  212.       number = $game_party.armor_number(item.id)
  213.     end
  214.     if item.is_a?(RPG::Item) and
  215.       $game_party.item_can_use?(item.id)
  216.       self.contents.font.color = normal_color
  217.     else
  218.       self.contents.font.color = disabled_color
  219.     end
  220.     x = 4
  221.     y = index * 32
  222.     bitmap = RPG::Cache.icon(item.icon_name)
  223.     opacity = self.contents.font.color == normal_color ? 255 : 128
  224.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  225.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  226.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  227.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● ヘルプテキスト更新
  231.   #--------------------------------------------------------------------------
  232.   def update_help
  233.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  234.   end
  235. end
  236. #==============================================================================
  237. # ■ Harts_Scene_Item
  238. #------------------------------------------------------------------------------
  239. #  アイテム画面の処理を行うクラスです。再定義
  240. #==============================================================================
  241. class Scene_Item
  242.   #--------------------------------------------------------------------------
  243.   # ● メイン処理
  244.   #--------------------------------------------------------------------------
  245.   def main
  246.     # タイトルウィンドウを作成
  247.     @itemtitle_window = Harts_Window_ItemTitle.new
  248.     #コマンドウィンドウを作成
  249.     @itemcommand_window = Harts_Window_ItemCommand.new
  250.     @command_index = @itemcommand_window.index
  251.     #アイテムウィンドウを作成
  252.     @itemlist_window = Harts_Window_ItemList.new
  253.     @itemlist_window.active = false
  254.     #ヘルプウィンドウを作成
  255.     @help_window = Window_Help.new
  256.     @help_window.x = 0
  257.     @help_window.y = 416
  258.     # ヘルプウィンドウを関連付け
  259.     @itemcommand_window.help_window = @help_window
  260.     @itemlist_window.help_window = @help_window
  261.     # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
  262.     @target_window = Window_Target.new
  263.     @target_window.visible = false
  264.     @target_window.active = false
  265.     # アイテムウィンドウ内容表示
  266.     @itemlist_window.set_item(@command_index)
  267.     # トランジション実行
  268.     Graphics.transition
  269.     # メインループ
  270.     loop do
  271.       # ゲーム画面を更新
  272.       Graphics.update
  273.       # 入力情報を更新
  274.       Input.update
  275.       # フレーム更新
  276.       update
  277.       # 画面が切り替わったらループを中断
  278.       if $scene != self
  279.         break
  280.       end
  281.     end
  282.     # トランジション準備
  283.     Graphics.freeze
  284.     # ウィンドウを解放
  285.     @itemtitle_window.dispose
  286.     @itemcommand_window.dispose
  287.     @itemlist_window.dispose
  288.     @help_window.dispose
  289.     @target_window.dispose
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● フレーム更新
  293.   #--------------------------------------------------------------------------
  294.   def update
  295.     # ウィンドウを更新
  296.     @itemtitle_window.update
  297.     @itemcommand_window.update
  298.     @itemlist_window.update
  299.     @help_window.update
  300.     @target_window.update
  301.     if @command_index != @itemcommand_window.index
  302.       @command_index = @itemcommand_window.index
  303.       @itemlist_window.set_item(@command_index)
  304.     end
  305.     # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
  306.     if @itemcommand_window.active
  307.       update_itemcommand
  308.       return
  309.     end
  310.     # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
  311.     if @itemlist_window.active
  312.       update_itemlist
  313.       return
  314.     end
  315.     # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
  316.     if @target_window.active
  317.       update_target
  318.       return
  319.     end
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  323.   #--------------------------------------------------------------------------
  324.   def update_itemcommand
  325.   # B ボタンが押された場合
  326.   if Input.trigger?(Input::B)
  327.   # キャンセル SE を演奏
  328.   $game_system.se_play($data_system.cancel_se)
  329.   # メニュー画面に切り替え
  330.   $scene = Scene_Menu.new(0)
  331.   return
  332.   end
  333.   # C ボタンが押された場合
  334.   if Input.trigger?(Input::C)
  335.   # 選択中のコマンドのアイテムがない場合
  336.   if @itemlist_window.item_number == 0
  337.   # ブザー SE を演奏
  338.   $game_system.se_play($data_system.buzzer_se)
  339.   return
  340.   end
  341.   # 決定 SE を演奏
  342.   $game_system.se_play($data_system.decision_se)
  343.   # アイテムウィンドウをアクティブにする
  344.   @itemcommand_window.active = false
  345.   @itemlist_window.active = true
  346.   @itemlist_window.index = 0
  347.   return
  348.   end
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  352.   #--------------------------------------------------------------------------
  353.   def update_itemlist
  354.     # B ボタンが押された場合
  355.     if Input.trigger?(Input::B)
  356.       # キャンセル SE を演奏
  357.       $game_system.se_play($data_system.cancel_se)
  358.       # アイテムウィンドウをアクティブにする
  359.       @itemcommand_window.active = true
  360.       @itemlist_window.active = false
  361.       @itemlist_window.index = 0
  362.       @itemcommand_window.index = @command_index
  363.       return
  364.     end
  365.     # C ボタンが押された場合
  366.     if Input.trigger?(Input::C)
  367.       # アイテムウィンドウで現在選択されているデータを取得
  368.       @item = @itemlist_window.item
  369.       # 使用アイテムではない場合
  370.       unless @item.is_a?(RPG::Item)
  371.         # ブザー SE を演奏
  372.         $game_system.se_play($data_system.buzzer_se)
  373.         return
  374.       end
  375.       # 使用できない場合
  376.       unless $game_party.item_can_use?(@item.id)
  377.         # ブザー SE を演奏
  378.         $game_system.se_play($data_system.buzzer_se)
  379.         return
  380.       end
  381.       # 決定 SE を演奏
  382.       $game_system.se_play($data_system.decision_se)
  383.       # 効果範囲が味方の場合
  384.       if @item.scope >= 3
  385.         # ターゲットウィンドウをアクティブ化
  386.         @itemlist_window.active = false
  387.         @target_window.x = 304
  388.         @target_window.visible = true
  389.         @target_window.active = true
  390.         # 効果範囲 (単体/全体) に応じてカーソル位置を設定
  391.         if @item.scope == 4 || @item.scope == 6
  392.           @target_window.index = -1
  393.         else
  394.           @target_window.index = 0
  395.         end
  396.         # 効果範囲が味方以外の場合
  397.       else
  398.         # コモンイベント ID が有効の場合
  399.         if @item.common_event_id > 0
  400.           # コモンイベント呼び出し予約
  401.           $game_temp.common_event_id = @item.common_event_id
  402.           # アイテムの使用時 SE を演奏
  403.           $game_system.se_play(@item.menu_se)
  404.           # 消耗品の場合
  405.             if @item.consumable
  406.               # 使用したアイテムを 1 減らす
  407.               $game_party.lose_item(@item.id, 1)
  408.               # アイテムウィンドウの項目を再描画
  409.               @itemlist_window.draw_item(@itemlist_window.index)
  410.             end
  411.           # マップ画面に切り替え
  412.           $scene = Scene_Map.new
  413.           return
  414.         end
  415.       end
  416.       return
  417.     end
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  421.   #--------------------------------------------------------------------------
  422.   def update_target
  423.     # B ボタンが押された場合
  424.     if Input.trigger?(Input::B)
  425.       # キャンセル SE を演奏
  426.       $game_system.se_play($data_system.cancel_se)
  427.       # アイテム切れなどで使用できなくなった場合
  428.       unless $game_party.item_can_use?(@item.id)
  429.         # アイテムウィンドウの内容を再作成
  430.         @itemlist_window.refresh
  431.       end
  432.       # ターゲットウィンドウを消去
  433.       @itemlist_window.active = true
  434.       @target_window.visible = false
  435.       @target_window.active = false
  436.       @itemlist_window.set_item(@command_index)
  437.       return
  438.     end
  439.     # C ボタンが押された場合
  440.     if Input.trigger?(Input::C)
  441.       # アイテムを使い切った場合
  442.       if $game_party.item_number(@item.id) == 0
  443.         # ブザー SE を演奏
  444.         $game_system.se_play($data_system.buzzer_se)
  445.         return
  446.       end
  447.       # ターゲットが全体の場合
  448.       if @target_window.index == -1
  449.         # パーティ全体にアイテムの使用効果を適用
  450.         used = false
  451.         for i in $game_party.actors
  452.           used |= i.item_effect(@item)
  453.         end
  454.       end
  455.       # ターゲットが単体の場合
  456.       if @target_window.index >= 0
  457.         # ターゲットのアクターにアイテムの使用効果を適用
  458.         target = $game_party.actors[@target_window.index]
  459.         used = target.item_effect(@item)
  460.       end
  461.       # アイテムを使った場合
  462.       if used
  463.         # アイテムの使用時 SE を演奏
  464.         $game_system.se_play(@item.menu_se)
  465.         # 消耗品の場合
  466.         if @item.consumable
  467.           # 使用したアイテムを 1 減らす
  468.           $game_party.lose_item(@item.id, 1)
  469.           # アイテムウィンドウの項目を再描画
  470.           @itemlist_window.draw_item(@itemlist_window.index)
  471.           @itemlist_window.set_item(@command_index)
  472.         end
  473.         # ターゲットウィンドウの内容を再作成
  474.         @target_window.refresh
  475.         # 全滅の場合
  476.         if $game_party.all_dead?
  477.           # ゲームオーバー画面に切り替え
  478.           $scene = Scene_Gameover.new
  479.           return
  480.         end
  481.         # コモンイベント ID が有効の場合
  482.         if @item.common_event_id > 0
  483.           # コモンイベント呼び出し予約
  484.           $game_temp.common_event_id = @item.common_event_id
  485.           # マップ画面に切り替え
  486.           $scene = Scene_Map.new
  487.           return
  488.         end
  489.       end
  490.       # アイテムを使わなかった場合
  491.       unless used
  492.         # ブザー SE を演奏
  493.         $game_system.se_play($data_system.buzzer_se)
  494.       end
  495.     return
  496.     end
  497.   end
  498. end
  499. #==============================================================================
  500. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  501. #==============================================================================


新增装备脚本

RUBY 代码复制
  1. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #                                防具类追加
  4. #
  5. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6. module RPG
  7.   class Armor
  8.     def name
  9.       name = @name.split(/,/)[0]
  10.       return name != nil ? name : ''
  11.     end
  12.     def kind
  13.       kind  = @name.split(/,/)[1]
  14.       return kind  != nil ? kind.to_i : @kind
  15.     end
  16.   end
  17. end
  18. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  19. #
  20. #                  Game_Actor添加新的防具ID,并对相关方法修正
  21. #
  22. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  23. class Game_Actor < Game_Battler
  24.   attr_reader   :armor5_id                # 项链 ID
  25.   attr_reader   :armor6_id                # 鞋 ID
  26.   #--------------------------------------------------------------------------
  27.   # ● 设置
  28.   #     actor_id : 角色 ID
  29.   #--------------------------------------------------------------------------
  30.   alias old_setup setup
  31.   def setup(actor_id)
  32.     old_setup(actor_id)
  33.     @armor5_id = 0
  34.     @armor6_id = 0
  35.     update_auto_state(nil, $data_armors[@armor5_id])
  36.     update_auto_state(nil, $data_armors[@armor6_id])
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 取得属性修正值
  40.   #     element_id : 属性 ID
  41.   #--------------------------------------------------------------------------
  42.   def element_rate(element_id)
  43.     # 获取对应属性有效度的数值
  44.     table = [0,200,150,100,50,0,-100]
  45.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  46.     # 防具能防御本属性的情况下效果减半
  47.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  48.       armor = $data_armors[i]
  49.       if armor != nil and armor.guard_element_set.include?(element_id)
  50.         result /= 2
  51.       end
  52.     end
  53.     # 状态能防御本属性的情况下效果减半
  54.     for i in @states
  55.       if $data_states[i].guard_element_set.include?(element_id)
  56.         result /= 2
  57.       end
  58.     end
  59.     # 过程结束
  60.     return result
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 判定防御属性
  64.   #     state_id : 属性 ID
  65.   #--------------------------------------------------------------------------
  66.   def state_guard?(state_id)
  67.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  68.       armor = $data_armors[i]
  69.       if armor != nil
  70.         if armor.guard_state_set.include?(state_id)
  71.           return true
  72.         end
  73.       end
  74.     end
  75.     return false
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 获取基本力量
  79.   #--------------------------------------------------------------------------
  80.   def base_str
  81.     n = $data_actors[@actor_id].parameters[2, @level]
  82.     weapon = $data_weapons[@weapon_id]
  83.     armor1 = $data_armors[@armor1_id]
  84.     armor2 = $data_armors[@armor2_id]
  85.     armor3 = $data_armors[@armor3_id]
  86.     armor4 = $data_armors[@armor4_id]
  87.     armor5 = $data_armors[@armor5_id]
  88.     armor6 = $data_armors[@armor6_id]
  89.     n += weapon != nil ? weapon.str_plus : 0
  90.     n += armor1 != nil ? armor1.str_plus : 0
  91.     n += armor2 != nil ? armor2.str_plus : 0
  92.     n += armor3 != nil ? armor3.str_plus : 0
  93.     n += armor4 != nil ? armor4.str_plus : 0
  94.     n += armor5 != nil ? armor5.str_plus : 0
  95.     n += armor6 != nil ? armor6.str_plus : 0
  96.     return [[n, 1].max, 999].min
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 获取基本灵巧
  100.   #--------------------------------------------------------------------------
  101.   def base_dex
  102.     n = $data_actors[@actor_id].parameters[3, @level]
  103.     weapon = $data_weapons[@weapon_id]
  104.     armor1 = $data_armors[@armor1_id]
  105.     armor2 = $data_armors[@armor2_id]
  106.     armor3 = $data_armors[@armor3_id]
  107.     armor4 = $data_armors[@armor4_id]
  108.     armor5 = $data_armors[@armor5_id]
  109.     armor6 = $data_armors[@armor6_id]
  110.     n += weapon != nil ? weapon.dex_plus : 0
  111.     n += armor1 != nil ? armor1.dex_plus : 0
  112.     n += armor2 != nil ? armor2.dex_plus : 0
  113.     n += armor3 != nil ? armor3.dex_plus : 0
  114.     n += armor4 != nil ? armor4.dex_plus : 0
  115.     n += armor5 != nil ? armor5.dex_plus : 0
  116.     n += armor6 != nil ? armor6.dex_plus : 0
  117.     return [[n, 1].max, 999].min
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 获取基本速度
  121.   #--------------------------------------------------------------------------
  122.   def base_agi
  123.     n = $data_actors[@actor_id].parameters[4, @level]
  124.     weapon = $data_weapons[@weapon_id]
  125.     armor1 = $data_armors[@armor1_id]
  126.     armor2 = $data_armors[@armor2_id]
  127.     armor3 = $data_armors[@armor3_id]
  128.     armor4 = $data_armors[@armor4_id]
  129.     armor5 = $data_armors[@armor5_id]
  130.     armor6 = $data_armors[@armor6_id]
  131.     n += weapon != nil ? weapon.agi_plus : 0
  132.     n += armor1 != nil ? armor1.agi_plus : 0
  133.     n += armor2 != nil ? armor2.agi_plus : 0
  134.     n += armor3 != nil ? armor3.agi_plus : 0
  135.     n += armor4 != nil ? armor4.agi_plus : 0
  136.     n += armor5 != nil ? armor5.agi_plus : 0
  137.     n += armor6 != nil ? armor6.agi_plus : 0
  138.     return [[n, 1].max, 999].min
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 获取基本魔力
  142.   #--------------------------------------------------------------------------
  143.   def base_int
  144.     n = $data_actors[@actor_id].parameters[5, @level]
  145.     weapon = $data_weapons[@weapon_id]
  146.     armor1 = $data_armors[@armor1_id]
  147.     armor2 = $data_armors[@armor2_id]
  148.     armor3 = $data_armors[@armor3_id]
  149.     armor4 = $data_armors[@armor4_id]
  150.     armor5 = $data_armors[@armor5_id]
  151.     armor6 = $data_armors[@armor6_id]
  152.     n += weapon != nil ? weapon.int_plus : 0
  153.     n += armor1 != nil ? armor1.int_plus : 0
  154.     n += armor2 != nil ? armor2.int_plus : 0
  155.     n += armor3 != nil ? armor3.int_plus : 0
  156.     n += armor4 != nil ? armor4.int_plus : 0
  157.     n += armor5 != nil ? armor5.int_plus : 0
  158.     n += armor6 != nil ? armor6.int_plus : 0
  159.     return [[n, 1].max, 999].min
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 获取基本物理防御
  163.   #--------------------------------------------------------------------------
  164.   def base_pdef
  165.     weapon = $data_weapons[@weapon_id]
  166.     armor1 = $data_armors[@armor1_id]
  167.     armor2 = $data_armors[@armor2_id]
  168.     armor3 = $data_armors[@armor3_id]
  169.     armor4 = $data_armors[@armor4_id]
  170.     armor5 = $data_armors[@armor5_id]
  171.     armor6 = $data_armors[@armor6_id]
  172.     pdef1 = weapon != nil ? weapon.pdef : 0
  173.     pdef2 = armor1 != nil ? armor1.pdef : 0
  174.     pdef3 = armor2 != nil ? armor2.pdef : 0
  175.     pdef4 = armor3 != nil ? armor3.pdef : 0
  176.     pdef5 = armor4 != nil ? armor4.pdef : 0
  177.     pdef6 = armor5 != nil ? armor5.pdef : 0
  178.     pdef7 = armor6 != nil ? armor6.pdef : 0
  179.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + dex*0.33
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 获取基本魔法防御
  183.   #--------------------------------------------------------------------------
  184.   def base_mdef
  185.     weapon = $data_weapons[@weapon_id]
  186.     armor1 = $data_armors[@armor1_id]
  187.     armor2 = $data_armors[@armor2_id]
  188.     armor3 = $data_armors[@armor3_id]
  189.     armor4 = $data_armors[@armor4_id]
  190.     armor5 = $data_armors[@armor5_id]
  191.     armor6 = $data_armors[@armor6_id]
  192.     mdef1 = weapon != nil ? weapon.mdef : 0
  193.     mdef2 = armor1 != nil ? armor1.mdef : 0
  194.     mdef3 = armor2 != nil ? armor2.mdef : 0
  195.     mdef4 = armor3 != nil ? armor3.mdef : 0
  196.     mdef5 = armor4 != nil ? armor4.mdef : 0
  197.     mdef6 = armor5 != nil ? armor5.mdef : 0
  198.     mdef7 = armor6 != nil ? armor6.mdef : 0
  199.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + int*0.33
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 获取基本回避修正
  203.   #--------------------------------------------------------------------------
  204.   def base_eva
  205.     armor1 = $data_armors[@armor1_id]
  206.     armor2 = $data_armors[@armor2_id]
  207.     armor3 = $data_armors[@armor3_id]
  208.     armor4 = $data_armors[@armor4_id]
  209.     armor5 = $data_armors[@armor5_id]
  210.     armor6 = $data_armors[@armor6_id]
  211.     eva1 = armor1 != nil ? armor1.eva : 0
  212.     eva2 = armor2 != nil ? armor2.eva : 0
  213.     eva3 = armor3 != nil ? armor3.eva : 0
  214.     eva4 = armor4 != nil ? armor4.eva : 0
  215.     eva5 = armor5 != nil ? armor5.eva : 0
  216.     eva6 = armor6 != nil ? armor6.eva : 0
  217.     return eva1 + eva2 + eva3 + eva4 + eva5 + eva6
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 装备固定判定
  221.   #     equip_type : 装备类型
  222.   #--------------------------------------------------------------------------
  223.   def equip_fix?(equip_type)
  224.     case equip_type
  225.     when 0  # 武器
  226.       return $data_actors[@actor_id].weapon_fix
  227.     when 1  # 盾
  228.       return $data_actors[@actor_id].armor1_fix
  229.     when 2  # 头
  230.       return $data_actors[@actor_id].armor2_fix
  231.     when 3  # 身体
  232.       return $data_actors[@actor_id].armor3_fix
  233.     when 4  # 装饰品
  234.       return $data_actors[@actor_id].armor4_fix
  235.     end
  236.     return false
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 变更装备
  240.   #     equip_type : 装备类型
  241.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  242.   #--------------------------------------------------------------------------
  243.   def equip(equip_type, id)
  244.     case equip_type
  245.     when 0  # 武器
  246.       if id == 0 or $game_party.weapon_number(id) > 0
  247.         $game_party.gain_weapon(@weapon_id, 1)
  248.         @weapon_id = id
  249.         $game_party.lose_weapon(id, 1)
  250.       end
  251.     when 1  # 盾
  252.       if id == 0 or $game_party.armor_number(id) > 0
  253.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  254.         $game_party.gain_armor(@armor1_id, 1)
  255.         @armor1_id = id
  256.         $game_party.lose_armor(id, 1)
  257.       end
  258.     when 2  # 头
  259.       if id == 0 or $game_party.armor_number(id) > 0
  260.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  261.         $game_party.gain_armor(@armor2_id, 1)
  262.         @armor2_id = id
  263.         $game_party.lose_armor(id, 1)
  264.       end
  265.     when 3  # 身体
  266.       if id == 0 or $game_party.armor_number(id) > 0
  267.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  268.         $game_party.gain_armor(@armor3_id, 1)
  269.         @armor3_id = id
  270.         $game_party.lose_armor(id, 1)
  271.       end
  272.     when 4  # 装饰品
  273.       if id == 0 or $game_party.armor_number(id) > 0
  274.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  275.         $game_party.gain_armor(@armor4_id, 1)
  276.         @armor4_id = id
  277.         $game_party.lose_armor(id, 1)
  278.       end
  279.     when 5  # 项链
  280.       if id == 0 or $game_party.armor_number(id) > 0
  281.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  282.         $game_party.gain_armor(@armor5_id, 1)
  283.         @armor5_id = id
  284.         $game_party.lose_armor(id, 1)
  285.       end
  286.     when 6  # 鞋
  287.       if id == 0 or $game_party.armor_number(id) > 0
  288.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  289.         $game_party.gain_armor(@armor6_id, 1)
  290.         @armor6_id = id
  291.         $game_party.lose_armor(id, 1)
  292.       end
  293.     end
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● 更改职业 ID
  297.   #     class_id : 新的职业 ID
  298.   #--------------------------------------------------------------------------
  299.   def class_id=(class_id)
  300.     if $data_classes[class_id] != nil
  301.       @class_id = class_id
  302.       # 避开无法装备的物品
  303.       unless equippable?($data_weapons[@weapon_id])
  304.         equip(0, 0)
  305.       end
  306.       unless equippable?($data_armors[@armor1_id])
  307.         equip(1, 0)
  308.       end
  309.       unless equippable?($data_armors[@armor2_id])
  310.         equip(2, 0)
  311.       end
  312.       unless equippable?($data_armors[@armor3_id])
  313.         equip(3, 0)
  314.       end
  315.       unless equippable?($data_armors[@armor4_id])
  316.         equip(4, 0)
  317.       end
  318.       unless equippable?($data_armors[@armor5_id])
  319.         equip(5, 0)
  320.       end
  321.       unless equippable?($data_armors[@armor6_id])
  322.         equip(6, 0)
  323.       end
  324.     end
  325.   end
  326. end
  327. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  328. #
  329. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  330. #
  331. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  332. #==============================================================================
  333. # ■ Window_Base
  334. #------------------------------------------------------------------------------
  335. #  游戏中全部窗口的超级类。
  336. #==============================================================================
  337.  
  338. class Window_Base < Window
  339.   ################## 属性增减颜色 ##############################
  340.   def up_color
  341.     return Color.new(0, 255, 0)
  342.   end
  343.   def down_color
  344.     return Color.new(255, 0, 0)
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 描绘能力值
  348.   #     actor : 角色
  349.   #     x     : 描画目标 X 坐标
  350.   #     y     : 描画目标 Y 坐标
  351.   #     type  : 能力值种类 (0~6)
  352.   #--------------------------------------------------------------------------
  353.   def draw_actor_parameter(actor, x, y, type)
  354.     case type
  355.     when 0
  356.       parameter_name = $data_system.words.atk
  357.       parameter_value = actor.atk
  358.     when 1
  359.       parameter_name = $data_system.words.pdef
  360.       parameter_value = actor.pdef
  361.     when 2
  362.       parameter_name = $data_system.words.mdef
  363.       parameter_value = actor.mdef
  364.     when 3
  365.       parameter_name = $data_system.words.str
  366.       parameter_value = actor.str
  367.     when 4
  368.       parameter_name = $data_system.words.dex
  369.       parameter_value = actor.dex
  370.     when 5
  371.       parameter_name = $data_system.words.agi
  372.       parameter_value = actor.agi
  373.     when 6
  374.       parameter_name = $data_system.words.int
  375.       parameter_value = actor.int
  376.     when 7
  377.       parameter_name = "回避"
  378.       parameter_value = actor.eva
  379.     end
  380.     self.contents.font.color = system_color
  381.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  382.     self.contents.font.color = normal_color
  383.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  384.   end
  385. end
  386. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  387. #
  388. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  389. #
  390. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  391. #==============================================================================
  392. # ■ Window_EquipRight
  393. #------------------------------------------------------------------------------
  394. #  装备画面、显示角色现在装备的物品的窗口。
  395. #==============================================================================
  396.  
  397. class Window_EquipRight < Window_Selectable
  398.   #--------------------------------------------------------------------------
  399.   # ● 初始化对像
  400.   #     actor : 角色
  401.   #--------------------------------------------------------------------------
  402.   def initialize(actor)
  403.     super(272, 64, 368, 256)
  404.     self.contents = Bitmap.new(width - 32, height - 32)
  405.     @actor = actor
  406.     refresh
  407.     self.index = 0
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 刷新
  411.   #--------------------------------------------------------------------------
  412.   def refresh
  413.     self.contents.clear
  414.     @data = []
  415.     @data.push($data_weapons[@actor.weapon_id])
  416.     @data.push($data_armors[@actor.armor1_id])
  417.     @data.push($data_armors[@actor.armor2_id])
  418.     @data.push($data_armors[@actor.armor3_id])
  419.     @data.push($data_armors[@actor.armor4_id])
  420.     @data.push($data_armors[@actor.armor5_id])
  421.     @data.push($data_armors[@actor.armor6_id])
  422.     @item_max = @data.size
  423.     self.contents.font.color = system_color
  424.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  425.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  426.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  427.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  428.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  429.     self.contents.draw_text(4, 32 * 5, 92, 32, "项链")
  430.     self.contents.draw_text(4, 32 * 6, 92, 32, "鞋")
  431.     draw_item_name(@data[0], 92, 32 * 0)
  432.     draw_item_name(@data[1], 92, 32 * 1)
  433.     draw_item_name(@data[2], 92, 32 * 2)
  434.     draw_item_name(@data[3], 92, 32 * 3)
  435.     draw_item_name(@data[4], 92, 32 * 4)
  436.     draw_item_name(@data[5], 92, 32 * 5)
  437.     draw_item_name(@data[6], 92, 32 * 6)
  438.   end
  439. end
  440.  
  441. #==============================================================================
  442. # ■ Window_EquipLeft
  443. #------------------------------------------------------------------------------
  444. #  装备画面的、显示角色能力值变化的窗口。
  445. #==============================================================================
  446.  
  447. class Window_EquipLeft < Window_Base
  448.   #--------------------------------------------------------------------------
  449.   # ● 初始化对像
  450.   #     actor : 角色
  451.   #--------------------------------------------------------------------------
  452.   def initialize(actor)
  453.     super(0, 64, 272, 416)
  454.     self.contents = Bitmap.new(width - 32, height - 32)
  455.     @actor = actor
  456.     refresh
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 刷新
  460.   #--------------------------------------------------------------------------
  461.   def refresh
  462.     self.contents.clear
  463.     draw_actor_name(@actor, 4, 0)
  464.     draw_actor_level(@actor, 4, 32)
  465.  
  466.     draw_actor_parameter(@actor, 4, 64, 0)
  467.     draw_actor_parameter(@actor, 4, 96, 1)
  468.     draw_actor_parameter(@actor, 4, 128, 2)
  469.     draw_actor_parameter(@actor, 4, 160, 7)
  470.     draw_actor_parameter(@actor, 4, 192, 3)
  471.     draw_actor_parameter(@actor, 4, 224, 4)
  472.     draw_actor_parameter(@actor, 4, 256, 5)
  473.     draw_actor_parameter(@actor, 4, 288, 6)
  474.     if @new_atk != nil
  475.       self.contents.font.color = system_color
  476.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  477.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  478.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  479.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  480.     end
  481.     if @new_pdef != nil
  482.       self.contents.font.color = system_color
  483.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  484.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  485.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  486.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  487.     end
  488.     if @new_mdef != nil
  489.       self.contents.font.color = system_color
  490.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  491.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  492.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  493.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  494.     end
  495.     if @new_eva != nil
  496.       self.contents.font.color = system_color
  497.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  498.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  499.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  500.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  501.     end
  502.     if @new_str != nil
  503.       self.contents.font.color = system_color
  504.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  505.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  506.       self.contents.font.color = normal_color if @new_str == @actor.str
  507.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  508.     end
  509.     if @new_dex != nil
  510.       self.contents.font.color = system_color
  511.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  512.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  513.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  514.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  515.     end
  516.     if @new_agi != nil
  517.       self.contents.font.color = system_color
  518.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  519.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  520.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  521.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  522.     end
  523.     if @new_int != nil
  524.       self.contents.font.color = system_color
  525.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  526.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  527.       self.contents.font.color = normal_color if @new_int == @actor.int
  528.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  529.     end
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ● 变更装备后的能力值设置
  533.   #     new_atk  : 变更装备后的攻击力
  534.   #     new_pdef : 变更装备后的物理防御
  535.   #     new_mdef : 变更装备后的魔法防御
  536.   #--------------------------------------------------------------------------
  537.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  538.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  539.       @new_atk = new_atk
  540.       @new_pdef = new_pdef
  541.       @new_mdef = new_mdef
  542.       @new_eva = new_eva
  543.       @new_str = new_str
  544.       @new_dex = new_dex
  545.       @new_agi = new_agi
  546.       @new_int = new_int
  547.       refresh
  548.     end
  549.   end
  550. end
  551. #==============================================================================
  552. # ■ Window_EquipItem
  553. #------------------------------------------------------------------------------
  554. #  装备画面、显示浏览变更装备的候补物品的窗口。
  555. #==============================================================================
  556.  
  557. class Window_EquipItem < Window_Selectable
  558.   #--------------------------------------------------------------------------
  559.   # ● 初始化对像
  560.   #     actor      : 角色
  561.   #     equip_type : 装备部位 (0~3)
  562.   #--------------------------------------------------------------------------
  563.   def initialize(actor, equip_type)
  564.     super(272, 320, 368, 160)
  565.     @actor = actor
  566.     @equip_type = equip_type
  567.     @column_max = 1
  568.     refresh
  569.     self.active = false
  570.     self.index = -1
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● 项目的描绘
  574.   #     index : 项目符号
  575.   #--------------------------------------------------------------------------
  576.   def draw_item(index)
  577.     item = @data[index]
  578.     x = 4
  579.     y = index * 32
  580.     case item
  581.     when RPG::Weapon
  582.       number = $game_party.weapon_number(item.id)
  583.     when RPG::Armor
  584.       number = $game_party.armor_number(item.id)
  585.     end
  586.     bitmap = RPG::Cache.icon(item.icon_name)
  587.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  588.     self.contents.font.color = normal_color
  589.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  590.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  591.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  592.   end
  593. end
  594.  
  595. class Scene_Equip
  596.   #--------------------------------------------------------------------------
  597.   # ● 主处理
  598.   #--------------------------------------------------------------------------
  599.   def main
  600.     # 获取角色
  601.     @actor = $game_party.actors[@actor_index]
  602.     # 生成窗口
  603.     @help_window = Window_Help.new
  604.     @left_window = Window_EquipLeft.new(@actor)
  605.     @right_window = Window_EquipRight.new(@actor)
  606.     @item_window1 = Window_EquipItem.new(@actor, 0)
  607.     @item_window2 = Window_EquipItem.new(@actor, 1)
  608.     @item_window3 = Window_EquipItem.new(@actor, 2)
  609.     @item_window4 = Window_EquipItem.new(@actor, 3)
  610.     @item_window5 = Window_EquipItem.new(@actor, 4)
  611.     @item_window6 = Window_EquipItem.new(@actor, 5)
  612.     @item_window7 = Window_EquipItem.new(@actor, 6)
  613.     # 关联帮助窗口
  614.     @right_window.help_window = @help_window
  615.     @item_window1.help_window = @help_window
  616.     @item_window2.help_window = @help_window
  617.     @item_window3.help_window = @help_window
  618.     @item_window4.help_window = @help_window
  619.     @item_window5.help_window = @help_window
  620.     @item_window6.help_window = @help_window
  621.     @item_window7.help_window = @help_window
  622.     # 设置光标位置
  623.     @right_window.index = @equip_index
  624.     refresh
  625.     # 执行过渡
  626.     Graphics.transition
  627.     # 主循环
  628.     loop do
  629.       # 刷新游戏画面
  630.       Graphics.update
  631.       # 刷新输入信息
  632.       Input.update
  633.       # 刷新画面
  634.       update
  635.       # 如果画面切换的话的就中断循环
  636.       if $scene != self
  637.         break
  638.       end
  639.     end
  640.     # 准备过渡
  641.     Graphics.freeze
  642.     # 释放窗口
  643.     @help_window.dispose
  644.     @left_window.dispose
  645.     @right_window.dispose
  646.     @item_window1.dispose
  647.     @item_window2.dispose
  648.     @item_window3.dispose
  649.     @item_window4.dispose
  650.     @item_window5.dispose
  651.     @item_window6.dispose
  652.     @item_window7.dispose
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ● 刷新
  656.   #--------------------------------------------------------------------------
  657.   def refresh
  658.     # 设置物品窗口的可视状态
  659.     @item_window1.visible = (@right_window.index == 0)
  660.     @item_window2.visible = (@right_window.index == 1)
  661.     @item_window3.visible = (@right_window.index == 2)
  662.     @item_window4.visible = (@right_window.index == 3)
  663.     @item_window5.visible = (@right_window.index == 4)
  664.     @item_window6.visible = (@right_window.index == 5)
  665.     @item_window7.visible = (@right_window.index == 6)
  666.     # 获取当前装备中的物品
  667.     item1 = @right_window.item
  668.     # 设置当前的物品窗口到 @item_window
  669.     case @right_window.index
  670.     when 0
  671.       @item_window = @item_window1
  672.     when 1
  673.       @item_window = @item_window2
  674.     when 2
  675.       @item_window = @item_window3
  676.     when 3
  677.       @item_window = @item_window4
  678.     when 4
  679.       @item_window = @item_window5
  680.     when 5
  681.       @item_window = @item_window6
  682.     when 6
  683.       @item_window = @item_window7
  684.     end
  685.     # 右窗口被激活的情况下
  686.     if @right_window.active
  687.       # 删除变更装备后的能力
  688.     ###############################################################
  689.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  690.     end
  691.     # 物品窗口被激活的情况下
  692.     if @item_window.active
  693.       # 获取现在选中的物品
  694.       item2 = @item_window.item
  695.       # 变更装备
  696.       last_hp = @actor.hp
  697.       last_sp = @actor.sp
  698.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  699.     ###############################################################
  700.       # 获取变更装备后的能力值
  701.       new_atk = @actor.atk
  702.       new_pdef = @actor.pdef
  703.       new_mdef = @actor.mdef
  704.       new_eva = @actor.eva
  705.       new_str = @actor.str
  706.       new_dex = @actor.dex
  707.       new_agi = @actor.agi
  708.       new_int = @actor.int
  709.       # 返回到装备
  710.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  711.       @actor.hp = last_hp
  712.       @actor.sp = last_sp
  713.       # 描画左窗口
  714.     ###############################################################
  715.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  716.     ###############################################################
  717.     end
  718.   end
  719. end
  720. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  721. #
  722. #              状态窗口美化,全防具装备栏描绘
  723. #
  724. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  725. #==============================================================================
  726. # ■ Window_Status
  727. #------------------------------------------------------------------------------
  728. #  显示状态画面、完全规格的状态窗口。
  729. #==============================================================================
  730.  
  731. class Window_Status < Window_Base
  732.   #--------------------------------------------------------------------------
  733.   # ● 刷新
  734.   #--------------------------------------------------------------------------
  735.   def refresh
  736.     self.contents.clear
  737.     draw_actor_graphic(@actor, 40, 112)
  738.     draw_actor_name(@actor, 4, 0)
  739.     draw_actor_class(@actor, 4 + 144, 0)
  740.     draw_actor_level(@actor, 96, 32)
  741.     draw_actor_state(@actor, 96, 64)
  742.     draw_actor_hp(@actor, 96, 112, 172)
  743.     draw_actor_sp(@actor, 96, 144, 172)
  744.     draw_actor_parameter(@actor, 96, 192, 0)
  745.     draw_actor_parameter(@actor, 96, 224, 1)
  746.     draw_actor_parameter(@actor, 96, 256, 2)
  747.     draw_actor_parameter(@actor, 96, 304, 3)
  748.     draw_actor_parameter(@actor, 96, 336, 4)
  749.     draw_actor_parameter(@actor, 96, 368, 5)
  750.     draw_actor_parameter(@actor, 96, 400, 6)
  751.     self.contents.font.color = system_color
  752.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  753.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  754.     self.contents.font.color = normal_color
  755.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  756.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  757.     self.contents.font.color = system_color
  758.     self.contents.draw_text(320, 160, 96, 32, "装备")
  759.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  760.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
  761.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
  762.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
  763.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
  764.     draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
  765.     draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
  766.   end
  767.   def dummy
  768.     self.contents.font.color = system_color
  769.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  770.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  771.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  772.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  773.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  774.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  775.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  776.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  777.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  778.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  779.   end
  780. end
  781. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  782. #
  783. #              商店购买窗口美化,增加对新装备位置的描述
  784. #
  785. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  786. #==============================================================================
  787. # ■ Window_ShopStatus
  788. #------------------------------------------------------------------------------
  789. #  商店画面、显示物品所持数与角色装备的窗口。
  790. #==============================================================================
  791.  
  792. class Window_ShopStatus < Window_Base
  793.   #--------------------------------------------------------------------------
  794.   # ● 刷新
  795.   #--------------------------------------------------------------------------
  796.   def refresh
  797.     self.contents.clear
  798.     if @item == nil
  799.       return
  800.     end
  801.     case @item
  802.     when RPG::Item
  803.       number = $game_party.item_number(@item.id)
  804.     when RPG::Weapon
  805.       number = $game_party.weapon_number(@item.id)
  806.     when RPG::Armor
  807.       number = $game_party.armor_number(@item.id)
  808.     end
  809.     self.contents.font.color = system_color
  810.     self.contents.draw_text(4, 0, 200, 32, "所持数")
  811.     self.contents.font.color = normal_color
  812.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  813.     if @item.is_a?(RPG::Item)
  814.       return
  815.     end
  816.     # 添加装备品信息
  817.     for i in 0...$game_party.actors.size
  818.       # 获取角色
  819.       actor = $game_party.actors[i]
  820.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  821.       if actor.equippable?(@item)
  822.         self.contents.font.color = normal_color
  823.       else
  824.         self.contents.font.color = disabled_color
  825.       end
  826.       # 描绘角色名字
  827.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  828.       # 获取当前的装备品
  829.       if @item.is_a?(RPG::Weapon)
  830.         item1 = $data_weapons[actor.weapon_id]
  831.       elsif @item.kind == 0
  832.         item1 = $data_armors[actor.armor1_id]
  833.       elsif @item.kind == 1
  834.         item1 = $data_armors[actor.armor2_id]
  835.       elsif @item.kind == 2
  836.         item1 = $data_armors[actor.armor3_id]
  837.       elsif @item.kind == 3
  838.         item1 = $data_armors[actor.armor4_id]
  839.       elsif @item.kind == 4
  840.         item1 = $data_armors[actor.armor5_id]
  841.       elsif @item.kind == 5
  842.         item1 = $data_armors[actor.armor6_id]
  843.       end
  844.       # 可以装备的情况
  845.       if actor.equippable?(@item)
  846.         # 武器的情况
  847.         if @item.is_a?(RPG::Weapon)
  848.           atk1 = item1 != nil ? item1.atk : 0
  849.           atk2 = @item != nil ? @item.atk : 0
  850.           change = atk2 - atk1
  851.         end
  852.         # 防具的情况
  853.         if @item.is_a?(RPG::Armor)
  854.           pdef1 = item1 != nil ? item1.pdef : 0
  855.           mdef1 = item1 != nil ? item1.mdef : 0
  856.           pdef2 = @item != nil ? @item.pdef : 0
  857.           mdef2 = @item != nil ? @item.mdef : 0
  858.           change = pdef2 - pdef1 + mdef2 - mdef1
  859.         end
  860.         # 描绘能力值变化
  861.         self.contents.draw_text(124, 64 + 64 * i, 112, 32,
  862.           sprintf("%+d", change), 2)
  863.       end
  864.       # 描绘物品
  865.       if item1 != nil
  866.         x = 4
  867.         y = 64 + 64 * i + 32
  868.         bitmap = RPG::Cache.icon(item1.icon_name)
  869.         opacity = self.contents.font.color == normal_color ? 255 : 128
  870.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  871.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  872.       end
  873.     end
  874.   end
  875. end

最佳答案

查看完整内容

165~176注释掉的when7和when8的那几行:

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

2
发表于 2015-9-18 00:00:41 | 只看该作者
本帖最后由 cinderelmini 于 2015-9-18 12:59 编辑

165~176注释掉的when7和when8的那几行:

  1.     when 7
  2.       for i in 1...$data_armors.size
  3.         if $data_armors[i].kind == 4 and $game_party.armor_number(i) > 0
  4.           @data.push($data_armors[i])
  5.         end
  6.       end
  7.     when 8
  8.       for i in 1...$data_armors.size
  9.         if $data_armors[i].kind == 5 and $game_party.armor_number(i) > 0
  10.           @data.push($data_armors[i])
  11.         end
  12.       end
复制代码

点评

弄了半天原来只是几个词写错的原因…………  发表于 2015-9-18 13:00
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
556 小时
注册时间
2010-11-18
帖子
774
3
 楼主| 发表于 2015-9-18 16:08:54 | 只看该作者
cinderelmini 发表于 2015-9-18 12:33
165~176注释掉的when7和when8的那几行:

晚上我回去试一试 下午有个婚宴
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
463
在线时间
193 小时
注册时间
2014-8-25
帖子
30
4
发表于 2015-9-26 11:40:11 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #可以自定义设置物品分类,利用物品描述,每个描述后面添加@物品分类即可。

  5. #==============================================================================
  6. # ■ Harts_Window_ItemTitle
  7. #==============================================================================

  8. class Harts_Window_ItemTitle < Window_Base
  9.   def initialize
  10.     super(0, 0, 160, 64)
  11.     self.contents = Bitmap.new(width - 32, height - 32)
  12.     self.contents.clear
  13.     self.contents.font.color = normal_color
  14.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  15.   end
  16. end

  17. #==============================================================================
  18. # ■ Harts_Window_ItemCommand
  19. #==============================================================================

  20. class Harts_Window_ItemCommand < Window_Selectable
  21.   attr_accessor :commands
  22.   #--------------------------------------------------------------------------
  23.   # ● 初始化,生成commands窗口
  24.   #--------------------------------------------------------------------------
  25.   def initialize
  26.     super(0, 64, 160, 352)
  27.     @commands = []
  28.     #————————生成commands窗口
  29.     for i in 1...$data_items.size
  30.       if $game_party.item_number(i) > 0
  31.         push = true
  32.         for com in @commands
  33.           if com == $data_items[i].desc
  34.             push = false
  35.           end
  36.         end
  37.         if push == true
  38.           @commands.push($data_items[i].desc)
  39.         end
  40.       end
  41.     end
  42.     for i in 1...$data_weapons.size
  43.       if $game_party.weapon_number(i) > 0
  44.         push = true
  45.         for com in @commands
  46.           if com == $data_weapons[i].desc
  47.             push = false
  48.           end
  49.         end
  50.         if push == true
  51.           @commands.push($data_weapons[i].desc)
  52.         end
  53.       end
  54.     end
  55.     for i in 1...$data_armors.size
  56.       if $game_party.armor_number(i) > 0
  57.         push = true
  58.         for com in @commands
  59.           if com == $data_armors[i].desc
  60.             push = false
  61.           end
  62.         end
  63.         if push == true
  64.           @commands.push($data_armors[i].desc)
  65.         end
  66.       end
  67.     end
  68.     if @commands == []
  69.       @commands.push("天材地宝")
  70.     end      
  71.     @item_max = @commands.size
  72.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  73.     refresh
  74.     self.index = 0
  75.    if $game_temp.in_battle
  76.      self.height = 288
  77.    end
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   #--------------------------------------------------------------------------
  81.   def refresh
  82.     self.contents.clear
  83.     for i in 0...@item_max
  84.       draw_item(i, normal_color)
  85.     end  
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   #--------------------------------------------------------------------------
  89.   def draw_item(index, color)
  90.     self.contents.font.color = color
  91.     y = index * 32
  92.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # 只描绘原文字
  96.   #--------------------------------------------------------------------------
  97.   def update_help
  98.     @help_window.set_text(@commands[self.index])
  99.   end
  100. end

  101. #==============================================================================
  102. # ■ Window_Item
  103. #==============================================================================

  104. class Harts_Window_ItemList < Window_Selectable
  105.   #--------------------------------------------------------------------------
  106.   #--------------------------------------------------------------------------
  107.   
  108. def initialize
  109.    super(160, 0, 480, 416)
  110.    self.opacity = 0
  111.    self.z = 999
  112.    refresh
  113.    self.index = 0
  114.    # 战斗中的情况下将窗口移至中央并将其半透明化
  115.    if $game_temp.in_battle
  116.      self.y = 64
  117.      self.height = 256
  118.      self.back_opacity = 160
  119.      self.opacity = 255
  120.    end
  121. end
  122.   #--------------------------------------------------------------------------
  123.   #--------------------------------------------------------------------------
  124.   def item
  125.     return @data[self.index]
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   #--------------------------------------------------------------------------
  129.   def refresh
  130.     if self.contents != nil
  131.       self.contents.dispose
  132.       self.contents = nil
  133.     end
  134.     @data = []
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   #--------------------------------------------------------------------------
  138.   def set_item(command)
  139.     refresh
  140.     for i in 1...$data_items.size
  141.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  142.         @data.push($data_items[i])
  143.       end
  144.     end
  145.     for i in 1...$data_weapons.size
  146.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  147.         @data.push($data_weapons[i])
  148.       end
  149.     end
  150.     for i in 1...$data_armors.size
  151.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  152.         @data.push($data_armors[i])
  153.       end
  154.     end
  155.     @item_max = @data.size
  156.     if @item_max > 0
  157.       self.contents = Bitmap.new(width - 32, row_max * 32)
  158.       self.contents.clear
  159.       for i in 0...@item_max
  160.         draw_item(i)
  161.       end
  162.     end
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   #--------------------------------------------------------------------------
  166.   def item_number
  167.     return @item_max
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   #--------------------------------------------------------------------------
  171.   def draw_item(index)
  172.     item = @data[index]
  173.     case item
  174.     when RPG::Item
  175.       number = $game_party.item_number(item.id)
  176.     when RPG::Weapon
  177.       number = $game_party.weapon_number(item.id)
  178.     when RPG::Armor
  179.       number = $game_party.armor_number(item.id)
  180.     end
  181.     if item.is_a?(RPG::Item) and
  182.       $game_party.item_can_use?(item.id)
  183.       self.contents.font.color = normal_color
  184.     else
  185.       self.contents.font.color = disabled_color
  186.     end
  187.     x = 4
  188.     y = index * 32
  189.     bitmap = RPG::Cache.icon(item.icon_name)
  190.     opacity = self.contents.font.color == normal_color ? 255 : 128
  191.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  192.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  193.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  194.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   #--------------------------------------------------------------------------
  198.   def update_help
  199.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  200.   end
  201. end

  202. #==============================================================================
  203. # ■ Harts_Scene_Item
  204. #==============================================================================

  205. class Scene_Item
  206.   #--------------------------------------------------------------------------
  207.   #--------------------------------------------------------------------------
  208.   def main
  209.     #添加背景图,不用则删
  210.     @backsp = Sprite.new
  211.     @backsp.bitmap = Bitmap.new("Graphics/Pictures/界面物品")
  212.     #
  213.     @itemtitle_window = Harts_Window_ItemTitle.new
  214.     @itemcommand_window = Harts_Window_ItemCommand.new
  215.     @command_index = @itemcommand_window.index
  216.     @itemlist_window = Harts_Window_ItemList.new
  217.     @itemlist_window.active = false
  218.     @help_window = Window_Help.new
  219.     @help_window.x = 0
  220.     @help_window.y = 416
  221.     @itemcommand_window.help_window = @help_window
  222.     @itemlist_window.help_window = @help_window
  223.     @target_window = Window_Target.new
  224.     @target_window.visible = false
  225.     @target_window.active = false
  226.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  227.     Graphics.transition
  228.     loop do
  229.       Graphics.update
  230.       Input.update
  231.       update
  232.       if $scene != self
  233.         break
  234.       end
  235.     end
  236.     Graphics.freeze
  237.      #添加背景图,不用则删
  238.     @backsp.dispose
  239.      #
  240.     @itemtitle_window.dispose
  241.     @itemcommand_window.dispose
  242.     @itemlist_window.dispose
  243.     @help_window.dispose
  244.     @target_window.dispose
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   #--------------------------------------------------------------------------
  248.   def update
  249.     @itemtitle_window.update
  250.     @itemcommand_window.update
  251.     @itemlist_window.update
  252.     @help_window.update
  253.     @target_window.update
  254.     if @command_index != @itemcommand_window.index
  255.       @command_index = @itemcommand_window.index
  256.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  257.     end
  258.     if @itemcommand_window.active
  259.       update_itemcommand
  260.       return
  261.     end
  262.     if @itemlist_window.active
  263.       update_itemlist
  264.       return
  265.     end
  266.     if @target_window.active
  267.       update_target
  268.       return
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   #--------------------------------------------------------------------------
  273.   def update_itemcommand
  274.     if Input.trigger?(Input::B)
  275.       $game_system.se_play($data_system.cancel_se)
  276.       $scene = Scene_Menu.new(0)
  277.       return
  278.     end
  279.     if Input.trigger?(Input::C)
  280.       if @itemlist_window.item_number == 0
  281.         $game_system.se_play($data_system.buzzer_se)
  282.         return
  283.       end
  284.       $game_system.se_play($data_system.decision_se)
  285.       @itemcommand_window.active = false
  286.       @itemlist_window.active = true
  287.       @itemlist_window.index = 0
  288.       return
  289.     end
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   #--------------------------------------------------------------------------
  293.   def update_itemlist
  294.     if Input.trigger?(Input::B)
  295.       $game_system.se_play($data_system.cancel_se)
  296.       @itemcommand_window.active = true
  297.       @itemlist_window.active = false
  298.       @itemlist_window.index = 0
  299.       @itemcommand_window.index = @command_index
  300.       return
  301.     end
  302.     if Input.trigger?(Input::C)
  303.       @item = @itemlist_window.item
  304.       unless @item.is_a?(RPG::Item)
  305.         $game_system.se_play($data_system.buzzer_se)
  306.         return
  307.       end
  308.       unless $game_party.item_can_use?(@item.id)
  309.         $game_system.se_play($data_system.buzzer_se)
  310.         return
  311.       end
  312.       $game_system.se_play($data_system.decision_se)
  313.       if @item.scope >= 3
  314.         @itemlist_window.active = false
  315.         @target_window.x = 304
  316.         @target_window.visible = true
  317.         @target_window.active = true
  318.         if @item.scope == 4 || @item.scope == 6
  319.           @target_window.index = -1
  320.         else
  321.           @target_window.index = 0
  322.         end
  323.       else
  324.         if @item.common_event_id > 0
  325.           $game_temp.common_event_id = @item.common_event_id
  326.           $game_system.se_play(@item.menu_se)
  327.             if @item.consumable
  328.               $game_party.lose_item(@item.id, 1)
  329.               @itemlist_window.draw_item(@itemlist_window.index)
  330.             end
  331.           $scene = Scene_Map.new
  332.           return
  333.         end
  334.       end
  335.       return
  336.     end
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   #--------------------------------------------------------------------------
  340.   def update_target
  341.     if Input.trigger?(Input::B)
  342.       $game_system.se_play($data_system.cancel_se)
  343.       unless $game_party.item_can_use?(@item.id)
  344.         @itemlist_window.refresh
  345.       end
  346.       @itemlist_window.active = true
  347.       @target_window.visible = false
  348.       @target_window.active = false
  349.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  350.       return
  351.     end
  352.     if Input.trigger?(Input::C)
  353.       if $game_party.item_number(@item.id) == 0
  354.         $game_system.se_play($data_system.buzzer_se)
  355.         return
  356.       end
  357.       if @target_window.index == -1
  358.         used = false
  359.         for i in $game_party.actors
  360.           used |= i.item_effect(@item)
  361.         end
  362.       end
  363.       if @target_window.index >= 0
  364.         target = $game_party.actors[@target_window.index]
  365.         used = target.item_effect(@item)
  366.       end
  367.       if used
  368.         $game_system.se_play(@item.menu_se)
  369.         if @item.consumable
  370.           $game_party.lose_item(@item.id, 1)
  371.           @itemlist_window.draw_item(@itemlist_window.index)
  372.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  373.         end
  374.         @target_window.refresh
  375.         if $game_party.all_dead?
  376.           $scene = Scene_Gameover.new
  377.           return
  378.         end
  379.         if @item.common_event_id > 0
  380.           $game_temp.common_event_id = @item.common_event_id
  381.           $scene = Scene_Map.new
  382.           return
  383.         end
  384.       end
  385.       unless used
  386.         $game_system.se_play($data_system.buzzer_se)
  387.       end
  388.     return
  389.     end
  390.   end
  391. end

  392. #==============================================================================
  393. # ■ RPG追加定义,使用@符号分类
  394. #==============================================================================

  395. module RPG
  396.   class Weapon
  397.     def description
  398.       description = @description.split(/@/)[0]
  399.       return description != nil ? description : ''
  400.     end
  401.     def desc
  402.       desc = @description.split(/@/)[1]
  403.       return desc != nil ? desc : "天材地宝"
  404.     end
  405.   end
  406.   class Item
  407.     def description
  408.       description = @description.split(/@/)[0]
  409.       return description != nil ? description : ''
  410.     end
  411.     def desc
  412.       desc = @description.split(/@/)[1]
  413.       return desc != nil ? desc : "天材地宝"
  414.     end
  415.   end
  416.   class Armor
  417.     def description
  418.       description = @description.split(/@/)[0]
  419.       return description != nil ? description : ''
  420.     end
  421.     def desc
  422.       desc = @description.split(/@/)[1]
  423.       return desc != nil ? desc : "天材地宝"
  424.     end
  425.   end
  426. end

  427. #==============================================================================
  428. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  429. #==============================================================================
复制代码
推荐使用这个物品分类脚本
黄海有狂人,欲与日月争,还我三万六千晨
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 11:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表