#============================================================================== # 本脚本来自www.66RPG.com,使用和转载请保留此信息 #============================================================================== class Special_Element #-------------------------------------------------------------------------- # ● 特殊な属性を定義する定数 #-------------------------------------------------------------------------- TWO_WEAPONS = "二刀流" #-------------------------------------------------------------------------- # ● 特殊な属性をすべて取得 #-------------------------------------------------------------------------- def self.special_elements # 特殊な属性をすべて列挙 elements = [ TWO_WEAPONS ] return elements end #-------------------------------------------------------------------------- # ● 属性名からその属性のIDを得る #-------------------------------------------------------------------------- def self.get_index(name) return $data_system.elements.index(name) end #-------------------------------------------------------------------------- # ● 正規表現にマッチするすべての属性のIDとマッチ情報を得る # 戻り値 : 二次元配列 [n][0]にID、[n][1]にマッチ情報(MatchData) #-------------------------------------------------------------------------- def self.get_indices(regexp) indices = [] for i in 1...$data_system.elements.size indices.push([i, $~]) if regexp =~ $data_system.elements[i] end end #-------------------------------------------------------------------------- # ● 特殊な属性を取り除く # element_set : 取り除く前の属性IDの配列 # ignore_elements : 取り除きたい属性 ID・名前・正規表現で指定可能 # 戻り値 : 取り除いた結果の属性IDの配列 #-------------------------------------------------------------------------- def self.delete(element_set) result = element_set.dup for ignore in Special_Element::special_elements case ignore when Integer result.delete(ignore) when String result.delete(Special_Element::get_index(ignore)) when Regexp for i in result result[i] = nil if ignore =~ $data_system.elements[result[i]] end result.delete(nil) end end return result end end class Game_Battler #-------------------------------------------------------------------------- # ● 属性修正の計算 # element_set : 属性 #-------------------------------------------------------------------------- def elements_correct(element_set) # --- ここから変更部分 --- element_set = Special_Element::delete(element_set) # --- 変更部分終わり --- # 無属性の場合 if element_set == [] # 100 を返す return 100 end # 与えられた属性の中で最も弱いものを返す # ※メソッド element_rate は、このクラスから継承される Game_Actor # および Game_Enemy クラスで定義される weakest = -100 for i in element_set weakest = [weakest, self.element_rate(i)].max end return weakest end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :name # 名前 attr_reader :character_name # キャラクター ファイル名 attr_reader :character_hue # キャラクター 色相 attr_reader :class_id # クラス ID attr_reader :weapon_id # 武器 ID # --- ここから追加部分 --- attr_reader :weapon2_id # 二刀流武器 ID # --- 追加部分終わり --- attr_reader :armor1_id # 盾 ID attr_reader :armor2_id # 頭防具 ID attr_reader :armor3_id # 体防具 ID attr_reader :armor4_id # 装飾品 ID attr_reader :level # レベル attr_reader :exp # EXP attr_reader :skills # スキル #-------------------------------------------------------------------------- # ● セットアップ # actor_id : アクター ID #-------------------------------------------------------------------------- def setup(actor_id) actor = $data_actors[actor_id] @actor_id = actor_id @name = actor.name @character_name = actor.character_name @character_hue = actor.character_hue @battler_name = actor.battler_name @battler_hue = actor.battler_hue @class_id = actor.class_id @weapon_id = actor.weapon_id # --- ここから追加部分 --- @weapon2_id = 0 # --- 追加部分終わり --- @armor1_id = actor.armor1_id @armor2_id = actor.armor2_id @armor3_id = actor.armor3_id @armor4_id = actor.armor4_id @level = actor.initial_level @exp_list = Array.new(101) make_exp_list @exp = @exp_list[@level] @skills = [] @hp = maxhp @sp = maxsp @states = [] @states_turn = {} @maxhp_plus = 0 @maxsp_plus = 0 @str_plus = 0 @dex_plus = 0 @agi_plus = 0 @int_plus = 0 # スキル習得 for i in 1..@level for j in $data_classes[@class_id].learnings if j.level == i learn_skill(j.skill_id) end end end # オートステートを更新 update_auto_state(nil, $data_armors[@armor1_id]) update_auto_state(nil, $data_armors[@armor2_id]) update_auto_state(nil, $data_armors[@armor3_id]) update_auto_state(nil, $data_armors[@armor4_id]) end #-------------------------------------------------------------------------- # ● 通常攻撃の属性取得 #-------------------------------------------------------------------------- def element_set weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] result = [] result.concat(weapon.element_set) if weapon != nil result.concat(weapon2.element_set) if weapon2 != nil return result # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 通常攻撃のステート変化 (+) 取得 #-------------------------------------------------------------------------- def plus_state_set weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] result = [] result.concat(weapon.plus_state_set) if weapon != nil result.concat(weapon2.plus_state_set) if weapon2 != nil return result # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 通常攻撃のステート変化 (-) 取得 #-------------------------------------------------------------------------- def minus_state_set weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] result = [] result.concat(weapon.minus_state_set) if weapon != nil result.concat(weapon2.minus_state_set) if weapon2 != nil return result # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 基本腕力の取得 #-------------------------------------------------------------------------- def base_str n = $data_actors[@actor_id].parameters[2, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト n += weapon2 != nil ? weapon2.str_plus / 2 : 0 # --- 追加部分終わり --- n += weapon != nil ? weapon.str_plus : 0 n += armor1 != nil ? armor1.str_plus : 0 n += armor2 != nil ? armor2.str_plus : 0 n += armor3 != nil ? armor3.str_plus : 0 n += armor4 != nil ? armor4.str_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 基本器用さの取得 #-------------------------------------------------------------------------- def base_dex n = $data_actors[@actor_id].parameters[3, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト n += weapon2 != nil ? weapon2.dex_plus / 2 : 0 # --- 追加部分終わり --- n += weapon != nil ? weapon.dex_plus : 0 n += armor1 != nil ? armor1.dex_plus : 0 n += armor2 != nil ? armor2.dex_plus : 0 n += armor3 != nil ? armor3.dex_plus : 0 n += armor4 != nil ? armor4.dex_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 基本素早さの取得 #-------------------------------------------------------------------------- def base_agi n = $data_actors[@actor_id].parameters[4, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト n += weapon2 != nil ? weapon2.agi_plus / 2 : 0 # --- 追加部分終わり --- n += weapon != nil ? weapon.agi_plus : 0 n += armor1 != nil ? armor1.agi_plus : 0 n += armor2 != nil ? armor2.agi_plus : 0 n += armor3 != nil ? armor3.agi_plus : 0 n += armor4 != nil ? armor4.agi_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 基本魔力の取得 #-------------------------------------------------------------------------- def base_int n = $data_actors[@actor_id].parameters[5, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト n += weapon2 != nil ? weapon2.int_plus / 2 : 0 # --- 追加部分終わり --- n += weapon != nil ? weapon.int_plus : 0 n += armor1 != nil ? armor1.int_plus : 0 n += armor2 != nil ? armor2.int_plus : 0 n += armor3 != nil ? armor3.int_plus : 0 n += armor4 != nil ? armor4.int_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 基本攻撃力の取得 #-------------------------------------------------------------------------- def base_atk weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト n = weapon2 != nil ? weapon2.atk / 2 : 0 return weapon != nil ? weapon.atk + n : n # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 基本物理防御の取得 #-------------------------------------------------------------------------- def base_pdef weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] pdef1 = weapon != nil ? weapon.pdef : 0 pdef2 = armor1 != nil ? armor1.pdef : 0 pdef3 = armor2 != nil ? armor2.pdef : 0 pdef4 = armor3 != nil ? armor3.pdef : 0 pdef5 = armor4 != nil ? armor4.pdef : 0 # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト pdef1 += weapon2 != nil ? weapon2.pdef / 2 : 0 # --- 追加部分終わり --- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 end #-------------------------------------------------------------------------- # ● 基本魔法防御の取得 #-------------------------------------------------------------------------- def base_mdef weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] mdef1 = weapon != nil ? weapon.mdef : 0 mdef2 = armor1 != nil ? armor1.mdef : 0 mdef3 = armor2 != nil ? armor2.mdef : 0 mdef4 = armor3 != nil ? armor3.mdef : 0 mdef5 = armor4 != nil ? armor4.mdef : 0 # --- ここから追加部分 --- weapon2 = $data_weapons[@weapon2_id] # そのまま加算すると強すぎなので半分にしてみるテスト mdef1 += weapon2 != nil ? weapon2.mdef / 2 : 0 # --- 追加部分終わり --- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 end #-------------------------------------------------------------------------- # ● 通常攻撃 攻撃側アニメーション ID の取得 #-------------------------------------------------------------------------- def animation1_id weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] animations = [] animations.push(weapon.animation1_id) if weapon != nil animations.push(weapon2.animation1_id) if weapon2 != nil animations.delete(0) return animations.empty? ? 0 : animations # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 通常攻撃 対象側アニメーション ID の取得 #-------------------------------------------------------------------------- def animation2_id weapon = $data_weapons[@weapon_id] # --- ここから変更部分 --- weapon2 = $data_weapons[@weapon2_id] animations = [] animations.push(weapon.animation2_id) if weapon != nil animations.push(weapon2.animation2_id) if weapon2 != nil animations.delete(0) return animations.empty? ? 0 : animations # --- 変更部分終わり --- end #-------------------------------------------------------------------------- # ● 装備の変更 # equip_type : 装備タイプ(変更点:-1なら二刀流の盾部分の武器) # id : 武器 or 防具 ID (0 なら装備解除) #-------------------------------------------------------------------------- def equip(equip_type, id) case equip_type when 0 # 武器 if id == 0 or $game_party.weapon_number(id) > 0 $game_party.gain_weapon(@weapon_id, 1) @weapon_id = id $game_party.lose_weapon(id, 1) # --- ここから追加部分 --- # 二刀武器じゃないものを装備した場合、盾の部分の二刀武器を外す if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS)) $game_party.gain_weapon(@weapon2_id, 1) @weapon2_id = 0 end # --- 追加部分終わり --- end when 1 # 盾 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor1_id], $data_armors[id]) $game_party.gain_armor(@armor1_id, 1) @armor1_id = id $game_party.lose_armor(id, 1) # --- ここから追加部分 --- # 二刀武器を装備していた場合は外す if id != 0 $game_party.gain_weapon(@weapon2_id, 1) @weapon2_id = 0 end # --- 追加部分終わり --- end when 2 # 頭 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor2_id], $data_armors[id]) $game_party.gain_armor(@armor2_id, 1) @armor2_id = id $game_party.lose_armor(id, 1) end when 3 # 身体 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor3_id], $data_armors[id]) $game_party.gain_armor(@armor3_id, 1) @armor3_id = id $game_party.lose_armor(id, 1) end when 4 # 装飾品 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor4_id], $data_armors[id]) $game_party.gain_armor(@armor4_id, 1) @armor4_id = id $game_party.lose_armor(id, 1) end # --- ここから追加部分 --- when -1 # 二刀流の盾部分の武器 if id == 0 or $game_party.weapon_number(id) > 0 $game_party.gain_weapon(@weapon2_id, 1) @weapon2_id = id $game_party.lose_weapon(id, 1) # 盾を外す $game_party.gain_armor(@armor1_id, 1) @armor1_id = 0 # 既に装備している武器が二刀武器じゃない場合は外す if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS)) $game_party.gain_weapon(@weapon_id, 1) @weapon_id = 0 end end # --- 追加部分終わり --- end end #-------------------------------------------------------------------------- # ● 二刀流可能なアクターかどうか #-------------------------------------------------------------------------- def can_two_weapons? return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS)) end #-------------------------------------------------------------------------- # ● アクターの所属クラスの属性がAのものを取得 #-------------------------------------------------------------------------- def class_element_set element_set = [] for i in 1...$data_classes[@class_id].element_ranks.xsize element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1 end return element_set end end class Window_EquipRight < Window_Selectable #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] @data.push($data_weapons[@actor.weapon_id]) # --- ここから変更部分 --- @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id]) # --- 変更部分終わり --- @data.push($data_armors[@actor.armor2_id]) @data.push($data_armors[@actor.armor3_id]) @data.push($data_armors[@actor.armor4_id]) @item_max = @data.size self.contents.font.color = system_color self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon) self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1) self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2) self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3) self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4) draw_item_name(@data[0], 92, 32 * 0) draw_item_name(@data[1], 92, 32 * 1) draw_item_name(@data[2], 92, 32 * 2) draw_item_name(@data[3], 92, 32 * 3) draw_item_name(@data[4], 92, 32 * 4) end end class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # 装備可能な武器を追加 if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end # --- ここから追加部分 --- # 二刀流可能なアクターの場合は、盾に二刀武器も表示 if @equip_type == 1 and @actor.can_two_weapons? weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size 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)) @data.push($data_weapons[i]) end end end # --- 追加部分終わり --- # 装備可能な防具を追加 if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end # 空白を追加 @data.push(nil) # ビットマップを作成し、全項目を描画 @item_max = @data |