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

Project1

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

[已经过期] 属性镶嵌脚本和装备扩张脚本问题

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

跳转到指定楼层
1
发表于 2017-4-29 21:02:39 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
使用了属性镶嵌脚本和装备扩张脚本,但好像是因为经过镶嵌之后的装备因为没有重量属性而出错,请问这个要怎么改?


属性镶嵌脚本
RUBY 代码复制
  1. #
  2. # Mosaic System (Applicable with MOG_Monogatari by Moghunter)
  3. # 属性镶嵌系统
  4. # Esp 2016.04.16 by 影月千秋
  5. #
  6.  
  7. # Mosaic
  8. module Mosaic
  9.  
  10.   # 镶嵌场景中帮助窗口, 装备窗口, 宝石窗口, 提示窗口 的 [x, y, 宽, 高]
  11.   HelpWindow = [Graphics.width * 2 / 3, 0, Graphics.width / 3, Graphics.height]
  12.   EquipWindow = [0, 0, Graphics.width / 3, Graphics.height]
  13.   GemWindow = [Graphics.width / 3, 0, Graphics.width / 3, Graphics.height]
  14.   PromptWindow = [Graphics.width * 0.4, Graphics.height * 0.4,
  15.                   Graphics.width * 0.2, Graphics.height * 0.15]
  16.   # 镶嵌确认窗口的宽度
  17.   # 高度是自适应的
  18.   ConfirmWidth = 0.65 * Graphics.width
  19.   # 确认窗口的显示格式
  20.   # 用<equip>代替当前镶嵌装备 <gem>代表当前镶嵌宝石 <gold>当前持有金钱
  21.   # <cost>镶嵌费用
  22.   ConfirmFormat = %w!
  23.     <equip>
  24.     <gem>
  25.     持有金钱: <gold>
  26.     需要金钱: <cost>
  27.   !
  28.   # 确认窗口的两个按钮的名字
  29.   ConfirmText = "确认"
  30.   CancelText  = "取消"
  31.   # 提示窗口出现的时间
  32.   PromptCount = 60
  33.   # 镶嵌成功或者失败(金钱不足)时的提示文字
  34.   MosaicSucceed = "镶嵌成功"
  35.   MosaicFail = "金钱不足"
  36.  
  37.   # 致菜单脚本作者:
  38.   #   镶嵌装备的说明(description)是在 Mosaicked#description 里实现的
  39.   #   如果你打算拓展帮助 可以从这里入手
  40.  
  41.   # 镶嵌的宝石属性类型的最大数目
  42.   # 这个数目不包括装备掉落时随机生成的属性数目
  43.   MaxNewGemCount = 2
  44.  
  45.   # 用于在数据库备注匹配识别宝石id的正则式
  46.   # 在物品的备注栏加上 <gem XX> XX表示属性编号
  47.   #例如 <gem 0> 表示是HP的宝石 <gem 1> MP宝石 …………以此类推
  48.   GemTypeRegexp = /<gem (\d+)>/i   
  49.  
  50.   # NewParamChance: 掉落装备产生新属性的概率
  51.   # EquipColor: 拥有几种属性的装备的颜色 数字和显示文字里面的颜色id一样的意义
  52.   NewParamChance = [60, 55, 50, 45, 40, 30, 25]#掉落各个颜色装备的概率
  53.   EquipColor     = [0,1, 3,  2, 26, 27, 14, 18] # \c表示的颜色
  54.                 #0白色 #1蓝色 3绿色 2橙色 27粉红色 14金黄色 18深红色
  55.                 #掉落的装备会根据设置的几率出现下面的颜色,白板请无视
  56.   # 默认的参数值
  57.   DefaultParamValue = {
  58.     name: "NoName", # 名字
  59.     percentage: false, # 显示的时候是否要加一个百分号
  60.     state: -1, # 附加状态 -1表示无
  61.     party: -1,
  62.     # 团队能力 -1:无 0:遇敌减半 1:随机遇敌无效 2:敌人偷袭无效 3:先制攻击率上升
  63.     # 4:掉落金钱双倍 5:掉落物品双倍
  64.     increase_gold: false, # 是否导致金钱增加
  65.     increase_critical: false, # 是否导致暴击伤害加成率(对敌)
  66.     decrease_critical: false, # 是否导致暴击伤害减少率(对己)
  67.     more_params_rate: false, # 是否导致多属性出现几率加成
  68.     action_plus_set: false, # 是否导致行动次数增加几率加成
  69.     max_level: 10, # 该属性的最大等级
  70.     random_range: 1..3, # 掉落的时候 如果产生了该属性 属性的等级范围
  71.     range: 10..30, # 属性的值的范围
  72.     cost: [2000, 2500, 3500, 4500, 5500, 6500, 7500, 8500, 10000, 15000],
  73.     # 强化该属性耗费的基础金钱,实际金钱会加上装备的价格
  74.     equip: [], # 可以装备在哪些栏位 etype 0:武器 1:盾 2:头盔 3:盔甲 4:装饰品
  75.     weapon: nil, # 可以装备的武器类型 wtype
  76.     armor: nil # 可以装备的防具类型 atype
  77.   }
  78.  
  79.   #0:武器 1:盾 2:头盔 3:盔甲 4:装饰品
  80.   #左边装备类型,右边则是属性编号,属性编号不必全部都填,可选择性地填
  81.   EType = {
  82.     0 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  83.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  84.           38, 39, 40,41],
  85.     1 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  86.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  87.           38, 39, 40,41],
  88.     2 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  89.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  90.           38, 39, 40,41],
  91.     3 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  92.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  93.           38, 39, 40,41],
  94.     4 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  95.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  96.           38, 39, 40,41]
  97.   }
  98.  
  99.   WType = {}
  100.  
  101.   AType = {}
  102.  
  103.   # 在这里设置具体的属性和参数
  104.   # 未设置的参数会自动应用默认值的
  105.   Params = []
  106.   # 40号之前的属性都对应了特定含义
  107.   # 0:hp上限 1:mp上限 2:攻击 3:防御 4:魔攻 5:魔防 6:敏捷 7:幸运
  108.   # 名字会从数据库里读取
  109.   Params[0] = {     #HP上限
  110.     range: 10..30   #增加量随机10-30点(可随意设置,如需固定增加量则range: 10..10)
  111.   }
  112.  
  113.   Params[1] = {     #MP上限
  114.     range: 10..30   #增加量随机10-30点
  115.   }
  116.  
  117.   Params[2] = {     #物理攻击力
  118.     range: 10..30   #增加量随机10-30点
  119.   }
  120.  
  121.   Params[3] = {     #物理防御力
  122.     range: 10..30   #增加量随机10-30点
  123.   }
  124.  
  125.   Params[4] = {     #魔法攻击力
  126.     range: 10..30   #增加量随机10-30点
  127.   }
  128.  
  129.   Params[5] = {     #魔法防御力
  130.     range: 10..30   #增加量随机10-30点
  131.   }
  132.  
  133.   Params[6] = {     #敏捷
  134.     range: 10..30   #增加量随机10-30点
  135.   }
  136.  
  137.   Params[7] = {     #幸运
  138.     range: 10..30   #增加量随机10-30点
  139.   }
  140.  
  141.  
  142.  
  143.  
  144.   # (按百分比) 10:hp上限 11:mp上限 12:攻击 13:防御 14:魔攻 15:魔防 16:敏捷 17:幸运
  145.   # 名字会从数据库里读取
  146.   Params[10] = {           #HP上限百分比
  147.     percentage: true,      #添加百分号
  148.     range: 1..5            #随机1%-5%
  149.   }
  150.  
  151.   Params[11] = {           #MP上限百分比
  152.     percentage: true,      #添加百分号
  153.     range: 1..5            #随机1%-5%
  154.   }
  155.  
  156.   Params[12] = {           #攻击力百分比
  157.     percentage: true,      #添加百分号
  158.     range: 1..5            #随机1%-5%
  159.   }
  160.  
  161.   Params[13] = {           #防御力百分比
  162.     percentage: true,      #添加百分号
  163.     range: 1..5            #随机1%-5%
  164.   }
  165.  
  166.   Params[14] = {           #魔法攻击力百分比
  167.     percentage: true,      #添加百分号
  168.     range: 1..5            #随机1%-5%
  169.   }
  170.  
  171.   Params[15] = {           #魔法防御力百分比
  172.     percentage: true,      #添加百分号
  173.     range: 1..5            #随机1%-5%
  174.   }
  175.  
  176.   Params[16] = {           #敏捷百分比
  177.     percentage: true,      #添加百分号
  178.     range: 1..5            #随机1%-5%
  179.   }
  180.  
  181.   Params[17] = {           #幸运百分比
  182.     percentage: true,      #添加百分号
  183.     range: 1..5            #随机1%-5%
  184.   }
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.   # 20:物理命中率 21:物理回避率 22:暴击率 23:暴击闪避率 24:魔法闪避率 25:魔法反射率 26:物理反击率 27:生命回复 28:魔法回复 29:TP回复
  192.   Params[20] = {  
  193.     name: "物理命中率",     #属性名称:物理命中率,随意改名字
  194.     percentage: true,       #添加百分号
  195.     range: 1..5             #随机1%-5%
  196.   }
  197.  
  198.   Params[21] = {           
  199.     name: "物理回避率",     #物理回避率
  200.     percentage: true,      #添加百分号
  201.     range: 1..5            #随机1%-5%
  202.   }
  203.  
  204.   Params[22] = {      
  205.     name: "暴击几率",       #暴击几率
  206.     percentage: true,      #添加百分号
  207.     range: 1..5            #随机1%-5%
  208.   }
  209.  
  210.   Params[23] = {   
  211.     name: "暴击闪避率",     #暴击闪避率
  212.     percentage: true,      #添加百分号
  213.     range: 1..5            #随机1%-5%
  214.   }
  215.  
  216.   Params[24] = {   
  217.     name: "魔法闪避率",     #魔法闪避率
  218.     percentage: true,      #添加百分号
  219.     range: 1..5            #随机1%-5%
  220.   }
  221.  
  222.   Params[25] = {   
  223.     name: "魔法反射率",     #魔法反射率
  224.     percentage: true,      #添加百分号
  225.     range: 1..5            #随机1%-5%
  226.   }
  227.  
  228.   Params[26] = {   
  229.     name: "物理反射率",     #物理反射率
  230.     percentage: true,      #添加百分号
  231.     range: 1..5            #随机1%-5%
  232.   }
  233.  
  234.   Params[27] = {   
  235.     name: "体力再生",       #HP再生
  236.     percentage: true,      #添加百分号
  237.     range: 1..5            #随机1%-5%
  238.   }
  239.  
  240.   Params[28] = {   
  241.     name: "魔力再生",      #MP再生
  242.     percentage: true,      #添加百分号
  243.     range: 1..5            #随机1%-5%
  244.   }
  245.  
  246.   Params[29] = {   
  247.     name: "TP再生",        #TP再生
  248.     percentage: true,      #添加百分号
  249.     range: 1..5            #随机1%-5%
  250.   }
  251.  
  252.  
  253.  
  254.   # 30:受到攻击的几率 31:防御效果 32:恢复效果 33:药理知识 34:魔法消耗 35:TP增长 36:物理伤害加成 37:魔法伤害加成 38:地形伤害加成 39:经验获得
  255.   Params[30] = {
  256.     name: "受到攻击几率",   #吸引仇恨………………
  257.     percentage: true,      #添加百分号
  258.     range: 1..5            #随机1%-5%
  259.   }
  260.  
  261.   Params[31] = {   
  262.     name: "防御效果",       #这些都是VA默认下有的东西,具体请看 Game_BattlerBase
  263.     percentage: true,      #添加百分号
  264.     range: 1..5            #随机1%-5%
  265.   }
  266.  
  267.   Params[32] = {   
  268.     name: "恢复效果",       #恢复效果
  269.     percentage: true,      #添加百分号
  270.     range: 1..5            #随机1%-5%
  271.   }
  272.  
  273.   Params[33] = {   
  274.     name: "药理知识",       #药理知识
  275.     percentage: true,      #添加百分号
  276.     range: 1..5            #随机1%-5%
  277.   }
  278.  
  279.   Params[34] = {   
  280.     name: "魔法消耗",       #魔法消耗
  281.     percentage: true,      #添加百分号
  282.     range: 1..5            #随机1%-5%
  283.   }
  284.  
  285.   Params[35] = {   
  286.     name: "TP增长",        #TP增长
  287.     percentage: true,      #添加百分号
  288.     range: 1..5            #随机1%-5%
  289.   }
  290.  
  291.   Params[36] = {   
  292.     name: "物理伤害加成",   #物理伤害加成
  293.     percentage: true,      #添加百分号
  294.     range: 1..5            #随机1%-5%
  295.   }
  296.  
  297.   Params[37] = {   
  298.     name: "魔法伤害加成",   #魔法伤害加成
  299.     percentage: true,      #添加百分号
  300.     range: 1..5            #随机1%-5%
  301.   }
  302.  
  303.   Params[38] = {   
  304.     name: "地形伤害加成",   #地形伤害加成
  305.     percentage: true,      #添加百分号
  306.     range: 1..5            #随机1%-5%
  307.   }
  308.  
  309.   Params[39] = {   
  310.     name: "经验获得加成",   #经验获得加成
  311.     percentage: true,      #添加百分号
  312.     range: 1..5            #随机1%-5%
  313.   }
  314.   #新添加属性
  315.   # 40及以后的属性可以随意设置
  316.   Params[40] = {      
  317.     name: "金钱增加",     #属性名称
  318.     percentage: true,     #添加百分号
  319.     increase_gold: true,  #金钱增加开启
  320.     range: 1..5           #随机1%-5%
  321.   }
  322.  
  323.   Params[41] = {
  324.     name: "再次行动几率",    #属性名称
  325.     percentage: true,       #添加百分号
  326.     action_plus_set: true,  #增加行动次数开启(不是攻击次数,别搞混了)
  327.     range: 1..5             #随机1%-5%
  328.   }
  329.  
  330.   #Params[40] = {
  331.     #name: "掉落物品双倍",
  332.     #party: 5,
  333.     #max_level: 1
  334.   #}
  335.  
  336.   #Params[41] = {
  337.     #name: "攻击附加状态",
  338.     #percentage: true,  
  339.     #state: 6,    #数据库状态编号
  340.     #range: 5..7
  341.   #}
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.   EType.each do |k, v|
  352.     v.each do |i|
  353.       next unless Params[i]
  354.       Params[i][:equip] ||= []
  355.       Params[i][:equip].push k
  356.     end
  357.   end
  358.   WType.each do |k, v|
  359.     v.each do |i|
  360.       next unless Params[i]
  361.       Params[i][:weapon] ||= []
  362.       Params[i][:weapon].push k
  363.     end
  364.   end
  365.   AType.each do |k, v|
  366.     v.each do |i|
  367.       next unless Params[i]
  368.       Params[i][:armor] ||= []
  369.       Params[i][:armor].push k
  370.     end
  371.   end
  372.   Params.compact.each do |h| DefaultParamValue.each do |k, v| h[k] ||= v end end
  373. end
  374.  
  375. # Mosaic Gem
  376. module MosaicGem
  377.  
  378.   # gem type
  379.   def gem_type
  380.     @gem_type ||= begin
  381.       Mosaic::GemTypeRegexp.match @note
  382.       $1 ? $1.to_i : -1
  383.     end
  384.   end
  385. end
  386.  
  387. RPG::Item.send :include, MosaicGem
  388.  
  389. # Mosaicked
  390. module Mosaicked
  391.  
  392.   # readers
  393.   def data_id
  394.     @data_id ||= @id
  395.   end
  396.   def generated_gems
  397.     @generated_gems ||= {}
  398.   end
  399.   def mosaicked_gems
  400.     @mosaicked_gems ||= {}
  401.   end
  402.   def mosaic_effects
  403.     @mosaic_effects ||= {}
  404.   end
  405.  
  406.   # get gems
  407.   def gems
  408.     r = Marshal.load Marshal.dump generated_gems
  409.     mosaicked_gems.each do |k, v| r[k] = v end
  410.     r
  411.   end
  412.  
  413.   # mosaic
  414.   def mosaic gem
  415.     if generated_gems[gem.gem_type]
  416.       generated_gems[gem.gem_type] += 1
  417.     else
  418.       mosaicked_gems[gem.gem_type] ||= 0
  419.       mosaicked_gems[gem.gem_type] += 1
  420.     end
  421.     apply_mosaicked_params gem.gem_type
  422.     @id = $game_system.new_mosaic_item_id self
  423.   end
  424.  
  425.   # can mosaic?
  426.   def can_mosaic? item
  427.     return if item.gem_type < 0
  428.     type = item.gem_type; params = Mosaic::Params[type]
  429.     return unless params
  430.     return unless gems[type] ? gems[type] < params[:max_level] :
  431.       mosaicked_gems.size < Mosaic::MaxNewGemCount
  432.     case self
  433.     when RPG::Weapon
  434.       params[:weapon] ? params[:weapon].include?(wtype_id) :
  435.         params[:equip].include?(etype_id)
  436.     when RPG::Armor
  437.       params[:armor] ? params[:armor].include?(atype_id) :
  438.         params[:equip].include?(etype_id)
  439.     else
  440.       params[:equip].include? etype_id
  441.     end
  442.   end
  443.  
  444.   # mosaic cost
  445.   def mosaic_cost gem
  446.     Mosaic::Params[gem.gem_type][:cost][gems[gem.gem_type] || 0] + price
  447.   end
  448.  
  449.   # mosaic base equal?
  450.   def mosaic_base_equal? rhs
  451.     self.class == rhs.class && self.data_id == rhs.data_id
  452.   end
  453.  
  454.   # apply mosaicked params
  455.   def apply_mosaicked_params type
  456.     mosaic_effects[type] ||= 0
  457.     mosaic_effects[type] += Mosaic::Params[type][:range].to_a.sample
  458.   end
  459.  
  460.   # allowed params
  461.   def allowed_params
  462.     Mosaic::Params.each_with_index.map do |k, i|
  463.       next unless k
  464.       ((is_a?(RPG::Weapon) && k[:weapon] && k[:weapon].include?(wtype_id)) ||
  465.       (is_a?(RPG::Armor) && k[:armor] && k[:armor].include?(atype_id)) ||
  466.       k[:equip].include?(etype_id)) ? i : nil
  467.     end.compact
  468.   end
  469.  
  470.   # mosaic random generate
  471.   def mosaic_random_generate
  472.     item = Marshal.load Marshal.dump self
  473.     item.instance_exec do
  474.       while (t = Mosaic::NewParamChance[generated_gems.size] +
  475.         $game_party.all_members.flat_map(&:equips).compact.inject(0){|r, item|
  476.         item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][
  477.         :more_params_rate] ? v : 0) }}) && rand < t / 100.0
  478.         param = allowed_params.sample
  479.         break unless param
  480.         level = Mosaic::Params[param][:random_range].to_a.sample
  481.         generated_gems[param] = level
  482.         level.times{ apply_mosaicked_params param }
  483.       end
  484.       self.id = $game_system.new_mosaic_item_id(self) if generated_gems.size > 0
  485.     end
  486.     item
  487.   end
  488.  
  489.   # quality
  490.   def quality
  491.     generated_gems.size
  492.   end
  493.  
  494.   # description
  495.   def description
  496.     super + "\n" + gems.map do |gid, level|
  497.       "Lv.#{level} #{Mosaic::Params[gid][:name]}+#{mosaic_effects[gid]}#{
  498.       Mosaic::Params[gid][:percentage] ? '%' : nil}"
  499.     end.join("\n")
  500.   end
  501. end
  502.  
  503. RPG::EquipItem.send :include, Mosaicked
  504.  
  505. # Data Manager
  506. class << DataManager
  507.  
  508.   # init
  509.   alias mosaic_system_init init
  510.   def init
  511.     mosaic_system_init
  512.     (0..7).each{|i| Mosaic::Params[i][:name] = Vocab.param(i)}
  513.     (10..17).each{|i| Mosaic::Params[i][:name] = Vocab.param(i - 10)}
  514.   end
  515. end
  516.  
  517. # Battle Manager
  518. class << BattleManager
  519.  
  520.   # gain drop items
  521.   def gain_drop_items
  522.     $game_troop.make_drop_items.each do |item|
  523.       item = item.mosaic_random_generate
  524.       $game_party.gain_item(item, 1)
  525.       $game_message.add(sprintf("\\C[#{Mosaic::EquipColor[item.quality]}]"+
  526.       #Vocab::ObtainItem+"\\C[0]", item.name))
  527.        Vocab::ObtainItem, item.name))
  528.     end
  529.     wait_for_message
  530.   end
  531. end
  532.  
  533. # Game System
  534. class Game_System
  535.  
  536.   # initialize
  537.   alias mosaic_system_initialize initialize
  538.   def initialize
  539.     mosaic_system_initialize
  540.     @mosaicked_items = []
  541.   end
  542.  
  543.   # reader
  544.   def mosaicked_items id
  545.     @mosaicked_items[id - $data_weapons.size - $data_armors.size]
  546.   end
  547.  
  548.   # new mosaic item id
  549.   def new_mosaic_item_id item
  550.     id = $data_weapons.size + $data_armors.size + @mosaicked_items.size
  551.     item = Marshal.load Marshal.dump item
  552.     item.id = id
  553.     @mosaicked_items.push item
  554.     id
  555.   end
  556. end
  557.  
  558. # Game BaseItem
  559. class Game_BaseItem
  560.  
  561.   # object
  562.   def object
  563.     return $data_skills[@item_id]  if is_skill?
  564.     return $data_items[@item_id]   if is_item?
  565.     return $data_weapons[@item_id] || $game_system.mosaicked_items(@item_id) if
  566.     is_weapon?
  567.     return $data_armors[@item_id]  || $game_system.mosaicked_items(@item_id) if
  568.     is_armor?
  569.     return nil
  570.   end
  571. end
  572.  
  573. # Game Actor
  574. class Game_Actor
  575.  
  576.   # param plus
  577.   alias mosaic_system_param_plus param_plus
  578.   def param_plus param_id
  579.     equips.compact.inject(mosaic_system_param_plus param_id){|r, item| r +
  580.     (item.mosaic_effects[param_id] || 0) }
  581.   end
  582.  
  583.   # param rate
  584.   def param_rate param_id
  585.     equips.compact.inject(super){|r, item| r + (item.mosaic_effects[param_id +
  586.     10] || 0) / 100.0 }
  587.   end
  588.  
  589.   # xparam
  590.   def xparam xparam_id
  591.     equips.compact.inject(super){|r, item| r + (item.mosaic_effects[xparam_id +
  592.     20] || 0) / 100.0 }
  593.   end
  594.  
  595.   # sparam
  596.   def sparam sparam_id
  597.     [0, equips.compact.inject(super){|r, item| r + (item.mosaic_effects[
  598.     sparam_id + 30] || 0) / 100.0 }].max
  599.   end
  600.  
  601.   # party ability
  602.   def party_ability ability_id
  603.     super || equips.compact.any?{|item| item.gems.keys.any?{|k| Mosaic::Params[
  604.     k][:party] == ability_id }}
  605.   end
  606.  
  607.   # atk states
  608.   def atk_states
  609.     a = equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k|
  610.     s << Mosaic::Params[k][:state] }}
  611.     a.delete(-1)
  612.     a.uniq
  613.   end
  614.  
  615.   # atk states rate
  616.   def atk_states_rate state_id
  617.     equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k| s +
  618.     (Mosaic::Params[k][:state] == state_id ? item.mosaic_effects[k] : 0)/100.0}}
  619.   end
  620.  
  621.   # apply critical
  622.   def apply_critical value
  623.     super * (100 - equips.compact.inject(0){|r, item|
  624.     item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][
  625.     :decrease_critical] ? v : 0) }}) / 100.0
  626.   end
  627.  
  628.   # action plus set
  629.   def action_plus_set
  630.     equips.compact.inject(super){|r, item| item.mosaic_effects.inject(r){
  631.     |s, (k, v)| s + (Mosaic::Params[k][:action_plus_set] ? (v / 100.0) : 0) }}
  632.   end
  633. end
  634.  
  635. # Game Enemy
  636. class Game_Enemy
  637.  
  638.   # apply critical
  639.   def apply_critical value
  640.     super * (100 + $game_party.battle_members.flat_map(&:equips).compact.inject(
  641.     0){|r, item| item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[
  642.     k][:increase_critical] ? v : 0) }}) / 100.0
  643.   end
  644. end
  645.  
  646. # Game Party
  647. class Game_Party
  648.  
  649.   # weapons
  650.   def weapons
  651.     @weapons.keys.sort.collect{|id| $data_weapons[id] ||
  652.     $game_system.mosaicked_items(id) }
  653.   end
  654.  
  655.   # armors
  656.   def armors
  657.     @armors.keys.sort.collect{|id| $data_armors[id] ||
  658.     $game_system.mosaicked_items(id) }
  659.   end
  660. end
  661.  
  662. # Game Troop
  663. class Game_Troop
  664.  
  665.   # gold rate
  666.   alias mosaic_system_gold_rate gold_rate
  667.   def gold_rate
  668.     rate = $game_party.members.inject(0) do |r, x|
  669.       r + x.equips.compact.inject(0) do |s, y|
  670.         s + y.mosaic_effects.inject(0) do |t, (k, v)|
  671.           t + (Mosaic::Params[k][:increase_gold] ? v : 0)
  672.         end
  673.       end
  674.     end
  675.     mosaic_system_gold_rate * (1 + rate)
  676.   end
  677. end
  678.  
  679. # Window Base
  680. class Window_Base
  681.  
  682.   # draw item name
  683.   def draw_item_name item, x, y, enabled = true, width = 172
  684.     return unless item
  685.     draw_icon item.icon_index, x, y, enabled
  686.     color = item.is_a?(Mosaicked) ? text_color(Mosaic::EquipColor[item.quality])
  687.     : normal_color
  688.     change_color color, enabled
  689.     draw_text x + 24, y, width, line_height, item.name
  690.   end
  691. end
  692.  
  693. # Mosaic Help Window
  694. class Window_MosaicHelp < Window_Base
  695.  
  696.   # initialize
  697.   def initialize x, y, width, height
  698.     super
  699.     @text = ""
  700.   end
  701.  
  702.   # set text
  703.   def set_text text
  704.     return if @text == text
  705.     @text = text
  706.     refresh
  707.   end
  708.  
  709.   # set item
  710.   def set_item item
  711.     set_text item ? item.description : ""
  712.   end
  713.  
  714.   # clear
  715.   def clear
  716.     set_text ""
  717.   end
  718.  
  719.   # refresh
  720.   def refresh
  721.     contents.clear
  722.     draw_text_ex 4, 0, @text
  723.   end
  724.  
  725.   # process character
  726.   def process_character c, text, pos
  727.     case c
  728.     when "\n"
  729.       process_new_line text, pos
  730.     when "\f"
  731.       process_new_page text, pos
  732.     when "\e"
  733.       if text[0] == 'n'
  734.         text.slice! 0, 1
  735.         process_new_line text, pos
  736.       else
  737.         process_escape_character obtain_escape_code(text), text, pos
  738.       end
  739.     else
  740.       process_normal_character c, pos
  741.     end
  742.   end
  743. end
  744.  
  745. # Mosaic Confirm Window
  746. class Window_MosaicConfirm < Window_Command
  747.  
  748.   # initialize
  749.   def initialize
  750.     super (Graphics.width - window_width) / 2,
  751.     (Graphics.height - window_height) / 2
  752.     deactivate
  753.     hide
  754.     close
  755.   end
  756.  
  757.   # window width
  758.   def window_width
  759.     Mosaic::ConfirmWidth
  760.   end
  761.  
  762.   # visible line number
  763.   def visible_line_number
  764.     Mosaic::ConfirmFormat.size + 1
  765.   end
  766.  
  767.   # set item
  768.   def set_item equip, g
  769.     text = Mosaic::ConfirmFormat.join(?\n)
  770.     text.gsub! '<equip>', "\\I[#{equip.icon_index}] #{equip.name}"
  771.     text.gsub! '<gem>', "\\I[#{g.icon_index}] #{g.name}"
  772.     text.gsub! '<gold>', "#{$game_party.gold}\\G"
  773.     text.gsub! '<cost>', "#{equip.mosaic_cost(g)}\\G"
  774.     refresh
  775.     draw_text_ex 4, 0, text
  776.   end
  777.  
  778.   # make command list
  779.   def make_command_list
  780.     add_command Mosaic::ConfirmText, :confirm
  781.     add_command Mosaic::CancelText,  :cancel
  782.   end
  783.  
  784.   # col max
  785.   def col_max
  786.     2
  787.   end
  788.  
  789.   # item width
  790.   def item_width
  791.     contents_width / 2 - standard_padding * 2
  792.   end
  793.  
  794.   # item_rect
  795.   alias mosaic_system_item_rect item_rect
  796.   def item_rect index
  797.     rect = mosaic_system_item_rect index
  798.     rect.y += Mosaic::ConfirmFormat.size * line_height
  799.     rect
  800.   end
  801. end
  802.  
  803. # Mosaic Gem List Window
  804. class Window_MosaicGemList < Window_ItemList
  805.  
  806.   # initialize
  807.   def initialze x, y, width, height
  808.     super
  809.     deactivate
  810.     [url=home.php?mod=space&uid=457221]@Filter[/url] = ->(*){}
  811.   end
  812.  
  813.   # filter
  814.   def filter filter
  815.     @filter = filter
  816.   end
  817.  
  818.   # include?
  819.   def include? item
  820.     item.is_a?(RPG::Item) && @filter[item]
  821.   end
  822.  
  823.   # col max
  824.   def col_max
  825.     1
  826.   end
  827.  
  828.   # enable?
  829.   def enable? item
  830.     !@data.empty?
  831.   end
  832.  
  833.   # activate
  834.   def activate
  835.     super
  836.     self.index = @data.size - 1 if @index > @data.size - 1
  837.   end
  838. end
  839.  
  840. # Mosaic Equip List Window
  841. class Window_MosaicEquipList < Window_ItemList
  842.  
  843.   attr_accessor :gem_window
  844.  
  845.   # update cursor
  846.   def update_cursor
  847.     super
  848.     call_update_gem_window
  849.   end
  850.  
  851.   # call update gem window
  852.   def call_update_gem_window
  853.     update_gem_window if active && @gem_window
  854.   end
  855.  
  856.   # update gem window
  857.   def update_gem_window
  858.     @gem_window.filter(item ? item.method(:can_mosaic?) : ->(*){})
  859.     @gem_window.refresh
  860.   end
  861.  
  862.   # refresh
  863.   def refresh
  864.     super
  865.     call_update_gem_window
  866.     call_update_help
  867.   end
  868.  
  869.   # include?
  870.   def include? item
  871.     item.is_a?(Mosaicked) && enable?(item)
  872.   end
  873.  
  874.   # col max
  875.   def col_max
  876.     1
  877.   end
  878.  
  879.   # enable?
  880.   def enable? item
  881.     item && $game_party.all_items.any?{|i| i.is_a?(RPG::Item) &&
  882.     item.can_mosaic?(i) }
  883.   end
  884. end
  885.  
  886. # Mosaic Prompt Window
  887. class Window_MosaicPrompt < Window_Base
  888.  
  889.   # initialize
  890.   def initialize x, y, width, height
  891.     super
  892.     hide
  893.     close
  894.   end
  895.  
  896.   # prompt
  897.   def prompt text
  898.     show
  899.     open
  900.     @count = 0
  901.     draw_text_ex 4, 0, text
  902.   end
  903.  
  904.   # update
  905.   def update
  906.     super
  907.     if open?
  908.       @count += 1
  909.       close if @count > Mosaic::PromptCount
  910.     end
  911.   end
  912. end
  913.  
  914. # Mosaic Scene
  915. class Scene_Mosaic < Scene_Base
  916.  
  917.   # initialize
  918.   def initialize
  919.     super
  920.     create_background
  921.     create_all_windows
  922.   end
  923.  
  924.   # create all windows
  925.   def create_all_windows
  926.     create_equip_window
  927.     create_gem_window
  928.     create_help_window
  929.     create_confirm_window
  930.     create_prompt_window
  931.     setup_all_windows
  932.   end
  933.  
  934.   # create equip window
  935.   def create_equip_window
  936.     @equip_window = Window_MosaicEquipList.new *Mosaic::EquipWindow
  937.   end
  938.  
  939.   # create gem window
  940.   def create_gem_window
  941.     @gem_window = Window_MosaicGemList.new *Mosaic::GemWindow
  942.     @equip_window.gem_window = @gem_window
  943.   end
  944.  
  945.   # create help window
  946.   def create_help_window
  947.     @help_window = Window_MosaicHelp.new *Mosaic::HelpWindow
  948.     @equip_window.help_window = @help_window
  949.     @gem_window.help_window = @help_window
  950.   end
  951.  
  952.   # create confirm window
  953.   def create_confirm_window
  954.     @confirm_window = Window_MosaicConfirm.new
  955.   end
  956.  
  957.   # create prompt window
  958.   def create_prompt_window
  959.     @prompt_window = Window_MosaicPrompt.new *Mosaic::PromptWindow
  960.   end
  961.  
  962.   # setup all windows
  963.   def setup_all_windows
  964.     @equip_window.set_handler(:ok,     method(:on_equip_ok))
  965.     @equip_window.set_handler(:cancel, method(:return_scene))
  966.     @gem_window.set_handler(:ok,     method(:on_gem_ok))
  967.     @gem_window.set_handler(:cancel, method(:on_gem_cancel))
  968.     @confirm_window.set_handler(:confirm, method(:on_confirm_ok))
  969.     @confirm_window.set_handler(:cancel, method(:on_confirm_cancel))
  970.     @equip_window.refresh
  971.     @equip_window.activate
  972.     @equip_window.select 0
  973.     @gem_window.select 0
  974.   end
  975.  
  976.   # on equip ok
  977.   def on_equip_ok
  978.     @equip_window.deactivate
  979.     @gem_window.activate
  980.   end
  981.  
  982.   # on gem ok
  983.   def on_gem_ok
  984.     @confirm_window.set_item @equip_window.item, @gem_window.item
  985.     @confirm_window.show
  986.     @confirm_window.open
  987.     @gem_window.deactivate
  988.     @confirm_window.activate
  989.   end
  990.  
  991.   # on gem cancel
  992.   def on_gem_cancel
  993.     @gem_window.deactivate
  994.     @equip_window.activate
  995.   end
  996.  
  997.   # on confirm ok
  998.   def on_confirm_ok
  999.     equip = @equip_window.item
  1000.     gem = @gem_window.item
  1001.     if $game_party.gold >= equip.mosaic_cost(gem)
  1002.       $game_party.lose_gold equip.mosaic_cost(gem)
  1003.       $game_party.lose_item equip, 1
  1004.       $game_party.lose_item gem, 1
  1005.       equip = Marshal.load Marshal.dump equip
  1006.       equip.mosaic gem
  1007.       $game_party.gain_item equip, 1
  1008.       @prompt_window.prompt Mosaic::MosaicSucceed
  1009.       @equip_window.activate
  1010.       @equip_window.refresh
  1011.       @confirm_window.close
  1012.     else
  1013.       @prompt_window.prompt Mosaic::MosaicFail
  1014.       @confirm_window.activate
  1015.     end
  1016.   end
  1017.  
  1018.   # on confirm cancel
  1019.   def on_confirm_cancel
  1020.     @confirm_window.deactivate
  1021.     @confirm_window.close
  1022.     @gem_window.activate
  1023.   end
  1024.  
  1025.   # create background
  1026.   def create_background
  1027.     @background_sprite = Sprite.new
  1028.     @background_sprite.bitmap = SceneManager.background_bitmap
  1029.     @background_sprite.color.set 16, 16, 16, 128
  1030.   end
  1031.  
  1032.   # terminate
  1033.   def terminate
  1034.     dispose_background
  1035.     super
  1036.   end
  1037.  
  1038.   # dispose background
  1039.   def dispose_background
  1040.     @background_sprite.dispose
  1041.   end
  1042. end



