#============================================================================== # ■ VXAce-RGSS3-46-btd スタイルチェンジ(Battle-default) [Ver.1.0.1] by Claimh #------------------------------------------------------------------------------ # 戦闘画面上でスタイルチェンジできるようにします。 # ※デフォルト戦闘画面用です。 #------------------------------------------------------------------------------ # 戦闘スタイルの切替操作: # アクターコマンドWindow上で左右キー #============================================================================== #============================================================================== # ■ Window_ActorBattleStyle #============================================================================== class Window_ActorBattleStyle < Window_HorzCommand #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0) unselect self.top_col = 0 deactivate.close end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_ok end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return 128 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max @actor ? @actor.btl_style.num : 0 end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● 先頭の桁の設定 ※Window_HorzCommandバグ回避 #-------------------------------------------------------------------------- def top_col=(col) col = 0 if col < 0 col = (item_max / visible_line_number) - 1 if col > (item_max / visible_line_number) - 1 self.ox = col * (item_width + spacing) end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return unless @actor @actor.btl_style.classes_obj.each do |c| add_command(c.name, :ok, true, c.id) end end #-------------------------------------------------------------------------- # ● アイテムウィンドウの設定 #-------------------------------------------------------------------------- def item_window=(item_window) @item_window = item_window end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor open refresh unselect self.top_col = @actor.btl_style.class_ids.sort.index(@actor.class_id) end #-------------------------------------------------------------------------- # ● 次の戦闘スタイル #-------------------------------------------------------------------------- def cur_next self.top_col = (top_col + 1) % item_max if item_max > 1 end #-------------------------------------------------------------------------- # ● 前の戦闘スタイル #-------------------------------------------------------------------------- def cur_prev self.top_col = (top_col - 1 + item_max) % item_max if item_max > 1 end #-------------------------------------------------------------------------- # ● 現在のクラスID #-------------------------------------------------------------------------- def current_class_id @list[top_col][:ext] end #-------------------------------------------------------------------------- # ● 戦闘スタイル切り替え #-------------------------------------------------------------------------- def change_style(dir) top = top_col dir ? cur_next : cur_prev if top != top_col Sound.play_cursor @actor.change_class(current_class_id) end end end #============================================================================== # ■ Window_ActorCommand #============================================================================== class Window_ActorCommand < Window_Command attr_accessor :style_window # 戦闘スタイルWindow #-------------------------------------------------------------------------- # ● ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate @style_window.show if @style_window super end #-------------------------------------------------------------------------- # ● ウィンドウの非アクティブ化 #-------------------------------------------------------------------------- def deactivate @style_window.hide if @style_window super end #-------------------------------------------------------------------------- # ● ウィンドウを開く #-------------------------------------------------------------------------- def open @style_window.open if @style_window super end #-------------------------------------------------------------------------- # ● ウィンドウを閉じる #-------------------------------------------------------------------------- def close @style_window.close if @style_window super end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- alias cursor_right_style cursor_right def cursor_right(wrap = false) cursor_right_style(wrap) call_handler(:next_style) if wrap end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- alias cursor_left_style cursor_left def cursor_left(wrap = false) cursor_left_style(wrap) call_handler(:prev_style) if wrap end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● アクターコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_actor_command_window_style create_actor_command_window def create_actor_command_window create_actor_command_window_style @actor_style_window = Window_ActorBattleStyle.new @actor_style_window.x = @actor_command_window.x @actor_style_window.y = @info_viewport.rect.y - @actor_style_window.height #* 3 / 4 @actor_style_window.z = @actor_command_window.z + 10 @actor_command_window.set_handler(:next_style, method(:next_style)) @actor_command_window.set_handler(:prev_style, method(:prev_style)) @actor_command_window.style_window = @actor_style_window end #-------------------------------------------------------------------------- # ● 次の戦闘スタイル #-------------------------------------------------------------------------- def next_style @actor_style_window.change_style(true) @actor_command_window.refresh @status_window.redraw_item($game_party.battle_members.index(BattleManager.actor)) end #-------------------------------------------------------------------------- # ● 前の戦闘スタイル #-------------------------------------------------------------------------- def prev_style @actor_style_window.change_style(false) @actor_command_window.refresh @status_window.redraw_item($game_party.battle_members.index(BattleManager.actor)) end #-------------------------------------------------------------------------- # ● アクターコマンド選択の開始 #-------------------------------------------------------------------------- alias start_actor_command_selection_style start_actor_command_selection def start_actor_command_selection start_actor_command_selection_style @actor_style_window.actor = BattleManager.actor end #-------------------------------------------------------------------------- # ● 情報表示ビューポートの移動 #-------------------------------------------------------------------------- alias move_info_viewport_style move_info_viewport def move_info_viewport(ox) move_info_viewport_style(ox) @actor_style_window.x = Graphics.width - @info_viewport.ox end end