I'm trying to implement a house rule feat we use called Improved Flanking. It is as follows:
Prereq is handled fine:
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
And this is how I'm implementing the bonus (pstFlanki2 replaces pstFlankin):
Post-levels 20000
Final Phase 20000
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.
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
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.