I have an item that adds 12 atk against land units. My problem is with the calculation of armor/defense of the enemy.

My hero attacks an enemy doing first 16.33 dmg (42.00 atk vs 66 def) and then 1.85 dmg (12.00 atk vs 66 def).

I don't know the algorithm for calculating dmg from atk vs def, but would my hero get more dmg if he would get the attack as xxx dmg ((42+12) atk vs 66 def)?

4 years ago

TL;DR : yes, but there are some cases when It's not possible to "merge" the attack.

Correct me if I'm wrong, but the bonus attack only applies to the specific matching targets, and it is a different attack than the first one.

For example imagine your hero has 50atk + 12 VS siege, and is attacking solo a living unit and a siege weapon.

Now, during one round, your hero may attack the living unit. Therefore the unit will receive the 50atk. However because it is not a siege unit, the bonus damage won't apply.


The bonus atk will try to find another valid target for the attack. So because the siege weapon is in range, your bonus atk will target that siege weapon. (It's like your hero attacked 2 different units)

Now, if indeed the bonus attack targets the same unit as the main attack, it would be more profitable to "merge" the attacks into one with the sum of the base atk and the bonus atk

To be really sure, we would need to compute some derivative... I don't have the exact formula of damage = f(atk, armor) (just realized the one I had wasn't exactly the right one), but mine seems to be still a good approximation, and the derivative would be

d(dmg)/d(atk) = (atk + ln(2)*armor)  /  ( atk*2^(-atk/armor) )

It's not very obvious with this formula (and anyway I believe it's chinese for most of you), but looking at a graph, it is clearly obvious that what you say is correct ^^. Indeed it would be more profitable to have a single attack rather than 2 different attacks.

Edited by Startouf 4 years ago.

4 years ago

Ok, since the bonus damage searches for the first enemy with the required stat before being applied, or if none found going to 0, changing the whole code to include these varied bonuses in a single attack would involve a pretty big dmg algorithm rework so not worth the time required at this point at least.

But at least these bonuses do jump to first enemy meeting the criteria (a boon in itself since the bonus does not get wasted if the first creature encountered by main attack does not fit the bonus params) so i can roleplay it as a left hand dagger (bonus)doing damage sometimes to specific creatures, in addition to the main hand weapon.

Ty for the reply.

4 years ago

Well, since some people are willing to go through all the hoops of reverse-engineering the attack formula, I guess I better post it here so people will be able to test the inner mechanics with more understanding.

The formula can be changed without notice in some of the updates, but so far it is like this:


4 years ago

Ty bers, now people can test the proper functioning.

And we can test in advance the effect of weapon/armor upgrades for fighting various enemies.

And, my assumption was right, the combination of atk+bonus would result in better dmg, but i do understand the reason for splitting the dmg bonus by criteria.

Edited by Aghiuta 4 years ago. Reason: added paragraph

4 years ago

Splitting the criteria may seem logical, but the effect cripples the attack.  If the hero hits the right type of unit, please add together all the relevant attacks, then do the maths.  These bonuses are almost worthless, done seperately.  Or give the bonuses to the army instead.  Or would that be just as bad?

6 Riflemen in range, current damage 39.1 each.  Damage with bonuses 55.4.  Total round damage improved by 16.3 x 6 = 97.8 ........vs 40 from hero. 

Edited by Stitch 9 months ago. Reason: Applying bonus to army

9 months ago

That was a design decision made in the beginning which is impossible to change later. There were reasons to make it the way it is now.

9 months ago

It works, badly.  Is it possible to add it to the things that are 'not working', please?

9 months ago

What exactly is not working?

9 months ago

The 'vs' 'bonus' on artefacts, gives very, very poor results, but it is not obvious, unless you take a very close look and are willing to do the maths.  It would be 'kinder' to disable this feature and let testers equip artefacts, with more effective bonuses.

The link, is about hero healing perk, which logically, should be in addition, to hero fighting.  Not instead of.  

Hero is generally about 4 or 5 times stronger, in attack, than any one army unit.  The healing perk, lets him heal army units, INSTEAD of fighting.  The healing done is tiny, especially against strong troops or monsters.  Try it out, your army will be slaughtered, while hero is doing a few points of healing, per round.

Healing is best left to healers, like Witchdoctors, Sisters, doctors and medics.  Hero SHOULD fight, he is a lousy healer.

P.S.  In TTG you could build a herb garden, that increased both health of troops and how much healing was done by witchdoctors.  I like that system, a lot better.

Edited by Stitch 9 months ago. Reason: Post script

9 months ago

Reply to berserker :

That was a design decision made in the beginning which is impossible to change later. There were reasons to make it the way it is now.

From page 4 of the update log, dated 5 years ago.  Does not sound 'impossible to change later'.

  • The battle calculation subsystem was totally reimplemented. Although that does not mean much of noticeable changes for players, it fixed a number of older battle-related bugs (and temporary introduced a few new) and also will serve as a springboard for planned further modifications, particularly in the way espionage works.

9 months ago

The fact that it does not work against the strongest monsters in the game does not mean it does not work at all. Normal aerial unilts like planes have much lower armor and thus not that many damage is resisted.

9 months ago

I could test this theory, but I rarely fight planes.  

How about I test it against what most testers fight, for most of the game, which is PvE monsters and troops?  Or the fights where I most particularly need to bring my 'best game', like DRAGONS.  

Also, when you award artefacts as defeat compensation,   it would be helpful if they were artefacts you could equip, in the early levels of hero.  Given you need 1 hero level, for every 2 artefact power level, the artefacts in this example, would need hero levels  25, 21, 22, 19 and 20.

9 months ago