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

Project1

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

[已经解决] 物品合成,取消合成项目

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
85 小时
注册时间
2012-4-25
帖子
192
跳转到指定楼层
1
发表于 2012-6-16 18:24:57 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 woyaozhuce 于 2012-6-16 18:50 编辑


这个是首先打开矿石合成项目的图


这个是首先打开武器合成项目的图


这个是先打开矿石合成项目的图,之后打开了武器合成项目的图

好了,我想请教的是,我打开了矿石合成项目的图片后,再打开武器
的合成项目,怎么只显示武器的合成项目,去掉矿石的合成项目。


这个是武器合成调用脚本的公共事件


这个是矿石合成调用脚本的公共事件


-------------------------------------以下是脚本-----------------------------------------



# written by Deke
#============================================================================================
# 简介:
# 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
# 物品方法。
#
# 使用方法:
# 1、召唤界面:使用脚本$scene = Scene_Craft.new
#
# 2、学习合成:$game_party.learn_recipe(合成项目)
#
# 3、合成定义:
# 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
# 直接写在这里就可以,另一种是在学习之前现场定义。
#
# 4、举例
#  4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
#       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
#
#  4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,   
#  脚本:
#    材料 = [$game_variables[1],$game_variables[2]]  #——材料编号是变量1、2的编号
#    材料种类 = [0,0]                                #——材料是物品
#    材料数量 = [$game_variables[3],$game_variables[4]]  #——需要材料数量是变量3、4的编号
#    成品 = $game_variables[5]                       #——获得结果编号是5
#    成品种类 = 1                                    #——成品是防具类
#    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类))
#===========================================================================================
class Game_Temp
  attr_reader :recipe_list  
  alias crafting_temp_initialize initialize
  def initialize
    crafting_temp_initialize
    @recipe_list=[]
    get_recipe_list
  end  
  def get_recipe_list
    ##########################################################################
    # 宝石精炼 一级矿
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 270                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (铜矿石10=青铜)
    ##########################################################################
    材料 = [62,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,10]         # 需要材料的数量
    成品 = 43                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (铁矿石10=钢铁)
    ##########################################################################
    材料 = [61,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,10]         # 需要材料的数量
    成品 = 50                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (银矿石10=银锭)
    ##########################################################################
    材料 = [65,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,10]         # 需要材料的数量
    成品 = 39                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (锂矿石10=锂锭)
    ##########################################################################
    材料 = [56,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,10]         # 需要材料的数量
    成品 = 46                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[5] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (朱矿石10=朱锭)
    ##########################################################################
    材料 = [65,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,10]         # 需要材料的数量
    成品 = 39                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[6] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 2级矿
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 271                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[7] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黄金母矿10=黄金)
    ##########################################################################
    材料 = [54,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 45                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[8] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黄金10=黄宝石)
    ##########################################################################
    材料 = [45,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 53                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[9] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (祖母绿母矿10=祖母绿)
    ##########################################################################
    材料 = [47,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 71                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[10] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (蛋白母矿10=蛋白石)
    ##########################################################################
    材料 = [48,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 49                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[11] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (蓝宝石母矿10=深海宝石)
    ##########################################################################
    材料 = [58,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 57                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[12] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (石榴母矿10=石榴石)
    ##########################################################################
    材料 = [59,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,20]         # 需要材料的数量
    成品 = 60                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[13] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 3级矿
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 272                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[14] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黑水晶母矿10=黑水晶)
    ##########################################################################
    材料 = [52,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 51                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[15] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黑水晶10=黑暗水晶)
    ##########################################################################
    材料 = [51,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 68                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[16] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (透明母矿10=透明宝石)
    ##########################################################################
    材料 = [63,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 55                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[17] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (紫矿石10=紫水晶母矿)
    ##########################################################################
    材料 = [67,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 70                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[18] =Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (紫水晶母矿10=紫水晶)
    ##########################################################################
    材料 = [70,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 69                 # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[19] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (钻石母矿10=钻石)
    ##########################################################################
    材料 = [73,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 72                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[20] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (幸运母矿10=幸运水晶)
    ##########################################################################
    材料 = [41,92]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10,30]         # 需要材料的数量
    成品 = 42                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[21] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 4级矿
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 273                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[22] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黄金5+祖母绿5+蛋白石5+深海宝石5+石榴石5=星辰石)
    ##########################################################################
    材料 = [45,71,49,57,60,92]             # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,5,5,5,5,50]         # 需要材料的数量
    成品 = 64                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[23] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 (黑水晶5+透明宝石5+紫水晶母矿5+钻石5+幸运水晶5=月光石)
    ##########################################################################
    材料 = [51,55,70,72,42,92]             # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,5,5,5,5,50]         # 需要材料的数量
    成品 = 40                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[24]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 其他合成
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 274                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[25]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 怪物结晶c10=怪物结晶b
    ##########################################################################
    材料 = [207]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10]         # 需要材料的数量
    成品 = 206                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[26]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 怪物结晶B10=怪物结晶A
    ##########################################################################
    材料 = [206]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10]         # 需要材料的数量
    成品 = 205                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[27]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 时空碎片c10=时空碎片b
    ##########################################################################
    材料 = [212]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10]         # 需要材料的数量
    成品 = 211                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[28]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 宝石精炼 时空碎片B10=时空碎片A
    ##########################################################################
    材料 = [211]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [10]         # 需要材料的数量
    成品 = 210                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[29]= Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   
   
   
    #----------------------------devil武器打造列表----------------------------
    ##########################################################################
    # 初级斧类合成 (铜矿石5        铁矿石)
    ##########################################################################
    材料 = [300]             # 需要材料的数据库编号
    材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [0]         # 需要材料的数量
    成品 = 275                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[30] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造长刃斧 (铜矿石5        铁矿石)
    ##########################################################################
    材料 = [62,61]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,1]         # 需要材料的数量
    成品 = 2                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[31] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造双面斧 (铁矿石5        银矿石)
    ##########################################################################
    材料 = [61,65]             # 需要材料的数据库编号
    材料种类 = [0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,1]         # 需要材料的数量
    成品 = 3                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[32] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造吸血斧 (青铜        锂矿石10        长刃斧1)
    ##########################################################################
    材料 = [61,56,2]             # 需要材料的数据库编号
    材料种类 = [0,0,2]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,1,1]         # 需要材料的数量
    成品 = 4                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[33] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造枫叶战斧 (钢铁3        双面斧        怪物结晶c3        朱矿石)
    ##########################################################################
    材料 = [50,66,3,207]             # 需要材料的数据库编号
    材料种类 = [0,0,2,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [3,1,1,3]         # 需要材料的数量
    成品 = 5                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[34] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造战神斧 (锂锭3        朱锭3        怪物结晶c5        合成费用500)
    ##########################################################################
    材料 = [46,44,207,78]             # 需要材料的数据库编号
    材料种类 = [0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [3,3,5,1]         # 需要材料的数量
    成品 = 6                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[35] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造碎石斧(铜矿石20        锂矿石1        斧头1        合成费用1000        怪物结晶c5)
    ##########################################################################
    材料 = [62,56,2,207,74]             # 需要材料的数据库编号
    材料种类 = [0,0,2,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [20,1,1,1,5]         # 需要材料的数量
    成品 = 7                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[36] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
    ##########################################################################
    # 打造黄金战斧 (黄金矿石20        黄金        战神斧1        合成费用1000        怪物结晶c5)
    ##########################################################################
    材料 = [54,45,6,207,74]             # 需要材料的数据库编号
    材料种类 = [0,0,2,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [20,1,1,1,5]         # 需要材料的数量
    成品 = 8                  # 获得物品编号
    成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
    @recipe_list[37] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   
   
   
   
   

   
  end # of get_recipe_list method
end # of updates to Game_Temp Class

#================================
# CRAFTING PROGRAM
#----------------------------------------------------------------
#-written by Deke
#-yes_no window code created by Phsylomortis
#----------------------------------------------------------------
#================================

#updates to Game_Party class

class Game_Party
  
  attr_accessor       :recipes
  
  alias crafting_party_initialize initialize
  
  def initialize
    crafting_party_initialize
    @recipes=[]
  end
  
  #----------------------------------------------------------------------
  def know?(recipe, version = 1)
    unless recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    return $game_party.recipes.include?(recipe)
  end
  
#----------------------------------------------------------------------
  def learn_recipe(recipe , version = 1)
    unless recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    if recipe.is_a?(Game_Recipe)
      unless know?(recipe)
        @recipes.push(recipe)
      end
    end
  end
  
#----------------------------------------------------------------------
  def forget_recipe(recipe , version = 1)
    if !recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    if recipe.is_a?(Game_Recipe)
      for i in [email protected]
        if recipe == @recipes
          index = i
          break
        end
      end
      if index != nil
        @recipes.delete(@recipes[index])
      end
    end
  end
  
#----------------------------------------------------------------------
  def get_recipe_from_master_list(item, version)
    index = nil
    for i in 0...$game_temp.recipe_list.size
      if item[0] == $game_temp.recipe_list.result and item[1] ==$game_temp.recipe_list.result_type
        version -= 1
        if version == 0
          index = i
          break
        end
      end
    end
    if index.is_a?(Integer)
      return ($game_temp.recipe_list[index])
    else
      return false
    end
  end
  
end # of Game_Party updates

#================================
class Game_Recipe

  attr_reader :ingredients
  attr_reader :quantities
  attr_reader :result
  attr_reader :result_type
  attr_reader :ingredient_types
  
#----------------------------------------------------------------------
  def initialize( ingredients, ingredient_types, quantities, result, result_type)
    @ingredients = ingredients
    @ingredient_types = ingredient_types
    @quantities = quantities
    @result = result
    @result_type = result_type
  end
  
#----------------------------------------------------------------------
  def name
    case @result_type
      when 0
        name = $data_items[@result].name
      when 1
        name = $data_armors[@result].name
      when 2
        name = $data_weapons[@result].name
    end
    return name
  end

#----------------------------------------------------------------------
  def have
    have_all = true
    for i in [email protected]
      case @ingredient_types
        when 0
          if $game_party.item_number(@ingredients) < @quantities
            have_all=false
          end
        when 1
          if $game_party.armor_number(@ingredients) < @quantities
            have_all=false
          end
        when 2
          if $game_party.weapon_number(@ingredients) < @quantities
            have_all=false
          end
      end
    end
    return have_all
  end

#----------------------------------------------------------------------
  def decrement
    for i in [email protected]
      case @ingredient_types
      when 0
        $game_party.lose_item(@ingredients, @quantities)
      when 1
        $game_party.lose_armor(@ingredients, @quantities)
      when 2
        $game_party.lose_weapon(@ingredients, @quantities)
      end
    end
  end

#----------------------------------------------------------------------
  def make
    if have
      case @result_type
      when 0
        $game_party.gain_item(@result, 1)
      when 1
        $game_party.gain_armor(@result, 1)
      when 2
        $game_party.gain_weapon(@result, 1)
      end
      decrement
    end
  end
  
#----------------------------------------------------------------------
  def == (recipe)
    if recipe.is_a?(Game_Recipe)
      equal = true
      if recipe.ingredients != self.ingredients
        equal = false
      end
      if recipe.ingredient_types != self.ingredient_types
        equal = false
      end
      if recipe.quantities != self.quantities
        equal = false
      end
      if recipe.result != self.result
        equal=false
      end
      if recipe.result_type != self.result_type
        equal = false
      end
    else
      equal = false
    end
    return equal
  end
  
end # of Game_Recipe class

#===================================

class Window_Craft < Window_Selectable

  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 240, 416)
    @column_max = 1
    refresh
    self.index = 0
  end

  #--------------------------------------------------------------------------
  def recipe
    return @data[self.index]
  end

  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.recipes.size
        @data.push($game_party.recipes)
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = "黑体" # = "黑体"
      self.contents.font.size = 18 # = 18
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  #--------------------------------------------------------------------------
  def draw_item(index)
    recipe = @data[index]
    self.contents.font.color = recipe.have ? normal_color : disabled_color
    x = 16
    y = index * 32
    self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  end

  #--------------------------------------------------------------------------
  def update_help
    current_recipe = recipe
    if current_recipe.is_a?(Game_Recipe)
    case current_recipe.result_type
      when 0
        description = $data_items[current_recipe.result].description
      when 1
        description = $data_armors[current_recipe.result].description
      when 2
        description = $data_weapons[current_recipe.result].description
      end
    else
      description = ""
    end
    @help_window.set_text(description)
    @help_window.update
  end
  
end # of Window_Craft

#=======================================
class Window_CraftResult < Window_Base

  #--------------------------------------------------------------------------
  def initialize
    super(240, 64, 400, 184)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
    self.contents.font.size = 18 # = 20
    @result = nil
    @type = nil
  end

  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @type
      when 0
        item = $data_items[@result]
        if item.recover_hp_rate > item.recover_hp
          hp_string = "稀有度"
          hp_stat = item.recover_hp_rate
        else
          hp_string = "神圣度"
          hp_stat = item.recover_hp
        end
        if item.recover_sp_rate > item.recover_sp
          sp_string = "能力值"
          sp_stat = item.recover_sp_rate
        else
          sp_string = "天赋值"
          sp_stat = item.recover_sp
        end
        @strings = [hp_string, sp_string, "成长力" , "战斗力", "智力", "体力"]
        @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
                       $game_party.item_number(@result)]
        @bitmap = RPG::Cache.icon(item.icon_name)
      when 1
        item = $data_armors[@result]
        @strings = ["Q", "W", "E", "R", "T",
                       "Y", "U"]
        @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
                    item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
        @bitmap = RPG::Cache.icon(item.icon_name)
      when 2
        item = $data_weapons[@result]
        @strings =["攻击力:", "物理防御:", "魔法防御:", "力量:", "灵巧:",
                    "速度:", "魔力:"]
        @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
                    item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
        @bitmap = RPG::Cache.icon(item.icon_name)
    end
    for i in [email protected]
      x = i%2 * 184
      y = i /2 *28 +32
      self.contents.font.color = normal_color
      self.contents.draw_text(x,y,100, 28,@strings)
      self.contents.font.color = system_color
      self.contents.draw_text(x + 110, y, 45, 28, @stats.to_s)
    end
    self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
    self.contents.font.color= normal_color
    self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
    self.contents.font.color = system_color
    count = @stats[@stats.size - 1].to_s
    self.contents.draw_text(294, 0, 45, 28, count )
  end
   
#----------------------------------------------------------------------
  def set_result(result , type)
    @result = result
    @type = type
    refresh
  end

end #of Window_CraftResult

#=======================================
class Window_CraftIngredients < Window_Base

  #--------------------------------------------------------------------------
  def initialize
    super(240, 248, 400, 232)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
    self.contents.font.size = 18 # = 20
    @ingredients = []
    @types = []
    @quantities = []
    @item = nil
    @count = 0
  end

  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in [email protected]
      case @types
      when 0
        @item = $data_items[@ingredients]
        @count = $game_party.item_number(@ingredients)
      when 1
        @item = $data_armors[@ingredients]
        @count = $game_party.armor_number(@ingredients)
      when 2
        @item = $data_weapons[@ingredients]
        @count = $game_party.weapon_number(@ingredients)
      end
      y = i *26
      self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
      self.contents.font.color = @count >= @quantities ? normal_color : disabled_color
      self.contents.draw_text(30, y, 280, 28, @item.name)
      self.contents.draw_text(300, y, 45, 28, @quantities.to_s)
      self.contents.font.color = system_color
      self.contents.draw_text(245, y, 45, 28, @count.to_s )     
    end
  end
      
  #--------------------------------------------------------------------------
  def set_ingredients(ingredients , types, quantities)
    @ingredients = ingredients
    @types = types
    @quantities = quantities
    refresh
  end

end # of Window_CraftIngredients

#======================================
class Scene_Craft

  #--------------------------------------------------------------------------
  def initialize(craft_index=0)
    @craft_index=craft_index
  end
  
  #--------------------------------------------------------------------------
  def main
    @craft_window = Window_Craft.new
    @craft_window.index=@craft_index
    @confirm_window = Window_Base.new(120, 188, 400, 64)
    @confirm_window.contents = Bitmap.new(368, 32)
    @confirm_window.contents.font.name = "黑体"
    @confirm_window.contents.font.size = 20
    @help_window = Window_Help.new
    @craft_window.help_window = @help_window
    @result_window=Window_CraftResult.new
    @ingredients_window=Window_CraftIngredients.new
    @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
    @confirm_window.visible = false
    @confirm_window.z = 1500
    @yes_no_window.visible = false
    @yes_no_window.active = false
    @yes_no_window.index = 1
    @yes_no_window.x = 270
    @yes_no_window.y = 252
    @yes_no_window.z = 1500
    @label_window = Window_Base.new(450,200,190,52)
    @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
    @label_window.contents.font.size=20
    @label_window.contents.font.color = @label_window.normal_color
    @label_window.contents.font.name = "黑体"
    @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @help_window.dispose
    @craft_window.dispose
    @result_window.dispose
    @ingredients_window.dispose
    @confirm_window.dispose
    @yes_no_window.dispose
    @label_window.dispose
  end

  #--------------------------------------------------------------------------
  def update
    @craft_window.update
    @ingredients_window.update
    if $game_party.recipes.size > 0
      @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
      @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
                                                           @craft_window.recipe.ingredient_types,
                                                           @craft_window.recipe.quantities)
    end
    if @craft_window.active
      update_craft
      return
    end
    if @yes_no_window.active
      confirm_update
      return
    end
  end

  #--------------------------------------------------------------------------
  def update_craft
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      # command_121 开关操作
      $game_switches[1] = false
      $game_map.need_refresh = true
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C) and $game_party.recipes.size != 0
      @recipe = @craft_window.recipe
      if @recipe.have
        @yes_no_window.active = true
        @craft_window.active = false
      else
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
  end

  #--------------------------------------------------------------------------
  def confirm_update
    @craft_index = @craft_window.index
    @confirm_window.visible = true
    @confirm_window.z = 1500
    @yes_no_window.visible = true
    @yes_no_window.active = true
    @yes_no_window.z = 1500
    @yes_no_window.update
    string = "合成 " + @recipe.name + "?"
    cw = @confirm_window.contents.text_size(string).width
    center = @confirm_window.contents.width/2 - cw /2
    unless @drawn
      @confirm_window.contents.draw_text(center, 0, cw, 30, string)
      @drawn = true
    end
    if Input.trigger?(Input::C)
      if @yes_no_window.index == 0
        $game_system.se_play($data_system.decision_se)
        @recipe.make
        $game_system.se_play($data_system.save_se)
        $scene=Scene_Craft.new(@craft_index)
      else
        $game_system.se_play($data_system.cancel_se)
        $scene=Scene_Craft.new(@craft_index)
      end
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene=Scene_Craft.new(@craft_index)
    end
  end

end # of Scene_Craft

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================



Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

2
发表于 2012-6-16 18:30:56 | 只看该作者
  1. $game_party.learn_recipe(
  2. $game_temp.recipe_list[2])
  3. #以上为学习2号配方

  4. $game_party.forget_recipe(
  5. $game_temp.recipe_list[2])
  6. #以上为遗忘2号配方
复制代码
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
85 小时
注册时间
2012-4-25
帖子
192
3
 楼主| 发表于 2012-6-16 18:53:59 | 只看该作者
chd114 发表于 2012-6-16 18:30

好快啊,我还以为我问题没写清楚呢,就来回答了。

谢谢 。
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

4
发表于 2012-6-16 18:59:37 | 只看该作者
woyaozhuce 发表于 2012-6-16 18:53
好快啊,我还以为我问题没写清楚呢,就来回答了。

谢谢 。

刚才看到你那个斧头合成的图很熟,能把工程发给我吗?
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
85 小时
注册时间
2012-4-25
帖子
192
5
 楼主| 发表于 2012-6-16 19:33:47 | 只看该作者
chd114 发表于 2012-6-16 18:59
刚才看到你那个斧头合成的图很熟,能把工程发给我吗?

这个是我正在做的游戏,工程180+MB。

有点大。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-31 01:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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