Skip to content

A program for determining luck/morality in Heroes 3!

User Avatar
#586
Auto-translated
.:: LMOracle 3.4 ::.

:: What's New? ::
1) Added a nearly full morale and luck indicator for HoMM I 1.1 RU version;
2) Added a damage monitor for HoMM I 1.1 RU version;
3) Fixed minor bugs.

:: Instructions ::
1) Start a battle;

2) Set the morale and luck values in the "Settings" menu (Morale, Luck, Enemy's Luck);
Note: this step is very important, as an incorrect luck value will result in incorrect damage calculations.

3) Select the mode "Without retaliation", "With retaliation", or "Without attack";

4) Set an additional condition (there is only one for HoMM I), if necessary: "Double attack" (elves, paladins, etc.);

5a) "Without retaliation" mode:
Double-click on the "Defender" label and enter the defense of the attacked unit in the window that appears (you won't miss where to put it). If the attacking unit is a shooter and is blocked, check the "Blocked" box (halves damage for shooters, ignored by all others).

5b) "With retaliation" mode:
Here you need to enter the following parameters (from top to bottom, left to right):
1) The exact number of warriors in the attacked unit who WILL be able to retaliate after the (first) strike of the attacker (the damage monitor can help determine this number, see below);
2) Minimum damage of a warrior in the attacked unit;
3) Maximum damage of a warrior in the attacked unit;
4) [Already set] Attack of the warriors in your current unit;
5) Defense of the warriors in the attacked unit.

Notes (5b):
1) Attack and defense parameters should be entered taking into account all bonuses (the numbers in parentheses in the information window);
2) The "Blocked" checkbox in this mode is checked because if shooters hit with retaliation, it means they are blocked, while other units ignore this flag.

The program signals with a green color before the turn of any unit the possibility of morale and/or luck occurring under the given conditions.

:: Damage Monitor ::

Introduction.
It turns out that the formula k = (1 + 0.1*sign(A1-D2))^|A1-D2| is not exact, although it approximates the damage coefficient quite well within some limits (see below).

In reality, the game calculates damage as follows:
1) The following sum is calculated:
base_dmg = sum[i = 1, n] (int_rand(min_dmg, max_dmg)).

Example:
Suppose n = 10 wolves (min_dmg = 3, max_dmg = 5, A1 = 6, D1 = 2) attack n' = 50 fairies (min_dmg' = 1, max_dmg' = 2, A2 = 4, D2 = 2), then the mentioned sum will look approximately like this:
base_dmg = 4 + 4 + 3 + 5 + 3 + 4 + 3 + 3 + 3 + 5 = 37 (which corresponds to 3.7 * 10 in classical theory, but the number 3.7 is not generated anywhere; it is provided here only for comparison);

2) The resulting sum is multiplied by coefficient k (the first number is the difference between the attacker's attack and the defender's defense (A1-D2), the second is the coefficient k):

0: 1.00

1: 1.10; 2: 1.21; 3: 1.33; 4: 1.46; 5: 1.61; 6: 1.77; 7: 1.95; 8: 2.14; 9: 2.36; 10: 2.59,
11: 2.85; 12: 3.14; 13: 3.45; 14: 3.80; 15: 4.18, 16: 4.59; 17 and above(!): 5.00

-1: 0.90; -2: 0.81; -3: 0.73; -4: 0.66; -5: 0.59; -6: 0.53; -7: 0.48; -8: 0.43; -9: 0.39; -10: 0.35;
-11: 0.31; -12: 0.28; -13: 0.25; -14: 0.23; -15: 0.21; -16 and below(!): 0.20 = 1/5

Thus, maximum damage is observed when the difference A1-D2 >= 17 and is five times the base; minimum is when the difference A1-D2 <= -16 and is five times less than the base.

The figures provided are stored in the game's executable file and are values of the expression (1 + 0.1*sign(A1-D2))^|A1-D2| rounded to the hundredths for various differences of A1-D2. The power is not calculated directly!

Returning to the example. almost_right_dmg = k * base_dmg = 1.46 * 37 = 54.02
This value is either divided by two (blocked shooters, etc.) or multiplied by two (luck).
(almost_right_dmg:=almost_right_dmg/2; almost_right_dmg:=almost_right_dmg*2)

And, the final touch, right_dmg = floor(almost_right_dmg + 0.5)

For our case (let's say, for example, the wolves hit with luck), right_dmg = floor(54.02 * 2 + 0.5) = floor(108.54) = 108.

:: Damage Monitor ::
If all parameters are set correctly, you will see the exact damage in the status bar. For shooters with a double attack, you can see the damage for the first and second shots: with the "Double attack" box unchecked — damage for the first shot, otherwise — for the second).

:: Limitations ::
Morale and damage will generally be predicted incorrectly if:
a) "With retaliation" mode + "Double attack": the enemy's retaliation kills at least one warrior in the attacking unit (as well as variations on this theme with double retaliation against a double attack);

b) You selected "Double attack" mode, but your unit killed the enemy with the first strike (uncheck the "Double attack" box before such attacks).

Please report cases of incorrect morale or damage prediction!

P.S. Units behind Fortress walls receive a +4 defense bonus against shooter attacks! Keep this in mind. The bonus disappears if the unit crosses the wall line or is on it, as well as if your shooters are on the same horizontal as the enemy unit and the wall on that horizontal is completely destroyed.

Download