#============================================================================== # ¡á Harts_Window_ItemTitle #------------------------------------------------------------------------------ # ¡¡¾ÆÀÌÅÛ È­¸é¿¡¼­ ŸÀÌƲÀ» Ç¥½ÃÇÏ´Â À©µµ¿ì¡£ #============================================================================== class Harts_Window_ItemTitle < Window_Base #-------------------------------------------------------------------------- # ¡Ü «ª«Ö«¸«§«¯«ÈôøÑ¢ûù #-------------------------------------------------------------------------- def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.clear self.contents.font.color = normal_color self.contents.draw_shadow_text(4, 0, 120, 32, "I T E M", 1) end end #============================================================================== # ¡á Harts_Window_ItemCommand #------------------------------------------------------------------------------ # ¡¡«¢«¤«Æ«àªÎðúܬàÔ?ªòú¼ª¦«¦«£«ó«É«¦ªÇª¹¡£ #============================================================================== class Harts_Window_ItemCommand < Window_Selectable #-------------------------------------------------------------------------- # ¡Ü «ª«Ö«¸«§«¯«ÈôøÑ¢ûù #-------------------------------------------------------------------------- def initialize super(0, 64, 160, 225) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 6 @commands = ["µµ±¸", $data_system.words.weapon, "¹æÆÐ", $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4,] refresh self.index = 0 end #-------------------------------------------------------------------------- # ¡Ü «ê«Õ«ì«Ã«·«å #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # ¡Ü ú£ÙͪÎÙÚ? # index : ú£ÙÍÛã? # color : Ùþí®ßä #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color y = index * 32 self.contents.draw_shadow_text(4, y, 128, 32, @commands[index]) end #-------------------------------------------------------------------------- # ¡Ü «Ø«ë«×«Æ«­«¹«ÈÌÚãæ #-------------------------------------------------------------------------- def update_help case self.index when 0 @text = @commands[0] when 1 @text = @commands[1] when 2 @text = @commands[2] when 3 @text = @commands[3] when 4 @text = @commands[4] when 5 @text = @commands[5] end @help_window.set_text(@text) end end #============================================================================== # ¡á Window_Item #------------------------------------------------------------------------------ # ¡¡«¢«¤«Æ«à?ØüªÇ¡¢á¶ò¥«¢«¤«Æ«àªÎìé?ªòøúãƪ¹ªë«¦«£«ó«É«¦ªÇª¹¡£ #============================================================================== class Harts_Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ¡Ü «ª«Ö«¸«§«¯«ÈôøÑ¢ûù #-------------------------------------------------------------------------- def initialize super(160, 0, 480, 416) refresh self.index = 0 end #-------------------------------------------------------------------------- # ¡Ü «¢«¤«Æ«àªÎö¢Ôð #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ¡Ü «ê«Õ«ì«Ã«·«å #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] end #-------------------------------------------------------------------------- # ¡Ü «¢«¤«Æ«àìé?àâïÒ # command : àÔ?ñéªÎ«³«Þ«ó«É #-------------------------------------------------------------------------- def set_item(command) refresh case command when 0 for i in 1...$data_items.size if ($game_party.item_number(i) > 0) @data.push($data_items[i]) end end when 1 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end when 2 for i in 1...$data_armors.size if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 3 for i in 1...$data_armors.size if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 4 for i in 1...$data_armors.size if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 5 for i in 1...$data_armors.size if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end end # ú£ÙÍ?ª¬ 0 ªÇªÊª±ªìªÐ«Ó«Ã«È«Þ«Ã«×ªòíÂà÷ª·¡¢îïú£ÙͪòÙÚ? @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.clear for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # ¡Ü ðú׾ܬ«¢«¤«Æ«à?ªÎö¢Ôð #-------------------------------------------------------------------------- def item_number return @item_max end #-------------------------------------------------------------------------- # ¡Ü ú£ÙͪÎÙÚ? # index : ú£ÙÍÛã? #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = normal_color end x = 4 y = index * 32 bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255) self.contents.draw_shadow_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_shadow_text(x + 400, y, 16, 32, ":", 1) self.contents.draw_shadow_text(x + 416, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # ¡Ü «Ø«ë«×«Æ«­«¹«ÈÌÚãæ #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================================== # ¡á Harts_Scene_Item #------------------------------------------------------------------------------ # ¡¡«¢«¤«Æ«à?ØüªÎ?×âªòú¼ª¦«¯«é«¹ªÇª¹¡£î¢ïÒëù #============================================================================== class Scene_Item #-------------------------------------------------------------------------- # ¡Ü «á«¤«ó?×â #-------------------------------------------------------------------------- def main # «¿«¤«È«ë«¦«£«ó«É«¦ªòíÂà÷ @itemtitle_window = Harts_Window_ItemTitle.new #«³«Þ«ó«É«¦«£«ó«É«¦ªòíÂà÷ @itemcommand_window = Harts_Window_ItemCommand.new @command_index = @itemcommand_window.index #«¢«¤«Æ«à«¦«£«ó«É«¦ªòíÂà÷ @itemlist_window = Harts_Window_ItemList.new @itemlist_window.active = false #«Ø«ë«×«¦«£«ó«É«¦ªòíÂà÷ @help_window = Window_Help.new @help_window.x = 0 @help_window.y = 416 # «Ø«ë«×«¦«£«ó«É«¦ªò?Ö§Üõª± @itemcommand_window.help_window = @help_window @itemlist_window.help_window = @help_window # «¿?«²«Ã«È«¦«£«ó«É«¦ªòíÂà÷ (ÜôʦãÊ?Þª«¢«¯«Æ«£«ÖªËàâïÒ) @target_window = Window_Target.new @target_window.visible = false @target_window.active = false # °ñµå À©µµ¿ì¸¦ ÀÛ¼º @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 289 # «¢«¤«Æ«à«¦«£«ó«É«¦?é»øúãÆ @itemlist_window.set_item(@command_index) # «È«é«ó«¸«·«ç«ó?ú¼ Graphics.transition # «á«¤«ó«ë?«× loop do # «²?«à?ØüªòÌÚãæ Graphics.update # ìýÕôï×ÜêòÌÚãæ Input.update # «Õ«ì?«àÌÚãæ update # ?Øüª¬ï·ªêôðªïªÃª¿ªé«ë?«×ªòñé? if $scene != self break end end # «È«é«ó«¸«·«ç«óñÞÝá Graphics.freeze # «¦«£«ó«É«¦ªòú°Û¯ @itemtitle_window.dispose @itemcommand_window.dispose @itemlist_window.dispose @help_window.dispose @gold_window.dispose @target_window.dispose end #-------------------------------------------------------------------------- # ¡Ü «Õ«ì?«àÌÚãæ #-------------------------------------------------------------------------- def update # «¦«£«ó«É«¦ªòÌÚãæ @itemtitle_window.update @itemcommand_window.update @itemlist_window.update @help_window.update @gold_window.update @target_window.update if @command_index != @itemcommand_window.index @command_index = @itemcommand_window.index @itemlist_window.set_item(@command_index) end # «³«Þ«ó«É«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê: update_itemcommand ªòû¼ªÖ if @itemcommand_window.active update_itemcommand return end # «¢«¤«Æ«à«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê: update_itemlist ªòû¼ªÖ if @itemlist_window.active update_itemlist return end # «¿?«²«Ã«È«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê: update_target ªòû¼ªÖ if @target_window.active update_target return end end #-------------------------------------------------------------------------- # ¡Ü «Õ«ì?«àÌÚãæ («³«Þ«ó«É«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê) #-------------------------------------------------------------------------- def update_itemcommand # B «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::B) # «­«ã«ó«»«ë SE ªòæÑñ´ $game_system.se_play($data_system.cancel_se) # «á«Ë«å??ØüªËï·ªêô𪨠$scene = Scene_Menu.new return end # C «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::C) # àÔ?ñéªÎ«³«Þ«ó«ÉªÎ«¢«¤«Æ«àª¬ªÊª¤íÞùê if @itemlist_window.item_number == 0 # «Ö«¶? SE ªòæÑñ´ $game_system.se_play($data_system.buzzer_se) return end # ̽ïÒ SE ªòæÑñ´ $game_system.se_play($data_system.decision_se) # «¢«¤«Æ«à«¦«£«ó«É«¦ªò«¢«¯«Æ«£«ÖªËª¹ªë @itemcommand_window.active = false @itemlist_window.active = true @itemlist_window.index = 0 return end end #-------------------------------------------------------------------------- # ¡Ü «Õ«ì?«àÌÚãæ («¢«¤«Æ«à«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê) #-------------------------------------------------------------------------- def update_itemlist # B «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::B) # «­«ã«ó«»«ë SE ªòæÑñ´ $game_system.se_play($data_system.cancel_se) # «¢«¤«Æ«à«¦«£«ó«É«¦ªò«¢«¯«Æ«£«ÖªËª¹ªë @itemcommand_window.active = true @itemlist_window.active = false @itemlist_window.index = 0 @itemcommand_window.index = @command_index return end # C «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::C) # «¢«¤«Æ«à«¦«£«ó«É«¦ªÇúÞî¤àÔ?ªµªìªÆª¤ªë«Ç?«¿ªòö¢Ôð @item = @itemlist_window.item # ÞÅéÄ«¢«¤«Æ«àªÇªÏªÊª¤íÞùê unless @item.is_a?(RPG::Item) # «Ö«¶? SE ªòæÑñ´ $game_system.se_play($data_system.buzzer_se) return end # ÞÅéĪǪ­ªÊª¤íÞùê unless $game_party.item_can_use?(@item.id) # «Ö«¶? SE ªòæÑñ´ $game_system.se_play($data_system.buzzer_se) return end # ̽ïÒ SE ªòæÑñ´ $game_system.se_play($data_system.decision_se) # ?ÍýÛô?ª¬Ú«Û°ªÎíÞùê if @item.scope >= 3 # «¿?«²«Ã«È«¦«£«ó«É«¦ªò«¢«¯«Æ«£«Öûù @itemlist_window.active = false @target_window.x = 304 @target_window.visible = true @target_window.active = true # ?ÍýÛô? (??/îï?) ªË?ª¸ªÆ««?«½«ëêÈöǪòàâïÒ if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end # ?ÍýÛô?ª¬Ú«Û°ì¤èâªÎíÞùê else # «³«â«ó«¤«Ù«ó«È ID ª¬êó?ªÎíÞùê if @item.common_event_id > 0 # «³«â«ó«¤«Ù«ó«Èû¼ªÓõóª·åøå³ $game_temp.common_event_id = @item.common_event_id # «¢«¤«Æ«àªÎÞÅéÄãÁ SE ªòæÑñ´ $game_system.se_play(@item.menu_se) # á¼ÙÄù¡ªÎíÞùê if @item.consumable # ÞÅéĪ·ª¿«¢«¤«Æ«àªò 1 Êõªéª¹ $game_party.lose_item(@item.id, 1) # «¢«¤«Æ«à«¦«£«ó«É«¦ªÎú£Ùͪòî¢ÙÚ? @itemlist_window.draw_item(@itemlist_window.index) end # «Þ«Ã«×?ØüªËï·ªêô𪨠$scene = Scene_Map.new return end end return end end #-------------------------------------------------------------------------- # ¡Ü «Õ«ì?«àÌÚãæ («¿?«²«Ã«È«¦«£«ó«É«¦ª¬«¢«¯«Æ«£«ÖªÎíÞùê) #-------------------------------------------------------------------------- def update_target # B «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::B) # «­«ã«ó«»«ë SE ªòæÑñ´ $game_system.se_play($data_system.cancel_se) # «¢«¤«Æ«àï·ªìªÊªÉªÇÞÅéĪǪ­ªÊª¯ªÊªÃª¿íÞùê unless $game_party.item_can_use?(@item.id) # «¢«¤«Æ«à«¦«£«ó«É«¦ªÎ?黪òî¢íÂà÷ @itemlist_window.refresh end # «¿?«²«Ã«È«¦«£«ó«É«¦ªòá¼ËÛ @itemlist_window.active = true @target_window.visible = false @target_window.active = false @itemlist_window.set_item(@command_index) return end # C «Ü«¿«óª¬ä㪵ªìª¿íÞùê if Input.trigger?(Input::C) # «¢«¤«Æ«àªòÞŪ¤ï·ªÃª¿íÞùê if $game_party.item_number(@item.id) == 0 # «Ö«¶? SE ªòæÑñ´ $game_system.se_play($data_system.buzzer_se) return end # «¿?«²«Ã«Èª¬îï?ªÎíÞùê if @target_window.index == -1 # «Ñ?«Æ«£îï?ªË«¢«¤«Æ«àªÎÞÅéÄ?ÍýªòîêéÄ used = false for i in $game_party.actors used |= i.item_effect(@item) end end # «¿?«²«Ã«Èª¬??ªÎíÞùê if @target_window.index >= 0 # «¿?«²«Ã«ÈªÎ«¢«¯«¿?ªË«¢«¤«Æ«àªÎÞÅéÄ?ÍýªòîêéÄ target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # «¢«¤«Æ«àªòÞŪê¿íÞùê if used # «¢«¤«Æ«àªÎÞÅéÄãÁ SE ªòæÑñ´ $game_system.se_play(@item.menu_se) # á¼ÙÄù¡ªÎíÞùê if @item.consumable # ÞÅéĪ·ª¿«¢«¤«Æ«àªò 1 Êõªéª¹ $game_party.lose_item(@item.id, 1) # «¢«¤«Æ«à«¦«£«ó«É«¦ªÎú£Ùͪòî¢ÙÚ? @itemlist_window.draw_item(@itemlist_window.index) @itemlist_window.set_item(@command_index) end # «¿?«²«Ã«È«¦«£«ó«É«¦ªÎ?黪òî¢íÂà÷ @target_window.refresh # îïØþªÎíÞùê if $game_party.all_dead? # «²?«à«ª?«Ð??ØüªËï·ªêô𪨠$scene = Scene_Gameover.new return end # «³«â«ó«¤«Ù«ó«È ID ª¬êó?ªÎíÞùê if @item.common_event_id > 0 # «³«â«ó«¤«Ù«ó«Èû¼ªÓõóª·åøå³ $game_temp.common_event_id = @item.common_event_id # «Þ«Ã«×?ØüªËï·ªêô𪨠$scene = Scene_Map.new return end end # «¢«¤«Æ«àªòÞŪïªÊª«ªÃª¿íÞùê unless used # «Ö«¶? SE ªòæÑñ´ $game_system.se_play($data_system.buzzer_se) end return end end end