I want to include a skill that averages the user's current HP% with the target's current HP% and sets both to the midpoint percentage calculated from those values. My formula (final 0 added so there's no additional "damage" from using the skill) is:
Which, given values of 20/20 and 10/20, should return:
Although I do understand that the application of damage formulas is a little wonky, I don't know how else I can achieve this and it seems very very odd for a computer program to not be able to handle a seemingly simple calculation like this. I'm not the best at math and I've only had VXAce for 3 days, so am I doing something wrong? Could this be done differently/in a better way??
c = (a.hp/a.mhp)
d = (b.hp/b.mhp)
a.hp = a.mhp * ((c+d)/2)
b.hp = b.mhp * ((c+d)/2)
0
Which, given values of 20/20 and 10/20, should return:
But the /2 specifically (which I have to use in order to find the average) causes the game to set the HP to 0, killing both party members instantly even though something like a.hp = a.hp * 0.75 works fine. None of the alternative methods I've tried, like reordering things or using *0.5 instead of /2, work. They either also kill the party instantly or give the incorrect result.
Although I do understand that the application of damage formulas is a little wonky, I don't know how else I can achieve this and it seems very very odd for a computer program to not be able to handle a seemingly simple calculation like this. I'm not the best at math and I've only had VXAce for 3 days, so am I doing something wrong? Could this be done differently/in a better way??