Combat
======

Combat in Olympia occurs when one stack attacks another stack.

A unit will be defended by any other characters it is stacked with.
Thus, a unit which is part of a stack cannot be attacked alone.
No matter which unit is specified in the ATTACK order, the entire
stack containing the unit will respond.

Only the leader of a stack may initiate combat.  If another unit in a
stack wants to issue ATTACK, it must first drop out of the stack.

Combat involves nobles, who possess strong heroic fighting abilities,
and fighters who may accompany them.  Fighters include soldiers,
pikemen, swordsmen, knights, elite guard, crossbowmen, archers, and
elite archers.


Resolution of battle
--------------------

Each kind of fighter has an attack and defense rating:

                     attack    defense    missile
                    +----------------------------
    peasant         |   1         1
    worker          |   1         1
    sailor          |   1         1
    soldier         |   5         5 
    pikeman         |   5        30
    swordsman       |  15        15
    pirate          |   5 (15)    5 (15)
    knight          |  45 (20)   45 (20)
    elite guard     |  90 (65)   90 (65)
    crossbowman     |   1         1         25
    archer          |   5         5         50
    elite archer    |  10        10         75

Numbers in parenthesis are for shipboard combat.

Nobles have strong innate heroic abilities, and so even an unarmed,
untrained noble is a formidable opponent on the battlefield.

    A noble is rated (attack=80, defense=80, missile=0).

A blessed soldier fights with the same attack and defense values
as a regular soldier, but has a 50% chance of surviving a hit.

A pirate fights (15,15,0) on a ship, but only (5,5,0) on land.

Knights and elite guard receive a -25 penalty to both their attack and
defense ratings when fighting on a ship or in a swamp province.

During combat, a random man is chosen to attack.  If the attack succeeds,
the target is removed from battle.  This continues until the battle is over.

More specifically:

1.  A man is picked at random to attack.  This man may be from either
    side in the battle.

    For example, if there are 10 men on side A, and 20 men on side B,
    there is a 1/3 chance that one of A's men will be chosen, and a
    2/3 chance that one of B's men will be chosen.

2.  The attacker chooses an enemy target at random.  The target may
    be any of the men in the enemy's front units.  A ship or building
    housing the enemy also counts as a potential target.

    In other words, if there are five men in a tower, each man has 1/6
    chance of being selected as a target, and the tower also has 1/6
    chance of being paired with an attacker.

3.  The chance that the attacker will score a hit against the target is:

        A = attacker's attack rating
        B = target's defense rating

        A / (A + B)

    For example:

        A(attack=90) vs B(defense=45)     A has a 2/3 chance of killing B
        A(attack=90) vs B(defense=90)     A has a 1/2 chance of killing B

4.  If the attacker scores a hit against a noble, the noble will receive
    a random wound of 1-100 health points.  Note that there is a 1% chance
    that a perfectly healthy noble will be instantly killed, and a greater
    chance that a previously wounded noble will die.  (See the section on
    health for more information on wounds, illness and healing.)

    Wounded nobles do not continue fighting, even if their wounds are minor.
    
    If a hit is scored against a fighter (soldiers, pikemen, archers, etc.),
    the fighter is killed.  However, a blessed soldier has a 50% chance of
    surviving a hit.
    
    A man successfully attacking a building or a ship will cause one point
    of damage to the structure.  A siege engine attacking a building will
    cause 5-10 points of damage.

5.  Repeats until a side breaks.  A side breaks when its total offensive
    plus defensive value falls by 50%.

    For instance, a noble plus two pikemen has a value of

        (80+80) + (5+30) + (5+30) = 230         break point: 115

    A noble plus two knights has a value of

        (80+80) + (45+45) + (45+45) = 340       break point: 170

    Therefore, a noble with two pikemen will continue to fight if the
    pikemen are killed.  However, a noble with two knights will be
    declared the loser if both knights are killed.

    The offensive value used is either the attack or the effective
    missile rating, whichever is higher.

