查看: 3452|回复: 10

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

[复制链接]
梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

发表于 2017-4-29 21:02:39 | 显示全部楼层 |阅读模式

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

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

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


属性镶嵌脚本

  1. #
  2. # Mosaic System (Applicable with MOG_Monogatari by Moghunter)
  3. # 属性镶嵌系统
  4. # Esp 2016.04.16 by 影月千秋
  5. #

  6. # Mosaic
  7. module Mosaic

  8.   # 镶嵌场景中帮助窗口, 装备窗口, 宝石窗口, 提示窗口 的 [x, y, 宽, 高]
  9.   HelpWindow = [Graphics.width * 2 / 3, 0, Graphics.width / 3, Graphics.height]
  10.   EquipWindow = [0, 0, Graphics.width / 3, Graphics.height]
  11.   GemWindow = [Graphics.width / 3, 0, Graphics.width / 3, Graphics.height]
  12.   PromptWindow = [Graphics.width * 0.4, Graphics.height * 0.4,
  13.                   Graphics.width * 0.2, Graphics.height * 0.15]
  14.   # 镶嵌确认窗口的宽度
  15.   # 高度是自适应的
  16.   ConfirmWidth = 0.65 * Graphics.width
  17.   # 确认窗口的显示格式
  18.   # 用<equip>代替当前镶嵌装备 <gem>代表当前镶嵌宝石 <gold>当前持有金钱
  19.   # <cost>镶嵌费用
  20.   ConfirmFormat = %w!
  21.     <equip>
  22.     <gem>
  23.     持有金钱: <gold>
  24.     需要金钱: <cost>
  25.   !
  26.   # 确认窗口的两个按钮的名字
  27.   ConfirmText = "确认"
  28.   CancelText  = "取消"
  29.   # 提示窗口出现的时间
  30.   PromptCount = 60
  31.   # 镶嵌成功或者失败(金钱不足)时的提示文字
  32.   MosaicSucceed = "镶嵌成功"
  33.   MosaicFail = "金钱不足"

  34.   # 致菜单脚本作者:
  35.   #   镶嵌装备的说明(description)是在 Mosaicked#description 里实现的
  36.   #   如果你打算拓展帮助 可以从这里入手

  37.   # 镶嵌的宝石属性类型的最大数目
  38.   # 这个数目不包括装备掉落时随机生成的属性数目
  39.   MaxNewGemCount = 2

  40.   # 用于在数据库备注匹配识别宝石id的正则式
  41.   # 在物品的备注栏加上 <gem XX> XX表示属性编号
  42.   #例如 <gem 0> 表示是HP的宝石 <gem 1> MP宝石 …………以此类推
  43.   GemTypeRegexp = /<gem (\d+)>/i   

  44.   # NewParamChance: 掉落装备产生新属性的概率
  45.   # EquipColor: 拥有几种属性的装备的颜色 数字和显示文字里面的颜色id一样的意义
  46.   NewParamChance = [60, 55, 50, 45, 40, 30, 25]#掉落各个颜色装备的概率
  47.   EquipColor     = [0,1, 3,  2, 26, 27, 14, 18] # \c表示的颜色
  48.                 #0白色 #1蓝色 3绿色 2橙色 27粉红色 14金黄色 18深红色
  49.                 #掉落的装备会根据设置的几率出现下面的颜色,白板请无视
  50.   # 默认的参数值
  51.   DefaultParamValue = {
  52.     name: "NoName", # 名字
  53.     percentage: false, # 显示的时候是否要加一个百分号
  54.     state: -1, # 附加状态 -1表示无
  55.     party: -1,
  56.     # 团队能力 -1:无 0:遇敌减半 1:随机遇敌无效 2:敌人偷袭无效 3:先制攻击率上升
  57.     # 4:掉落金钱双倍 5:掉落物品双倍
  58.     increase_gold: false, # 是否导致金钱增加
  59.     increase_critical: false, # 是否导致暴击伤害加成率(对敌)
  60.     decrease_critical: false, # 是否导致暴击伤害减少率(对己)
  61.     more_params_rate: false, # 是否导致多属性出现几率加成
  62.     action_plus_set: false, # 是否导致行动次数增加几率加成
  63.     max_level: 10, # 该属性的最大等级
  64.     random_range: 1..3, # 掉落的时候 如果产生了该属性 属性的等级范围
  65.     range: 10..30, # 属性的值的范围
  66.     cost: [2000, 2500, 3500, 4500, 5500, 6500, 7500, 8500, 10000, 15000],
  67.     # 强化该属性耗费的基础金钱,实际金钱会加上装备的价格
  68.     equip: [], # 可以装备在哪些栏位 etype 0:武器 1:盾 2:头盔 3:盔甲 4:装饰品
  69.     weapon: nil, # 可以装备的武器类型 wtype
  70.     armor: nil # 可以装备的防具类型 atype
  71.   }
  72.   
  73.   #0:武器 1:盾 2:头盔 3:盔甲 4:装饰品
  74.   #左边装备类型,右边则是属性编号,属性编号不必全部都填,可选择性地填
  75.   EType = {
  76.     0 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  77.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  78.           38, 39, 40,41],
  79.     1 => [ 0,  1,  2,  3,  4,  5,  6,  7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
  80.           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
  81.           38, 39, 40,41],
  82.     2 => [ 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.     3 => [ 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.     4 => [ 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.   }

  92.   WType = {}

  93.   AType = {}

  94.   # 在这里设置具体的属性和参数
  95.   # 未设置的参数会自动应用默认值的
  96.   Params = []
  97.   # 40号之前的属性都对应了特定含义
  98.   # 0:hp上限 1:mp上限 2:攻击 3:防御 4:魔攻 5:魔防 6:敏捷 7:幸运
  99.   # 名字会从数据库里读取
  100.   Params[0] = {     #HP上限
  101.     range: 10..30   #增加量随机10-30点(可随意设置,如需固定增加量则range: 10..10)
  102.   }
  103.   
  104.   Params[1] = {     #MP上限
  105.     range: 10..30   #增加量随机10-30点
  106.   }
  107.   
  108.   Params[2] = {     #物理攻击力
  109.     range: 10..30   #增加量随机10-30点
  110.   }
  111.   
  112.   Params[3] = {     #物理防御力
  113.     range: 10..30   #增加量随机10-30点
  114.   }
  115.   
  116.   Params[4] = {     #魔法攻击力
  117.     range: 10..30   #增加量随机10-30点
  118.   }
  119.   
  120.   Params[5] = {     #魔法防御力
  121.     range: 10..30   #增加量随机10-30点
  122.   }
  123.   
  124.   Params[6] = {     #敏捷
  125.     range: 10..30   #增加量随机10-30点
  126.   }
  127.   
  128.   Params[7] = {     #幸运
  129.     range: 10..30   #增加量随机10-30点
  130.   }
  131.   
  132.   
  133.   
  134.   
  135.   # (按百分比) 10:hp上限 11:mp上限 12:攻击 13:防御 14:魔攻 15:魔防 16:敏捷 17:幸运
  136.   # 名字会从数据库里读取
  137.   Params[10] = {           #HP上限百分比
  138.     percentage: true,      #添加百分号
  139.     range: 1..5            #随机1%-5%
  140.   }
  141.   
  142.   Params[11] = {           #MP上限百分比
  143.     percentage: true,      #添加百分号
  144.     range: 1..5            #随机1%-5%
  145.   }
  146.   
  147.   Params[12] = {           #攻击力百分比
  148.     percentage: true,      #添加百分号
  149.     range: 1..5            #随机1%-5%
  150.   }
  151.   
  152.   Params[13] = {           #防御力百分比
  153.     percentage: true,      #添加百分号
  154.     range: 1..5            #随机1%-5%
  155.   }
  156.   
  157.   Params[14] = {           #魔法攻击力百分比
  158.     percentage: true,      #添加百分号
  159.     range: 1..5            #随机1%-5%
  160.   }
  161.   
  162.   Params[15] = {           #魔法防御力百分比
  163.     percentage: true,      #添加百分号
  164.     range: 1..5            #随机1%-5%
  165.   }
  166.   
  167.   Params[16] = {           #敏捷百分比
  168.     percentage: true,      #添加百分号
  169.     range: 1..5            #随机1%-5%
  170.   }
  171.   
  172.   Params[17] = {           #幸运百分比
  173.     percentage: true,      #添加百分号
  174.     range: 1..5            #随机1%-5%
  175.   }
  176.   
  177.   
  178.   
  179.   
  180.   
  181.   
  182.   # 20:物理命中率 21:物理回避率 22:暴击率 23:暴击闪避率 24:魔法闪避率 25:魔法反射率 26:物理反击率 27:生命回复 28:魔法回复 29:TP回复
  183.   Params[20] = {  
  184.     name: "物理命中率",     #属性名称:物理命中率,随意改名字
  185.     percentage: true,       #添加百分号
  186.     range: 1..5             #随机1%-5%
  187.   }
  188.   
  189.   Params[21] = {           
  190.     name: "物理回避率",     #物理回避率
  191.     percentage: true,      #添加百分号
  192.     range: 1..5            #随机1%-5%
  193.   }
  194.   
  195.   Params[22] = {      
  196.     name: "暴击几率",       #暴击几率
  197.     percentage: true,      #添加百分号
  198.     range: 1..5            #随机1%-5%
  199.   }
  200.   
  201.   Params[23] = {   
  202.     name: "暴击闪避率",     #暴击闪避率
  203.     percentage: true,      #添加百分号
  204.     range: 1..5            #随机1%-5%
  205.   }
  206.   
  207.   Params[24] = {   
  208.     name: "魔法闪避率",     #魔法闪避率
  209.     percentage: true,      #添加百分号
  210.     range: 1..5            #随机1%-5%
  211.   }
  212.   
  213.   Params[25] = {   
  214.     name: "魔法反射率",     #魔法反射率
  215.     percentage: true,      #添加百分号
  216.     range: 1..5            #随机1%-5%
  217.   }
  218.   
  219.   Params[26] = {   
  220.     name: "物理反射率",     #物理反射率
  221.     percentage: true,      #添加百分号
  222.     range: 1..5            #随机1%-5%
  223.   }
  224.   
  225.   Params[27] = {   
  226.     name: "体力再生",       #HP再生
  227.     percentage: true,      #添加百分号
  228.     range: 1..5            #随机1%-5%
  229.   }
  230.   
  231.   Params[28] = {   
  232.     name: "魔力再生",      #MP再生
  233.     percentage: true,      #添加百分号
  234.     range: 1..5            #随机1%-5%
  235.   }
  236.   
  237.   Params[29] = {   
  238.     name: "TP再生",        #TP再生
  239.     percentage: true,      #添加百分号
  240.     range: 1..5            #随机1%-5%
  241.   }
  242.   
  243.   

  244.   # 30:受到攻击的几率 31:防御效果 32:恢复效果 33:药理知识 34:魔法消耗 35:TP增长 36:物理伤害加成 37:魔法伤害加成 38:地形伤害加成 39:经验获得
  245.   Params[30] = {
  246.     name: "受到攻击几率",   #吸引仇恨………………
  247.     percentage: true,      #添加百分号
  248.     range: 1..5            #随机1%-5%
  249.   }
  250.   
  251.   Params[31] = {   
  252.     name: "防御效果",       #这些都是VA默认下有的东西,具体请看 Game_BattlerBase
  253.     percentage: true,      #添加百分号
  254.     range: 1..5            #随机1%-5%
  255.   }
  256.   
  257.   Params[32] = {   
  258.     name: "恢复效果",       #恢复效果
  259.     percentage: true,      #添加百分号
  260.     range: 1..5            #随机1%-5%
  261.   }
  262.   
  263.   Params[33] = {   
  264.     name: "药理知识",       #药理知识
  265.     percentage: true,      #添加百分号
  266.     range: 1..5            #随机1%-5%
  267.   }
  268.   
  269.   Params[34] = {   
  270.     name: "魔法消耗",       #魔法消耗
  271.     percentage: true,      #添加百分号
  272.     range: 1..5            #随机1%-5%
  273.   }
  274.   
  275.   Params[35] = {   
  276.     name: "TP增长",        #TP增长
  277.     percentage: true,      #添加百分号
  278.     range: 1..5            #随机1%-5%
  279.   }
  280.   
  281.   Params[36] = {   
  282.     name: "物理伤害加成",   #物理伤害加成
  283.     percentage: true,      #添加百分号
  284.     range: 1..5            #随机1%-5%
  285.   }
  286.   
  287.   Params[37] = {   
  288.     name: "魔法伤害加成",   #魔法伤害加成
  289.     percentage: true,      #添加百分号
  290.     range: 1..5            #随机1%-5%
  291.   }
  292.   
  293.   Params[38] = {   
  294.     name: "地形伤害加成",   #地形伤害加成
  295.     percentage: true,      #添加百分号
  296.     range: 1..5            #随机1%-5%
  297.   }
  298.   
  299.   Params[39] = {   
  300.     name: "经验获得加成",   #经验获得加成
  301.     percentage: true,      #添加百分号
  302.     range: 1..5            #随机1%-5%
  303.   }
  304.   #新添加属性
  305.   # 40及以后的属性可以随意设置
  306.   Params[40] = {      
  307.     name: "金钱增加",     #属性名称
  308.     percentage: true,     #添加百分号
  309.     increase_gold: true,  #金钱增加开启
  310.     range: 1..5           #随机1%-5%
  311.   }

  312.   Params[41] = {
  313.     name: "再次行动几率",    #属性名称
  314.     percentage: true,       #添加百分号
  315.     action_plus_set: true,  #增加行动次数开启(不是攻击次数,别搞混了)
  316.     range: 1..5             #随机1%-5%
  317.   }
  318.   
  319.   #Params[40] = {
  320.     #name: "掉落物品双倍",
  321.     #party: 5,
  322.     #max_level: 1
  323.   #}

  324.   #Params[41] = {
  325.     #name: "攻击附加状态",
  326.     #percentage: true,  
  327.     #state: 6,    #数据库状态编号
  328.     #range: 5..7
  329.   #}
  330.   
  331.   
  332.   
  333.   
  334.   
  335.   
  336.   
  337.   
  338.   
  339.   EType.each do |k, v|
  340.     v.each do |i|
  341.       next unless Params[i]
  342.       Params[i][:equip] ||= []
  343.       Params[i][:equip].push k
  344.     end
  345.   end
  346.   WType.each do |k, v|
  347.     v.each do |i|
  348.       next unless Params[i]
  349.       Params[i][:weapon] ||= []
  350.       Params[i][:weapon].push k
  351.     end
  352.   end
  353.   AType.each do |k, v|
  354.     v.each do |i|
  355.       next unless Params[i]
  356.       Params[i][:armor] ||= []
  357.       Params[i][:armor].push k
  358.     end
  359.   end
  360.   Params.compact.each do |h| DefaultParamValue.each do |k, v| h[k] ||= v end end
  361. end

  362. # Mosaic Gem
  363. module MosaicGem

  364.   # gem type
  365.   def gem_type
  366.     @gem_type ||= begin
  367.       Mosaic::GemTypeRegexp.match @note
  368.       $1 ? $1.to_i : -1
  369.     end
  370.   end
  371. end

  372. RPG::Item.send :include, MosaicGem

  373. # Mosaicked
  374. module Mosaicked

  375.   # readers
  376.   def data_id
  377.     @data_id ||= @id
  378.   end
  379.   def generated_gems
  380.     @generated_gems ||= {}
  381.   end
  382.   def mosaicked_gems
  383.     @mosaicked_gems ||= {}
  384.   end
  385.   def mosaic_effects
  386.     @mosaic_effects ||= {}
  387.   end

  388.   # get gems
  389.   def gems
  390.     r = Marshal.load Marshal.dump generated_gems
  391.     mosaicked_gems.each do |k, v| r[k] = v end
  392.     r
  393.   end

  394.   # mosaic
  395.   def mosaic gem
  396.     if generated_gems[gem.gem_type]
  397.       generated_gems[gem.gem_type] += 1
  398.     else
  399.       mosaicked_gems[gem.gem_type] ||= 0
  400.       mosaicked_gems[gem.gem_type] += 1
  401.     end
  402.     apply_mosaicked_params gem.gem_type
  403.     @id = $game_system.new_mosaic_item_id self
  404.   end

  405.   # can mosaic?
  406.   def can_mosaic? item
  407.     return if item.gem_type < 0
  408.     type = item.gem_type; params = Mosaic::Params[type]
  409.     return unless params
  410.     return unless gems[type] ? gems[type] < params[:max_level] :
  411.       mosaicked_gems.size < Mosaic::MaxNewGemCount
  412.     case self
  413.     when RPG::Weapon
  414.       params[:weapon] ? params[:weapon].include?(wtype_id) :
  415.         params[:equip].include?(etype_id)
  416.     when RPG::Armor
  417.       params[:armor] ? params[:armor].include?(atype_id) :
  418.         params[:equip].include?(etype_id)
  419.     else
  420.       params[:equip].include? etype_id
  421.     end
  422.   end

  423.   # mosaic cost
  424.   def mosaic_cost gem
  425.     Mosaic::Params[gem.gem_type][:cost][gems[gem.gem_type] || 0] + price
  426.   end

  427.   # mosaic base equal?
  428.   def mosaic_base_equal? rhs
  429.     self.class == rhs.class && self.data_id == rhs.data_id
  430.   end

  431.   # apply mosaicked params
  432.   def apply_mosaicked_params type
  433.     mosaic_effects[type] ||= 0
  434.     mosaic_effects[type] += Mosaic::Params[type][:range].to_a.sample
  435.   end

  436.   # allowed params
  437.   def allowed_params
  438.     Mosaic::Params.each_with_index.map do |k, i|
  439.       next unless k
  440.       ((is_a?(RPG::Weapon) && k[:weapon] && k[:weapon].include?(wtype_id)) ||
  441.       (is_a?(RPG::Armor) && k[:armor] && k[:armor].include?(atype_id)) ||
  442.       k[:equip].include?(etype_id)) ? i : nil
  443.     end.compact
  444.   end

  445.   # mosaic random generate
  446.   def mosaic_random_generate
  447.     item = Marshal.load Marshal.dump self
  448.     item.instance_exec do
  449.       while (t = Mosaic::NewParamChance[generated_gems.size] +
  450.         $game_party.all_members.flat_map(&:equips).compact.inject(0){|r, item|
  451.         item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][
  452.         :more_params_rate] ? v : 0) }}) && rand < t / 100.0
  453.         param = allowed_params.sample
  454.         break unless param
  455.         level = Mosaic::Params[param][:random_range].to_a.sample
  456.         generated_gems[param] = level
  457.         level.times{ apply_mosaicked_params param }
  458.       end
  459.       self.id = $game_system.new_mosaic_item_id(self) if generated_gems.size > 0
  460.     end
  461.     item
  462.   end

  463.   # quality
  464.   def quality
  465.     generated_gems.size
  466.   end

  467.   # description
  468.   def description
  469.     super + "\n" + gems.map do |gid, level|
  470.       "Lv.#{level} #{Mosaic::Params[gid][:name]}+#{mosaic_effects[gid]}#{
  471.       Mosaic::Params[gid][:percentage] ? '%' : nil}"
  472.     end.join("\n")
  473.   end
  474. end

  475. RPG::EquipItem.send :include, Mosaicked

  476. # Data Manager
  477. class << DataManager

  478.   # init
  479.   alias mosaic_system_init init
  480.   def init
  481.     mosaic_system_init
  482.     (0..7).each{|i| Mosaic::Params[i][:name] = Vocab.param(i)}
  483.     (10..17).each{|i| Mosaic::Params[i][:name] = Vocab.param(i - 10)}
  484.   end
  485. end

  486. # Battle Manager
  487. class << BattleManager

  488.   # gain drop items
  489.   def gain_drop_items
  490.     $game_troop.make_drop_items.each do |item|
  491.       item = item.mosaic_random_generate
  492.       $game_party.gain_item(item, 1)
  493.       $game_message.add(sprintf("\\C[#{Mosaic::EquipColor[item.quality]}]"+
  494.       #Vocab::ObtainItem+"\\C[0]", item.name))
  495.        Vocab::ObtainItem, item.name))
  496.     end
  497.     wait_for_message
  498.   end
  499. end

  500. # Game System
  501. class Game_System

  502.   # initialize
  503.   alias mosaic_system_initialize initialize
  504.   def initialize
  505.     mosaic_system_initialize
  506.     @mosaicked_items = []
  507.   end

  508.   # reader
  509.   def mosaicked_items id
  510.     @mosaicked_items[id - $data_weapons.size - $data_armors.size]
  511.   end

  512.   # new mosaic item id
  513.   def new_mosaic_item_id item
  514.     id = $data_weapons.size + $data_armors.size + @mosaicked_items.size
  515.     item = Marshal.load Marshal.dump item
  516.     item.id = id
  517.     @mosaicked_items.push item
  518.     id
  519.   end
  520. end

  521. # Game BaseItem
  522. class Game_BaseItem

  523.   # object
  524.   def object
  525.     return $data_skills[@item_id]  if is_skill?
  526.     return $data_items[@item_id]   if is_item?
  527.     return $data_weapons[@item_id] || $game_system.mosaicked_items(@item_id) if
  528.     is_weapon?
  529.     return $data_armors[@item_id]  || $game_system.mosaicked_items(@item_id) if
  530.     is_armor?
  531.     return nil
  532.   end
  533. end

  534. # Game Actor
  535. class Game_Actor

  536.   # param plus
  537.   alias mosaic_system_param_plus param_plus
  538.   def param_plus param_id
  539.     equips.compact.inject(mosaic_system_param_plus param_id){|r, item| r +
  540.     (item.mosaic_effects[param_id] || 0) }
  541.   end

  542.   # param rate
  543.   def param_rate param_id
  544.     equips.compact.inject(super){|r, item| r + (item.mosaic_effects[param_id +
  545.     10] || 0) / 100.0 }
  546.   end

  547.   # xparam
  548.   def xparam xparam_id
  549.     equips.compact.inject(super){|r, item| r + (item.mosaic_effects[xparam_id +
  550.     20] || 0) / 100.0 }
  551.   end

  552.   # sparam
  553.   def sparam sparam_id
  554.     [0, equips.compact.inject(super){|r, item| r + (item.mosaic_effects[
  555.     sparam_id + 30] || 0) / 100.0 }].max
  556.   end

  557.   # party ability
  558.   def party_ability ability_id
  559.     super || equips.compact.any?{|item| item.gems.keys.any?{|k| Mosaic::Params[
  560.     k][:party] == ability_id }}
  561.   end

  562.   # atk states
  563.   def atk_states
  564.     a = equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k|
  565.     s << Mosaic::Params[k][:state] }}
  566.     a.delete(-1)
  567.     a.uniq
  568.   end

  569.   # atk states rate
  570.   def atk_states_rate state_id
  571.     equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k| s +
  572.     (Mosaic::Params[k][:state] == state_id ? item.mosaic_effects[k] : 0)/100.0}}
  573.   end

  574.   # apply critical
  575.   def apply_critical value
  576.     super * (100 - equips.compact.inject(0){|r, item|
  577.     item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][
  578.     :decrease_critical] ? v : 0) }}) / 100.0
  579.   end
  580.   
  581.   # action plus set
  582.   def action_plus_set
  583.     equips.compact.inject(super){|r, item| item.mosaic_effects.inject(r){
  584.     |s, (k, v)| s + (Mosaic::Params[k][:action_plus_set] ? (v / 100.0) : 0) }}
  585.   end
  586. end

  587. # Game Enemy
  588. class Game_Enemy

  589.   # apply critical
  590.   def apply_critical value
  591.     super * (100 + $game_party.battle_members.flat_map(&:equips).compact.inject(
  592.     0){|r, item| item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[
  593.     k][:increase_critical] ? v : 0) }}) / 100.0
  594.   end
  595. end

  596. # Game Party
  597. class Game_Party

  598.   # weapons
  599.   def weapons
  600.     @weapons.keys.sort.collect{|id| $data_weapons[id] ||
  601.     $game_system.mosaicked_items(id) }
  602.   end

  603.   # armors
  604.   def armors
  605.     @armors.keys.sort.collect{|id| $data_armors[id] ||
  606.     $game_system.mosaicked_items(id) }
  607.   end
  608. end

  609. # Game Troop
  610. class Game_Troop

  611.   # gold rate
  612.   alias mosaic_system_gold_rate gold_rate
  613.   def gold_rate
  614.     rate = $game_party.members.inject(0) do |r, x|
  615.       r + x.equips.compact.inject(0) do |s, y|
  616.         s + y.mosaic_effects.inject(0) do |t, (k, v)|
  617.           t + (Mosaic::Params[k][:increase_gold] ? v : 0)
  618.         end
  619.       end
  620.     end
  621.     mosaic_system_gold_rate * (1 + rate)
  622.   end
  623. end

  624. # Window Base
  625. class Window_Base

  626.   # draw item name
  627.   def draw_item_name item, x, y, enabled = true, width = 172
  628.     return unless item
  629.     draw_icon item.icon_index, x, y, enabled
  630.     color = item.is_a?(Mosaicked) ? text_color(Mosaic::EquipColor[item.quality])
  631.     : normal_color
  632.     change_color color, enabled
  633.     draw_text x + 24, y, width, line_height, item.name
  634.   end
  635. end

  636. # Mosaic Help Window
  637. class Window_MosaicHelp < Window_Base

  638.   # initialize
  639.   def initialize x, y, width, height
  640.     super
  641.     @text = ""
  642.   end

  643.   # set text
  644.   def set_text text
  645.     return if @text == text
  646.     @text = text
  647.     refresh
  648.   end

  649.   # set item
  650.   def set_item item
  651.     set_text item ? item.description : ""
  652.   end

  653.   # clear
  654.   def clear
  655.     set_text ""
  656.   end

  657.   # refresh
  658.   def refresh
  659.     contents.clear
  660.     draw_text_ex 4, 0, @text
  661.   end
  662.   
  663.   # process character
  664.   def process_character c, text, pos
  665.     case c
  666.     when "\n"
  667.       process_new_line text, pos
  668.     when "\f"
  669.       process_new_page text, pos
  670.     when "\e"
  671.       if text[0] == 'n'
  672.         text.slice! 0, 1
  673.         process_new_line text, pos
  674.       else
  675.         process_escape_character obtain_escape_code(text), text, pos
  676.       end
  677.     else
  678.       process_normal_character c, pos
  679.     end
  680.   end
  681. end

  682. # Mosaic Confirm Window
  683. class Window_MosaicConfirm < Window_Command

  684.   # initialize
  685.   def initialize
  686.     super (Graphics.width - window_width) / 2,
  687.     (Graphics.height - window_height) / 2
  688.     deactivate
  689.     hide
  690.     close
  691.   end

  692.   # window width
  693.   def window_width
  694.     Mosaic::ConfirmWidth
  695.   end

  696.   # visible line number
  697.   def visible_line_number
  698.     Mosaic::ConfirmFormat.size + 1
  699.   end

  700.   # set item
  701.   def set_item equip, g
  702.     text = Mosaic::ConfirmFormat.join(?\n)
  703.     text.gsub! '<equip>', "\\I[#{equip.icon_index}] #{equip.name}"
  704.     text.gsub! '<gem>', "\\I[#{g.icon_index}] #{g.name}"
  705.     text.gsub! '<gold>', "#{$game_party.gold}\\G"
  706.     text.gsub! '<cost>', "#{equip.mosaic_cost(g)}\\G"
  707.     refresh
  708.     draw_text_ex 4, 0, text
  709.   end

  710.   # make command list
  711.   def make_command_list
  712.     add_command Mosaic::ConfirmText, :confirm
  713.     add_command Mosaic::CancelText,  :cancel
  714.   end

  715.   # col max
  716.   def col_max
  717.     2
  718.   end

  719.   # item width
  720.   def item_width
  721.     contents_width / 2 - standard_padding * 2
  722.   end

  723.   # item_rect
  724.   alias mosaic_system_item_rect item_rect
  725.   def item_rect index
  726.     rect = mosaic_system_item_rect index
  727.     rect.y += Mosaic::ConfirmFormat.size * line_height
  728.     rect
  729.   end
  730. end

  731. # Mosaic Gem List Window
  732. class Window_MosaicGemList < Window_ItemList

  733.   # initialize
  734.   def initialze x, y, width, height
  735.     super
  736.     deactivate
  737.     [url=home.php?mod=space&uid=457221]@Filter[/url] = ->(*){}
  738.   end

  739.   # filter
  740.   def filter filter
  741.     @filter = filter
  742.   end

  743.   # include?
  744.   def include? item
  745.     item.is_a?(RPG::Item) && @filter[item]
  746.   end

  747.   # col max
  748.   def col_max
  749.     1
  750.   end

  751.   # enable?
  752.   def enable? item
  753.     !@data.empty?
  754.   end
  755.   
  756.   # activate
  757.   def activate
  758.     super
  759.     self.index = @data.size - 1 if @index > @data.size - 1
  760.   end
  761. end

  762. # Mosaic Equip List Window
  763. class Window_MosaicEquipList < Window_ItemList

  764.   attr_accessor :gem_window

  765.   # update cursor
  766.   def update_cursor
  767.     super
  768.     call_update_gem_window
  769.   end

  770.   # call update gem window
  771.   def call_update_gem_window
  772.     update_gem_window if active && @gem_window
  773.   end

  774.   # update gem window
  775.   def update_gem_window
  776.     @gem_window.filter(item ? item.method(:can_mosaic?) : ->(*){})
  777.     @gem_window.refresh
  778.   end

  779.   # refresh
  780.   def refresh
  781.     super
  782.     call_update_gem_window
  783.     call_update_help
  784.   end

  785.   # include?
  786.   def include? item
  787.     item.is_a?(Mosaicked) && enable?(item)
  788.   end

  789.   # col max
  790.   def col_max
  791.     1
  792.   end

  793.   # enable?
  794.   def enable? item
  795.     item && $game_party.all_items.any?{|i| i.is_a?(RPG::Item) &&
  796.     item.can_mosaic?(i) }
  797.   end
  798. end

  799. # Mosaic Prompt Window
  800. class Window_MosaicPrompt < Window_Base

  801.   # initialize
  802.   def initialize x, y, width, height
  803.     super
  804.     hide
  805.     close
  806.   end

  807.   # prompt
  808.   def prompt text
  809.     show
  810.     open
  811.     @count = 0
  812.     draw_text_ex 4, 0, text
  813.   end

  814.   # update
  815.   def update
  816.     super
  817.     if open?
  818.       @count += 1
  819.       close if @count > Mosaic::PromptCount
  820.     end
  821.   end
  822. end

  823. # Mosaic Scene
  824. class Scene_Mosaic < Scene_Base

  825.   # initialize
  826.   def initialize
  827.     super
  828.     create_background
  829.     create_all_windows
  830.   end

  831.   # create all windows
  832.   def create_all_windows
  833.     create_equip_window
  834.     create_gem_window
  835.     create_help_window
  836.     create_confirm_window
  837.     create_prompt_window
  838.     setup_all_windows
  839.   end

  840.   # create equip window
  841.   def create_equip_window
  842.     @equip_window = Window_MosaicEquipList.new *Mosaic::EquipWindow
  843.   end

  844.   # create gem window
  845.   def create_gem_window
  846.     @gem_window = Window_MosaicGemList.new *Mosaic::GemWindow
  847.     @equip_window.gem_window = @gem_window
  848.   end

  849.   # create help window
  850.   def create_help_window
  851.     @help_window = Window_MosaicHelp.new *Mosaic::HelpWindow
  852.     @equip_window.help_window = @help_window
  853.     @gem_window.help_window = @help_window
  854.   end

  855.   # create confirm window
  856.   def create_confirm_window
  857.     @confirm_window = Window_MosaicConfirm.new
  858.   end

  859.   # create prompt window
  860.   def create_prompt_window
  861.     @prompt_window = Window_MosaicPrompt.new *Mosaic::PromptWindow
  862.   end

  863.   # setup all windows
  864.   def setup_all_windows
  865.     @equip_window.set_handler(:ok,     method(:on_equip_ok))
  866.     @equip_window.set_handler(:cancel, method(:return_scene))
  867.     @gem_window.set_handler(:ok,     method(:on_gem_ok))
  868.     @gem_window.set_handler(:cancel, method(:on_gem_cancel))
  869.     @confirm_window.set_handler(:confirm, method(:on_confirm_ok))
  870.     @confirm_window.set_handler(:cancel, method(:on_confirm_cancel))
  871.     @equip_window.refresh
  872.     @equip_window.activate
  873.     @equip_window.select 0
  874.     @gem_window.select 0
  875.   end

  876.   # on equip ok
  877.   def on_equip_ok
  878.     @equip_window.deactivate
  879.     @gem_window.activate
  880.   end

  881.   # on gem ok
  882.   def on_gem_ok
  883.     @confirm_window.set_item @equip_window.item, @gem_window.item
  884.     @confirm_window.show
  885.     @confirm_window.open
  886.     @gem_window.deactivate
  887.     @confirm_window.activate
  888.   end

  889.   # on gem cancel
  890.   def on_gem_cancel
  891.     @gem_window.deactivate
  892.     @equip_window.activate
  893.   end

  894.   # on confirm ok
  895.   def on_confirm_ok
  896.     equip = @equip_window.item
  897.     gem = @gem_window.item
  898.     if $game_party.gold >= equip.mosaic_cost(gem)
  899.       $game_party.lose_gold equip.mosaic_cost(gem)
  900.       $game_party.lose_item equip, 1
  901.       $game_party.lose_item gem, 1
  902.       equip = Marshal.load Marshal.dump equip
  903.       equip.mosaic gem
  904.       $game_party.gain_item equip, 1
  905.       @prompt_window.prompt Mosaic::MosaicSucceed
  906.       @equip_window.activate
  907.       @equip_window.refresh
  908.       @confirm_window.close
  909.     else
  910.       @prompt_window.prompt Mosaic::MosaicFail
  911.       @confirm_window.activate
  912.     end
  913.   end

  914.   # on confirm cancel
  915.   def on_confirm_cancel
  916.     @confirm_window.deactivate
  917.     @confirm_window.close
  918.     @gem_window.activate
  919.   end

  920.   # create background
  921.   def create_background
  922.     @background_sprite = Sprite.new
  923.     @background_sprite.bitmap = SceneManager.background_bitmap
  924.     @background_sprite.color.set 16, 16, 16, 128
  925.   end

  926.   # terminate
  927.   def terminate
  928.     dispose_background
  929.     super
  930.   end

  931.   # dispose background
  932.   def dispose_background
  933.     @background_sprite.dispose
  934.   end
  935. end

