Open General
by Luis Guzman

COMBAT "FORMULAS"

If you want to support
this site, please ...

Combat is not ruled by a unique simple formula, but a serie of procedures,

Combat can occur because:

  • Normal Combat happens when selected unit (the Attacker) attacks enemy unit (Defender) or if "surprised" while moving by unspotted/overwatch enemy unit
    having at least 1 strength point (sp) unsuppressed, or when it meets unspotted enemy unit while moving (Surprised).
    The procedure used by Engine is:  Normal Combat.

  • If scenario enables "Allow Barrage Fire", then it is also possible for some units to fire to empty hexes either if unspotted or if having any facility suceptible to be blown up.
    The procedure used by Engine is:  Barrage fire.

  • If scenario enables "Air units can be intercepted while moving", some Ground (AD, FlaK and equivalents) units can fire Air units while moving.
    The procedure used by Engine is:  Interception.

Thus combat can involve only 2 units, but can also involve many units firing on support of main contenders. We'll call the "Active" unit to the one is firing an enemy ("the Pasive") thus when a single combat involves only 2 units able to fire each other, there will be 2 rounds:

  • In one round: the Active will be the Attacker firing to Defender (Pasive)
  • In the other:   the Active will be the Defender firing to Attacker (Pasive)
In all cases, no unit can "fire" without ammo nor if not having at least one unsuppressed strengh.

To allow either getting a forecast for casualties or actually resolve the combat, the engine uses "working copies" of the units, which will update later into true units when engine is resolving a real combat (not forecasting). Engine also uses some auxiliary variables that I'll use too, in order to make writing & reading easier. This table summarizes the terms and abbreviations used along these procedures:

Term/Abbev. Meaning
Attacker Unit inititating combat (attacking enemy unit)
Defender The Unit being attacked
Active (A) The unit which is firing another. Notice it can be the Attacker, Defender ot a third one firing in support
Pasive (P) The unit which is receiving fire from the Active. It can be the Defender/Attacker
CbtRange Is the distance between the Active and Pasive unit
atcTYPE_AttachmentBonus If unit has that atcTYPE attachment, unit gets that attachment bonus
Land-unit Unit with class less than Fighter
Naval-unit Unit with class more then Helo transport
Air-unit Unit not being Land nor Naval
EffAtk Effective stat used by unit to fire (modified SA,HA,AA or NA)
EffDef Effective stat used by unit to minimize enemy fire (modified GD,AD,CD, +RDM)
Rugged Either if CloseCombat, RuggedDefense or Surprised, as all of this affect the same in combat
SP (also sp) Strength of a Unit
AT, AD, TB, LB, plus -class Anti-Tank, Air-Defense, Tactical-Bomber, Level-Bomber .. Unit's classes
AttackerIni, DefenderIni, IniDiff Effective inititative of Attacker/Defender and difference between AttackerIni and DefenderIni
X += V  means: 'add V to X'
X -= V  means: 'reduce V from X but not below 1'
Active "Can Ignore Entrenchment" if
  • Pasive has not FerociousDefense leader
  • .. AND..
  • Active has "Ignore entrench" special attribute ... or
  • Active has "Infiltration Tactics" leader ... or
  • Active has "Street Fighter" leader and defender terrain is City or Port
Close Combat
  • Attacker is Infantry unit
  • .. and ..
  • Defender is on City, Forest, Mountain or it's class Fortification
Bad weather Weather is: overcast, rain or snow (not fair)

Main procedures:

use a set of common "sub-procedures" that are explained after those main procedures


Normal Combat procedure

The basic procedure to resolve a combat is this (whenever Attacker of Defender is killed, combat is finished):

  1. Engine checks if Attacker Overruns Defender ... then Defender is killed and combat finishes
  2. Engine figures if combat is Close Combat
  3. Engine setup working copies of the units involved to allow process as Forecast or Real combat
  4. If Attacker is Air unit, engine checks for Interceptors
  5. If Attacker is Air unit and Defender is ground unit, engine checks for Air defense
  6. If Attacker is unit on land, engine checks for Fire Support
  7. If Attacker is naval unit and "Extended Naval Rules" is enabled engine checks for Naval Support
  8. Engine then, checks for Sabotage
  9. If Attacker was not surprised, engine checks for Defender Evades
  10. If defender is naval unit in Port, and Attacker is Infantry, Tank, Recon, AntiTank or Flak not surprised, then engine checks for Fleeing out Port
  11. If Attacker was not surprised, engine checks for Defender Evades
  12. If Attacker was not surprised and is Infantry and Defender is also Infantry and both are in adjacent hexes and Defender has ammo engine checks for Rugged defense
  13. Then engine Eval Odds and Eval Initiative .. Attacker vs Defender
  14. If Attacker was not surprised and Defender is not Air unit, engine checks Bomber Attack and Strategic bombing
  15. At this point engine Resolve Combat between Attacker and Defender
  16. If Attacker is not Air unit and it has fired, then Counter Battery Fireis checked
  17. Finally, the engine Update stats to Attacker and Defender (working copies) ... and if combat is real (not forecast), then
    true units are updated with current data of working copies, Defender eventually retreats and if Attacker has "Marine" special attribute, it can move to any adjacent hex after Defender retreats


