I cracked it and got an initial build working by taking apart Defensive Weapon Training feat. Now I just need to add conditions for Grapple and Spell as selections and to test that Natural special condition works properly. I'll post the finished result once I have those sorted out. Working so far:
Code:
~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)
~ If we haven't chosen anything, get out now
doneif (field[usrChosen1].ischosen = 0)
~get the wFtrGroup tag from our choice
perform field[usrChosen1].chosen.pulltags[wFtrGroup.?]
~if we didn't find a wFtrGroup tag, there's nothing more we can do
doneif (tagis[wFtrGroup.?] = 0)
~ If we are a bonus feat which ignores pre-reqs, we don't want our weapons
~ to complain when they don't find those pre-reqs we skipped.
if (tagis[thing.skipprereq] <> 0) then
perform assign[Broadcast.NoPWepFocu]
endif
~ Assign the appropriate tag to all weapons that meet the criteria
var id as string
var name as string
call fTargetId
foreach pick in hero from BaseWep
if (eachpick.tagmatch[wFtrGroup,wFtrGroup,initial] <> 0) then
perform eachpick.assign[Broadcast.WepFocus]
perform eachpick.pulltags[WepFocus.?]
perform eachpick.pushtags[Broadcast.?]
endif
nexteach
perform hero.pushtags[WepFocus.?]
~ Set our 'short name'
field[shortname].text = "Focus: " & name
field[sbName].text = "Weapon Focus (" & lowercase(name) & ")"
~ If the selected weapon is a natural weapon, then apply the Hero.NatWpFocus
~ tag to the hero. We do this here so that the hero doesn't actually have
~ to have such a weapon on their character in order to get the tag and
~ qualify for pre-reqs based on it. For example, a Druid/Monk may want
~ to take Weapon Focus (Claw) in order to take Feral Combat Training, but
~ may not actually have claws most of the time (only when wild shaped).
if (field[usrChosen1].chosen.tagis[wFtrGroup.Natural] <> 0) then
perform hero.assign[Hero.NatWpFocus]
endif
~ Choosing Grapple gives us a bonus on those checks
if (field[usrChosen1].chosen.tagis[thingid.wGrapple] <> 0) then
~ Add a +1 bonus to the Grapple CMB
hero.child[manGrapple].field[cmbBonus].value += 1
endif
~ This is chiefly for the Low Templar PrC's pre-req (which requires weapon
~ focus in any martial weapon), but also checking Simple and Exotic as
~ well in case those are needed in the future.
if (tagis[wProfReq.Simple] <> 0) then
perform hero.assign[Hero.SimWpFocus]
endif
if (tagis[wProfReq.Martial] <> 0) then
perform hero.assign[Hero.MrtWpFocus]
endif
if (tagis[wProfReq.Exotic] <> 0) then
perform hero.assign[Hero.ExoWpFocus]
endif