# # アクターの複数回行動 #  (C)2005,2006,2022 TYPE74RX-T # Bugfixed by (C)2022 みんと # # ★ 連続行動可能なステートを設定しているステートID #  (数値はお好みにより変更して下さい。) RX_T_CAS_ID = 17 # ★ 連続行動回数を設定(数値はお好みにより変更して下さい。) RX_T_CAS_FREQUENCY = 2 #============================================================================== # ★ RX_T_Continuous_Action_State #------------------------------------------------------------------------------ #  連続行動情報を扱うクラスです。 #============================================================================== class RX_T_Continuous_Action_State #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :times # 行動回数 attr_accessor :magic # スキルの連続攻撃か否か #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @times = 0 @magic = false end end #============================================================================== # ★ RX_T_ActorDoing #------------------------------------------------------------------------------ #  直前のターンに取った行動をコピーするクラスです。 #============================================================================== class RX_T_ActorDoing #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :name # バトラーの名前 attr_accessor :kind # 基本行動・スキルorアイテム行使の判別 attr_accessor :basic # 基本行動を選択した時の種別 attr_accessor :skill_id # スキル ID attr_accessor :item_id # アイテム ID attr_accessor :target # 対象キャラ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @name = "" @kind = 0 @basic = 0 @skill_id = 0 @item_id = 0 @target = 0 end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear @name = "" @kind = 0 @basic = 3 @skill_id = 0 @item_id = 0 @target = 0 end end #============================================================================== # ■ Bitmap #============================================================================== class Bitmap # ★ KAMESOFT様の縁取り・影文字描画スクリプトを適用していない場合 if $imported["FrameShadowText"] == nil #-------------------------------------------------------------------------- # ● 影文字描画 # x, y, width, height, string[, align, shadow_color] # rect, string[, align, shadow_color] #-------------------------------------------------------------------------- def draw_shadow_text(*args) draw_text(*args) end end end #============================================================================== # ■ Game_Battler (分割定義 1) #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :rx_current # 複数回行動フラグ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rgssb11_initialize initialize def initialize @rx_current = false rgssb11_initialize end #-------------------------------------------------------------------------- # ★ ステート有効ターン数の取得 #-------------------------------------------------------------------------- def rx_t_get_effective_turns(state) return @states_turn[state] end #-------------------------------------------------------------------------- # ● ステートの付加 # state_id : ステート ID # force : 強制付加フラグ (オートステートの処理で使用) #-------------------------------------------------------------------------- alias minto_rx_add_state add_state def add_state(state_id, force = false) # 元の処理を実行 minto_rx_add_state(state_id, force) # 行動不能の場合 unless movable? # アクションをクリア @current_action.clear if self.is_a?(Game_Actor) unless self.index.nil? # ループ処理 for i in 0...$rx_t_ad[self.index].size do $rx_t_ad[self.index][i].clear end end end end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ★ 複数回行動ステート判定 #-------------------------------------------------------------------------- def rx_t_current_act(battler) if battler.states.include?(RX_T_CAS_ID) and battler.rx_current return true else battler.rx_current = false return false end end #-------------------------------------------------------------------------- # ★ 行動回数を初期化 #-------------------------------------------------------------------------- def rx_t_initialise_actor_times @rx_t_actor_times = [] rx_t_cas_i = 0 for actor in $game_party.actors rx_t_cas = 1 if actor.states.include?(RX_T_CAS_ID) rx_t_cas = $rx_t_cas[RX_T_CAS_ID].times end @rx_t_actor_times[rx_t_cas_i] = rx_t_cas rx_t_cas_i += 1 end end #-------------------------------------------------------------------------- # ● フレーム更新 (パーティコマンドフェーズ) #-------------------------------------------------------------------------- alias rx_t_cas_update_phase2 update_phase2 def update_phase2 # ★ 逃走フラグを初期化 @rx_t_run_away = true # ★ 行動回数を初期化 rx_t_initialise_actor_times rx_t_cas_update_phase2 end #-------------------------------------------------------------------------- # ● アクターコマンドフェーズ開始 #-------------------------------------------------------------------------- alias rx_t_cas_start_phase3 start_phase3 def start_phase3 # ★ 逃走フラグをOFFに @rx_t_run_away = false rx_t_cas_start_phase3 end #-------------------------------------------------------------------------- # ● 次のアクターのコマンド入力へ #-------------------------------------------------------------------------- alias rx_t_cas_phase3_next_actor phase3_next_actor def phase3_next_actor if @actor_index != -1 # ★ アクターの行動を格納する #$rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].name = @active_battler.name $rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].kind = @active_battler.current_action.kind $rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].basic = @active_battler.current_action.basic $rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].skill_id = @active_battler.current_action.skill_id $rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].item_id = @active_battler.current_action.item_id $rx_t_ad[@actor_index][@rx_t_actor_times[@actor_index]].target = @active_battler.current_action.target_index if @rx_t_actor_times[@actor_index] > 1 and @active_battler.states.include?(RX_T_CAS_ID) @active_battler.rx_current = true @rx_t_actor_times[@actor_index] -= 1 # ★ 連続行動を全て終えるまで次のキャラに順番を送らない @actor_index -= 1 end end # 最後のアクターの場合 if @actor_index == $game_party.actors.size-1 and @rx_t_actor_times[@actor_index] <= 1 # ★ 行動回数を初期化 rx_t_initialise_actor_times end rx_t_cas_phase3_next_actor end #-------------------------------------------------------------------------- # ● 前のアクターのコマンド入力へ #-------------------------------------------------------------------------- alias rx_t_cas_phase3_prior_actor phase3_prior_actor def phase3_prior_actor # ★ 行動回数を初期化 rx_t_initialise_actor_times rx_t_cas_phase3_prior_actor end #-------------------------------------------------------------------------- # ● メインフェーズ開始 #-------------------------------------------------------------------------- alias rx_t_cas_start_phase4 start_phase4 def start_phase4 # ★ 逃走フラグが立っていない時 #  (逃走による不具合を防ぐ) unless @rx_t_run_away rx_t_cnt_i = 0 for actor in $game_party.actors rx_t_cas = 1 # ★ 連続行動フラグ持ちなら if rx_t_current_act(actor) # 連続行動 rx_t_cas = $rx_t_cas[RX_T_CAS_ID].times end # ★ 最初に取る行動を代入 #actor.name = $rx_t_ad[rx_t_cnt_i][rx_t_cas].name actor.current_action.kind = $rx_t_ad[rx_t_cnt_i][rx_t_cas].kind actor.current_action.basic = $rx_t_ad[rx_t_cnt_i][rx_t_cas].basic actor.current_action.target_index = $rx_t_ad[rx_t_cnt_i][rx_t_cas].target actor.current_action.skill_id = $rx_t_ad[rx_t_cnt_i][rx_t_cas].skill_id actor.current_action.item_id = $rx_t_ad[rx_t_cnt_i][rx_t_cas].item_id rx_t_cnt_i += 1 end end rx_t_cas_start_phase4 end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ) #-------------------------------------------------------------------------- alias rx_t_cas_update_phase4 update_phase4 def update_phase4 rx_t_cas_update_phase4 if @phase4_step == 7 update_phase4_step7 end if @phase4_step == 8 update_phase4_step8 end end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備) #-------------------------------------------------------------------------- alias rx_t_cas_update_phase4_step1 update_phase4_step1 def update_phase4_step1 rx_t_cas_update_phase4_step1 # ★規定ターン数で切れる連続行動ステートなら #  有効ターン数を取得 if @active_battler != nil @rx_acts_effective_turns = @active_battler.rx_t_get_effective_turns(RX_T_CAS_ID) end # ★ 行動者がアクターの場合 if @active_battler.is_a?(Game_Actor) # ★ 行動数の設定 @rx_t_acts = 1 if rx_t_current_act(@active_battler) @rx_t_acts = $rx_t_cas[RX_T_CAS_ID].times end end end #-------------------------------------------------------------------------- # ● 基本アクション 結果作成 #-------------------------------------------------------------------------- alias rx_t_cas_make_basic_action_result make_basic_action_result def make_basic_action_result # ★ コモンイベント ID を初期化 @common_event_id = 0 # ★ 基本行動が防御か何もしない場合 if @active_battler.current_action.basic == 1 or @active_battler.current_action.basic == 3 # アニメーションを初期化 @animation1_id = 0 @animation2_id = 0 end rx_t_cas_make_basic_action_result end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ) #-------------------------------------------------------------------------- alias rx_t_cas_update_phase4_step6 update_phase4_step6 def update_phase4_step6 rx_t_cas_update_phase4_step6 # 行動者がアクターの場合 if @active_battler.is_a?(Game_Actor) # ステップ 7 に移行 @phase4_step = 7 end end #-------------------------------------------------------------------------- # ★ フレーム更新 (メインフェーズ ステップ 7 : 連続行動可能時の行動設定) #-------------------------------------------------------------------------- def update_phase4_step7 if @rx_t_acts > 1 rx_t_i = 0 for actor in $game_party.actors if @active_battler.name == actor.name and rx_t_current_act(actor) break end rx_t_i += 1 end # 次の行動を代入 @active_battler.current_action.kind = $rx_t_ad[rx_t_i][@rx_t_acts - 1].kind @active_battler.current_action.basic = $rx_t_ad[rx_t_i][@rx_t_acts - 1].basic @active_battler.current_action.skill_id = $rx_t_ad[rx_t_i][@rx_t_acts - 1].skill_id @active_battler.current_action.item_id = $rx_t_ad[rx_t_i][@rx_t_acts - 1].item_id @active_battler.current_action.target_index = $rx_t_ad[rx_t_i][@rx_t_acts - 1].target # ステップ 8 に移行 @phase4_step = 8 else # ステップ 1 に移行 @phase4_step = 1 end end #-------------------------------------------------------------------------- # ★ フレーム更新 (メインフェーズ ステップ 8 : 全滅・行動終了判定) #-------------------------------------------------------------------------- def update_phase4_step8 # ★攻撃カウントを減らす @rx_t_acts -= 1 # ★まだ行動可能、かつ勝敗がついていない場合 if @rx_t_acts >= 1 and !judge # 連続行動ステートの最後の有効ターンで、かつ、連続行動最終回なら if @rx_t_acts == 1 and @rx_acts_effective_turns < 1 # 連続行動ステート解除 @active_battler.remove_state(RX_T_CAS_ID) end # ステップ 2 に移行 @phase4_step = 2 # ★それ以外の場合 else # ステップ 1 に移行 @phase4_step = 1 end end end class Scene_Title #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- alias rx_t_cas_main main unless $! def main # ★ KAMESOFT様の多人数パーティを適用しているか kame_lpt = KGC::LargeParty::MAX_BATTLE_MEMBER != nil rx_cas_battle_members = kame_lpt ? KGC::LargeParty::MAX_BATTLE_MEMBER : RX_T_CAS_FREQUENCY+1 # ★ アクターの行動データを初期化 rx_t_i = rx_t_j = 0 $rx_t_ad = nil $rx_t_ad = [] for i in 0..rx_cas_battle_members $rx_t_ad.push([]) end for rx_t_i in 0..rx_cas_battle_members for rx_t_j in 0..RX_T_CAS_FREQUENCY $rx_t_ad[rx_t_i][rx_t_j] = RX_T_ActorDoing.new end end $rx_t_cas = [] $rx_t_cas[RX_T_CAS_ID] = RX_T_Continuous_Action_State.new $rx_t_cas[RX_T_CAS_ID].times = RX_T_CAS_FREQUENCY rx_t_cas_main end end