Loggy's interpretation of the chassis value function code
The "chassis value" function (there's no mark suggesting what name Illwinter may have given it) is used in a variety of places, out of a lack of other solutions I thought it sensible to put it here.
Calculate "HP value": (current HP + 10)/2, rounded down
Score is the following things added together:
If prot is 14+:
If unit is ethereal, double score
If the unit is regenerating, score = ((regen % * 3 + 100) * score) /100
Add fear value to the score, if any
If the unit has fire shield, add (HP val/3)
If the unit has awe, add (HP val/3)
If the unit has either heat or chill aura, or both, add (HP val/3)
If the unit's base chassis is a trampler (not via items), add (HP val/3)
If the unit's base chassis is sacred (not blessed via items, pretender, prophetising etc), add HP val
If the unit's base chassis has 13+ morale, add 20% of hpval to the score
If the unit's base chassis has 9 or lower morale, subtract 20% of hpval from the score
For each weapon on the unit:
Chassis value can't be smaller than 5
Alternatively, here's one I made earlier