# # SP消費武器 #  (C)2007,2012 TYPE74RX-T # module RX_T #-------------------------------------------------------------------------- # ● 配列に指定名を含む属性があるか #-------------------------------------------------------------------------- def RX_T.check_element(el_set, state_name) result = false for i in 0...el_set.size if $data_system.elements[el_set[i]].include?(state_name) # 結果を真に result = true break end end return result end #-------------------------------------------------------------------------- # ● 配列に指定名を含む属性と数値があれば配列内の数値を返す #-------------------------------------------------------------------------- def RX_T.get_num_from_element(el_set, state_name) numeric = 1 for i in 0...el_set.size if $data_system.elements[el_set[i]].include?(state_name) # ステート名から数字を抜き出す numeric = $data_system.elements[el_set[i]].scan(/[\d\-]+/) # 抜き出した数字文字列を数値に変える numeric = numeric[0].to_i break end end return numeric end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ★ 行動できるか否かの判定(このスクリプト専用) #-------------------------------------------------------------------------- def rx_rgsss18_no_action? return (@active_battler.current_action.basic == 1 or @active_battler.current_action.basic == 3) end #-------------------------------------------------------------------------- # ● 基本アクション 結果作成 #-------------------------------------------------------------------------- alias rx_rgsss18_make_basic_action_result make_basic_action_result def make_basic_action_result #************************************************************************** # ★ 処理:SP を消費する武器を持っている時 #     武器の消費 SP がアクターの SP より大きければ #     行動できなくする(システム的には「何もしない」扱い) #************************************************************************** # 武器の消費 SP を初期化 rx_weapon_spcost = 0 # アクター側バトラーが SP 消費武器を持っていれば if @active_battler.is_a?(Game_Actor) if @active_battler.weapon_id != 0 and RX_T.check_element($data_weapons[@active_battler.weapon_id].element_set, "消費SP") # 消費 SP を取得 rx_weapon_spcost = RX_T.get_num_from_element($data_weapons[@active_battler.weapon_id].element_set, "消費SP") end # SP 切れなどで使用できなくなった場合 if @active_battler.sp < rx_weapon_spcost # 行動を「何もしない」状態にする @active_battler.current_action.basic = 3 else # SP 消費 @active_battler.sp -= rx_weapon_spcost unless rx_rgsss18_no_action? # ステータスウィンドウをリフレッシュ @status_window.refresh end end # メソッドを呼び戻す rx_rgsss18_make_basic_action_result end #-------------------------------------------------------------------------- # ● スキルアクション 結果作成 #-------------------------------------------------------------------------- alias rx_rgsss18_make_skill_action_result make_skill_action_result def make_skill_action_result #************************************************************************** # ★ 処理:SP を消費する武器を持っている時 #     スキルと武器の消費 SP と合算した値がアクターの SP より大きければ #     スキルを発動させなくする #************************************************************************** # 武器の消費 SP を初期化 rx_weapon_spcost = 0 # アクター側バトラーが SP 消費武器を持っていて # かつ、打撃系(腕力 F が1以上の)スキル攻撃なら if @active_battler.is_a?(Game_Actor) if @active_battler.weapon_id != 0 and RX_T.check_element($data_weapons[@active_battler.weapon_id].element_set, "消費SP") and $data_skills[@active_battler.current_action.skill_id].str_f > 0 # 消費 SP を取得 rx_weapon_spcost = RX_T.get_num_from_element($data_weapons[@active_battler.weapon_id].element_set, "消費SP") end # SP 切れなどで使用できなくなった場合(武器側とスキル側の消費 SP を合算) if @active_battler.sp < rx_weapon_spcost + $data_skills[@active_battler.current_action.skill_id].sp_cost # 強制アクションでなければ unless @active_battler.current_action.forcing # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end else # SP 消費(武器側) @active_battler.sp -= rx_weapon_spcost end end # メソッドを呼び戻す rx_rgsss18_make_skill_action_result end end