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

Project1

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

[已经过期] 关于物品合成的脚本

[复制链接]

Lv2.观梦者

梦石
0
星屑
651
在线时间
118 小时
注册时间
2019-3-15
帖子
82
跳转到指定楼层
1
发表于 2019-3-20 23:48:03 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
在别的帖子里找到一个物品合成的脚本
但是会报错
自己用事件弄合成好烦....
如果这个脚本不能用的话,还有没有别的物品合成的脚本?





RUBY 代码复制
  1. module Sword
  2. #=======================================
  3.   Sword4_Message, Sword4_Help, Sword4_Synthesize = [], [], [[], [], []]
  4. #=======================================
  5. =begin
  6. ● 設置方法
  7. 呼叫方法(全部):$scene = Sword_Synthesize.new
  8. 呼叫方法(物品):$scene = Sword_Synthesize.new(0)
  9. 呼叫方法(武器):$scene = Sword_Synthesize.new(1)
  10. 呼叫方法(防具):$scene = Sword_Synthesize.new(2)
  11. 習得公開:$game_party.sword_synthesize[種類][編號] = true
  12. 習得隱藏:$game_party.sword_synthesize[種類][編號] = false
  13. 遺忘合成:$game_party.sword_synthesize[種類][編號] = nil
  14. 全部公開:$game_party.sword_synthesize(true)
  15. 全部隱藏:$game_party.sword_synthesize(false)
  16. 全部遺忘:$game_party.sword_synthesize(nil)
  17. 機率加乘變量:$game_party.synthesize_multiply[種類][編號]
  18. =end
  19. #=======================================
  20. #● 使用者自定設置
  21. Sword4_Width = 180 # 設定合成選項的寬度,相對的合成內容寬度也會更動
  22. Sword4_NoCommand = '?????' # 習得卻未合成過的選項文字,''表示道具名稱
  23. Sword4_Whether = '是否要消耗材料並合成道具?' # 合成提示文字,''為不提示
  24. Sword4_Wait1 = 30 # 設定合成中的等待時間,每40約為1秒
  25. Sword4_Wait2 = 30 # 設定成功或完成的訊息等待時間,每40約為1秒
  26. Sword4_Roll = 3 # 設定材料5個以上時,滾動效果的速度
  27. Sword4_Probability1 = 1 # 設定增加成功率的合成結果,0為失敗;1為成功;2是都可
  28. Sword4_Probability2 = 1 # 設定每合成增加成功機率的數值,因Sword4_Probability1而定
  29. Sword4_SE = '122-Ice03' # 開始合成時演奏SE檔名或動畫編號,''或0為不演奏
  30. Sword4_Picture = '049-Skill06' # 當習得未合成時的圖示,XP用字串、VX用數值
  31. Sword4_Menu = 0 # 關閉合成返回設定,0為地圖;1以上選單,並指著指定的選項
  32. #--------------------------------------------------------------
  33. #○ 合成提示窗口設定
  34. # Sword4_Message[不必更改] = [紅, 綠, 藍, '文字內容']
  35. Sword4_Message[0] = [255, 255, 255, '開始合成中...'] # 正在合成中
  36. Sword4_Message[1] = [255, 0, 0, '合成失敗']# 合成失敗
  37. Sword4_Message[2] = [255, 255, 0, '合成成功']# 合成成功
  38. Sword4_Message[3] = [255, 0, 0, '材料不足'] # 材料不足
  39. #--------------------------------------------------------------
  40. #○ 說明窗口顯示設定
  41. # Sword4_Help[不必更改] = ['文字內容', 靠邊位置]
  42. # 靠邊位置:0為靠左邊顯示、1為中央顯示、2為靠右邊顯示
  43. Sword4_Help[0] = ['合成系統', 0] # 顯示所有物品、武器、防具時
  44. Sword4_Help[1] = ['物品合成', 0] # 只顯示物品時
  45. Sword4_Help[2] = ['武器合成', 0] # 只顯示武器時
  46. Sword4_Help[3] = ['防具合成', 0] # 只顯示防具時
  47. #--------------------------------------------------------------
  48. #○ 合成資料表
  49. # Sword4_Synthesize[合成種類][合成編號] = [{物品}, {武器}, {防具}, 成功率]
  50. # 合成種類:0為物品、1為武器、2為防具
  51. # 物品、武器、防具:「編號=>數量」,每個相同種類材料必須用小逗號分開
  52. Sword4_Synthesize[0][3] = [{1=>5, 2=>2}, {}, {}, 100]
  53. Sword4_Synthesize[0][6] = [{4=>5, 5=>2}, {}, {}, 80]
  54. Sword4_Synthesize[1][4] = [{}, {1=>3}, {}, 70]
  55. Sword4_Synthesize[1][8] = [{}, {5=>2, 6=>8}, {4=>1}, 70]
  56. Sword4_Synthesize[2][4] = [{}, {}, {1=>6, 2=>3, 3=>1}, 65]
  57. #=======================================
  58.   $Sword ? $Sword[4] = true : $Sword = {4=>true} # 腳本使用標誌
  59.   ($Sword_VX = false ; RPG::Weather rescue $Sword_VX = true) if $Sword_VX == nil
  60. end
  61. #=======================================
  62. #■ 處理同伴的類別
  63. class Game_Party
  64.   include Sword
  65.   attr_writer    :sword_synthesize # 合成狀態數據
  66.   attr_accessor :synthesize_multiply # 機率加乘數值
  67.   #-------------------------------------------------------------
  68.   #● 初始化物件
  69.   alias sword4_initialize initialize
  70.   def initialize
  71.     sword4_initialize
  72.     @sword_synthesize = [Array.new($data_items.size + 1){nil},
  73.     Array.new($data_weapons.size + 1){nil}, Array.new($data_armors.size + 1){nil}]
  74.     @synthesize_multiply = [Array.new($data_items.size + 1){0},
  75.     Array.new($data_weapons.size + 1){0}, Array.new($data_armors.size + 1){0}]
  76.   end
  77.   #-------------------------------------------------------------
  78.   #● 讀取與全部修改的方法
  79.   def sword_synthesize(number = 0)
  80.     return @sword_synthesize if number == 0 # 傳回值
  81.     (0..2).each{|i| (1...Sword4_Synthesize.size).each{|ii|
  82.     next unless Sword4_Synthesize[ii] ; @sword_synthesize[ii] = number}}
  83.   end
  84. end
  85. #=======================================
  86. #■ 合成系統窗口
  87. class WSword_Synthesize < Window_Base
  88.   include Sword
  89.   attr_accessor :max_oy  # 目前位圖Y座標
  90.   #-------------------------------------------------------------
  91.   #● 初始化物件
  92.   def initialize
  93.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height, WLH + 32] : [640, 480, 64]
  94.     super(Sword4_Width, @xpvx[2], @xpvx[0] - Sword4_Width, @xpvx[1] - @xpvx[2])
  95.     self.contents = Bitmap.new(1, 1) ; refresh
  96.   end
  97.   #-------------------------------------------------------------
  98.   #● 更新內容(成品資料)
  99.   def refresh(itema = nil)
  100.     self.contents.clear ; return unless itema # 清除窗口內容
  101.     case itema[0] # 道具種類分歧
  102.     when 0 ; item = $data_items[itema[1]] # 物品
  103.       # [HP恢復量, SP(MP)恢復量, X, X, HP恢復率, SP(MP)恢復率, X]
  104.       words = $Sword_VX ? [$data_system.terms.hp + '恢復量',
  105.       $data_system.terms.mp + '恢復量', '', '', $data_system.terms.hp + '恢復率',
  106.       $data_system.terms.mp + '恢復率', ''] : [$data_system.words.hp + '恢復量',
  107.       $data_system.words.sp + '恢復量', '', '', $data_system.words.hp + '恢復率',
  108.       $data_system.words.sp + '恢復率', '']
  109.       if $game_party.sword_synthesize[0][itema[1]] # 公開顯示的情況
  110.         amounts = $Sword_VX ? [item.hp_recovery.to_s, item.mp_recovery.to_s, '', '',
  111.         item.hp_recovery_rate.to_s, item.mp_recovery_rate.to_s, ''] : [item.recover_hp.to_s,
  112.         item.recover_sp.to_s, '', '', item.recover_hp_rate.to_s, item.recover_sp_rate.to_s, '']
  113.         if item.parameter_type > 0 # 有設定增加能力值的場合
  114.           words[3] = ($Sword_VX ? [$data_system.terms.hp, $data_system.terms.mp,
  115.           $data_system.terms.atk, $data_system.terms.def, $data_system.terms.spi,
  116.           $data_system.terms.agi] : [$data_system.words.hp, $data_system.words.sp,
  117.           $data_system.words.str, $data_system.words.dex, $data_system.words.agi,
  118.           $data_system.words.int])[item.parameter_type - 1] + '上限'
  119.           amounts[3] = item.parameter_points.to_s
  120.         end
  121.       else ; amounts = ['??', '??', '', '', '??', '??', ''] # 未公開的場合
  122.       end
  123.       number = $Sword_VX ? $game_party.item_number(item) :
  124.       $game_party.item_number(item.id) # 持有數量
  125.     when 1 ; item = $data_weapons[itema[1]] # 武器
  126.       # [攻擊, 物防(防禦), 魔防(X), 力量(命中), 靈巧(精神), 速度(敏捷), 魔力(X)]
  127.       words = $Sword_VX ? [$data_system.terms.atk, $data_system.terms.def, '', '命中率',
  128.       $data_system.terms.spi, $data_system.terms.agi, ''] : [$data_system.words.atk,
  129.       $data_system.words.pdef, $data_system.words.mdef, $data_system.words.str,
  130.       $data_system.words.dex, $data_system.words.agi, $data_system.words.int]
  131.       if $game_party.sword_synthesize[1][itema[1]] # 公開顯示的情況
  132.         amounts = $Sword_VX ? [item.atk.to_s, item.def.to_s, '', item.hit.to_s + '%', item.spi.to_s,
  133.         item.agi.to_s, ''] : [item.atk.to_s, item.pdef.to_s, item.mdef.to_s, item.str_plus.to_s,
  134.         item.dex_plus.to_s, item.agi_plus.to_s, item.int_plus.to_s]
  135.       else ; amounts = ['??'] * 7 # 未公開的場合
  136.       end
  137.       number = $Sword_VX ? $game_party.item_number(item) :
  138.       $game_party.weapon_number(item.id) # 持有數量
  139.     when 2 ; item = $data_armors[itema[1]] # 防具
  140.       # [物防(攻擊), 魔防(防禦), 迴避(X), 力量(迴避), 靈巧(精神), 速度(敏捷), 魔力(X)]
  141.       words = $Sword_VX ? [$data_system.terms.atk, $data_system.terms.def, '', '回避率',
  142.       $data_system.terms.spi, $data_system.terms.agi, ''] : [$data_system.words.pdef,
  143.       $data_system.words.mdef, '回避', $data_system.words.str, $data_system.words.dex,
  144.       $data_system.words.agi, $data_system.words.int]
  145.       if $game_party.sword_synthesize[2][itema[1]] # 公開顯示的情況
  146.         amounts = $Sword_VX ? [item.atk.to_s, item.def.to_s, '', item.eva.to_s + '%',
  147.         item.spi.to_s, item.agi.to_s, ''] : [item.pdef.to_s, item.mdef.to_s, item.eva.to_s,
  148.         item.str_plus.to_s, item.dex_plus.to_s, item.agi_plus.to_s, item.int_plus.to_s]
  149.       else ; amounts = ['??'] * 7 # 未公開的場合
  150.       end
  151.       number = $Sword_VX ? $game_party.item_number(item) :
  152.       $game_party.armor_number(item.id) # 持有數量
  153.     end
  154.     by, y, x, self.oy = 8, 32, Font.default_size * 5, 0 # 位圖行, 描繪Y, 描繪X, 起始位置
  155.     by += self.contents.text_size($game_party.sword_synthesize[itema[0]][itema[1]] ?
  156.     item.description : '????????????').width / (self.width - 32) # 說明換行
  157.     (0..2).each{|i| by += Sword4_Synthesize[itema[0]][itema[1]].size} rescue
  158. raise("合成資料不存在,Sword4_Synthesize[#{itema[0]}][#{itema[1]}]未設置") # Error
  159.     by -= 1 if $Sword_VX or itema[0] == 0
  160.     self.contents = Bitmap.new(self.width - 32, by * 32) # 重新產生位圖
  161.     @max_oy = [by * 32 - (@xpvx[1] - @xpvx[2]) + 32, 0].max # 滾動限制
  162.     self.contents.font.color = normal_color # 數值和內容
  163.     if $game_party.sword_synthesize[itema[0]][itema[1]] # 公開顯示的情況
  164.       $Sword_VX ? draw_icon(item.icon_index, 0, 0, true) : # 圖標
  165.       contents.blt(0, 0, RPG::Cache.icon(item.icon_name), Rect.new(0 , 0, 24, 24))
  166.       contents.draw_text(28, 0, 640, 32, item.name) # 名稱
  167.       contents.draw_text(0, 0, self.width - 40, 32, number.to_s, 2) # 持有數
  168.       xx = 0
  169.       item.description.scan(/./).each{|c| cx = self.contents.text_size(c).width
  170.       (xx = 0 ; y += 32) if xx + cx > self.width - 32
  171.       contents.draw_text(xx, y, cx, 32, c) ; xx += cx}  # 說明
  172.     else # 隱藏顯示的場合
  173.       $Sword_VX ? draw_icon(Sword4_Picture, 0, 0, true) : # 圖標
  174.       contents.blt(0, 0, RPG::Cache.icon(Sword4_Picture), Rect.new(0 , 0, 24, 24))
  175.       contents.draw_text(28, 0, 640, 32, Sword4_NoCommand.empty? ?
  176.       item.name : Sword4_NoCommand) # 名稱
  177.       contents.draw_text(0, 0, self.width - 40, 32, '??', 2) # 持有數
  178.       contents.draw_text(0, 32, 640, 32, '????????????') # 說明
  179.     end
  180.     probability = [[Sword4_Synthesize[itema[0]][itema[1]][3] +
  181.     $game_party.synthesize_multiply[itema[0]][itema[1]], 100].min, 0].max.to_s + '%'
  182.     contents.draw_text(x, y + 32, 640, 32, probability) # 成功率
  183.     contents.draw_text(x, y + 64, 640, 32, amounts[0])
  184.     contents.draw_text(x, y + 96, 640, 32, amounts[1])
  185.     contents.draw_text(x, y + 128, 640, 32, amounts[2])
  186.     contents.draw_text(self.width / 2 + x, y + 32, 640, 32, amounts[3])
  187.     contents.draw_text(self.width / 2 + x, y + 64, 640, 32, amounts[4])
  188.     contents.draw_text(self.width / 2 + x, y + 96, 640, 32, amounts[5])
  189.     contents.draw_text(self.width / 2 + x, y + 128, 640, 32, amounts[6])
  190.     sequence, yy = [Sword4_Synthesize[itema[0]][itema[1]][0].keys.sort,
  191.     Sword4_Synthesize[itema[0]][itema[1]][1].keys.sort,
  192.     Sword4_Synthesize[itema[0]][itema[1]][2].keys.sort], 7 + y / 32
  193.     yyy = 6 ; (yy -= 1 ; yyy = 5) if $Sword_VX or itema[0] == 0
  194.     (0...sequence.size).each{|i| sequence.each{|ii|
  195.     stuff(i, ii, itema[1], yy, itema[0]) ; yy += 1}}
  196.     self.contents.font.color = system_color # 用語
  197.     contents.draw_text(0, 0, self.width - 64, 32, '持有數:', 2)
  198.     contents.draw_text(0, y + 32, 640, 32, '成功率')
  199.     contents.draw_text(0, y + 64, 640, 32, words[0])
  200.     contents.draw_text(0, y + 96, 640, 32, words[1])
  201.     contents.draw_text(0, y + 128, 640, 32, words[2])
  202.     contents.draw_text(self.width / 2, y + 32, 640, 32, words[3])
  203.     contents.draw_text(self.width / 2, y + 64, 640, 32, words[4])
  204.     contents.draw_text(self.width / 2, y + 96, 640, 32, words[5])
  205.     contents.draw_text(self.width / 2, y + 128, 640, 32, words[6])
  206.     contents.draw_text(0, (yyy + y / 32) * 32, 640, 32, '所需道具')
  207.     contents.draw_text(0, (yyy + y / 32) * 32, self.width - 138, 32, '持有數', 2)
  208.     contents.draw_text(0, (yyy + y / 32) * 32, self.width - 42, 32, '所需數', 2)
  209.     (0..7).each do |i| # 產生「:」
  210.       next if i == 3 or i == 7 if $Sword_VX
  211.       next if [3, (item.parameter_type > 0 and $game_party.sword_synthesize[0][itema[1]]) ?
  212.       nil : 4, 7].include?(i) if itema[0] == 0 # 物品的場合,忽略不必描繪的部份
  213.       if i > 3 ; i -= 4
  214.         contents.draw_text(self.width / 2 + Font.default_size * 4, 32 * i + 32 + y, 640, 32, ':')
  215.       else ; contents.draw_text(Font.default_size * 4, 32 * i + 32 + y, 640, 32, ':')
  216.       end
  217.     end
  218.   end
  219.   #-------------------------------------------------------------
  220.   #● 所需材料的內容
  221.   def stuff(kind, i, item, y, kind2)
  222.     # 所需數
  223.     Sword4_Synthesize[kind2][item][kind] > 9 ?
  224.     a = 64 : a = 69
  225.     self.contents.draw_text(0, y * 32, @xpvx[0] - Sword4_Width - a, 32,
  226.     Sword4_Synthesize[kind2][item][kind].to_s, 2)
  227.     # 圖示與持有數
  228.     case kind
  229.     when 0 # 物品(材料)
  230.       if $Sword_VX
  231.         draw_icon($data_items.icon_index, 0, y * 32, true)
  232.         items = $game_party.item_number($data_items)
  233.       else
  234.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  235.         $data_items.icon_name), Rect.new(0 , 0, 24, 24))
  236.         items = $game_party.item_number(i)
  237.       end
  238.       items >= Sword4_Synthesize[kind2][item][0] ?
  239.       color = normal_color : color = Color.new(255, 64, 0)
  240.       self.contents.draw_text(28, y * 32, 640, 32, $data_items.name)
  241.       # 持有數
  242.       self.contents.font.color = color
  243.       items > 9 ? a = 160 : a = 165
  244.       self.contents.draw_text(0, y * 32,
  245.       @xpvx[0] - Sword4_Width - a, 32, items.to_s, 2)
  246.       self.contents.font.color = normal_color
  247.     when 1 # 武器(材料)
  248.       if $Sword_VX
  249.         weapon = $game_party.item_number($data_weapons)
  250.         draw_icon($data_weapons.icon_index, 0, y * 32, true)
  251.       else
  252.         weapon = $game_party.weapon_number(i)
  253.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  254.         $data_weapons.icon_name), Rect.new(0 , 0, 24, 24))
  255.       end
  256.       weapon >= Sword4_Synthesize[kind2][item][1] ?
  257.       color = normal_color : color = Color.new(255, 64, 0)
  258.       self.contents.draw_text(28, y * 32, 640, 32, $data_weapons.name)
  259.       # 持有數
  260.       self.contents.font.color = color
  261.       weapon > 9 ? a = 160 : a = 165
  262.       self.contents.draw_text(0, y * 32,
  263.       @xpvx[0] - Sword4_Width - a, 32, weapon.to_s, 2)
  264.       self.contents.font.color = normal_color
  265.     when 2 # 防具(材料)
  266.       if $Sword_VX
  267.         draw_icon($data_armors.icon_index, 0, y * 32, true)
  268.         armors = $game_party.item_number($data_armors)
  269.       else
  270.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  271.         $data_armors.icon_name), Rect.new(0 , 0, 24, 24))
  272.         armors = $game_party.armor_number(i)
  273.       end
  274.       armors >= Sword4_Synthesize[kind2][item][2] ?
  275.       color = normal_color : color = Color.new(255, 64, 0)
  276.       self.contents.draw_text(28, y * 32, 640, 32, $data_armors.name)
  277.       # 持有數
  278.       self.contents.font.color = color
  279.       armors > 9 ? a = 160 : a = 165
  280.       self.contents.draw_text(0, y * 32,
  281.       @xpvx[0] - Sword4_Width - a, 32, armors.to_s, 2)
  282.       self.contents.font.color = normal_color
  283.     end
  284.   end
  285. end
  286. #=======================================
  287. #■ 是否合成提示窗口
  288. class WSword_SynthesizeONOFF < Window_Base
  289.   include Sword # 連接自定設置
  290.   attr_accessor  :index # 游標位置
  291.   #-------------------------------------------------------------
  292.   #● 初始化物件
  293.   def initialize
  294.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height] : [640, 480]
  295.     contents = Bitmap.new(@xpvx[0], 32)
  296.     @width = contents.text_size(Sword4_Whether).width
  297.     @width = 32 if @width  == 0
  298.     super((@xpvx[0] - @width) / 2 - 32, (@xpvx[1] - (Font.default_size + 10)*4)/2,
  299.     @width + 32, (Font.default_size + 10) * 4)
  300.     self.contents = Bitmap.new(width - 32, height - 32)
  301.     self.z, @Index = 400, 1
  302.     refresh
  303.   end
  304.   #-------------------------------------------------------------
  305.   #● 更新內容
  306.   def refresh
  307.     self.contents.draw_text(0, 0, 640, 32, Sword4_Whether)
  308.     self.contents.draw_text(0, 32, @width, 32, '是', 1)
  309.     self.contents.draw_text(0, 64, @width, 32, '否', 1)
  310.     self.cursor_rect.set(@width / 2 - (Font.default_size * 5 / 2),
  311.     @index * 32 + 32, Font.default_size * 5, 32)
  312.   end
  313.   #-------------------------------------------------------------
  314.   #● 更新游標
  315.   def update_cursor_rect
  316.     $Sword_VX ? Sound.play_cursor : $game_system.se_play($data_system.cursor_se)
  317.     @index == 0 ? @index = 1 : @index = 0
  318.     self.cursor_rect.set(@width / 2 - (Font.default_size * 5 / 2),
  319.     @index * 32 + 32, Font.default_size * 5, 32)
  320.   end
  321. end
  322. #=======================================
  323. #■ 合成狀況窗口
  324. class WSword_SynthesizeState < Window_Base
  325.   include Sword # 連接自定設置
  326.   #-------------------------------------------------------------
  327.   #● 初始化物件
  328.   def initialize
  329.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height] : [640, 480]
  330.     super(0, (@xpvx[1] - Font.default_size + 10) / 2 - 32, 64, Font.default_size + 42)
  331.     self.contents = Bitmap.new(width - 32, height - 32)
  332.     self.z = 410
  333.     refresh
  334.   end
  335.   #-------------------------------------------------------------
  336.   #● 更新內容
  337.   def refresh(help = nil, color = nil)
  338.     return if help == nil
  339.     self.contents.clear
  340.     self.x = (@xpvx[0] - contents.text_size(help).width) / 2 - 32
  341.     self.width = contents.text_size(help).width + 32
  342.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  343.     self.contents.font.color = color
  344.     self.contents.draw_text(0, 0, self.width, 32, help)
  345.   end
  346. end
  347. #=======================================
  348. #■ 合成系統畫面
  349. class Sword_Synthesize
  350.   include Sword # 連接自定設置
  351.   #-------------------------------------------------------------
  352.   #● 初始化物件
  353.   def initialize(item = nil) ; @item = item ; end
  354.   #-------------------------------------------------------------
  355.   #● 主處理
  356.   def main
  357.     @help_window = Window_Help.new # 產生幫助窗口
  358.     a = @item == nil ? Sword4_Help[0][0] : Sword4_Help[@item + 1][0]
  359.     b = @item == nil ? Sword4_Help[0][1] : Sword4_Help[@item + 1][1]
  360.     @help_window.set_text(a, b)
  361.     @synthesizestate_wsword = WSword_SynthesizeState.new # 產生合成狀態窗口
  362.     @synthesizestate_wsword.visible = false
  363.     command
  364.     @synthesize_wsword = WSword_Synthesize.new # 產生合成內容窗口
  365.     @synthesize_wsword.refresh(@command[1][@command_window.index])
  366.     @synthesizeonoff_wsword = WSword_SynthesizeONOFF.new
  367.     @synthesizeonoff_wsword.active = false
  368.     @synthesizeonoff_wsword.visible = false
  369.     Graphics.transition
  370.     loop{Graphics.update ; Input.update ; update ; break if $scene != self}
  371.     Graphics.freeze
  372.     @help_window.dispose ; @command_window.dispose ; @synthesize_wsword.dispose
  373.     @synthesizeonoff_wsword.dispose ; @synthesizestate_wsword.dispose
  374.   end
  375.   #-------------------------------------------------------------
  376.   #● 更新
  377.   def update
  378.     @command_window.update ; @synthesizeonoff_wsword.update
  379.     if @command_window.active #○ 當選項窗口活動時
  380.       if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新合成內容
  381.         @synthesize_wsword.refresh(@command[1][@command_window.index])
  382.       elsif Input.press?(Input::LEFT) and @synthesize_wsword.oy > 0 # 向下滾動內容
  383.         return if @command[1].empty?
  384.         @synthesize_wsword.oy -= Sword4_Roll
  385.         @synthesize_wsword.oy = 0 if @synthesize_wsword.oy < 0
  386.       elsif Input.press?(Input::RIGHT) # 向上滾動內容
  387.         return if @command[1].empty?
  388.         if @synthesize_wsword.oy < @synthesize_wsword.max_oy
  389.           @synthesize_wsword.oy += Sword4_Roll
  390.           @synthesize_wsword.oy = @synthesize_wsword.max_oy if
  391.           @synthesize_wsword.oy > @synthesize_wsword.max_oy
  392.         end
  393.       elsif Input.repeat?(Input::B) # 回到地圖
  394.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  395.         $scene = Sword4_Menu > 0 ? Scene_Menu.new(Sword4_Menu - 1) : Scene_Map.new
  396.       elsif Input.repeat?(Input::C) # 合成物品
  397.         # 無法合成的場合
  398.         if @command[1][@command_window.index] == false or @no
  399.           $Sword_VX ? Sound.play_buzzer : $game_system.se_play($data_system.buzzer_se)
  400.           return
  401.         end
  402.         # 開始合成
  403.         success  = true # 用來記錄是否可合成
  404.         a = @command[1][@command_window.index]
  405.         eval("a = Sword4_Synthesize[#{a[0]}][#{a[1]}]")
  406.         # 判斷是否有足夠的材料
  407.         for i in 0..2
  408.           for ii in a
  409.             if $Sword_VX
  410.               success = $game_party.item_number($data_items[ii[0]]) >= ii[1] if i == 0
  411.               success = $game_party.item_number($data_weapons[ii[0]]) >= ii[1] if i == 1
  412.               success = $game_party.item_number($data_armors[ii[0]]) >= ii[1] if i == 2
  413.             else
  414.               success = $game_party.item_number(ii[0]) >= ii[1] if i == 0
  415.               success = $game_party.weapon_number(ii[0]) >= ii[1] if i == 1
  416.               success = $game_party.armor_number(ii[0]) >= ii[1] if i == 2
  417.             end
  418.             # 當其中1個材料不符合的情況
  419.             unless success
  420.               $Sword_VX ? Sound.play_buzzer : $game_system.se_play($data_system.buzzer_se)
  421.               unless Sword4_Message[3][3] == '' # 沒設定訊息的情況下
  422.                 color = Sword4_Message[3]
  423.                 @synthesizestate_wsword.visible = true
  424.                 @synthesizestate_wsword.refresh(
  425.                 Sword4_Message[3][3], Color.new(color[0], color[1], color[2]))
  426.                 for i in 1..Sword4_Wait2
  427.                   @command_window.update
  428.                   @synthesizeonoff_wsword.update
  429.                   Graphics.update
  430.                 end
  431.                 @synthesizestate_wsword.visible = false
  432.               end
  433.               return
  434.             end
  435.           end
  436.         end
  437.         # 開始活動是否合成選項窗口,不需提示就跳過
  438.         @synthesizeonoff_wsword.active = true
  439.         unless Sword4_Whether == ''
  440.           @synthesizeonoff_wsword.update_cursor_rect if @synthesizeonoff_wsword.index == 0
  441.           $Sword_VX ? Sound.play_decision : $game_system.se_play($data_system.decision_se)
  442.           @synthesizeonoff_wsword.visible = true
  443.           @command_window.active = false
  444.         end
  445.         return
  446.       end
  447.     end
  448.     #○ 當是否合成選項窗口活動時
  449.     if @synthesizeonoff_wsword.active
  450.       if Input.repeat?(Input::C) or Sword4_Whether == ''
  451.         @synthesizeonoff_wsword.index = 0 if Sword4_Whether == ''
  452.         if @synthesizeonoff_wsword.index == 0
  453.           # 合成開始,開始消耗材料
  454.           ac = @command[1][@command_window.index] ; a = nil ; multiply = nil
  455.           eval("multiply = $game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}]
  456.           a = Sword4_Synthesize[#{ac[0]}][#{ac[1]}]")
  457.           (0..2).each do |i| a.each do |ii|
  458.             if $Sword_VX
  459.               items = $game_party.item_number($data_items[ii[0]])
  460.               weapons = $game_party.item_number($data_weapons[ii[0]])
  461.               armors = $game_party.item_number($data_armors[ii[0]])
  462.               if items >= ii[1] and i == 0 ; $game_party.lose_item($data_items[ii[0]], ii[1])
  463.               elsif weapons >= ii[1] and i == 1 ; $game_party.lose_item($data_weapons[ii[0]], ii[1])
  464.               elsif armors >= ii[1] and i == 2 ; $game_party.lose_item($data_armors[ii[0]], ii[1])
  465.               end
  466.             else
  467.               items = $game_party.item_number(ii[0])
  468.               weapons = $game_party.weapon_number(ii[0])
  469.               armors = $game_party.armor_number(ii[0])
  470.               if items >= ii[1] and i == 0 ; $game_party.lose_item(ii[0], ii[1])
  471.               elsif weapons >= ii[1] and i == 1 ; $game_party.lose_weapon(ii[0], ii[1])
  472.               elsif armors >= ii[1] and i == 2 ; $game_party.lose_armor(ii[0], ii[1])
  473.               end
  474.             end
  475.           end ; end
  476.           # 結束活動是否合成選項窗口
  477.           @synthesizeonoff_wsword.visible = false
  478.           @synthesizeonoff_wsword.active = false
  479.           @command_window.active = true
  480.           # 顯示合成狀態
  481.           unless Sword4_Message[0][3] == ''
  482.             @synthesizestate_wsword.visible = true
  483.             color = Sword4_Message[0]
  484.             @synthesizestate_wsword.refresh(
  485.             Sword4_Message[0][3], Color.new(color[0], color[1], color[2]))
  486.           end
  487.           # 演奏合成SE
  488.           if Sword4_SE == '' or Sword4_SE == 0 ; 0 # 不演奏SE
  489.           elsif Sword4_SE.is_a?(Integer) # 指定動畫SE
  490.             searr = []
  491.             (0...$data_animations[Sword4_SE].timings.size).each{|i|
  492.             searr.push($data_animations[Sword4_SE].timings.frame)}
  493.             (0...$data_animations[Sword4_SE].frame_max).each do |i|
  494.               tim = $Sword_VX ? 3 : 2
  495.               tim.times {@command_window.update ; @synthesizeonoff_wsword.update
  496.               Graphics.update} # 更新畫面與窗口
  497.               ii = searr.index(i)
  498.               next unless ii
  499.               se = $data_animations[Sword4_SE].timings[ii].se
  500.               next if se.name == ''
  501.               Audio.se_play("Audio/SE/#{se.name}", se.volume, se.pitch)
  502.             end
  503.           elsif Sword4_SE.is_a?(String) ; Audio.se_play("Audio/SE/#{Sword4_SE}") # 指定SE
  504.           end
  505.           (1..Sword4_Wait1).each do |i| # 合成延遲時間
  506.             break if Sword4_SE.is_a?(Integer)
  507.             @command_window.update
  508.             @synthesizeonoff_wsword.update
  509.             Graphics.update
  510.           end
  511.           # 是否合成成功
  512.           @synthesizestate_wsword.visible = false
  513.           if a[3] + multiply > rand(100) # 計算合成機率與合成成功時的場合
  514.             eval("$game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}] +=
  515.             #{Sword4_Probability2}") if [1, 2].include?(Sword4_Probability1)
  516.             unless Sword4_Message[2][3] == ''
  517.               color = Sword4_Message[2]
  518.               @synthesizestate_wsword.visible = true
  519.               @synthesizestate_wsword.refresh(
  520.               Sword4_Message[2][3], Color.new(color[0], color[1], color[2]))
  521.             end
  522.             a = @command[1][@command_window.index]
  523.             # 如果是未合成物品,切換到已合成過
  524.             unless $game_party.sword_synthesize[a[0]][a[1]]
  525.               $game_party.sword_synthesize[a[0]][a[1]] = true
  526.               command(@command_window.index)
  527.             end
  528.             # 獲取合成的物品
  529.             if $Sword_VX
  530.               b = @command[1][@command_window.index][1]
  531.               case @command[1][@command_window.index][0] # 依道具種類決定執行內容
  532.               when 0 ; $game_party.gain_item($data_items, 1)
  533.               when 1 ; $game_party.gain_item($data_weapons, 1)
  534.               when 2 ; $game_party.gain_item($data_armors, 1)
  535.               end
  536.             else
  537.               case @command[1][@command_window.index][0]
  538.               when 0; $game_party.gain_item(@command[1][@command_window.index][1], 1)
  539.               when 1;$game_party.gain_weapon(@command[1][@command_window.index][1],1)
  540.               when 2; $game_party.gain_armor(@command[1][@command_window.index][1],1)
  541.               end
  542.             end
  543.           else # 合成失敗時
  544.             eval("$game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}] +=
  545.             #{Sword4_Probability2}") if [0, 2].include?(Sword4_Probability1)
  546.             unless Sword4_Message[1][3] == ''
  547.               color = Sword4_Message[1]
  548.               @synthesizestate_wsword.visible = true
  549.               @synthesizestate_wsword.refresh(
  550.               Sword4_Message[1][3], Color.new(color[0], color[1], color[2]))
  551.             end
  552.           end
  553.           @synthesize_wsword.refresh(@command[1][@command_window.index])
  554.           # 合成訊息時間
  555.           for i in 1..Sword4_Wait2
  556.             break if Sword4_Message[0][3] == ''
  557.             break if Sword4_Message[1][3] == ''
  558.             break if Sword4_Message[2][3] == ''
  559.             @command_window.update
  560.             @synthesizeonoff_wsword.update
  561.             Graphics.update
  562.           end
  563.         else # 選擇否的情況
  564.           $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  565.         end
  566.         # 結束活動是否合成選項窗口
  567.         @synthesizeonoff_wsword.visible = false
  568.         @synthesizeonoff_wsword.active = false
  569.         @command_window.active = true
  570.         @synthesizestate_wsword.visible = false
  571.       elsif Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新游標
  572.         @synthesizeonoff_wsword.update_cursor_rect
  573.       end
  574.     end
  575.   end
  576.   #-------------------------------------------------------------
  577.   #● 選項的方法
  578.   def command(index = 0)
  579.     @command_window.dispose if @command_window # 該窗口存在就釋放該窗口
  580.     @command = [[], []] # [[道具名稱數組], [道具類型與編號數組]]
  581.     # 設定選項文字
  582.     for i in 0..2
  583.       next unless @item == i unless @item == nil # 不符合顯示標準移到下次
  584.       for ii in 1...$game_party.sword_synthesize.size
  585.         if $game_party.sword_synthesize[ii]
  586.           case i # 依照道具種類決定執行內容
  587.           when 0 ; @command[0].push($data_items[ii].name) ; @command[1].push([0, ii])
  588.           when 1 ; @command[0].push($data_weapons[ii].name) ; @command[1].push([1, ii])
  589.           when 2 ; @command[0].push($data_armors[ii].name) ; @command[1].push([2, ii])
  590.           end
  591.         elsif $game_party.sword_synthesize[ii] == false
  592.           if Sword4_NoCommand == '' # 未合成過的道具用該道具名稱
  593.             case i # 依照道具種類決定執行內容
  594.             when 0 ; @command[0].push($data_items[ii].name)
  595.             when 1 ; @command[0].push($data_weapons[ii].name)
  596.             when 2 ; @command[0].push($data_armors[ii].name)
  597.             end
  598.           else ; @command[0].push(Sword4_NoCommand) # 直接指定未合過的選項文字
  599.           end
  600.           case i # 依照道具種類決定執行內容
  601.           when 0 ; @command[1].push([0, ii, false])
  602.           when 1 ; @command[1].push([1, ii, false])
  603.           when 2 ; @command[1].push([2, ii, false])
  604.           end
  605.         end
  606.       end
  607.     end
  608.     @no = true if @command[0].empty?
  609.     @command[0] = [' '] if @command[0].empty?
  610.     # 產生選項窗口
  611.     @command_window = Window_Command.new(Sword4_Width, @command[0])
  612.     if $Sword_VX ; @command_window.y = 56 ; @command_window.height = 360
  613.     else ; @command_window.y = 64 ; @command_window.height = 416
  614.     end
  615.     @command_window.index = index
  616.     # 無效的顏色
  617.     (0...@command[1].size).each{|i|
  618.     if $Sword_VX ; @command_window.draw_item(i, false) if @command[1][2] == false
  619.     else ; @command_window.disable_item(i) if @command[1][2] == false
  620.     end}
  621.   end
  622. end

捕获.PNG (20.86 KB, 下载次数: 6)

捕获.PNG

捕获1.PNG (19.45 KB, 下载次数: 7)

捕获1.PNG

Lv4.逐梦者 (版主)

聪仔

梦石
0
星屑
6182
在线时间
3077 小时
注册时间
2013-12-26
帖子
3145
2
发表于 2019-3-21 00:09:09 | 只看该作者
设置Sword4_Synthesize就好了蛤...
话说你设置了合成需要的材料以及数量了吗?
聪聪全国第三帅...
他们都叫我【人赢聪】
我的RM能力雷达图:

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
651
在线时间
118 小时
注册时间
2019-3-15
帖子
82
3
 楼主| 发表于 2019-3-21 06:49:21 | 只看该作者
正太君 发表于 2019-3-21 00:09
设置Sword4_Synthesize就好了蛤...
话说你设置了合成需要的材料以及数量了吗?
...

这应该是在51行那设置的
脚本有几个合成配方原本就有了,我以为可以直接打开的。
但是我自己在额外设置其他配方之后,又会出现另外的错误。

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
478
在线时间
71 小时
注册时间
2019-3-6
帖子
14
4
发表于 2019-3-23 15:06:46 | 只看该作者
  1. module Sword
  2. #=======================================
  3.   Sword4_Message, Sword4_Help, Sword4_Synthesize = [], [], [[], [], []]
  4. #=======================================
  5. =begin
  6. ● 設置方法
  7. 呼叫方法(全部):$scene = Sword_Synthesize.new
  8. 呼叫方法(物品):$scene = Sword_Synthesize.new(0)
  9. 呼叫方法(武器):$scene = Sword_Synthesize.new(1)
  10. 呼叫方法(防具):$scene = Sword_Synthesize.new(2)
  11. 習得公開:$game_party.sword_synthesize[種類][編號] = true
  12. 習得隱藏:$game_party.sword_synthesize[種類][編號] = false
  13. 遺忘合成:$game_party.sword_synthesize[種類][編號] = nil
  14. 全部公開:$game_party.sword_synthesize(true)
  15. 全部隱藏:$game_party.sword_synthesize(false)
  16. 全部遺忘:$game_party.sword_synthesize(nil)
  17. 機率加乘變量:$game_party.synthesize_multiply[種類][編號]
  18. =end
  19. #=======================================
  20. #● 使用者自定設置
  21. Sword4_Width = 180 # 設定合成選項的寬度,相對的合成內容寬度也會更動
  22. Sword4_NoCommand = '?????' # 習得卻未合成過的選項文字,''表示道具名稱
  23. Sword4_Whether = '是否要消耗材料並合成道具?' # 合成提示文字,''為不提示
  24. Sword4_Wait1 = 30 # 設定合成中的等待時間,每40約為1秒
  25. Sword4_Wait2 = 30 # 設定成功或完成的訊息等待時間,每40約為1秒
  26. Sword4_Roll = 3 # 設定材料5個以上時,滾動效果的速度
  27. Sword4_Probability1 = 1 # 設定增加成功率的合成結果,0為失敗;1為成功;2是都可
  28. Sword4_Probability2 = 1 # 設定每合成增加成功機率的數值,因Sword4_Probability1而定
  29. Sword4_SE = '122-Ice03' # 開始合成時演奏SE檔名或動畫編號,''或0為不演奏
  30. Sword4_Picture = '049-Skill06' # 當習得未合成時的圖示,XP用字串、VX用數值
  31. Sword4_Menu = 0 # 關閉合成返回設定,0為地圖;1以上選單,並指著指定的選項
  32. #--------------------------------------------------------------
  33. #○ 合成提示窗口設定
  34. # Sword4_Message[不必更改] = [紅, 綠, 藍, '文字內容']
  35. Sword4_Message[0] = [255, 255, 255, '開始合成中...'] # 正在合成中
  36. Sword4_Message[1] = [255, 0, 0, '合成失敗']# 合成失敗
  37. Sword4_Message[2] = [255, 255, 0, '合成成功']# 合成成功
  38. Sword4_Message[3] = [255, 0, 0, '材料不足'] # 材料不足
  39. #--------------------------------------------------------------
  40. #○ 說明窗口顯示設定
  41. # Sword4_Help[不必更改] = ['文字內容', 靠邊位置]
  42. # 靠邊位置:0為靠左邊顯示、1為中央顯示、2為靠右邊顯示
  43. Sword4_Help[0] = ['合成系統', 0] # 顯示所有物品、武器、防具時
  44. Sword4_Help[1] = ['物品合成', 0] # 只顯示物品時
  45. Sword4_Help[2] = ['武器合成', 0] # 只顯示武器時
  46. Sword4_Help[3] = ['防具合成', 0] # 只顯示防具時
  47. #--------------------------------------------------------------
  48. #○ 合成資料表
  49. # Sword4_Synthesize[合成種類][合成編號] = [{物品}, {武器}, {防具}, 成功率]
  50. # 合成種類:0為物品、1為武器、2為防具
  51. # 物品、武器、防具:「編號=>數量」,每個相同種類材料必須用小逗號分開
  52. Sword4_Synthesize[0][3] = [{1=>5, 2=>2, 5=>2}, {}, {}, 100]
  53. Sword4_Synthesize[0][6] = [{4=>5, 5=>2}, {}, {}, 80]
  54. Sword4_Synthesize[1][4] = [{}, {1=>3}, {}, 70]
  55. Sword4_Synthesize[1][8] = [{}, {5=>2, 6=>8}, {4=>1}, 70]
  56. Sword4_Synthesize[2][4] = [{}, {}, {1=>6, 2=>3, 3=>1}, 65]
  57. Sword4_Synthesize[1][28] = [{1=>5, 2=>2}, {5=>5}, {5=>5}, 25]
  58. Sword4_Synthesize[1][4] = [{1=>5}, {2=>2}, {}, 70]
  59. #=======================================
  60.   $Sword ? $Sword[4] = true : $Sword = {4=>true} # 腳本使用標誌
  61.   ($Sword_VX = false ; RPG::Weather rescue $Sword_VX = true) if $Sword_VX == nil
  62. end
  63. #=======================================
  64. #■ 處理同伴的類別
  65. class Game_Party
  66.   include Sword
  67.   attr_writer    :sword_synthesize # 合成狀態數據
  68.   attr_accessor :synthesize_multiply # 機率加乘數值
  69.   #-------------------------------------------------------------
  70.   #● 初始化物件
  71.   alias sword4_initialize initialize
  72.   def initialize
  73.     sword4_initialize
  74.     @sword_synthesize = [Array.new($data_items.size + 1){nil},
  75.     Array.new($data_weapons.size + 1){nil}, Array.new($data_armors.size + 1){nil}]
  76.     @synthesize_multiply = [Array.new($data_items.size + 1){0},
  77.     Array.new($data_weapons.size + 1){0}, Array.new($data_armors.size + 1){0}]
  78.   end
  79.   #-------------------------------------------------------------

  80.   #● 讀取與全部修改的方法
  81.   def sword_synthesize(number = 0)
  82.     return @sword_synthesize if number == 0 # 傳回值
  83.    for i in 0...Sword4_Synthesize.size
  84.      for ii in 0..Sword4_Synthesize[i].size
  85.      next if Sword4_Synthesize[i][ii].nil?
  86.      @sword_synthesize[i][ii] = number
  87.      end
  88.    end
  89.   end
  90. end
  91. #=======================================
  92. #■ 合成系統窗口
  93. class WSword_Synthesize < Window_Base
  94.   include Sword
  95.   attr_accessor :max_oy  # 目前位圖Y座標
  96.   #-------------------------------------------------------------
  97.   #● 初始化物件
  98.   def initialize
  99.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height, WLH + 32] : [640, 480, 64]
  100.     super(Sword4_Width, @xpvx[2], @xpvx[0] - Sword4_Width, @xpvx[1] - @xpvx[2])
  101.     self.contents = Bitmap.new(1, 1) ; refresh
  102.   end
  103.   #-------------------------------------------------------------
  104.   #● 更新內容(成品資料)
  105.   def refresh(itema = nil)
  106.     self.contents.clear ; return unless itema # 清除窗口內容
  107.     case itema[0] # 道具種類分歧
  108.     when 0 ; item = $data_items[itema[1]] # 物品
  109.       # [HP恢復量, SP(MP)恢復量, X, X, HP恢復率, SP(MP)恢復率, X]
  110.       words = $Sword_VX ? [$data_system.terms.hp + '恢復量',
  111.       $data_system.terms.mp + '恢復量', '', '', $data_system.terms.hp + '恢復率',
  112.       $data_system.terms.mp + '恢復率', ''] : [$data_system.words.hp + '恢復量',
  113.       $data_system.words.sp + '恢復量', '', '', $data_system.words.hp + '恢復率',
  114.       $data_system.words.sp + '恢復率', '']
  115.       if $game_party.sword_synthesize[0][itema[1]] # 公開顯示的情況
  116.         amounts = $Sword_VX ? [item.hp_recovery.to_s, item.mp_recovery.to_s, '', '',
  117.         item.hp_recovery_rate.to_s, item.mp_recovery_rate.to_s, ''] : [item.recover_hp.to_s,
  118.         item.recover_sp.to_s, '', '', item.recover_hp_rate.to_s, item.recover_sp_rate.to_s, '']
  119.         if item.parameter_type > 0 # 有設定增加能力值的場合
  120.           words[3] = ($Sword_VX ? [$data_system.terms.hp, $data_system.terms.mp,
  121.           $data_system.terms.atk, $data_system.terms.def, $data_system.terms.spi,
  122.           $data_system.terms.agi] : [$data_system.words.hp, $data_system.words.sp,
  123.           $data_system.words.str, $data_system.words.dex, $data_system.words.agi,
  124.           $data_system.words.int])[item.parameter_type - 1] + '上限'
  125.           amounts[3] = item.parameter_points.to_s
  126.         end
  127.       else ; amounts = ['??', '??', '', '', '??', '??', ''] # 未公開的場合
  128.       end
  129.       number = $Sword_VX ? $game_party.item_number(item) :
  130.       $game_party.item_number(item.id) # 持有數量
  131.     when 1 ; item = $data_weapons[itema[1]] # 武器
  132.       # [攻擊, 物防(防禦), 魔防(X), 力量(命中), 靈巧(精神), 速度(敏捷), 魔力(X)]
  133.       words = $Sword_VX ? [$data_system.terms.atk, $data_system.terms.def, '', '命中率',
  134.       $data_system.terms.spi, $data_system.terms.agi, ''] : [$data_system.words.atk,
  135.       $data_system.words.pdef, $data_system.words.mdef, $data_system.words.str,
  136.       $data_system.words.dex, $data_system.words.agi, $data_system.words.int]
  137.       if $game_party.sword_synthesize[1][itema[1]] # 公開顯示的情況
  138.         amounts = $Sword_VX ? [item.atk.to_s, item.def.to_s, '', item.hit.to_s + '%', item.spi.to_s,
  139.         item.agi.to_s, ''] : [item.atk.to_s, item.pdef.to_s, item.mdef.to_s, item.str_plus.to_s,
  140.         item.dex_plus.to_s, item.agi_plus.to_s, item.int_plus.to_s]
  141.       else ; amounts = ['??'] * 7 # 未公開的場合
  142.       end
  143.       number = $Sword_VX ? $game_party.item_number(item) :
  144.       $game_party.weapon_number(item.id) # 持有數量
  145.     when 2 ; item = $data_armors[itema[1]] # 防具
  146.       # [物防(攻擊), 魔防(防禦), 迴避(X), 力量(迴避), 靈巧(精神), 速度(敏捷), 魔力(X)]
  147.       words = $Sword_VX ? [$data_system.terms.atk, $data_system.terms.def, '', '回避率',
  148.       $data_system.terms.spi, $data_system.terms.agi, ''] : [$data_system.words.pdef,
  149.       $data_system.words.mdef, '回避', $data_system.words.str, $data_system.words.dex,
  150.       $data_system.words.agi, $data_system.words.int]
  151.       if $game_party.sword_synthesize[2][itema[1]] # 公開顯示的情況
  152.         amounts = $Sword_VX ? [item.atk.to_s, item.def.to_s, '', item.eva.to_s + '%',
  153.         item.spi.to_s, item.agi.to_s, ''] : [item.pdef.to_s, item.mdef.to_s, item.eva.to_s,
  154.         item.str_plus.to_s, item.dex_plus.to_s, item.agi_plus.to_s, item.int_plus.to_s]
  155.       else ; amounts = ['??'] * 7 # 未公開的場合
  156.       end
  157.       number = $Sword_VX ? $game_party.item_number(item) :
  158.       $game_party.armor_number(item.id) # 持有數量
  159.     end
  160.     by, y, x, self.oy = 8, 32, Font.default_size * 5, 0 # 位圖行, 描繪Y, 描繪X, 起始位置
  161.     by += self.contents.text_size($game_party.sword_synthesize[itema[0]][itema[1]] ?
  162.     item.description : '????????????').width / (self.width - 32) # 說明換行
  163.     (0..2).each{|i|by += Sword4_Synthesize[itema[0]][itema[1]].size} rescue
  164. raise("合成資料不存在,Sword4_Synthesize[#{itema[0]}][#{itema[1]}]未設置") # Error
  165.     by -= 1 if $Sword_VX or itema[0] == 0
  166.     self.contents = Bitmap.new(self.width - 32, by * 32) # 重新產生位圖
  167.     @max_oy = [by * 32 - (@xpvx[1] - @xpvx[2]) + 32, 0].max # 滾動限制
  168.     self.contents.font.color = normal_color # 數值和內容
  169.     if $game_party.sword_synthesize[itema[0]][itema[1]] # 公開顯示的情況
  170.       $Sword_VX ? draw_icon(item.icon_index, 0, 0, true) : # 圖標
  171.       contents.blt(0, 0, RPG::Cache.icon(item.icon_name), Rect.new(0 , 0, 24, 24))
  172.       contents.draw_text(28, 0, 640, 32, item.name) # 名稱
  173.       contents.draw_text(0, 0, self.width - 40, 32, number.to_s, 2) # 持有數
  174.       xx = 0
  175.       item.description.scan(/./).each{|c| cx = self.contents.text_size(c).width
  176.       (xx = 0 ; y += 32) if xx + cx > self.width - 32
  177.       contents.draw_text(xx, y, cx, 32, c) ; xx += cx}  # 說明
  178.     else # 隱藏顯示的場合
  179.       $Sword_VX ? draw_icon(Sword4_Picture, 0, 0, true) : # 圖標
  180.       contents.blt(0, 0, RPG::Cache.icon(Sword4_Picture), Rect.new(0 , 0, 24, 24))
  181.       contents.draw_text(28, 0, 640, 32, Sword4_NoCommand.empty? ?
  182.       item.name : Sword4_NoCommand) # 名稱
  183.       contents.draw_text(0, 0, self.width - 40, 32, '??', 2) # 持有數
  184.       contents.draw_text(0, 32, 640, 32, '????????????') # 說明
  185.     end
  186.     probability = [[Sword4_Synthesize[itema[0]][itema[1]][3] +
  187.     $game_party.synthesize_multiply[itema[0]][itema[1]], 100].min, 0].max.to_s + '%'
  188.     contents.draw_text(x, y + 32, 640, 32, probability) # 成功率
  189.     contents.draw_text(x, y + 64, 640, 32, amounts[0])
  190.     contents.draw_text(x, y + 96, 640, 32, amounts[1])
  191.     contents.draw_text(x, y + 128, 640, 32, amounts[2])
  192.     contents.draw_text(self.width / 2 + x, y + 32, 640, 32, amounts[3])
  193.     contents.draw_text(self.width / 2 + x, y + 64, 640, 32, amounts[4])
  194.     contents.draw_text(self.width / 2 + x, y + 96, 640, 32, amounts[5])
  195.     contents.draw_text(self.width / 2 + x, y + 128, 640, 32, amounts[6])
  196.     sequence, @yy = [Sword4_Synthesize[itema[0]][itema[1]][0].keys.sort,
  197.     Sword4_Synthesize[itema[0]][itema[1]][1].keys.sort,
  198.     Sword4_Synthesize[itema[0]][itema[1]][2].keys.sort], 7 + y / 32
  199.     yyy = 6 ; (@yy -= 1 ; yyy = 5) #if $Sword_VX or itema[0] == 0
  200.    for i in 0...sequence.size
  201.      next if sequence[i].empty?
  202.      sequence[i].each{|ii|stuff(i, ii, itema[1], @yy, itema[0]) ; @yy += 1}
  203.      end
  204.     self.contents.font.color = system_color # 用語
  205.     contents.draw_text(0, 0, self.width - 64, 32, '持有數:', 2)
  206.     contents.draw_text(0, y + 32, 640, 32, '成功率')
  207.     contents.draw_text(0, y + 64, 640, 32, words[0])
  208.     contents.draw_text(0, y + 96, 640, 32, words[1])
  209.     contents.draw_text(0, y + 128, 640, 32, words[2])
  210.     contents.draw_text(self.width / 2, y + 32, 640, 32, words[3])
  211.     contents.draw_text(self.width / 2, y + 64, 640, 32, words[4])
  212.     contents.draw_text(self.width / 2, y + 96, 640, 32, words[5])
  213.     contents.draw_text(self.width / 2, y + 128, 640, 32, words[6])
  214.     contents.draw_text(0, (yyy + y / 32) * 32, 640, 32, '所需道具')
  215.     contents.draw_text(0, (yyy + y / 32) * 32, self.width - 138, 32, '持有數', 2)
  216.     contents.draw_text(0, (yyy + y / 32) * 32, self.width - 42, 32, '所需數', 2)
  217.     (0..7).each do |i| # 產生「:」
  218.       next if i == 3 or i == 7 if $Sword_VX
  219.       next if [3, (item.parameter_type > 0 and $game_party.sword_synthesize[0][itema[1]]) ?
  220.       nil : 4, 7].include?(i) if itema[0] == 0 # 物品的場合,忽略不必描繪的部份
  221.       if i > 3 ; i -= 4
  222.         contents.draw_text(self.width / 2 + Font.default_size * 4, 32 * i + 32 + y, 640, 32, ':')
  223.       else ; contents.draw_text(Font.default_size * 4, 32 * i + 32 + y, 640, 32, ':')
  224.       end
  225.     end
  226.   end
  227.   #-------------------------------------------------------------
  228.   #● 所需材料的內容
  229.   def stuff(kind, i, item, y, kind2)
  230.     Sword4_Synthesize[kind2][item][kind][i] > 9 ?
  231.     a = 64 : a = 69
  232.     self.contents.draw_text(0, y * 32, @xpvx[0] - Sword4_Width - a, 32,
  233.     Sword4_Synthesize[kind2][item][kind][i].to_s, 2)
  234.     # 圖示與持有數
  235.     case kind
  236.     when 0 # 物品(材料)
  237.       if $Sword_VX
  238.         draw_icon($data_items.icon_index, 0, y * 32, true)
  239.         items = $game_party.item_number($data_items)
  240.       else
  241.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  242.         $data_items[i].icon_name), Rect.new(0 , 0, 24, 24))
  243.         items = $game_party.item_number(i)
  244.       end
  245.       items >= Sword4_Synthesize[kind2][item][0][i] ?
  246.       color = normal_color : color = Color.new(255, 64, 0)
  247.       self.contents.draw_text(28, y * 32, 640, 32, $data_items[i].name)
  248.       # 持有數
  249.       self.contents.font.color = color
  250.       items > 9 ? a = 160 : a = 165
  251.       self.contents.draw_text(0, y * 32,
  252.       @xpvx[0] - Sword4_Width - a, 32, items.to_s, 2)
  253.       self.contents.font.color = normal_color
  254.     when 1 # 武器(材料)
  255.       if $Sword_VX
  256.         weapon = $game_party.item_number($data_weapons)
  257.         draw_icon($data_weapons.icon_index, 0, y * 32, true)
  258.       else
  259.         weapon = $game_party.weapon_number(i)
  260.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  261.         $data_weapons[i].icon_name), Rect.new(0 , 0, 24, 24))
  262.       end
  263.       weapon >= Sword4_Synthesize[kind2][item][1][i] ?
  264.       color = normal_color : color = Color.new(255, 64, 0)
  265.       self.contents.draw_text(28, y * 32, 640, 32, $data_weapons[i].name)
  266.       # 持有數
  267.       self.contents.font.color = color
  268.       weapon > 9 ? a = 160 : a = 165
  269.       self.contents.draw_text(0, y * 32,
  270.       @xpvx[0] - Sword4_Width - a, 32, weapon.to_s, 2)
  271.       self.contents.font.color = normal_color
  272.     when 2 # 防具(材料)
  273.       if $Sword_VX
  274.         draw_icon($data_armors.icon_index, 0, y * 32, true)
  275.         armors = $game_party.item_number($data_armors)
  276.       else
  277.         self.contents.blt(0, y * 32, RPG::Cache.icon(
  278.         $data_armors[i].icon_name), Rect.new(0 , 0, 24, 24))
  279.         armors = $game_party.armor_number(i)
  280.       end
  281.       armors >= Sword4_Synthesize[kind2][item][2][i] ?
  282.       color = normal_color : color = Color.new(255, 64, 0)
  283.       self.contents.draw_text(28, y * 32, 640, 32, $data_armors[i].name)
  284.       # 持有數
  285.       self.contents.font.color = color
  286.       armors > 9 ? a = 160 : a = 165
  287.       self.contents.draw_text(0, y * 32,
  288.       @xpvx[0] - Sword4_Width - a, 32, armors.to_s, 2)
  289.       self.contents.font.color = normal_color
  290.     end
  291.   end
  292. end
  293. #=======================================
  294. #■ 是否合成提示窗口
  295. class WSword_SynthesizeONOFF < Window_Base
  296.   include Sword # 連接自定設置
  297.   attr_accessor  :index # 游標位置
  298.   #-------------------------------------------------------------
  299.   #● 初始化物件
  300.   def initialize
  301.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height] : [640, 480]
  302.     contents = Bitmap.new(@xpvx[0], 32)
  303.     @width = contents.text_size(Sword4_Whether).width
  304.     @width = 32 if @width  == 0
  305.     super((@xpvx[0] - @width) / 2 - 32, (@xpvx[1] - (Font.default_size + 10)*4)/2,
  306.     @width + 32, (Font.default_size + 10) * 4)
  307.     self.contents = Bitmap.new(width - 32, height - 32)
  308.     self.z, @Index = 400, 1
  309.     refresh
  310.   end
  311.   #-------------------------------------------------------------
  312.   #● 更新內容
  313.   def refresh
  314.     self.contents.draw_text(0, 0, 640, 32, Sword4_Whether)
  315.     self.contents.draw_text(0, 32, @width, 32, '是', 1)
  316.     self.contents.draw_text(0, 64, @width, 32, '否', 1)
  317.     y = @index.nil? ? 0 : @index * 32
  318.     self.cursor_rect.set(@width / 2 - (Font.default_size * 5 / 2), y, Font.default_size * 5, 32)
  319.   end
  320.   #-------------------------------------------------------------
  321.   #● 更新游標
  322.   def update_cursor_rect
  323.     $Sword_VX ? Sound.play_cursor : $game_system.se_play($data_system.cursor_se)
  324.     @index == 0 ? @index = 1 : @index = 0
  325.     self.cursor_rect.set(@width / 2 - (Font.default_size * 5 / 2),
  326.     @index * 32 + 32, Font.default_size * 5, 32)
  327.   end
  328. end
  329. #=======================================
  330. #■ 合成狀況窗口
  331. class WSword_SynthesizeState < Window_Base
  332.   include Sword # 連接自定設置
  333.   #-------------------------------------------------------------
  334.   #● 初始化物件
  335.   def initialize
  336.     @xpvx = $Sword_VX ? [Graphics.width, Graphics.height] : [640, 480]
  337.     super(0, (@xpvx[1] - Font.default_size + 10) / 2 - 32, 64, Font.default_size + 42)
  338.     self.contents = Bitmap.new(width - 32, height - 32)
  339.     self.z = 410
  340.     refresh
  341.   end
  342.   #-------------------------------------------------------------
  343.   #● 更新內容
  344.   def refresh(help = nil, color = nil)
  345.     return if help == nil
  346.     self.contents.clear
  347.     self.x = (@xpvx[0] - contents.text_size(help).width) / 2 - 32
  348.     self.width = contents.text_size(help).width + 32
  349.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  350.     self.contents.font.color = color
  351.     self.contents.draw_text(0, 0, self.width, 32, help)
  352.   end
  353. end
  354. #=======================================
  355. #■ 合成系統畫面
  356. class Sword_Synthesize
  357.   include Sword # 連接自定設置
  358.   #-------------------------------------------------------------
  359.   #● 初始化物件
  360.   def initialize(item = nil) ; @item = item ; end
  361.   #-------------------------------------------------------------
  362.   #● 主處理
  363.   def main
  364.     @help_window = Window_Help.new # 產生幫助窗口
  365.     a = @item == nil ? Sword4_Help[0][0] : Sword4_Help[@item + 1][0]
  366.     b = @item == nil ? Sword4_Help[0][1] : Sword4_Help[@item + 1][1]
  367.     @help_window.set_text(a, b)
  368.     @synthesizestate_wsword = WSword_SynthesizeState.new    # 產生合成狀態窗口
  369.     @synthesizestate_wsword.visible = false
  370.     command
  371.     @synthesize_wsword = WSword_Synthesize.new# 產生合成內容窗口
  372.     @synthesize_wsword.refresh(@command[1][@command_window.index])
  373.     @synthesizeonoff_wsword = WSword_SynthesizeONOFF.new
  374.     @synthesizeonoff_wsword.active = false
  375.     @synthesizeonoff_wsword.visible = false
  376.     Graphics.transition
  377.     loop{Graphics.update ; Input.update ; update ; break if $scene != self}
  378.     Graphics.freeze
  379.     @help_window.dispose ; @command_window.dispose ; @synthesize_wsword.dispose
  380.     @synthesizeonoff_wsword.dispose ; @synthesizestate_wsword.dispose
  381.   end
  382.   #-------------------------------------------------------------
  383.   #● 更新
  384.   def update
  385.     @command_window.update ; @synthesizeonoff_wsword.update
  386.     if @command_window.active #○ 當選項窗口活動時
  387.       if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新合成內容
  388.         @synthesize_wsword.refresh(@command[1][@command_window.index])
  389.       elsif Input.press?(Input::LEFT) and @synthesize_wsword.oy > 0 # 向下滾動內容
  390.         return if @command[1].empty?
  391.         @synthesize_wsword.oy -= Sword4_Roll
  392.         @synthesize_wsword.oy = 0 if @synthesize_wsword.oy < 0
  393.       elsif Input.press?(Input::RIGHT) # 向上滾動內容
  394.         return if @command[1].empty?
  395.         if @synthesize_wsword.oy < @synthesize_wsword.max_oy
  396.           @synthesize_wsword.oy += Sword4_Roll
  397.           @synthesize_wsword.oy = @synthesize_wsword.max_oy if
  398.           @synthesize_wsword.oy > @synthesize_wsword.max_oy
  399.         end
  400.       elsif Input.repeat?(Input::B) # 回到地圖
  401.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  402.         $scene = Sword4_Menu > 0 ? Scene_Menu.new(Sword4_Menu - 1) : Scene_Map.new
  403.       elsif Input.repeat?(Input::C) # 合成物品
  404.         # 無法合成的場合
  405.         if @command[1][@command_window.index] == false or @no
  406.           $Sword_VX ? Sound.play_buzzer : $game_system.se_play($data_system.buzzer_se)
  407.           return
  408.         end
  409.         # 開始合成
  410.         success  = true # 用來記錄是否可合成
  411.         a = @command[1][@command_window.index]
  412.         eval("a = Sword4_Synthesize[#{a[0]}][#{a[1]}]")
  413.         # 判斷是否有足夠的材
  414.         m = []
  415.         for i in 0..2
  416.            a[i].each{|ii|
  417.         success = $game_party.item_number(ii[0]) >= ii[1] if i == 0
  418.         success = $game_party.weapon_number(ii[0]) >= ii[1] if i == 1
  419.         success = $game_party.armor_number(ii[0]) >= ii[1] if i == 2
  420.         m.push(success)}
  421.       end
  422.           if m.include?(false)
  423.             success = false
  424.             end
  425.             # 當其中1個材料不符合的情況
  426.             unless success
  427.               $Sword_VX ? Sound.play_buzzer : $game_system.se_play($data_system.buzzer_se)
  428.               unless Sword4_Message[3][3] == '' # 沒設定訊息的情況下
  429.                 color = Sword4_Message[3]
  430.                 @synthesizestate_wsword.visible = true
  431.                 @synthesizestate_wsword.refresh(
  432.                 Sword4_Message[3][3], Color.new(color[0], color[1], color[2]))
  433.                 for i in 1..Sword4_Wait2
  434.                   @command_window.update
  435.                   @synthesizeonoff_wsword.update
  436.                   Graphics.update
  437.                 end
  438.                 @synthesizestate_wsword.visible = false
  439.               end
  440.               return
  441.             end
  442.         # 開始活動是否合成選項窗口,不需提示就跳過
  443.         @synthesizeonoff_wsword.active = true
  444.         unless Sword4_Whether == ''
  445.           @synthesizeonoff_wsword.update_cursor_rect if @synthesizeonoff_wsword.index == 0
  446.           $Sword_VX ? Sound.play_decision : $game_system.se_play($data_system.decision_se)
  447.           @synthesizeonoff_wsword.visible = true
  448.           @command_window.active = false
  449.         end
  450.         return
  451.       end
  452.     end
  453.     #○ 當是否合成選項窗口活動時
  454.     if @synthesizeonoff_wsword.active
  455.       if Input.repeat?(Input::C) or Sword4_Whether == ''
  456.         @synthesizeonoff_wsword.index = 0 if Sword4_Whether == ''
  457.         if @synthesizeonoff_wsword.index == 0
  458.           # 合成開始,開始消耗材料
  459.           ac = @command[1][@command_window.index] ; a = nil ; multiply = nil
  460.           eval("multiply = $game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}]
  461.           a = Sword4_Synthesize[ac[0]][ac[1]]
  462.           b = []
  463.           b.push(a[0])
  464.           b.push(a[1])
  465.           b.push(a[2])
  466.           (0..2).each do |i|
  467.             b[i].each do |ii|
  468.           case i
  469.           when 0
  470.             items = $game_party.item_number(ii[0])
  471.             if items >= ii[1]
  472.              $game_party.lose_item(ii[0],ii[1])
  473.              end
  474.           when 1
  475.             weapons = $game_party.weapon_number(ii[0])
  476.             if weapons >= ii[1]
  477.               $game_party.lose_weapon(ii[0],ii[1])
  478.             end
  479.            when 2
  480.              armors = $game_party.armor_number(ii[0])
  481.              if armors >= ii[1]
  482.                $game_party.lose_armor(ii[0],ii[1])
  483.              end
  484.            end
  485.           end
  486.         end

  487.           #a1 = Sword4_Synthesize[#{ac[0]}][#{ac[1]}]")
  488.         #  (0..2).each do |i| a.each do |ii|
  489.       #   end ; end
  490.     # 結束活動是否合成選項窗口
  491.           @synthesizeonoff_wsword.visible = false
  492.           @synthesizeonoff_wsword.active = false
  493.           @command_window.active = true
  494.           # 顯示合成狀態
  495.           unless Sword4_Message[0][3] == ''
  496.             @synthesizestate_wsword.visible = true
  497.             color = Sword4_Message[0]
  498.             @synthesizestate_wsword.refresh(
  499.             Sword4_Message[0][3], Color.new(color[0], color[1], color[2]))
  500.           end
  501.           # 演奏合成SE
  502.           if Sword4_SE == '' or Sword4_SE == 0 ; 0 # 不演奏SE
  503.           elsif Sword4_SE.is_a?(Integer) # 指定動畫SE
  504.             searr = []
  505.             (0...$data_animations[Sword4_SE].timings.size).each{|i|
  506.             searr.push($data_animations[Sword4_SE].timings.frame)}
  507.             (0...$data_animations[Sword4_SE].frame_max).each do |i|
  508.               tim = $Sword_VX ? 3 : 2
  509.               tim.times {@command_window.update ; @synthesizeonoff_wsword.update
  510.               Graphics.update} # 更新畫面與窗口
  511.               ii = searr.index(i)
  512.               next unless ii
  513.               se = $data_animations[Sword4_SE].timings[ii].se
  514.               next if se.name == ''
  515.               Audio.se_play("Audio/SE/#{se.name}", se.volume, se.pitch)
  516.             end
  517.           elsif Sword4_SE.is_a?(String) ; Audio.se_play("Audio/SE/#{Sword4_SE}") # 指定SE
  518.           end
  519.           (1..Sword4_Wait1).each do |i| # 合成延遲時間
  520.             break if Sword4_SE.is_a?(Integer)
  521.             @command_window.update
  522.             @synthesizeonoff_wsword.update
  523.             Graphics.update
  524.           end
  525.           # 是否合成成功
  526.           @synthesizestate_wsword.visible = false
  527.           if a[3] + multiply > rand(100) # 計算合成機率與合成成功時的場合
  528.             eval("$game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}] +=
  529.             #{Sword4_Probability2}") if [1, 2].include?(Sword4_Probability1)
  530.             unless Sword4_Message[2][3] == ''
  531.               color = Sword4_Message[2]
  532.               @synthesizestate_wsword.visible = true
  533.               @synthesizestate_wsword.refresh(
  534.               Sword4_Message[2][3], Color.new(color[0], color[1], color[2]))
  535.             end
  536.             a = @command[1][@command_window.index]
  537.             # 如果是未合成物品,切換到已合成過
  538.             unless $game_party.sword_synthesize[a[0]][a[1]]
  539.               $game_party.sword_synthesize[a[0]][a[1]] = true
  540.               command(@command_window.index)
  541.             end
  542.             # 獲取合成的物品
  543.             if $Sword_VX
  544.               b = @command[1][@command_window.index][1]
  545.               case @command[1][@command_window.index][0] # 依道具種類決定執行內容
  546.               when 0 ; $game_party.gain_item($data_items, 1)
  547.               when 1 ; $game_party.gain_item($data_weapons, 1)
  548.               when 2 ; $game_party.gain_item($data_armors, 1)
  549.               end
  550.             else
  551.               case @command[1][@command_window.index][0]
  552.               when 0; $game_party.gain_item(@command[1][@command_window.index][1], 1)
  553.               when 1;$game_party.gain_weapon(@command[1][@command_window.index][1],1)
  554.               when 2; $game_party.gain_armor(@command[1][@command_window.index][1],1)
  555.               end
  556.             end
  557.           else # 合成失敗時
  558.             eval("$game_party.synthesize_multiply[#{ac[0]}][#{ac[1]}] +=
  559.             #{Sword4_Probability2}") if [0, 2].include?(Sword4_Probability1)
  560.             unless Sword4_Message[1][3] == ''
  561.               color = Sword4_Message[1]
  562.               @synthesizestate_wsword.visible = true
  563.               @synthesizestate_wsword.refresh(
  564.               Sword4_Message[1][3], Color.new(color[0], color[1], color[2]))
  565.             end
  566.           end
  567.           @synthesize_wsword.refresh(@command[1][@command_window.index])
  568.           # 合成訊息時間
  569.           for i in 1..Sword4_Wait2
  570.             break if Sword4_Message[0][3] == ''
  571.             break if Sword4_Message[1][3] == ''
  572.             break if Sword4_Message[2][3] == ''
  573.             @command_window.update
  574.             @synthesizeonoff_wsword.update
  575.             Graphics.update
  576.           end
  577.         else # 選擇否的情況
  578.           $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  579.         end
  580.         # 結束活動是否合成選項窗口
  581.         @synthesizeonoff_wsword.visible = false
  582.         @synthesizeonoff_wsword.active = false
  583.         @command_window.active = true
  584.         @synthesizestate_wsword.visible = false
  585.       elsif Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新游標
  586.         @synthesizeonoff_wsword.update_cursor_rect
  587.       end
  588.     end
  589.   end
  590.   #-------------------------------------------------------------
  591.   #● 選項的方法
  592.   def command(index = 0)
  593.     @command_window.dispose if @command_window # 該窗口存在就釋放該窗口
  594.     @command = [[], []] # [[道具名稱數組], [道具類型與編號數組]]
  595.     # 設定選項文字
  596.     a = Sword::Sword4_Synthesize[@item]
  597.     for i in 0...a.size
  598.       next if a[i] == nil
  599.       case @item
  600.       when 0
  601.       $game_party.sword_synthesize[0][i] ? @command[0].push($data_items[i].name) :
  602.       @command[0].push(Sword4_NoCommand)
  603.       when 1
  604.       $game_party.sword_synthesize[1][i] ? @command[0].push($data_weapons[i].name) :
  605.       @command[0].push(Sword4_NoCommand)
  606.       when 2
  607.       $game_party.sword_synthesize[2][i] ? @command[0].push($data_armors[i].name) :
  608.       @command[0].push(Sword4_NoCommand)
  609.       end
  610.       @command[1].push([@item,i])
  611.     end
  612. =begin
  613.     for i in 0..2
  614.       next unless @item == i unless @item == nil # 不符合顯示標準移到下次
  615.       for ii in 1...$game_party.sword_synthesize.size
  616.         if $game_party.sword_synthesize[ii]
  617.           case i # 依照道具種類決定執行內容
  618.           when 0 ; @command[0].push($data_items[ii].name) ; @command[1].push([0, ii])
  619.           when 1 ; @command[0].push($data_weapons[ii].name) ; @command[1].push([1, ii])
  620.           when 2 ; @command[0].push($data_armors[ii].name) ; @command[1].push([2, ii])
  621.           end
  622.         elsif $game_party.sword_synthesize[ii] == false
  623.           if Sword4_NoCommand == '' # 未合成過的道具用該道具名稱
  624.             case i # 依照道具種類決定執行內容
  625.             when 0 ; @command[0].push($data_items[ii].name)
  626.             when 1 ; @command[0].push($data_weapons[ii].name)
  627.             when 2 ; @command[0].push($data_armors[ii].name)
  628.             end
  629.           else ; @command[0].push(Sword4_NoCommand) # 直接指定未合過的選項文字
  630.           end
  631.           case i # 依照道具種類決定執行內容
  632.           when 0 ; @command[1].push([0, ii, false])
  633.           when 1 ; @command[1].push([1, ii, false])
  634.           when 2 ; @command[1].push([2, ii, false])
  635.           end
  636.         end
  637.       end
  638.     end
  639. =end
  640.     @no = true if @command[0].empty?
  641.     @command[0] = [' '] if @command[0].empty?
  642.     # 產生選項窗口
  643.     @command_window = Window_Command.new(Sword4_Width, @command[0])
  644.     if $Sword_VX ; @command_window.y = 56 ; @command_window.height = 360
  645.     else ; @command_window.y = 64 ; @command_window.height = 416
  646.     end
  647.     @command_window.index = index
  648.     # 無效的顏色
  649.     (0...@command[1].size).each{|i|
  650.     if $Sword_VX ; @command_window.draw_item(i, false) if @command[1][2] == false
  651.     else ; @command_window.disable_item(i) if @command[1][2] == false
  652.     end}
  653.   end
  654. end
复制代码
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
478
在线时间
71 小时
注册时间
2019-3-6
帖子
14
5
发表于 2019-3-23 15:07:25 | 只看该作者
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-30 13:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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