The actual process of combat is mostly hidden from the user, who only gets to see the outcome. However, understanding the process is important to knowing how to construct an effective army. Combat in Legions of Lore is heavily based on strong counters. Most armies are very stong against certain foes and can defeat armies several times in size, but at the same time are very weak against certain other types of enemies. Building the right units to counter your opponents is the key to victory.
The HP stat determines how much damage a unit can take before it dies. Without modifiers, a unit can take damage equal to its HP. The base HP of each unit is displayed in its tooltip.
The damage stat determines how much damage a unit does when it attacks. Without modifiers, each round a unit deals damage equal to it's damage stat divided by the combat round precision (which is presently 100). The base damage of each unit is displayed in its tooltip.
The HP and damage of a unit are modified by the various bonuses that may be affecting it, such as defense bonus, terrain bonuses, operative abilities, tech and artifacts. Most of these affect both stats although a few only affect one or the other. Most modifiers are combined additively with one another, although some, such as the combined arms penalty, are multiplicative with the others. The projected bonuses your armies will receive can be seen on the army page.
To add a small but controlled level of randomness to each fight, each army when entering a fight rolls a random combat bonus between -10% and +10%.
Armies composed of several unit types face a combat penalty. For each unit type past the first two, your army fights as if the opponent were 15% stronger. All summoned units, Adventure heroes, as well as goblins, skeletons, laser cannons and rovers don't contribute toward the combined arms penalty. Science Fiction can research a tech that extends the number of allowed unit types without penalty to three. Diverse armies are penalized in this way because they have the advantage of being more difficult to counter.
There are several other important stats besides HP and damage which affect how units behave and deal damage in combat
Units of the same type and with the same modifiers are grouped into stacks which function together for the purpose of choosing targets.
Combat takes place in a number of rounds. During each round, each stack of non-healing units chooses which opposing stacks to attack and then deals damage based on how many units are left in the stack and their damage stat. If an enemy stack is finished off, the remaining damage will carry over to other targets. Then the stacks of healing units choose which friendly stacks to heal. The amount of damage and healing done in one round is fairly small, so the combat process closely approximates the continuous case. A fight can last anywhere from a few to a few hundred rounds depending on how close and how large the fight is.
Every round, each of your stacks must choose what to attack. This is based on the perceived threat of each of the enemy stacks. If some enemy stacks have similar threat, the attack will be distributed among them, with higher threat stacks receiving a larger portion of the attack. If the threat of one of the stacks is particularly high compared to the others, it will receive the full attack, and if the threat of a stack is particularly low, it will hardly be attacked at all. Your stack would by default distribute its attack equally among all the enemy stacks. The first modifier on threat is tanking. Enemy stacks with tanking have their base threat multiplied and tend to be attacked more. The second modifier on threat is the payoff value of attacking each enemy stack. This is the maximum amount of damage that stack could deal to any of your units multiplied by the amount of damage your stack would do to it, divided by the health of the enemy stack. In other words, the payoff value is how much potential damage to your army you could prevent by attacking this enemy stack. Enemies with high potential damage and low HP have a high payoff value. Dumb units aren't influenced by the payoff value much at all, while average units are influenced by it some, especially in the absence of enemy tanks, but will still mostly attack tanks first. Units with sniping are highly influenced by the payoff value, and will tend to attack the best target even with tanks present.
Your retreat thresholds are percentage values that determine at what point your forces retreat from a fight. By default they are set to 20%, meaning that if your army gets below 20% of its original power, the remaining forces will attempt to escape. The size of your army remaining is calculated by the combined power of the units that are still alive. Having a high retreat threshold has the advantage of saving a lot of your units from being killed in a losing fight, but in a very close fight, you could lose when you otherwise would have won because your army retreated. The defense threshold determines how all your defending armies behave, and the offense threshold determines how all your attacking armies behave. These values can be set at the "army" page. The possible ranges are 0 to 75% for adventure and 0 to 50% for everyone else.
Retreating units include those retreating from losing fights, but also units that have completed a raid, and units that were recruited this turn. Once units begin to retreat they won't fight anymore during that turn. Once all other rollover actions are finished, retreating units will first try to go to the territory they were meant to finish in. So for units being recruited, that's the territory they were recruited in, for units raiding that the territory they left for the raid from, and for units attacking that's the territory they attacked. If that territory is no longer available (because it's now controlled by another player) each unit will randomly move to one of the adjacent territories you control. If there are no adjacent territories in your control the units will go to the next closest territories, but for each enemy territory they have to travel through, 15% of the units (by power) are lost along the way.