# ▽△▽ XRXSv9. BaST-VX.EG3. ターンシフトエンジン+フリークイック ▽△▽ # # publish 2011/ 2/xx # update - 2/16 β # # # [バトルコマンド設定] #  このエンジンでは「ターン終了」コマンドが必須です。 #  (推奨)パーティスキル・クイックコマンド # #============================================================================== # カスタマイズポイント - BaST本体 #============================================================================== module XRXSV9 # # [用語] # EGTurnStart_S = "%sのターン!" EGTurnStart_D = 24 # # アクション待ちのために表示するウェイトバー(Graphics/System) # CounterTimeS = "BattleCounterTimeS" CounterTimeBar = "BattleCounterTimeBar" CounterTimeX = 272 CounterTimeY = 128 CounterTimeDuration = 90 end module Vocab # # トルームネーム # TroopName = "%sたち" end #============================================================================== # 使用タイミング限定 #============================================================================== module XRXSV9EG3_InTurnSkill def skill_can_use?(skill) b = super(skill) b = false if skill.power_reset and skill.scope == 11 and self.power_increase_turn == 0 return b end end class Game_Actor < Game_Battler include XRXSV9EG3_InTurnSkill end #============================================================================== # アイテム・スキルの追加効果 #============================================================================== module XRXSV9_UsableItemOccasionBan def usable_in_turn return false if self.note[/\\out_turn/] return true end def usable_out_turn return false if self.note[/\\in_turn/] return true end def usable_only_at_attack return self.note[/\\at_attack/] end def power_reset return self.note[/\\powreset/] end def deattack return self.note[/\\at_attack_guard/] end def free_quick? return self.note[/\\quick_free/] end def need_set? return self.note[/\\need_set/] end def settable? return (self.note[/\\settable/] or need_set?) end def more_summon return self.note[/\\more_summon/] end def elementic_turn n = 0 self.note.gsub(/\\elementric\[([0-9]+?)\]/) do n = $1.to_i end return n end def battle_ok? return false if self.usable_only_at_attack and $game_temp.battle_timing_type != 1 return false if not self.usable_in_turn and $game_temp.turn_shift return false if not self.usable_out_turn and !$game_temp.turn_shift return false if self.more_summon and not $game_temp.link_done return super end end class RPG::Skill include XRXSV9_UsableItemOccasionBan end class RPG::Item include XRXSV9_UsableItemOccasionBan end #============================================================================== # カウンタータイムスプライト #============================================================================== class Sprite_CounterTime < Sprite_Base def initialize super() self.bitmap = Cache.system(XRXSV9::CounterTimeS) self.x = XRXSV9::CounterTimeX self.y = XRXSV9::CounterTimeY self.oy = 10 self.ox = self.bitmap.width / 2 @bat_sprite = Sprite_Base.new() @bat_sprite.bitmap = Cache.system(XRXSV9::CounterTimeBar) @bat_sprite.ox = @bat_sprite.bitmap.width / 2 @bat_sprite.oy = @bat_sprite.bitmap.height / 2 @bat_sprite.x = self.x @bat_sprite.y = self.y + 2 @count = XRXSV9::CounterTimeDuration update end def moving? return (@count >= 1) end def update super if @count >= 1 @count -= 1 @count -= 5 if Input.press?(Input::B) @count = 0 if @count < 0 case @count when 0..5 @bat_sprite.zoom_x = (6 - @count) / 12.0 @bat_sprite.zoom_y = @count / 8.0 else @bat_sprite.zoom_x = 1.0 * @count / XRXSV9::CounterTimeDuration end end end def dispose @bat_sprite.dispose super end end #============================================================================== # ■ アクターコマンド #============================================================================== class Window_ActorCommand < Window_Command def setup_quickguard @command_ids = [6] @commands = [XRXSV9::S_QUICK] @item_max = @commands.size @quick_one_mode = true refresh self.index = 0 self.active = true self.open end end #============================================================================== # コマンド可能アクターリストポップアップ #============================================================================== class Window_CommandableActorList < Window_Selectable def initialize(x, y) super(x, y, 160, $game_party.members.size * WLH + 32) refresh end def refresh self.contents.clear @item_max = $game_party.members.size w = self.contents.width y = 0 for actor in $game_party.members self.contents.font.color.alpha = (enable?(actor) ? 255 : 128) self.contents.draw_text(0, y, w, WLH, actor.name) y += WLH end self.index = 0 self.active = true end def enable?(actor) return (actor.inputable? and not actor.commanded) end def actor return $game_party.members[self.index] end end #============================================================================== # コマンド確認ウィンドウを一部無効化 #============================================================================== class Window_ActorCommandSet < Window_Base if XRXSV9::CommandSetVisible def draw_actor(actor) self.contents.clear self.visible = false end end end #============================================================================== # トループネーム(パーティネームから転用) #============================================================================== class Game_Troop < Game_Unit def name if @enemies.size == 0 return '' elsif @enemies.size == 1 return members[0].name else return sprintf(Vocab::TroopName, members[0].name) end end end #============================================================================== # BaST - コマンドストリーム #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # エンジン対応(本体機能の上書き) #-------------------------------------------------------------------------- def command_rights_user(action) return action.battler end def make_actor_auto_actions end def prior_actor end #-------------------------------------------------------------------------- # フレーム更新 - カウント/コマンドストリーム #-------------------------------------------------------------------------- def update_basic_stream case @phase when 2 update_stream_count else #when 3 update_stream_command end end #-------------------------------------------------------------------------- # フレーム更新 - カウントストリーム(ターンスタートフェイズ) #-------------------------------------------------------------------------- def update_stream_count process_turn_start_phase # ターンスタートフェイズ process_standby_phase # スタンバイフェイズクリア process_draw_phase # ドローフェイズ process_start_main_phase # メインフェイズへ移行させる処理 end #-------------------------------------------------------------------------- # 敵味方分岐してメインフェイズの開始処理 #-------------------------------------------------------------------------- def process_start_main_phase if $game_temp.turn_shift # # プレイヤーターンの開始 # $game_party.slip_damage_effect @status_window.refresh for actor in $game_party.members actor.commanded = false end battlermotion_reset @actor_index = -1 next_actor else # # エネミーターンの開始 # $game_troop.slip_damage_effect for enemy in $game_troop.members enemy.commanded = false end battlermotion_reset make_auto_actions start_main end end #-------------------------------------------------------------------------- # ターンスタートフェイズの処理 #-------------------------------------------------------------------------- def process_turn_start_phase @phase = 3 unit = ($game_temp.turn_shift ? $game_party : $game_troop) text = sprintf(XRXSV9::EGTurnStart_S, unit.name) @message_window.add_instant_text(text) #wait(XRXSV9::EGTurnStart_D) end #-------------------------------------------------------------------------- # ドローフェイズの処理 #-------------------------------------------------------------------------- def process_draw_phase if $game_temp.turn_shift # リキャストカウント $game_party.recast_count! # se = false for obj in ($game_temp.last_recasts rescue []) case obj when Material text = obj.item.name + "のチャージが完了した!" when Game_Actor text = obj.name + "が目を覚ました!" end @message_window.add_instant_text(text) se = true end Sound.play_use_item if se end wait(XRXSV9::EGTurnStart_D) end #-------------------------------------------------------------------------- # フレーム更新 - コマンドストリーム #-------------------------------------------------------------------------- def update_stream_command update_command end #-------------------------------------------------------------------------- # コマンド不可能状態 #-------------------------------------------------------------------------- def actor_command_stop? return !$game_temp.turn_shift end def enemy_command_stop? return $game_temp.turn_shift end #-------------------------------------------------------------------------- # コマンドした行動を実行に移す判定 #-------------------------------------------------------------------------- def action_start? return @active_actions.size >= 1 end #-------------------------------------------------------------------------- # アクターコマンド判定サーチ(強制的に先頭アクター) #-------------------------------------------------------------------------- def actor_command_seach(n, command_deciding, command_canceling) actor_command_close if action_start? allclear_power start_main return end @active_battler = party_top_member @actor_index = @active_battler.index xcam_turn_refresh wait_for_xcam battler_power_initialize if defined? battler_power_initialize start_actor_command_selection end def party_top_member result = $game_party.members[0] for actor in $game_party.members if actor.inputable? result = actor break end end return result end #-------------------------------------------------------------------------- # 「にげる」コマンドの処理 #-------------------------------------------------------------------------- def process_escape_command actor_command_close process_escape process_turn_end_command if @phase <= 4 end #-------------------------------------------------------------------------- # 戦闘行動の実行前 #-------------------------------------------------------------------------- def start_main_ok? return true end #-------------------------------------------------------------------------- # ターンエンドコマンド #-------------------------------------------------------------------------- def process_turn_end_command actor_command_close turn_end_process2 end #-------------------------------------------------------------------------- # クイックコマンドによる行動後、コマンド更新に戻る #-------------------------------------------------------------------------- def back_to_command_from_quick quick_off! case @phase when 4 start_quick_one_command else @actor_index -= 1 actor_command_seach(1, false, false) end end #-------------------------------------------------------------------------- # ● ターン終了 *(予約アクション終了 に相当、ターンシフトしない) #-------------------------------------------------------------------------- def turn_end if $game_temp.turn_shift @phase = 3 $game_temp.battle_phase = true actor_command_seach(1,true,false) else turn_end_process2 end end #-------------------------------------------------------------------------- # ターン終了2 - ターンシフトする #-------------------------------------------------------------------------- def turn_end_process2 allclear_power battlejump_back if $game_temp.turn_shift $game_party.do_auto_recovery @status_window.refresh end $game_troop.increase_turn $game_troop.preemptive = false $game_troop.surprise = false process_turn_end_battle_event start_party_command_selection end #-------------------------------------------------------------------------- # コマンド済み状態の解除とCP更新 #-------------------------------------------------------------------------- def active_battler_uncommanded unless @quick_mode if @active_action.orderer and @active_action.orderer != @active_battler @active_action.orderer.cp_reset else @active_battler.cp_reset end end end #-------------------------------------------------------------------------- # クイックコマンドだけのコマンドを展開 #-------------------------------------------------------------------------- def process_before_execute_action return if @quick_mode start_quick_one_command end def start_quick_one_command @commanding_action = Game_BattleAction.new(party_top_member) @actor_index = @commanding_action.battler.index @actor_command_window.setup_quickguard end #-------------------------------------------------------------------------- # ガード入力/クイックコマンド用待機時間 #-------------------------------------------------------------------------- def wait_for_counter_time(targets) return if @quick_time if @active_battler.action.skill and @active_battler.action.skill.base_damage >= 1 #$game_temp.attack_start_step = true end if @active_action.attack? or (@active_action.skill and @active_action.skill.base_damage >= 1) @counter_time_sprite = Sprite_CounterTime.new while @counter_time_sprite.moving? update_basic @counter_time_sprite.update end @counter_time_sprite.dispose @counter_time_sprite = nil end end end #============================================================================== # バトル用ウィンドウ - クイックコマンド のセット有効化 #============================================================================== class Window_BattleQuick < Window_BattlePartyAction def enable?(item) return (super or item.settable?) end def enable_skill?(actor, skill) return (super or skill.settable?) end end class Game_Battler attr_accessor :elementic_turn end #============================================================================== # -- 行動者選択コマンド機能 --- #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● アクターコマンド選択の更新 * #-------------------------------------------------------------------------- def update_actor_list_command if @actorlist_window @actorlist_window.update if Input.trigger?(Input::B) Sound.play_cancel @actorlist_window.dispose @actorlist_window = nil @actor_command_window.active = true elsif Input.trigger?(Input::C) if @actorlist_window.enable?(@actorlist_window.actor) #last_active_battler = @active_battler #last_actor_index = @actor_index @active_battler = @actorlist_window.actor @actor_index = @actorlist_window.actor.index @actorlist_window.dispose @actorlist_window = nil @actor_command_window.active = true @commanding_action = @active_battler.action process_actor_command_selection #@active_battler = last_active_battler #@actor_index = last_actor_index else Sound.play_buzzer end end end end def update_actor_command_selection if Input.trigger?(Input::C) case @actor_command_window.command_id when 0, 1, 2, 4, 5 Sound.play_decision x = @actor_command_window.x + 64 y = [@actor_command_window.y + @actor_command_window.cursor_rect.y, Graphics.height - 32 - $game_party.members.size * 24].min @actorlist_window = Window_CommandableActorList.new(x, y) @actorlist_window.z = @actor_command_window.z + 3 @actor_command_window.active = false return end end process_actor_command_selection end end