Note that in step 4, if the target is not hit, the target does not
immediately retaliate against the attacker.  Only when the target is
randomly selected to make an attack will it have a chance to score a hit.

The winner in combat will attempt to take prisoners.  The chance that a
given defeated unit will be taken prisoner is proportional to the sizes
of the remaining forces.

(Taking prisoners in battle and claiming loot requires many soldiers to
run after the fleeing enemy.  Thus, the chance of success is based on
numerical advantage rather than combat skill.)

        1:1     25%
        2:1     50%
        3:1     75%

If the winning side outnumbers the defeated force by 2:1, there is a 50%
chance that a given defeated unit will be captured.  Defeated units which
are not captured retreat from battle.  If they are occupying a building or
are located in a city, they may flee into the outlying province.

The victor always has at least a 25% chance of taking a unit prisoner, but
no better than a 75% chance.

The victor will claim the defender's position in the location list if it is
better, or will move into the defender's structure, ejecting the losing force.
(The attacker may specify a flag to the ATTACK order to inhibit this behavior.)

Prisoners are stripped of their belongings by the victor, including any men
accompanying the prisoners, such as workers or peasants.  The stack leader
of the winning force receives all of the loot from the battle.


Front and rear
--------------

Units may issue the BEHIND command to declare whether they will line
the front or the rear in battle.  Rear units do not become targets
for the enemy until all of the units in the rows in front of them
have been killed.  Only missile fighters, such as archers, may attack
from the rear.

The leader of each stack (the top-most unit in the stack) will be the
last unit to receive hits, regardless of its BEHIND status.


Missile Attacks
---------------

Units in the rear may attack with their missile rating.  Units in front
attack with either their missile rating, or their attack rating, whichever
is higher.

Thus, a noble with rating (attack=80, defense=80, missile=40) will do
an attack of 40 when in the rear, and an attack of 80 when in front.

If the location of the battle is windy, all missile ratings are halved.
If it is raining, the missile rating for archers and elite archers is
reduced to zero.

If a fighter's missile rating is zero, it can not attack from the rear.
In this case, the fighter will use its attack rating like a regular soldier.



Fortifications
--------------

Structures which may aid fighters in battle are rated for their
defensive bonus.

        Castle Imperius [gx56], castle, defense 25

During battle, the fortification rating is added to the defense
number for the men who fit inside the structure.

        structure               men protected
        ---------               -------------
        Castle                  first 500
        Tower                   first 100
        Galley or roundship     first 50
        Other structures        first 50

Attacking fighters may randomly select the structure instead of an enemy
fighter.  The attack is resolved in the same way as for two fighters,
using the attacker's attack rating and the structure's defense rating.
If the attacker is successful the structure's defense rating will be
lowered by one point.

Once the defense rating reaches zero, further hits will cause the building
to become damaged.  A fully damaged building (100% damage) will collapse,
ejecting its occupants.

Siege engines always select the structure as a target.

        engine          attack  defense   missile
        ------          ------  -------   -------
        catapult          25      200       25
        battering ram     30      250
        siege tower       30      250

Siege engines do 5-10 points of damage to the structure per hit.

Siege engines are not used in combat at sea.


Item bonuses
------------

Nobles may possess items which grant attack, defense or missile bonuses
in combat.  Only one item may be wielded for each category.  If the noble
possesses multiple items with bonuses in the same area, the item with the
largest bonus will be chosen.

For example, suppose Osswid had the following items:

	Shield of Achilles [fx78]	+25 defense
	Sword of Death [gl23]		+10 attack
	Mithril Axe [wt29]		+15 attack
	Magic javelin [ht02]		+5 missile

Osswid would wield the javelin and axe, and wear the shield.  He would not
use the Sword of Death.

Nobles automatically use items with combat bonuses in battle.  No special
orders are needed to wield them.


