# ▽△▽ XRXSv9. BaST-VX.EG1. ATBエンジン ▽△▽ # # publish 2010/ 4/12 # update - 11/ 1/12a # #============================================================================== # カスタマイズポイント - BaST本体 #============================================================================== module XRXSV9 # # 【ATBモード】 # 0 : フルアクティブ  ATB (FF6,7,9方式) # 1 : アクションウェイトATB (FF4,5,8方式) # 2 : コマンド決定待ち ATB # ATBMODE = 0 # # バトルスピード関係(低いほど速い) # CPBaseWait = 256 # 通常待機時間係数 CPAGIBase = 70 # すばやさ基準 (ゲーム中盤の平均的なすばやさに設定する) # # 全員待機時 何倍速にする?(オプションで無効化できます) # CPFastCount = 3 # # 実行ウェイト(低いほど速く発動) # ・通常攻撃 - 「ターン内先制」武器は通常攻撃ウェイト0。 # ・スキル - 下の値から「速度補正値」を引きます。 #  ・アイテム #  ・逃げる # CPAWAttack = 5 CPAWSkill = 20 CPAWItem = 10 CPAWEscape = 10 # # コマンドオープン時CP停止時間(FF5方式)[単位:F] # CommandOpenWait = 0 # # スリップダメージ/HPMP自動回復のタイミング # false : ターンコントローラーの行動直後に全員 # true : 個別に行動後 # OneSlipStep = true end #============================================================================== # システム追加機能 #============================================================================== class Game_System attr_accessor :battle_atbrate attr_accessor :battle_atbrapidban def battle_atbrate return (@battle_atbrate ? @battle_atbrate : 1) end end #============================================================================== # 魔法?の判定 #============================================================================== class Game_BattleAction def magic_skill? return (self.skill? ? (self.skill.spi_f >= 1) : false) end end #============================================================================== # CP機能 #============================================================================== class Game_Battler attr_accessor :cp def cst #詠唱速度 return 10 end def cp_per48 return cp_per96 / 2 end def cp_per96 return 0 if self.dead? return 96 if self.cp_max? return [self.cp / 4, 0].max end def cp_countup! unless self.cp_max? if @cp_wait_count.to_i > 0 @cp_wait_count -= 1 else self.cp += @cp_speed @cp_wait_count = @cp_wait_speed end end end def cp_reset @cp_wait_count = 0 cp_speed_evaluate self.cp = @cp_offset end def cp_speed_evaluate if not self.commanded n = ($game_system.battle_atbrate * XRXSV9::CPBaseWait).to_i n = n * (2 * XRXSV9::CPAGIBase) / (XRXSV9::CPAGIBase + self.agi) elsif self.action.skill cast_speed = (self.action.magic_skill? ? self.cst : 10) n = [(XRXSV9::CPAWSkill - self.action.skill.speed) * 40 / (30 + cast_speed), 1].max elsif self.action.item? n = [(XRXSV9::CPAWItem - self.action.item.speed), 1].max elsif self.action.attack? n = (self.fast_attack ? 0 : XRXSV9::CPAWAttack) elsif self.action.escape? n = XRXSV9::CPAWEscape else n = 1 end n *= 2 if n >= 192 @cp_wait_speed = (n / 96 - 1) n /= (@cp_wait_speed + 1) end n = 1 if n == 0 @cp_speed = 384 / n @cp_offset = (384 - n * @cp_speed) @cp_last_agi = self.agi end def cp_speed_refresh if @cp_last_agi != self.agi and !self.commanded cp_speed_evaluate end end def cp_max? return (self.cp.to_i >= 384) end def cp_leadoff? return false end def cp_nillize @cp = nil @cp_offset = nil @cp_last_agi = nil @cp_speed = nil @cp_wait_speed = nil @cp_wait_count = nil end def cp_random_start self.cp += rand(96) + 96 * self.agi / XRXSV9::CPAGIBase end end class Game_Actor < Game_Battler def cp_random_start self.cp_reset if $game_troop.preemptive self.cp = 382 elsif $game_troop.surprise # else super end end end class Game_Enemy < Game_Battler def cp_random_start self.cp_reset if $game_troop.preemptive # elsif $game_troop.surprise self.cp = 382 else super end end end module XRXSV9EG_CPInitializing def battler_initialize super self.cp_reset end end class Game_Actor < Game_Battler include XRXSV9EG_CPInitializing end #============================================================================== # 行動スピード * #============================================================================== class Game_BattleAction def make_speed @speed = 0 end end #============================================================================== # BaST - 基本戦闘進行処理 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # CPの初期化 #-------------------------------------------------------------------------- def cp_initialize for member in self.members member.cp_random_start end max_cp = 0 for member in self.members max_cp = member.cp if max_cp < member.cp end n = [382 - max_cp, 0].max for member in self.members member.cp += n end for member in self.members member.cp = 384 if member.cp_leadoff? end end def start_cp @cp_active = true $game_troop.preemptive = false $game_troop.surprise = false end def cp_start_actor_command XRXSV9::CommandPopSE.play @cp_command_open_wait_count = XRXSV9::CommandOpenWait unless @cp_command_open_wait_count @cp_spriteset.refresh end def cp_command_done(action) action.battler.cp_reset unless @quick_mode @cp_command_open_wait_count = nil end #-------------------------------------------------------------------------- # フレーム更新 - カウント/コマンドストリーム #-------------------------------------------------------------------------- def update_basic_stream update_stream_count update_stream_command if @cp_active end end #============================================================================== # BaST - コマンドストリーム #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # フレーム更新 - コマンドストリーム #-------------------------------------------------------------------------- def update_stream_command make_auto_actions if @active_battler == nil actor_command_seach(1, false, false) elsif @active_battler.inputable? update_command else # コマンド中に行動不能になった/元々コマンド不能 の判定 end_all_selection @active_battler.commanded = false actor_command_seach(1, false, false) end end #-------------------------------------------------------------------------- # ● 前のアクターのコマンド入力へ * #-------------------------------------------------------------------------- def prior_actor end #-------------------------------------------------------------------------- # 防御コマンドの実行 #-------------------------------------------------------------------------- def do_guard_command @active_battler.action.clear @active_battler.guarding = true @active_battler.cp_reset @cp_spriteset.refresh(@active_actions + @charging_actions) if XRXSV9::OneSlipStep @active_battler.slip_damage_effect @active_battler.do_auto_recovery remove_states_auto @status_window.refresh @cp_command_open_wait_count = nil end @active_battler = nil @commanding_action = nil actor_command_seach(1, false, false) end #-------------------------------------------------------------------------- # コマンドした行動を実行に移す判定 #-------------------------------------------------------------------------- def action_start? return true end #-------------------------------------------------------------------------- # コマンド切り替え #-------------------------------------------------------------------------- def update_actor_command_selection_ex if Input.trigger?(Input::Y) or Input.trigger?(Input::RIGHT) actor_command_seach(1, false, false) elsif Input.trigger?(Input::LEFT) actor_command_seach(-1, false, false) end end end #============================================================================== # BaST - カウントストリーム #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # フレーム更新 - カウントストリーム #-------------------------------------------------------------------------- def update_stream_count if @cp_command_open_wait_count.to_i >= 1 @cp_command_open_wait_count -= 1 elsif @quick_mode # elsif self.cp_active? cp_countup! if (@phase == 2 and @commanding_action == nil) and not $game_system.battle_atbrapidban (XRXSV9::CPFastCount - 1).times do cp_countup! end end end end def cp_countup! for member in self.members member.cp_countup! end end #-------------------------------------------------------------------------- # CP稼動判定 #-------------------------------------------------------------------------- case XRXSV9::ATBMODE when 0,2 def cp_active? return @cp_active end when 1 def cp_active? return ((@phase == 2 or @phase == 3) and @cp_active) end end end #============================================================================== # BaST - アクションストリーム #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # アクション実行判定 #-------------------------------------------------------------------------- case XRXSV9::ATBMODE when 2 def update_action? return ([2,3,4].include?(@phase) and @commanding_action == nil) end else def update_action? return [2,3,4].include?(@phase) end end #-------------------------------------------------------------------------- # ● 行動順序作成 * #-------------------------------------------------------------------------- def make_action_orders @charging_actions.sort! do |a,b| b.battler.cp - a.battler.cp end end #-------------------------------------------------------------------------- # ● ターン終了 * #-------------------------------------------------------------------------- def turn_end_process2 start_party_command_selection end def start_party_command_selection @phase = 2 end #-------------------------------------------------------------------------- # ● 戦闘行動の処理 #-------------------------------------------------------------------------- alias xrxsv9eg1_process_action process_action def process_action xrxsv9eg1_process_action b = ((@active_battler == $game_troop.members[0]) and not $game_troop.interpreter.running?) process_turn_ending(b) for battler in self.members battler.cp_speed_refresh end end if XRXSV9::OneSlipStep def process_turn_ending(turn_ending) if turn_ending $game_troop.increase_turn process_turn_end_battle_event end if @active_battler @active_battler.slip_damage_effect @active_battler.do_auto_recovery @status_window.refresh end end else def process_turn_ending(turn_ending) if turn_ending $game_troop.increase_turn process_slip_recover process_turn_end_battle_event end end end end