#============================================================================== # RMVX Ver 2.0¸¦ À§ÇÑ ±â¼ú »óÁ¡ #============================================================================== # Nechigawara SanzeninÀÇ # °æ°í!! : ÀÌ ¿øº»Àº RPG Á¦ÀÛÀÚ¿¡ VX¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù!! (XP Áö¿ø ¾Æ´Õ´Ï´Ù) #============================================================================== # RMVX¸¦ À§ÇÑ ±¸¸Å ±â¼ú ¼±ÅÃ±Ç #============================================================================== #Version Å볪¹« #============================================================================== #2.0´Â ¼öÆò ÇÊ¿äÁ¶°ÇÀ» Ãß°¡ÇÑ´Ù - ij¸¯ÅÍ Ãß·Á³½ âÀ» ¹Ù²Ù½Ê½Ã¿À #============================================================================== =begin »ç¿ëÇÏ´Â ¹æ¹ý: ¿øº»À» Àα⠻óÇ°À» À§ÇÑ ±â¼úÀÇ ID¸¦ ³õ±â À§ÇÏ¿© ºÎ¸£±â À§ÇÏ¿© ´ç½ÅÀº "$skill_shop =[Id of Skill]"À»Ãß°¡ÇϽʽÿÀ ±â¼ú »óÁ¡ Windows¸¦ ºÎ¸£±â À§ÇÏ¿©. ´ç½ÅÀº "$scene = Scene_Skill_Shop.new" ¸¦ Ãß°¡ÇϽʽÿÀ º¸±â: $skill_shop = [1,2,3,6,7] $scene = Scene_Skill_Shop.new ´ç½ÅÀº ÀÌ ½ºÅ©¸³Æ®·ÎÀÛµ¿ÇÏ´Â ±â¼ú»óÁ¡À» ¹Ø¿¡ ¿É¼ÇÀǷμöÁ¤ÇϽǼöÀÖ½À´Ï´Ù. ¼öÁ¤ÀÌ °¡´ÉÇѰ͵é: °¡°Ý,½ºÅ³,·¹¹ë,¿ë¾îµîµîÀÌÀÖ½À´Ï´Ù. ´ç½ÅÀº ij¸¯ÅÍ ÀÚ·á¿¡¼­ ÀÌ°Í °°ÀÌ Á¶Á¤ÇÏ¿© º¸±âÇϽʽÿÀ [IDÀÇ ±â¼ú, ¼öÆò ÇÊ¿äÁ¶°ÇÀº ±â¼úÀ» ¹è¿ì·Á¸é¸¸Á·ÇؾߵȴÙ.] =end #============================================================================== #´ÜÀ§ ±â¼ú »óÁ¡ #============================================================================== ´ÜÀ§ ±â¼ú »óÁ¡ # ±â¼ú»óÁ¡¿É¼Ç How_Learn = "¾î¶² ij¸¯ÅÍÀÌ ¹è¿ï±î¿ä?" Can_Learn = "¹è¿ï¼öÀÖ´ÂÁ¶°ÇÀ»¸¸Á·ÇÏ¿´½À´Ï´Ù." Can_Learn_Lv = "·¹º§" Cant_Learn = "¾ÆÁ÷ ¹è¿ì±â¿¡´Â ¹«¸®ÀÔ´Ï´Ù." Learnt = "ÀÍÈù ½ºÅ³" Teach = "½ºÅ³À» ¹è¿î´Ù" Cancel = "Ãë¼Ò" # °¡°Ý¹×ÀÚ·á PRICE = { # ¼³Á¤µÇÁö¾ÊÀº ±â¼ú °¡°Ý 0 => 100, # ±â¼úÀÇ°¡°ÝÀ» ¿©±â¿¡¼­ Ãß°¡ÇϽʽÿÀ 1 => 150, 2 => 550, 3 => 450, 30 => 4500, # ³¡ } # ij¸¯ÅÍ ÀÚ·á SKILL_BUY = { # ¹«½¼ ij¸¯ÅÍ°¡ ±â¼úÀÇ ±¸¸Å¸¦ ÇÒ¼ö ÀÖ´ÂÁö ¿©±â¿¡¼­ Ãß°¡ÇϽʽÿÀ # [ID ÀDZâ¼ú, ¼öÁØ] 1 => [ [1,1],[2,3],[3,1], ], 2 => [ [1,4],[2,3],[3,1], ], # ³¡ } # °¡°ÝÀ» Ãß°¡ÇϽʽÿÀ def self.skill_price(id) if PRICE.include?(id) return PRICE[id] else return PRICE[0] end end # ij¸¯ÅÍ ID¸¦ Ãß°¡ÇϽʽÿÀ def self.skill_buy(id) if SKILL_BUY.include?(id) return SKILL_BUY[id] else return [] end end end #============================================================================== #Á¾·ù °ÔÀÓ Ä³¸¯ÅÍ #============================================================================== class Game_Actor < Game_Battler def learn?(skill) learn = skill_learn?(skill) if learn == true return false else return true end end end #============================================================================== #Á¾·ù â ±â¼ú ShopBuy #============================================================================== class Window_Skill_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 304, 304) @skill_shop_goods = $skill_shop refresh self.index = 0 end #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- def refresh @data = [] for i in 0...@skill_shop_goods.size skill = $data_skills[@skill_shop_goods[i]] if skill != nil @data.push(skill) end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] price = SKILL_SHOP.skill_price(skill.id) enabled = (price <= $game_party.gold) rect = item_rect(index) self.contents.clear_rect(rect) draw_item_name(skill, rect.x, rect.y, enabled) rect.width -= 4 self.contents.draw_text(rect, price, 2) end #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end #============================================================================== #Á¾·ù â ±â¼ú ShopStatus #============================================================================== class Window_Skill_ShopStatus < Window_Selectable #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 240, 304) @item = nil refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size if @item != nil self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, WLH, SKILL_SHOP::How_Learn) for actor in $game_party.members x = 4 y = WLH * (2 + actor.index * 2) draw_actor_can_learn(actor, x, y) end end end #-------------------------------------------------------------------------- def draw_actor_can_learn(actor, x, y) can = false lv = false ac_lv = 0 can_learn = SKILL_SHOP.skill_buy(actor.id) id = @item.id for i in 0...can_learn.size if can_learn[i][0] == id can = true if can_learn[i][1] <= actor.level lv = true else lv = false ac_lv = can_learn[i][1] end break else can = false end end enabled = (can and lv and actor.learn?(@item)) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 name = actor.character_name index = actor.character_index size = contents.text_size(actor.name).width draw_character(name, index, x + 20 + size , y + 30) self.contents.draw_text(x, y, 200, WLH, actor.name) if can == false text = SKILL_SHOP::Cant_Learn elsif can == true and lv == false ac = ac_lv.to_s text = SKILL_SHOP::Can_Learn_Lv + " " + ac + "+" elsif actor.learn?(@item) == false text = SKILL_SHOP::Learnt else text = SKILL_SHOP::Can_Learn end self.contents.draw_text(x, y, 200, WLH, text, 2) end #-------------------------------------------------------------------------- def item=(item) if @item != item @item = item refresh end end #-------------------------------------------------------------------------- def update_cursor if @index < 0 self.cursor_rect.empty elsif @index < @item_max y = WLH * (2 + @index * 2) self.cursor_rect.set(0, y - 4, contents.width,34) end end end #============================================================================== #Á¾·ù Àå¸é ±â¼ú »óÁ¡ #============================================================================== class Scene_Skill_Shop < Scene_Base #-------------------------------------------------------------------------- def start super create_menu_background create_command_window @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @gold_window = Window_Gold.new(384, 56) @dummy_window = Window_Base.new(0, 112, 544, 304) @buy_window = Window_Skill_ShopBuy.new(0, 112) @buy_window.active = false @buy_window.visible = false @buy_window.help_window = @help_window @status_window = Window_Skill_ShopStatus.new(304, 112) @status_window.visible = false @status_window.active = false end #-------------------------------------------------------------------------- def terminate super dispose_menu_background dispose_command_window @help_window.dispose @gold_window.dispose @dummy_window.dispose @buy_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- def update super update_menu_background @help_window.update @command_window.update @gold_window.update @dummy_window.update @buy_window.update @status_window.update if @command_window.active update_command_selection elsif @buy_window.active update_buy_selection elsif @status_window.active update_target_selection end end #-------------------------------------------------------------------------- def create_command_window s1 = SKILL_SHOP::Teach s2 = SKILL_SHOP::Cancel @command_window = Window_Command.new(384, [s1, s2], 2) @command_window.y = 56 end #-------------------------------------------------------------------------- def dispose_command_window @command_window.dispose end #-------------------------------------------------------------------------- def update_command_selection @help_window.set_text("") if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) case @command_window.index when 0 Sound.play_decision @command_window.active = false @dummy_window.visible = false @buy_window.active = true @buy_window.visible = true @buy_window.refresh @status_window.visible = true when 1 Sound.play_decision $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- def update_buy_selection @status_window.item = @buy_window.skill if Input.trigger?(Input::B) Sound.play_cancel @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil return end if Input.trigger?(Input::C) @item = @buy_window.skill @price = SKILL_SHOP.skill_price(@item.id) enabled = (@price <= $game_party.gold) if not enabled Sound.play_buzzer else Sound.play_decision show_target_window end end end #-------------------------------------------------------------------------- def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel hide_target_window elsif Input.trigger?(Input::C) @actor = $game_party.members[@status_window.index] can = false lv = false can_learn = SKILL_SHOP.skill_buy(@actor.id) id = @item.id for i in 0...can_learn.size if can_learn[i][0] == id can = true if can_learn[i][1] <= @actor.level lv = true else lv = false end break else can = false end end enabled = (can and lv and @actor.learn?(@item)) if not enabled Sound.play_buzzer else learn_target(@item.id) end end end #-------------------------------------------------------------------------- def learn_target(skill_id) Sound.play_shop @actor.learn_skill(skill_id) $game_party.lose_gold(@price) @buy_window.refresh @gold_window.refresh @status_window.refresh hide_target_window end #-------------------------------------------------------------------------- def show_target_window @buy_window.active = false @status_window.active = true @status_window.index = 0 end #-------------------------------------------------------------------------- def hide_target_window @buy_window.active = true @status_window.active = false @status_window.index =- 1 end end