装备扩张脚本问题
RUBY 代码复制
  1. #==============================================================================
  2. #  ■装備拡張 for RGSS3 Ver1.10
  3. # □author kure
  4. #
  5. # 呼び出し方法  SceneManager.call(Scene_Equip)
  6. #==============================================================================
  7. module KURE
  8.   module ExEquip
  9.   #画面の表示設定
  10.   #装備品のステータス補正表示(0=表示しない 1=表示する)
  11.   VIEW_EQUIP_STATUS = 1
  12.  
  13.   #装備スロット欄の表示設定----------------------------------------------------
  14.   #装備スロット表示名を設定(EQUIP_SLOT_NAME = [スロット5表示名,…]
  15.   EQUIP_SLOT_NAME = ["黑魔法书","白魔法书","坐骑",]
  16.  
  17.   #装備スロットを設定
  18.   #通常のスロット
  19.   EQUIP_SLOT = [0,1,2,3,4,7,5,6]
  20.   #二刀流のスロット
  21.   EQUIP_SLOT_DUAL = [0,0,2,3,4,7,5,6]
  22.  
  23.   #ステータス欄の表示設定-------------------------------------------------------
  24.   #ステータス変化に表示する文字列
  25.   #Vocab_Ex1 = [命中率,回避率,会心率]
  26.   Vocab_Ex1 = ["命中率","回避率","会心率"]
  27.  
  28.   #装備重量システム-------------------------------------------------------------
  29.   #装備重量システムを利用する(0=利用しない 1=利用する)
  30.   USE_WEIGHT_SYSTEM = 1
  31.  
  32.   #最大装備重量設定------------------------------------------------------------
  33.   #基礎最大重量(全てのアクターが最低限もてる重量を設定します)
  34.   MAX_WEIGHT_BASE = 50
  35.   #レベル補正(レベルが上がるごとに増える最大重量を設定します)
  36.   MAX_WEIGHT_Lv = 2
  37.  
  38.   #アクター毎、装備重量補正
  39.   #MAX_WEIGHT_ACTOR = [アクターID1,アクターID2,アクターID3,…]
  40.   #MAX_WEIGHT_ACTOR = [20,20,20,20,20,20,20,20,20,20]
  41.    MAX_WEIGHT_ACTOR = [0]
  42.   #職業ごとの装備重量補正
  43.   #MAX_WEIGHT_JOB = [職業ID1,職業ID2,職業ID3,…]
  44.   #MAX_WEIGHT_JOB = [10,10,10,10,10,10,10,10,10,10]
  45.   MAX_WEIGHT_JOB = [0]
  46.   #スキル補正
  47.   #MAX_WEIGHT_SKILL = [[スキルID,重量補正],[スキルID,重量補正],…]
  48.   #MAX_WEIGHT_SKILL = [[1,10],[3,5],[84,100]]
  49.   MAX_WEIGHT_SKILL = [[1,0],[3,0],[84,0]]
  50.   #装備重量の名称
  51.   WEIGHT_NAME = "重量"
  52.  
  53.   #重量0のアイテムの重量表示(0=表示する 1=表示しない)
  54.   WEIGHT_0_ITEM = 1
  55.  
  56.   end
  57. end
  58.  
  59. #==============================================================================
  60. # ■ RPG::BaseItem
  61. #==============================================================================
  62. class RPG::BaseItem
  63.   #--------------------------------------------------------------------------
  64.   # ● 装備重量の定義(追加定義)
  65.   #--------------------------------------------------------------------------  
  66.   def weight
  67.     cheack_note = @note
  68.     cheack_note.match(/^<装備重量\s?(\d+)>/)
  69.     if $1 == nil
  70.       return 0   
  71.     else
  72.       return type = $1.to_i
  73.     end   
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 装備重量の定義(追加定義)
  77.   #--------------------------------------------------------------------------  
  78.   def gain_weight  
  79.     cheack_note = @note
  80.     cheack_note.match(/^<最大重量増加\s?(\d+)>/)
  81.     if $1 == nil
  82.       return 0   
  83.     else
  84.       return type = $1.to_i
  85.     end  
  86.   end
  87. end
  88.  
  89. #==============================================================================
  90. # ■ RPG::EquipItem(再定義)
  91. #==============================================================================
  92. class RPG::EquipItem < RPG::BaseItem
  93.   #--------------------------------------------------------------------------
  94.   # ● 装備タイプの定義(再定義)
  95.   #--------------------------------------------------------------------------  
  96.   def etype_id
  97.     if @note != ""
  98.       cheack_note = @note
  99.       cheack_note.match(/^<装備タイプ\s?(\d+)>/)
  100.       if $1 == nil
  101.         return @etype_id   
  102.       else
  103.         return type = $1.to_i
  104.       end
  105.     else
  106.       return @etype_id
  107.     end
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 装備タイプの定義(再定義)
  111.   #--------------------------------------------------------------------------  
  112.   def etype_id=(etype_id)
  113.     @etype_id = etype_id
  114.   end
  115. end
  116.  
  117. #==============================================================================
  118. # ■ Game_BaseItem(追加定義)
  119. #==============================================================================
  120. class Game_BaseItem
  121.   def id
  122.     @item_id
  123.   end
  124. end
  125.  
  126. #==============================================================================
  127. # ■ Game_Actor
  128. #==============================================================================
  129. class Game_Actor < Game_Battler
  130.   #--------------------------------------------------------------------------
  131.   # ● 装備スロットの配列を取得(再定義)
  132.   #--------------------------------------------------------------------------
  133.   def equip_slots
  134.     return KURE::ExEquip::EQUIP_SLOT_DUAL if dual_wield?
  135.     return KURE::ExEquip::EQUIP_SLOT  # 通常
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 装備総重量(追加定義)
  139.   #--------------------------------------------------------------------------  
  140.   def all_weight
  141.     weight = 0
  142.       for i in [email]0..@equips.size[/email] - 1
  143.         #オブジェクトが存在している場合
  144.         if @equips[i].object != nil
  145.           if equip_slots[i] == 0
  146.             weight = weight + $data_weapons[@equips[i].id].weight
  147.           else
  148.             weight = weight + $data_armors[@equips[i].id].weight
  149.           end
  150.         end
  151.       end
  152.     return weight
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 重量増加量(追加定義)
  156.   #--------------------------------------------------------------------------  
  157.   def all_gain_weight
  158.     gain_weight = 0
  159.       for i in [email]0..@equips.size[/email] - 1
  160.         #オブジェクトが存在している場合
  161.         if @equips[i].object != nil
  162.           if equip_slots[i] == 0
  163.             gain_weight = gain_weight + $data_weapons[@equips[i].id].gain_weight
  164.           else
  165.             gain_weight = gain_weight + $data_armors[@equips[i].id].gain_weight
  166.           end
  167.         end
  168.       end
  169.     return gain_weight   
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 重量最大量(追加定義)
  173.   #--------------------------------------------------------------------------  
  174.   def max_weight
  175.     max_weight = 0
  176.     #追加重量
  177.     plus_weight = all_gain_weight
  178.     #基礎値
  179.     max_weight = max_weight + plus_weight + KURE::ExEquip::MAX_WEIGHT_BASE + KURE::ExEquip::MAX_WEIGHT_Lv * @level
  180.     #アクター補正
  181.     if KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id] != nil
  182.       max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id]
  183.     end
  184.     #職業補正
  185.     if KURE::ExEquip::MAX_WEIGHT_JOB[@class_id] != nil
  186.       max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_JOB[@class_id]
  187.     end   
  188.     #スキル補正を加算
  189.     for i in 0..KURE::ExEquip::MAX_WEIGHT_SKILL.size-1
  190.       if KURE::ExEquip::MAX_WEIGHT_SKILL[i] != nil
  191.         #スキルを設定していればスキルを保存
  192.         cheack_skill = $data_skills[KURE::ExEquip::MAX_WEIGHT_SKILL[i][0]]
  193.         #念のためnilではないか確認
  194.         if cheack_skill != nil
  195.           #スキルを覚えていれば補正値を加算
  196.           if skill_learn?(cheack_skill)
  197.             if KURE::ExEquip::MAX_WEIGHT_SKILL[i][1] != nil
  198.             max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_SKILL[i][1]
  199.             end
  200.           end  
  201.         end
  202.       end
  203.     end
  204.     return max_weight
  205.   end
  206. end
  207.  
  208. #==============================================================================
  209. # ■ Scene_Equip(再定義)
  210. #------------------------------------------------------------------------------
  211. #  装備画面の処理を行うクラスです。
  212. #==============================================================================
  213. class Scene_Equip < Scene_MenuBase
  214.   #--------------------------------------------------------------------------
  215.   # ● 開始処理
  216.   #--------------------------------------------------------------------------
  217.   def start
  218.     super
  219.     @max_weight = @actor.max_weight
  220.  
  221.     create_help_window
  222.     create_small_status_window
  223.     create_command_window
  224.     create_slot_window
  225.     create_status_window
  226.     create_item_window
  227.  
  228.     @save_item = 0
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● コマンドウィンドウの作成
  232.   #--------------------------------------------------------------------------
  233.   def create_command_window
  234.     @command_window = Window_Ex_EquipCommand.new(0,@help_window.height + @small_status_window.height, @small_status_window.width)
  235.     @command_window.viewport = @viewport
  236.     @command_window.help_window = @help_window
  237.     @command_window.set_handler(:equip,    method(:command_equip))
  238.     @command_window.set_handler(:optimize, method(:command_optimize))
  239.     @command_window.set_handler(:clear,    method(:command_clear))
  240.     @command_window.set_handler(:cancel,   method(:return_scene))
  241.     @command_window.set_handler(:pagedown, method(:next_actor))
  242.     @command_window.set_handler(:pageup,   method(:prev_actor))
  243.     @command_window.activate
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● スロットウィンドウの作成
  247.   #--------------------------------------------------------------------------
  248.   def create_slot_window
  249.     @slot_window = Window_Ex_EquipSlot.new(0, @command_window.height + @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120)
  250.     @slot_window.viewport = @viewport
  251.     @slot_window.help_window = @help_window
  252.     @slot_window.status_window = @status_window
  253.     @slot_window.actor = @actor
  254.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  255.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  256.     @slot_window.set_handler(:pagedown, method(:next_actor))
  257.     @slot_window.set_handler(:pageup,   method(:prev_actor))
  258.     @slot_window.deactivate
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● ステータスウィンドウの作成
  262.   #--------------------------------------------------------------------------
  263.   def create_status_window
  264.     @status_window = Window_Ex_EquipStatus.new(@slot_window.width, @help_window.height,Graphics.width - @slot_window.width,Graphics.height - @help_window.height)
  265.     @status_window.viewport = @viewport
  266.     @status_window.actor = @actor
  267.   end
  268.   #--------------------------------------------------------------------------
  269.   # ● ステータスウィンドウの作成
  270.   #--------------------------------------------------------------------------
  271.   def create_small_status_window
  272.     @small_status_window = Window_Equip_Small_Status.new(0,@help_window.height,305,120)
  273.     @small_status_window.viewport = @viewport
  274.     @small_status_window.weight = @actor.all_weight
  275.     @small_status_window.max_weight = @max_weight
  276.     @small_status_window.refresh
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● アイテムウィンドウの作成
  280.   #--------------------------------------------------------------------------
  281.   def create_item_window
  282.     @item_window = Window_Ex_EquipItem.new(0,@command_window.height +  @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120)
  283.     @item_window.viewport = @viewport
  284.     @item_window.help_window = @help_window
  285.     @item_window.status_window = @status_window
  286.     @item_window.actor = @actor
  287.     @item_window.set_handler(:ok,     method(:on_item_ok))
  288.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  289.     @slot_window.item_window = @item_window
  290.     @item_window.visible = false
  291.     @item_window.weight = @actor.all_weight
  292.     @item_window.max_weight = @max_weight
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● フレーム更新
  296.   #--------------------------------------------------------------------------
  297.   def update
  298.     update_basic
  299.     update_ex_status_window
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● フレーム更新
  303.   #--------------------------------------------------------------------------
  304.   def update_ex_status_window
  305.     if @item_window.visible == true
  306.       if  @item_window.item != @save_item
  307.         @save_item = @item_window.item
  308.         temp_actor = Marshal.load(Marshal.dump(@actor))
  309.         temp_actor.force_change_equip(@item_window.slot_id, @save_item)
  310.         @status_window.set_temp_actor(temp_actor)
  311.         @status_window.set_select_item2(@save_item)
  312.         @status_window.refresh
  313.       end
  314.     end
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● コマンド[装備変更]
  318.   #--------------------------------------------------------------------------
  319.   def command_equip
  320.     slot_window_set_focus
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● コマンド[全て外す]
  324.   #--------------------------------------------------------------------------
  325.   def command_clear
  326.     Sound.play_equip
  327.     @actor.clear_equipments
  328.     @status_window.refresh
  329.     @slot_window.refresh
  330.     @command_window.activate
  331.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  332.       update_weight     
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● スロット[決定]
  337.   #--------------------------------------------------------------------------
  338.   def on_slot_ok
  339.     @save_item = 0
  340.     @slot_window.visible = false
  341.     @item_window.visible = true
  342.     @status_window.draw_index = 1
  343.     @status_window.set_select_item(@slot_window.index)
  344.  
  345.     #装備アイテムがあれば重量を渡す
  346.     if @actor.equips[@slot_window.index] != nil
  347.       @item_window.chage_item_weight = @actor.equips[@slot_window.index].weight
  348.       @item_window.chaged_item_gain_weight = @actor.equips[@slot_window.index].gain_weight
  349.     else
  350.       @item_window.chage_item_weight = 0
  351.       @item_window.chaged_item_gain_weight = 0
  352.     end
  353.     update_weight
  354.  
  355.     @item_window.refresh
  356.     @slot_window.deactivate
  357.     @item_window.activate
  358.     @item_window.select(0)
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● スロット[キャンセル]
  362.   #--------------------------------------------------------------------------
  363.   def on_slot_cancel
  364.     @slot_window.unselect
  365.     @slot_window.deactivate
  366.     @command_window.activate
  367.     @command_window.select(0)
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● アイテム[決定]
  371.   #--------------------------------------------------------------------------
  372.   def on_item_ok
  373.     Sound.play_equip
  374.     index = @slot_window.index
  375.     @actor.change_equip(@slot_window.index, @item_window.item)
  376.  
  377.     #二刀流両手剣問題対応
  378.     if @actor.dual_wield?
  379.       if @slot_window.index == 0
  380.         @actor.change_equip(1, nil) if @actor.features_set(54).include?(1)
  381.       elsif @slot_window.index == 1
  382.         @actor.change_equip(0, nil) if @actor.features_set(54).include?(1)
  383.       end
  384.     end
  385.  
  386.     @item_window.chaged_item_gain_weight = 0
  387.     @status_window.draw_index = 0
  388.     slot_window_set_focus
  389.     delete_plus_status
  390.     @slot_window.index = index
  391.     update_weight
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● アイテム[キャンセル]
  395.   #--------------------------------------------------------------------------
  396.   def on_item_cancel
  397.     @status_window.draw_index = 0
  398.     index = @slot_window.index
  399.     slot_window_set_focus
  400.     @slot_window.index = index
  401.     delete_plus_status
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● アクターの切り替え
  405.   #--------------------------------------------------------------------------
  406.   def on_actor_change
  407.     update_weight   
  408.     @status_window.actor = @actor
  409.     @slot_window.actor = @actor
  410.     @item_window.actor = @actor
  411.     @command_window.activate
  412.     @command_window.select(0)
  413.     @slot_windowdeactivate
  414.     @slot_window.unselect
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● ステータスウィンドウ項目消去
  418.   #--------------------------------------------------------------------------
  419.   def delete_plus_status
  420.     @status_window.set_temp_actor(nil)
  421.     @status_window.set_select_item(nil)
  422.     @status_window.set_select_item2(nil)
  423.     @status_window.refresh   
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● スロットウィンドウにカーソルセット
  427.   #--------------------------------------------------------------------------
  428.   def slot_window_set_focus
  429.     @item_window.visible = false
  430.     @item_window.unselect
  431.     @item_window.refresh
  432.  
  433.     @slot_window.visible = true
  434.     @slot_window.activate
  435.     @slot_window.select(0)
  436.     @slot_window.refresh
  437.  
  438.     @command_window.unselect
  439.     @command_window.deactivate
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 装備重量更新
  443.   #--------------------------------------------------------------------------  
  444.   def update_weight
  445.     @max_weight = @actor.max_weight
  446.     @small_status_window.weight = @actor.all_weight
  447.     @small_status_window.max_weight = @max_weight
  448.     @item_window.weight = @actor.all_weight
  449.     @item_window.max_weight = @max_weight
  450.     @small_status_window.refresh     
  451.   end
  452. end
  453.  
  454. #==============================================================================
  455. # ■ Window_Ex_EquipSlot
  456. #==============================================================================
  457. class Window_Ex_EquipSlot < Window_EquipSlot
  458.   #--------------------------------------------------------------------------
  459.   # ● 公開インスタンス変数
  460.   #--------------------------------------------------------------------------
  461.   attr_reader   :status_window            # ステータスウィンドウ
  462.   attr_reader   :item_window              # アイテムウィンドウ
  463.   #--------------------------------------------------------------------------
  464.   # ● オブジェクト初期化
  465.   #--------------------------------------------------------------------------
  466.   def initialize(x, y, width, height)
  467.     @height = height
  468.     super(x, y, width)
  469.     @actor = nil
  470.     refresh
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● ウィンドウ高さの取得
  474.   #--------------------------------------------------------------------------
  475.   def window_height
  476.     return @height
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 項目の描画
  480.   #--------------------------------------------------------------------------
  481.   def draw_item(index)
  482.     return unless @actor
  483.     rect = item_rect_for_text(index)
  484.     change_color(system_color, enable?(index))
  485.     if @actor.equip_slots[index] <= 4
  486.       draw_text(rect.x, rect.y, 75, line_height, slot_name(index))
  487.     else
  488.       draw_index = KURE::ExEquip::EQUIP_SLOT[index]
  489.       draw_text(rect.x, rect.y, 75, line_height, KURE::ExEquip::EQUIP_SLOT_NAME[draw_index-5])      
  490.     end  
  491.     draw_item_name(@actor.equips[index], rect.x + 75, rect.y, enable?(index))
  492.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  493.       if @actor.equips[index] != nil
  494.         if @actor.equips[index].gain_weight != 0
  495.           change_color(power_up_color)
  496.           draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].gain_weight.to_s,2)         
  497.         else
  498.           if KURE::ExEquip::WEIGHT_0_ITEM == 1
  499.             if @actor.equips[index].weight != 0
  500.               change_color(power_down_color)
  501.               draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2)
  502.             end
  503.           else
  504.             change_color(power_down_color)
  505.             draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2)
  506.           end
  507.         end
  508.       end
  509.     end
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● リフレッシュ
  513.   #--------------------------------------------------------------------------
  514.   def refresh
  515.     #フォントの設定
  516.     last_font = contents.font.size
  517.     contents.font.size = 20
  518.  
  519.     contents.clear
  520.     create_contents
  521.     draw_all_items
  522.  
  523.     #フォントを戻す
  524.     contents.font.size = last_font
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● ヘルプテキスト更新
  528.   #--------------------------------------------------------------------------
  529.   def update_help
  530.     @help_window.clear
  531.     @help_window.set_item(item) if @help_window
  532.   end
  533. end
  534.  
  535.  
  536. #==============================================================================
  537. # ■ Window_Ex_EquipItem
  538. #==============================================================================
  539. class Window_Ex_EquipItem < Window_EquipItem
  540.   attr_reader   :status_window
  541.   attr_accessor :weight
  542.   attr_accessor :max_weight
  543.   attr_accessor :chage_item_weight
  544.   attr_accessor :chaged_item_gain_weight
  545.   #--------------------------------------------------------------------------
  546.   # ● オブジェクト初期化
  547.   #--------------------------------------------------------------------------
  548.   def initialize(x, y, width, height)
  549.     super(x, y, width, height)
  550.     @weight = 0
  551.     @max_weight = 0
  552.     @chage_item_weight = 0
  553.     @chaged_item_gain_weight = 0
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 桁数の取得
  557.   #--------------------------------------------------------------------------
  558.   def col_max
  559.     return 1
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● →キー入力時動作
  563.   #--------------------------------------------------------------------------
  564.   def cursor_right(wrap = false)
  565.     if @status_window.draw_index == 1
  566.       @status_window.draw_index = 2
  567.     else
  568.       @status_window.draw_index = 1
  569.     end
  570.     @status_window.refresh
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● ←キー入力時操作
  574.   #--------------------------------------------------------------------------
  575.   def cursor_left(wrap = false)
  576.     if @status_window.draw_index == 1
  577.       @status_window.draw_index = 2
  578.     else
  579.       @status_window.draw_index = 1
  580.     end
  581.     @status_window.refresh
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # ● アイテムを許可状態で表示するかどうか
  585.   #--------------------------------------------------------------------------
  586.   def enable?(item)
  587.     #重量システムを利用時だけ判定を行う
  588.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  589.       #アイテムが存在する時
  590.       if item !=nil
  591.         #総重量
  592.         total_weight = item.weight + @weight - @chage_item_weight
  593.         if total_weight > @max_weight - @chaged_item_gain_weight
  594.           return false
  595.         else
  596.           return true
  597.         end
  598.       else
  599.         if @weight > @max_weight - @chaged_item_gain_weight
  600.           return false
  601.         else
  602.           return true
  603.         end
  604.       end
  605.     end
  606.  
  607.     #重量システム非利用時であればtureを返す
  608.     return true
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # ● 桁数の取得
  612.   #--------------------------------------------------------------------------
  613.   def slot_id
  614.     return @slot_id
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # ● ヘルプテキスト更新
  618.   #--------------------------------------------------------------------------
  619.   def update_help
  620.     @help_window.set_item(item)
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 項目の描画
  624.   #--------------------------------------------------------------------------
  625.   def draw_item(index)
  626.     item = @data[index]
  627.     if item
  628.       rect = item_rect(index)
  629.       rect.width -= 4
  630.       draw_item_name(item, rect.x, rect.y, enable?(item))
  631.       draw_item_number(rect, item)
  632.  
  633.       #重量システムを利用時は重量を表示する
  634.       if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  635.         if item.gain_weight != 0
  636.           change_color(power_up_color)
  637.           draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.gain_weight.to_s,2)         
  638.         else
  639.           #重量0をチェック
  640.           if KURE::ExEquip::WEIGHT_0_ITEM == 1
  641.             if item.weight != 0
  642.               change_color(power_down_color)
  643.               draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2)
  644.             end
  645.           else
  646.             change_color(power_down_color)
  647.             draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2)
  648.           end
  649.         end
  650.       end
  651.  
  652.     end
  653.   end
  654. end
  655.  
  656. #==============================================================================
  657. # ■ Window_Small_Status
  658. #------------------------------------------------------------------------------
  659. #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
  660. #==============================================================================
  661. class Window_Equip_Small_Status < Window_Selectable
  662.   #--------------------------------------------------------------------------
  663.   # ● 公開インスタンス変数
  664.   #--------------------------------------------------------------------------
  665.   attr_reader   :pending_index            # 保留位置(並び替え用)
  666.   attr_accessor :weight
  667.   attr_accessor :max_weight
  668.   #--------------------------------------------------------------------------
  669.   # ● オブジェクト初期化
  670.   #--------------------------------------------------------------------------
  671.   def initialize(x, y,width,height)
  672.     super(x, y, width, height)
  673.     refresh
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ● 項目の描画
  677.   #--------------------------------------------------------------------------
  678.   def draw_status
  679.     @actor = $game_party.menu_actor
  680.     draw_actor_face(@actor, 0, 0)
  681.     draw_actor_name(@actor, 130, line_height * 0)
  682.     draw_actor_icons(@actor, 230-50, line_height * 0)
  683.     draw_actor_hp(@actor, 130, line_height * 1)
  684.     draw_actor_mp(@actor, 130, line_height * 2)
  685.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  686.       if @max_weight != nil
  687.         draw_actor_weight(@actor, 130, line_height * 3)
  688.       end
  689.     end
  690.   end
  691.   #--------------------------------------------------------------------------
  692.   # ● 装備重量の描画
  693.   #--------------------------------------------------------------------------
  694.   def draw_actor_weight(actor, x, y, width = 124)
  695.     weight_rate = @weight.to_f / @max_weight
  696.     draw_gauge(x, y, width, weight_rate, tp_gauge_color1, tp_gauge_color2)
  697.     change_color(system_color)
  698.     draw_text(x, y, 30, line_height, KURE::ExEquip::WEIGHT_NAME)
  699.     draw_current_and_max_values(x, y, width, @weight, @max_weight,
  700.     mp_color(actor), normal_color)
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ● リフレッシュ
  704.   #--------------------------------------------------------------------------
  705.   def refresh
  706.     contents.clear
  707.     draw_status
  708.   end
  709. end
  710.  
  711. #==============================================================================
  712. # ■ Window_Ex_EquipStatus
  713. #------------------------------------------------------------------------------
  714. #  装備画面で、アクターの能力値変化を表示するウィンドウです。
  715. #==============================================================================
  716. class Window_Ex_EquipStatus < Window_EquipStatus
  717.   attr_accessor :draw_index
  718.   #--------------------------------------------------------------------------
  719.   # ◎ オブジェクト初期化
  720.   #--------------------------------------------------------------------------
  721.   def initialize(x, y,width,height)
  722.     @draw_index = 0
  723.     @width = width
  724.     @height = height
  725.     super(x, y)
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # ◎ ウィンドウ幅の取得
  729.   #--------------------------------------------------------------------------
  730.   def window_width
  731.     return @width
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ◎ ウィンドウ高さの取得
  735.   #--------------------------------------------------------------------------
  736.   def window_height
  737.     return @height
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ◎ リフレッシュ
  741.   #--------------------------------------------------------------------------
  742.   def refresh
  743.     contents.clear
  744.     #フォントの設定
  745.     last_font = contents.font.size
  746.     contents.font.size = 20
  747.  
  748.     draw_gauge(5,0, contents.width, 1, mp_gauge_color2,crisis_color)
  749.     change_color(normal_color)
  750.  
  751.     case @draw_index
  752.     when 0,1
  753.       draw_text(5, 0, 126, contents.font.size, "能力属性栏")   
  754.       draw_equip_befor(5,line_height * 1)
  755.       draw_right_arrow(0, line_height * 2)
  756.       draw_equip_after(65,line_height * 2)
  757.     when 2
  758.       draw_text(5, 0, 126, contents.font.size, "装备属性")
  759.       draw_equip_after(5,line_height * 1)
  760.     end
  761.  
  762.     case @draw_index
  763.     when 0,1   
  764.       11.times {|i| draw_item(0, line_height * 2 + contents.font.size * (1 + i), i) }
  765.     when 2
  766.       draw_features(5,line_height * 2)
  767.     end
  768.  
  769.     case @draw_index
  770.     when 1,2     
  771.       change_color(normal_color)
  772.       draw_text(0, line_height * 12, contents.width, contents.font.size, "",1)
  773.     end
  774.     contents.font.size = last_font
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ◎ 装備変更のアイテム表示
  778.   #--------------------------------------------------------------------------
  779.   def draw_equip_befor(x,y)
  780.     return unless @actor
  781.     if @base_item_index != nil
  782.       draw_item_name(@actor.equips[@base_item_index], x, y)
  783.     end
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # ◎ 装備変更のアイテム表示
  787.   #--------------------------------------------------------------------------
  788.   def draw_equip_after(x,y)
  789.     return unless @actor
  790.     if @change_item != nil
  791.       draw_item_name(@change_item, x, y)
  792.     end
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # ◎ 装備アイテム描画の変数を設定
  796.   #--------------------------------------------------------------------------
  797.   def set_select_item(index)
  798.     return if @base_item_index == index
  799.     @base_item_index = index
  800.     refresh
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ◎ 変更装備アイテムの変数を設定
  804.   #--------------------------------------------------------------------------
  805.   def set_select_item2(index)
  806.     return if @change_item == index
  807.     @change_item = index
  808.     refresh
  809.   end
  810.   #--------------------------------------------------------------------------
  811.   # ◎ 項目の描画
  812.   #--------------------------------------------------------------------------
  813.   def draw_item(x, y, param_id)
  814.     case param_id
  815.     when 0,1,2,3,4,5,6,7
  816.       draw_param_name(x + 4, y, param_id)
  817.       draw_current_param(x + 84+20, y, param_id) if @actor
  818.       draw_right_arrow(x + 116, y)
  819.       draw_new_param(x + 140+ 140, y, param_id) if @temp_actor
  820.  
  821.       if KURE::ExEquip::VIEW_EQUIP_STATUS == 1
  822.         change_color(param_change_color(@change_item.params[param_id])) if @change_item
  823.         draw_text(x + 172, y, 40, line_height, @change_item.params[param_id], 2) if @change_item
  824.       end
  825.  
  826.     when 8,9,10
  827.       value = 0
  828.       value2 = 0
  829.       value = (@actor.xparam(param_id - 8) * 100).to_i if @actor
  830.       value2 = (@temp_actor.xparam(param_id - 8) * 100).to_i  if @temp_actor
  831.       change_color(system_color)
  832.       draw_text(x + 4, y, 80, line_height, KURE::ExEquip::Vocab_Ex1[param_id - 8])
  833.       change_color(normal_color)
  834.       draw_text(x + 84+30, y, 32, line_height, value, 2) if @actor
  835.       draw_right_arrow(x + 116, y)
  836.       change_color(param_change_color(value2 - value)) if @temp_actor
  837.       draw_text(x + 140+ 140, y, 32, line_height, value2, 2) if @temp_actor
  838.  
  839.       if KURE::ExEquip::VIEW_EQUIP_STATUS == 1
  840.         change_color(param_change_color(value2 - value))
  841.         draw_text(x + 172, y, 40, line_height, value2 - value, 2) if @change_item
  842.       end
  843.  
  844.     end
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # ◎ 特徴の描画
  848.   #--------------------------------------------------------------------------
  849.   def draw_features(x,y)
  850.     return if @change_item == nil
  851.     #特徴を描画
  852.     change_color(system_color)
  853.     draw_text(5, y, 126, contents.font.size, "属性特效")
  854.  
  855.     #配列数取得変数を初期化
  856.     features_max = 0
  857.     #描画用配列を作成
  858.     draw_list = Array.new(100)
  859.     #配列用カウンターをセット
  860.     @draw_counter = 0
  861.     #装備品が有れば特徴最大数を取得
  862.     features_max = @change_item.features.size - 1
  863.  
  864.       #項目をチェックして描画用配列に入れる
  865.       for l in 0..features_max
  866.  
  867.         #攻撃属性がある場合
  868.         if @change_item.features[l].code == 31
  869.           draw_str  = $data_system.elements[@change_item.features[l].data_id]
  870.           draw_list[@draw_counter] = draw_str + "属性 "
  871.           @draw_counter += 1
  872.         end
  873.  
  874.         #属性耐性がある場合
  875.         if @change_item.features[l].code == 11
  876.           #属性名取得
  877.           draw_str = $data_system.elements[@change_item.features[l].data_id]+ "耐性"
  878.           value = 100 - (@change_item.features[l].value * 100).to_i
  879.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  880.           @draw_counter += 1
  881.         end
  882.  
  883.         #弱体有効度がある場合
  884.         if @change_item.features[l].code == 12
  885.           #属性名取得
  886.           draw_str = "耐"+Vocab::param(@change_item.features[l].data_id)+ "减少"
  887.           value = 100 - (@change_item.features[l].value * 100).to_i
  888.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  889.           @draw_counter += 1
  890.         end         
  891.  
  892.         #ステート耐性がある場合
  893.         if @change_item.features[l].code == 13
  894.           #ステート名取得
  895.           draw_str = $data_states[@change_item.features[l].data_id].name + "耐性"
  896.           value = 100 - (@change_item.features[l].value * 100).to_i
  897.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  898.           @draw_counter += 1
  899.         end
  900.  
  901.         #ステート無効化がある場合
  902.         if @change_item.features[l].code == 14
  903.           #ステート名取得
  904.           draw_str = $data_states[@change_item.features[l].data_id].name
  905.           draw_list[@draw_counter] = draw_str + "无效 "
  906.           @draw_counter += 1
  907.         end         
  908.  
  909.         #通常能力値判定がある場合
  910.         if @change_item.features[l].code == 21
  911.           #ステータス名取得
  912.           draw_str = Vocab::param(@change_item.features[l].data_id)
  913.           value = (@change_item.features[l].value * 100).to_i - 100
  914.             if value > 0
  915.               value = "+" + value.to_s
  916.             end            
  917.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  918.           @draw_counter += 1
  919.         end
  920.  
  921.         #通常能力値判定がある場合
  922.         if @change_item.features[l].code == 22
  923.           #ステータス名取得
  924.           draw_str = @change_item.features[l].data_id
  925.           case draw_str
  926.           when 0
  927.             draw_str = "命中率"
  928.           when 1
  929.             draw_str = "回避率"
  930.           when 2
  931.             draw_str = "会心率"
  932.           when 3
  933.             draw_str = "会心回避"            
  934.           when 4
  935.             draw_str = "兵法回避"
  936.           when 5
  937.             draw_str = "兵法反射"
  938.           when 6
  939.             draw_str = "反击率"
  940.           when 7
  941.             draw_str = "每回合兵力回复"
  942.           when 8
  943.             draw_str = "每回合谋点回复"
  944.           when 9
  945.             draw_str = "每回合气力回复"
  946.           end
  947.           value = (@change_item.features[l].value * 100).to_i
  948.             if value > 0
  949.               value = "+" + value.to_s
  950.             end            
  951.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  952.           @draw_counter += 1
  953.         end
  954.  
  955.         #特殊能力値判定がある場合
  956.         if @change_item.features[l].code == 23
  957.           #ステート名取得
  958.           draw_str = @change_item.features[l].data_id
  959.           case draw_str
  960.           when 0
  961.             draw_str = "被打几率"
  962.           when 1
  963.             draw_str = "防御効果"
  964.           when 2
  965.             draw_str = "回复效果"
  966.           when 3
  967.             draw_str = "药草知识"
  968.           when 4
  969.             draw_str = "谋点消费率"
  970.           when 5
  971.             draw_str = "气力增加率"
  972.           when 6
  973.             draw_str = "受物理伤害"
  974.           when 7
  975.             draw_str = "受兵法伤害"
  976.           when 8
  977.             draw_str = "受地图伤害"
  978.           when 9
  979.             draw_str = "经验值"
  980.           end
  981.           value = (@change_item.features[l].value * 100).to_i - 100
  982.             if value > 0
  983.               value = "+" + value.to_s
  984.             end            
  985.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  986.           @draw_counter += 1
  987.         end
  988.  
  989.         #攻撃時ステート判定がある場合
  990.         if @change_item.features[l].code == 32
  991.           #ステート名取得
  992.           draw_str = $data_states[@change_item.features[l].data_id].name + "追加"
  993.           value = (@change_item.features[l].value * 100).to_i
  994.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  995.           @draw_counter += 1
  996.         end
  997.  
  998.         #攻撃追加がある場合
  999.         if @change_item.features[l].code == 34
  1000.           #攻撃回数を取得
  1001.           value = (@change_item.features[l].value + 1).to_i
  1002.           draw_list[@draw_counter] = value.to_s + "回攻击 "
  1003.           @draw_counter += 1
  1004.         end
  1005.  
  1006.         #スキルタイプ追加がある場合
  1007.         if @change_item.features[l].code == 41
  1008.           #項目を取得
  1009.           value = $data_system.skill_types[@change_item.features[l].data_id]
  1010.           draw_list[@draw_counter] = value + "可使用 "
  1011.           @draw_counter += 1
  1012.         end  
  1013.  
  1014.         #スキルタイプ削除がある場合
  1015.         if @change_item.features[l].code == 42
  1016.           #項目を取得
  1017.           value = $data_system.skill_types[@change_item.features[l].data_id]
  1018.           draw_list[@draw_counter] = value + "使用不可 "
  1019.           @draw_counter += 1
  1020.         end
  1021.  
  1022.         #スキル追加がある場合
  1023.         if @change_item.features[l].code == 43
  1024.           #項目を取得
  1025.           value = $data_skills[@change_item.features[l].data_id].name
  1026.           draw_list[@draw_counter] = "“" +value + "”可使用 "
  1027.           @draw_counter += 1
  1028.         end
  1029.  
  1030.         #スキル削除がある場合
  1031.         if @change_item.features[l].code == 44
  1032.           #項目を取得
  1033.           value = $data_skills[@change_item.features[l].data_id].name
  1034.           draw_list[@draw_counter] = "“" +value + "”不可使用 "
  1035.           @draw_counter += 1
  1036.         end
  1037.  
  1038.         #行動追加がある場合
  1039.         if @change_item.features[l].code == 61
  1040.           #項目を取得
  1041.           value = (@change_item.features[l].value * 100).to_i
  1042.           draw_list[@draw_counter] = "追加行动"+ value.to_s + "% "
  1043.           @draw_counter += 1
  1044.         end         
  1045.  
  1046.         #特殊フラグがある場合
  1047.         if @change_item.features[l].code == 62
  1048.           #項目を取得
  1049.           value = @change_item.features[l].data_id
  1050.           case value
  1051.           when 0
  1052.             value = "自动战斗"
  1053.           when 1
  1054.             value = "自动防御"
  1055.           when 2
  1056.             value = "自动援护"
  1057.           when 3
  1058.             value = "TP持越"
  1059.           end
  1060.           draw_list[@draw_counter] = value
  1061.           @draw_counter += 1
  1062.         end  
  1063.  
  1064.         #パーティー能力がある場合
  1065.         if @change_item.features[l].code == 64
  1066.           #項目を取得
  1067.           value = @change_item.features[l].data_id
  1068.           case value
  1069.           when 0
  1070.             value = "遇敌率↓"
  1071.           when 1
  1072.             value = "遇敌率0"
  1073.           when 2
  1074.             value = "不会被偷袭"
  1075.           when 3
  1076.             value = "偷袭率上升"
  1077.           when 4
  1078.             value = "金钱双倍"              
  1079.           when 5
  1080.             value = "掉宝双倍"              
  1081.           when 6
  1082.           end
  1083.           draw_list[@draw_counter] = value
  1084.           @draw_counter += 1
  1085.         end
  1086.       end
  1087.  
  1088.       #実際の描画処理
  1089.       for j in 0..@draw_counter
  1090.         if draw_list[j] != nil or 0
  1091.           case j
  1092.           when 0..10
  1093.             change_color(normal_color)            
  1094.             draw_text(x, y + contents.font.size * (j + 1) , contents.width / 2, contents.font.size, draw_list[j])
  1095.           when 11..21
  1096.             change_color(normal_color)            
  1097.             draw_text(x + contents.width / 2, y + contents.font.size * (j - 10) , contents.width / 2, contents.font.size, draw_list[j])
  1098.           end
  1099.         end
  1100.       end      
  1101.  
  1102.   end
  1103. end
  1104.  
  1105. #==============================================================================
  1106. # ■ Window_Ex_EquipCommand
  1107. #------------------------------------------------------------------------------
  1108. #  スキル画面で、コマンド(装備変更、最強装備など)を選択するウィンドウです。
  1109. #==============================================================================
  1110. class Window_Ex_EquipCommand < Window_HorzCommand
  1111.   #--------------------------------------------------------------------------
  1112.   # ● オブジェクト初期化
  1113.   #--------------------------------------------------------------------------
  1114.   def initialize(x, y, width)
  1115.     @window_width = width
  1116.     super(x, y)
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ● ウィンドウ幅の取得
  1120.   #--------------------------------------------------------------------------
  1121.   def window_width
  1122.     @window_width
  1123.   end
  1124.   #--------------------------------------------------------------------------
  1125.   # ● 桁数の取得
  1126.   #--------------------------------------------------------------------------
  1127.   def col_max
  1128.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0
  1129.       return 3
  1130.     else
  1131.       return 2
  1132.     end
  1133.   end
  1134.   #--------------------------------------------------------------------------
  1135.   # ● コマンドリストの作成
  1136.   #--------------------------------------------------------------------------
  1137.   def make_command_list
  1138.     add_command(Vocab::equip2,   :equip)
  1139.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0
  1140.       add_command(Vocab::optimize, :optimize)
  1141.     end
  1142.     add_command(Vocab::clear,    :clear)
  1143.   end
  1144. end

