幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1110|回复: 1

[RMXP] 关于二刀流求助,装备为什么不能卸载了呢

[复制链接]

2

主题

4

帖子

36

积分

②入门

积分
36
发表于 2010-1-11 08:44:14 | 显示全部楼层 |阅读模式
这个脚本很好用,可是头、身体、饰品一旦装上咯就卸载不了咯,求高手帮忙!!!谢谢啦!!!!!!!
请注意发脚本的格式。secondsen留
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. class Special_Element
  5.   #--------------------------------------------------------------------------
  6.   # ● 特殊な属性を定義する定数
  7.   #--------------------------------------------------------------------------
  8.   TWO_WEAPONS = "二刀流"
  9.   #--------------------------------------------------------------------------
  10.   # ● 特殊な属性をすべて取得
  11.   #--------------------------------------------------------------------------
  12.   def self.special_elements
  13.     # 特殊な属性をすべて列挙
  14.     elements = [
  15.       TWO_WEAPONS
  16.     ]
  17.     return elements
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 属性名からその属性のIDを得る
  21.   #--------------------------------------------------------------------------
  22.   def self.get_index(name)
  23.     return $data_system.elements.index(name)
  24.   end
  25.   
  26.   #--------------------------------------------------------------------------
  27.   # ● 正規表現にマッチするすべての属性のIDとマッチ情報を得る
  28.   #     戻り値 : 二次元配列 [n][0]にID、[n][1]にマッチ情報(MatchData)
  29.   #--------------------------------------------------------------------------
  30.   def self.get_indices(regexp)
  31.     indices = []
  32.     for i in 1...$data_system.elements.size
  33.       indices.push([i, $~]) if regexp =~ $data_system.elements[i]
  34.     end
  35.   end
  36.   
  37.   #--------------------------------------------------------------------------
  38.   # ● 特殊な属性を取り除く
  39.   #     element_set     : 取り除く前の属性IDの配列
  40.   #     ignore_elements : 取り除きたい属性 ID・名前・正規表現で指定可能
  41.   #     戻り値          : 取り除いた結果の属性IDの配列
  42.   #--------------------------------------------------------------------------
  43.   def self.delete(element_set)
  44.     result = element_set.dup
  45.     for ignore in Special_Element::special_elements
  46.       case ignore
  47.       when Integer
  48.         result.delete(ignore)
  49.       when String
  50.         result.delete(Special_Element::get_index(ignore))
  51.       when Regexp
  52.         for i in result
  53.           result[i] = nil if ignore =~ $data_system.elements[result[i]]
  54.         end
  55.         result.delete(nil)
  56.       end
  57.     end
  58.     return result
  59.   end
  60. end
  61. class Game_Battler
  62.   #--------------------------------------------------------------------------
  63.   # ● 属性修正の計算
  64.   #     element_set : 属性
  65.   #--------------------------------------------------------------------------
  66.   def elements_correct(element_set)
  67.     # --- ここから変更部分 ---
  68.     element_set = Special_Element::delete(element_set)
  69.     # --- 変更部分終わり ---
  70.     # 無属性の場合
  71.     if element_set == []
  72.       # 100 を返す
  73.       return 100
  74.     end
  75.     # 与えられた属性の中で最も弱いものを返す
  76.     # ※メソッド element_rate は、このクラスから継承される Game_Actor
  77.     #   および Game_Enemy クラスで定義される
  78.     weakest = -100
  79.     for i in element_set
  80.       weakest = [weakest, self.element_rate(i)].max
  81.     end
  82.     return weakest
  83.   end
  84. end
  85. class Game_Actor < Game_Battler
  86.   #--------------------------------------------------------------------------
  87.   # ● 公開インスタンス変数
  88.   #--------------------------------------------------------------------------
  89.   attr_reader   :name                     # 名前
  90.   attr_reader   :character_name           # キャラクター ファイル名
  91.   attr_reader   :character_hue            # キャラクター 色相
  92.   attr_reader   :class_id                 # クラス ID
  93.   attr_reader   :weapon_id                # 武器 ID
  94.   # --- ここから追加部分 ---
  95.   attr_reader   :weapon2_id               # 二刀流武器 ID
  96.   # --- 追加部分終わり ---
  97.   attr_reader   :armor1_id                # 盾 ID
  98.   attr_reader   :armor2_id                # 頭防具 ID
  99.   attr_reader   :armor3_id                # 体防具 ID
  100.   attr_reader   :armor4_id                # 装飾品 ID
  101.   attr_reader   :level                    # レベル
  102.   attr_reader   :exp                      # EXP
  103.   attr_reader   :skills                   # スキル
  104.   #--------------------------------------------------------------------------
  105.   # ● セットアップ
  106.   #     actor_id : アクター ID
  107.   #--------------------------------------------------------------------------
  108.   def setup(actor_id)
  109.     actor = $data_actors[actor_id]
  110.     @actor_id = actor_id
  111.     @name = actor.name
  112.     @character_name = actor.character_name
  113.     @character_hue = actor.character_hue
  114.     @battler_name = actor.battler_name
  115.     @battler_hue = actor.battler_hue
  116.     @class_id = actor.class_id
  117.     @weapon_id = actor.weapon_id
  118.     # --- ここから追加部分 ---
  119.     @weapon2_id = 0
  120.     # --- 追加部分終わり ---
  121.     @armor1_id = actor.armor1_id
  122.     @armor2_id = actor.armor2_id
  123.     @armor3_id = actor.armor3_id
  124.     @armor4_id = actor.armor4_id
  125.     @level = actor.initial_level
  126.     @exp_list = Array.new(101)
  127.     make_exp_list
  128.     @exp = @exp_list[@level]
  129.     @skills = []
  130.     @hp = maxhp
  131.     @sp = maxsp
  132.     @states = []
  133.     @states_turn = {}
  134.     @maxhp_plus = 0
  135.     @maxsp_plus = 0
  136.     @str_plus = 0
  137.     @dex_plus = 0
  138.     @agi_plus = 0
  139.     @int_plus = 0
  140.     # スキル習得
  141.     for i in 1..@level
  142.       for j in $data_classes[@class_id].learnings
  143.         if j.level == i
  144.           learn_skill(j.skill_id)
  145.         end
  146.       end
  147.     end
  148.     # オートステートを更新
  149.     update_auto_state(nil, $data_armors[@armor1_id])
  150.     update_auto_state(nil, $data_armors[@armor2_id])
  151.     update_auto_state(nil, $data_armors[@armor3_id])
  152.     update_auto_state(nil, $data_armors[@armor4_id])
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 通常攻撃の属性取得
  156.   #--------------------------------------------------------------------------
  157.   def element_set
  158.     weapon = $data_weapons[@weapon_id]
  159.     # --- ここから変更部分 ---
  160.     weapon2 = $data_weapons[@weapon2_id]
  161.     result = []
  162.     result.concat(weapon.element_set) if weapon != nil
  163.     result.concat(weapon2.element_set) if weapon2 != nil
  164.     return result
  165.     # --- 変更部分終わり ---
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 通常攻撃のステート変化 (+) 取得
  169.   #--------------------------------------------------------------------------
  170.   def plus_state_set
  171.     weapon = $data_weapons[@weapon_id]
  172.     # --- ここから変更部分 ---
  173.     weapon2 = $data_weapons[@weapon2_id]
  174.     result = []
  175.     result.concat(weapon.plus_state_set) if weapon != nil
  176.     result.concat(weapon2.plus_state_set) if weapon2 != nil
  177.     return result
  178.     # --- 変更部分終わり ---
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 通常攻撃のステート変化 (-) 取得
  182.   #--------------------------------------------------------------------------
  183.   def minus_state_set
  184.     weapon = $data_weapons[@weapon_id]
  185.     # --- ここから変更部分 ---
  186.     weapon2 = $data_weapons[@weapon2_id]
  187.     result = []
  188.     result.concat(weapon.minus_state_set) if weapon != nil
  189.     result.concat(weapon2.minus_state_set) if weapon2 != nil
  190.     return result
  191.     # --- 変更部分終わり ---
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 基本腕力の取得
  195.   #--------------------------------------------------------------------------
  196.   def base_str
  197.     n = $data_actors[@actor_id].parameters[2, @level]
  198.     weapon = $data_weapons[@weapon_id]
  199.     armor1 = $data_armors[@armor1_id]
  200.     armor2 = $data_armors[@armor2_id]
  201.     armor3 = $data_armors[@armor3_id]
  202.     armor4 = $data_armors[@armor4_id]
  203.     # --- ここから追加部分 ---
  204.     weapon2 = $data_weapons[@weapon2_id]
  205.     # そのまま加算すると強すぎなので半分にしてみるテスト
  206.     n += weapon2 != nil ? weapon2.str_plus / 2 : 0
  207.     # --- 追加部分終わり ---
  208.     n += weapon != nil ? weapon.str_plus : 0
  209.     n += armor1 != nil ? armor1.str_plus : 0
  210.     n += armor2 != nil ? armor2.str_plus : 0
  211.     n += armor3 != nil ? armor3.str_plus : 0
  212.     n += armor4 != nil ? armor4.str_plus : 0
  213.     return [[n, 1].max, 999].min
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 基本器用さの取得
  217.   #--------------------------------------------------------------------------
  218.   def base_dex
  219.     n = $data_actors[@actor_id].parameters[3, @level]
  220.     weapon = $data_weapons[@weapon_id]
  221.     armor1 = $data_armors[@armor1_id]
  222.     armor2 = $data_armors[@armor2_id]
  223.     armor3 = $data_armors[@armor3_id]
  224.     armor4 = $data_armors[@armor4_id]
  225.     # --- ここから追加部分 ---
  226.     weapon2 = $data_weapons[@weapon2_id]
  227.     # そのまま加算すると強すぎなので半分にしてみるテスト
  228.     n += weapon2 != nil ? weapon2.dex_plus / 2 : 0
  229.     # --- 追加部分終わり ---
  230.     n += weapon != nil ? weapon.dex_plus : 0
  231.     n += armor1 != nil ? armor1.dex_plus : 0
  232.     n += armor2 != nil ? armor2.dex_plus : 0
  233.     n += armor3 != nil ? armor3.dex_plus : 0
  234.     n += armor4 != nil ? armor4.dex_plus : 0
  235.     return [[n, 1].max, 999].min
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 基本素早さの取得
  239.   #--------------------------------------------------------------------------
  240.   def base_agi
  241.     n = $data_actors[@actor_id].parameters[4, @level]
  242.     weapon = $data_weapons[@weapon_id]
  243.     armor1 = $data_armors[@armor1_id]
  244.     armor2 = $data_armors[@armor2_id]
  245.     armor3 = $data_armors[@armor3_id]
  246.     armor4 = $data_armors[@armor4_id]
  247.     # --- ここから追加部分 ---
  248.     weapon2 = $data_weapons[@weapon2_id]
  249.     # そのまま加算すると強すぎなので半分にしてみるテスト
  250.     n += weapon2 != nil ? weapon2.agi_plus / 2 : 0
  251.     # --- 追加部分終わり ---
  252.     n += weapon != nil ? weapon.agi_plus : 0
  253.     n += armor1 != nil ? armor1.agi_plus : 0
  254.     n += armor2 != nil ? armor2.agi_plus : 0
  255.     n += armor3 != nil ? armor3.agi_plus : 0
  256.     n += armor4 != nil ? armor4.agi_plus : 0
  257.     return [[n, 1].max, 999].min
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 基本魔力の取得
  261.   #--------------------------------------------------------------------------
  262.   def base_int
  263.     n = $data_actors[@actor_id].parameters[5, @level]
  264.     weapon = $data_weapons[@weapon_id]
  265.     armor1 = $data_armors[@armor1_id]
  266.     armor2 = $data_armors[@armor2_id]
  267.     armor3 = $data_armors[@armor3_id]
  268.     armor4 = $data_armors[@armor4_id]
  269.     # --- ここから追加部分 ---
  270.     weapon2 = $data_weapons[@weapon2_id]
  271.     # そのまま加算すると強すぎなので半分にしてみるテスト
  272.     n += weapon2 != nil ? weapon2.int_plus / 2 : 0
  273.     # --- 追加部分終わり ---
  274.     n += weapon != nil ? weapon.int_plus : 0
  275.     n += armor1 != nil ? armor1.int_plus : 0
  276.     n += armor2 != nil ? armor2.int_plus : 0
  277.     n += armor3 != nil ? armor3.int_plus : 0
  278.     n += armor4 != nil ? armor4.int_plus : 0
  279.     return [[n, 1].max, 999].min
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● 基本攻撃力の取得
  283.   #--------------------------------------------------------------------------
  284.   def base_atk
  285.     weapon = $data_weapons[@weapon_id]
  286.     # --- ここから変更部分 ---
  287.     weapon2 = $data_weapons[@weapon2_id]
  288.     # そのまま加算すると強すぎなので半分にしてみるテスト
  289.     n = weapon2 != nil ? weapon2.atk / 2 : 0
  290.     return weapon != nil ? weapon.atk + n : n
  291.     # --- 変更部分終わり ---
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 基本物理防御の取得
  295.   #--------------------------------------------------------------------------
  296.   def base_pdef
  297.     weapon = $data_weapons[@weapon_id]
  298.     armor1 = $data_armors[@armor1_id]
  299.     armor2 = $data_armors[@armor2_id]
  300.     armor3 = $data_armors[@armor3_id]
  301.     armor4 = $data_armors[@armor4_id]
  302.     pdef1 = weapon != nil ? weapon.pdef : 0
  303.     pdef2 = armor1 != nil ? armor1.pdef : 0
  304.     pdef3 = armor2 != nil ? armor2.pdef : 0
  305.     pdef4 = armor3 != nil ? armor3.pdef : 0
  306.     pdef5 = armor4 != nil ? armor4.pdef : 0
  307.     # --- ここから追加部分 ---
  308.     weapon2 = $data_weapons[@weapon2_id]
  309.     # そのまま加算すると強すぎなので半分にしてみるテスト
  310.     pdef1 += weapon2 != nil ? weapon2.pdef / 2 : 0
  311.     # --- 追加部分終わり ---
  312.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 基本魔法防御の取得
  316.   #--------------------------------------------------------------------------
  317.   def base_mdef
  318.     weapon = $data_weapons[@weapon_id]
  319.     armor1 = $data_armors[@armor1_id]
  320.     armor2 = $data_armors[@armor2_id]
  321.     armor3 = $data_armors[@armor3_id]
  322.     armor4 = $data_armors[@armor4_id]
  323.     mdef1 = weapon != nil ? weapon.mdef : 0
  324.     mdef2 = armor1 != nil ? armor1.mdef : 0
  325.     mdef3 = armor2 != nil ? armor2.mdef : 0
  326.     mdef4 = armor3 != nil ? armor3.mdef : 0
  327.     mdef5 = armor4 != nil ? armor4.mdef : 0
  328.     # --- ここから追加部分 ---
  329.     weapon2 = $data_weapons[@weapon2_id]
  330.     # そのまま加算すると強すぎなので半分にしてみるテスト
  331.     mdef1 += weapon2 != nil ? weapon2.mdef / 2 : 0
  332.     # --- 追加部分終わり ---
  333.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 通常攻撃 攻撃側アニメーション ID の取得
  337.   #--------------------------------------------------------------------------
  338.   def animation1_id
  339.     weapon = $data_weapons[@weapon_id]
  340.     # --- ここから変更部分 ---
  341.     weapon2 = $data_weapons[@weapon2_id]
  342.     animations = []
  343.     animations.push(weapon.animation1_id) if weapon != nil
  344.     animations.push(weapon2.animation1_id) if weapon2 != nil
  345.     animations.delete(0)
  346.     return animations.empty? ? 0 : animations
  347.     # --- 変更部分終わり ---
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● 通常攻撃 対象側アニメーション ID の取得
  351.   #--------------------------------------------------------------------------
  352.   def animation2_id
  353.     weapon = $data_weapons[@weapon_id]
  354.     # --- ここから変更部分 ---
  355.     weapon2 = $data_weapons[@weapon2_id]
  356.     animations = []
  357.     animations.push(weapon.animation2_id) if weapon != nil
  358.     animations.push(weapon2.animation2_id) if weapon2 != nil
  359.     animations.delete(0)
  360.     return animations.empty? ? 0 : animations
  361.     # --- 変更部分終わり ---
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 装備の変更
  365.   #     equip_type : 装備タイプ(変更点:-1なら二刀流の盾部分の武器)
  366.   #     id    : 武器 or 防具 ID  (0 なら装備解除)
  367.   #--------------------------------------------------------------------------
  368.   def equip(equip_type, id)
  369.     case equip_type
  370.     when 0  # 武器
  371.       if id == 0 or $game_party.weapon_number(id) > 0
  372.         $game_party.gain_weapon(@weapon_id, 1)
  373.         @weapon_id = id
  374.         $game_party.lose_weapon(id, 1)
  375.         # --- ここから追加部分 ---
  376.         # 二刀武器じゃないものを装備した場合、盾の部分の二刀武器を外す
  377.         if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  378.           $game_party.gain_weapon(@weapon2_id, 1)
  379.           @weapon2_id = 0
  380.         end
  381.         # --- 追加部分終わり ---
  382.       end
  383.     when 1  # 盾
  384.       if id == 0 or $game_party.armor_number(id) > 0
  385.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  386.         $game_party.gain_armor(@armor1_id, 1)
  387.         @armor1_id = id
  388.         $game_party.lose_armor(id, 1)
  389.         # --- ここから追加部分 ---
  390.         # 二刀武器を装備していた場合は外す
  391.         if id != 0
  392.           $game_party.gain_weapon(@weapon2_id, 1)
  393.           @weapon2_id = 0
  394.         end
  395.         # --- 追加部分終わり ---
  396.       end
  397.     when 2  # 頭
  398.       if id == 0 or $game_party.armor_number(id) > 0
  399.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  400.         $game_party.gain_armor(@armor2_id, 1)
  401.         @armor2_id = id
  402.         $game_party.lose_armor(id, 1)
  403.       end
  404.     when 3  # 身体
  405.       if id == 0 or $game_party.armor_number(id) > 0
  406.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  407.         $game_party.gain_armor(@armor3_id, 1)
  408.         @armor3_id = id
  409.         $game_party.lose_armor(id, 1)
  410.       end
  411.     when 4  # 装飾品
  412.       if id == 0 or $game_party.armor_number(id) > 0
  413.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  414.         $game_party.gain_armor(@armor4_id, 1)
  415.         @armor4_id = id
  416.         $game_party.lose_armor(id, 1)
  417.       end
  418.       # --- ここから追加部分 ---
  419.       when -1 # 二刀流の盾部分の武器
  420.       if id == 0 or $game_party.weapon_number(id) > 0
  421.         $game_party.gain_weapon(@weapon2_id, 1)
  422.         @weapon2_id = id
  423.         $game_party.lose_weapon(id, 1)
  424.         # 盾を外す
  425.         $game_party.gain_armor(@armor1_id, 1)
  426.         @armor1_id = 0
  427.         # 既に装備している武器が二刀武器じゃない場合は外す
  428.         if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  429.           $game_party.gain_weapon(@weapon_id, 1)
  430.           @weapon_id = 0
  431.         end
  432.       end
  433.       # --- 追加部分終わり ---
  434.     end
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 二刀流可能なアクターかどうか
  438.   #--------------------------------------------------------------------------
  439.   def can_two_weapons?
  440.     return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● アクターの所属クラスの属性がAのものを取得
  444.   #--------------------------------------------------------------------------
  445.   def class_element_set
  446.     element_set = []
  447.     for i in 1...$data_classes[@class_id].element_ranks.xsize
  448.       element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
  449.     end
  450.     return element_set
  451.   end
  452. end
  453. class Window_EquipRight < Window_Selectable
  454.   #--------------------------------------------------------------------------
  455.   # ● リフレッシュ
  456.   #--------------------------------------------------------------------------
  457.   def refresh
  458.     self.contents.clear
  459.     @data = []
  460.     @data.push($data_weapons[@actor.weapon_id])
  461.     # --- ここから変更部分 ---
  462.     @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
  463.     # --- 変更部分終わり ---
  464.     @data.push($data_armors[@actor.armor2_id])
  465.     @data.push($data_armors[@actor.armor3_id])
  466.     @data.push($data_armors[@actor.armor4_id])
  467.     @item_max = @data.size
  468.     self.contents.font.color = system_color
  469.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  470.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  471.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  472.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  473.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  474.     draw_item_name(@data[0], 92, 32 * 0)
  475.     draw_item_name(@data[1], 92, 32 * 1)
  476.     draw_item_name(@data[2], 92, 32 * 2)
  477.     draw_item_name(@data[3], 92, 32 * 3)
  478.     draw_item_name(@data[4], 92, 32 * 4)
  479.   end
  480. end
  481. class Window_EquipItem < Window_Selectable
  482.   #--------------------------------------------------------------------------
  483.   # ● リフレッシュ
  484.   #--------------------------------------------------------------------------
  485.   def refresh
  486.     if self.contents != nil
  487.       self.contents.dispose
  488.       self.contents = nil
  489.     end
  490.     @data = []
  491.     # 装備可能な武器を追加
  492.     if @equip_type == 0
  493.       weapon_set = $data_classes[@actor.class_id].weapon_set
  494.       for i in 1...$data_weapons.size
  495.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  496.           @data.push($data_weapons[i])
  497.         end
  498.       end
  499.     end
  500.     # --- ここから追加部分 ---
  501.     # 二刀流可能なアクターの場合は、盾に二刀武器も表示
  502.     if @equip_type == 1 and @actor.can_two_weapons?
  503.       weapon_set = $data_classes[@actor.class_id].weapon_set
  504.       for i in 1...$data_weapons.size
  505.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  506.           @data.push($data_weapons[i])
  507.         end
  508.       end
  509.     end
  510.     # --- 追加部分終わり ---
  511.     # 装備可能な防具を追加
  512.     if @equip_type != 0
  513.       armor_set = $data_classes[@actor.class_id].armor_set
  514.       for i in 1...$data_armors.size
  515.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  516.           if $data_armors[i].kind == @equip_type-1
  517.             @data.push($data_armors[i])
  518.           end
  519.         end
  520.       end
  521.     end
  522.     # 空白を追加
  523.     @data.push(nil)
  524.     # ビットマップを作成し、全項目を描画
  525.     @item_max = @data.size
  526.     self.contents = Bitmap.new(width - 32, row_max * 32)
  527.     for i in 0...@item_max-1
  528.       draw_item(i)
  529.     end
  530.   end
  531. end
  532. class Scene_Equip
  533.   #--------------------------------------------------------------------------
  534.   # ● リフレッシュ
  535.   #--------------------------------------------------------------------------
  536.   def refresh
  537.     # アイテムウィンドウの可視状態設定
  538.     @item_window1.visible = (@right_window.index == 0)
  539.     @item_window2.visible = (@right_window.index == 1)
  540.     @item_window3.visible = (@right_window.index == 2)
  541.     @item_window4.visible = (@right_window.index == 3)
  542.     @item_window5.visible = (@right_window.index == 4)
  543.     # 現在装備中のアイテムを取得
  544.     item1 = @right_window.item
  545.     # 現在のアイテムウィンドウを @item_window に設定
  546.     case @right_window.index
  547.     when 0
  548.       @item_window = @item_window1
  549.     when 1
  550.       @item_window = @item_window2
  551.     when 2
  552.       @item_window = @item_window3
  553.     when 3
  554.       @item_window = @item_window4
  555.     when 4
  556.       @item_window = @item_window5
  557.     end
  558.     # ライトウィンドウがアクティブの場合
  559.     if @right_window.active
  560.       # 装備変更後のパラメータを消去
  561.       @left_window.set_new_parameters(nil, nil, nil)
  562.     end
  563.     # アイテムウィンドウがアクティブの場合
  564.     if @item_window.active
  565.       # 現在選択中のアイテムを取得
  566.       item2 = @item_window.item
  567.       # 装備を変更
  568.       last_hp = @actor.hp
  569.       last_sp = @actor.sp
  570.       # --- ここから変更部分 ---
  571.       # 現在の装備を保存(装備の種類を増やしている場合はここを変更)
  572.       equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
  573.       @actor.equip(equip_type(@right_window.index, item2), item2 == nil ? 0 : item2.id)
  574.       # --- 変更部分終わり ---
  575.       # 装備変更後のパラメータを取得
  576.       new_atk = @actor.atk
  577.       new_pdef = @actor.pdef
  578.       new_mdef = @actor.mdef
  579.       # --- ここから変更部分 ---
  580.       # 装備を戻す
  581.       for i in 0...equipments.size
  582.         @actor.equip(i - 1, equipments[i])
  583.       end
  584.       # --- 変更部分終わり ---
  585.       @actor.hp = last_hp
  586.       @actor.sp = last_sp
  587.       # レフトウィンドウに描画
  588.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  589.     end
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  593.   #--------------------------------------------------------------------------
  594.   def update_item
  595.     # B ボタンが押された場合
  596.     if Input.trigger?(Input::B)
  597.       # キャンセル SE を演奏
  598.       $game_system.se_play($data_system.cancel_se)
  599.       # ライトウィンドウをアクティブ化
  600.       @right_window.active = true
  601.       @item_window.active = false
  602.       @item_window.index = -1
  603.       return
  604.     end
  605.     # C ボタンが押された場合
  606.     if Input.trigger?(Input::C)
  607.       # 装備 SE を演奏
  608.       $game_system.se_play($data_system.equip_se)
  609.       # アイテムウィンドウで現在選択されているデータを取得
  610.       item = @item_window.item
  611.       # --- ここから変更部分 ---
  612.       # 装備を変更
  613.       @actor.equip(equip_type(@right_window.index, item), item == nil ? 0 : item.id)
  614.       # --- 変更部分終わり ---
  615.       # ライトウィンドウをアクティブ化
  616.       @right_window.active = true
  617.       @item_window.active = false
  618.       @item_window.index = -1
  619.       # ライトウィンドウ、アイテムウィンドウの内容を再作成
  620.       @right_window.refresh
  621.       # --- ここから変更部分 ---
  622.       # めんどくさいのですべてのウィンドウをリフレッシュ
  623.       @item_window1.refresh
  624.       @item_window2.refresh
  625.       @item_window3.refresh
  626.       @item_window4.refresh
  627.       @item_window5.refresh
  628.       # --- 変更部分終わり ---
  629.       return
  630.     end
  631.   end
  632.   
  633.   # --- ここから追加部分 ---
  634.   #--------------------------------------------------------------------------
  635.   # ● 二刀流用の装備部位取得
  636.   #--------------------------------------------------------------------------
  637.   def equip_type(index, item)
  638.     return index * (item.is_a?(RPG::Armor) ? 1 : -1)
  639.   end
  640.   # --- 追加部分終わり ---
  641. end
  642. class Scene_Battle
  643.   #--------------------------------------------------------------------------
  644.   # ● 基本アクション 結果作成
  645.   #--------------------------------------------------------------------------
  646.   def make_basic_action_result
  647.     # 攻撃の場合
  648.     if @active_battler.current_action.basic == 0
  649.       # --- ここから変更部分 ---
  650.       # アニメーション ID を設定
  651.       @animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
  652.       @animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @active_battler.animation2_id
  653.       # --- 変更部分終わり ---
  654.       # 行動側バトラーがエネミーの場合
  655.       if @active_battler.is_a?(Game_Enemy)
  656.         if @active_battler.restriction == 3
  657.           target = $game_troop.random_target_enemy
  658.         elsif @active_battler.restriction == 2
  659.           target = $game_party.random_target_actor
  660.         else
  661.           index = @active_battler.current_action.target_index
  662.           target = $game_party.smooth_target_actor(index)
  663.         end
  664.       end
  665.       # 行動側バトラーがアクターの場合
  666.       if @active_battler.is_a?(Game_Actor)
  667.         if @active_battler.restriction == 3
  668.           target = $game_party.random_target_actor
  669.         elsif @active_battler.restriction == 2
  670.           target = $game_troop.random_target_enemy
  671.         else
  672.           index = @active_battler.current_action.target_index
  673.           target = $game_troop.smooth_target_enemy(index)
  674.         end
  675.       end
  676.       # 対象側バトラーの配列を設定
  677.       @target_battlers = [target]
  678.       # 通常攻撃の効果を適用
  679.       for target in @target_battlers
  680.         target.attack_effect(@active_battler)
  681.       end
  682.       return
  683.     end
  684.     # 防御の場合
  685.     if @active_battler.current_action.basic == 1
  686.       # ヘルプウィンドウに "防御" を表示
  687.       @help_window.set_text($data_system.words.guard, 1)
  688.       return
  689.     end
  690.     # 逃げるの場合
  691.     if @active_battler.is_a?(Game_Enemy) and
  692.        @active_battler.current_action.basic == 2
  693.       # ヘルプウィンドウに "逃げる" を表示
  694.       @help_window.set_text("逃げる", 1)
  695.       # 逃げる
  696.       @active_battler.escape
  697.       return
  698.     end
  699.     # 何もしないの場合
  700.     if @active_battler.current_action.basic == 3
  701.       # アクション強制対象のバトラーをクリア
  702.       $game_temp.forcing_battler = nil
  703.       # ステップ 1 に移行
  704.       @phase4_step = 1
  705.       return
  706.     end
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  710.   #--------------------------------------------------------------------------
  711.   def update_phase4_step3
  712.     # --- ここから変更部分 ---
  713.     # アニメーションの配列の先頭を取り出す
  714.     if @animation1_id.is_a?(Integer)
  715.       @animation1_id = [@animation1_id]
  716.     end
  717.     animation = @animation1_id.shift
  718.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  719.     if animation == 0
  720.       @active_battler.white_flash = true
  721.     else
  722.       @active_battler.animation_id = animation
  723.       @active_battler.animation_hit = true
  724.     end
  725.     # アニメーションがなくなったらステップ 4 に移行
  726.     @phase4_step = 4 if @animation1_id.empty?
  727.     # --- 変更部分終わり ---
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  731.   #--------------------------------------------------------------------------
  732.   def update_phase4_step4
  733.     # --- ここから変更部分 ---
  734.     # アニメーションの配列の先頭を取り出す
  735.     if @animation2_id.is_a?(Integer)
  736.       @animation2_id = [@animation2_id]
  737.     end
  738.     animation = @animation2_id.shift
  739.     # 対象側アニメーション
  740.     for target in @target_battlers
  741.       target.animation_id = animation
  742.       target.animation_hit = (target.damage != "Miss")
  743.     end
  744.     # アニメーションの長さにかかわらず、最低 8 フレーム待つ
  745.     @wait_count = 8
  746.     # アニメーションがなくなったらステップ 5 に移行
  747.     @phase4_step = 5 if @animation2_id.empty?
  748.     # --- 変更部分終わり ---
  749.   end
  750. end
  751. #==============================================================================
  752. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  753. #==============================================================================
复制代码
回复

使用道具 举报

2

主题

4

帖子

36

积分

②入门

积分
36
 楼主| 发表于 2010-1-11 14:04:41 | 显示全部楼层
谢谢大神,以后一定注意,呵呵,请问能帮我解答下嘛?是$game_party.lose_armor(id, 1)这些的问题吗?好像是说同伴装备变更的这些语句,就是找不到具体问题在哪啊,菜鸟刚接触xp一周,请高人指点下啊!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2024-6-3 22:21 , Processed in 0.018929 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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