复制代码



装备扩张脚本问题

  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. # ■ RPG::BaseItem
  60. #==============================================================================
  61. class RPG::BaseItem
  62.   #--------------------------------------------------------------------------
  63.   # ● 装備重量の定義(追加定義)
  64.   #--------------------------------------------------------------------------  
  65.   def weight
  66.     cheack_note = @note
  67.     cheack_note.match(/^<装備重量\s?(\d+)>/)
  68.     if $1 == nil
  69.       return 0   
  70.     else
  71.       return type = $1.to_i
  72.     end   
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 装備重量の定義(追加定義)
  76.   #--------------------------------------------------------------------------  
  77.   def gain_weight  
  78.     cheack_note = @note
  79.     cheack_note.match(/^<最大重量増加\s?(\d+)>/)
  80.     if $1 == nil
  81.       return 0   
  82.     else
  83.       return type = $1.to_i
  84.     end  
  85.   end
  86. end

  87. #==============================================================================
  88. # ■ RPG::EquipItem(再定義)
  89. #==============================================================================
  90. class RPG::EquipItem < RPG::BaseItem
  91.   #--------------------------------------------------------------------------
  92.   # ● 装備タイプの定義(再定義)
  93.   #--------------------------------------------------------------------------  
  94.   def etype_id
  95.     if @note != ""
  96.       cheack_note = @note
  97.       cheack_note.match(/^<装備タイプ\s?(\d+)>/)
  98.       if $1 == nil
  99.         return @etype_id   
  100.       else
  101.         return type = $1.to_i
  102.       end
  103.     else
  104.       return @etype_id
  105.     end
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 装備タイプの定義(再定義)
  109.   #--------------------------------------------------------------------------  
  110.   def etype_id=(etype_id)
  111.     @etype_id = etype_id
  112.   end
  113. end

  114. #==============================================================================
  115. # ■ Game_BaseItem(追加定義)
  116. #==============================================================================
  117. class Game_BaseItem
  118.   def id
  119.     @item_id
  120.   end
  121. end

  122. #==============================================================================
  123. # ■ Game_Actor
  124. #==============================================================================
  125. class Game_Actor < Game_Battler
  126.   #--------------------------------------------------------------------------
  127.   # ● 装備スロットの配列を取得(再定義)
  128.   #--------------------------------------------------------------------------
  129.   def equip_slots
  130.     return KURE::ExEquip::EQUIP_SLOT_DUAL if dual_wield?
  131.     return KURE::ExEquip::EQUIP_SLOT  # 通常
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 装備総重量(追加定義)
  135.   #--------------------------------------------------------------------------  
  136.   def all_weight
  137.     weight = 0
  138.       for i in [email]0..@equips.size[/email] - 1
  139.         #オブジェクトが存在している場合
  140.         if @equips[i].object != nil
  141.           if equip_slots[i] == 0
  142.             weight = weight + $data_weapons[@equips[i].id].weight
  143.           else
  144.             weight = weight + $data_armors[@equips[i].id].weight
  145.           end
  146.         end
  147.       end
  148.     return weight
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 重量増加量(追加定義)
  152.   #--------------------------------------------------------------------------  
  153.   def all_gain_weight
  154.     gain_weight = 0
  155.       for i in [email]0..@equips.size[/email] - 1
  156.         #オブジェクトが存在している場合
  157.         if @equips[i].object != nil
  158.           if equip_slots[i] == 0
  159.             gain_weight = gain_weight + $data_weapons[@equips[i].id].gain_weight
  160.           else
  161.             gain_weight = gain_weight + $data_armors[@equips[i].id].gain_weight
  162.           end
  163.         end
  164.       end
  165.     return gain_weight   
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 重量最大量(追加定義)
  169.   #--------------------------------------------------------------------------  
  170.   def max_weight
  171.     max_weight = 0
  172.     #追加重量
  173.     plus_weight = all_gain_weight
  174.     #基礎値
  175.     max_weight = max_weight + plus_weight + KURE::ExEquip::MAX_WEIGHT_BASE + KURE::ExEquip::MAX_WEIGHT_Lv * @level
  176.     #アクター補正
  177.     if KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id] != nil
  178.       max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id]
  179.     end
  180.     #職業補正
  181.     if KURE::ExEquip::MAX_WEIGHT_JOB[@class_id] != nil
  182.       max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_JOB[@class_id]
  183.     end   
  184.     #スキル補正を加算
  185.     for i in 0..KURE::ExEquip::MAX_WEIGHT_SKILL.size-1
  186.       if KURE::ExEquip::MAX_WEIGHT_SKILL[i] != nil
  187.         #スキルを設定していればスキルを保存
  188.         cheack_skill = $data_skills[KURE::ExEquip::MAX_WEIGHT_SKILL[i][0]]
  189.         #念のためnilではないか確認
  190.         if cheack_skill != nil
  191.           #スキルを覚えていれば補正値を加算
  192.           if skill_learn?(cheack_skill)
  193.             if KURE::ExEquip::MAX_WEIGHT_SKILL[i][1] != nil
  194.             max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_SKILL[i][1]
  195.             end
  196.           end  
  197.         end
  198.       end
  199.     end
  200.     return max_weight
  201.   end
  202. end

  203. #==============================================================================
  204. # ■ Scene_Equip(再定義)
  205. #------------------------------------------------------------------------------
  206. #  装備画面の処理を行うクラスです。
  207. #==============================================================================
  208. class Scene_Equip < Scene_MenuBase
  209.   #--------------------------------------------------------------------------
  210.   # ● 開始処理
  211.   #--------------------------------------------------------------------------
  212.   def start
  213.     super
  214.     @max_weight = @actor.max_weight
  215.    
  216.     create_help_window
  217.     create_small_status_window
  218.     create_command_window
  219.     create_slot_window
  220.     create_status_window
  221.     create_item_window
  222.    
  223.     @save_item = 0
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● コマンドウィンドウの作成
  227.   #--------------------------------------------------------------------------
  228.   def create_command_window
  229.     @command_window = Window_Ex_EquipCommand.new(0,@help_window.height + @small_status_window.height, @small_status_window.width)
  230.     @command_window.viewport = @viewport
  231.     @command_window.help_window = @help_window
  232.     @command_window.set_handler(:equip,    method(:command_equip))
  233.     @command_window.set_handler(:optimize, method(:command_optimize))
  234.     @command_window.set_handler(:clear,    method(:command_clear))
  235.     @command_window.set_handler(:cancel,   method(:return_scene))
  236.     @command_window.set_handler(:pagedown, method(:next_actor))
  237.     @command_window.set_handler(:pageup,   method(:prev_actor))
  238.     @command_window.activate
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● スロットウィンドウの作成
  242.   #--------------------------------------------------------------------------
  243.   def create_slot_window
  244.     @slot_window = Window_Ex_EquipSlot.new(0, @command_window.height + @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120)
  245.     @slot_window.viewport = @viewport
  246.     @slot_window.help_window = @help_window
  247.     @slot_window.status_window = @status_window
  248.     @slot_window.actor = @actor
  249.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  250.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  251.     @slot_window.set_handler(:pagedown, method(:next_actor))
  252.     @slot_window.set_handler(:pageup,   method(:prev_actor))
  253.     @slot_window.deactivate
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● ステータスウィンドウの作成
  257.   #--------------------------------------------------------------------------
  258.   def create_status_window
  259.     @status_window = Window_Ex_EquipStatus.new(@slot_window.width, @help_window.height,Graphics.width - @slot_window.width,Graphics.height - @help_window.height)
  260.     @status_window.viewport = @viewport
  261.     @status_window.actor = @actor
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● ステータスウィンドウの作成
  265.   #--------------------------------------------------------------------------
  266.   def create_small_status_window
  267.     @small_status_window = Window_Equip_Small_Status.new(0,@help_window.height,305,120)
  268.     @small_status_window.viewport = @viewport
  269.     @small_status_window.weight = @actor.all_weight
  270.     @small_status_window.max_weight = @max_weight
  271.     @small_status_window.refresh
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● アイテムウィンドウの作成
  275.   #--------------------------------------------------------------------------
  276.   def create_item_window
  277.     @item_window = Window_Ex_EquipItem.new(0,@command_window.height +  @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120)
  278.     @item_window.viewport = @viewport
  279.     @item_window.help_window = @help_window
  280.     @item_window.status_window = @status_window
  281.     @item_window.actor = @actor
  282.     @item_window.set_handler(:ok,     method(:on_item_ok))
  283.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  284.     @slot_window.item_window = @item_window
  285.     @item_window.visible = false
  286.     @item_window.weight = @actor.all_weight
  287.     @item_window.max_weight = @max_weight
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● フレーム更新
  291.   #--------------------------------------------------------------------------
  292.   def update
  293.     update_basic
  294.     update_ex_status_window
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● フレーム更新
  298.   #--------------------------------------------------------------------------
  299.   def update_ex_status_window
  300.     if @item_window.visible == true
  301.       if  @item_window.item != @save_item
  302.         @save_item = @item_window.item
  303.         temp_actor = Marshal.load(Marshal.dump(@actor))
  304.         temp_actor.force_change_equip(@item_window.slot_id, @save_item)
  305.         @status_window.set_temp_actor(temp_actor)
  306.         @status_window.set_select_item2(@save_item)
  307.         @status_window.refresh
  308.       end
  309.     end
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● コマンド[装備変更]
  313.   #--------------------------------------------------------------------------
  314.   def command_equip
  315.     slot_window_set_focus
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● コマンド[全て外す]
  319.   #--------------------------------------------------------------------------
  320.   def command_clear
  321.     Sound.play_equip
  322.     @actor.clear_equipments
  323.     @status_window.refresh
  324.     @slot_window.refresh
  325.     @command_window.activate
  326.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  327.       update_weight     
  328.     end
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● スロット[決定]
  332.   #--------------------------------------------------------------------------
  333.   def on_slot_ok
  334.     @save_item = 0
  335.     @slot_window.visible = false
  336.     @item_window.visible = true
  337.     @status_window.draw_index = 1
  338.     @status_window.set_select_item(@slot_window.index)
  339.    
  340.     #装備アイテムがあれば重量を渡す
  341.     if @actor.equips[@slot_window.index] != nil
  342.       @item_window.chage_item_weight = @actor.equips[@slot_window.index].weight
  343.       @item_window.chaged_item_gain_weight = @actor.equips[@slot_window.index].gain_weight
  344.     else
  345.       @item_window.chage_item_weight = 0
  346.       @item_window.chaged_item_gain_weight = 0
  347.     end
  348.     update_weight
  349.    
  350.     @item_window.refresh
  351.     @slot_window.deactivate
  352.     @item_window.activate
  353.     @item_window.select(0)
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● スロット[キャンセル]
  357.   #--------------------------------------------------------------------------
  358.   def on_slot_cancel
  359.     @slot_window.unselect
  360.     @slot_window.deactivate
  361.     @command_window.activate
  362.     @command_window.select(0)
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● アイテム[決定]
  366.   #--------------------------------------------------------------------------
  367.   def on_item_ok
  368.     Sound.play_equip
  369.     index = @slot_window.index
  370.     @actor.change_equip(@slot_window.index, @item_window.item)
  371.    
  372.     #二刀流両手剣問題対応
  373.     if @actor.dual_wield?
  374.       if @slot_window.index == 0
  375.         @actor.change_equip(1, nil) if @actor.features_set(54).include?(1)
  376.       elsif @slot_window.index == 1
  377.         @actor.change_equip(0, nil) if @actor.features_set(54).include?(1)
  378.       end
  379.     end
  380.   
  381.     @item_window.chaged_item_gain_weight = 0
  382.     @status_window.draw_index = 0
  383.     slot_window_set_focus
  384.     delete_plus_status
  385.     @slot_window.index = index
  386.     update_weight
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● アイテム[キャンセル]
  390.   #--------------------------------------------------------------------------
  391.   def on_item_cancel
  392.     @status_window.draw_index = 0
  393.     index = @slot_window.index
  394.     slot_window_set_focus
  395.     @slot_window.index = index
  396.     delete_plus_status
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● アクターの切り替え
  400.   #--------------------------------------------------------------------------
  401.   def on_actor_change
  402.     update_weight   
  403.     @status_window.actor = @actor
  404.     @slot_window.actor = @actor
  405.     @item_window.actor = @actor
  406.     @command_window.activate
  407.     @command_window.select(0)
  408.     @slot_windowdeactivate
  409.     @slot_window.unselect
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● ステータスウィンドウ項目消去
  413.   #--------------------------------------------------------------------------
  414.   def delete_plus_status
  415.     @status_window.set_temp_actor(nil)
  416.     @status_window.set_select_item(nil)
  417.     @status_window.set_select_item2(nil)
  418.     @status_window.refresh   
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● スロットウィンドウにカーソルセット
  422.   #--------------------------------------------------------------------------
  423.   def slot_window_set_focus
  424.     @item_window.visible = false
  425.     @item_window.unselect
  426.     @item_window.refresh
  427.    
  428.     @slot_window.visible = true
  429.     @slot_window.activate
  430.     @slot_window.select(0)
  431.     @slot_window.refresh
  432.    
  433.     @command_window.unselect
  434.     @command_window.deactivate
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 装備重量更新
  438.   #--------------------------------------------------------------------------  
  439.   def update_weight
  440.     @max_weight = @actor.max_weight
  441.     @small_status_window.weight = @actor.all_weight
  442.     @small_status_window.max_weight = @max_weight
  443.     @item_window.weight = @actor.all_weight
  444.     @item_window.max_weight = @max_weight
  445.     @small_status_window.refresh     
  446.   end
  447. end

  448. #==============================================================================
  449. # ■ Window_Ex_EquipSlot
  450. #==============================================================================
  451. class Window_Ex_EquipSlot < Window_EquipSlot
  452.   #--------------------------------------------------------------------------
  453.   # ● 公開インスタンス変数
  454.   #--------------------------------------------------------------------------
  455.   attr_reader   :status_window            # ステータスウィンドウ
  456.   attr_reader   :item_window              # アイテムウィンドウ
  457.   #--------------------------------------------------------------------------
  458.   # ● オブジェクト初期化
  459.   #--------------------------------------------------------------------------
  460.   def initialize(x, y, width, height)
  461.     @height = height
  462.     super(x, y, width)
  463.     @actor = nil
  464.     refresh
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● ウィンドウ高さの取得
  468.   #--------------------------------------------------------------------------
  469.   def window_height
  470.     return @height
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 項目の描画
  474.   #--------------------------------------------------------------------------
  475.   def draw_item(index)
  476.     return unless @actor
  477.     rect = item_rect_for_text(index)
  478.     change_color(system_color, enable?(index))
  479.     if @actor.equip_slots[index] <= 4
  480.       draw_text(rect.x, rect.y, 75, line_height, slot_name(index))
  481.     else
  482.       draw_index = KURE::ExEquip::EQUIP_SLOT[index]
  483.       draw_text(rect.x, rect.y, 75, line_height, KURE::ExEquip::EQUIP_SLOT_NAME[draw_index-5])      
  484.     end  
  485.     draw_item_name(@actor.equips[index], rect.x + 75, rect.y, enable?(index))
  486.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  487.       if @actor.equips[index] != nil
  488.         if @actor.equips[index].gain_weight != 0
  489.           change_color(power_up_color)
  490.           draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].gain_weight.to_s,2)         
  491.         else
  492.           if KURE::ExEquip::WEIGHT_0_ITEM == 1
  493.             if @actor.equips[index].weight != 0
  494.               change_color(power_down_color)
  495.               draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2)
  496.             end
  497.           else
  498.             change_color(power_down_color)
  499.             draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2)
  500.           end
  501.         end
  502.       end
  503.     end
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● リフレッシュ
  507.   #--------------------------------------------------------------------------
  508.   def refresh
  509.     #フォントの設定
  510.     last_font = contents.font.size
  511.     contents.font.size = 20
  512.    
  513.     contents.clear
  514.     create_contents
  515.     draw_all_items
  516.    
  517.     #フォントを戻す
  518.     contents.font.size = last_font
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ● ヘルプテキスト更新
  522.   #--------------------------------------------------------------------------
  523.   def update_help
  524.     @help_window.clear
  525.     @help_window.set_item(item) if @help_window
  526.   end
  527. end


  528. #==============================================================================
  529. # ■ Window_Ex_EquipItem
  530. #==============================================================================
  531. class Window_Ex_EquipItem < Window_EquipItem
  532.   attr_reader   :status_window
  533.   attr_accessor :weight
  534.   attr_accessor :max_weight
  535.   attr_accessor :chage_item_weight
  536.   attr_accessor :chaged_item_gain_weight
  537.   #--------------------------------------------------------------------------
  538.   # ● オブジェクト初期化
  539.   #--------------------------------------------------------------------------
  540.   def initialize(x, y, width, height)
  541.     super(x, y, width, height)
  542.     @weight = 0
  543.     @max_weight = 0
  544.     @chage_item_weight = 0
  545.     @chaged_item_gain_weight = 0
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● 桁数の取得
  549.   #--------------------------------------------------------------------------
  550.   def col_max
  551.     return 1
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # ● →キー入力時動作
  555.   #--------------------------------------------------------------------------
  556.   def cursor_right(wrap = false)
  557.     if @status_window.draw_index == 1
  558.       @status_window.draw_index = 2
  559.     else
  560.       @status_window.draw_index = 1
  561.     end
  562.     @status_window.refresh
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● ←キー入力時操作
  566.   #--------------------------------------------------------------------------
  567.   def cursor_left(wrap = false)
  568.     if @status_window.draw_index == 1
  569.       @status_window.draw_index = 2
  570.     else
  571.       @status_window.draw_index = 1
  572.     end
  573.     @status_window.refresh
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● アイテムを許可状態で表示するかどうか
  577.   #--------------------------------------------------------------------------
  578.   def enable?(item)
  579.     #重量システムを利用時だけ判定を行う
  580.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  581.       #アイテムが存在する時
  582.       if item !=nil
  583.         #総重量
  584.         total_weight = item.weight + @weight - @chage_item_weight
  585.         if total_weight > @max_weight - @chaged_item_gain_weight
  586.           return false
  587.         else
  588.           return true
  589.         end
  590.       else
  591.         if @weight > @max_weight - @chaged_item_gain_weight
  592.           return false
  593.         else
  594.           return true
  595.         end
  596.       end
  597.     end
  598.    
  599.     #重量システム非利用時であればtureを返す
  600.     return true
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 桁数の取得
  604.   #--------------------------------------------------------------------------
  605.   def slot_id
  606.     return @slot_id
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● ヘルプテキスト更新
  610.   #--------------------------------------------------------------------------
  611.   def update_help
  612.     @help_window.set_item(item)
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● 項目の描画
  616.   #--------------------------------------------------------------------------
  617.   def draw_item(index)
  618.     item = @data[index]
  619.     if item
  620.       rect = item_rect(index)
  621.       rect.width -= 4
  622.       draw_item_name(item, rect.x, rect.y, enable?(item))
  623.       draw_item_number(rect, item)
  624.       
  625.       #重量システムを利用時は重量を表示する
  626.       if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  627.         if item.gain_weight != 0
  628.           change_color(power_up_color)
  629.           draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.gain_weight.to_s,2)         
  630.         else
  631.           #重量0をチェック
  632.           if KURE::ExEquip::WEIGHT_0_ITEM == 1
  633.             if item.weight != 0
  634.               change_color(power_down_color)
  635.               draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2)
  636.             end
  637.           else
  638.             change_color(power_down_color)
  639.             draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2)
  640.           end
  641.         end
  642.       end
  643.       
  644.     end
  645.   end
  646. end

  647. #==============================================================================
  648. # ■ Window_Small_Status
  649. #------------------------------------------------------------------------------
  650. #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
  651. #==============================================================================
  652. class Window_Equip_Small_Status < Window_Selectable
  653.   #--------------------------------------------------------------------------
  654.   # ● 公開インスタンス変数
  655.   #--------------------------------------------------------------------------
  656.   attr_reader   :pending_index            # 保留位置(並び替え用)
  657.   attr_accessor :weight
  658.   attr_accessor :max_weight
  659.   #--------------------------------------------------------------------------
  660.   # ● オブジェクト初期化
  661.   #--------------------------------------------------------------------------
  662.   def initialize(x, y,width,height)
  663.     super(x, y, width, height)
  664.     refresh
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 項目の描画
  668.   #--------------------------------------------------------------------------
  669.   def draw_status
  670.     @actor = $game_party.menu_actor
  671.     draw_actor_face(@actor, 0, 0)
  672.     draw_actor_name(@actor, 130, line_height * 0)
  673.     draw_actor_icons(@actor, 230-50, line_height * 0)
  674.     draw_actor_hp(@actor, 130, line_height * 1)
  675.     draw_actor_mp(@actor, 130, line_height * 2)
  676.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1
  677.       if @max_weight != nil
  678.         draw_actor_weight(@actor, 130, line_height * 3)
  679.       end
  680.     end
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # ● 装備重量の描画
  684.   #--------------------------------------------------------------------------
  685.   def draw_actor_weight(actor, x, y, width = 124)
  686.     weight_rate = @weight.to_f / @max_weight
  687.     draw_gauge(x, y, width, weight_rate, tp_gauge_color1, tp_gauge_color2)
  688.     change_color(system_color)
  689.     draw_text(x, y, 30, line_height, KURE::ExEquip::WEIGHT_NAME)
  690.     draw_current_and_max_values(x, y, width, @weight, @max_weight,
  691.     mp_color(actor), normal_color)
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● リフレッシュ
  695.   #--------------------------------------------------------------------------
  696.   def refresh
  697.     contents.clear
  698.     draw_status
  699.   end
  700. end

  701. #==============================================================================
  702. # ■ Window_Ex_EquipStatus
  703. #------------------------------------------------------------------------------
  704. #  装備画面で、アクターの能力値変化を表示するウィンドウです。
  705. #==============================================================================
  706. class Window_Ex_EquipStatus < Window_EquipStatus
  707.   attr_accessor :draw_index
  708.   #--------------------------------------------------------------------------
  709.   # ◎ オブジェクト初期化
  710.   #--------------------------------------------------------------------------
  711.   def initialize(x, y,width,height)
  712.     @draw_index = 0
  713.     @width = width
  714.     @height = height
  715.     super(x, y)
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ◎ ウィンドウ幅の取得
  719.   #--------------------------------------------------------------------------
  720.   def window_width
  721.     return @width
  722.   end
  723.   #--------------------------------------------------------------------------
  724.   # ◎ ウィンドウ高さの取得
  725.   #--------------------------------------------------------------------------
  726.   def window_height
  727.     return @height
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ◎ リフレッシュ
  731.   #--------------------------------------------------------------------------
  732.   def refresh
  733.     contents.clear
  734.     #フォントの設定
  735.     last_font = contents.font.size
  736.     contents.font.size = 20
  737.    
  738.     draw_gauge(5,0, contents.width, 1, mp_gauge_color2,crisis_color)
  739.     change_color(normal_color)
  740.    
  741.     case @draw_index
  742.     when 0,1
  743.       draw_text(5, 0, 126, contents.font.size, "能力属性栏")   
  744.       draw_equip_befor(5,line_height * 1)
  745.       draw_right_arrow(0, line_height * 2)
  746.       draw_equip_after(65,line_height * 2)
  747.     when 2
  748.       draw_text(5, 0, 126, contents.font.size, "装备属性")
  749.       draw_equip_after(5,line_height * 1)
  750.     end
  751.       
  752.     case @draw_index
  753.     when 0,1   
  754.       11.times {|i| draw_item(0, line_height * 2 + contents.font.size * (1 + i), i) }
  755.     when 2
  756.       draw_features(5,line_height * 2)
  757.     end
  758.    
  759.     case @draw_index
  760.     when 1,2     
  761.       change_color(normal_color)
  762.       draw_text(0, line_height * 12, contents.width, contents.font.size, "",1)
  763.     end
  764.     contents.font.size = last_font
  765.   end
  766.   #--------------------------------------------------------------------------
  767.   # ◎ 装備変更のアイテム表示
  768.   #--------------------------------------------------------------------------
  769.   def draw_equip_befor(x,y)
  770.     return unless @actor
  771.     if @base_item_index != nil
  772.       draw_item_name(@actor.equips[@base_item_index], x, y)
  773.     end
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ◎ 装備変更のアイテム表示
  777.   #--------------------------------------------------------------------------
  778.   def draw_equip_after(x,y)
  779.     return unless @actor
  780.     if @change_item != nil
  781.       draw_item_name(@change_item, x, y)
  782.     end
  783.   end
  784.   #--------------------------------------------------------------------------
  785.   # ◎ 装備アイテム描画の変数を設定
  786.   #--------------------------------------------------------------------------
  787.   def set_select_item(index)
  788.     return if @base_item_index == index
  789.     @base_item_index = index
  790.     refresh
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # ◎ 変更装備アイテムの変数を設定
  794.   #--------------------------------------------------------------------------
  795.   def set_select_item2(index)
  796.     return if @change_item == index
  797.     @change_item = index
  798.     refresh
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ◎ 項目の描画
  802.   #--------------------------------------------------------------------------
  803.   def draw_item(x, y, param_id)
  804.     case param_id
  805.     when 0,1,2,3,4,5,6,7
  806.       draw_param_name(x + 4, y, param_id)
  807.       draw_current_param(x + 84+20, y, param_id) if @actor
  808.       draw_right_arrow(x + 116, y)
  809.       draw_new_param(x + 140+ 140, y, param_id) if @temp_actor
  810.       
  811.       if KURE::ExEquip::VIEW_EQUIP_STATUS == 1
  812.         change_color(param_change_color(@change_item.params[param_id])) if @change_item
  813.         draw_text(x + 172, y, 40, line_height, @change_item.params[param_id], 2) if @change_item
  814.       end
  815.       
  816.     when 8,9,10
  817.       value = 0
  818.       value2 = 0
  819.       value = (@actor.xparam(param_id - 8) * 100).to_i if @actor
  820.       value2 = (@temp_actor.xparam(param_id - 8) * 100).to_i  if @temp_actor
  821.       change_color(system_color)
  822.       draw_text(x + 4, y, 80, line_height, KURE::ExEquip::Vocab_Ex1[param_id - 8])
  823.       change_color(normal_color)
  824.       draw_text(x + 84+30, y, 32, line_height, value, 2) if @actor
  825.       draw_right_arrow(x + 116, y)
  826.       change_color(param_change_color(value2 - value)) if @temp_actor
  827.       draw_text(x + 140+ 140, y, 32, line_height, value2, 2) if @temp_actor
  828.       
  829.       if KURE::ExEquip::VIEW_EQUIP_STATUS == 1
  830.         change_color(param_change_color(value2 - value))
  831.         draw_text(x + 172, y, 40, line_height, value2 - value, 2) if @change_item
  832.       end
  833.       
  834.     end
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ◎ 特徴の描画
  838.   #--------------------------------------------------------------------------
  839.   def draw_features(x,y)
  840.     return if @change_item == nil
  841.     #特徴を描画
  842.     change_color(system_color)
  843.     draw_text(5, y, 126, contents.font.size, "属性特效")
  844.    
  845.     #配列数取得変数を初期化
  846.     features_max = 0
  847.     #描画用配列を作成
  848.     draw_list = Array.new(100)
  849.     #配列用カウンターをセット
  850.     @draw_counter = 0
  851.     #装備品が有れば特徴最大数を取得
  852.     features_max = @change_item.features.size - 1

  853.       #項目をチェックして描画用配列に入れる
  854.       for l in 0..features_max
  855.          
  856.         #攻撃属性がある場合
  857.         if @change_item.features[l].code == 31
  858.           draw_str  = $data_system.elements[@change_item.features[l].data_id]
  859.           draw_list[@draw_counter] = draw_str + "属性 "
  860.           @draw_counter += 1
  861.         end
  862.          
  863.         #属性耐性がある場合
  864.         if @change_item.features[l].code == 11
  865.           #属性名取得
  866.           draw_str = $data_system.elements[@change_item.features[l].data_id]+ "耐性"
  867.           value = 100 - (@change_item.features[l].value * 100).to_i
  868.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  869.           @draw_counter += 1
  870.         end
  871.         
  872.         #弱体有効度がある場合
  873.         if @change_item.features[l].code == 12
  874.           #属性名取得
  875.           draw_str = "耐"+Vocab::param(@change_item.features[l].data_id)+ "减少"
  876.           value = 100 - (@change_item.features[l].value * 100).to_i
  877.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  878.           @draw_counter += 1
  879.         end         
  880.          
  881.         #ステート耐性がある場合
  882.         if @change_item.features[l].code == 13
  883.           #ステート名取得
  884.           draw_str = $data_states[@change_item.features[l].data_id].name + "耐性"
  885.           value = 100 - (@change_item.features[l].value * 100).to_i
  886.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  887.           @draw_counter += 1
  888.         end
  889.          
  890.         #ステート無効化がある場合
  891.         if @change_item.features[l].code == 14
  892.           #ステート名取得
  893.           draw_str = $data_states[@change_item.features[l].data_id].name
  894.           draw_list[@draw_counter] = draw_str + "无效 "
  895.           @draw_counter += 1
  896.         end         
  897.       
  898.         #通常能力値判定がある場合
  899.         if @change_item.features[l].code == 21
  900.           #ステータス名取得
  901.           draw_str = Vocab::param(@change_item.features[l].data_id)
  902.           value = (@change_item.features[l].value * 100).to_i - 100
  903.             if value > 0
  904.               value = "+" + value.to_s
  905.             end            
  906.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  907.           @draw_counter += 1
  908.         end
  909.          
  910.         #通常能力値判定がある場合
  911.         if @change_item.features[l].code == 22
  912.           #ステータス名取得
  913.           draw_str = @change_item.features[l].data_id
  914.           case draw_str
  915.           when 0
  916.             draw_str = "命中率"
  917.           when 1
  918.             draw_str = "回避率"
  919.           when 2
  920.             draw_str = "会心率"
  921.           when 3
  922.             draw_str = "会心回避"            
  923.           when 4
  924.             draw_str = "兵法回避"
  925.           when 5
  926.             draw_str = "兵法反射"
  927.           when 6
  928.             draw_str = "反击率"
  929.           when 7
  930.             draw_str = "每回合兵力回复"
  931.           when 8
  932.             draw_str = "每回合谋点回复"
  933.           when 9
  934.             draw_str = "每回合气力回复"
  935.           end
  936.           value = (@change_item.features[l].value * 100).to_i
  937.             if value > 0
  938.               value = "+" + value.to_s
  939.             end            
  940.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  941.           @draw_counter += 1
  942.         end

  943.         #特殊能力値判定がある場合
  944.         if @change_item.features[l].code == 23
  945.           #ステート名取得
  946.           draw_str = @change_item.features[l].data_id
  947.           case draw_str
  948.           when 0
  949.             draw_str = "被打几率"
  950.           when 1
  951.             draw_str = "防御効果"
  952.           when 2
  953.             draw_str = "回复效果"
  954.           when 3
  955.             draw_str = "药草知识"
  956.           when 4
  957.             draw_str = "谋点消费率"
  958.           when 5
  959.             draw_str = "气力增加率"
  960.           when 6
  961.             draw_str = "受物理伤害"
  962.           when 7
  963.             draw_str = "受兵法伤害"
  964.           when 8
  965.             draw_str = "受地图伤害"
  966.           when 9
  967.             draw_str = "经验值"
  968.           end
  969.           value = (@change_item.features[l].value * 100).to_i - 100
  970.             if value > 0
  971.               value = "+" + value.to_s
  972.             end            
  973.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  974.           @draw_counter += 1
  975.         end

  976.         #攻撃時ステート判定がある場合
  977.         if @change_item.features[l].code == 32
  978.           #ステート名取得
  979.           draw_str = $data_states[@change_item.features[l].data_id].name + "追加"
  980.           value = (@change_item.features[l].value * 100).to_i
  981.           draw_list[@draw_counter] = draw_str + value.to_s + "% "
  982.           @draw_counter += 1
  983.         end
  984.          
  985.         #攻撃追加がある場合
  986.         if @change_item.features[l].code == 34
  987.           #攻撃回数を取得
  988.           value = (@change_item.features[l].value + 1).to_i
  989.           draw_list[@draw_counter] = value.to_s + "回攻击 "
  990.           @draw_counter += 1
  991.         end
  992.          
  993.         #スキルタイプ追加がある場合
  994.         if @change_item.features[l].code == 41
  995.           #項目を取得
  996.           value = $data_system.skill_types[@change_item.features[l].data_id]
  997.           draw_list[@draw_counter] = value + "可使用 "
  998.           @draw_counter += 1
  999.         end  
  1000.          
  1001.         #スキルタイプ削除がある場合
  1002.         if @change_item.features[l].code == 42
  1003.           #項目を取得
  1004.           value = $data_system.skill_types[@change_item.features[l].data_id]
  1005.           draw_list[@draw_counter] = value + "使用不可 "
  1006.           @draw_counter += 1
  1007.         end

  1008.         #スキル追加がある場合
  1009.         if @change_item.features[l].code == 43
  1010.           #項目を取得
  1011.           value = $data_skills[@change_item.features[l].data_id].name
  1012.           draw_list[@draw_counter] = "“" +value + "”可使用 "
  1013.           @draw_counter += 1
  1014.         end
  1015.          
  1016.         #スキル削除がある場合
  1017.         if @change_item.features[l].code == 44
  1018.           #項目を取得
  1019.           value = $data_skills[@change_item.features[l].data_id].name
  1020.           draw_list[@draw_counter] = "“" +value + "”不可使用 "
  1021.           @draw_counter += 1
  1022.         end
  1023.          
  1024.         #行動追加がある場合
  1025.         if @change_item.features[l].code == 61
  1026.           #項目を取得
  1027.           value = (@change_item.features[l].value * 100).to_i
  1028.           draw_list[@draw_counter] = "追加行动"+ value.to_s + "% "
  1029.           @draw_counter += 1
  1030.         end         
  1031.          
  1032.         #特殊フラグがある場合
  1033.         if @change_item.features[l].code == 62
  1034.           #項目を取得
  1035.           value = @change_item.features[l].data_id
  1036.           case value
  1037.           when 0
  1038.             value = "自动战斗"
  1039.           when 1
  1040.             value = "自动防御"
  1041.           when 2
  1042.             value = "自动援护"
  1043.           when 3
  1044.             value = "TP持越"
  1045.           end
  1046.           draw_list[@draw_counter] = value
  1047.           @draw_counter += 1
  1048.         end  
  1049.          
  1050.         #パーティー能力がある場合
  1051.         if @change_item.features[l].code == 64
  1052.           #項目を取得
  1053.           value = @change_item.features[l].data_id
  1054.           case value
  1055.           when 0
  1056.             value = "遇敌率↓"
  1057.           when 1
  1058.             value = "遇敌率0"
  1059.           when 2
  1060.             value = "不会被偷袭"
  1061.           when 3
  1062.             value = "偷袭率上升"
  1063.           when 4
  1064.             value = "金钱双倍"              
  1065.           when 5
  1066.             value = "掉宝双倍"              
  1067.           when 6
  1068.           end
  1069.           draw_list[@draw_counter] = value
  1070.           @draw_counter += 1
  1071.         end
  1072.       end

  1073.       #実際の描画処理
  1074.       for j in 0..@draw_counter
  1075.         if draw_list[j] != nil or 0
  1076.           case j
  1077.           when 0..10
  1078.             change_color(normal_color)            
  1079.             draw_text(x, y + contents.font.size * (j + 1) , contents.width / 2, contents.font.size, draw_list[j])
  1080.           when 11..21
  1081.             change_color(normal_color)            
  1082.             draw_text(x + contents.width / 2, y + contents.font.size * (j - 10) , contents.width / 2, contents.font.size, draw_list[j])
  1083.           end
  1084.         end
  1085.       end      
  1086.    
  1087.   end
  1088. end

  1089. #==============================================================================
  1090. # ■ Window_Ex_EquipCommand
  1091. #------------------------------------------------------------------------------
  1092. #  スキル画面で、コマンド(装備変更、最強装備など)を選択するウィンドウです。
  1093. #==============================================================================
  1094. class Window_Ex_EquipCommand < Window_HorzCommand
  1095.   #--------------------------------------------------------------------------
  1096.   # ● オブジェクト初期化
  1097.   #--------------------------------------------------------------------------
  1098.   def initialize(x, y, width)
  1099.     @window_width = width
  1100.     super(x, y)
  1101.   end
  1102.   #--------------------------------------------------------------------------
  1103.   # ● ウィンドウ幅の取得
  1104.   #--------------------------------------------------------------------------
  1105.   def window_width
  1106.     @window_width
  1107.   end
  1108.   #--------------------------------------------------------------------------
  1109.   # ● 桁数の取得
  1110.   #--------------------------------------------------------------------------
  1111.   def col_max
  1112.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0
  1113.       return 3
  1114.     else
  1115.       return 2
  1116.     end
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ● コマンドリストの作成
  1120.   #--------------------------------------------------------------------------
  1121.   def make_command_list
  1122.     add_command(Vocab::equip2,   :equip)
  1123.     if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0
  1124.       add_command(Vocab::optimize, :optimize)
  1125.     end
  1126.     add_command(Vocab::clear,    :clear)
  1127.   end
  1128. end

