| 
 
| 赞 | 4 |  
| VIP | 71 |  
| 好人卡 | 22 |  
| 积分 | 7 |  
| 经验 | 32145 |  
| 最后登录 | 2013-8-9 |  
| 在线时间 | 184 小时 |  
 Lv2.观梦者 天仙 
	梦石0 星屑680 在线时间184 小时注册时间2008-4-15帖子5023 
 | 
| 算了,帮你写一个吧 
 
 复制代码class RPG::BaseItem
  def get_atk
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[ATK*(.*)\]/i
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return nil
  end
  
  def get_def
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[DEF*(.*)\]/i
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return nil
  end
  
  def get_agi
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[AGI*(.*)\]/i
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return nil
  end
  
  def get_spi
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[SPI*(.*)\]/i
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return nil
  end
  
end
class RPG::Weapon < RPG::BaseItem
  def atk
    return @atk + get_atk.to_i
  end
  
  def def
    return @def + get_def.to_i
  end
  
  def agi
    return @agi + get_agi.to_i
  end
  
  def spi
    return @spi + get_spi.to_i
  end
end
class RPG::Armor < RPG::BaseItem
  def atk
    return @atk + get_atk.to_i
  end
  
  def def
    return @def + get_def.to_i
  end
  
  def agi
    return @agi + get_agi.to_i
  end
  
  def spi
    return @spi + get_spi.to_i
  end
end
 在武器/防具的备注里写下
 [atk n] n 为加值的攻击力
 也就是说,原本数据库内设置的为3, 备注里设置为[atk 500]
 则该武器总攻击力为 503
 以同理设置防御力、精神力、敏捷度(def, spi, agi)
 
 经测试後,可破限至最大999(应该是角色能力值未用破限脚本的原因)
 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
 | 
 |