(or, you can skip defining all those variables as intermediate steps):
Code:
<!-- Each attribute point above one that is allocated by the user costs 4CP * the level, per level -->
<eval index="3" phase="Traits" priority="10000">
<before name="Calc resLeft"/>
<after name="Bound trtUser"/><![CDATA[
hero.child[resCP].field[resSpent].value += (field[trtCPCost].value / 2 * (field[trtUser].value ^ 2 + field[trtUser].value)) - 12
]]></eval>