var highmod as number
~ Go through all casting classes.
foreach pick in hero from BaseClHelp where "CasterSrc.?"
  ~ transition through the attribute linkage, is it higher than our current
  ~ variable? If so, set the variable to this and set the focus to the linked
  ~ attribute.
  if (eachpick.linkage[spellattr].field[aModBonus].value > highmod) then
    perform eachpick.linkage[spellattr].setfocus
    highmod = eachpick.linkage[spellattr].field[aModBonus].value
  ~ Otherwise, do nothing, we'll check the next class
  else
    ~ Nothing
    endif
  nexteach
~ It's possible that we're added to a character with no casting classes. In that
~ case, we don't have a focus and should stop now.
doneif (state.isfocus = 0)
~ Finally, pull the appropriate tag from the focus attribute to ourselves, which
~ will override our melee attack attribute.
perform focus.pulltags[MelAttOver.?]