#============================================================================== # ■ RGSS2 簡易状況確認コマンド Ver1.01 by 星潟 #------------------------------------------------------------------------------ # 戦闘中にパーティコマンドから簡単な能力値等を確認できるようになります。 # 極力スクリプトエディタ内の下の方に導入される事をお勧めします。 #============================================================================== module EasyBattleConfirm #状況確認コマンドのコマンド名を取得。 Title = "状況確認" #エネミーも一覧に追加するか? #trueで追加。falseで追加しない。 Enemy = true #アクターに対し状況確認コマンドで確認した際 #装備の描写も行うか否かを判定。 #trueで行う。falseで行わない。 Equip = true end class Window_PartyCommand < Window_Command #-------------------------------------------------------------------------- # 初期化 #-------------------------------------------------------------------------- alias initialize_battle_confirm initialize def initialize initialize_battle_confirm @commands.push(EasyBattleConfirm::Title) @item_max += 1 i = @commands.size - 1 draw_item(i, true) end end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # 開始処理 #-------------------------------------------------------------------------- alias start_battle_confirm start def start start_battle_confirm @battle_confirm_window = Window_EasyBattleConfirm.new end #-------------------------------------------------------------------------- # 情報表示ビューポートの更新 #-------------------------------------------------------------------------- alias update_info_viewport_battle_confirm update_info_viewport def update_info_viewport update_info_viewport_battle_confirm @battle_confirm_window.update if @battle_confirm_window end #-------------------------------------------------------------------------- # 情報表示ビューポートの解放 #-------------------------------------------------------------------------- alias dispose_info_viewport_battle_confirm dispose_info_viewport def dispose_info_viewport @battle_confirm_window.dispose if @battle_confirm_window dispose_info_viewport_battle_confirm end #-------------------------------------------------------------------------- # パーティコマンド選択の更新 #-------------------------------------------------------------------------- alias update_party_command_selection_battle_confirm update_party_command_selection def update_party_command_selection if Input.trigger?(Input::C) && @party_command_window.commands[@party_command_window.index] == EasyBattleConfirm::Title Sound.play_decision process_battle_confirm return end update_party_command_selection_battle_confirm end #-------------------------------------------------------------------------- # 状況確認の実行 #-------------------------------------------------------------------------- def process_battle_confirm @party_command_window.active = false @battle_confirm_window.mode = :actor_select @battle_confirm_window.refresh @battle_confirm_window.visible = true @battle_confirm_window.active = true @battle_confirm_window.index = 0 end #-------------------------------------------------------------------------- # 戦闘行動の処理 #-------------------------------------------------------------------------- alias process_action_battle_confirm process_action def process_action return if battle_confirm_execute process_action_battle_confirm end #-------------------------------------------------------------------------- # 状況確認の処理 #-------------------------------------------------------------------------- def battle_confirm_execute if @battle_confirm_window.visible if Input.trigger?(Input::C) Sound.play_decision @battle_confirm_window.refresh_with_mode_change elsif Input.trigger?(Input::B) Sound.play_cancel if @battle_confirm_window.mode == :battle_confirm @battle_confirm_window.refresh_with_mode_change else @battle_confirm_window.active = false @battle_confirm_window.visible = false @party_command_window.active = true end end return true end return false end end class Window_EasyBattleConfirm < Window_Selectable attr_accessor :mode #-------------------------------------------------------------------------- # オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @last_index = 0 super(0, 0, Graphics.width, Graphics.height) @mode = :actor_select refresh self.visible = false end #-------------------------------------------------------------------------- # 先頭の行の取得 #-------------------------------------------------------------------------- def top_row return self.oy / (WLH * 2) end #-------------------------------------------------------------------------- # 先頭の行の設定 #-------------------------------------------------------------------------- def top_row=(row) row = 0 if row < 0 row = row_max - 1 if row > row_max - 1 self.oy = row * WLH * 2 end #-------------------------------------------------------------------------- # 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return (self.height - 32) / (WLH * 2) end #-------------------------------------------------------------------------- # 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = WLH * 2 rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * WLH * 2 return rect end #-------------------------------------------------------------------------- # ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents return super if @mode != :actor_select self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH * 2].max) end #-------------------------------------------------------------------------- # リフレッシュ #-------------------------------------------------------------------------- def refresh case @mode when :actor_select @index = @last_index @members = $game_party.battle_confirm_members + (EasyBattleConfirm::Enemy ? $game_troop.battle_confirm_members : []) @item_max = @members.size when :battle_confirm @last_index = @index @members = [@members[@index]] @index = -1 update_cursor self.top_row = 0 @item_max = 1 end create_contents @item_max.times do |i| draw_item(i) end end #-------------------------------------------------------------------------- # 項目の描画 #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color actor = @members[index] draw_actor_name(actor, rect.x, rect.y) draw_actor_hp(actor, self.contents.width / 2 - 40, rect.y) draw_actor_mp(actor, self.contents.width / 4 * 3, rect.y) draw_actor_state(actor, rect.x, rect.y + 24, self.contents.width) if @mode == :battle_confirm 4.times do |i| draw_actor_parameter(actor, rect.x, rect.y + WLH * (3 + i), i) end if actor.actor? if EasyBattleConfirm::Equip self.contents.font.color = system_color xd = self.contents.width / 2 self.contents.draw_text(xd, rect.y + WLH * 2, 120, WLH, Vocab::equip) es = actor.equips ess = es.size ess.times do |i| draw_item_name(es[i], xd, rect.y + WLH * (i + 3)) end end end end end #-------------------------------------------------------------------------- # 名前の描画 #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y) self.contents.font.color = hp_color(actor) self.contents.draw_text(x, y, self.contents.width / 2 - 40, WLH, actor.name) end #-------------------------------------------------------------------------- # HP の描画 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 160) draw_actor_hp_gauge(actor, x, y, width) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a) self.contents.font.color = hp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 40, y, 60, WLH, actor.hp, 2) else self.contents.draw_text(xr - 130, y, 60, WLH, actor.hp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 70, y, 10, WLH, "/", 2) self.contents.draw_text(xr - 60, y, 60, WLH, actor.maxhp, 2) end end #-------------------------------------------------------------------------- # モードを切り替えてからリフレッシュ #-------------------------------------------------------------------------- def refresh_with_mode_change case @mode when :actor_select @mode = :battle_confirm when :battle_confirm @mode = :actor_select end refresh end end class Game_Unit #-------------------------------------------------------------------------- # 隠れていないメンバーを取得 #-------------------------------------------------------------------------- def battle_confirm_members a = [] for i in members a.push(i) if !i.hidden end a end end