#============================================================================== # ■ VX-RGSS2-21 精霊システム [change] by Claimh #------------------------------------------------------------------------------ # ★精霊選択画面 # $scene = Scene_SpiritChange.new(menu_index) # menu_index : メニューIndex(省略時は-1 = Mapに戻る) #============================================================================== #============================================================================== # ■ Window_SpiritActors #============================================================================== class Window_SpiritActors < Window_Selectable attr_accessor :help_window2 # ヘルプウィンドウ attr_accessor :help_window3 # ヘルプウィンドウ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 160, WLH*4+32) @item_max = $game_party.members.size create_contents refresh self.index = 0 end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, @item_max * WLH].max) end #-------------------------------------------------------------------------- # ● アクター参照 #-------------------------------------------------------------------------- def actor return $game_party.members[@index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_i(i) end end #-------------------------------------------------------------------------- # ● 項目描画 #-------------------------------------------------------------------------- def draw_i(i) draw_actor_name($game_party.members[i], 4, i*WLH) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.actor = @help_window2.actor = actor @help_window3.spirit_id = actor.partner.id unless actor.partner.disable? end end #============================================================================== # ■ Window_SpiritList #============================================================================== class Window_SpiritList < Window_Selectable attr_accessor :help_window2 # ヘルプウィンドウ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize y = WLH*4+32 super(0, y, 160, 416-y) @actor = nil @data = [] for id in $game_party.spirits d = $game_party.spirit[id] @data.push(d) if d.visible end @data.push(nil) @item_max = @data.size create_contents self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, @item_max * WLH].max) end #-------------------------------------------------------------------------- # ● 精霊参照 #-------------------------------------------------------------------------- def spirit return @data[@index] end #-------------------------------------------------------------------------- # ● アクター選択 #-------------------------------------------------------------------------- def actor=(a) return if @actor == a @actor = a refresh end #-------------------------------------------------------------------------- # ● Window有効・無効 #-------------------------------------------------------------------------- def enable self.active = true self.index = 0 end def disable self.index = -1 self.active = false end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_i(i) end end #-------------------------------------------------------------------------- # ● 項目描画 #-------------------------------------------------------------------------- def draw_i(i) d = @data[i] return if d.nil? self.contents.font.color.alpha = enable_i?(i) ? 255 : 128 self.contents.draw_text(4, i*WLH, 120, WLH, d.name) end #-------------------------------------------------------------------------- # ● 選択可能? #-------------------------------------------------------------------------- def enable_i?(i) return true if @data[i].nil? return false if @data[i].partner_id != 0 return false if @actor.nil? return false if @actor.partner.compatible_i(@data[i].id) == 0 return true end def enable? return enable_i?(@index) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help id = @data[@index].nil? ? -1 : @data[@index].id @help_window.spirit_id = @help_window2.spirit_id = id end end #============================================================================== # ■ Window_SpiritActInfo #============================================================================== class Window_SpiritActInfo < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize super(160, 0, 544-160, WLH*7+32) @actor = nil @spirit_id = 0 end #-------------------------------------------------------------------------- # ● アクター変更 #-------------------------------------------------------------------------- def actor=(a) return if @actor == a @actor = a @spirit_id = 0 refresh end #-------------------------------------------------------------------------- # ● 精霊変更 #-------------------------------------------------------------------------- def spirit_id=(s) return if @spirit_id == s @spirit_id = s refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear case @spirit_id when 0; spirit = @actor.partner.obj when -1; spirit = nil else; spirit = $game_party.spirit[@spirit_id] end draw_actor_name(@actor, 4, 0) draw_partner_name(@actor, 160, 0) draw_actor_face(@actor, self.contents.width-96, self.contents.height-96) # word = [ "最大"+$data_system.terms.hp, "最大"+$data_system.terms.mp, $data_system.terms.atk, $data_system.terms.def, $data_system.terms.spi, $data_system.terms.agi ] now = [ @actor.maxhp, @actor.maxmp, @actor.atk, @actor.def, @actor.spi, @actor.agi ] # for i in 0...word.size case @spirit_id when 0; new = now[i] when -1; new = @actor.v_spirit(0, i) else; new = @actor.v_spirit(@spirit_id, i) end draw_diff(24, WLH*(i+1), word[i], now[i], new) end end #-------------------------------------------------------------------------- # ● パラメータ差分描画 #-------------------------------------------------------------------------- def draw_diff(x, y, word, now, new) self.contents.font.color = system_color self.contents.draw_text(x, y, 112, WLH, word) self.contents.font.color = normal_color self.contents.draw_text(x+20, y, 112, WLH, now.to_s, 2) if now != new self.contents.draw_text(x+140, y, 112, WLH, "→") if now < new self.contents.font.color = power_up_color elsif now > new self.contents.font.color = power_down_color end self.contents.draw_text(x+96, y, 112, WLH, new.to_s, 2) end end end #============================================================================== # ■ Window_SpiritInfo #============================================================================== class Window_SpiritInfo < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize y = WLH*7+32 super(160, y, 544-160, 416-y) @spirit_id = 0 end #-------------------------------------------------------------------------- # ● 精霊変更 #-------------------------------------------------------------------------- def spirit_id=(s) return if @spirit_id == s @spirit_id = s refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear return if @spirit_id < 1 spirit = $game_party.spirit[@spirit_id] self.contents.font.color = normal_color self.contents.draw_text(4, 0, 108, WLH, spirit.name) draw_spirit_level(spirit, 160, 0) draw_actor_face(spirit, self.contents.width-96, 0) # draw_partner_name2(spirit, 24, WLH*1) skills = spirit.skills clumn = 2 # 列数 for i in 0...skills.size x = 24 + (i % clumn) * 150 y = WLH*(i/clumn+2) draw_item_name(skills[i], x, y) break if (i/clumn) >= 4 end end end #============================================================================== # ■ Scene_SpiritChange #============================================================================== class Scene_SpiritChange < Scene_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(index=-1) @menu_index = index end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @actor_window = Window_SpiritActors.new @info_window = Window_SpiritActInfo.new @list_window = Window_SpiritList.new @s_info_window = Window_SpiritInfo.new # @list_window.help_window2 = @s_info_window @list_window.help_window = @info_window @actor_window.help_window3 = @s_info_window @actor_window.help_window2 = @list_window @actor_window.help_window = @info_window end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @actor_window.dispose @info_window.dispose @list_window.dispose @s_info_window.dispose end #---------------------------------------------------------------------------- # ● シーン終了 #---------------------------------------------------------------------------- def exit_scene $scene = @menu_index < 0 ? Scene_Map.new : Scene_Menu.new(@menu_index) end #---------------------------------------------------------------------------- # ● フレーム更新 #---------------------------------------------------------------------------- def update if @actor_window.active update_actors elsif @list_window.active update_list end end #---------------------------------------------------------------------------- # ● フレーム更新 : @actor_window #---------------------------------------------------------------------------- def update_actors @actor_window.update if Input.trigger?(Input::B) Sound.play_cancel exit_scene elsif Input.trigger?(Input::C) Sound.play_decision @actor_window.active = false @list_window.enable end end #---------------------------------------------------------------------------- # ● フレーム更新 : @list_window #---------------------------------------------------------------------------- def update_list @list_window.update if Input.trigger?(Input::B) Sound.play_cancel @list_window.disable @info_window.spirit_id = 0 @actor_window.active = true @actor_window.update_help elsif Input.trigger?(Input::C) unless @list_window.enable? Sound.play_buzzer return end Sound.play_equip id = @list_window.spirit.nil? ? 0 : @list_window.spirit.id @actor_window.actor.change_partner(id) @list_window.refresh @list_window.disable @info_window.spirit_id = 0 @actor_window.active = true end end end