以下引用snstar2006于2008-8-14 10:53:27的发言:
class RPG::Weapon < RPG::BaseItem
def mdfpl
self.note.mplit(/[\r\n]+/).each { |line|
if line =~ /\[抗性 \d+\]/
a = line.mplit(/ /)[1]
d = ""
while ((c = a.slice!(/./m)) != nil)
d += c if c.is_a?(Integer)
end
end
}
return d ? d.to_i : nil
end
end
之後就能使用 $data_weapons[N].mdfpl来获取该值了
以下引用snstar2006于2008-8-16 0:07:55的发言:
class RPG::Weapon < RPG::BaseItem
def mdfpl
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[抗性 (\d+)\]/
}
return m
end
end
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |