#============================================================================== # ■ XP-RGSS-54 個別ステータスウィンドウ《ATB対応版》 by Claimh #------------------------------------------------------------------------------ # ・バトル画面でパーティメンバーのステータスを表示するウィンドウを個別化。 # ・1〜4人まで対応。右つめ式。戦闘位置調整には未対応。 # ・ActiveTimeBattle用にカスタマイズ済み #============================================================================== module BS_Setting #-------------------------------------------------------- # バトルステータス画像設定 => Windowskinにインポート #-------------------------------------------------------- # ActiveTimeBattle用スキン # ActiveTimerカウントバー ATB_BAR = "Gauge.png" # ActiveTimerカウントバー(フル状態用) ATB_FULL = "Gauge.png" end #============================================================================== # ■ Window_BattleStatus【再構築】 #------------------------------------------------------------------------------ #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。 #------------------------------------------------------------------------------ # パーティ個別のウィンドウを一元管理するクラス。 # 一元管理させることで、Scene_Battleへの変更をなくす(導入を容易化させる) # ウィンドウクラスとしているが実質はウィンドウではない(ウィンドウ管理クラス) #============================================================================== class Window_BattleStatus #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @hp_window = [] @bs_window = [] for i in 0...$game_party.actors.size @hp_window[i] = Window_BattleActorStatus.new(i) @bs_window[i] = Sprite_ActiveTimer.new(i) end # メンバー入れ替えにも耐えうるようにパーティ記憶 @battle_party = $game_party.dup end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose for i in 0...@battle_party.actors.size @hp_window[i].dispose @bs_window[i].dispose end end #-------------------------------------------------------------------------- # ● レベルアップフラグの設定 # actor_index : アクターインデックス #-------------------------------------------------------------------------- def level_up(actor_index) @hp_window[actor_index].level_up end #-------------------------------------------------------------------------- # ● リフレッシュ(ALL) #-------------------------------------------------------------------------- def refresh # パーティ入れ替えを検出 if @battle_party.actors != $game_party.actors # 全ウィンドウを再構築する dispose initialize else # 通常更新 for i in 0...@battle_party.actors.size @hp_window[i].refresh end end end #-------------------------------------------------------------------------- # ● リフレッシュ(1ウィンドウ) # 全てのウィンドウ更新は負荷がかかる場合に使用する軽量処理用リフレッシュ # 指定ウィンドウ以外のパーティ入れ替えには対応してない。 #-------------------------------------------------------------------------- def one_refresh(actor_index) # パーティ入れ替えを検出 if @battle_party.actors[actor_index] != $game_party.actors[actor_index] # 入れ替え @battle_party.actors[actor_index] = $game_party.actors[actor_index].dup # 指定ウィンドウを再構築する @hp_window[actor_index].dispose @hp_window[actor_index] = Window_BattleActorStatus.new(actor_index) else # 通常更新 @hp_window[actor_index].refresh end end #-------------------------------------------------------------------------- # ● HP/APウィンドウだけのリフレッシュ(負荷軽量Refresh) #-------------------------------------------------------------------------- def hpap_refresh for i in 0...$game_party.actors.size @hp_window[i].refresh end end #-------------------------------------------------------------------------- # ● ATBウィンドウだけのリフレッシュ(負荷軽量Refresh) #-------------------------------------------------------------------------- def atb_refresh for i in 0...$game_party.actors.size @bs_window[i].refresh end end #-------------------------------------------------------------------------- # ● 行動者だけのHP/APリフレッシュ(最軽量Refresh) #-------------------------------------------------------------------------- def actor_hpap_refresh(i) @hp_window[i].refresh end #-------------------------------------------------------------------------- # ● 行動者だけのATリフレッシュ(最軽量Refresh) #-------------------------------------------------------------------------- def actor_atb_refresh(i) @bs_window[i].refresh end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update for i in 0...@battle_party.actors.size @bs_window[i].update end end end #============================================================================== # ■ Window_BattleActorStatus #------------------------------------------------------------------------------ # アクター単位でウィンドウを分割するために用意したウィンドウ。 # Window_BattleStatus内で一元管理させる。 # 当然、4人以上のパーティには未対応(スペース足りない) #============================================================================== class Window_BattleActorStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor_index) super(actor_index * 640/4, 320, 640/4, 160) self.opacity = 160 @actor = $game_party.actors[actor_index] self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = false @item_max = 1 refresh end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose super end #-------------------------------------------------------------------------- # ● レベルアップフラグの設定 # actor_index : アクターインデックス #-------------------------------------------------------------------------- def level_up @level_up_flags = true end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear actor_x = 4 draw_actor_name(@actor, actor_x, 0) draw_actor_hp(@actor, actor_x, 26, 120) draw_actor_sp(@actor, actor_x, 50, 120) if @level_up_flags self.contents.font.color = normal_color self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!") else draw_actor_state(@actor, actor_x, 96) end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # メインフェーズのときは不透明度をやや下げる if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end end end #============================================================================== # ■ Sprite_ActiveTimer #------------------------------------------------------------------------------ # ActiveTimer表示用スプライト # Window_BattleStatus内で一元管理させる。 #============================================================================== class Sprite_ActiveTimer < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor_index) super() self.x = actor_index * 640 / 4 + 20 self.y = 420 self.z = 200 @actor = $game_party.actors[actor_index] self.bitmap = Bitmap.new(120,8) refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.bitmap.clear self.bitmap.draw_activetimer(@actor, 0, 0) end end class Bitmap #-------------------------------------------------------------------------- # ● windowskin描画(Graphics/Windowskin内の画像を表示) # file_name : 画像ファイル名 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_windowskin(file_name, x, y, opacity=255) bitmap = RPG::Cache.windowskin(file_name) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) blt(x, y, bitmap, src_rect, opacity) end #-------------------------------------------------------------------------- # ● 0 - 100%バー描画 #-------------------------------------------------------------------------- def draw_crurrent(file_name, x, y, current, max) bitmap = RPG::Cache.windowskin(file_name) cw = bitmap.width * current / max ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) blt(x, y, bitmap, src_rect) end #-------------------------------------------------------------------------- # ● ActiveTimerの描画(Full Edition) #-------------------------------------------------------------------------- def draw_activetimer(actor, x, y) # Full判定 if actor.at_full? # Full表示 draw_windowskin(BS_Setting::ATB_FULL, x, y) else # 通常表示 draw_crurrent(BS_Setting::ATB_BAR, x, y, actor.at, ATB_W::AT_MAX) end end end