What I want to happen is that the attack gets stronger and deals more damage the lower the actor's HP is. My formula is this:
a.atk*4 - b.def*2 + ((a.atk*4 - b.def*2) * (a.mhp - a.hp)/a.mhp)
I tested it against a much weaker enemy and just got Null coming up. The stats involved in the particular instance are:
atk = 60
def = 48
mhp = 622
actual hp = 373
So I work out that formula as follows
240 - 96 + ((240 - 96) * (622 - 373)/622)
=
144 + ((144) * (249)/622)
=
144 + (35856 / 622)
=
144 + 58 = 202
Where am I going wrong?
Thanks
a.atk*4 - b.def*2 + ((a.atk*4 - b.def*2) * (a.mhp - a.hp)/a.mhp)
I tested it against a much weaker enemy and just got Null coming up. The stats involved in the particular instance are:
atk = 60
def = 48
mhp = 622
actual hp = 373
So I work out that formula as follows
240 - 96 + ((240 - 96) * (622 - 373)/622)
=
144 + ((144) * (249)/622)
=
144 + (35856 / 622)
=
144 + 58 = 202
Where am I going wrong?
Thanks

