查看: 1768|回复: 4

[已经解决] 白の魔的物品合成脚本可以设置成功率吗?

[复制链接]
梦石
0
星屑
809
在线时间
176 小时
注册时间
2017-1-15
回帖
50
发表于 2020-11-23 22:37:22 | 显示全部楼层 |阅读模式
悬赏50星屑已解决
我看了下脚本,虽然是日文,但看上去好像没有设置成功率的地方……

[pre lang="ruby"]#==============================================================================
# ■ RGSS3 アイテム合成 ver 1.02
#------------------------------------------------------------------------------
#  配布元:
#     白の魔 http://izumiwhite.web.fc2.com/
#
#  利用規約:
#     RPGツクールVX Aceの正規の登録者のみご利用になれます。
#     利用報告・著作権表示とかは必要ありません。
#     改造もご自由にどうぞ。
#     何か問題が発生しても責任は持ちません。
#==============================================================================
=begin
i_recipe_switch_on(2) i_中的i可以改成a和w表示防具和武器的开启 2是配方的ID
i_recipe_switch_on(2)开启2号物品配方
a_recipe_switch_on(3)开启3号防具配方
w_recipe_switch_on(4)开启4号武器配方

i_recipe_switch_off(2)关闭2号物品配方
a_recipe_switch_off(3)关闭3号防具配方
w_recipe_switch_off(4)关闭4号武器配方

i_recipe_switch_on?(2)开启了2号物品配方?
a_recipe_switch_on?(3)开启了3号防具配方?
w_recipe_switch_on?(4)开启了4号武器配方?

i_recipe_all_switch_on 开启所有物品配方
a_recipe_all_switch_on开启所有防具配方
w_recipe_all_switch_on开启所有武器配方



recipe_all_switch_on开启所有配方
recipe_all_switch_off 关闭所有配方
=end
#--------------------------------------------------------------------------
# ★ 初期設定。
#    合成レシピ等の設定
#--------------------------------------------------------------------------
module WD_itemsynthesis_ini

  Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)

  Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示

  I_recipe = [] #この行は削除しないこと
  W_recipe = [] #この行は削除しないこと
  A_recipe = [] #この行は削除しないこと

  #以下、合成レシピ。
  #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  #と記載した場合、ID3のアイテムの合成必要は、100G。
  #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  #となる。

  #アイテムの合成レシピ
  I_recipe[1]  = [300,  ["I",2,1],["I",3,1]]
  I_recipe[20]  = [0,  ["I",19,1],["I",202,1],["I",204,1]]
  #I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  #I_recipe[17] = [500, ["I",1,10]]

  #武器の合成レシピ
  W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  #W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]

  #防具の合成レシピ  
  A_recipe[2]  = [40,   ["A",1,2]]
  #A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]

end


#==============================================================================
# ■ WD_itemsynthesis
#------------------------------------------------------------------------------
#  アイテム合成用の共通メソッドです。
#==============================================================================

