# 用法示例:$game_troop.members.first.atk = 500
# 一旦赋值即覆盖原属性,慎用!
class Game_Enemy
# 属性列表
doc = <<-EOF
def mhp; param(0); end # 最大HP Maximum Hit Point
def mmp; param(1); end # 最大MP Maximum Magic Point
def atk; param(2); end # 物理攻击 ATtacK power
def def; param(3); end # 物理防御 DEFense power
def mat; param(4); end # 魔法攻击 Magic ATtack power
def mdf; param(5); end # 魔法防御 Magic DeFense power
def agi; param(6); end # 敏 捷 值 AGIlity
def luk; param(7); end # 幸 运 值 LUcK
def hit; xparam(0); end # 成功几率 HIT rate
def eva; xparam(1); end # 闪避几率 EVAsion rate
def cri; xparam(2); end # 必杀几率 CRItical rate
def cev; xparam(3); end # 闪避必杀几率 Critical EVasion rate
def mev; xparam(4); end # 闪避魔法几率 Magic EVasion rate
def mrf; xparam(5); end # 反射魔法几率 Magic ReFlection rate
def cnt; xparam(6); end # 反击几率 CouNTer attack rate
def hrg; xparam(7); end # HP再生速度 Hp ReGeneration rate
def mrg; xparam(8); end # MP再生速度 Mp ReGeneration rate
def trg; xparam(9); end # TP再生速度 Tp ReGeneration rate
def tgr; sparam(0); end # 受到攻击的几率 TarGet Rate
def grd; sparam(1); end # 防御效果比率 GuaRD effect rate
def rec; sparam(2); end # 恢复效果比率 RECovery effect rate
def pha; sparam(3); end # 药理知识 PHArmacology
def mcr; sparam(4); end # MP消费率 Mp Cost Rate
def tcr; sparam(5); end # TP消耗率 Tp Charge Rate
def pdr; sparam(6); end # 物理伤害加成 Physical Damage Rate
def mdr; sparam(7); end # 魔法伤害加成 Magical Damage Rate
def fdr; sparam(8); end # 地形伤害加成 Floor Damage Rate
def exr; sparam(9); end # 经验获得加成 EXperience Rate'
EOF
doc.scan(/def (\w+)/) do |(name)|
attr_writer name
old = instance_method name
ivar = :"@#{name}"
define_method name do
if instance_variable_defined? ivar
instance_variable_get ivar
else
old.bind(self).call
end
end
end
end