The specialties were chosen by the user, on the add an advance form, right?
Here's another piece of code from the skeleton files:
Code:
<!-- Each skill point that is allocated by the user costs 2 CP -->
<eval index="2" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
~if this skill is not added directly to the hero (i.e. an advance), skip it entirely
doneif (origin.ishero = 0)
~adjust the resource appropriately
hero.child[resCP].field[resSpent].value += field[trtUser].value * 2
]]></eval>