Calculating the damage from Idle Heroes

I'm trying to figure out how the damage is calculated in a game, but have been unable to. I'm not sure if this is the right platform to ask this. If not, pls let me know in the comments and I'll delete the question right away.

I have tested it with 3 characters, fighting 2 other characters separately.

```DMG        damage done to defender
ATTACK     attack power of the attacker
ARMOR      total amount of armor of the defender
LVL        lvl of the defender
REDUCTION  total amount of dmg reduced (ATTACK - DMG)
```

The data is as follows:

```          DMG     ATTACK    ARMOR    LVL  REDUCTION
Norma    9.142    13.342    1.064    160    4.200
OD-01    4.305     6.284    1.064    160    1.979
Vesas    3.222     4.703    1.064    160    1.481

Norma    9.674    13.342    1.039    180    3.668
OD-01    4.556     6.284    1.039    180    1.728
```

Someone pointed out the formula should roughly be like:

`reduction in % = ARMOR / (200 + LVL * 20)`

But this formula is off by a small margin and was hoping I could find the exact formula to calculate the damage. Anyone an idea how the DMG is calculated from ATTACK, ARMOR, and LVL?

1 Answer

EDIT: Turns out the formula you originally had was just a little off, so all that follows was a bit overkill XD. Oh well I had fun thinking about it. The actual formula is

`    reduction in % = ARMOR / (180 + LVL * 25)`

ORIGINAL: No one else has offered up any answers for you, so while I cant give you an answer, I can offer some insight on how you can answer it yourself. This is more hypothetical rambling than an educational answer, so read on if you desire.

While I don't have an actual solution to your question, (I wish I did, but the devs keep the details very well hidden), I do have a suggestion on how you may go about trying to solve it. I suggest firstly making the assumption that the error stems from the constants used in the formula having different values than originally assumed. We assume the format of the generic function you quoted (with constants base & mult, and variables ARMOR & LVL):

`    reduction in % = ARMOR / (base + LVL * mult)`

Popular opinion is that the constants have values near

```base = 200
mult = 20```

Perhaps for example the formula is closer to

`    reduction in % = ARMOR / (180 + LVL * 25)`

The value of mult (keeping in mind typical level ranges of 140-200), the ratio of base against typical armor ranges, and the ratio of base against mult each are important relationships that determine the fine details on how the formula works.

You can attempt to reverse engineer these relationships if you find the right battles. (Best way I imagine would be working with a friend [or dupe account] and doing VS fights, this way you can control the heroes on both sides of a fight, AND you can find or set the stats of all units involved.)

If you can find a way to modify one variable at a time, it is possible the true formula can be pieced together (or at least one that is vastly more accurate)

Attacking a variety of LVL 1 heroes with different armor values can possibly find relationship defining base , Attacking heroes with the same armor value but having different LVLs can possibly find a relationship for mult.

You can go deeper, possibly comparing two heroes with identical armor but differing low LVLs (ex. LVL 1 v LVL 2); THEN another test on two heroes with equal armor but differing high LVLs (ex. LVL 99 v LVL 100); and using any comparisons between the two situations to try deriving the ratio of base against mult.

If the structure of the actual damage formula turns out to be entirely different from the assumption,

`    reduction in % = ARMOR / (base + LVL * mult)`

the structure, parameters, and operations that shape the true formula can be still be concisely found then pieced together if you can manage to preform tests with only a single variable.

If you can't vary just one variable, it becomes immensely more complex trying to derive relations from two variables, thought it can still be done with sufficient skill in the appropriate math field. It can be simplified if you can find two variables that are already closely linked (such as the armor increase with each LVLup), as you may be able to treat the two as a single compound variable.

To just throw a couple ideas and suggestions out there, sensible or not, here are some ideas for relations that may possibly have relevance to how the actual formulas work (There is no evidence supporting any of these, they are purely made up in my head. They could be right, who knows?):

```NOTE: the character '∝' means "is proportional to"
(Many of these are just a relation, not a whole formula.  The values of these
might be plugged into another function to get the equivalent % reduction)
reduction ∝ (ARMOR + LVL * mult)
reduction ∝ (mult * LVL - base + ARMOR) / LVL
reduction ∝ (LVL - base + ARMOR) / (mult * LVL)
reduction ∝ (mult * LVL + (-base + ARMOR)^(3/2)) / LVL
reduction ∝ (mult * LVL + (-base + ARMOR)^(3/2)) / (mult * LVL)
reduction ∝ (LVL + (-base + ARMOR)^(3/2)) / (mult * LVL)
reduction = (ARMOR* (ARMOR/(6*LVL))^(3/2) / (200 + 20 LVL)

reductionPercent = sqrt((LVL+100)/200)*10*e^((ARMOR/(6*LVL))^(3/2))```

I spent a little time "inventing" the last formula. The exponential constant e has value of 2.72, multiplying by 10 gets 27.3 which as a percent is very near baseline resistance (about 1/4). So the above function gives a percent from an exponential function (where the exponent is based on the ratio of ARMOR to a typical armor value), multiplied by ten, and then multiplied by another term based solely on the level of the hero.

It isn't related to the actual damage formula, but instead is an alternate formula that exaggerates the effectiveness of additional armor. (if the game used this formula, I might try going for armored heroes for once)

Because of the limited resources available in the game, there isn't much you can do if you want to get a more accurate formula besides rigorous experimentation within the game or messing with different forms of functions and trying to find one that fits what is observed.

Unfortunately I don't have a friend to cooperate with, nor the resources to be able to experiment myself, but if you REALLY want to know you can always try to find the answer yourself.

If you do happen to solve some of the game's formulas, don't forget to share that wisdom with the rest of us? ;D

OVERDUE EDIT: The account this comment was posted with is no longer used, my main account now is https://gaming.stackexchange.com/users/243096/abmays?tab=profile . If you have any questions contact that account.