Barrage fire procedure

Barrage fire is an optional action that must be enabled as scenario option Allow Barrage fire

Only units having a "BombSize" (also called BombCode sometimes) bigger than zero can use this action.

This option allows such units to Bombard an empty hex with the objective to blow any facility (Port, City, Airfield or Road/Bridge).
If hex would have an unspotted enemy unit, that unit would suffer same results than in normal combat Bomber Attack.

Anyway the hex itself can be affected as in Strategic bombing except it is not limited to Ab'ttacker being a Level Bomber

Like normal combat, Barrage fire can get some retalation fire:



Ground to Air Interception procedure

Requires scenario option "Air units can be intercepted while moving" enabled.
Units able to do ground-to-air (g2a) interception are the same than can do Air-Defense (see Air defense), let's call them "AD/Flaks".

Interception cannot happen if:

  • Plane has Skilled Assault leader
  • "AD/Flaks" having "No Intercept Air" special attribute cannot intercept obviously
  • "AD/Flaks" units that have already intercepted in the turn cannot intercept again.
  • Planes having "Jet(stealth) special attribute can only be intercepted by "AD/Flaks" having also "Jet(stealth) special attribute

Exact behavior of this action, depends on $Var: g2a_intercept_mode.

  • Default is:
    • 1a.- Hidden "AD/Flaks" can intercept in range 1 when plane moves to adjacent hex or plane finish movement on same/adjacent hex
    • 2a.- If plane attack any ground unit, "AD/Flaks" can also do air-defense if plane is in its range of fire
  • if g2a_intercept_mode. is odd number (1 or 3):
    • 2b.- "AD/Flaks" after intercption, cannot do air-defense fire
  • if g2a_intercept_mode. is 2:
    • 1b.- enable interception if plane finish movement in range 1 even if "AD/Flak" is spotted
If plane is intercepted, the "AD/Flak" fires to plane (surprised) doing: Thus plane fight as "surprised" and doesn't fire back to "AD/Flak"

Overrun procedure

Any unit may Overrun when it was not surprised by unspotted Defender while moving and:

  • Attacker's class is Tank and has not "Overrun" special attribute.
  • Attacker is ground unit not class Tank and has "Overrun" special attribute
  • Attacker has ammo to fire

When Attacker may Overrun, Combat Forecast is figured out and if results that:

  • Defender's losing all its strength and Attacker not losing any strength...
Then defender is killed and normal combat doesn't happen. Each overrun requires the Attacker to spend ammo. Attacker can continue moving and firing.

Air-Interception (Interceptors) procedure

When Attacker is Air unit, engine checks if any Defenders' adjacent friend (same side) fighter can fire first to Attacker. Only exception is if Air Missions are enabled and Attacker is flying a WildWeasel mission, then no Air-Interception is posible.

Fighters can do Air-Interception only once during enemy turn, except if they have "Skilled Interceptor" leader.

If any Fighter can fire Attacker, then the engine performs:



Air Defense procedure

When Attacker is Air unit attacking a Ground unit, engine scans what Defenders' friend Ground units are able to fire the Attacker first. Only exception is if Air Missions are enabled and Attacker is flying a WildWeasel mission, then no Air-Interception is posible.

These are the Units able to do Air defense (AD units):

  • AirDefense (AD) class units, not disable with a special attribute, having the plane in its range of fire
  • FlaK class units, not disable with a special attribute, having the plane in adjacent hex
    or if plane is adjacent to Defender, FlaK is also adjacent to Defender and $flak_ex2 is active
  • Units having "AD Support" special attribute
  • Units having "CAn Air Attack" special attribute
  • Destroyers, carriers and all Cruisers if scenario option "DD.CV and LC can fire as FlaKs" is enabled

For any friend unit able to do Air defense, the engine performs:



Fire Support procedure

When Attacker is Ground unit attacking another Ground unit, engine scans what Defenders' friend Ground units are able to fire the Attacker first.

