module LEVELUP
LU = {
#1至5级增加的变量值
5=>(1..5).to_a+"1#5".to_a,
#6至9级增加的变量值
10=>(6..9).to_a+"99#10".to_a
}
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 更改 EXP
# exp : 新的 EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@lv=1
# 学会特技
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# 降级
while @exp < @exp_list[@level]
@level -= 1
end
if !@lv.nil?
for values in LEVELUP::LU.values.sort
for key in LEVELUP::LU.keys.sort
$game_variables[values.last.split(/#/)[0].to_i] += key if self.id == 1 and values.include?(@level) and key == values.last.split(/#/)[1].to_i
end
end
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end