#============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # レッツ、最強装備! # シフトボタン押下で現装備含めて装備可能な武器防具から # ステータスの一番高いものを最強装備として変更 #============================================================================== module An_SWAA #消さないでください #メッセージ Message = ["優先能力", "攻撃力重視", "防御力重視", "精神力重視","敏捷性重視", "最強装備を適応しますか?", "はい", "いいえ"] #変更部分の装備アイテム名の色指定 #最強装備の候補があった場合現装備と見分けるため SWC = 14 #二刀流のとき、両手装備の攻撃力と片手武器2個の攻撃力がつりあった場合、 #優先順位:0→両手武器 1→片手武器 TOS = 0 end #============================================================================== # ■ Window_Equip #============================================================================== class Window_SWEquip < Window_Equip #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh2(data) for i in 0..4 if data[i] != nil self.contents.clear_rect(92, WLH * i, 196, WLH) end end if data[0] != nil && data[0].two_handed self.contents.clear_rect(92, WLH * 1, 196, WLH) end draw_item_name2(data[0], 92, WLH * 0, i = data[0] == @actor.equips[0]) draw_item_name2(data[1], 92, WLH * 1, i = data[1] == @actor.equips[1]) draw_item_name2(data[2], 92, WLH * 2, i = data[2] == @actor.equips[2]) draw_item_name2(data[3], 92, WLH * 3, i = data[3] == @actor.equips[3]) draw_item_name2(data[4], 92, WLH * 4, i = data[4] == @actor.equips[4]) @data2 = data end #-------------------------------------------------------------------------- # ● アイテム名の描画 #-------------------------------------------------------------------------- def draw_item_name2(item, x, y, enabled = true) if item != nil draw_icon(item.icon_index, x, y, true) self.contents.font.color = text_color(An_SWAA::SWC) if !enabled self.contents.draw_text(x + 24, y, 172, WLH, item.name) self.contents.font.color = normal_color end end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text("") end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor @index = -1 super end end #============================================================================== # ■ Window_EquipItem #============================================================================== class Window_EquipItem < Window_Item #-------------------------------------------------------------------------- # ● 最強装備候補 #-------------------------------------------------------------------------- def search_sw @data = [] for item in $game_party.items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end data = [] data << @data.sort{|a,b| a.atk <=> b.atk} data << @data.sort{|a,b| a.def <=> b.def} data << @data.sort{|a,b| a.spi <=> b.spi} data << @data.sort{|a,b| a.agi <=> b.agi} for i in 0..3 data[i].reverse! data[i] << nil end return data end end #============================================================================== # ■ Scene_Equip #============================================================================== class Scene_Equip < Scene_Base include An_SWAA #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias an_SW_start start def start an_SW_start wlh = Window_Base::WLH - 4 @sw_window = [] @sw_window << Window_Base.new(0, 208, 544, 208) @sw_window[0].contents.draw_text(0, 0, 544, wlh, Message[0]) @sw_window << Window_Command.new(536, [Message[1], Message[2], Message[3], Message[4]], 4) @sw_window[1].x = 4 @sw_window[1].y = 228 @sw_window[1].opacity = 0 @sw_window[0].contents.draw_text(0, 52, 544, wlh, Message[5]) @sw_window << Window_Command.new(336, [Message[6], Message[7]], 2) @sw_window[2].x = 4 @sw_window[2].y = 284 @sw_window[2].opacity = 0 @sw_window << Window_SWEquip.new(208, 56, @actor) for i in 0..3 @sw_window[i].visible = false @sw_window[i].active = false end @sw_window[4] = false @sw_window[5] = 0 end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- alias an_SW_terminate terminate unless $! def terminate an_SW_terminate for i in 0..3 @sw_window[i].dispose end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias an_SW_update update unless $! def update an_SW_update update_sw_windows if @sw_window[4] update_sw_selection end end #-------------------------------------------------------------------------- # ● 最強装備の検索 #-------------------------------------------------------------------------- def sw_actor(scope) data = [] equip = @actor.equips for i in 0...@actor.equips.size @actor.change_equip(i, nil) end data << @item_windows[0].search_sw[scope] data << @item_windows[1].search_sw[scope][0] if !@actor.two_swords_style data << @item_windows[0].search_sw[scope] if @actor.two_swords_style data << @item_windows[2].search_sw[scope][0] data << @item_windows[3].search_sw[scope][0] data << @item_windows[4].search_sw[scope][0] for i in 0...@actor.equips.size @actor.change_equip(i, equip[i]) end s = [nil, []] for i in data[0] next if i.nil? if i.two_handed && s[0].nil? s[0] = i elsif i.two_handed next else if $game_party.item_number(i) > 1 && s[1].empty? s[1] = [i, i] elsif s[1][1].nil? s[1] << i else next end end end data[0] = data[0][0] if @actor.two_swords_style case scope when 0 s0 = s[0].atk ; s1 = (s[1][0].atk + s[1][1].atk) when 1 s0 = s[0].def ; s1 = (s[1][0].def + s[1][1].def) when 2 s0 = s[0].spi ; s1 = (s[1][0].spi + s[1][1].spi) when 3 s0 = s[0].agi ; s1 = (s[1][0].agi + s[1][1].agi) end if s0 > s1 or (s0 == s1 && TOS == 1) data[0] = s[0] data[1] = nil else data[0] = s[1][0] data[1] = s[1][1] end elsif data[0] != nil && data[1] != nil && data[0].two_handed if scope == 0 data[0] = s[0] data[1] = nil else data[0] = s[1][0] end end return data end #-------------------------------------------------------------------------- # ● 装備部位選択の更新 #-------------------------------------------------------------------------- alias an_SW_update_equip_selection update_equip_selection unless $! def update_equip_selection an_SW_update_equip_selection if Input.trigger?(Input::SHIFT) if @actor.fix_equipment Sound.play_buzzer else Sound.play_decision @sw_window[4] = true for i in 0..3 @sw_window[i].visible = true end @equip_window.active = false @equip_window.visible = false @sw_index = 1 @sw_window[1].active = true end end end #-------------------------------------------------------------------------- # ● ステータスウィンドウの更新 #-------------------------------------------------------------------------- alias an_SW_update_status_window update_status_window unless $! def update_status_window if @sw_window[4] temp_actor = @actor.clone newequip = sw_actor(@sw_window[5]) for i in 0..4 temp_actor.change_equip(i, newequip[i], true) end new_atk = temp_actor.atk new_def = temp_actor.def new_spi = temp_actor.spi new_agi = temp_actor.agi @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi) @status_window.update else an_SW_update_status_window end end #-------------------------------------------------------------------------- # ● アイテムウィンドウの更新 #-------------------------------------------------------------------------- alias an_SW_update_item_windows update_item_windows unless $! def update_item_windows an_SW_update_item_windows if @sw_window[4] for window in @item_windows window.visible = false end return end end #-------------------------------------------------------------------------- # ● 独自追加ウィンドウ更新 #-------------------------------------------------------------------------- def update_sw_windows for i in 0..3 @sw_window[i].active = (i == @sw_index) @sw_window[i].visible = @sw_window[4] @sw_window[i].update end @sw_window[5] = @sw_window[1].index end #-------------------------------------------------------------------------- # ● 独自追加コマンドウィンドウ更新 #-------------------------------------------------------------------------- def update_sw_selection if Input.trigger?(Input::DOWN) Sound.play_cursor @sw_index += 1 @sw_index = 1 if @sw_index == 3 elsif Input.trigger?(Input::UP) Sound.play_cursor @sw_index -= 1 @sw_index = 2 if @sw_index == 0 elsif Input.trigger?(Input::B) or (Input.trigger?(Input::C) && @sw_window[2].index == 1) Sound.play_cancel @sw_index = -1 @sw_window[4] = false @equip_window.active = true @equip_window.visible = true elsif Input.trigger?(Input::C) Sound.play_equip newequip = sw_actor(@sw_window[5]) for i in 0..4 @actor.change_equip(i, newequip[i]) end @sw_index = -1 @sw_window[4] = false @equip_window.active = true @equip_window.visible = true @equip_window.refresh for item_window in @item_windows item_window.refresh end end @sw_window[3].refresh2(sw_actor(@sw_window[5])) end end #Ver1.01