These are the Units able to do Fire Support (as far as they have Attacker within its range of fire):

  • Artillery class units not having "FireSupport special attribute
  • Non artillery units having "FireSupport special attribute
  • FlaK class units having "Support Fire" leader but not having "FireSupport special attribute

For any friend unit able to do Fire Support (FS-Unit), the engine performs:

Units having "SingleSupportFire" special attribute do support fire only once in enemy turn

Naval Support procedure

This action is restricted to Submarines attacking another naval unit different than Destoryers, when "Extended Naval Rules" scenario option is enabled. Otherwise it is skipped.

So when a Submarine attacks, engine scans first Destroyer adjacent to Defender that:

  • Have not given Naval Support in that turn yet
  • Have not ""NoIntercept" special attribute
Only one Destroyer can do Naval Support.

If any Destroyer can fire Attacker, then the engine performs:



Counter Battery Fire (CBF) procedure

This CBF action is a kind of retaliation fire when enemy guns have fired to friend units, but is done after enemy guns fired. As usual enemy target must be within range of fire of the unit doing CBF.

Artillery having "CBF" special attribute can fire to enemy Artillery after fired to friend units
Destroyers units having "CBF" special attribute can fire enemy ships after fired to friend units.

Units having ""Single Fire Support" can do CBF or FireSupport only once per turn. Only one unit can do CBF in each combat.

Engine scans units able to do CBF and the first found does:



Sabotage procedure

If Attacker has "Saboteur" special attibute and Defender is not aready sabotaged, Attacker performs a Sabotage temtative before attacking spending 1 ammo. If Sabotage fails, combate continues normaly, but if Attacker success Defender turn to sabotaged status and combat finish.

Engine figures what is the probability of success based on how a few $vars are configured:

  • Base probability is $sabotage_min
  • Attacker adds to this % a value = inititaive + twice exp-bars + 3 times his attack value for Defender's target
  • If Attacker has not 10 sp or Defender has not 10sp, % is promediated according actual strength
  • Then probability is limited by $sabotage_max
Then if Dice(1,100) is <= than %, Sabotage fails, Attacker gets 2 sp suppressed and combat finishes.

While any unit is sabotaged:

  • Cannot reinforce, resupply or attack other units, but can defend if attacked
  • Has its combat stats reduced in 2 if attacked
  • Cannot evade combat in case it had that option
  • Cannot work as depot in case it had that option
  • Cannot work as healer in case it had that option


Evading combat procedure

This option only works if Defender can find a postion (hex) to retreat, otherwise is skipped.
Designer can configure units with the possibility to avoid combat (evade) in two ways.

  1. Defining $class_evade in .CFG files, assigning for each class a specific probabiity to evade combat. If $class_evade is not defined (default), only Submarines can evade
  2. Assigning some units the "Evade" special attribute,as far as they are not sabotaged

Submarines and units in group 1, perform slightly different than units in group 2.

For Submarines and other units defined by $class_evade:

  • Probability to evade is given by $class_evade for Defender's class, or 30% if $class_evade is not defined (50% if playing Pg2-Mode)
  • if $zoc_evade is define, % is reduced for each additional enemy on ZOC (adjacent) by the value set in that $var
  • % is increased by (5 * Defender's exp_bars) - (5 * Attacker's exp_bars)
  • If Attacker is Air unit, % is halved
  • If Defender is "mounted" % is halved again.
  • If % is >= Dice(1,100), then Defender evades combat
Note: A common trick to make Submarines being "summerged" or "surface" is assigning a ground transport, faster than Submarine but with worse stats

