Game Internals › War of the Lance › Combat

Combat

How combat is resolved in War of the Lance. The original game includes some combat-related bugs, which are fixed by default in the rebuild.

1Overview

Battles are fought in the combat phase, square by square. The game's battle code runs these steps in order:

  1. Orders. The attacker chooses Retreat, Light or Heavy (or aborts), then the defender chooses Retreat, Stand or Counterattack. A side with dragons also picks Dragon Fear or Attack for them.
  2. Side bonus. Each side's leaders, wizards, magic items and attacking dragons add up to a percentage bonus, at most +200%.
  3. Strength. Every unit's strength is worked out from its troops and quality, then adjusted for fatigue, terrain, items, race and more. Each side's strengths are added up and the side bonus applied.
  4. Odds. The attacker's strength as a percentage of the defender's, between 50 and 500.
  5. Losses. The attacker's losses come from the number of troops in the battle and the orders, not from the odds. The defender's are the attacker's scaled by the odds. If the defender would lose almost everything, it is destroyed outright.
  6. Shared out. Each side's losses are divided among its units by headcount, then each unit's own quality, armour and orders adjust its share. Units left under 20 troops are eliminated.
  7. After the battle. Who retreats, whether the attackers advance into the square, and whether they attack again.

The details below are the original's own formulas: we rebuilt the game from its code and checked our version against the real game. The charts and simulator use that same code.

PC version This page is the Apple II game. SSI's 1990 DOS version is a line-by-line translation of the same BASIC code, with the same game data: its battles follow every formula here, bugs included. The few places where it differs are marked in notes like this one.

2Battle simulator

Set up a battle and fight it 2,000 times. Choose a starting point, change any unit or setting, then press Fight.

Attacker
TypeTroopsRatingQualityFatigueItemRaceOP left
Defender Whitestone
TypeTroopsRatingQualityFatigueItemRaceDug in

Troops are the unit's headcount, or for dragons the number of dragons; leaders and wizards are always one. Rating is a leader's worth to its side, +1% strength per point (0–9): the game keeps it but never shows it. Quality runs from 0 to 7, fatigue from 0 to 24. "Dug in" is the fort level a unit builds up by staying put (0–7). Fleets and citadels are left out.

3A unit's strength

