#============================================================================== # □ ウィンドウアイコン化 #------------------------------------------------------------------------------ #  スキルやアイテムのウィンドウをアイコンで表示するスクリプトです。 #============================================================================== ITEM_FLAG = true # true のとき、アイテムウィンドウをアイコン表示します。 SKILL_FLAG = true # true のとき、スキルウィンドウをアイコン表示します。 #============================================================================== # □ Window_Help #------------------------------------------------------------------------------ #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。 #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ○ テキスト設定 # text : ウィンドウに表示する文字列 # align : アラインメント (0..左揃え、1..中央揃え、2..右揃え) #-------------------------------------------------------------------------- def set_text(text, flag = false, item = nil, number = nil, align = 0) if text != @text or item != @item or number != @number or align != @align self.contents.clear self.contents.font.color = normal_color if flag self.height = WLH * 2 + 32 create_contents if item != nil draw_item_name(item, 4, 0) if number != nil self.contents.draw_text(28, 0, 200, WLH, sprintf("%2d", number), 2) end self.contents.draw_text(4, WLH, self.width - 40, WLH, text, align) end else self.contents.draw_text(4, 0, self.width - 40, WLH, text, align) end @text = text @item = item @number = number @align = align end end end if ITEM_FLAG #============================================================================== # □ Window_Item #------------------------------------------------------------------------------ #  アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y + WLH, width, height - WLH, 3) @column_max = 19 self.index = 0 refresh end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil enabled = enable?(item) if item != nil draw_icon(item.icon_index, rect.x, rect.y, enabled) end end end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help number = $game_party.item_number(item) @help_window.set_text(item == nil ? "" : item.description, true, item, number) end end #============================================================================== # □ Scene_Item #------------------------------------------------------------------------------ #  アイテム画面の処理を行うクラスです。 #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # ○ アイテムの決定 #-------------------------------------------------------------------------- def determine_item if @item.for_friend? show_target_window(@item_window.index % @column_max < @column_max / 2) if @item.for_all? @target_window.index = 99 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_item_nontarget end end end #============================================================================== # □ Window_Equip #------------------------------------------------------------------------------ #  装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。 #============================================================================== class Window_Equip < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y + WLH, 336, WLH * 5 + 32) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description, true, item, nil) end end #============================================================================== # □ Window_EquipStatus #------------------------------------------------------------------------------ #  装備画面で、アクターの能力値変化を表示するウィンドウです。 #============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y + WLH, 208, WLH * 5 + 32) @actor = actor refresh end end #============================================================================== # □ Scene_Equip #------------------------------------------------------------------------------ #  装備画面の処理を行うクラスです。 #============================================================================== class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # ○ アイテムウィンドウの作成 #-------------------------------------------------------------------------- def create_item_windows @item_windows = [] for i in 0...EQUIP_TYPE_MAX @item_windows[i] = Window_EquipItem.new(0, 208, 544, 208, @actor, i) @item_windows[i].help_window = @help_window @item_windows[i].visible = (@equip_index == i) @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 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 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 end end end end if SKILL_FLAG #============================================================================== # □ Window_Skill #------------------------------------------------------------------------------ #  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y + WLH, width, height - WLH, 3) @actor = actor @column_max = 19 self.index = 0 refresh end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil enabled = @actor.skill_can_use?(skill) if skill != nil draw_icon(skill.icon_index, rect.x, rect.y, enabled) end end end #-------------------------------------------------------------------------- # ○ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description, true, skill, skill == nil ? "" : @actor.calc_mp_cost(skill)) end end #============================================================================== # □ Window_SkillStatus #------------------------------------------------------------------------------ #  スキル画面で、スキル使用者のステータスを表示するウィンドウです。 #============================================================================== class Window_SkillStatus < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y + WLH, 544, WLH + 32) @actor = actor refresh end end #============================================================================== # □ Scene_Skill #------------------------------------------------------------------------------ #  スキル画面の処理を行うクラスです。 #============================================================================== class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # ○ スキルの決定 #-------------------------------------------------------------------------- def determine_skill if @skill.for_friend? show_target_window(@skill_window.index % @column_max < @column_max / 2) if @skill.for_all? @target_window.index = 99 elsif @skill.for_user? @target_window.index = @actor_index + 100 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_skill_nontarget end end end end