#============================================================================== # ■ XP-RGSS-66 精霊システム [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, 200, 32*4+32) @item_max = $game_party.actors.size self.contents = Bitmap.new(width - 32, [height - 32, @item_max * 32].max) refresh self.index = 0 end #-------------------------------------------------------------------------- # ● アクター参照 #-------------------------------------------------------------------------- def actor return $game_party.actors[@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.actors[i], 4, i*32) 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 = 32*4+32 super(0, y, 200, 480-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 self.contents = Bitmap.new(width - 32, [height - 32, @item_max * 32].max) self.active = false self.index = -1 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*32, 120, 32, 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(200, 0, 440, 32*7+32) self.contents = Bitmap.new(width - 32, height - 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, 200, 0) draw_actor_battler(@actor) # word = [ "最大"+$data_system.words.hp, "最大"+$data_system.words.sp, $data_system.words.str, $data_system.words.dex, $data_system.words.agi, $data_system.words.int ] now = [ @actor.maxhp, @actor.maxsp, @actor.str, @actor.dex, @actor.agi, @actor.int ] # 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, 32*(i+1), word[i], now[i], new) end end #-------------------------------------------------------------------------- # ● バトラー描画(Graphics/Battlers内の画像を表示) #-------------------------------------------------------------------------- def draw_actor_battler(actor) bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(self.contents.width-cw, self.contents.height-ch, bitmap, src_rect) end #-------------------------------------------------------------------------- # ● パラメータ差分描画 #-------------------------------------------------------------------------- def draw_diff(x, y, word, now, new) self.contents.font.color = system_color self.contents.draw_text(x, y, 112, 32, word) self.contents.font.color = normal_color self.contents.draw_text(x+40, y, 112, 32, now.to_s, 2) if now != new self.contents.draw_text(x+168, y, 112, 32, "→") if now < new self.contents.font.color = crisis_color elsif now > new self.contents.font.color = normal_color self.contents.font.color.alpha = 128 end self.contents.draw_text(x+130, y, 112, 32, new.to_s, 2) end end end #============================================================================== # ■ Window_SpiritInfo #============================================================================== class Window_SpiritInfo < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize y = 32*7+32 super(200, y, 440, 480-y) self.contents = Bitmap.new(width - 32, height - 32) @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] draw_actor_name(spirit, 4, 0) draw_spirit_level(spirit, 200, 0) draw_actor_battler(spirit) # draw_partner_name2(spirit, 24, 32*1) skills = spirit.skills clumn = 2 # 列数 for i in 0...skills.size x = 24 + (i % clumn) * 180 y = 32*(i/clumn+2) draw_item_name($data_skills[skills[i]], x, y) break if (i/clumn) >= 4 end end #-------------------------------------------------------------------------- # ● バトラー描画(Graphics/Battlers内の画像を表示) #-------------------------------------------------------------------------- def draw_actor_battler(actor) bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(self.contents.width-cw, 0, bitmap, src_rect) end end #============================================================================== # ■ Scene_SpiritChange #============================================================================== class Scene_SpiritChange #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(index=-1) @menu_index = index end #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main start # 開始処理 Graphics.transition # トランジション実行 loop do Graphics.update # ゲーム画面を更新 Input.update # 入力情報を更新 update # フレーム更新 break if $scene != self # 画面が切り替わったらループを中断 end Graphics.update Graphics.freeze # トランジション準備 terminate # 終了処理 end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start @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 @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) $game_system.se_play($data_system.cancel_se) exit_scene elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @actor_window.active = false @list_window.enable end end #---------------------------------------------------------------------------- # ● フレーム更新 : @list_window #---------------------------------------------------------------------------- def update_list @list_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @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? $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.equip_se) 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