<!-- If this is an increase, add one to the trait, and subtract one for a decrease -->
<eval index="4" phase="Traits" priority="2000" name="Calc Advance"><![CDATA[
~we only worry about this on actual advances - not traits added at creation
doneif (tagis[Advance.Gizmo] = 0)
var basevalue as number
~if we're one of the shifter attribute advancements, we'll establish a
~focus to the version of ourselves that exists inside the shift power's
~gizmo. If not, we'll set the focus to linkage[basis]
if (origin.parent.tagis[Advance.ShiftAttr] <> 0) then
doneif (hero.childlives[cpShiftSha] = 0)
perform hero.child[cpShiftSha].gizmo.findchild[Attribute,"thingid." & linkage[basis].idstring].setfocus
elseif (origin.parent.tagexpr[Advance.Increase | Advance.Decrease] <> 0) then
perform linkage[basis].setfocus
endif
if (origin.parent.tagexpr[Advance.Increase | Advance.Decrease] <> 0) then
doneif (state.isfocus = 0)
endif
~increase and decrease advancements often need to look up the base value of the thing they're working with
if (origin.parent.tagis[Advance.Increase] + origin.parent.tagis[Advance.Decrease] <> 0) then
if (tagis[component.SkillIndiv] <> 0) then
basevalue = maximum(focus.field[trtUser].value, focus.field[sklGroup].value) + focus.field[trtAdvMod].value + focus.field[trtBase].value + focus.field[trtBonus].value + focus.field[trtInitial].value
else
basevalue = focus.field[trtUser].value + focus.field[trtAdvMod].value + focus.field[trtBase].value + focus.field[trtBonus].value + focus.field[trtInitial].value
endif
endif
~apply any appropriate increase or decrease for the linked trait
~Note: This pick is a child of the gizmo and our parent pick is the actual "Advance"
~ pick that contains the appopriate "Advance" tag, so be sure to check there.
~Note: Since the advancement is displaced to the hero, it's "parent" is *not* the
~ gizmo, so we must explicitly reference through the "origin" container.
if (origin.parent.tagis[Advance.Increase] > 0) then
perform focus.field[trtBase].modify[+,1,"Advancement"]
if (origin.parent.tagis[Advance.MaximumToo] <> 0) then
focus.field[trtNatMax].value += 1
endif
if (tagis[component.Quality] + tagis[component.AdeptPower] <> 0) then
origin.parent.field[advCost].value = (focus.field[abRating].arrayvalue[basevalue] - focus.field[abRating].arrayvalue[basevalue - 1]) * focus.field[trtAdvCost].value
else
if (tagis[Advance.MultNew] <> 0) then
origin.parent.field[advCost].value += focus.field[trtAdvCost].value * (basevalue + 1)
else
origin.parent.field[advCost].value += focus.field[trtAdvCost].value
endif
endif
elseif (origin.parent.tagis[Advance.Decrease] > 0) then
perform focus.field[trtBase].modify[-,1,"Advancement"]
if (origin.parent.tagis[Advance.MaximumToo] <> 0) then
focus.field[trtNatMax].value -= 1
endif
if (tagis[component.Ability] <> 0) then
if (basevalue <= 1) then
if (focus.field[trtBPCost].value <> 0) then
origin.parent.field[advCost].value = - focus.field[trtBPCost].value * focus.field[trtAdvCost].value
else
origin.parent.field[advCost].value = - focus.field[abRating].arrayvalue[0] * focus.field[trtAdvCost].value
endif
else
origin.parent.field[advCost].value = (focus.field[abRating].arrayvalue[basevalue - 2] - focus.field[abRating].arrayvalue[basevalue - 1]) * focus.field[trtAdvCost].value
endif
else
if (tagis[Advance.MultNew] <> 0) then
origin.parent.field[advCost].value += focus.field[trtAdvCost].value * (basevalue)
else
origin.parent.field[advCost].value += focus.field[trtAdvCost].value
endif
endif
elseif (origin.parent.tagis[Advance.AddNew] <> 0) then
~abilities don't get the rating point. They handle the initial point
~with their minimum values.
if (tagis[component.Ability] = 0) then
if (tagis[component.Skill] <> 0) then
if (hero.tagis[Hero.AllySpirit] = 0) then
perform field[trtBase].modify[+,1,"Advancement"]
endif
else
perform field[trtBase].modify[+,1,"Advancement"]
endif
endif
if (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].tagexpr[component.Power | component.ProgEcho] <> 0) then
origin.parent.field[advCost].value += field[trtAdvCost].value
elseif (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].tagis[component.Ability] <> 0) then
if (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[abRating].arrayvalue[0] <> 0) then
origin.parent.field[advCost].value += origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[abRating].arrayvalue[0] * field[trtAdvCost].value
else
origin.parent.field[advCost].value += origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[trtBPCost].value * field[trtAdvCost].value
endif
endif
endif
if (origin.parent.tagis[Advance.NoCost] <> 0) then
origin.parent.field[advCost].value = 0
endif
]]></eval>