设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1005|回复: 4
打印 上一主题 下一主题

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
809
在线时间
176 小时
注册时间
2017-1-15
帖子
81
跳转到指定楼层
1
发表于 2020-11-23 22:37:22 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式
50星屑
我看了下脚本,虽然是日文,但看上去好像没有设置成功率的地方……

RUBY 代码复制
  1. #==============================================================================
  2. # ■ RGSS3 アイテム合成 ver 1.02
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVX Aceの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================
  13. =begin
  14.  i_recipe_switch_on(2) i_中的i可以改成a和w表示防具和武器的开启 2是配方的ID
  15. i_recipe_switch_on(2)开启2号物品配方
  16. a_recipe_switch_on(3)开启3号防具配方
  17. w_recipe_switch_on(4)开启4号武器配方
  18.  
  19. i_recipe_switch_off(2)关闭2号物品配方
  20. a_recipe_switch_off(3)关闭3号防具配方
  21. w_recipe_switch_off(4)关闭4号武器配方
  22.  
  23. i_recipe_switch_on?(2)开启了2号物品配方?
  24. a_recipe_switch_on?(3)开启了3号防具配方?
  25. w_recipe_switch_on?(4)开启了4号武器配方?
  26.  
  27. i_recipe_all_switch_on 开启所有物品配方
  28. a_recipe_all_switch_on开启所有防具配方
  29. w_recipe_all_switch_on开启所有武器配方
  30.  
  31.  
  32.  
  33. recipe_all_switch_on开启所有配方
  34. recipe_all_switch_off 关闭所有配方
  35. =end
  36. #--------------------------------------------------------------------------
  37. # ★ 初期設定。
  38. #    合成レシピ等の設定
  39. #--------------------------------------------------------------------------
  40. module WD_itemsynthesis_ini
  41.  
  42.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  43.  
  44.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  45.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  46.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  47.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  48.  
  49.   I_recipe = [] #この行は削除しないこと
  50.   W_recipe = [] #この行は削除しないこと
  51.   A_recipe = [] #この行は削除しないこと
  52.  
  53.   #以下、合成レシピ。
  54.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  55.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  56.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  57.   #となる。
  58.  
  59.   #アイテムの合成レシピ
  60.   I_recipe[1]  = [300,  ["I",2,1],["I",3,1]]
  61.   I_recipe[20]  = [0,  ["I",19,1],["I",202,1],["I",204,1]]
  62.   #I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  63.   #I_recipe[17] = [500, ["I",1,10]]
  64.  
  65.   #武器の合成レシピ
  66.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  67.   #W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  68.  
  69.   #防具の合成レシピ  
  70.   A_recipe[2]  = [40,   ["A",1,2]]
  71.   #A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  72.  
  73. end
  74.  
  75.  
  76. #==============================================================================
  77. # ■ WD_itemsynthesis
  78. #------------------------------------------------------------------------------
  79. #  アイテム合成用の共通メソッドです。
  80. #==============================================================================
  81.  
  82. module WD_itemsynthesis
  83.   def i_recipe_switch_on(id)
  84.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  85.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  86.     $game_system.i_rcp_sw[id] = true
  87.   end
  88.   def i_recipe_switch_off(id)
  89.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  90.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  91.     $game_system.i_rcp_sw[id] = false
  92.   end
  93.   def i_recipe_switch_on?(id)
  94.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  95.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  96.     return $game_system.i_rcp_sw[id]
  97.   end
  98.   def i_recipe_all_switch_on
  99.     for i in 1..$data_items.size
  100.       i_recipe_switch_on(i)
  101.     end
  102.   end
  103.   def i_recipe_all_switch_off
  104.     for i in 1..$data_items.size
  105.       i_recipe_switch_off(i)
  106.     end
  107.   end
  108.   def w_recipe_switch_on(id)
  109.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  110.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  111.     $game_system.w_rcp_sw[id] = true
  112.   end
  113.   def w_recipe_switch_off(id)
  114.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  115.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  116.     $game_system.w_rcp_sw[id] = false
  117.   end
  118.   def w_recipe_switch_on?(id)
  119.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  120.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  121.     return $game_system.w_rcp_sw[id]
  122.   end
  123.   def w_recipe_all_switch_on
  124.     for i in 1..$data_weapons.size
  125.       w_recipe_switch_on(i)
  126.     end
  127.   end
  128.   def w_recipe_all_switch_off
  129.     for i in 1..$data_weapons.size
  130.       w_recipe_switch_off(i)
  131.     end
  132.   end
  133.   def a_recipe_switch_on(id)
  134.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  135.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  136.     $game_system.a_rcp_sw[id] = true
  137.   end
  138.   def a_recipe_switch_off(id)
  139.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  140.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  141.     $game_system.a_rcp_sw[id] = false
  142.   end
  143.   def a_recipe_switch_on?(id)
  144.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  145.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  146.     return $game_system.a_rcp_sw[id]
  147.   end
  148.   def a_recipe_all_switch_on
  149.     for i in 1..$data_armors.size
  150.       a_recipe_switch_on(i)
  151.     end
  152.   end
  153.   def a_recipe_all_switch_off
  154.     for i in 1..$data_armors.size
  155.       a_recipe_switch_off(i)
  156.     end
  157.   end
  158.   def recipe_all_switch_on
  159.     i_recipe_all_switch_on
  160.     w_recipe_all_switch_on
  161.     a_recipe_all_switch_on
  162.   end
  163.   def recipe_all_switch_off
  164.     i_recipe_all_switch_off
  165.     w_recipe_all_switch_off
  166.     a_recipe_all_switch_off
  167.   end
  168.  
  169. end
  170.  
  171. class Game_Interpreter
  172.   include WD_itemsynthesis
  173. end
  174.  
  175. class Game_System
  176.   #--------------------------------------------------------------------------
  177.   # ● 公開インスタンス変数
  178.   #--------------------------------------------------------------------------
  179.   attr_accessor :i_rcp_sw
  180.   attr_accessor :w_rcp_sw
  181.   attr_accessor :a_rcp_sw
  182.   #--------------------------------------------------------------------------
  183.   # ● オブジェクト初期化
  184.   #--------------------------------------------------------------------------
  185.   alias wd_orig_initialize004 initialize
  186.   def initialize
  187.     wd_orig_initialize004
  188.     @i_rcp_sw = []
  189.     @w_rcp_sw = []
  190.     @a_rcp_sw = []
  191.   end
  192. end
  193.  
  194.  
  195. #==============================================================================
  196. # ■ Scene_ItemSynthesis
  197. #------------------------------------------------------------------------------
  198. #  合成画面の処理を行うクラスです。
  199. #==============================================================================
  200.  
  201. class Scene_ItemSynthesis < Scene_MenuBase
  202.   #--------------------------------------------------------------------------
  203.   # ● 開始処理
  204.   #--------------------------------------------------------------------------
  205.   def start
  206.     super
  207.     create_help_window
  208.     create_dummy_window
  209.     create_number_window
  210.     create_status_window
  211.     create_material_window
  212.     create_list_window
  213.     create_category_window
  214.     create_gold_window
  215.     create_change_window
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● ゴールドウィンドウの作成
  219.   #--------------------------------------------------------------------------
  220.   def create_gold_window
  221.     @gold_window = Window_Gold.new
  222.     @gold_window.viewport = @viewport
  223.     @gold_window.x = Graphics.width - @gold_window.width
  224.     @gold_window.y = @help_window.height
  225.     @gold_window.hide
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 切り替え表示ウィンドウの作成
  229.   #--------------------------------------------------------------------------
  230.   def create_change_window
  231.     wx = 0
  232.     wy = @gold_window.y
  233.     ww = Graphics.width - @gold_window.width
  234.     wh = @gold_window.height
  235.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  236.     @change_window.viewport = @viewport
  237.     @change_window.hide
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● ダミーウィンドウの作成
  241.   #--------------------------------------------------------------------------
  242.   def create_dummy_window
  243.     wy = @help_window.y + @help_window.height + 48
  244.     wh = Graphics.height - wy
  245.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  246.     @dummy_window.viewport = @viewport
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● 個数入力ウィンドウの作成
  250.   #--------------------------------------------------------------------------
  251.   def create_number_window
  252.     wy = @dummy_window.y
  253.     wh = @dummy_window.height
  254.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  255.     @number_window.viewport = @viewport
  256.     @number_window.hide
  257.     @number_window.set_handler(:ok,     method(:on_number_ok))
  258.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● ステータスウィンドウの作成
  262.   #--------------------------------------------------------------------------
  263.   def create_status_window
  264.     wx = @number_window.width
  265.     wy = @dummy_window.y
  266.     ww = Graphics.width - wx
  267.     wh = @dummy_window.height
  268.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  269.     @status_window.viewport = @viewport
  270.     @status_window.hide
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 素材ウィンドウの作成
  274.   #--------------------------------------------------------------------------
  275.   def create_material_window
  276.     wx = @number_window.width
  277.     wy = @dummy_window.y
  278.     ww = Graphics.width - wx
  279.     wh = @dummy_window.height
  280.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  281.     @material_window.viewport = @viewport
  282.     @material_window.hide
  283.     @number_window.material_window = @material_window
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 合成アイテムリストウィンドウの作成
  287.   #--------------------------------------------------------------------------
  288.   def create_list_window
  289.     wy = @dummy_window.y
  290.     wh = @dummy_window.height
  291.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  292.     @list_window.viewport = @viewport
  293.     @list_window.help_window = @help_window
  294.     @list_window.status_window = @status_window
  295.     @list_window.material_window = @material_window
  296.     @list_window.hide
  297.     @list_window.set_handler(:ok,     method(:on_list_ok))
  298.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  299.     @list_window.set_handler(:change_window, method(:on_change_window))   
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● カテゴリウィンドウの作成
  303.   #--------------------------------------------------------------------------
  304.   def create_category_window
  305.     @category_window = Window_ItemSynthesisCategory.new
  306.     @category_window.viewport = @viewport
  307.     @category_window.help_window = @help_window
  308.     @category_window.y = @help_window.height
  309.     @category_window.activate
  310.     @category_window.item_window = @list_window
  311.     @category_window.set_handler(:ok,     method(:on_category_ok))
  312.     @category_window.set_handler(:cancel, method(:return_scene))
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 合成アイテムリストウィンドウのアクティブ化
  316.   #--------------------------------------------------------------------------
  317.   def activate_list_window
  318.     @list_window.money = money
  319.     @list_window.show.activate
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 合成[決定]
  323.   #--------------------------------------------------------------------------
  324.   def on_list_ok
  325.     @item = @list_window.item
  326.     @list_window.hide
  327.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  328.     @number_window.show.activate
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● 合成[キャンセル]
  332.   #--------------------------------------------------------------------------
  333.   def on_list_cancel
  334.     @category_window.activate
  335.     @category_window.show
  336.     @dummy_window.show
  337.     @list_window.hide
  338.     @status_window.hide
  339.     @status_window.item = nil
  340.     @material_window.hide
  341.     @material_window.set(nil, nil)
  342.     @gold_window.hide
  343.     @change_window.hide
  344.     @help_window.clear
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 表示切替
  348.   #--------------------------------------------------------------------------
  349.   def on_change_window
  350.     if @status_window.visible
  351.       @status_window.hide
  352.       @material_window.show
  353.     else
  354.       @status_window.show
  355.       @material_window.hide
  356.     end
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● カテゴリ[決定]
  360.   #--------------------------------------------------------------------------
  361.   def on_category_ok
  362.     activate_list_window
  363.     @gold_window.show
  364.     @change_window.show
  365.     @material_window.show
  366.     @category_window.hide
  367.     @list_window.select(0)
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● 個数入力[決定]
  371.   #--------------------------------------------------------------------------
  372.   def on_number_ok
  373.     Sound.play_shop
  374.     do_syntetic(@number_window.number)
  375.     end_number_input
  376.     @gold_window.refresh
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● 個数入力[キャンセル]
  380.   #--------------------------------------------------------------------------
  381.   def on_number_cancel
  382.     Sound.play_cancel
  383.     end_number_input
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 合成の実行
  387.   #--------------------------------------------------------------------------
  388.   def do_syntetic(number)
  389.     $game_party.lose_gold(number * buying_price)
  390.     $game_party.gain_item(@item, number)
  391.  
  392.       @recipe = @list_window.recipe(@item)
  393.       for i in 1...@recipe.size
  394.         kind = @recipe[i][0]
  395.         id   = @recipe[i][1]
  396.         num  = @recipe[i][2]
  397.         if kind == "I"
  398.           item = $data_items[id]
  399.         elsif kind == "W"
  400.           item = $data_weapons[id]
  401.         elsif kind == "A"
  402.           item = $data_armors[id]
  403.         end
  404.         $game_party.lose_item(item, num*number)
  405.       end
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 個数入力の終了
  409.   #--------------------------------------------------------------------------
  410.   def end_number_input
  411.     @number_window.hide
  412.     activate_list_window
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 最大購入可能個数の取得
  416.   #--------------------------------------------------------------------------
  417.   def max_buy
  418.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  419.  
  420.     @recipe = @list_window.recipe(@item)
  421.       for i in 1...@recipe.size
  422.         kind = @recipe[i][0]
  423.         id   = @recipe[i][1]
  424.         num  = @recipe[i][2]
  425.         if kind == "I"
  426.           item = $data_items[id]
  427.         elsif kind == "W"
  428.           item = $data_weapons[id]
  429.         elsif kind == "A"
  430.           item = $data_armors[id]
  431.         end
  432.         if num > 0
  433.           max_buf = $game_party.item_number(item)/num
  434.         else
  435.           max_buf = 999
  436.         end
  437.         max = [max, max_buf].min
  438.       end
  439.  
  440.     buying_price == 0 ? max : [max, money / buying_price].min
  441.  
  442.   end
  443. #--------------------------------------------------------------------------
  444.   # ● 所持金の取得
  445.   #--------------------------------------------------------------------------
  446.   def money
  447.     @gold_window.value
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● 通貨単位の取得
  451.   #--------------------------------------------------------------------------
  452.   def currency_unit
  453.     @gold_window.currency_unit
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 合成費用の取得
  457.   #--------------------------------------------------------------------------
  458.   def buying_price
  459.     @list_window.price(@item)
  460.   end
  461. end
  462.  
  463.  
  464. #==============================================================================
  465. # ■ Window_ItemSynthesisList
  466. #------------------------------------------------------------------------------
  467. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  468. #==============================================================================
  469.  
  470. class Window_ItemSynthesisList < Window_Selectable
  471.   include WD_itemsynthesis
  472.   #--------------------------------------------------------------------------
  473.   # ● 公開インスタンス変数
  474.   #--------------------------------------------------------------------------
  475.   attr_reader   :status_window            # ステータスウィンドウ
  476.   #--------------------------------------------------------------------------
  477.   # ● オブジェクト初期化
  478.   #--------------------------------------------------------------------------
  479.   def initialize(x, y, height)
  480.     super(x, y, window_width, height)
  481.  
  482.     @shop_goods = []
  483.     @shop_recipes = []
  484.  
  485.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  486.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  487.       if recipe
  488.         good = [0, i, recipe[0]]
  489.         if i_recipe_switch_on?(i)
  490.           @shop_goods.push(good)
  491.           @shop_recipes.push(recipe)
  492.         end
  493.       end
  494.     end
  495.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  496.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  497.       if recipe
  498.         good = [1, i, recipe[0]]
  499.         if w_recipe_switch_on?(i)
  500.           @shop_goods.push(good)
  501.           @shop_recipes.push(recipe)
  502.         end
  503.       end
  504.     end
  505.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  506.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  507.       if recipe
  508.         good = [2, i, recipe[0]]
  509.         if a_recipe_switch_on?(i)
  510.           @shop_goods.push(good)
  511.           @shop_recipes.push(recipe)
  512.         end
  513.       end
  514.     end
  515.  
  516.     @money = 0
  517.     refresh
  518.     select(0)
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ● ウィンドウ幅の取得
  522.   #--------------------------------------------------------------------------
  523.   def window_width
  524.     return 304
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● 項目数の取得
  528.   #--------------------------------------------------------------------------
  529.   def item_max
  530.     @data ? @data.size : 1
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● アイテムの取得
  534.   #--------------------------------------------------------------------------
  535.   def item
  536.     @data[index]
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 所持金の設定
  540.   #--------------------------------------------------------------------------
  541.   def money=(money)
  542.     @money = money
  543.     refresh
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ● 選択項目の有効状態を取得
  547.   #--------------------------------------------------------------------------
  548.   def current_item_enabled?
  549.     enable?(@data[index])
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 合成費用を取得
  553.   #--------------------------------------------------------------------------
  554.   def price(item)
  555.     @price[item]
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 合成可否を取得
  559.   #--------------------------------------------------------------------------
  560.   def enable?(item)
  561.     @makable[item]
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● レシピを取得
  565.   #--------------------------------------------------------------------------
  566.   def recipe(item)
  567.     @recipe[item]
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # ● アイテムを許可状態で表示するかどうか
  571.   #--------------------------------------------------------------------------
  572.   def have_mat?(recipe)
  573.     flag = true
  574.     if @money >= recipe[0]
  575.       for i in 1...recipe.size
  576.         kind = recipe[i][0]
  577.         id   = recipe[i][1]
  578.         num  = recipe[i][2]
  579.         if kind == "I"
  580.           item = $data_items[id]
  581.         elsif kind == "W"
  582.           item = $data_weapons[id]
  583.         elsif kind == "A"
  584.           item = $data_armors[id]
  585.         end
  586.         if $game_party.item_number(item) < [num, 1].max
  587.           flag = false
  588.         end
  589.       end
  590.     else
  591.       flag = false
  592.     end
  593.     return flag
  594.   end
  595.   #--------------------------------------------------------------------------
  596.   # ● カテゴリの設定
  597.   #--------------------------------------------------------------------------
  598.   def category=(category)
  599.     return if @category == category
  600.     @category = category
  601.     refresh
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● リフレッシュ
  605.   #--------------------------------------------------------------------------
  606.   def refresh
  607.     make_item_list
  608.     create_contents
  609.     draw_all_items
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ● アイテムをリストに含めるかどうか
  613.   #--------------------------------------------------------------------------
  614.   def include?(item)
  615.     case @category
  616.     when :item
  617.       item.is_a?(RPG::Item) && !item.key_item?
  618.     when :weapon
  619.       item.is_a?(RPG::Weapon)
  620.     when :armor
  621.       item.is_a?(RPG::Armor)
  622.     when :key_item
  623.       item.is_a?(RPG::Item) && item.key_item?
  624.     else
  625.       false
  626.     end
  627.   end
  628.   #--------------------------------------------------------------------------
  629.   # ● アイテムリストの作成
  630.   #--------------------------------------------------------------------------
  631.   def make_item_list
  632.     @data = []
  633.     @price = {}
  634.     @makable = {}
  635.     @recipe = {}
  636.     for i in 0...@shop_goods.size
  637.       goods = @shop_goods[i]
  638.       recipe = @shop_recipes[i]
  639.       case goods[0]
  640.       when 0;  item = $data_items[goods[1]]
  641.       when 1;  item = $data_weapons[goods[1]]
  642.       when 2;  item = $data_armors[goods[1]]
  643.       end
  644.       if item
  645.         if include?(item)
  646.           @data.push(item)
  647.           @price[item] = goods[2]
  648.           @makable[item] = have_mat?(recipe)
  649.           @recipe[item] = recipe
  650.         end
  651.       end
  652.     end
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ● 項目の描画
  656.   #--------------------------------------------------------------------------
  657.   def draw_item(index)
  658.     item = @data[index]
  659.     rect = item_rect(index)
  660.     draw_item_name(item, rect.x, rect.y, enable?(item))
  661.     rect.width -= 4
  662.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ● ステータスウィンドウの設定
  666.   #--------------------------------------------------------------------------
  667.   def status_window=(status_window)
  668.     @status_window = status_window
  669.     call_update_help
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ● 素材ウィンドウの設定
  673.   #--------------------------------------------------------------------------
  674.   def material_window=(material_window)
  675.     @material_window = material_window
  676.     call_update_help
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● ヘルプテキスト更新
  680.   #--------------------------------------------------------------------------
  681.   def update_help
  682.     @help_window.set_item(item) if @help_window
  683.     @status_window.item = item if @status_window
  684.     @material_window.set(item, recipe(item)) if @material_window
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● ←→ ボタン(表示切替)が押されたときの処理
  688.   #--------------------------------------------------------------------------
  689.   def process_change_window
  690.     Sound.play_cursor
  691.     Input.update
  692.     call_handler(:change_window)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 決定やキャンセルなどのハンドリング処理
  696.   #--------------------------------------------------------------------------
  697.   def process_handling
  698.     super
  699.     if active
  700.       return process_change_window if handle?(:change_window) && Input.trigger?(:X)
  701.       return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
  702.     end
  703.   end
  704. end
  705.  
  706.  
  707. #==============================================================================
  708. # ■ Window_ItemSynthesisMaterial
  709. #------------------------------------------------------------------------------
  710. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  711. #==============================================================================
  712.  
  713. class Window_ItemSynthesisMaterial < Window_Base
  714.   #--------------------------------------------------------------------------
  715.   # ● オブジェクト初期化
  716.   #--------------------------------------------------------------------------
  717.   def initialize(x, y, width, height)
  718.     super(x, y, width, height)
  719.     @item = nil
  720.     refresh
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● リフレッシュ
  724.   #--------------------------------------------------------------------------
  725.   def refresh
  726.     contents.clear
  727.     draw_possession(4, 0)
  728.     draw_material_info(0, line_height * 2)
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ● アイテムの設定
  732.   #--------------------------------------------------------------------------
  733.   def set(item, recipe)
  734.     @item = item
  735.     @recipe = recipe
  736.     @make_number = 1
  737.     refresh
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ● 作成個数の設定
  741.   #--------------------------------------------------------------------------
  742.   def set_num(make_number)
  743.     @make_number = make_number
  744.     refresh
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● 所持数の描画
  748.   #--------------------------------------------------------------------------
  749.   def draw_possession(x, y)
  750.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  751.     change_color(system_color)
  752.     draw_text(rect, Vocab::Possession)
  753.     change_color(normal_color)
  754.     draw_text(rect, $game_party.item_number(@item), 2)
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● 素材情報の描画
  758.   #--------------------------------------------------------------------------
  759.   def draw_material_info(x, y)
  760.     rect = Rect.new(x, y, contents.width, line_height)
  761.     change_color(system_color)
  762.     contents.font.size = 18
  763.     draw_text(rect, "必要素材", 0)
  764.     if @recipe
  765.       for i in 1...@recipe.size
  766.         kind = @recipe[i][0]
  767.         id   = @recipe[i][1]
  768.         num  = @recipe[i][2]
  769.         if kind == "I"
  770.           item = $data_items[id]
  771.         elsif kind == "W"
  772.           item = $data_weapons[id]
  773.         elsif kind == "A"
  774.           item = $data_armors[id]
  775.         end
  776.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  777.         enabled = true
  778.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  779.         draw_item_name(item, rect.x, rect.y, enabled)
  780.         change_color(normal_color, enabled)
  781.         if num > 0
  782.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  783.         end
  784.       end
  785.     end
  786.     change_color(normal_color)
  787.     contents.font.size = 24
  788.   end
  789. end
  790.  
  791.  
  792. #==============================================================================
  793. # ■ Window_ItemSynthesisNumber
  794. #------------------------------------------------------------------------------
  795. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  796. #==============================================================================
  797.  
  798. class Window_ItemSynthesisNumber < Window_ShopNumber
  799.   #--------------------------------------------------------------------------
  800.   # ● リフレッシュ
  801.   #--------------------------------------------------------------------------
  802.   def refresh
  803.     contents.clear
  804.     draw_item_name(@item, 0, item_y)
  805.     draw_number
  806.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● オブジェクト初期化
  810.   #--------------------------------------------------------------------------
  811.   def material_window=(material_window)
  812.     @material_window = material_window
  813.     call_update_help
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ● 作成個数の変更
  817.   #--------------------------------------------------------------------------
  818.   def change_number(amount)
  819.     @number = [[@number + amount, @max].min, 1].max
  820.     call_update_help #追加
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # ● ヘルプテキスト更新
  824.   #--------------------------------------------------------------------------
  825.   def call_update_help
  826.     @material_window.set_num(@number) if @material_window
  827.   end
  828. end
  829.  
  830.  
  831. #==============================================================================
  832. # ■ Window_ItemSynthesisCategory
  833. #------------------------------------------------------------------------------
  834. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  835. #==============================================================================
  836.  
  837. class Window_ItemSynthesisCategory < Window_ItemCategory
  838.   #--------------------------------------------------------------------------
  839.   # ● 桁数の取得
  840.   #--------------------------------------------------------------------------
  841.   def col_max
  842.     i = 0
  843.     i += 1 if WD_itemsynthesis_ini::Category_i
  844.     i += 1 if WD_itemsynthesis_ini::Category_w
  845.     i += 1 if WD_itemsynthesis_ini::Category_a
  846.     i += 1 if WD_itemsynthesis_ini::Category_k
  847.     return i
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● コマンドリストの作成
  851.   #--------------------------------------------------------------------------
  852.   def make_command_list
  853.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  854.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  855.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  856.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  857.   end
  858. end
  859.  
  860.  
  861. #==============================================================================
  862. # ■ Window_ItemSynthesisNumber
  863. #------------------------------------------------------------------------------
  864. #  合成画面で、切替を表示するウィンドウです。
  865. #==============================================================================
  866.  
  867. class Window_ItemSynthesisChange < Window_Base
  868.   #--------------------------------------------------------------------------
  869.   # ● オブジェクト初期化
  870.   #--------------------------------------------------------------------------
  871.   def initialize(x, y, width, height)
  872.     super(x, y, width, height)
  873.     refresh
  874.   end
  875.   #--------------------------------------------------------------------------
  876.   # ● リフレッシュ
  877.   #--------------------------------------------------------------------------
  878.   def refresh
  879.     contents.clear
  880.     text = "X Y:表示切换"
  881.     draw_text(0, 0, contents_width, line_height, text, 1)
  882.   end
  883. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-12 02:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表