ok i fiddled with it some more and discovered the @maxhp_plus setting is working at initialization (i.e. when I set it to 100 my base hit points were all +100), but after initialization, the bonus does not change. this means at some point, the ability of maxhp_plus to be changed during play somehow disappeared in my rewrite.
edit:
so I've been tinkering some, and concluded I have no clue why it won't work. I tried @maxhp_plus as an attr_accessor and it still crashed.
I think this section:
def maxhp=(maxhp)
@maxhp_plus += maxhp - self.maxhp
@maxhp_plus = [[@maxhp_plus, -9999].max, 9999].min
@hp = [@hp, self.maxhp].min
end
is probably what's preventing it from working. It's like when I switch from
this:
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
to this:
def maxhp
vitality = x99(self.sta, endurance_check)
n = [[vitality + @maxhp_plus, 1].max, 999999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 999999].min
return n
end
only the changes to self.sta and endurance update. Put another way, when the program turns on, ALL THREE attributes:
1. self.sta [stamina]
2. endurance_check [endurance]
3. maxhp_plus
work fine. After the game starts, using things like events to change these attributes only works for:
1. self.sta [stamina]
2. endurance_check [endurance]
while
3. maxhp_plus
which is useful for things like spell buffs, remains whatever it is set to during initialization. I have no idea why these other attributes are able to change after initialization while maxhp_plus fails, since they are part of the same definition.
P.S.
vitality = x99(self.sta, endurance_check)
just means :
self.sta * (endurance_check + 2)