QQ图片20170429210118.png (2.93 KB, 下载次数: 6)

QQ图片20170429210118.png

Lv5.捕梦者 (版主)

梦石
1
星屑
23963
在线时间
3338 小时
注册时间
2011-7-8
帖子
3925

开拓者

2
发表于 2017-4-29 21:16:21 | 只看该作者
根据多年经验,应该是调用了个id=0的武器/防具,结果报了nil。
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

3
 楼主| 发表于 2017-4-29 21:27:02 | 只看该作者
guoxiaomi 发表于 2017-4-29 21:16
根据多年经验,应该是调用了个id=0的武器/防具,结果报了nil。

根据目前的经验,表示参不透

点评

请问下,怎么使用,不然不知道怎么解决,我都进不去这系统  发表于 2017-4-29 22:11
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
31847
在线时间
5079 小时
注册时间
2012-11-19
帖子
4877

开拓者

4
发表于 2017-4-29 22:30:29 | 只看该作者
把装备扩展 161 到 167
  1. if @equips[i].object != nil
  2.   if equip_slots[i] == 0
  3.     gain_weight = gain_weight + $data_weapons[@equips[i].id].gain_weight
  4.   else
  5.     gain_weight = gain_weight + $data_armors[@equips[i].id].gain_weight
  6.   end
  7. end
