#============================================================================== # ■ VXAce-RGSS3-31 和風レイアウト by Claimh #------------------------------------------------------------------------------ # バトル画面変更 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ● 背景色の取得 #-------------------------------------------------------------------------- def back_color Color.new(255, 255, 255, back_opacity) end #-------------------------------------------------------------------------- # ● 背景の不透明度を取得 #-------------------------------------------------------------------------- def back_opacity return 164 end end class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● 敵キャラ名の後ろにつける文字の表 #-------------------------------------------------------------------------- LETTER_TABLE_FULL = ['ノ壱','ノ弐','ノ参','ノ肆','ノ伍', 'ノ陸','ノ漆','ノ捌','ノ玖','ノ拾'] end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Actor < Game_Battler attr_reader :r_st # 戦闘時のステートルーレット #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- alias setup_rst setup def setup(actor_id) setup_rst(actor_id) @r_st = FvRouletStates.new(self) end end #============================================================================== # ■ FvRouletStates #============================================================================== class FvRouletStates WAIT = 40 # 切り替えタイミング(frame) #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor) reset_states(actor) end #-------------------------------------------------------------------------- # ● ステート情報リセット #-------------------------------------------------------------------------- def reset_states(actor) act_sts = actor.states.select {|s| s.icon_index != 0} return false if act_sts == @states @states = act_sts @index = 0 @wait = WAIT true end #-------------------------------------------------------------------------- # ● ステート情報切り替え #-------------------------------------------------------------------------- def next_state @index = (@index + 1) % @states.size @wait = WAIT true end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update(actor) return true if reset_states(actor) return false if @states.size < 2 @wait -= 1 return next_state if @wait == 0 false end #-------------------------------------------------------------------------- # ● アイコンIndex #-------------------------------------------------------------------------- def icon_index return 0 if @states.empty? @states[@index].icon_index end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● マップ画面を加工した戦闘背景用ビットマップの作成 #-------------------------------------------------------------------------- def create_blurry_background_bitmap source = SceneManager.background_bitmap bitmap = Bitmap.new(640, 480) bitmap.stretch_blt(bitmap.rect, source, source.rect) #~ bitmap.radial_blur(120, 16) bitmap.blur bitmap end end #============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_J_BattleStatus < Window_J_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, window_height) refresh self.openness = 0 end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def item_width base_contents_width / visible_line_number end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width Graphics.width - 128 end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height fitting_height(visible_line_number) end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 4 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max $game_party.battle_members.size end #-------------------------------------------------------------------------- # ● HP/MP/TPの行の高さ取得 #-------------------------------------------------------------------------- def gauge_line_height return 18 end #-------------------------------------------------------------------------- # ● 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing return 0 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_all_items end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.battle_members[index] draw_basic_area(basic_area_rect(index), actor) draw_gauge_area(gauge_area_rect(index), actor) end #-------------------------------------------------------------------------- # ● 基本エリアの矩形を取得 #-------------------------------------------------------------------------- def basic_area_rect(index) rect = item_rect(index) rect.height -= gauge_area_height rect end #-------------------------------------------------------------------------- # ● ゲージエリアの矩形を取得 #-------------------------------------------------------------------------- def gauge_area_rect(index) rect = item_rect(index) rect.y += contents_height - gauge_area_height - 8 rect.height = gauge_area_height rect.width -= 24 rect end #-------------------------------------------------------------------------- # ● ルーレットステートの描画矩形 #-------------------------------------------------------------------------- def rst_area_rect(index) r= basic_area_rect(index) Rect.new(r.x+r.width-24, contents_height - 24, 24, 24) end #-------------------------------------------------------------------------- # ● ゲージエリアの高さを取得 #-------------------------------------------------------------------------- def gauge_area_height return (gauge_line_height * ($data_system.opt_display_tp ? 3 : 2)) end #-------------------------------------------------------------------------- # ● 基本エリアの描画 #-------------------------------------------------------------------------- def draw_basic_area(rect, actor) draw_actor_face(actor, rect.x+2, rect.y+2, !actor.dead?) x = rect.x + rect.width - line_width draw_actor_name(actor, x, rect.y, item_height) draw_roulet_st(actor, actor.index) end #-------------------------------------------------------------------------- # ● ゲージエリアの描画 #-------------------------------------------------------------------------- def draw_gauge_area(rect, actor) if $data_system.opt_display_tp draw_gauge_area_with_tp(rect, actor) else draw_gauge_area_without_tp(rect, actor) end end #-------------------------------------------------------------------------- # ● ゲージエリアの描画(TP あり) #-------------------------------------------------------------------------- def draw_gauge_area_with_tp(rect, actor) @jmode = false draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 0, rect.width) draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width) draw_actor_tp(actor, rect.x, rect.y + gauge_line_height * 2, rect.width) @jmode = true end #-------------------------------------------------------------------------- # ● ゲージエリアの描画(TP なし) #-------------------------------------------------------------------------- def draw_gauge_area_without_tp(rect, actor) @jmode = false draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width) draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 2, rect.width) @jmode = true end #-------------------------------------------------------------------------- # ● 名前の描画 #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y, height = 112) change_color(hp_color(actor)) draw_text(x, y, line_width, height, actor.name) end #-------------------------------------------------------------------------- # ● アクターの顔グラフィック描画 #-------------------------------------------------------------------------- def draw_actor_face(actor, x, y, enabled = true) bitmap = Cache.face(actor.face_name) rect = Rect.new(actor.face_index % 4 * 96 + 14, actor.face_index / 4 * 96 + 30, 96-26, 32) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end #-------------------------------------------------------------------------- # ● ルーレットステート描画 #-------------------------------------------------------------------------- def draw_roulet_st(actor, index) return if actor.r_st.icon_index == 0 rect = rst_area_rect(index) draw_icon(actor.r_st.icon_index, rect.x, rect.y) end #-------------------------------------------------------------------------- # ● ルーレットステート再描画 #-------------------------------------------------------------------------- def redraw_roulet_st(actor, index) contents.clear_rect(rst_area_rect(index)) draw_roulet_st(actor, index) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super $game_party.battle_members.each do |actor| redraw_roulet_st(actor, actor.index) if actor.r_st.update(actor) end end end #============================================================================== # ■ Window_J_BattleActor #------------------------------------------------------------------------------ #  バトル画面で、行動対象のアクターを選択するウィンドウです。 #============================================================================== class Window_J_BattleActor < Window_J_BattleStatus #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(info_viewport) super() self.y = info_viewport.rect.y self.visible = false self.openness = 255 @info_viewport = info_viewport end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show if @info_viewport width_remain = Graphics.width - width self.x = width_remain @info_viewport.rect.width = width_remain select(0) end super end #-------------------------------------------------------------------------- # ● ウィンドウの非表示 #-------------------------------------------------------------------------- def hide @info_viewport.rect.width = Graphics.width if @info_viewport super end end #============================================================================== # ■ Window_J_PartyCommand #------------------------------------------------------------------------------ #  バトル画面で、戦うか逃げるかを選択するウィンドウです。 #============================================================================== class Window_J_PartyCommand < Window_J_Command #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0) self.openness = 0 deactivate end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width fitting_width(visible_line_number) end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height fitting_width(4) end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 2 end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::fight, :fight) add_command(Vocab::escape, :escape, BattleManager.can_escape?) end #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- def setup clear_command_list make_command_list refresh select(0) activate open end end #============================================================================== # ■ Window_J_ActorCommand #------------------------------------------------------------------------------ #  バトル画面で、アクターの行動を選択するウィンドウです。 #============================================================================== class Window_J_ActorCommand < Window_J_Command #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0) self.openness = 0 deactivate @actor = nil end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width fitting_width(visible_line_number) end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height fitting_width(4) end #-------------------------------------------------------------------------- # ● 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 4 end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return unless @actor add_attack_command add_skill_commands add_guard_command add_item_command end #-------------------------------------------------------------------------- # ● 攻撃コマンドをリストに追加 #-------------------------------------------------------------------------- def add_attack_command add_command(Vocab::attack, :attack, @actor.attack_usable?) end #-------------------------------------------------------------------------- # ● スキルコマンドをリストに追加 #-------------------------------------------------------------------------- def add_skill_commands @actor.added_skill_types.sort.each do |stype_id| name = $data_system.skill_types[stype_id] add_command(name, :skill, true, stype_id) end end #-------------------------------------------------------------------------- # ● 防御コマンドをリストに追加 #-------------------------------------------------------------------------- def add_guard_command add_command(Vocab::guard, :guard, @actor.guard_usable?) end #-------------------------------------------------------------------------- # ● アイテムコマンドをリストに追加 #-------------------------------------------------------------------------- def add_item_command add_command(Vocab::item, :item) end #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- def setup(actor) @actor = actor clear_command_list make_command_list refresh select(0) activate open end end #============================================================================== # ■ Window_BattleSkill #------------------------------------------------------------------------------ #  バトル画面で、使用するスキルを選択するウィンドウです。 #============================================================================== class Window_J_BattleSkill < Window_J_SkillList #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = help_window.height super(0, y, Graphics.width, info_viewport.rect.y - y) self.visible = false @help_window = help_window @info_viewport = info_viewport end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show select_last @help_window.show super end #-------------------------------------------------------------------------- # ● ウィンドウの非表示 #-------------------------------------------------------------------------- def hide @help_window.hide super end end #============================================================================== # ■ Window_J_BattleItem #------------------------------------------------------------------------------ #  バトル画面で、使用するアイテムを選択するウィンドウです。 #============================================================================== class Window_J_BattleItem < Window_J_ItemList #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = help_window.height super(0, y, Graphics.width, info_viewport.rect.y - y) self.visible = false @help_window = help_window @info_viewport = info_viewport end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● アイテムをリストに含めるかどうか #-------------------------------------------------------------------------- def include?(item) $game_party.usable?(item) end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show select_last @help_window.show super end #-------------------------------------------------------------------------- # ● ウィンドウの非表示 #-------------------------------------------------------------------------- def hide @help_window.hide super end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● パーティコマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_party_command_window @party_command_window = Window_J_PartyCommand.new @party_command_window.x = Graphics.width @party_command_window.viewport = @info_viewport @party_command_window.set_handler(:fight, method(:command_fight)) @party_command_window.set_handler(:escape, method(:command_escape)) @party_command_window.unselect end #-------------------------------------------------------------------------- # ● アクターコマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_actor_command_window @actor_command_window = Window_J_ActorCommand.new @actor_command_window.viewport = @info_viewport @actor_command_window.set_handler(:attack, method(:command_attack)) @actor_command_window.set_handler(:skill, method(:command_skill)) @actor_command_window.set_handler(:guard, method(:command_guard)) @actor_command_window.set_handler(:item, method(:command_item)) @actor_command_window.set_handler(:cancel, method(:prior_command)) @actor_command_window.x = Graphics.width end #-------------------------------------------------------------------------- # ● ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_status_window @status_window = Window_J_BattleStatus.new @status_window.x = 128 end #-------------------------------------------------------------------------- # ● アクターウィンドウの作成 #-------------------------------------------------------------------------- def create_actor_window @actor_window = Window_J_BattleActor.new(@info_viewport) @actor_window.set_handler(:ok, method(:on_actor_ok)) @actor_window.set_handler(:cancel, method(:on_actor_cancel)) end #-------------------------------------------------------------------------- # ● スキルウィンドウの作成 #-------------------------------------------------------------------------- def create_skill_window @skill_window = Window_J_BattleSkill.new(@help_window, @info_viewport) @skill_window.set_handler(:ok, method(:on_skill_ok)) @skill_window.set_handler(:cancel, method(:on_skill_cancel)) end #-------------------------------------------------------------------------- # ● アイテムウィンドウの作成 #-------------------------------------------------------------------------- def create_item_window @item_window = Window_J_BattleItem.new(@help_window, @info_viewport) @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) end #-------------------------------------------------------------------------- # ● 情報表示ビューポートの更新 #-------------------------------------------------------------------------- def update_info_viewport move_info_viewport(@party_command_window.width) if @party_command_window.active move_info_viewport(@actor_command_window.width) if @actor_command_window.active move_info_viewport(64) if BattleManager.in_turn? end end