复制代码
QQ图片20170429210118.png
梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

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

使用道具 举报

梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

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

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

点评

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

使用道具 举报

梦石
0
星屑
34511
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 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 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

 楼主| 发表于 2017-4-29 22:45:28 | 显示全部楼层
devil033 发表于 2017-4-29 21:27
根据目前的经验,表示参不透

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

Project2.rar

1.44 MB, 下载次数: 141

回复

使用道具 举报

梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

 楼主| 发表于 2017-4-29 22:48:53 | 显示全部楼层
本帖最后由 devil033 于 2017-4-29 22:54 编辑
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167


确认装备后报另外一个错
QQ图片20170429224756.png

点评

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

使用道具 举报

梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

 楼主| 发表于 2017-4-29 23:07:17 | 显示全部楼层
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167

照葫芦画瓢,把147至153

  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
复制代码


改为

  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
回复

使用道具 举报

梦石
0
星屑
7650
在线时间
1162 小时
注册时间
2016-9-10
回帖
145

开拓者

 楼主| 发表于 2017-5-1 00:18:47 | 显示全部楼层
好尴尬,这问题还有没有机会再抢救一下
回复

使用道具 举报

梦石
0
星屑
1877
在线时间
220 小时
注册时间
2018-8-5
回帖
75
发表于 2019-2-18 21:37:54 | 显示全部楼层
挖个坟  那个箭头能不能往右移动些
一点一点加油
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部