#============================================================================== # ■統合ベーススクリプト拡張ユニットJ for RGSS3 Ver2.09-β3 # □作成者 kure # # 命中タイプ指定を利用するためのオプションスクリプトです。 # 命中タイプ指定を適用するスキル、アイテムのメモ欄に # 『<命中タイプ指定対象>』と記載してください。 # #============================================================================== p "統合ベーススクリプトJ" #============================================================================== # ●■ RPG::UsableItem(追加定義集積) #============================================================================== class RPG::UsableItem < RPG::BaseItem #-------------------------------------------------------------------------- # ☆ 命中タイプ変化反映(追加定義) #-------------------------------------------------------------------------- def adopt_hit_type_change @note.include?("<命中タイプ指定対象>") end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ★ 拡張特徴による命中タイプ修正(追加定義) #-------------------------------------------------------------------------- def user_item_hit_type(user, item) #命中タイプを取得 value = item.hit_type return value unless item.adopt_hit_type_change #命中タイプ変化の配列を取得 list = user.hit_type_change #本来の命中タイプ変化の配列を取得 list1 = user.hit_type_change[item.hit_type] #全体用命中タイプ変化を取得 list2 = user.hit_type_change[3] #判定 index_mem = 0 if list1 != [] list1.each_with_index{|block, index| next unless block next if block == [] #値を返す(必中(0)を優先して反映) value = block.min index_mem = index break } end if list2 != [] list2.each_with_index{|block, index| break if index_mem == index next unless block next if block == [] #値を返す(必中(0)を優先して反映) value = block.min break } end return value end #(上書きされる各種処理)---------------------------------------------------- #-------------------------------------------------------------------------- # ● スキル/アイテムの回避率計算(上書き) #-------------------------------------------------------------------------- def item_eva(user, item) return eva if user_item_hit_type(user, item) == 1 # 物理攻撃なら回避率を返す return mev if user_item_hit_type(user, item) == 2 # 魔法攻撃なら魔法回避率を返す return 0 end #-------------------------------------------------------------------------- # ★ 拡張命中率の計算(追加定義)(上書き) #-------------------------------------------------------------------------- def item_ex_hit(user, item) return [user.hit - eva ,KURE::Integrate::MIN_HIT_RATE].max if user_item_hit_type(user, item) == 1 return [user.mhit - mev,KURE::Integrate::MIN_HIT_RATE].max if user_item_hit_type(user, item) == 2 return 1 end #-------------------------------------------------------------------------- # ★ 使用効果無効化判定プロセス(拡張特徴ID95用)(追加定義) #-------------------------------------------------------------------------- def effect_invalidate_process(user, item) #貫通能力適用時は処理を終了 return if item.pierce_ability.include?(95) #データを取得 data = add_features_object(95) #スキル、アイテムで判定を分割 list = data[0] + data[2] if item.is_a?(RPG::Skill) list = data[1] + data[2] if item.is_a?(RPG::Item) #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) list.each{|block| #命中対応対象指定の場合違えば判定を除外 next if block[0] != 3 && block[0] != u_item_hit_type next if rand(100) >= block[1] @result.effect_invalidate = true if item.damage.none? @result.add_feature_deffence.push([95, block[2], [self.name], 0]) end break } end #-------------------------------------------------------------------------- # ★ 無効化能力の発動チェック(追加定義) #-------------------------------------------------------------------------- def invalidate_cheak_process(user, item) return if !opposite?(user) #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) #ID62(防御壁展開) unless item.pierce_ability.include?(62) #貫通能力判定 @ad_counter[0].each_with_index{|block, index| next if block[0] != 3 && block[0] != u_item_hit_type next if rand(100) >= block[2] next if block[1] < 1 @ad_counter[0][index][1] -= 1 @ad_counter[0][index][1] -= item.break_wall if block[1] >= 0 @result.add_feature_invalidate.push([43, 0, [user.name, item.break_wall + 1], 2]) if item.break_wall > 0 @result.add_feature_invalidate.push([62, block[4], [name], 0]) if block[1] == 0 erase_state(block[3]) if block[3] != 0 @ad_counter[0][index] = nil end @ad_counter[0].compact! return else @result.add_feature_deffence.push([43, 1, [user.name], 2]) erase_state(block[3]) if block[3] != 0 @ad_counter[0][index] = nil @ad_counter[0].compact! return end } end #ID25(命中タイプ無効化) unless item.pierce_ability.include?(25) hit_type_invalidate.each {|block| #アイテム対象のデータはスキルで反映しない next if block[0] == 1 && item.is_a?(RPG::Skill) #スキル対象のデータはアイテムでは反映しない next if block[0] == 0 && item.is_a?(RPG::Item) next if block[1] != 3 && block[1] != u_item_hit_type next if rand(100) >= block[2] @result.add_feature_invalidate.push([25, block[3], [name], 0]) return } end end #-------------------------------------------------------------------------- # ★ スキル/アイテムの命中タイプ修正値を取得(追加定義) #-------------------------------------------------------------------------- def item_hit_type_rate(user, item) #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) result = 1.0 result *= user.hit_type_gain_rate(u_item_hit_type) case u_item_hit_type when 1 ; result *= pdr when 2 ; result *= mdr end result += user.hit_type_add_rate(u_item_hit_type) result -= hit_type_drain_rate(u_item_hit_type) if !item.damage.recover? return result end #-------------------------------------------------------------------------- # ★ スキル/アイテムの反射計算(拡張特徴46,46)(追加定義) #-------------------------------------------------------------------------- def item_mrf_ex(user, item, mode) return 0 if item.impossible_refrect > rand(100) #反射不可スキル判定 return 0 if KURE::Integrate::HEAL_REFRECT == 0 && item.damage.recover? return 0 if user == self #自分には反射しない #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) case u_item_hit_type when 0 ; return cer_rf_rate when 1 ; return phy_rf_rate when 2 ; return mrf end return 0 end #-------------------------------------------------------------------------- # ★ ステート反撃プロセス(拡張特徴ID40)(追加定義) #-------------------------------------------------------------------------- def counter_state_process(user, item) return if counter_states == [] #カウンターステートが無ければ処理しない return if item.impossible_counter > rand(100) #反撃不可スキル判定 return unless opposite?(user) # 味方には反撃しない element = basic_element_list(user, item) #攻撃者の属性を取得 #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) counter_states.each{|block| next if block[0] != u_item_hit_type && block[0] != 3 next if block[1] != 0 && !element.include?(block[1]) next if rand > user.item_state_rate(block[3].to_f / 100, self, block[2], item) @result.add_feature_after.push([40, block[4], [name], 0]) next if counter_state_break_process(user, item) user.add_state(block[2]) @result.add_feature_after.push([user, nil, nil, 1]) } end #-------------------------------------------------------------------------- # ★ 属性反応ステートプロセス(拡張能力ID84) #-------------------------------------------------------------------------- def element_react_state_process(user, item) #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) element = basic_element_list(user, item) element_react_state.each{|block| next unless element.include?(block[0]) next if u_item_hit_type != block[1] && block[1] != 3 add_state(block[2])} end #-------------------------------------------------------------------------- # ★ 変換処理(拡張特徴ID96,97)(追加定義) #-------------------------------------------------------------------------- def convert_object_process(target, item) if item.is_a?(RPG::Skill) arr = target.convert_skill_obj ; id = 96 elsif item.is_a?(RPG::Item) arr = target.convert_item_obj ; id = 97 end #命中タイプ取得 u_item_hit_type = user_item_hit_type(user, item) #スキル変換処理 list = arr.sort_by{rand} list.each{|block| #対象判定 case block[0] when 0 ; next if block[1] != item.id when 1 ; next if !@subject.basic_element_list(@subject, item).include?(block[1]) when 2 ; next if block[1] != 3 && block[1] != u_item_hit_type end #確率判定 next if rand(100) >= block[3] @log_window.wait @log_window.message_block_view(target, [[id, block[4], $data_skills[block[2]].name, 0]]) return $data_skills[block[2]] } return item end #-------------------------------------------------------------------------- # ★ 行動反応追撃発動(拡張特徴ID53)(追加定義) #-------------------------------------------------------------------------- def invoke_reaction_attack(user, item, target) return if target.dead? group = user.friends_unit.members.select{|battler| battler != user} group.each{|battler| next if !battler.alive? or !battler.movable? battler.react_obj.each{|block| next if !battler.opposite?(target) && block[0] < 2 next if battler.opposite?(target) && block[0] == 2 next if rand(100) >= block[3] #命中タイプ取得 u_item_hit_type = user_item_hit_type(battler, item) case block[0] when 0 ; next if item.damage.element_id != block[1] when 1 ; next if u_item_hit_type != block[1] && block[1] != 3 end skill = $data_skills[block[2]] @log_window.message_block_view(battler, [[53, block[4], [battler.name, skill.name], 0]]) return if react_break_process(target, skill) skill.effects.each {|effect| battler.item_global_effect_apply(effect) } effect_adopter(battler, skill, [target]) @log_window.back_one break } } end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ★ トラップ発動(スキル能力ID18)(追加定義) #-------------------------------------------------------------------------- def invoke_trap(user, item, target) return if item.impossible_trap > rand(100) #トラップ無効スキルは処理しない return unless target.opposite?(user) # 味方には反撃しない list = target.ad_counter[3] #命中タイプ取得 u_item_hit_type = user.user_item_hit_type(user, item) list.each_with_index{|block, index| next if block[0] != 3 && block[0] != u_item_hit_type next if rand(100) >= block[1] trapper = block[6] skill = $data_skills[block[2]] @log_window.message_block_view(trapper, [[18, block[5], [skill.name], 2]]) skill.effects.each {|effect| trapper.item_global_effect_apply(effect) } effect_adopter(trapper, skill, [user]) list[index][3] -= 1 #回数消費 if list[index][3] == 0 target.erase_state(block[4]) if block[4] != 0 list[index] = nil end break } target.ad_counter[3].compact! end end