## Introduction Edit

Is a 1% increase in HP better than a 1% increase in Atk or Def? What about an arbitrary a% increase? In this page you will find some math explaining why they are exactly equal.

The assumptions made are the same as in the page that links here, Efficient Attribute Points distribution. They are wrong, but perhaps somewhat close to the reality. The equations used should, however, be replaced with the real ones as soon as they are available. See APSingnificance#To do for more details on this subject.

To get started, we have to understand the following notion. It is after all the key to everything that follows. Lets say you engage in a battle. You win. You are left with 1000HP. That means that you had greater stats than you actually needed, so that you would win. You had excess stats. You had spent more AP than you needed. It also means one more thing, far more important. You could engage in a battle with a more powerful enemy, and still win. That holds true even if you are left with 500HP, or 100HP or 10HP. The strongest enemy you can fight and win, is the one that leaves you with just 1HP. For the sake of simplicity, we will accept that the strongest enemy you can fight and win is the one that leaves you with zero hp (or 0,000000000001 hp if you prefer). Lets introduce some variable names for your player and this particular enemy, the strongest enemy you can fight. Your player's hp when you started the battle will be called 'ph' (Player Hp), the atk 'pa', the def 'pd'. The enemy's hp will be 'eh' (Enemy Hp), atk 'ea', def 'ed'. The duration of the battle will be 's' seconds.

- Your damage per second (dps) 'pdps' is: pdps = C1 * pa / ed, where C1 is some constant value, uknown but irrelevant. (equation 1)
- The enemy's dps 'edps' is: edps = C2 * ea / pd, where C2 is some constant value, uknown but irrelevant. (equation 2)
- The enemy dealt some damage during that battle, which brought you down to 0 hp, so: ph = edps * s (equation 3)
- You dealt some damage during that battle, which brought the enemy down to 0 hp, so: eh = pdps * s (equation 4)
- (3) and (4) => ph * pdps = eh * edps (equation 5)

The question that will be answered is this: You now move on to fight a stronger enemy. You will die unless you raise your stats. If the monster is a% stronger, how much do you have to raise your atk to ba able to kill it. If instead you raise your hp, how much do you have to raise it? Is it the same percentage? What about your def?

But what does it mean "the monster is a% stronger"? We'll deal with 3 distinct cases. The monster has a% more hp, the monster has a% more atk, the monster has a% more def. If we find the percentage we have to increase the player's hp or atk or def to match the monster's strength for each of these cases, than we can deal with any arbitrary combination of monster hp or atk or def increase by doing it in one, two or three steps. We'll come back to this after studying the simple cases.

## Details Edit

### Case 1: The monster has a% more hp Edit

The new monster's hp will be called 'eh2'. That means: eh2 = a * eh,

#### Subcase 1: We raise the player's hp Edit

The new player's hp will be called 'ph2'. As explained before, that means...

ph2 * pdps = eh2 * edps = (a * eh) * edps = a * (eh * edps) = a * ph

So, to match the monster's strength, we have to raise the player's hp by a% too.

#### Subcase 2: We raise the player's atk Edit

The new player's atl will be called 'pa2' and the new player's dps 'pdps2'.

pdps2 = C1 * pa2 / ed, and ph * pdps2 = eh2 * edps = (a * eh) * edps = a * (eh * edps) = a * ph * pdps => pdps2 = a * pdps => C1 * pa2 / ed = a * C1 * pa / ed => pa2 = a * pa

So, to match the monster's strength, we have to raise the player's atk by a% too.

#### Subcase 3: We raise the player's def Edit

Sorry, too bored to post the math for every case. I've done it and they all come up with the same result. a%.

Case 2: The monster has a% more atk

Subcase 1: We raise the player's hp

Sorry, too bored to post the math for every case. I've done it and they all come up with the same result. a%.

Subcase 2: We raise the player's atk

Sorry, too bored to post the math for every case. I've done it and they all come up with the same result. a%.

Subcase 3: We raise the player's def

Case 3: The monster has a% more def

Subcase 1: We raise the player's hp

Subcase 2: We raise the player's atk

Subcase 3: We raise the player's def

## Result Edit

What we have proven so far, is that if the new monster is stronger by having only one of its stats better by a% than the previous monster, then we have to raise the player's hp or atk or def by a% to be able to kill it. To put it simple, a a% increase in hp or atk or def is exactly equivalent.

In case the new monster has a% more hp and b% more atk, we break down the process in two steps. Imagine a monster (A) which has just a% more hp and the same atk than the OLD one. To kill it we need a% more hp, or a% more atk, or a% more def. Then, to kill the NEW monster, we need an extra b% more hp, or b% more atk, or b% more def, than the stats we had so we could kill monster A. Complex? Not really. It means that the player can kill the NEW monster by doing one of the following:

- raise hp by (a*b)%
- raise atk by (a*b)%
- raise def by (a*b)%
- raise hp by a% and atk by b%
- raise hp by a% and def by b%
- raise atk by a% and def by b%
- raise hp by b% and atk by a%
- raise hp by b% and def by a%
- raise atk by b% and def by a%

The same can be done for a monster that has a% more hp, b% more atk and c% more def. And since a or b or c can be zero or even negative, we covered all possible combinations.

## To do Edit

The math in this page are rather simple. That's because we used simple equations in our assumptions (f(x)=ax and f(x)=a/x). When the real equations are available, this page needs some improvement. Here's how to do it. First of all, what we really calculated here could be generalized for any f(x). For example, to calculate how much the player has to increase his atk to match a monster with more def, we have to first find the function f for which y=f(x), where y=pa and x=ed. Using the assumptions we made, that process is as follows:

ph * pdps = eh * edps

ph * C1 * pa / ed = eh * edps

pa = ((eh * edps) / (ph * C1)) * ed

y = C * x, where C = ((eh * edps) / (ph * C1))

Then, for x2 = a * x (a a% increase in x), we need to find y2/y

y2/y = f(x2)/f(x)

And using our assumptions, that is:

y2/y = (C * x2) / (C * x) = x2/x = a

For the real function f, that result will probably be different. That has to be done for all 9 cases as above, if we only care for hp, atk and def, or for 25 cases if we care for all 5 attributes. The 25 cases are:

- PlayerHP = f(EnemyHP)
- PlayerHP = f(EnemyAtk)
- PlayerHP = f(EnemyDef)
- PlayerHP = f(EnemyAgi)
- PlayerHP = f(EnemyLuc)
- PlayerAtk = f(EnemyHP)
- PlayerAtk = f(EnemyAtk)
- PlayerAtk = f(EnemyDef)
- PlayerAtk = f(EnemyAgi)
- PlayerAtk = f(EnemyLuc)
- PlayerDef = f(EnemyHP)
- PlayerDef = f(EnemyAtk)
- PlayerDef = f(EnemyDef)
- PlayerDef = f(EnemyAgi)
- PlayerDef = f(EnemyLuc)
- PlayerAgi = f(EnemyHP)
- PlayerAgi = f(EnemyAtk)
- PlayerAgi = f(EnemyDef)
- PlayerAgi = f(EnemyAgi)
- PlayerAgi = f(EnemyLuc)
- PlayerLuc = f(EnemyHP)
- PlayerLuc = f(EnemyAtk)
- PlayerLuc = f(EnemyDef)
- PlayerLuc = f(EnemyAgi)
- PlayerLuc = f(EnemyLuc)

When all this is done, the reasoning behind Efficient Attribute Points distribution can be used to maximize a player's APs value.