复制代码


改为:
  1. if @equips[i].object != nil
  2.   xr_equip = equip_slots[i] == 0 ? $data_weapons[@equips[i].id] : $data_armors[@equips[i].id]
  3.   next if xr_equip.nil?
  4.   gain_weight += xr_equip.gain_weight
  5. end
复制代码


试试
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

5
 楼主| 发表于 2017-4-29 22:45:28 | 只看该作者
devil033 发表于 2017-4-29 21:27
根据目前的经验,表示参不透

@300英雄
好尴尬,你不说我都不知道,这脚本上传之后多了几个链接在里面,直接复制粘贴用不了
我还是上传一个附件吧

Project2.rar

1.44 MB, 下载次数: 141

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

6
 楼主| 发表于 2017-4-29 22:48:53 | 只看该作者
本帖最后由 devil033 于 2017-4-29 22:54 编辑
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167


确认装备后报另外一个错

QQ图片20170429224756.png (7.73 KB, 下载次数: 10)

QQ图片20170429224756.png

点评

单纯的筛选果然不行。如果要用 宝石镶嵌 脚本,需要整合。  发表于 2017-4-29 22:55
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

7
 楼主| 发表于 2017-4-29 23:07:17 | 只看该作者
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167

照葫芦画瓢,把147至153
RUBY 代码复制
  1. if @equips[i].object != nil
  2.           if equip_slots[i] == 0
  3.             weight = weight + $data_weapons[@equips[i].id].weight
  4.           else
  5.             weight = weight + $data_armors[@equips[i].id].weight
  6.           end
  7.         end


改为
RUBY 代码复制
  1. if @equips[i].object != nil
  2.            xr_equip = equip_slots[i] == 0 ? $data_weapons[@equips[i].id] : $data_armors[@equips[i].id]
  3.            next if xr_equip.nil?
  4.            weight += xr_equip.gain_weight
  5.         end

后可以装备了,但发现另外一个问题,装备上去属性不会发生任何变化

QQ图片20170429230626.png (159.64 KB, 下载次数: 8)

QQ图片20170429230626.png
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7495
在线时间
1152 小时
注册时间
2016-9-10
帖子
165

开拓者

8
 楼主| 发表于 2017-5-1 00:18:47 | 只看该作者
好尴尬,这问题还有没有机会再抢救一下
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1852
在线时间
219 小时
注册时间
2018-8-5
帖子
105
9
发表于 2019-2-18 21:37:54 | 只看该作者
挖个坟  那个箭头能不能往右移动些
一点一点加油
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 12:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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