module WD_itemsynthesis
  def i_recipe_switch_on(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    $game_system.i_rcp_sw[id] = true
  end
  def i_recipe_switch_off(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    $game_system.i_rcp_sw[id] = false
  end
  def i_recipe_switch_on?(id)
    $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
    $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
    return $game_system.i_rcp_sw[id]
  end
  def i_recipe_all_switch_on
    for i in 1..$data_items.size
      i_recipe_switch_on(i)
    end
  end
  def i_recipe_all_switch_off
    for i in 1..$data_items.size
      i_recipe_switch_off(i)
    end
  end
  def w_recipe_switch_on(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    $game_system.w_rcp_sw[id] = true
  end
  def w_recipe_switch_off(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    $game_system.w_rcp_sw[id] = false
  end
  def w_recipe_switch_on?(id)
    $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
    $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
    return $game_system.w_rcp_sw[id]
  end
  def w_recipe_all_switch_on
    for i in 1..$data_weapons.size
      w_recipe_switch_on(i)
    end
  end
  def w_recipe_all_switch_off
    for i in 1..$data_weapons.size
      w_recipe_switch_off(i)
    end
  end
  def a_recipe_switch_on(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    $game_system.a_rcp_sw[id] = true
  end
  def a_recipe_switch_off(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    $game_system.a_rcp_sw[id] = false
  end
  def a_recipe_switch_on?(id)
    $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
    $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
    return $game_system.a_rcp_sw[id]
  end
  def a_recipe_all_switch_on
    for i in 1..$data_armors.size
      a_recipe_switch_on(i)
    end
  end
  def a_recipe_all_switch_off
    for i in 1..$data_armors.size
      a_recipe_switch_off(i)
    end
  end
  def recipe_all_switch_on
    i_recipe_all_switch_on
    w_recipe_all_switch_on
    a_recipe_all_switch_on
  end
  def recipe_all_switch_off
    i_recipe_all_switch_off
    w_recipe_all_switch_off
    a_recipe_all_switch_off
  end

end

class Game_Interpreter
  include WD_itemsynthesis
end

class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :i_rcp_sw
  attr_accessor :w_rcp_sw
  attr_accessor :a_rcp_sw
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias wd_orig_initialize004 initialize
  def initialize
    wd_orig_initialize004
    @i_rcp_sw = []
    @w_rcp_sw = []
    @a_rcp_sw = []
  end
end


#==============================================================================
# ■ Scene_ItemSynthesis
#------------------------------------------------------------------------------
#  合成画面の処理を行うクラスです。
#==============================================================================

class Scene_ItemSynthesis < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_dummy_window
    create_number_window
    create_status_window
    create_material_window
    create_list_window
    create_category_window
    create_gold_window
    create_change_window
  end
  #--------------------------------------------------------------------------
  # ● ゴールドウィンドウの作成
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.viewport = @viewport
    @gold_window.x = Graphics.width - @gold_window.width
    @gold_window.y = @help_window.height
    @gold_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 切り替え表示ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_change_window
    wx = 0
    wy = @gold_window.y
    ww = Graphics.width - @gold_window.width
    wh = @gold_window.height
    @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
    @change_window.viewport = @viewport
    @change_window.hide
  end
  #--------------------------------------------------------------------------
  # ● ダミーウィンドウの作成
  #--------------------------------------------------------------------------
  def create_dummy_window
    wy = @help_window.y + @help_window.height + 48
    wh = Graphics.height - wy
    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
    @dummy_window.viewport = @viewport
  end
  #--------------------------------------------------------------------------
  # ● 個数入力ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_number_window
    wy = @dummy_window.y
    wh = @dummy_window.height
    @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
    @number_window.viewport = @viewport
    @number_window.hide
    @number_window.set_handler(:ok,     method(:on_number_ok))
    @number_window.set_handler(:cancel, method(:on_number_cancel))
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの作成
  #--------------------------------------------------------------------------
  def create_status_window
    wx = @number_window.width
    wy = @dummy_window.y
    ww = Graphics.width - wx
    wh = @dummy_window.height
    @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
    @status_window.viewport = @viewport
    @status_window.hide
  end
  #--------------------------------------------------------------------------
  # ● 素材ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_material_window
    wx = @number_window.width
    wy = @dummy_window.y
    ww = Graphics.width - wx
    wh = @dummy_window.height
    @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
    @material_window.viewport = @viewport
    @material_window.hide
    @number_window.material_window = @material_window
  end
  #--------------------------------------------------------------------------
  # ● 合成アイテムリストウィンドウの作成
  #--------------------------------------------------------------------------
  def create_list_window
    wy = @dummy_window.y
    wh = @dummy_window.height
    @list_window = Window_ItemSynthesisList.new(0, wy, wh)
    @list_window.viewport = @viewport
    @list_window.help_window = @help_window
    @list_window.status_window = @status_window
    @list_window.material_window = @material_window
    @list_window.hide
    @list_window.set_handler(:ok,     method(:on_list_ok))
    @list_window.set_handler(:cancel, method(:on_list_cancel))
    @list_window.set_handler(:change_window, method(:on_change_window))   
  end
  #--------------------------------------------------------------------------
  # ● カテゴリウィンドウの作成
  #--------------------------------------------------------------------------
  def create_category_window
    @category_window = Window_ItemSynthesisCategory.new
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.y = @help_window.height
    @category_window.activate
    @category_window.item_window = @list_window
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 合成アイテムリストウィンドウのアクティブ化
  #--------------------------------------------------------------------------
  def activate_list_window
    @list_window.money = money
    @list_window.show.activate
  end
  #--------------------------------------------------------------------------
  # ● 合成[決定]
  #--------------------------------------------------------------------------
  def on_list_ok
    @item = @list_window.item
    @list_window.hide
    @number_window.set(@item, max_buy, buying_price, currency_unit)
    @number_window.show.activate
  end
  #--------------------------------------------------------------------------
  # ● 合成[キャンセル]
  #--------------------------------------------------------------------------
  def on_list_cancel
    @category_window.activate
    @category_window.show
    @dummy_window.show
    @list_window.hide
    @status_window.hide
    @status_window.item = nil
    @material_window.hide
    @material_window.set(nil, nil)
    @gold_window.hide
    @change_window.hide
    @help_window.clear
  end
  #--------------------------------------------------------------------------
  # ● 表示切替
  #--------------------------------------------------------------------------
  def on_change_window
    if @status_window.visible
      @status_window.hide
      @material_window.show
    else
      @status_window.show
      @material_window.hide
    end
  end
  #--------------------------------------------------------------------------
  # ● カテゴリ[決定]
  #--------------------------------------------------------------------------
  def on_category_ok
    activate_list_window
    @gold_window.show
    @change_window.show
    @material_window.show
    @category_window.hide
    @list_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● 個数入力[決定]
  #--------------------------------------------------------------------------
  def on_number_ok
    Sound.play_shop
    do_syntetic(@number_window.number)
    end_number_input
    @gold_window.refresh
  end
  #--------------------------------------------------------------------------
  # ● 個数入力[キャンセル]
  #--------------------------------------------------------------------------
  def on_number_cancel
    Sound.play_cancel
    end_number_input
  end
  #--------------------------------------------------------------------------
  # ● 合成の実行
  #--------------------------------------------------------------------------
  def do_syntetic(number)
    $game_party.lose_gold(number * buying_price)
    $game_party.gain_item(@item, number)

      @recipe = @list_window.recipe(@item)
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        $game_party.lose_item(item, num*number)
      end
  end
  #--------------------------------------------------------------------------
  # ● 個数入力の終了
  #--------------------------------------------------------------------------
  def end_number_input
    @number_window.hide
    activate_list_window
  end
  #--------------------------------------------------------------------------
  # ● 最大購入可能個数の取得
  #--------------------------------------------------------------------------
  def max_buy
    max = $game_party.max_item_number(@item) - $game_party.item_number(@item)

    @recipe = @list_window.recipe(@item)
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        if num > 0
          max_buf = $game_party.item_number(item)/num
        else
          max_buf = 999
        end
        max = [max, max_buf].min
      end

    buying_price == 0 ? max : [max, money / buying_price].min

  end
#--------------------------------------------------------------------------
  # ● 所持金の取得
  #--------------------------------------------------------------------------
  def money
    @gold_window.value
  end
  #--------------------------------------------------------------------------
  # ● 通貨単位の取得
  #--------------------------------------------------------------------------
  def currency_unit
    @gold_window.currency_unit
  end
  #--------------------------------------------------------------------------
  # ● 合成費用の取得
  #--------------------------------------------------------------------------
  def buying_price
    @list_window.price(@item)
  end
end


#==============================================================================
# ■ Window_ItemSynthesisList
#------------------------------------------------------------------------------
#  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisList < Window_Selectable
  include WD_itemsynthesis
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :status_window            # ステータスウィンドウ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, height)
    super(x, y, window_width, height)

    @shop_goods = []
    @shop_recipes = []

    for i in 1..WD_itemsynthesis_ini::I_recipe.size
      recipe = WD_itemsynthesis_ini::I_recipe
      if recipe
        good = [0, i, recipe[0]]
        if i_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end
    for i in 1..WD_itemsynthesis_ini::W_recipe.size
      recipe = WD_itemsynthesis_ini::W_recipe
      if recipe
        good = [1, i, recipe[0]]
        if w_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end
    for i in 1..WD_itemsynthesis_ini::A_recipe.size
      recipe = WD_itemsynthesis_ini::A_recipe
      if recipe
        good = [2, i, recipe[0]]
        if a_recipe_switch_on?(i)
          @shop_goods.push(good)
          @shop_recipes.push(recipe)
        end
      end
    end

    @money = 0
    refresh
    select(0)
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return 304
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # ● アイテムの取得
  #--------------------------------------------------------------------------
  def item
    @data[index]
  end
  #--------------------------------------------------------------------------
  # ● 所持金の設定
  #--------------------------------------------------------------------------
  def money=(money)
    @money = money
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 選択項目の有効状態を取得
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # ● 合成費用を取得
  #--------------------------------------------------------------------------
  def price(item)
    @price[item]
  end
  #--------------------------------------------------------------------------
  # ● 合成可否を取得
  #--------------------------------------------------------------------------
  def enable?(item)
    @makable[item]
  end
  #--------------------------------------------------------------------------
  # ● レシピを取得
  #--------------------------------------------------------------------------
  def recipe(item)
    @recipe[item]
  end
  #--------------------------------------------------------------------------
  # ● アイテムを許可状態で表示するかどうか
  #--------------------------------------------------------------------------
  def have_mat?(recipe)
    flag = true
    if @money >= recipe[0]
      for i in 1...recipe.size
        kind = recipe[0]
        id   = recipe[1]
        num  = recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        if $game_party.item_number(item) < [num, 1].max
          flag = false
        end
      end
    else
      flag = false
    end
    return flag
  end
  #--------------------------------------------------------------------------
  # ● カテゴリの設定
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
  #--------------------------------------------------------------------------
  # ● アイテムをリストに含めるかどうか
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテムリストの作成
  #--------------------------------------------------------------------------
  def make_item_list
    @data = []
    @price = {}
    @makable = {}
    @recipe = {}
    for i in 0...@shop_goods.size
      goods = @shop_goods
      recipe = @shop_recipes
      case goods[0]
      when 0;  item = $data_items[goods[1]]
      when 1;  item = $data_weapons[goods[1]]
      when 2;  item = $data_armors[goods[1]]
      end
      if item
        if include?(item)
          @data.push(item)
          @price[item] = goods[2]
          @makable[item] = have_mat?(recipe)
          @recipe[item] = recipe
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x, rect.y, enable?(item))
    rect.width -= 4
    draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  end
  #--------------------------------------------------------------------------
  # ● ステータスウィンドウの設定
  #--------------------------------------------------------------------------
  def status_window=(status_window)
    @status_window = status_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● 素材ウィンドウの設定
  #--------------------------------------------------------------------------
  def material_window=(material_window)
    @material_window = material_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item) if @help_window
    @status_window.item = item if @status_window
    @material_window.set(item, recipe(item)) if @material_window
  end
  #--------------------------------------------------------------------------
  # ● ←→ ボタン(表示切替)が押されたときの処理
  #--------------------------------------------------------------------------
  def process_change_window
    Sound.play_cursor
    Input.update
    call_handler(:change_window)
  end
  #--------------------------------------------------------------------------
  # ● 決定やキャンセルなどのハンドリング処理
  #--------------------------------------------------------------------------
  def process_handling
    super
    if active
      return process_change_window if handle?(:change_window) && Input.trigger?(:X)
      return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
    end
  end
end


#==============================================================================
# ■ Window_ItemSynthesisMaterial
#------------------------------------------------------------------------------
#  合成画面で、合成に必要な素材を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisMaterial < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @item = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_possession(4, 0)
    draw_material_info(0, line_height * 2)
  end
  #--------------------------------------------------------------------------
  # ● アイテムの設定
  #--------------------------------------------------------------------------
  def set(item, recipe)
    @item = item
    @recipe = recipe
    @make_number = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 作成個数の設定
  #--------------------------------------------------------------------------
  def set_num(make_number)
    @make_number = make_number
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 所持数の描画
  #--------------------------------------------------------------------------
  def draw_possession(x, y)
    rect = Rect.new(x, y, contents.width - 4 - x, line_height)
    change_color(system_color)
    draw_text(rect, Vocab::Possession)
    change_color(normal_color)
    draw_text(rect, $game_party.item_number(@item), 2)
  end
  #--------------------------------------------------------------------------
  # ● 素材情報の描画
  #--------------------------------------------------------------------------
  def draw_material_info(x, y)
    rect = Rect.new(x, y, contents.width, line_height)
    change_color(system_color)
    contents.font.size = 18
    draw_text(rect, "必要素材", 0)
    if @recipe
      for i in 1...@recipe.size
        kind = @recipe[0]
        id   = @recipe[1]
        num  = @recipe[2]
        if kind == "I"
          item = $data_items[id]
        elsif kind == "W"
          item = $data_weapons[id]
        elsif kind == "A"
          item = $data_armors[id]
        end
        rect = Rect.new(x, y + line_height*i, contents.width, line_height)
        enabled = true
        enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
        draw_item_name(item, rect.x, rect.y, enabled)
        change_color(normal_color, enabled)
        if num > 0
          draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
        end
      end
    end
    change_color(normal_color)
    contents.font.size = 24
  end
end


#==============================================================================
# ■ Window_ItemSynthesisNumber
#------------------------------------------------------------------------------
#  合成画面で、合成するアイテムの個数を入力するウィンドウです。
#==============================================================================

class Window_ItemSynthesisNumber < Window_ShopNumber
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_item_name(@item, 0, item_y)
    draw_number
    draw_total_price if WD_itemsynthesis_ini::Cost_view
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def material_window=(material_window)
    @material_window = material_window
    call_update_help
  end
  #--------------------------------------------------------------------------
  # ● 作成個数の変更
  #--------------------------------------------------------------------------
  def change_number(amount)
    @number = [[@number + amount, @max].min, 1].max
    call_update_help #追加
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def call_update_help
    @material_window.set_num(@number) if @material_window
  end
end


#==============================================================================
# ■ Window_ItemSynthesisCategory
#------------------------------------------------------------------------------
#  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
#==============================================================================

class Window_ItemSynthesisCategory < Window_ItemCategory
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    i = 0
    i += 1 if WD_itemsynthesis_ini::Category_i
    i += 1 if WD_itemsynthesis_ini::Category_w
    i += 1 if WD_itemsynthesis_ini::Category_a
    i += 1 if WD_itemsynthesis_ini::Category_k
    return i
  end
  #--------------------------------------------------------------------------
  # ● コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
    add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
    add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
    add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  end
end


#==============================================================================
# ■ Window_ItemSynthesisNumber
#------------------------------------------------------------------------------
#  合成画面で、切替を表示するウィンドウです。
#==============================================================================

class Window_ItemSynthesisChange < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    text = "X Y:表示切换"
    draw_text(0, 0, contents_width, line_height, text, 1)
  end
end[/pre]

最佳答案

查看完整内容

不可以,除非有好心人/砸RMB找人修改脚本 或许可以考慮換別个脚本,比如Vlue的高级配方合成 https://forums.rpgmakerweb.com/index.php?threads/advanced-recipe-crafting.27108/ [pre lang="ruby"]#高级配方合成 v1.2 #----------# #功能: 高级配方合成! # #使用方法: 使用脚本 # $crafting_category = :craft - 在呼出场景前使用, :craft 替换为合成类型 # SceneManager.call(Scene_Crafting) - 打 ...
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2020-11-23 22:37:23 | 显示全部楼层
本帖最后由 alexncf125 于 2020-11-23 23:12 编辑
白の魔的物品合成脚本可以设置成功率吗?

不可以,除非有好心人/砸RMB找人修改脚本

或许可以考慮換別个脚本,比如Vlue的高级配方合成
https://forums.rpgmakerweb.com/i ... ipe-crafting.27108/
A9AfjHN.png
[pre lang="ruby"]#高级配方合成 v1.2
#----------#
#功能: 高级配方合成!
#
#使用方法:    使用脚本
#       $crafting_category = :craft         - 在呼出场景前使用, :craft 替换为合成类型
#       SceneManager.call(Scene_Crafting)   - 打开合成菜单
#       SceneManager.call(Scene_CraftingAll)- 打开分类合成菜单
#       learn_recipe(id)                    - 学会该配方
#       forget_recipe(id)                   - 遗忘该配方
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#- Free to use in any project with credit given, donations always welcome!

module ADV_RECIPE
#合成出的武器/护甲是否随机化(需要脚本WA_RANDOMIZATION)
  USE_WA_RANDOMIZATION = false
#合成菜单中合成类型的显示顺序 , 使用:All 代表所有类型
  CATEGORIES = [:炼金,:锻造,:缝纫,:炼甲,:木匠,:建造,:等等]
  DESCRIPTIONS = {
    :炼金 => "可以合成药水!",
    :缝纫 => "可以将多种材料缝合成衣物.",
    :木匠 => "所有东西都可以变成木头."
  }
#合成类型的图标
  CATEGORY_ICONS = [10,199,284,332,0,0,0]
#角色等级图标
  LEVEL_ICON = 117
#合成等级提升需要的经验值, lvl 代表当前等级
  XP_NEEDED_EQUATION = "100 * lvl"
#是否可以合成多个物品
  CRAFT_MULTIPLE = true
#是否在菜单中添加合成指令
  ENABLE_MENU_ACCESS = true
#是否无法在菜单中合成 (只能查看配方,不能合成)
  DISABLE_MENU_CRAFT = false
#详细信息的文字大小, 文字越小,配方显示的越多
  DETAIL_FONT_SIZE = 18
  

#以下选项禁用某些功能的显示。然而,就算不在配方中显示,改消耗的仍然会消耗

#移除金钱消耗
  DISABLE_GOLD_COST = false
#移除成功率
  DISABLE_SUCCESS = false
#移除角色等级需求
  DISABLE_PLAYER_LEVEL = false
#移除合成等级需求和值槽
  DISABLE_CRAFT_LEVEL = false
#自动学会所有技能 (可以使用 forget_recipe 来在之后遗忘某些配方)
  AUTO_LEARN_RECIPES = true


#最有趣的 (读作: 最复杂的) 部分!
#配方符号:
#
#产物, 类型 0 = 物品, 1 = 武器, 2 = 护甲
# :result => [类型,id,数量]
#
#需要原料, 格式和产物一样.
# :materials => [ [类型,id,数量,消耗?],[类型,id,数量] ... ],
#
#  以下为可选:
# :gold_cost => 数量          - 消耗金钱, 可以是 0
# :success => 几率           - 成功率
# :success_gain => 几率      - 合成等级每级提升的合成成功率(等级越高,合成成功率越大)
# :level => 数值               - 需要等级
# :craft_level => 数值        - 需要合成等级
# :category => :类型       - 合成类型 (:炼金, :缝纫, etc)
# :multiple => false            - 是否允许多次合成
# :xp => 数量                 - 每次合成获得的合成经验值
# :xp_deprac => 数量          - 每有一个合成等级就减少的经验值
# :pxp => 数量                - 每次合成角色获得经验值

# 经验值获得公式最好如下设定:
#  xp gain = xp - (current_level - recipe_level) * xp_deprac

  RECIPES = {
  0 => { :result => [0,1,1],
         :materials => [[0,4,2]],
         :gold_cost => 10,
         :success => 95,
         :success_gain => 1,
         :level => 5,
         :craft_level => 1,
         :category => :炼金,
         :xp => 50,
         :xp_deprac => 15,},
         
  1 => { :result => [0,2,1],
         :materials => [[1,4,1],[0,5,2,false]],
         :gold_cost => 50,
         :success => 90,
         :success_gain => 2,
         :level => 15,
         :craft_level => 1,
         :category => :炼金,
         :xp => 150,
         :xp_deprac => 20,},
         
  2 => { :result => [0,3,1],
         :materials => [[0,4,1],[0,5,1],[0,6,2],[0,7,1],[0,8,1],[0,9,2]],
         :gold_cost => 150,
         :success => 85,
         :success_gain => 3,
         :level => 25,
         :craft_level => 1,
         :category => :炼金,
         :xp => 250,
         :xp_deprac => 25,},
         
  }

end

$crafting_category = :All
class Recipe
  attr_accessor :result
  attr_accessor :materials
  attr_accessor :known
  attr_accessor :id
  attr_accessor :gold_cost
  attr_accessor :level
  attr_accessor :category
  attr_accessor :xp
  def initialize(id,recipe_hash)
    @id = id
    @result = Material.new(recipe_hash[:result])
    @materials = []
    for item in recipe_hash[:materials]
      @materials.push(Material.new(item))
    end
    @known = false
    recipe_hash[:gold_cost] ? @gold_cost = recipe_hash[:gold_cost] : @gold_cost = 0
    recipe_hash[:success] ? @rate = recipe_hash[:success] : @rate = 100
    recipe_hash[:success_gain] ? @rated = recipe_hash[:success_gain] : @rated = 0
    recipe_hash[:level] ? @level = recipe_hash[:level] : @level = 1
    recipe_hash[:category] ? @category = recipe_hash[:category] : @category = CATEGORIES[0]
    recipe_hash[:xp] ? @xp = recipe_hash[:xp] : @xp = 0
    recipe_hash[:xp_deprac] ? @xpd = recipe_hash[:xp_deprac] : @xpd = 0
    recipe_hash[:craft_level] ? @clevel = recipe_hash[:craft_level] : @clevel = 0
    recipe_hash[:pxp] ? @pxp = recipe_hash[:pxp] : @pxp = 0
    !recipe_hash[:multiple].nil? ? @mult = recipe_hash[:multiple] : @mult = true
    @known = ADV_RECIPE::AUTO_LEARN_RECIPES
  end
  def name
    return @result.item.name
  end
  def multiple?
    @mult
  end
  def has_materials?
    for item in @materials
      return false unless $game_party.item_number(item.item) >= item.amount
    end
    return true
  end
  def has_gold?
    $game_party.gold >= @gold_cost
  end
  def has_craft_level?
    craft_level <= $game_party.craft_level_sym(@category)
  end
  def has_level?
    @level <= $game_party.highest_level && has_craft_level?
  end
  def craftable?
    has_gold? && has_materials? && has_level?
  end
  def craft_level
    @clevel
  end
  def amount_craftable?
    mat_amount = []
    for item in @materials
      mat_amount.push($game_party.item_number(item.item) / item.amount)
    end
    if @gold_cost > 0
      return [$game_party.gold / @gold_cost,mat_amount.min].min
    else
      return mat_amount.min
    end
  end
  def craft(fail = 0)
    remove_materials
    if fail < success_rate
      return add_result
    else
      return nil
    end
  end
  def remove_materials
    for item in @materials
      next unless item.consumed?
      $game_party.gain_item(item.item,-item.amount)
    end
    $game_party.gain_gold(-@gold_cost)
  end
  def add_result
    if ADV_RECIPE::USE_WA_RANDOMIZATION
      item = $game_party.add_weapon(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Weapon)
      item = $game_party.add_armor(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Armor)
      item = $game_party.add_item(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Item)
    else
      $game_party.gain_item(@result.item,@result.amount)
      item = @result.item
    end
    $game_party.gain_craft_exp(category_id, xp_gain)
    $game_party.members.each do |actor|
      actor.gain_exp(@pxp)
    end
    item
  end
  def category_id
    ADV_RECIPE::CATEGORIES.index(@category)
  end
  def xp_gain
    level_diff = $game_party.craft_level(category_id) - @clevel
    [@xp - @xpd * level_diff,0].max
  end
  def success_rate
    level_diff = $game_party.craft_level(category_id) - @clevel
    [@rate + @rated * level_diff,100].min
  end
end

class Material
  attr_accessor :item
  attr_accessor :amount
  def initialize(mat)
    @item = $data_items[mat[1]] if mat[0] == 0
    @item = $data_weapons[mat[1]] if mat[0] == 1
    @item = $data_armors[mat[1]] if mat[0] == 2
    @amount = mat[2]
    @consumed = mat[3].nil? ? true : mat[3]
  end
  def consumed?
    @consumed
  end
end

class Game_Party
  alias recipe_init initialize
  def initialize
    recipe_init
    @crafting_level = [1]*ADV_RECIPE::CATEGORIES.size
    @craft_exp = [0]*ADV_RECIPE::CATEGORIES.size
  end
  def craft_level(id)
    @crafting_level[id]
  end
  def craft_level_sym(sym)
    @crafting_level[ADV_RECIPE::CATEGORIES.index(sym)]
  end
  def craft_exp(id)
    @craft_exp[id]
  end
  def craft_exp_next(id)
    lvl = craft_level(id)
    return eval(ADV_RECIPE::XP_NEEDED_EQUATION)
  end
  def gain_craft_exp(id, val)
    @craft_exp[id] += val
    while craft_exp(id) >= craft_exp_next(id)
      @craft_exp[id] -= craft_exp_next(id)
      @crafting_level[id] += 1
    end
  end
end

module DataManager
  class << self
    alias rec_cgo create_game_objects
    alias rec_msc make_save_contents
    alias rec_esc extract_save_contents
  end
  def self.create_game_objects
    rec_cgo
    $game_recipes = create_recipes
  end
  def self.make_save_contents
    contents = rec_msc
    contents[:recipe] = $game_recipes
    contents
  end
  def self.extract_save_contents(contents)
    rec_esc(contents)
    $game_recipes = contents[:recipe]
  end
  def self.create_recipes
    recipes = {}
    ADV_RECIPE::RECIPES.each_pair do |key, val|
      recipes[key] = Recipe.new(key,val)
    end
    recipes
  end
end

class Game_Interpreter
  def learn_recipe(id)
    return if $game_recipes[id].nil?
    $game_recipes[id].known = true
  end
  def forget_recipe(id)
    return if $game_recipes[id].nil?
    $game_recipes[id].known = false
  end
end

class Window_RecipeList < Window_Selectable
  def initialize(x,y,w,h)
    super
    @data = $game_recipes.values.select {|recipe| include?(recipe)}
    refresh
  end
  def item_max
    @data ? @data.size : 1
  end
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  def current_item_enabled?
    enable?(@data[index])
  end
  def include?(item)
    return false unless item.has_craft_level?
    return false unless item.known
    return true if @category == :All
    return @category == item.category
  end
  def set_category(cat)
    return if cat == @category
    @category = cat
    @data = $game_recipes.values.select {|recipe| include?(recipe)}
    refresh
  end
  def enable?(item)
    return false if item.nil?
    return false if $temp_disable_crafting
    item.craftable?
  end
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      enabled = $temp_disable_crafting ? true : enable?(item)
      draw_item_name(item.result.item, rect.x, rect.y, enabled)
      if item.amount_craftable? > 0
        draw_text(rect.x,rect.y,contents.width,24,"x"+item.amount_craftable?.to_s,2)
      end
    end
  end
  def current_item
    index >= 0 ? @data[index] : nil
  end
  def process_ok
    if current_item_enabled?
      Sound.play_ok
      Input.update
      call_ok_handler
    else
      Sound.play_buzzer
    end
  end
  def refresh
    create_contents
    super
  end
  def content_heights
    item_max * 24
  end
end

class Window_RecipeDetail < Window_Base
  def initialize(x,y,w,h)
    super
    @recipe = nil
  end
  def set_recipe(recipe)
    @recipe = recipe
    refresh
  end
  def refresh
    contents.clear
    contents.font.size = ADV_RECIPE::DETAIL_FONT_SIZE
    return if @recipe.nil?
    draw_craft_level unless ADV_RECIPE::DISABLE_PLAYER_LEVEL && ADV_RECIPE::DISABLE_CRAFT_LEVEL
    draw_materials
    draw_success_rate unless ADV_RECIPE::DISABLE_SUCCESS
    draw_gold_cost unless ADV_RECIPE::DISABLE_GOLD_COST
  end
  def draw_craft_level
    change_color(system_color, @recipe.has_level?)
    draw_text(0,0,contents.width,contents.font.size,"合成等级:")
    change_color(normal_color, @recipe.has_level?)
    xx = 0
    if !ADV_RECIPE::DISABLE_PLAYER_LEVEL
      draw_text(0,0,contents.width,contents.font.size,@recipe.level,2)
      draw_icon(ADV_RECIPE::LEVEL_ICON,contents.width - 48,0)
      xx += 48
      text = @recipe.craft_level.to_s + "/"
    else
      text = @recipe.craft_level.to_s
    end
    if !ADV_RECIPE::DISABLE_CRAFT_LEVEL
      draw_text(0,0,contents.width - xx,contents.font.size,text,2)
      draw_icon(ADV_RECIPE::CATEGORY_ICONS[ADV_RECIPE::CATEGORIES.index(@recipe.category)],contents.width - 56 - xx,0)
    end
  end
  def draw_materials
    if ADV_RECIPE::DISABLE_CRAFT_LEVEL && ADV_RECIPE::DISABLE_PLAYER_LEVEL
      yy = 0
    else
      yy = contents.font.size
    end
    change_color(system_color, @recipe.craftable?)
    draw_text(0,yy,self.width,contents.font.size,"原料:")
    yy += contents.font.size
    for item in @recipe.materials
      change_color(normal_color, $game_party.item_number(item.item) >= item.amount)
      draw_icon(item.item.icon_index,0,yy)
      draw_text(24,yy,self.width,contents.font.size,item.item.name)
      string = $game_party.item_number(item.item).to_s + "/" + item.amount.to_s
      draw_text(0,yy,self.contents.width,contents.font.size,string,2)
      yy += contents.font.size
    end
  end
  def draw_success_rate
    change_color(system_color, @recipe.craftable?)
    draw_text(0,contents.height-contents.font.size,contents.width,contents.font.size,"成功率:")
    change_color(normal_color, @recipe.craftable?)
    draw_text(0,contents.height-contents.font.size,contents.width,contents.font.size,@recipe.success_rate.to_s + "%",2)
  end
  def draw_gold_cost
    if @recipe.gold_cost > 0
      change_color(system_color, @recipe.has_gold?)
      draw_text(0,contents.height-contents.font.size*2,contents.width,contents.font.size,"合成成本:")
      change_color(normal_color, @recipe.has_gold?)
      draw_currency_value(@recipe.gold_cost,Vocab::currency_unit,0,contents.height-contents.font.size*2,contents.width)
    end  
  end
  def draw_currency_value(value, unit, x, y, width)
    cx = text_size(unit).width
    change_color(normal_color,$game_party.gold >= value)
    draw_text(x, y, width - cx - 2, contents.font.size, value, 2)
    change_color(system_color)
    draw_text(x, y, width, contents.font.size, unit, 2)
  end
end

class Window_RecipeConfirm < Window_Selectable
  attr_accessor :amount
  def initialize(x,y,w,h)
    super
    @amount = 1
    refresh
  end
  def item_max; 1; end;
  def enable?(item); true; end;
  def refresh
    super
    draw_text(0,0,self.contents.width,line_height,"合成",1)
    return unless @recipe && @recipe.craftable?
    draw_text(0,0,contents.width,line_height,"x"+@amount.to_s,2)
  end
  def activate
    super
    select(0)
  end
  def deactivate
    super
    select(-1)
  end
  def set_recipe(rec)
    return if rec == @recipe
    @recipe = rec
    @amount = 1
    refresh
  end
  def cursor_movable?
    active && open? && ADV_RECIPE::CRAFT_MULTIPLE && @recipe.multiple?
  end
  def cursor_down(wrap = false)
    change_amount(-10)
  end
  def cursor_up(wrap = false)
    change_amount(10)
  end
  def cursor_right(wrap = false)
    change_amount(1)
  end
  def cursor_left(wrap = false)
    change_amount(-1)
  end
  def change_amount(val)
    Sound.play_cursor
    @amount += val
    @amount = [[@amount,1].max,@recipe.amount_craftable?].min
    refresh
  end
end

class Scene_CraftingAll < Scene_Base
  def start
    super
    @help_window = Window_Help.new
    width = Graphics.width / 2
    height = Graphics.height - @help_window.height - 48
    @list_window = Window_RecipeList.new(0,@help_window.height+48,width,height-48)
    @list_window.set_handler(:ok, method(:list_success))
    @list_window.set_handler(:cancel, method(:cancel))
    @list_window.height += 48 if ADV_RECIPE::DISABLE_CRAFT_LEVEL
    @list_window.create_contents
    @detail_window = Window_RecipeDetail.new(width,@list_window.y,width,height-48*2)
    @detail_window.height += 48 if ADV_RECIPE::DISABLE_GOLD_COST
    @detail_window.create_contents
    height = @detail_window.y + @detail_window.height
    @confirm_window = Window_RecipeConfirm.new(width,height,width,48)
    @confirm_window.set_handler(:ok, method(:craft_success))
    @confirm_window.set_handler(:cancel, method(:confirm_cancel))
    if !ADV_RECIPE::DISABLE_GOLD_COST
      @gold_window = Window_Gold.new
      @gold_window.width = width
      @gold_window.y = Graphics.height - 48
      @gold_window.x = width
    end
    @popup_window = Window_RecPopup.new
    @popup_window.set_handler(:ok, method(:popup_ok))
    @popup_window.set_handler(:cancel, method(:popup_ok))
    @command_window = Window_RecCategory.new
    @command_window.set_handler(:ok, method(:command_ok))
    @command_window.set_handler(:cancel, method(:command_cancel))
    @gauge_window = Window_RecGauge.new unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
  end
  def popup_ok
    @popup_window.deactivate
    @popup_window.close
    @list_window.activate
  end
  def update
    super
    @help_window.set_text(@list_window.current_item.result.item.description) if !@list_window.current_item.nil?
    if @command_window.active
      category = ADV_RECIPE::CATEGORIES[@command_window.index]
      @help_window.set_text(ADV_RECIPE::DESCRIPTIONS[category])
    end
    @detail_window.set_recipe(@list_window.current_item)
    @confirm_window.set_recipe(@list_window.current_item)
    @list_window.set_category(ADV_RECIPE::CATEGORIES[@command_window.index])
    @gauge_window.set_category(ADV_RECIPE::CATEGORIES[@command_window.index]) unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
    return unless @list_window.current_item
    if @list_window.current_item.craftable?
      @confirm_window.opacity = 255
      @confirm_window.contents_opacity = 255
    else
      @confirm_window.opacity = 75
      @confirm_window.contents_opacity = 75
    end
  end
  def list_success
    @list_window.deactivate
    @confirm_window.activate
  end
  def craft_success
    amount = 0
    item = nil
    @confirm_window.amount.times do
      item2 = @list_window.current_item.craft(rand(100))
      if item2
        amount += 1
        item = item2
      end
    end
    if item
      @popup_window.set_text(item, amount)
    else
      @popup_window.set_text_fail
    end
    @confirm_window.change_amount(-1000)
    @gold_window.refresh unless ADV_RECIPE::DISABLE_GOLD_COST
    @list_window.refresh
    @gauge_window.refresh unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
    @popup_window.activate
  end
  def confirm_cancel
    @confirm_window.deactivate
    @list_window.activate
  end
  def command_cancel
    $temp_disable_crafting = false
    SceneManager.return
  end
  def cancel
    @list_window.select(-1)
    @help_window.set_text("")
    @command_window.activate
  end
  def command_ok
    @list_window.select(0)
    @list_window.activate
  end
end

class Scene_Crafting < Scene_CraftingAll
  def start
    super
    @command_window.index = ADV_RECIPE::CATEGORIES.index($crafting_category)
    @command_window.deactivate
    @command_window.visible = false
    @list_window.height += 48
    @list_window.y -= 48
    @detail_window.height += 48
    @detail_window.y -= 48
    @list_window.create_contents
    @detail_window.create_contents
    @list_window.select(0)
    @list_window.activate
  end
  def cancel
    SceneManager.return
  end
end

class Window_RecCategory < Window_HorzCommand
  def initialize
    super(0,72)
  end
  def window_width; Graphics.width; end
  def window_height; 48; end
  def make_command_list
    ADV_RECIPE::CATEGORIES.each do |command|
      add_command(command.to_s,command)
    end
  end
  def item_width
    120
  end
  def draw_item(index)
    change_color(normal_color, command_enabled?(index))
    rect = item_rect_for_text(index)
    draw_text(rect, command_name(index))
    draw_icon(ADV_RECIPE::CATEGORY_ICONS[index],rect.x-24,rect.y)
  end
  def item_rect_for_text(index)
    rect = item_rect(index)
    rect.x += 28
    rect.width -= 28
    rect
  end
end

class Window_RecPopup < Window_Selectable
  def initialize
    super(Graphics.width/2-window_width/2,Graphics.height/2-window_height/2,120,48)
    self.openness = 0
    deactivate
  end
  def window_width; 120; end
  def window_height; 48; end
  def set_text(item, amount)
    contents.clear
    text = amount.to_s + "x " + item.name + " 已被合成!"
    width = contents.text_size(text).width
    self.width = width + padding*2
    self.x = Graphics.width/2-width/2
    create_contents
    draw_text(24,0,contents.width,line_height,text)
    draw_icon(item.icon_index,0,0)
    open
  end
  def set_text_fail
    contents.clear
    text = "合成失败!"
    width = contents.text_size(text).width
    self.width = width + padding*2
    self.x = Graphics.width/2-width/2
    create_contents
    draw_text(12,0,contents.width,line_height,text)
    open
  end
  def process_ok
    if current_item_enabled?
      Input.update
      deactivate
      call_ok_handler
    else
      Sound.play_buzzer
    end
  end
end

class Window_RecGauge < Window_Base
  def initialize
    super(0,Graphics.height-48,Graphics.width/2,48)
    @category = :All
  end
  def refresh
    contents.clear
    return if @category == :All
    draw_icon(ADV_RECIPE::CATEGORY_ICONS[cat_index],0,0)
    draw_text(24,0,contents.width,24,$game_party.craft_level(cat_index))
    rate = $game_party.craft_exp(cat_index).to_f / $game_party.craft_exp_next(cat_index)
    draw_gauge(48, -3, contents.width-48, rate, tp_gauge_color1, tp_gauge_color2)
    if Module.const_defined?(:SPECIAL_GAUGES)
      @gauges[[48,-3]].set_extra("XP",$game_party.craft_exp(cat_index),$game_party.craft_exp_next(cat_index))
    else
      text = $game_party.craft_exp(cat_index).to_s+"/"+$game_party.craft_exp_next(cat_index).to_s
      draw_text(0,0,contents.width,24,text,2)
    end
  end
  def set_category(cat)
    return if cat == @category
    @category = cat
    refresh
  end
  def cat_index
    ADV_RECIPE::CATEGORIES.index(@category)
  end
end

class Window_MenuCommand < Window_Command
  alias recipe_aoc add_original_commands
  def add_original_commands
    recipe_aoc
    add_command("合成", :recipe) if ADV_RECIPE::ENABLE_MENU_ACCESS
  end
end

class Scene_Menu < Scene_MenuBase
  alias recipe_create_command_window create_command_window
  def create_command_window
    recipe_create_command_window
    @command_window.set_handler(:recipe,   method(:command_recipe))
  end
  def command_recipe
    $temp_disable_crafting = ADV_RECIPE::DISABLE_MENU_CRAFT
    SceneManager.call(Scene_CraftingAll)
  end
end[/pre]

点评

好吧,谢谢了 我试试这个  发表于 2020-11-24 18:00
回复

使用道具 举报

梦石
0
星屑
42235
在线时间
6017 小时
注册时间
2006-11-10
回帖
6966
发表于 2020-11-24 09:49:53 | 显示全部楼层
在一个随时可以SL的环境里搞几率有啥意义呢?

点评

除非学DQM强制存档、or 自动存档  发表于 2020-11-25 18:52
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部