Unit Cost (Advanced)
The basic cost formula, to which there are several modifiers, is:
Cost = Weapon × (Armor + Speed) × 10 ÷ (2 ^ (Reactor + 1))
- Weapon value never less than half armor value
- Cost is halved for units with speed of one
- Cost is halved for sea units, and armor is discounted 50%
- Cost quartered for combat air units
- Armor cost doubled for air units
- Cost +25% for each unit of special ability cost
- Cost +25% if unit has two abilities and the ability it has which appears in alphax.txt first is not free (if the free ability comes second, it will increase price)
- Cost +10 minerals if both weapon and armor greater than one
- Cost +10 minerals if land unit’s weapon, armor, speed all greater than one
- Minimum cost (Reactor × 2 - Reactor ÷ 2) × 10 unless all values are one
Cost formula as discovered by Yutzi
Discussed in this topic.
http://alphacentauri2.info/index.php?topic=3038.msg18823#msg18823
Bold are correction from the post above uncovered later in the thread.
Ok, the actual formula (which someone else can take care of posting to the wiki), if I read things right:
Except where otherwise noted, all fractions are rounded toward 0 (down if positive, up if negative). Major divergences from the datalinks formula are italicized.
- Find the cost of the unit's armor. If it is a sea unit, divide by 2; if it is an air unit with armor cost more than 1, multiply by twice its reactor value.
- Take the new armor cost, halve it, and add 1. If the weapon costs less than this, use this instead of weapon cost.
- Find the cost of the unit's chassis. If it is a sea unit, add the unit's reactor; if it is an air unit add twice the unit's reactor (which, without mods, brings it up to its speed).
- Using these modified values, calculate WeaponX(Armor+Speed)/2^(Reactor+1), rounding normally (less than .5 rounds down; more or equal than .5 rounds up)
- If the (modified) chassis cost is 1, divide by 2 and add 1.
- If the unmodified weapon and armor cost are both more than 1, add 1. If it is a land unit and the chassis cost is also more than 1, add another 1.
- If it is a sea unit which is not an probe team, divide by two,
rounding uprounding normally (less than .5 rounds down; more or equal than .5 rounds up). - If it is an air unit, divide the result by 4 if it is a combat unit, or 2 for a noncombat unit.
- However, unless the (modified) weapon cost, armor cost, chassis cost, and reactor are all 1, there is a minimum of ReactorX2-(Reactor/2)
- Now add 25% for each point of ability cost, rounding normally. This is the unit cost in rows.
- Planet buster missiles ignore all of the above calculations; their cost in rows is simply the weapon cost.