• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Improved Flanking

Fuzzy

Well-known member
I'm trying to implement a house rule feat we use called Improved Flanking. It is as follows:
Code:
[COLOR="Red"][I][B]Prerequisite:[/B][/I] You must have a Sneak Attack ability of at least 3d6.[/COLOR]

[I][B]Benefit:[/B][/I] You gain a +1 flanking bonus for each d6 of sneak attack damage. Note that this bonus applies to any opponent in a flanking position, even if that opponent is immune to sneak attacks.

[B][I]Normally:[/I][/B] You no longer gain the +2 flanking bonus, regardless of Sneak Attack ability.

[B][I]Special:[/I][/B] Rogues gain this feat as a bonus feat at 5th level.

Prereq is handled fine:
Code:
validif (#value[cSneakAtt] >= 3)

the problem is coming down to a chicken/egg scenario with determining the bonuses. This is how I'm determining the bonus in the feat (fImpFlank):
Final Phase 10001
Code:
if (#value[cSneakAtt] > 2) then
     field[abValue].value = #value[cSneakAtt]
else
     field[abValue].value = 2
endif

And this is how I'm implementing the bonus (pstFlanki2 replaces pstFlankin):
Post-levels 20000
Code:
      ~ If we're in output mode, don't do anything
      doneif (state.isoutput <> 0)

      ~attack
      if (#hasfeat[fImpFlank] <> 0) then
            ~improved flanking feat            
            field[abValue2].value += #value[fImpFlank]
      else
            ~normal flanking
            field[abValue2].value += 2
      endif

      ~ If we're not enabled, get out now
      doneif (field[pIsOn].value + hero.isidentity[Condition] = 0)

      ~+2 to hit
      hero.child[Attack].field[tAtkMelee].value += field[abValue2].value
Final Phase 20000
Code:
      ~ If we're in output mode, don't do anything
      doneif (state.isoutput <> 0)

      if (#hasfeat[fImpFlank] <> 0) then
            ~improved flanking feat            
            field[livename].text = "Imp. Flanking (" & signed(field[abValue2].value) & " Melee)"
      else
            ~normal flanking
            field[livename].text = field[thingname].text & " (" & signed(field[abValue2].value) & " Melee)"
      endif

The problem arises from the fact that the Flanking calculation is done at post-levels/20000, but I can't perform the bonus calculation until after cSneakAtt is processed at Final Phase/10000.
 
well, that was quick. Figured it out as I was clicking post. I fixed it by simply looking at the count of sneak attack (which is determined MUCH earlier), instead of the abValue. So I've changed my feat eval to:
Post-levels/19999
Code:
var SnkAtt as number
SnkAtt = hero.child[cSneakAtt].field[xCount].value
if (SnkAtt > 2) then
     field[abValue].value = SnkAtt
else
     field[abValue].value = 2
endif
which seems to be working...
 
And for added flavor, changed the livename to show the bonus in the specials panel:
Final Phase/10000
Code:
field[livename].text = field[thingname].text & " (" & signed(field[abValue].value) & " Melee)"
 
So the final XML for it:
Code:
  <thing id="fImpFlank" name="Improved Flanking" description="Prerequisite: You must have a Sneak Attack ability of at least 3d6.\n\nYour ability to strike swiftly and with precision allows you more fully take advantage a flanked opponent.\n\nBenefit: You gain a +1 flanking bonus for each d6 of sneak attack damage. Note that this bonus applies to any opponent in a flanking position, even if that opponent is immune to sneak attacks.\n\nNormally: You no longer gain the +2 flanking bonus, regardless of Sneak Attack ability.\n\nSpecial: Rogues gain this feat as a bonus feat at 5th level." compset="Feat" summary="Flanking bonus is based on Sneak Attack dice count." uniqueness="useronce">
    <fieldval field="shortname" value="Imp. Flank"/>
    <usesource source="Mistfallen"/>
    <tag group="fCategory" tag="Combat"/>
    <tag group="Helper" tag="ShowSpec"/>
    <eval phase="PostLevel" priority="19999"><![CDATA[var SnkAtt as number
SnkAtt = hero.child[cSneakAtt].field[xCount].value
if (SnkAtt > 2) then
     field[abValue].value = SnkAtt
else
     field[abValue].value = 2
endif]]></eval>
    <eval phase="UserFinal" priority="10000" index="2"><![CDATA[field[livename].text = field[thingname].text & " (" & signed(field[abValue].value) & " Melee)"]]></eval>
    <prereq message="You must have a Sneak Attack ability of at least 3d6.">
      <validate><![CDATA[validif (#value[cSneakAtt] >= 3)]]></validate>
      </prereq>
    </thing>
  <thing id="cImpFlank" name="Improved Flanking" compset="ClSpecial" summary="Flanking bonus based on Sneak Attack dice.">
    <usesource source="Mistfallen"/>
    <tag group="Helper" tag="UseOwnLev" name="UseOwnLev" abbrev="UseOwnLev"/>
    <tag group="SpecType" tag="Attack"/>
    <tag group="AbilType" tag="Extra" name="Extraordinary Ability" abbrev=" (Ex)"/>
    <bootstrap thing="fImpFlank">
      <containerreq phase="First" priority="500"><![CDATA[Classes.Rogue >= 5]]></containerreq>
      </bootstrap>
    </thing>
<thing id="psfFlanki2" name="Flanking (w/ Improved)" description="When making a melee attack, you get a +2 flanking bonus if your opponent is threatened by another enemy character or creature on its opposite border or opposite corner. When in doubt about whether two characters flank an opponent in the middle, trace an imaginary line between the two attackers&apos; centers. If the line passes through opposite borders of the opponent&apos;s space (including corners of those borders), then the opponent is flanked.{br}{br}{i}Exception{/i}: If a flanker takes up more than 1 square, it gets the flanking bonus if any square it occupies counts for flanking.{br}{br}Only a creature or character that threatens the defender can help an attacker get a flanking bonus.{br}{br}Creatures with a reach of 0 feet can&apos;t flank an opponent." compset="InPlay" replaces="pstFlankin">
    <tag group="Helper" tag="AdjState" name="Combat State" abbrev="Combat State"/>
    <eval phase="PostLevel" priority="20000"><![CDATA[
      ~ If we're in output mode, don't do anything
      doneif (state.isoutput <> 0)

      ~attack
      if (#hasfeat[fImpFlank] <> 0) then
            ~improved flanking feat            
            field[abValue2].value += #value[fImpFlank]
      else
            ~normal flanking
            field[abValue2].value += 2
      endif

      ~ If we're not enabled, get out now
      doneif (field[pIsOn].value + hero.isidentity[Condition] = 0)

      ~+2 to hit
      hero.child[Attack].field[tAtkMelee].value += field[abValue2].value]]></eval>
    <eval phase="Final" priority="20000" index="2"><![CDATA[
      ~ If we're in output mode, don't do anything
      doneif (state.isoutput <> 0)

      if (#hasfeat[fImpFlank] <> 0) then
            ~improved flanking feat            
            field[livename].text = "Imp. Flanking (" & signed(field[abValue2].value) & " Melee)"
      else
            ~normal flanking
            field[livename].text = field[thingname].text & " (" & signed(field[abValue2].value) & " Melee)"
      endif]]></eval>
    </thing>
 
oh come-on, you could have left some sort of sage advice there anyways...

Okay,

What forces the Flanking to be at post-levels/20000, and not Final/11000?

What forces the ability to be at Final/10001, and not post-levels/19000?

(as it stands, I don't think your script would handle an Improved Sneak Attack feat - something I've seen as a house rule in various places - trade feat slots for extra sneak damage dice).
 
Okay,

What forces the Flanking to be at post-levels/20000, and not Final/11000?

What forces the ability to be at Final/10001, and not post-levels/19000?

(as it stands, I don't think your script would handle an Improved Sneak Attack feat - something I've seen as a house rule in various places - trade feat slots for extra sneak damage dice).

I'm pretty sure we wouldn't be using that feat. Both of those are ways to fix the effectiveness of sneak attacks (at mid-low levels, they sometimes aren't worth the risk with your otherwise weaker rogue up in their face. I much prefer incentivising it by giving a bit more change of success, while adding an extra dice or two to it would be far too overpowered at lower levels.

Still, it would simply depend on how the Improved Sneak Attack feat was coded. If it simply bootstraps in more picks of cSneakAtt, then it should still be captured by this method.
 
Back
Top