#============================================================================== # ■ VXAce-RGSS3-38 精霊システム <精霊ステータス画面> by Claimh #============================================================================== #============================================================================== # ■ Window_MenuCommand #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # ● 独自コマンドの追加用 #-------------------------------------------------------------------------- alias add_original_commands_spirits add_original_commands def add_original_commands add_original_commands_spirits add_command("精霊ステータス", :spirits, spirits_enable?) if add_spirits? end #-------------------------------------------------------------------------- # ● コマンド追加?[精霊ステータス] #-------------------------------------------------------------------------- def add_spirits? $game_party.spirit_num > 0 #and $game_switches[1] end #-------------------------------------------------------------------------- # ● コマンド可能?[精霊ステータス] #-------------------------------------------------------------------------- def spirits_enable? $game_party.spirit_num > 0 #and $game_switches[1] end end #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_spirits create_command_window def create_command_window create_command_window_spirits @command_window.set_handler(:spirits, method(:command_spirits)) end #-------------------------------------------------------------------------- # ● コマンド[精霊能力] #-------------------------------------------------------------------------- def command_spirits SceneManager.call(Scene_SpiritStatus) end end #============================================================================== # ■ Window_Spirits #============================================================================== class Window_Spirits < Window_HorzCommand #-------------------------------------------------------------------------- # ● 行の高さを取得 #-------------------------------------------------------------------------- def line_height 36 end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max (window_width - standard_padding * 2) / (item_width + spacing) end #-------------------------------------------------------------------------- # ● 項目の幅を取得 #-------------------------------------------------------------------------- def item_width 40 end #-------------------------------------------------------------------------- # ● 決定処理の有効状態を取得 #-------------------------------------------------------------------------- def ok_enabled? return false end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list $game_party.spirit_members.each {|s| add_command(s, :none)} end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) r = item_rect_for_text(index) #~ contents.fill_rect(r, pending_color) draw_actor_line_graphic(command_name(index), r.x, r.y) end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false) @help_window.next_page end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false) @help_window.prev_page end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- def cursor_right_page if col_max >= 2 select((index + 1) % item_max) end end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- def cursor_left_page if col_max >= 2 select((index - 1 + item_max) % item_max) end end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.actor = command_name(@index) end end #============================================================================== # ■ Window_SpiritStatus #============================================================================== class Window_SpiritStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(y) @page = 0 @data = Spirits.sts @max = @data.size super(0, y, Graphics.width, Graphics.height-y) end #-------------------------------------------------------------------------- # ● ウィンドウ内容の高さを計算 #-------------------------------------------------------------------------- def contents_height super + 10 end #-------------------------------------------------------------------------- # ● ページ切り替え #-------------------------------------------------------------------------- def page=(n) @page = [0, [@max-1, n].min].max self.oy = @page == 0 ? 0 : 10 refresh end def next_page self.page = @page + 1 end def prev_page self.page = @page - 1 end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_block1 (self.oy + line_height * 0) draw_horz_line(self.oy + line_height * 1) case @data[@page] when :status draw_block2 (self.oy + line_height * 2) draw_horz_line(self.oy + line_height * 6) draw_block3 (self.oy + line_height * 7) draw_horz_line(self.oy + line_height * 11) draw_block4 (self.oy + line_height * 12) when :stskl draw_block12 (self.oy + line_height * 2) draw_horz_line(self.oy + line_height * 6) draw_block13 (self.oy + line_height * 7) when :skills draw_block20 (self.oy + line_height * 2) when :features draw_block30 (self.oy + line_height * 2) end end #-------------------------------------------------------------------------- # ● ブロック 1 の描画 #-------------------------------------------------------------------------- def draw_block1(y) draw_spirit_name(@actor, self.ox + 4, y) draw_actor_nickname(@actor, self.ox + 148, y) draw_partner_name(@actor, self.ox + 280, y) end #-------------------------------------------------------------------------- # ● ブロック 2 の描画 #-------------------------------------------------------------------------- def draw_block2(y) draw_actor_face(@actor, self.ox + 8, y) draw_basic_info(self.ox + 136, y) draw_exp_info(self.ox + 304, y) end #-------------------------------------------------------------------------- # ● ブロック 3 の描画 #-------------------------------------------------------------------------- def draw_block3(y) draw_parameters(self.ox + 32, y, contents_width - 32) end #-------------------------------------------------------------------------- # ● ブロック 4 の描画 #-------------------------------------------------------------------------- def draw_block4(y) draw_description(self.ox + 4, y) end #-------------------------------------------------------------------------- # ● ブロック 12 の描画 #-------------------------------------------------------------------------- def draw_block12(y) draw_actor_face(@actor, self.ox + 8, y) draw_parameters(self.ox + 136, y, contents_width - 136) end #-------------------------------------------------------------------------- # ● ブロック 13 の描画 #-------------------------------------------------------------------------- def draw_block13(y) draw_skills(y, @actor.skills) end #-------------------------------------------------------------------------- # ● 水平線の描画 #-------------------------------------------------------------------------- def draw_horz_line(y) line_y = y + line_height / 2 - 1 contents.fill_rect(self.ox, line_y, contents_width, 2, line_color) end #-------------------------------------------------------------------------- # ● 水平線の色を取得 #-------------------------------------------------------------------------- def line_color color = normal_color color.alpha = 48 color end #-------------------------------------------------------------------------- # ● 基本情報の描画 #-------------------------------------------------------------------------- def draw_basic_info(x, y) draw_actor_level(@actor, x, y + line_height * 0) if Spirits::USE_LV end #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- def draw_parameters(x, y, w) col_max = 2 ww = w / col_max 8.times do |i| xx = x + i % col_max * ww yy = y + i / col_max * line_height draw_spirit_param(@actor, xx, yy, i) end end #-------------------------------------------------------------------------- # ● 経験値情報の描画 #-------------------------------------------------------------------------- def draw_exp_info(x, y) s1 = @actor.max_level? ? "-------" : @actor.exp s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp s_next = sprintf(Vocab::ExpNext, Vocab::level) change_color(system_color) draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal) draw_text(x, y + line_height * 2, 180, line_height, s_next) change_color(normal_color) draw_text(x, y + line_height * 1, 180, line_height, s1, 2) draw_text(x, y + line_height * 3, 180, line_height, s2, 2) end #-------------------------------------------------------------------------- # ● 説明の描画 #-------------------------------------------------------------------------- def draw_description(x, y) draw_text_ex(x, y, @actor.description) end #-------------------------------------------------------------------------- # ● ブロック 20 の描画 #-------------------------------------------------------------------------- def draw_block20(y) change_color(system_color) draw_text(self.ox, y, 100, line_height, "習得スキル") draw_skills(y + line_height, @actor.skills) end def draw_skills(y, skills) change_color(normal_color) skills.each_with_index do |skill, i| xx = self.ox + i % 2 * contents_width / 2 yy = y + i / 2 * line_height draw_item_name(skill, xx, yy) end end #-------------------------------------------------------------------------- # ● ブロック 30 の描画 #-------------------------------------------------------------------------- def draw_block30(y) change_color(system_color) draw_text(self.ox, y, 100, line_height, "追加能力") change_color(normal_color) draw_feature_text(Spirits::Features.new(@actor).all, self.ox, y + line_height) end #-------------------------------------------------------------------------- # ● 特徴テキストの描画 #-------------------------------------------------------------------------- def draw_feature_text(features, x, y, w=contents_width-10, col_max=2) return if features.nil? features.each_with_index do |ft, i| ww = w / col_max xx = x + i % col_max * ww yy = y + i / col_max * line_height draw_text(xx, yy, ww-24, line_height, ft[0]) draw_text(xx, yy, ww-24, line_height, ft[1], 2) unless ft[1].nil? end end end #============================================================================== # ■ Scene_SpiritStatus #============================================================================== class Scene_SpiritStatus < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super @list_window = Window_Spirits.new(0,0) @list_window.set_handler(:cancel, method(:return_scene)) @list_window.set_handler(:pagedown, method(:next_actor)) @list_window.set_handler(:pageup, method(:prev_actor)) @status_window = Window_SpiritStatus.new(@list_window.height) @list_window.help_window = @status_window end #-------------------------------------------------------------------------- # ● 次のアクターに切り替え #-------------------------------------------------------------------------- def next_actor @list_window.activate.cursor_right_page end #-------------------------------------------------------------------------- # ● 前のアクターに切り替え #-------------------------------------------------------------------------- def prev_actor @list_window.activate.cursor_left_page end end