Units can restore their own and each other's hp by doing repairs.
Repair requires a repair action.
The action points for this action
are taken from both the unit being repaired and
the repairer (using the same table acp-to-repair).
When a unit repairs itself, the action cost is counted once only.
ActionType: repair unit
This is the action of repairing the given unit.
Table: acp-to-repair u1 u2 -> acp
This table is the number of action points used up
by a unit of type u1
doing one repair action on a unit of type u2.
Defaults to 0, which disallows the action.
Table: hp-per-repair u1 u2 -> .01hp
This table is the hundredths of a hp that a single repair action
by a unit of type u1 restores to a unit of type u2.
The fraction of this over 100 is added to hp directly,
while the < 100 fraction is added probabilistically.
(For example, a value of 160 means that 1 hp will be added for
each action, and there is a 60% chance that a second hp will
be added also.)
Defaults to 0.
Materials may be needed and/or consumed during repair. The materials will be taken from the unit being repaired, then from the repairer.
Table: material-to-repair u m -> .01n
This table is the amount of each material type m needed
for one repair action.
As with hp-per-repair,
the < 100 part is average, and > 100 is guaranteed.
Defaults to 0.
Table: consumption-per-repair u m -> .01n
This table is the amount of each material type m used up by a repair action.
The repairing unit must also not be too damaged itself to do repairs.
Table: hp-to-repair u1 u2 -> hp
This table is the minimum hp level required of a unit of type u1
to repair a unit of type u2.
If less, then u1 is too damaged to do any repairing.
Defaults to 1, which allows repair always.
(The following are not really part of the repair action definition, since they occur automatically.)
Table: auto-repair u1 u2 -> .01hp
This table is the amount of repair (in 1/100 hp) that u1 will do
on any unit of type u2 within range (auto-repair-range).
As with hp-per-repair,
the < 1.00 part is average, and > 1.00 is guaranteed.
Defaults to 0, which disallows auto-repair.
Table: auto-repair-range u1 u2 -> dist
This table is the distance out to which u1 will auto-repair
any damaged u2. A value of 0 requires the two units
to be in the same cell, while a value of -1 means that
u2 must be either an occupant or transport of u1.
Defaults to 0.