# # 似非オートバトル #  (C)2005 TYPE74RX-T # #============================================================================== # ★ 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 end class Window_PartyCommand < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = 160 @commands = ["戦う", "逃げる", "オート"] @item_max = 3 @column_max = 3 draw_item(0, normal_color) draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color) draw_item(2, normal_color) self.active = false self.visible = false self.index = 0 end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # color : 文字色 #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], 1) end #-------------------------------------------------------------------------- # ● カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(80 + index * 160, 0, 128, 32) end end #============================================================================== # ■ Scene_Title #------------------------------------------------------------------------------ #  タイトル画面の処理を行うクラスです。 #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- alias rx_t_autobt_main main def main # ★ アクターの行動データを初期化 rx_t_i = 0 $rx_t_ad = nil $rx_t_ad = [] for rx_t_i in 0..3 $rx_t_ad[rx_t_i] = RX_T_ActorDoing.new end rx_t_autobt_main end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- alias rx_t_autobt_main main def main # ★ パーティーが入れ替わっていないかチェック rx_t_act = 0 rx_t_action_remake = false for actor in $game_party.actors # パーティーが入れ替わっていたら if actor.name != $rx_t_ad[rx_t_act].name # 直前のターンに取っていたパーティーの行動を初期化するフラグを立てる rx_t_action_remake = true end rx_t_act += 1 end # ★パーティーが入れ替わっていたら # 直前のターンに取っていたパーティーの行動を初期化する if rx_t_action_remake rx_t_i = 0 $rx_t_ad = nil $rx_t_ad = [] for rx_t_i in 0..3 $rx_t_ad[rx_t_i] = RX_T_ActorDoing.new end end rx_t_autobt_main end #-------------------------------------------------------------------------- # ● フレーム更新 (パーティコマンドフェーズ) #-------------------------------------------------------------------------- def update_phase2 # ★ 逃走フラグを初期化 @rx_t_run_away = true # C ボタンが押された場合 if Input.trigger?(Input::C) # パーティコマンドウィンドウのカーソル位置で分岐 case @party_command_window.index when 0 # 戦う # ★ 逃走フラグをオフに @rx_t_run_away = false # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクターコマンドフェーズ開始 start_phase3 when 1 # 逃げる # 逃走可能ではない場合 if $game_temp.battle_can_escape == false # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 逃走処理 update_phase2_escape when 2 # ★ オート # ★ 逃走フラグをオフに @rx_t_run_away = false # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ★ 戦闘開始 start_phase4 end return end end #-------------------------------------------------------------------------- # ● アクターコマンドフェーズ開始 #-------------------------------------------------------------------------- alias rx_t_autobt_start_phase3 start_phase3 def start_phase3 # ★ 逃走フラグを初期化 @rx_t_run_away = false rx_t_autobt_start_phase3 end #-------------------------------------------------------------------------- # ● 次のアクターのコマンド入力へ #-------------------------------------------------------------------------- alias rx_t_autobt_phase3_next_actor phase3_next_actor def phase3_next_actor @rx_t_command_flag = true rx_t_autobt_phase3_next_actor end #-------------------------------------------------------------------------- # ● メインフェーズ開始 #-------------------------------------------------------------------------- alias rx_t_autobt_start_phase4 start_phase4 def start_phase4 rx_t_act = 0 # ★ コマンド入力していれば if @rx_t_command_flag @rx_t_command_flag = false # ★ アクターの行動を格納する for actor in $game_party.actors $rx_t_ad[rx_t_act].name = actor.name $rx_t_ad[rx_t_act].kind = actor.current_action.kind $rx_t_ad[rx_t_act].basic = actor.current_action.basic $rx_t_ad[rx_t_act].skill_id = actor.current_action.skill_id $rx_t_ad[rx_t_act].item_id = actor.current_action.item_id $rx_t_ad[rx_t_act].target = actor.current_action.target_index rx_t_act += 1 end else unless @rx_t_run_away # ★ 前ターンのアクターの行動を読み込む for actor in $game_party.actors actor.current_action.kind = $rx_t_ad[rx_t_act].kind actor.current_action.basic = $rx_t_ad[rx_t_act].basic actor.current_action.skill_id = $rx_t_ad[rx_t_act].skill_id actor.current_action.item_id = $rx_t_ad[rx_t_act].item_id actor.current_action.target_index = $rx_t_ad[rx_t_act].target rx_t_act += 1 end end end rx_t_autobt_start_phase4 end end