For units having "Evade" special attribute, $evade_special can be defined in .CFG modifying default behavior. See: Config files.
But if actually Defender could evade, the procedure is almost the same than explained before but withe less modifiers:

  • Probability to evade is given by $class_evade for Defender's class, or 30% if $class_evade is not defined (50% if playing Pg2-Mode)
  • if $zoc_evade is define, % is reduced for each additional enemy on ZOC (adjacent) by the value set in that $var
  • % is increased only by (5 * Defender's exp_bars) regardless Attacker bars


Naval Fleeing procedure

Naval units located in Ports or in bridges (road over water) when $naval_noblock_bridge is defined, will try to flee when attacked by Infantry, Tank, Recon or AntiTank class units.

If Defender can find an adjacent hex to flee, it moves therer, but if Defender cannot find an hex to flee Defender is sunk. Either case, combat is finished.

Rugged defense procedure

If Attacker is not surprised and both Attacker and Defender are Infantry units, a "rugged" defense can be triggered.

But if Defender has not "Ferocious Defender" leader and:

  • Attacker has "Ignore entrench" special attribute ... or
  • Attacker has "Infiltration Tactics" leader ... or
  • Attacker has "Street Fighter" leader and defender terrain is City or Port
... then Attacker avoids "rugged" defense.

Otherwise, this formula applies:

  1. Attacker weight is 4 if Attacker has "Tenacious Defense" leader, else is 2
  2. Defender weight is 4 if Defender has "Tenacious Defense" leader, else is 2
  3. Weight factor is = 50 * (Defender weight) / (Attacker weight)
  4. TrenchRate = Infantry's Entrench rate + 1 .. [Entrench rate for Infantry is 3 unless redefined in TerrainEx.txt]
  5. Chance = ( 5 * Weight factor * TrenchRate * Defender's entrench) / (50 * TrenchRate)
  6. if Dice(1, 100) <= Chance then "rugged" defense is raised


Bomber Attack procedure

This action is only used if Attacker is Level Bomber class or engine is checking Barrage fire. Defender must be a Ground unit (land or naval) either spotted or unspotted.

This action can produce these effects:

  • Defender can suffer extra lasting suppression
  • Defender can loose some ammo (if uses ammo)
  • Defender can loose some fuel (if uses fuel

Engine uses this formula to resolve this action:

  • Attacker figures Efficiency = (UnsuppressedStrength * bomberCode / 10);
    With Bad weather, Efficiency is halved and (5 * Attacker's bars) is added.
    If fair weather (10 * Attacker's bars) is added to Efficiency
  • If Defender uses fuel, it looses FuelDestroyed = (Efficiency * Defender's max_fuel) / 100
    but always keep fuel enough as make a full move allowance
  • If unit uses ammo, it looses AmmoLoss = ( (Efficiency/2) * Defender's max_ammo ) / 100 but always keep 1 ammo (to shoot once at least)
  • Defnder get lasting suppression according this formula:
    If Bombard is during normal combat: Defender Suppression = RollDice(Defender's strength/3, Defender's strength)
    If Bombard is during barrage: Defender Suppression = RollDice(1, Defender's strength)


Strategic Bombing procedure

If Attacker is a LevelBomber bombarding a City, Port or Airfield owned by enemy, and scenario option Allow Barrage fire is enabled the engine checks if the owner loses prestige:

  • Attacker figures Efficiency = (Attacker's UnsuppressedStrength * Attacker's bomberCode / 10);
    With Bad weather, (5 * Attacker's bars) is added to Efficiency.
    If fair weather (10 * Attacker's bars) is added to Efficiency
  • PrestigeLoss = Dice(Efficiency/4, Efficiency/2) .. but never less than 24pp

In addition to this specific LevelBomber action, if:

  • Attacker is Artillery and (has not moved or has "Mechanized" special attribute) .. or
  • Attacker is (Fortification or AntiTank) firing to adjacent enemy .. or
  • Attacker is TacBomber, LevelBomber, Battleship or any Cruiser
  • .. AND ..
  • Attacker has bomberCode .. and
  • Attacker has "can blow"special attribute .. and
  • target hex is City, Port or Airfield

then:

  • Efficiency = (Attacker's UnsuppressedStrength * Attacker's bomberCode / 30)>
  • If not doing Barrage:
    • Efficiency = Efficiency/5
    • (Attacker's UnsuppressedStrength * Attacker's bars)/5 is added to Efficiency
    • If Attacker has leader: Efficiency adds 5
  • With bad weather, Efficiency is halved
  • If target hex is mined, Efficiency adds 10
  • and finally is limited to 85%
If Dice(1,100) <= Efficiency, the target hex is blown up.

Eval Odds procedure

This routine figures the effective Attack and Defense (EffAtk/EffDef) stats of two units firing each other.
I'll call ActiveUnit(A) / PasiveUnit(P) to make clear that units doing this action can be different than combat's Attacker/Defender (for example, when called from Fire Support, the Attacker becomes the Pasive unit here).

Thus this routine calculates: A.EffAtk, A.EffDef (for Active unit), and P.EffAtk, P.EffDef for Pasive unit. When Active or Pasive unit cannot fire, then its EffAtk is set to zero.

Here it is how the engine calculates fire stats for the units involved...

Effective Attack for Active unit (A.EffAtk)
If Active unit cannot attack A.EffAtk=0, otherwise:

  • A.EffAtk = Attack value according Pasive target [Soft/Hard/Air/Naval]
  • A.EffAtk += Active bars
  • if A is AT-class, A.EffAtk += atcAT_AttachmentBonus
  • if A is AD-class, A.EffAtk += atcAD_AttachmentBonus
  • if A has leader Aggresive Attack, A.EffAtk += 2
  • If Rugged and P is not Inf-class, A.EffAtk += 4
If resultant A.EffAtk is zero and it is not Rugged, no more stats are calculated, and the action calling this routine will abort.

Effective Attack for Pasive unit (P.EffAtk)
If Pasive unit cannot attack P.EffAtk=0, otherwise:

  • P.EffAtk = Attack value according Active target [Soft/Hard/Air/Naval attack]
  • P.EffAtk += Pasive bars
  • if P has typeAT_Attachment and Pasive is hard target, P.EffAtk += AT_AttachmentBonus
  • if P has typeAD_Attachment and Pasive is air target, P.EffAtk += AD_AttachmentBonus
  • if P has Aggresive Attack leader, P.EffAtk += 2
  • If Rugged and A is not Inf-class, P.EffAtk += 4
  • If P is sabotaged, P.EffAtk -= 2
If resultant P.EffAtk is zero and it is Rugged, no more stats are calculated, and the action calling this routine will abort.

Effective Defense for Active unit (A.EffDef):

  • If P is Inf-class and Rugged, A.EffDef = A close defense stat
  • if P is Submarine, A.EffDef = A close-defense stat
  • if P is Fighter, TacBomber or LevelBomber, A.EffDef = A air-defense stat
  • if P is any other class then A.EffDef = A ground.defense stat
  • A.EffDef += Active bars
  • if A has typeAD_Attachment and A is Defender, P.EffDef += AD_AttachmentBonus
  • if A is naval-unit and P is land-unit not in Fort-class, then A.EffDef += 8
  • If A is Inf-class and P is AT-class not having TankKiller leader, then A.EffDef += 2
  • if A is Arty-class and Rugged, then A.EffDef += 3
  • if A has not moved and not Rugged and P cannot ignore entrenchment, yhen A.EffDef += A.entrench stat

Effective Defense for Pasive unit (P.EffDef):

  • If A is Inf-class and P is (Fort-class or Rugged) then P.EffDef = P close defense stat
  • if A is Fighter, TacBomber or LevelBomber, P.EffDef = P air-defense stat
  • if A is Submarine, P.EffDef = P close-defense stat
  • if A is any other class then P.EffDef = P ground-defense stat
  • P.EffDef += Pasive bars
  • if P has typeAD_Attachment and P is Defender,then P.EffDef += AD_AttachmentBonus
  • If P is on Fort-terrain and has organic transport, P.EffDef = += 2
  • if P has no ammo and has not No Ammo Penalty special attribute, P.EffDef is halved
  • if P has leader DeterminedDefense, then P.EffDef += 2
  • If P is sabotaged, P.EffDef -= 2
  • if P is Defender and has TenaciousDefense leader , Effdef += 4
  • if P is naval-unit and A is land-unit not in Fort-class, then P.EffDef += 8
  • If P is Inf-class and A is AT-class not having TankKiller leader, then P.EffDef += 2
  • if P is Arty-class, then P.EffDef += 3
  • if A cannot ignore entrenchment, then P.EffDef += P.entrench stat

Other conditions:

  • If P is AD-class ...
    and Active is giving FireSupport, then A.EffAtk += 3
    and P is air-unit and Active is the Defender
    ...  then P.EffAtk += 3

  • If P is Inf-class located on BlownCity ... then
    P.EffDef += 1 and A.EffDef -= 1

  • If P is located on River/Stream with no bridge ... then
    A.EffAtk += 4 and P.EffDef += 4

  • If A is located on River/Stream with no bridge ... then
    P.EffAtk += 4 and P.EffDef += 4

  • If Rugged ... then
    P.EffAtk +=4 and P.EffDef +=4

  • If not Rugged and Bad weather ... then:
    if P is air/naval-unit or P has not i>AllWeather special attribute, then A.EffDef +=3
    if A is air/naval-unit or A has not AllWeather special attribute, then P.EffDef +=3

  • Range Defense Modifier (RDM)
    This modifier applies when A is land-class unit (less than 8) and P is land unit and not Rugged combat ...
    • If P.range-stat is different than CbtRange or CbtRange <= 1
      .. Then: P.EffDef += P.RDM-stat /2
      .. Else: P.EffDef += P.RDM-stat
    • If A is AT-class, without TankKiller leader and A has moved then A doesn't get RDM
    • If P.range-stat is same than CbtRange (and not AT or has TankKiller leader or A has not moved)
      .. Then: A.EffDef += A.RDM-stat .. Else A.EffDef += A.RDM-stat /2


  • If A is air-unit with SkilledGroundAttack leader and P is land-unit, then A.EffAtk += 4
  • If A has leader AggresiveAttack ... then
    A.EffAtk += 2 and A.EffDef += 2

  • If P has leader DeterminedDefense ... then
    P.EffAtk += 2 and P.EffDef += 2

  • If A is land/naval-unit on a minefield, then A.EffDef -= 3
    If P is land/naval-unit on a minefield, then P.EffDef -= 3

  • If A is the Attacker, not naval-unit, with class different than (Arty,TacBomber,Fort) then P.EffDef -= P.Hits (but never below zero)

  • If A is not giving Fire-Support, engine scans adjacent hexes and for each unit in same space(air/ground) having CCombatSupport leader or special attribute ... then:
    • A.EffDef += Unit's bars/li>
    • If A.EffAtk> then A.EffAtk += Unit's bars


  • Engine also scans adjacent hexes to P, and for each unit in same space(air/ground) having CombatSupport leader or special attribute .. then :
    • P.EffDef += Unit's bars/li>
    • If P.EffAtk >0 then P.EffAtk += Unit's bars


  • If A is Arty-class, AD-class or naval-uni, engine scans adjacent hexes to P
    and for each A's friend-unit having ForwardObserver attachment, then:
    A.EffAtk += atcFO_AttachmentBonus

These values can be modified later by EvalInitiative.

Eval Initiative procedure

The main purpose of this routine is to define the sequence of combat:

  • Simultaneous: both units fire and then take casualties
  • AttackerFirst: Attacker fires first, thus Defender fires back after removing loses
  • DefenderFirst: Defender fires first, thus Attacker fires back after removing loses
This routine is only called from main combat flow. Default sequence is SIMULTANEOUS and there are some quick-return conditions:

Condition Return
If .. Attacker is Fort-class and CbtRange is >1)  SIMULTANEOUS
If .. Attacker is Arty-class and combat is not rugged; SIMULTANEOUS
If .. rugged combat DEFENDER-FIRST
If .. Attacker is Air-unit and Defender is FlaK-class DEFENDER-FIRST
If .. Attacker is Submarine or Defender is Submarine ATTACKER-FIRST

Engine Attacker and Defender can modify the inititative used as explained below. I'll call AttackerIni and DefenderIni,  the effective inititiative used.

  • If .. Attacker is Air-unit and Defender is AD-class then AttackerIni and DefenderIni is set to 5.
    .... Otherwise:
    • AttackerIni and DefenderIni are set to Attacker/Defender initiative stats. (if mounted will use its transport initiative)
    • if both attacker and defender are ground units:
      • Terrain can set a limit in inititative. See TerrainLimit below
      • If Attacker has not moved and DefenderIni is bigger and not rugged combat, then AttackerIni is set = to DefenderIni
      • AttackerIni is reduced to TerrainLimit,  if bigger
      • DefenderIni is reduced to TerrainLimit,  if bigger
    • AttackerIni is increased by (Attacker bars+1)/2
    • DefenderIni is increased by (Defender bars+1)/2

  • AttackerIni is increased by Defender hits

  • If .. Attacker is AT-class not having leader TankKiller and has moved and DefenderIni + 3 is bigger than AttackerIni, then:
    AttackerIni is set to zero and DefenderIni is set to 99

  • If .. not forecasting then :
    AttackerIni and DefenderIni add a Dice(1,3)

  • If .. Attacker uses fuel and has no fuel, then :
    AttackerIni is halved

  • If .. Defender uses fuel and has no fuel, then :
    DefenderIni is halved

  • If .. Attacker uses ammo and has no ammo, then :
    AttackerIni is halved

  • If .. Defender uses ammo and has no ammo, then :
    DefenderIni is halved

  • If .. Attacker has leader BattleFieldIntel, then :
    AttackerIni is increased by 1

  • Attacker and Defender checks its attachments and eventually reduce any inititative set as penalty

  • if .. Attacker and Defender have not same super-class (both Land/Air/Naval units) then:
    routine returns (EffAtk/EffDef is not changed)

Otherwise, engine figures InitDif = AttackerIni - DefenderIni

  • If .. IniDif <0 and Defender.EffAtk > 0 and Defender.EffAtk + 4 > Attacker.EffDef
    • if Defender has leader FirstStrike or (is on City having leader StretFighter, then: Secuence is DEFENDER-FIRST
    • Defender.EffDef += 4
      Defender.EffAtk = what is less: 4 or absolute value of IniDif


  • elseif .. IniDif > 0 and not rugged and Attacker.EffAtk > 0 and Attacker.EffAtk + 4 > Defender.EffDef then:
    • if Attacker has leader FirstStrike then: Secuence is ATTACKER-FIRST
    • IniDif>1 and Attacker.EffAtk > Defender.EffDef and Attacker has leader "Infiltration Tactics" then Secuence is ATTACKER-FIRST
    • Attacker.EffDef += 4
      Attacker.EffAtk = what is less: 4 or absolute value of IniDif

... and routine returns the sequence eventually modified if both contenders are using same space.

TerrainLimit procedure

When both Attacker and Defender are ground units, terrain can limit their effective initiative ( AttackerIni / DefenderIni )

I call this limit: TerrainLimit

  • If .. close terrain
    • if Attacker has moved: TerrainLimit = max value between Attacker's hex terrain and Defender's hex terrain
    • else: TerrainLimit is set to Defender's hex terrain
  • else
    • if ..Range != 1, then TerrainLimit=99 (no limit)
    • else:
      • if AttackerIni > 8, then: AttackerIni = 8
      • if Attacker has moved and DefenderIni > 8, then DefenderIni = 8
      • TerrainLimit = max value between Attacker's hex terrain and Defender's hex terrain


Resolve Combat procedure

Once Eval Initiative has calculated how is the sequence of combat (fires), engine resolve combat in this way:

If Attacker fired first (ATTACKER_FIRST), then sequence is:

  • Eval losses is called to figure Defender casualties by Attacker
  • Update stats to Defender according casualties
  • If Defender is not killed and has remaining unsuppressed strenght:
  • Defender checks if must Retreat

If Defender fired first (DEFENDER_FIRST), then sequence is:

  • Eval losses is called to figure Attacker casualties by Defender
  • Update stats to Attacker according casualties
  • If Attacker is not killed and has remaining unsuppressed strenght:
  • Defender checks if must Retreat

If Combat is SIMULTANEOUS, then sequence is:

If combat is not "forecast", then real units, are updated with working copies content and any unit resulting in zero strength is killed.

if $Var: critical_hit is defined and Defender is Naval-unit and is not killed, there is a chance of getting a Critical-hit, making Defender to be sunk.

Eval losses procedure

This routine figures the casualties made by a unit firing (Active) to enemy (Pasive) as well as the experience gained by both in this action.

The Active unit will fire one shot for each unsuppressed strength, but this number is halved when :

  • Pasive is doing a RECON air-mission
  • Bad weather and Active has no "AllWeather" special nor leader and Active is not in same space than Pasive and any (Active/Pasive) is air-unit

The key value for this procedure is the difference:  Diff = Active's EffAtk - Pasive's EffDef,  thus as higher is this value as more casualties Active will inflict to Pasive.

This Diff value is modified if:

  • Difference is bigger than 4, then engine (same than PG2 did) flatten Diff using this formula:
    Diff = 4 + ( 2 * Diff - 8 ) / 5
  • if Active has leaderOverwhelmingAttack, then:
    Diff += 2
  • if Pasive has leaderResilience, then:
    Diff -= 2

Depending on Active unit-class, the threshold for Kill/Suppress is different:

  • If Active unit si ATY-class, FORT-class, LB-clas or Naval-unit
        DiceToSuppress = 11
        DiceToKill = 19 
  • else
        DiceToSuppress = 11
        DiceToKill = 15
These thresholds can be slightly modified :
  • If Active has SpecialAmmoAttachment threshold is reduced according the value defined in it:
        DiceToSuppress is reduced by attach-bonus
        DiceToKill is reduced by attach-bonus 
  • If Active has Kamikaze special attribute:
        DiceToSuppress is reduced by 1
        DiceToKill is reduced by 2

Engine stores casualties in 2 variables called:  KillFraction and SuppressFraction.


To get a Forecast of casualties , the formula is:
 

KillFraction = Diff + 21 - DiceToKill
if KillFraction is less than 1, it is set to 1
If KillFraction is bigger than 19, it is set to 19
Then  Pasive's expected kills are: ( 5 * KillFraction * Shots + 50 ) / 100 ... but no more than Pasive's strength
if Active has leader OverwhelmigAttack then expected kills are increased by 1
Remember "Shots" is the unit's unsuppressed strength.

To get casualties in real combat, this is the procedure:

One Dice(1,20) is thrown for each shot (unit's unsuppressed strength)
If Dice is higher than 1 and less than 20, Diff is added to Dice ... notice a Dice==20 always get a kill, regardless Diff
If resultant value is less than DiceToSuppress, shot had no effect
If resultant value is >= than DiceToKill then
  • KillFraction is increased by 1
  • SuppressFraction is increased by 1
Else
  • SuppressFraction is increased by 2

After all shots have been fired:

SuppressFraction is halved
KillFraction is checked to be less or equal to Pasive strenght
SuppressFraction is checked to be less or equal to Pasive's Strenght - KillFraction
if SuppressFraction>0 and Active has leader OverwhelmigAttack then SuppressFraction is reduced to 1 and KillFraction is increased in 1

*** Casualties for Pasive units are reported as: KillFraction , SuppressFraction ***

Finally engine checks for experience gained, ONLY if KillFraction is bigger than zero.

Two "ExpBonus" are used to figure experience
If Pasive has EffAtk: ExpBonus1 = Pasive's EffAtk + 6 - Active's EffDef
.- if ExpBonus1<1 then ExpBonus1=1
.- finally: ExpBonus1 = ExpBonus1 * Pasive's UnsuppressedStrength
ExpBonus2 = Pasive's EffDef + 6 - Active's EffAtk
.- if ExpBonus2<1 then ExpBonus2=1
These bonus are summed up to get a total: ExpBonus = ExpBonus1 + ExpBonus2
.- if ExpBonus > 15 then ExpBonus = 15
Then for Active ExpGained.A = ExpBonus * KillFraction
And for Pasive ExpGained.P = 2 * KillFraction
... * If $Var: exp_bar_factor is defined, ExpGained is adjusted depending unit's bars ...
... If Active has any exp-bar: ExpGained.A = ( ExpGained.A * (100 - Active's exp_bar * $exp_bar_factor) + 50 ) / 100
... If Pasive has any exp-bar: ExpGained.P = ( ExpGained.P * (100 - Pasive's exp_bar * $exp_bar_factor) + 50 ) / 100

Retreat from combat procedure

Only Defender can be forzed to retreat after combat.

if these conditions are fulfilled ...

  • Combat is not Rugged
  • Combat was not broken by support fire and Attacker (nor Defender) is not killed
  • Attacker is Land-unit but not not Arty-class, nor Fort-class nor AD-class
  • All Defender strenght is suppressed
  • Defender took either kills or suppression or both
Defender should retreat...

if CloseCombat or terrain entrench for Defender hex is >= Defender entrenchment

  • if Defender is not Fort-class and can move and finds an adjacent hex to retreat ... it moves there.
  • else if Defender has leaderFerociousDefender or NoSurrender special attribute
    Defender stands (ignores suppression)
    otherwise ... Defender is killed!

Critical-hits

When $Var: critical_hit is defined and Defender is Naval-unit and is not killed in combat, there is a chance of getting a Critical-hit sinking the unit.

Critical hits requires that Attacker and Defender has suffered at least 1 kill.

Chance of critical hit depends on the value assigned to $Var: critical_hit according this formula:
Chance = ( NA(Firing) * (1+bars(Firing)) * SP(Firing) * N - D(Fired) * (1+Bars(Fired)) * SP(Fired) * N ) / 30
where:

  • NA(Firing) is naval attack of unit firing
  • SP(Firing/Fired) is unit strength at start of combat
  • N is the value assigned to $Var
  • D(Fired) is GD or AD depending Attacker is Air/Gnd.
  • Submarines always add 10% when firing (either if attacking or defending)
  • If Chance > 75 then Chance=75
  • If Chance < Dice(1,100) then critical hit, Defender is sunk

Update stats procedure

In this routine the engine updates the working copy of a unit, doing this:

  • Strength is updated according its casualties.
  • If unit fired, Ammo is reduced by 1
  • Entrench is adjusted
  • Experience gained when firing/fired, is increased, adjusting bars when needed and if Unit increases its bars, engine checks if unit can get a leader

  • Comments

    Not every unit can attack every enemy, there are some exceptions, apart the obvious that anyone can guess (like unit not having enemy within its range of fire and similar)
    ... so here you are some exceptions:

    Submarines
    when not being surprised, they can be attacked only by these units:

    • Attacker is of class Tactical Bomber / Destroyer and has not "ASW" special attribute
    • Attacker is not class Tactical Bomber / Destroyer and has "ASW" special attribute
    • Submarine is in Port (or bridge when $naval_noblock_bridge is defined) and Attacker's class is Infantry, Tank, Recon, AntiTank or Flak and is not Air-unit