A unit starts from troops × quality and is adjusted step by step. Build a unit and watch each step:

    Strength:

    Then the side's strengths are added up and the side bonus applied (below). The steps, in the order the code takes them:

    • Base: troops × quality. Pegasi and griffons are halved. Dragons are worth 100 each, and 200 if the enemy has no Dragonlance; their quality doesn't count.
    • Leaders, wizards and citadels are worth 1: leaders and wizards help through the side bonus instead.
    • Fatigue: −4% per point, down to 4% at 24.
    • An attacker with no operation points left: × 0.8.
    • Terrain (defender only): + up to 300% (below).
    • Cavalry, pegasi, griffons and dragons: × 1.1 in the open, which here means anywhere but tunnels and dwarven forts.
    • A Dragonlance: × 2.
    • Dug in (defender only): adds (10 + 3 × fort level) ÷ 10, just 1 to 3.1 points. A likely bug.
    • Gnome technology: when anyone in the battle has a gnome device, it is rolled once for the battle: 60% it doubles Whitestone's infantry, cavalry and Draconians, otherwise nothing. It never halves, whatever the manual says.
    • Surrounded (defender only): roughly × 35–85%, more in fortified squares, less when the attackers still have plenty of movement.
    • Race: ogres and dwarves × 1.2 when the battle is in the mountains; elves and kender × 1.3 when it's in a forest. This goes by the defender's square, for both sides.
    • Level of play (below).
    • Attacking from a river square × 0.5, a stream × 0.7, a bridge over a river × 0.5, a bridge over a stream × 0.7. And dragons attacking a city, tower or fort × 0.7.

    4Odds and losses

    The odds are the attacker's strength as a percentage of the defender's, rounded down. They never go below 50, and once the attacker is more than five times as strong they jump straight to 500.

    The losses come from this:

    base = attacking troops − (attacking troops − defending infantry) ÷ 3 + 30 + 15 × dragons, if the attacker has dragons attacker = base × (20 to 29)% × orders% ÷ (2 in winter) defender = attacker × odds ÷ 150 + 2 × defending dragons then each + 0 to 10% at random
    • The attacker's losses don't depend on the odds at all. They grow with the size of the battle and the orders. Better odds only make the defender lose more.
    • At even odds (100) the defender loses two-thirds of what the attacker loses. The attacker needs odds of 150 to trade one for one.
    • The "defending infantry" in the base is the defender's infantry, cavalry and Draconians, where the attacker's would make more sense. It is probably a bug.
    • Destroyed outright: if the defender's losses reach its troops less 10, it loses everything, and the attacker loses only a quarter to nearly half of the defender's troops.

    PC version The same formulas, but the PC keeps many of the steps in whole numbers where the Apple II keeps fractions, so strengths and losses can come out a point or so different.

    5Numbers

    More attackers against the same 200 quality-3 defenders, on open ground, HEAVY against STAND:

    The attacker's own losses grow with its size, because the base counts every attacking trooper, until it is strong enough to destroy the defender outright. Then it loses only a quarter to nearly half of the defender's troops, so its losses drop. The defender's losses rise with the odds until it is destroyed.

    With Rules bug fixes on (the default), the defender retreats more often the harder it is hit, until it is simply destroyed. In the original (dotted), its retreats peak and then fall: the harder a defender is hit, the less likely it is to retreat (below).

    6Quality

    Quality works twice. It multiplies strength (troops × quality), so it sets the odds. And it reduces a unit's own share of the losses: each unit loses (130 − 10 × quality)% of its share, from 130% at quality 0 to 60% at quality 7.

    Every pairing of 200 against 200:

    Read across a row: the attacker's losses barely change whatever the defender's quality, because they depend only on its own quality. Down a column, a better attacker both loses less and inflicts more. Against quality-1 defenders, attackers of quality 5 and better are about five times as strong and almost always destroy them.

    7Orders

    The orders set how much of the battle's losses happen at all, for both sides:

    • Heavy against Counterattack is the bloodiest battle (150%); Retreat against Retreat barely a skirmish (5%).
    • A unit ordered to retreat also loses less of its own share: (120 − 2 × quality)%, and cavalry 50 points less. But it gains 2 extra fatigue, gives up its square, and its terrain bonus above 50% is halved.
    • Counterattacking also halves a terrain bonus above 50%.
    • When a side is almost all dragons and its dragons use Dragon Fear, or it retreats, the battle's losses fall to 1%. The same happens for a side of almost only fleets against no fliers, and for almost all fliers retreating from an enemy with none.
    • The computer's fleets always retreat when they defend a square on their own (with fewer than 5 other troops), whatever order it gave.

    300 attackers against 200 defenders under each pair of orders:

    8Fatigue

    Each point of fatigue costs 4% of a unit's strength, so a unit at 24 fights at 4%. Every battle adds 4 (6 when retreating), up to 24; units rest it off in the status phase. An attacker that has used all its operation points also fights at × 0.8.

    Fatigue weakens the attacker's strength, so it lowers the odds and the defender's losses. The attacker's own losses don't change, because they don't depend on the odds. A tired army loses just as many troops for less result, until the odds reach their floor of 50.

    9Terrain

    The defender's square gives its units a bonus, which is halved above 50% if they retreat or counterattack:

    Two attacking stacks of 250 against 200 defenders standing on each terrain:

    • In fortified squares (port cities, towers, dwarven forts, fortresses and fortified cities) the defender never retreats because of its losses, and the attacker never retreats because of its own.
    • Attacking across water: attackers in a river square fight at × 0.5, in a stream × 0.7; from a bridge, × 0.5 over a river and × 0.7 over a stream.
    • Race: ogres and dwarves × 1.2 in mountains; elves and kender × 1.3 in forest. It's the battle's square that counts, so attackers get it too when they fight into their terrain.
    • Cavalry and fliers get × 1.1 anywhere except in tunnels and dwarven forts.
    • Digging in is separate from terrain: a unit that stays put builds up a fort level of 0–7, but it adds only 1 to 3 points to its strength.
    • The attackers advance into a square they've won, except into mountains (unless ogres or dwarves are with them), rivers, marshes and deserts.

    10Leaders, wizards and items

    Leaders and wizards are worth only 1 strength each. They work through the side bonus, a percentage added to the whole side's strength, built up unit by unit:

    SourceBonus
    Each wizard+30%
    Each leader+ rating × (100 − 2 × fatigue)%, rounded down
    The side's dragons ordered to Attack+30%
    Medallion, or a gnome device, orb or lance with a banner, or medallion with armour+10% each
    Medallion with a banner+20%
    Banner alone+10%, only while the bonus is under 20%
    Most+200%

    A leader's rating (0–9) is hidden: the game never shows it, only its quality, which for a leader matters little (a slightly better chance of surviving the battle). A leader, wizard or dragon unit holding a bonus item adds its own bonus a second time.

    Wizards are among the strongest things in the game: all 3 wizards nearly double a side's strength. In battle, a leader or wizard is lost only on a bad roll (under 6% a battle, more if its side is wiped out), and once one of a side's is lost, the rest of that side are spared.

    11Dragons

    A dragon is worth 200 strength, or 100 if the enemy has a Dragonlance. Quality doesn't affect dragon strength. Each side with dragons chooses:

    • Dragon Fear: the dragons contribute their full strength to the battle, but are never lost unless the enemy has a Dragonlance, the enemy has dragons too, or the side is wiped out.
    • Attack: +30% to the side bonus, as well as contributing their full strength, but each dragon unit risks losing a dragon: a 5% chance, more if the enemy has a Dragonlance (+20%), the side is under 50 troops (+10%) or more than three dragons are already lost (+15%).

    Attacking dragons are safe against a defender with no dragons and no Dragonlance if the defender has fewer than 50 troops, or the attackers have more than 400 infantry, cavalry and Draconians. Otherwise they lose at most one dragon a battle against such a defender.

    Dragons joining 400 quality-1 infantry, attacking 200 quality-7:

    Each dragon adds 200 strength, and dragons also add to the base of the battle's losses (30 + 15 per dragon), which raises the attacker's own losses as well as the defender's. Attack's +30% helps, but costs dragons:

    • A dragon orb in the battle (either side's) turns each dragon unit away on a roll of 30 + 5 × quality percent or less; a turned-away dragon is worth 1. With the battle display the original ignored this; the rebuild doesn't.
    • Dragons on both sides: each dragon may be lost in proportion to the enemy's share of all the dragons: a side with three dragons against one loses each with a 25% chance, the lone dragon with 75%.
    • A stack of almost only dragons using Dragon Fear (or retreating) makes the whole battle's losses 1%.
    • The computer's defending dragons always use Dragon Fear, because of a bug.

    PC version One rule is new: when the defenders are wiped out, each defending dragon has a 70% chance not to count as wiped out. It then escapes the loss that a wipe-out brings, unless a Dragonlance, an Attack order or the enemy's dragons claim it. On the Apple II, a wipe-out puts every defending dragon at risk.

    12Losses by unit

    A side's losses are shared among its units by headcount, not by strength. Then each unit's share is adjusted:

    loss = share × (130 − 10 × quality)% + 1 to 4 (just + 1 if the enemy has 100 troops or fewer) armour: × 0.7 for the Highlord (× 0.5 against dragons), × 0.8 for Whitestone, + 1 retreat: × (120 − 2 × quality − 50 for cavalry)%
    • Infantry, cavalry, Draconians, pegasi and griffons left with fewer than 20 troops are eliminated.
    • Weak units soak up losses: pegasi and griffons fight at half strength but take a full headcount share.
    • When a side is wiped out, every unit that lost anything is destroyed.
    • Each battle can also raise the quality of infantry, cavalry, Draconians and leaders by 1: about a 4% chance at the start, growing to about 9% by the last turn, turn 30.

    The same 200 quality-3 defenders as one unit or several, attacked by 300:

    Every unit pays the flat 1–4 extra, and small units fall below 20 troops sooner. The same losses that leave one unit of 200 standing wipe out eight units of 25.

    13After the battle

    The defender retreats if it ordered Retreat, was wiped out, or has only leaders and wizards left. Otherwise, when it isn't in a fortified square and has lost more than a ninth of its troops, it may still fall back. The attacker retreats if it ordered Retreat, or (if the defender held, outside fortified squares) when it has lost more than half its troops, or more than a third with a 30% chance.

    In the original game, a bug causes the defender's chance to fall as its losses rise (dotted): 80% after losing 12%, 20% after 50%, none from 62.5%. With Rules bug fixes on (the default), the rebuild reverses the comparison, so the chance rises with its losses: 19% after losing 12%, 80% after 50%, certain from 62.5%.

    Retreating: each unit moves to the best neighbouring square (away from enemies, towards friends). A unit with nowhere to go is destroyed. The computer, in the original, decides to retreat only if the square to its south is free; Rules bug fixes makes it check every neighbouring square.

    Attacking again: when the attackers advance, they may attack the next enemy stack straight away. The chance is 20% × their order (Light 1, Heavy 2) − 10% × the defender's order, + 100% if they outnumber the defender ten to one (dragons count as 6), + 30% if the defender was destroyed. This can chain up to ten battles, but each adds 4 fatigue.

    14Level of play and events

    Level of playHighlord strengthWhitestone strength
    1× 0.8× 1.2
    2× 0.9× 1.1
    3× 1.0× 1.0
    4× 1.1× 0.9
    5× 1.2× 0.8
    • Winter (every fifth turn) halves the battle's losses.
    • Events can make losses × 1.2 or × 0.7 for a turn, or a side's strength × 1.2 or × 0.8.

    15Quirks

    The combat code has a few bugs, all on the bugs page:

    • Digging in adds 1–3 points instead of multiplying.
    • The battle's size is counted from the defender's infantry where the attacker's would make sense.
    • Defending dragons always add to the defender's losses.
    • The harder a defender is hit, the less likely it is to retreat.
    • The computer decides to retreat by the square to its south only, and its defending dragons always use Dragon Fear.
    • With the battle display, the original ignored the dragon orb (fixed in the rebuild).

    PC version Every one of these bugs is in the 1990 DOS version too: its programmers translated the code, bugs and all. The one combat bug it fixed is at sea: its sea battle odds use the exact ratio.