class Game_Actor
%w[
maxhp maxmp atk def spi agi
].each_with_index do |s, i|
eval <<-__END__
alias :petero_esper_base_#{s} :base_#{s}
def base_#{s}
@esperbonuses=[0,0,0,0,0,0] if !@esperbonuses
return petero_esper_base_#{s} + @esperbonuses[#{i}]
end
__END__
end
def parseEsperNote(note,tag,refValue)
value=0
note.scan(/\[#{tag}\:\s*(\d+)(\%?)\]/i){
value=$1.to_i
if $2=="%"
value=refValue*value/100
end
break
}
return value
end
alias :petero_esper_level_up level_up
def level_up
oldlevel=@level
petero_esper_level_up
@esperbonuses=[0,0,0,0,0,0] if !@esperbonuses
for armor in self.armors
next if !armor
params=actor.parameters
note=armor.note
stattags=[
"EsperGain_MaxHP",
"EsperGain_MaxMP",
"EsperGain_Atk",
"EsperGain_Def",
"EsperGain_Spi",
"EsperGain_Agi"]
for i in 0...6
paramDiff=(params[i,@level]-params[i,oldlevel]).abs
@esperbonuses[i]+=parseEsperNote(armor.note,
stattags[i],paramDiff)
end
end
end
end