| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 0 |  
| 经验 | 0 |  
| 最后登录 | 2012-6-3 |  
| 在线时间 | 8 小时 |  
 Lv1.梦旅人 
	梦石0 星屑316 在线时间8 小时注册时间2010-12-5帖子2 | 
| #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/    ◆ 物品合成 - KGC_ComposeItem ◆ VX ◆
 #_/    ◇ Last update : 2008/01/25 ◇
 #_/----------------------------------------------------------------------------
 #_/                     可制作合成物品。
 #_/                    部分翻译:八云 紫
 #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
 #==============================================================================
 # ★ 定做項目 - Customize ★
 #==============================================================================
 
 module KGC
 module ComposeItem
 # ◆ 将合成画面调用的开关号码
 #  把这个开关设定为 ON 的话,可代替通常的店铺并使用合成功能。
 COMPOSE_CALL_SWITCH = 1
 
 # ◆ 合成物素材设定,通常格式:
 #  ≪费用,"物品类型:ID,个数",... ≫
 #  【 费用 】合成物品所需的费用
 #  【 物品种类 】合成素材的种类  (I..物品  W..武器  A..防具)
 #  【  ID  】合成素材的ID (↑要与以上相对应)
 #  【 个数 】合成物品所需素材的数目
 #  "物品种类:ID,個数" 。多个的时候也可以这样设定。
 #  可省略数目。写成 "物品类型:ID" 。如果没写的话,将用默认设定个数为1。
 #  如果把个数设定为0的话,持有1个以上时也可以合成,但是合成成功的话,将
 #不会扣除所设定的物品。
 #  按一下设定的排列,添加的顺序与物品・武器・防具的ID相对应。
 RECIPE_ITEM   = []  # 物品
 RECIPE_WEAPON = []  # 武器
 RECIPE_ARMOR  = []  # 防具
 # 从这里开始,自定义合成公式(找不到好的词)。
 #  <例如>
 #  物品ID为8的合成公式
 #  物品ID 2, 4, 7 各消耗1个,免费合成。
 RECIPE_ITEM[8] = [0, "I:2", "I:4", "I:7"]
 #  武器ID:16 的合成公式
 #  武器ID:10 消耗1个、物品ID:16 消耗 2 个,合成费用800 G。
 RECIPE_WEAPON[16] = [800, "W:10", "I:16,2"]
 RECIPE_WEAPON[1] = [0,"I:1,2"]
 
 # ◆ 合成指令名
 #  可替代普通商店的购买指令。
 #  ※ 想要修改指令名字的话,可在下面的[Vocab]后做修改。
 VOCAB_COMPOSE_ITEM = "合成"
 # ◆ 合成物品的信息转换按键
 #  「所需材料 <=转换=> 角色能力值変化(为装备品时)」信息变换按键。
 #  不使用的时候,请设定成 nil。
 SWITCH_INFO_BUTTON = Input::X
 
 # ◆ 必要设定
 #  当合成的材料为较多数时,请设定成 true。(其实就是合成素材的行距与字的大小)
 COMPACT_MATERIAL_LIST = true
 # ◆ 不显示命令窗口。
 #  这与XP是相似的。
 HIDE_COMMAND_WINDOW   = true
 # ◆ 不显示所持金钱数
 HIDE_GOLD_WINDOW      = false
 # ◆ 当合成费用是0时, 不显示费用。
 HIDE_ZERO_COST        = true
 
 # ◆ 不表示费用与素材不足的合成列表。
 #  之前合成过的物品的显名表示。
 HIDE_SHORTAGE_RECIPE     = false
 # ◆ 没有合成的物品隐藏物品名字, true为隐藏。
 MASK_UNKNOWN_RECIPE_NAME = false
 # ◆ 没有合成过的物品在列表上的表示方法
 #  以下设定隐藏名,当物品名字为多个时,按以下设定扩展名字。
 UNKNOWN_NAME_MASK        = "?"
 # ◆ 没有合成过的物品,隐藏帮助信息。
 HIDE_UNKNOWN_RECIPE_HELP = true
 # ◆ 没有合成过在物品在列表上的帮助 信息。
 UNKNOWN_RECIPE_HELP      = "合成列表"
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 $imported = {} if $imported == nil
 $imported["ComposeItem"] = true
 
 module KGC::ComposeItem
 # 定义正则表达式
 module Regexp
 # 合成列表
 RECIPE = /([IWA])[ ]*:[ ]*(\d+)([ ]*,[ ]*\d+)?/i
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # ■ Vocab
 #==============================================================================
 
 module Vocab
 # 合成画面
 ComposeItem = KGC::ComposeItem::VOCAB_COMPOSE_ITEM
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # ■ RPG::BaseItem
 #==============================================================================
 
 class RPG::BaseItem
 #--------------------------------------------------------------------------
 # ○ 变量
 #--------------------------------------------------------------------------
 @@__masked_name =
 KGC::ComposeItem::UNKNOWN_NAME_MASK  # 隐藏名
 @@__expand_masked_name = false         # 隐藏名的扩展表示
 
 if @@__masked_name != nil
 @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
 end
 #--------------------------------------------------------------------------
 # ○ 物品合成费用
 #--------------------------------------------------------------------------
 def create_compose_item_cache
 @__compose_cost = 0
 @__compose_materials = []
 
 # 合成列表取得
 recipe = nil
 case self
 when RPG::Item    # 物品
 recipe = KGC::ComposeItem::RECIPE_ITEM[self.id]
 when RPG::Weapon  # 武器
 recipe = KGC::ComposeItem::RECIPE_WEAPON[self.id]
 when RPG::Armor   # 防具
 recipe = KGC::ComposeItem::RECIPE_ARMOR[self.id]
 end
 return if recipe == nil
 recipe = recipe.dup
 
 @__compose_cost = recipe.shift
 # 合成材料名单
 recipe.each { |r|
 if r =~ KGC::ComposeItem::Regexp::RECIPE
 material = Game_ComposeMaterial.new
 material.kind = $1.upcase                    # 取得材料的种类
 material.id = $2.to_i                        # 取得材料的ID
 if $3 != nil
 material.number = [$3[/\d+/].to_i, 0].max  # 取得必要合成个数
 end
 @__compose_materials << material
 end
 }
 end
 #--------------------------------------------------------------------------
 # ○ 隐藏名
 #--------------------------------------------------------------------------
 def masked_name
 if KGC::ComposeItem::MASK_UNKNOWN_RECIPE_NAME
 if @@__expand_masked_name
 # 隐藏名的扩展表示
 return @@__masked_name * self.name.scan(/./).size
 else
 return @@__masked_name
 end
 else
 return self.name
 end
 end
 #--------------------------------------------------------------------------
 # ○ 合成费用
 #--------------------------------------------------------------------------
 def compose_cost
 create_compose_item_cache if @__compose_cost == nil
 return @__compose_cost
 end
 #--------------------------------------------------------------------------
 # ○ 合成用材料名单
 #--------------------------------------------------------------------------
 def compose_materials
 create_compose_item_cache if @__compose_materials == nil
 return @__compose_materials
 end
 #--------------------------------------------------------------------------
 # ○ 合成列表
 #--------------------------------------------------------------------------
 def is_compose?
 return !compose_materials.empty?
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # ■ Game_Party
 #==============================================================================
 
 class Game_Party < Game_Unit
 #--------------------------------------------------------------------------
 # ○ 合成済みフラグをクリア
 #--------------------------------------------------------------------------
 def clear_composed_flag
 @item_composed = {}
 @weapon_composed = {}
 @armor_composed = {}
 end
 #--------------------------------------------------------------------------
 # ○ アイテムの合成済みフラグを設定
 #     item : アイテム
 #     flag : true..合成済み  false..未合成
 #--------------------------------------------------------------------------
 def set_item_composed(item, flag = true)
 return false unless item.is_a?(RPG::BaseItem)  # アイテム以外
 return false unless item.is_compose?           # 合成アイテム以外
 
 # 合成済みフラグを格納するハッシュを作成
 clear_composed_flag if @item_composed == nil
 
 # 合成済みフラグをセット
 case item
 when RPG::Item    # アイテム
 @item_composed[item.id] = flag
 when RPG::Weapon  # 武器
 @weapon_composed[item.id] = flag
 when RPG::Armor   # 防具
 @armor_composed[item.id] = flag
 end
 end
 #--------------------------------------------------------------------------
 # ○ アイテムの合成済み判定
 #     item : アイテム
 #--------------------------------------------------------------------------
 def item_composed?(item)
 return false unless item.is_a?(RPG::BaseItem)  # アイテム以外
 return false unless item.is_compose?           # 合成アイテム以外
 
 # 合成済みフラグを格納するハッシュを作成
 clear_composed_flag if @item_composed == nil
 
 # 合成済み判定
 case item
 when RPG::Item    # アイテム
 return @item_composed[item.id]
 when RPG::Weapon  # 武器
 return @weapon_composed[item.id]
 when RPG::Armor   # 防具
 return @armor_composed[item.id]
 end
 return false
 end
 #--------------------------------------------------------------------------
 # ○ アイテムの合成可能判定
 #     item : アイテム
 #--------------------------------------------------------------------------
 def item_can_compose?(item)
 return false unless item.is_a?(RPG::BaseItem)  # アイテム以外は不可
 return false unless item.is_compose?           # 合成アイテム以外は不可
 
 return false if gold < item.compose_cost       # 資金不足なら不可
 
 item.compose_materials.each { |material|
 num = item_number(material.item)
 # 素材不足なら不可
 return false if num < material.number || num == 0
 }
 return true
 end
 #--------------------------------------------------------------------------
 # ○ アイテムの合成可能数を取得
 #     item : アイテム
 #--------------------------------------------------------------------------
 def number_of_composable(item)
 return 0 unless item.is_a?(RPG::BaseItem)  # アイテム以外
 return 0 unless item.is_compose?           # 合成アイテム以外
 
 number = ($imported["LimitBreak"] ? item.number_limit : 99)
 if item.compose_cost > 0
 number = [number, gold / item.compose_cost].min
 end
 # 素材数判定
 item.compose_materials.each { |material|
 next if material.number == 0  # 必要数 0 は無視
 n = item_number(material.item) / material.number
 number = [number, n].min
 }
 return number
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # □ Game_ComposeMaterial
 #------------------------------------------------------------------------------
 #   合成素材の情報を格納するクラスです。
 #==============================================================================
 
 class Game_ComposeMaterial
 #--------------------------------------------------------------------------
 # ○ 公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_accessor :kind                     # アイテムの種類 (/[IWA]/)
 attr_accessor :id                       # アイテムの ID
 attr_accessor :number                   # 必要数
 #--------------------------------------------------------------------------
 # ○ オブジェクト初期化
 #--------------------------------------------------------------------------
 def initialize
 @kind = "I"
 @id = 0
 @number = 1
 end
 #--------------------------------------------------------------------------
 # ○ アイテム取得
 #--------------------------------------------------------------------------
 def item
 case @kind
 when "I"  # アイテム
 return $data_items[@id]
 when "W"  # 武器
 return $data_weapons[@id]
 when "A"  # 防具
 return $data_armors[@id]
 else
 return nil
 end
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # ■ Window_Base
 #==============================================================================
 
 class Window_Base < Window
 #--------------------------------------------------------------------------
 # ○ 合成アイテム名の描画
 #     item    : アイテム (スキル、武器、防具でも可)
 #     x       : 描画先 X 座標
 #     y       : 描画先 Y 座標
 #     enabled : 有効フラグ。false のとき半透明で描画
 #--------------------------------------------------------------------------
 def draw_compose_item_name(item, x, y, enabled = true)
 return if item == nil
 
 draw_icon(item.icon_index, x, y, enabled)
 self.contents.font.color = normal_color
 self.contents.font.color.alpha = enabled ? 255 : 128
 self.contents.draw_text(x + 24, y, 172, WLH,
 $game_party.item_composed?(item) ? item.name : item.masked_name)
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # □ Window_ComposeNumber
 #------------------------------------------------------------------------------
 #   合成画面で、合成するアイテムの個数を入力するウィンドウです。
 #==============================================================================
 
 class Window_ComposeNumber < Window_ShopNumber
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
 y = 96
 self.contents.clear
 draw_compose_item_name(@item, 0, y)
 self.contents.font.color = normal_color
 self.contents.draw_text(212, y, 20, WLH, "×")
 self.contents.draw_text(248, y, 20, WLH, @number, 2)
 self.cursor_rect.set(244, y, 28, WLH)
 if !KGC::ComposeItem::HIDE_ZERO_COST || @price > 0
 draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
 end
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # □ Window_ComposeItem
 #------------------------------------------------------------------------------
 #   合成画面で、合成できる商品の一覧を表示するウィンドウです。
 #==============================================================================
 
 class Window_ComposeItem < Window_ShopBuy
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
 @data = []
 for goods_item in @shop_goods
 case goods_item[0]
 when 0
 item = $data_items[goods_item[1]]
 when 1
 item = $data_weapons[goods_item[1]]
 when 2
 item = $data_armors[goods_item[1]]
 end
 # 合成アイテムのみ追加
 @data.push(item) if include?(item)
 end
 @item_max = @data.size
 create_contents
 for i in 0...@item_max
 draw_item(i)
 end
 end
 #--------------------------------------------------------------------------
 # ○ アイテムをリストに含めるかどうか
 #     item : アイテム
 #--------------------------------------------------------------------------
 def include?(item)
 return false if item == nil                # アイテムが nil なら含めない
 return false unless item.is_compose?       # 合成アイテムでなければ含めない
 if KGC::ComposeItem::HIDE_SHORTAGE_RECIPE  # 費用・素材不足を隠す場合
 if !$game_party.item_composed?(item) && !enable?(item)
 return false  # 未合成かつ合成不可なら含めない
 end
 end
 
 return true
 end
 #--------------------------------------------------------------------------
 # ○ アイテムを許可状態で表示するかどうか
 #     item : アイテム
 #--------------------------------------------------------------------------
 def enable?(item)
 return $game_party.item_can_compose?(item)
 end
 #--------------------------------------------------------------------------
 # ● 項目の描画
 #     index : 項目番号
 #--------------------------------------------------------------------------
 def draw_item(index)
 item = @data[index]
 number = $game_party.item_number(item)
 limit = ($imported["LimitBreak"] ? item.number_limit : 99)
 rect = item_rect(index)
 self.contents.clear_rect(rect)
 draw_compose_item_name(item, rect.x, rect.y, enable?(item))
 # 費用を描画
 if !KGC::ComposeItem::HIDE_ZERO_COST || item.compose_cost > 0
 rect.width -= 4
 self.contents.draw_text(rect, item.compose_cost, 2)
 end
 end
 
 if KGC::ComposeItem::HIDE_UNKNOWN_RECIPE_HELP
 #--------------------------------------------------------------------------
 # ● ヘルプテキスト更新
 #--------------------------------------------------------------------------
 def update_help
 item = (index >= 0 ? @data[index] : nil)
 if item == nil || $game_party.item_composed?(item)
 # アイテムが nil か、合成済みなら [Window_ShopBuy] に任せる
 super
 else
 @help_window.set_text(KGC::ComposeItem::UNKNOWN_RECIPE_HELP)
 end
 end
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # □ Window_ComposeStatus
 #------------------------------------------------------------------------------
 #  合成画面で、素材の所持数や必要数を表示するウィンドウです。
 #==============================================================================
 
 class Window_ComposeStatus < Window_ShopStatus
 #--------------------------------------------------------------------------
 # ○ 表示モード
 #--------------------------------------------------------------------------
 MODE_MATERIAL = 0  # 素材リスト
 MODE_STATUS   = 1  # パーティのステータス
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     x : ウィンドウの X 座標
 #     y : ウィンドウの Y 座標
 #--------------------------------------------------------------------------
 def initialize(x, y)
 @mode = MODE_MATERIAL
 super(x, y)
 end
 #--------------------------------------------------------------------------
 # ○ モード変更
 #--------------------------------------------------------------------------
 def change_mode
 case @mode
 when MODE_MATERIAL
 @mode = MODE_STATUS
 when MODE_STATUS
 @mode = MODE_MATERIAL
 end
 self.oy = 0
 refresh
 end
 #--------------------------------------------------------------------------
 # ● ウィンドウ内容の作成
 #--------------------------------------------------------------------------
 def create_contents
 if @mode == MODE_STATUS
 super
 return
 end
 
 self.contents.dispose
 ch = height - 32
 if @item != nil
 mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
 ch = [ch, WLH * (mag + @item.compose_materials.size * mag)].max
 end
 self.contents = Bitmap.new(width - 32, ch)
 end
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
 create_contents
 self.contents.font.size = Font.default_size
 case @mode
 when MODE_MATERIAL
 draw_material_list
 when MODE_STATUS
 super
 end
 end
 #--------------------------------------------------------------------------
 # ○ 素材リストを描画
 #--------------------------------------------------------------------------
 def draw_material_list
 return if @item == nil
 number = $game_party.item_number(@item)
 self.contents.font.color = system_color
 self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
 self.contents.font.color = normal_color
 self.contents.draw_text(4, 0, 200, WLH, number, 2)
 self.contents.font.size = 16 if KGC::ComposeItem::COMPACT_MATERIAL_LIST
 mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
 @item.compose_materials.each_with_index { |material, i|
 y = WLH * (mag + i * mag)
 draw_material_info(0, y, material)
 }
 end
 #--------------------------------------------------------------------------
 # ○ 素材情報を描画
 #--------------------------------------------------------------------------
 def draw_material_info(x, y, material)
 m_item = material.item
 return if m_item == nil
 number = $game_party.item_number(m_item)
 enabled = (number > 0 && number >= material.number)
 draw_item_name(m_item, x, y, enabled)
 if KGC::ComposeItem::COMPACT_MATERIAL_LIST
 m_number = (material.number == 0 ? "-" : sprintf("%d", material.number))
 self.contents.draw_text(x, y, width - 32, WLH,
 sprintf("%s/%d", m_number, number), 2)
 else
 m_number = (material.number == 0 ? "-" : sprintf("%2d", material.number))
 self.contents.draw_text(x, y + WLH, width - 32, WLH,
 sprintf("%2s/%2d", m_number, number), 2)
 end
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # ■ Scene_Map
 #==============================================================================
 
 class Scene_Map < Scene_Base
 #--------------------------------------------------------------------------
 # ● ショップ画面への切り替え
 #--------------------------------------------------------------------------
 alias call_shop_KGC_ComposeItem call_shop
 def call_shop
 # 合成画面を呼び出した場合
 if $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
 # 合成画面に移行
 $game_temp.next_scene = nil
 $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
 $scene = Scene_ComposeItem.new
 else
 call_shop_KGC_ComposeItem
 end
 end
 end
 
 #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
 #==============================================================================
 # □ Scene_ComposeItem
 #------------------------------------------------------------------------------
 #  合成画面の処理を行うクラスです。
 #==============================================================================
 
 class Scene_ComposeItem < Scene_Shop
 #--------------------------------------------------------------------------
 # ● 開始処理
 #--------------------------------------------------------------------------
 def start
 super
 # コマンドウィンドウ非表示
 if KGC::ComposeItem::HIDE_COMMAND_WINDOW
 @command_window.visible = false
 @gold_window.y = Graphics.height - @gold_window.height
 @gold_window.z = @status_window.z + 100
 @gold_window.visible = !KGC::ComposeItem::HIDE_GOLD_WINDOW
 
 @dummy_window.y = @command_window.y
 @dummy_window.height += @command_window.height
 end
 
 # [Scene_Shop] 再利用のため、合成リストに @buy_window を使用
 @buy_window.dispose
 @buy_window = Window_ComposeItem.new(0, @dummy_window.y)
 @buy_window.height = @dummy_window.height
 @buy_window.active = false
 @buy_window.visible = false
 @buy_window.help_window = @help_window
 
 # その他のウィンドウを再構成
 @number_window.dispose
 @number_window = Window_ComposeNumber.new(0, @buy_window.y)
 @number_window.height = @buy_window.height
 @number_window.create_contents
 @number_window.active = false
 @number_window.visible = false
 
 @status_window.dispose
 @status_window = Window_ComposeStatus.new(@buy_window.width, @buy_window.y)
 @status_window.height = @buy_window.height
 @status_window.create_contents
 @status_window.visible = false
 
 # コマンドウィンドウ非表示の場合、合成ウィンドウに切り替え
 if KGC::ComposeItem::HIDE_COMMAND_WINDOW
 @command_window.active = false
 @dummy_window.visible = false
 @buy_window.active = true
 @buy_window.visible = true
 @buy_window.update_help
 @status_window.visible = true
 @status_window.item = @buy_window.item
 end
 end
 #--------------------------------------------------------------------------
 # ● コマンドウィンドウの作成
 #--------------------------------------------------------------------------
 def create_command_window
 s1 = Vocab::ComposeItem
 s2 = Vocab::ShopSell
 s3 = Vocab::ShopCancel
 @command_window = Window_Command.new(384, [s1, s2, s3], 3)
 @command_window.y = 56
 if $game_temp.shop_purchase_only
 @command_window.draw_item(1, false)
 end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 def update
 super
 if KGC::ComposeItem::SWITCH_INFO_BUTTON != nil &&
 Input.trigger?(KGC::ComposeItem::SWITCH_INFO_BUTTON)
 Sound.play_cursor
 @status_window.change_mode
 end
 end
 #--------------------------------------------------------------------------
 # ● 購入アイテム選択の更新
 #--------------------------------------------------------------------------
 def update_buy_selection
 # コマンドウィンドウ非表示で B ボタンが押された場合
 if KGC::ComposeItem::HIDE_COMMAND_WINDOW && Input.trigger?(Input::B)
 Sound.play_cancel
 $scene = Scene_Map.new
 return
 end
 
 @status_window.item = @buy_window.item
 if Input.trigger?(Input::C)
 @item = @buy_window.item
 # アイテムが無効なら選択不可
 if @item == nil
 Sound.play_buzzer
 return
 end
 
 # 合成不可能 or 限界数まで所持している場合は選択不可
 number = $game_party.item_number(@item)
 limit = ($imported["LimitBreak"] ? @item.number_limit : 99)
 if !$game_party.item_can_compose?(@item) || number == limit
 Sound.play_buzzer
 return
 end
 
 # 個数入力に切り替え
 Sound.play_decision
 max = $game_party.number_of_composable(@item)
 max = [max, limit - number].min
 @buy_window.active = false
 @buy_window.visible = false
 @number_window.set(@item, max, @item.compose_cost)
 @number_window.active = true
 @number_window.visible = true
 return
 end
 
 super
 end
 #--------------------------------------------------------------------------
 # ● 個数入力の決定
 #--------------------------------------------------------------------------
 def decide_number_input
 if @command_window.index != 0  # 「合成する」以外
 super
 return
 end
 
 Sound.play_shop
 @number_window.active = false
 @number_window.visible = false
 # 合成処理
 operation_compose
 @gold_window.refresh
 @buy_window.refresh
 @status_window.refresh
 @buy_window.active = true
 @buy_window.visible = true
 end
 #--------------------------------------------------------------------------
 # ○ 合成の処理
 #--------------------------------------------------------------------------
 def operation_compose
 $game_party.lose_gold(@number_window.number * @item.compose_cost)
 if  rand(10) > 1     # 3/5左右吧。。数学不好。。自己改
 $game_party.gain_item(@item, @number_window.number)
 compose_ok = true
 else
 compose_ok = false
 t_window = Window_Base.new((640-200)/2,128,200,56)
 t_window.contents = Bitmap.new( t_window.width - 32, t_window.height - 32)
 t_window.contents.draw_text(0,0,208,24,"合成失败:")
 t_window.opacity = 160
 # 停顿 2/3秒
 for i in 0..40
 Graphics.update
 end
 # 淡出
 for i in 0..30
 t_window.opacity -= 30
 t_window.contents_opacity -= 30
 Graphics.update
 end
 t_window.dispose
 end
 # 素材を減らす
 @item.compose_materials.each { |material|
 $game_party.lose_item(material.item,
 material.number * @number_window.number)
 }
 # 合成済みにする
 $game_party.set_item_composed(@item,compose_ok)
 end
 end
 
 
 这是我用的。
 
 | 
 评分
查看全部评分
 |