=begin ◆概要 使用するまで効果が分からないアイテムを製作します。 ◆機能 ・アイテムを使用するまで「?」で説明文が埋め尽くされます。 ・アイテムのメモ欄に\des(文章)と書くことにより、「?」の代わりにその文章が表示 されるようになります。 ◆仕様 ・使用できないアイテム、武器、防具の説明文は通常通りです。 ◆使用上の注意 ・★……エイリアス ●……再定義 ○……新規定義 ・再定義があるので上の方に。 =end module FAI DESCRIPTION = "\des" end class RPG::Item < RPG::UsableItem def description2 self.note.each_line { |line| if line.include?(FAI::DESCRIPTION) return line[4, line.length - 4] end } return "?" * (description.length / 2) end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :identified_item # 判別後アイテムの配列 #-------------------------------------------------------------------------- # ★ オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_ident initialize def initialize initialize_ident @identified_item = [] # 判別後アイテムの配列 end #-------------------------------------------------------------------------- # ● アイテムの消耗 #-------------------------------------------------------------------------- def consume_item(item) if item.is_a?(RPG::Item) and item.consumable lose_item(item, 1) identified_item << item.id if !identified_item.include?(item.id) end end end #============================================================================== # ■ Window_Item #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help if item == nil @help_window.set_text("") elsif item.is_a?(RPG::Item) and (item.battle_ok? or item.menu_ok?) arr = $game_party.identified_item @help_window.set_text(arr.include?(item.id) ? item.description : item.description2) else @help_window.set_text(item.description) end end end #============================================================================== # ■ Window_ShopBuy #============================================================================== class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help if item == nil @help_window.set_text("") elsif item.is_a?(RPG::Item) and (item.battle_ok? or item.menu_ok?) arr = $game_party.identified_item @help_window.set_text(arr.include?(item.id) ? item.description : item.description2) else @help_window.set_text(item.description) end end end