#============================================================================== # ■ XP-RGSS-56 鍛冶屋 [シーンクラス] by Claimh #============================================================================== #============================================================================== # ■ Scene_Blacksmith #============================================================================== class Scene_Blacksmith include Blacksmith::MesCmd INFO_FLEX = false # infoウィンドウ表示中にもアイテム選択可能とする # #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- 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 @help_window = Window_Help.new @gold_window = Window_Gold.new @gold_window.x = 480 @gold_window.y = 64 @sys_window = Window_BsSysCmd.new @mod_window = Window_BsModCmd.new(@sys_window.sys) @ctg_window = Window_BsCtg.new @list_window = Window_BsList.new(@sys_window.sys, @mod_window.mod) @sl_window = Window_BsSList.new @pt_window = Window_BsActors.new @sts_window = Window_BsStatus.new(@sys_window.sys) @info_window = Window_BsItemInfo.new @yn_window = Window_BsYesNo.new @mes_window = Window_BsCaution.new # if @sys_window.fix? @sys_window.disable if @mod_window.fix? @mod_window.disable @list_window.enable @ctg_window.change(@mod_window.mod) if @ctg_window.fix? # sys/mod/ctg全て固定の場合はmodを表示 @mod_window.visible = true end else @mod_window.sys = @sys_window.sys @mod_window.enable end else @mod_window.disable end # @sl_window.pt_window = @pt_window @sl_window.sts_window = @sts_window @sl_window.help_window = @help_window @list_window.pt_window = @pt_window @list_window.sts_window = @sts_window @list_window.help_window = @help_window delete_help # @equip = false @actor = nil end def delete_help @help_window.set_text("") @pt_window.item = @sts_window.item = nil @sts_window.mode_reset(@sys_window.sys) end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate @help_window.dispose @gold_window.dispose @sys_window.dispose @mod_window.dispose @ctg_window.dispose @list_window.dispose @sl_window.dispose @pt_window.dispose @info_window.dispose @sts_window.dispose @yn_window.dispose @mes_window.dispose end #---------------------------------------------------------------------------- # ● 予約処理実行 #---------------------------------------------------------------------------- CB_YN = 0 CB_S_PT = 1 CB_D_PT = 2 def callback(ptn) case ptn when CB_YN @yn_window.enable when CB_S_PT @pt_window.refresh(@elist) @pt_window.active = true @pt_window.index = @elist[0] when CB_D_PT @pt_window.index = -1 @pt_window.active = false when M_E_D, M_E_C $game_system.se_play($data_system.equip_se) @mes_window.set_text(ptn, @actor) @actor = nil end end #---------------------------------------------------------------------------- # ● フレーム更新 #---------------------------------------------------------------------------- def update if @mes_window.visible @mes_window.update elsif @info_window.visible update_info elsif @sys_window.active update_sys elsif @mod_window.active update_mod elsif @list_window.active update_list elsif @sl_window.active update_slist elsif @yn_window.active update_yesno elsif @pt_window.active update_party end end #---------------------------------------------------------------------------- # ● フレーム更新 : @sys_window #---------------------------------------------------------------------------- def update_sys @sys_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @sys_window.exit? $scene = Scene_Map.new elsif @mod_window.fix? @sts_window.mode_reset(@sys_window.sys) @list_window.change_t(@sys_window.sys * 2 + @mod_window.mod) @list_window.enable @ctg_window.change(@mod_window.mod) if @ctg_window.fix? @sys_window.active = false else @sys_window.disable end else @sys_window.disable @mod_window.sys = @sys_window.sys @mod_window.enable end end end #---------------------------------------------------------------------------- # ● フレーム更新 : @mod_window #---------------------------------------------------------------------------- def update_mod @mod_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @sys_window.fix? $scene = Scene_Map.new else @sys_window.enable @mod_window.disable end elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @mod_window.exit? $scene = Scene_Map.new else @ctg_window.change(@mod_window.mod) @sts_window.mode_reset(@sys_window.sys) @list_window.change_t(@sys_window.sys * 2 + @mod_window.mod, @ctg_window.index) @list_window.enable @list_window.update_help if @ctg_window.fix? @mod_window.active = false else @mod_window.disable end end end end #---------------------------------------------------------------------------- # ● フレーム更新 : @list_window #---------------------------------------------------------------------------- def update_list if Input.trigger?(Input::LEFT) and !@ctg_window.fix? $game_system.se_play($data_system.cursor_se) @ctg_window.shift_l @list_window.change_c(@ctg_window.index) return elsif Input.trigger?(Input::RIGHT) and !@ctg_window.fix? $game_system.se_play($data_system.cursor_se) @ctg_window.shift_r @list_window.change_c(@ctg_window.index) return elsif Input.trigger?(Input::A) and !@sts_window.fix? $game_system.se_play($data_system.cursor_se) @sts_window.change_mode return end @list_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @sys_window.fix? and @mod_window.fix? $scene = Scene_Map.new else @mod_window.fix? ? @sys_window.enable : @mod_window.enable @ctg_window.visible = false @list_window.disable delete_help end elsif Input.trigger?(Input::C) unless @list_window.enable? $game_system.se_play($data_system.buzzer_se) @mes_window.set_text(@list_window.data.message) unless @list_window.data.nil? return end $game_system.se_play($data_system.decision_se) @list_window.active = false if @list_window.sys_create? $game_system.se_play(Blacksmith::SUCCESS_SE) @mes_window.set_text(M_S_C, @list_window.data.obj) if @list_window.data.equippable_members.size == 0 @equip = false execute else @mes_window.set_callback(CB_YN) end else @sts_window.mode_reset(0) @sl_window.startup(@list_window.data) end elsif Input.trigger?(Input::X) $game_system.se_play($data_system.decision_se) @info_window.visible = !@info_window.visible @info_window.item = @list_window.item end end #---------------------------------------------------------------------------- # ● フレーム更新 : @sl_window #---------------------------------------------------------------------------- def update_slist if Input.trigger?(Input::A) $game_system.se_play($data_system.cursor_se) @sts_window.change_mode return end @sl_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @list_window.enable @sl_window.disable @sts_window.mode_reset(@sys_window.sys) @list_window.update_help elsif Input.trigger?(Input::C) unless @sl_window.enable? $game_system.se_play($data_system.buzzer_se) @mes_window.set_text(@sl_window.data.message) unless @sl_window.data.nil? return end $game_system.se_play(Blacksmith::SUCCESS_SE) @mes_window.set_text(M_S_S, @sl_window.data.obj) @sl_window.active = false d = @list_window.data if d.num == 0 # 所持品ない == 装備品Only @elist = [] for i in d.equip_actors # 強化したアイテムが装備できるメンバーを抽出 @elist.push(i) if $game_party.actors[i].equippable?(@sl_window.data.obj) end if @elist.size > 1 # 複数人が装備可能 → 選択 @equip = true @mes_window.set_callback(CB_S_PT) elsif @elist.size == 1 # 一人しか装備できない → 装備交換 @actor = $game_party.actors[@elist[0]] @equip = true @mes_window.set_callback(M_E_C) execute(@actor) else # 誰も装備できない → 装備を外す @actor = $game_party.actors[d.equip_actors[0]] @equip = false itm = @sl_window.data.obj @actor.equip(itm.is_a?(RPG::Weapon) ? 0 : (itm.kind+1), 0) @mes_window.set_callback(M_E_D) execute(@actor) end else # 所持品がある場合、装備中かどうかは無視 if @sl_window.data.equippable_members.size == 0 @equip = false execute else $game_system.se_play($data_system.decision_se) @mes_window.set_callback(CB_YN) end end elsif Input.trigger?(Input::X) $game_system.se_play($data_system.decision_se) @info_window.visible = !@info_window.visible @info_window.item = @sl_window.item end end #---------------------------------------------------------------------------- # ● フレーム更新 : @info_window #---------------------------------------------------------------------------- def update_info @info_window.item = @list_window.active ? @list_window.item : @sl_window.item if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @info_window.visible = false elsif Input.trigger?(Input::C) or Input.trigger?(Input::X) $game_system.se_play($data_system.decision_se) @info_window.visible = false elsif INFO_FLEX if @list_window.active @list_window.update elsif @sl_window.active @sl_window.update end end end #---------------------------------------------------------------------------- # ● フレーム更新 : @yn_window #---------------------------------------------------------------------------- def update_yesno @yn_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) execute @yn_window.disable elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @yn_window.index == 0 @equip = true @pt_window.active = true @pt_window.index = 0 else execute end @yn_window.disable end end #---------------------------------------------------------------------------- # ● フレーム更新 : @pt_window #---------------------------------------------------------------------------- def update_party @pt_window.update if Input.trigger?(Input::B) and @list_window.data.num > 0 $game_system.se_play($data_system.cancel_se) @equip = false execute(nil) @mes_window.set_text(M_O_I) elsif Input.trigger?(Input::C) unless @pt_window.enable? $game_system.se_play($data_system.buzzer_se) @mes_window.set_text(M_E_N) return end $game_system.se_play($data_system.equip_se) execute(@pt_window.actor) @mes_window.set_text(M_E_C, @pt_window.actor) @mes_window.set_callback(CB_D_PT) end end #---------------------------------------------------------------------------- # ● 鍛治実行 #---------------------------------------------------------------------------- def execute(actor=nil) if @list_window.sys_create? @list_window.data.execute(@equip, actor) else @sl_window.data.execute(@equip, actor) @sl_window.disable @sts_window.mode_reset(@sys_window.sys) end @equip = false @list_window.enable @gold_window.refresh @list_window.diff_refresh @pt_window.refresh @sts_window.refresh end end