#============================================================================== # ■ VX-RGSS-24 装備画面-改 [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ # 装備画面を改変します。 #【変更点】 # ・アイテム情報ウィンドウ追加 # ・アクターウィンドウの表示変更 # ・レイアウト変更 #============================================================================== module EquipEx # 属性表示あり USE_ELE = true # 表示対象の属性 ELEMENTS = [9,10,11,12,13,14,15,16] # 属性のアイコン[ID:0,…] E_ICON = [0, 50, 2, 4, 14, 16, 12, 0, 0, 104, 105, 106, 107, 108, 109, 110, 111] end #============================================================================== # ■ Window_Equip #============================================================================== class Window_Equip < Window_Selectable attr_accessor :info_window #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 336, WLH * 5 + 32 + 8) @actor = actor refresh self.index = 0 @info_window = nil end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) @info_window.refresh(item) unless @info_window.nil? end end #============================================================================== # ■ Window_EquipItem #============================================================================== class Window_EquipItem < Window_Item attr_accessor :info_window #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_ex initialize def initialize(x, y, width, height, actor, equip_type) @info_window = nil initialize_ex(x, y, width, height, actor, equip_type) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh @column_max = 1 super end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "装備を外します。" : item.description) @info_window.refresh(item) unless @info_window.nil? end end #============================================================================== # ■ Window_EquipStatus #============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 208, WLH * 5 + 32 + 8) @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_graphic(@actor, 160, 32) draw_parameter(0, WLH * 1 + 8, 0) draw_parameter(0, WLH * 2 + 8, 1) draw_parameter(0, WLH * 3 + 8, 2) draw_parameter(0, WLH * 4 + 8, 3) end #-------------------------------------------------------------------------- # ● 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 (0〜3) #-------------------------------------------------------------------------- def draw_parameter(x, y, type) case type when 0 name = Vocab::atk value = @actor.atk new_value = @new_atk when 1 name = Vocab::def value = @actor.def new_value = @new_def when 2 name = Vocab::spi value = @actor.spi new_value = @new_spi when 3 name = Vocab::agi value = @actor.agi new_value = @new_agi end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 80, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 90, y, 30, WLH, value, 2) if new_value != nil and value != new_value self.contents.font.color = system_color self.contents.draw_text(x + 122, y, 20, WLH, "→", 1) self.contents.font.color = new_parameter_color(value, new_value) self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2) end end end #============================================================================== # ■ Window_EquipInfo #============================================================================== class Window_EquipInfo < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 216, 208, 200) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(item=nil) self.contents.clear return if item.nil? if item.is_a?(RPG::Weapon) type = item.two_handed ? "両手武器" : "片手武器" prm_t = "命中率"; prm = item.hit ele = "攻撃属性" else type = [Vocab.armor1+"防具", Vocab.armor2+"防具", Vocab.armor3+"防具", Vocab.armor4][item.kind] prm_t = "回避率補正"; prm = item.eva ele = "防御属性" end txt = [Vocab.atk, Vocab.def, Vocab.spi, Vocab.agi] self.contents.font.color = system_color self.contents.draw_text(0, WLH*0, 100, WLH, "種別") for i in 0...txt.size self.contents.draw_text(0, WLH*(i+1), 100, WLH, txt[i]) end self.contents.draw_text(0, WLH*5, 100, WLH, prm_t) self.contents.draw_text(0, WLH*6, 100, WLH, ele) if EquipEx::USE_ELE # self.contents.font.color = normal_color self.contents.draw_text(100, WLH*0, 160, WLH, type) prms = [item.atk, item.def, item.spi, item.agi] for i in 0...prms.size prm = prms[i] self.contents.font.color = parameter_color(prm) self.contents.draw_text(80, WLH*(i+1), 60, WLH, parameter_value(prm), 2) end self.contents.draw_text(100, WLH*5, 60, WLH, prm.to_s+" %", 2) if EquipEx::USE_ELE i = 0 for element_id in item.element_set next unless EquipEx::ELEMENTS.include?(element_id) draw_element_icon(element_id, 100+i*24, WLH*6) i += 1 end end end #-------------------------------------------------------------------------- # ● 属性アイコンの描画 #-------------------------------------------------------------------------- def draw_element_icon(element_id, x, y, enabled = true) draw_icon(EquipEx::E_ICON[element_id], x, y, enabled) end #-------------------------------------------------------------------------- # ● 能力値変化の描画色取得 #-------------------------------------------------------------------------- def parameter_color(value) return power_up_color if value > 0 # 強くなる return normal_color if value == 0 # 変わらず return power_down_color # 弱くなる end #-------------------------------------------------------------------------- # ● 能力値変化のテキスト #-------------------------------------------------------------------------- def parameter_value(value) return "+#{value}" if value > 0 # 強くなる return "±#{value}" if value == 0 # 変わらず return "−#{value}" # 弱くなる end end #============================================================================== # ■ Scene_Equip #============================================================================== class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # ● 定数 #-------------------------------------------------------------------------- EQUIP_TYPE_MAX = 5 # 装備部位の数 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_index : アクターインデックス # equip_index : 装備インデックス #-------------------------------------------------------------------------- def initialize(actor_index = 0, equip_index = 0, menu_index = 2) @actor_index = actor_index @equip_index = equip_index @menu_index = menu_index end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_party.members[@actor_index] @help_window = Window_Help.new create_item_windows @info_window = Window_EquipInfo.new @equip_window = Window_Equip.new(208, 56, @actor) @equip_window.info_window = @info_window @equip_window.help_window = @help_window @equip_window.index = @equip_index @status_window = Window_EquipStatus.new(0, 56, @actor) end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose @info_window.dispose @equip_window.dispose @status_window.dispose dispose_item_windows end #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(@menu_index) end #-------------------------------------------------------------------------- # ● 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index, @menu_index) end #-------------------------------------------------------------------------- # ● 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index, @menu_index) end #-------------------------------------------------------------------------- # ● アイテムウィンドウの作成 #-------------------------------------------------------------------------- def create_item_windows @item_windows = [] for i in 0...EQUIP_TYPE_MAX @item_windows[i] = Window_EquipItem.new(208, 208, 544-208, 200, @actor, i) @item_windows[i].help_window = @help_window @item_windows[i].visible = (@equip_index == i) @item_windows[i].y = 216 # @item_windows[i].height = 200 @item_windows[i].active = false @item_windows[i].index = -1 end end #-------------------------------------------------------------------------- # ● 装備部位選択の更新 #-------------------------------------------------------------------------- def update_equip_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) if @actor.fix_equipment Sound.play_buzzer else Sound.play_decision @equip_window.active = false @item_window.active = true @item_window.index = 0 @equip_window.info_window = nil @item_window.info_window = @info_window @item_window.update_help end end end #-------------------------------------------------------------------------- # ● アイテム選択の更新 #-------------------------------------------------------------------------- def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel @equip_window.active = true @item_window.active = false @item_window.index = -1 @item_window.info_window = nil @equip_window.info_window = @info_window @equip_window.update_help elsif Input.trigger?(Input::C) Sound.play_equip @actor.change_equip(@equip_window.index, @item_window.item) @equip_window.active = true @item_window.active = false @item_window.index = -1 @equip_window.refresh for item_window in @item_windows item_window.refresh end @item_window.info_window = nil @equip_window.info_window = @info_window @equip_window.update_help end end end