Skip to content

Fix: Power Attack on natural attacks (1.5x Str, secondary halving) and lost temp bonuses on save - #7762

Merged
Vest merged 7 commits into
PCGen:masterfrom
liao1994:bug/power_attack_natural_attacks_7695
Oct 31, 2026
Merged

Vest merged 7 commits into
PCGen:masterfrom
liao1994:bug/power_attack_natural_attacks_7695

Conversation

@liao1994

@liao1994 liao1994 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7695

On a primary natural weapon that adds 1-1/2x Str (a lone bite, or a bite with Improved Bite), the natural-attack Power Attack options only gave the 1x damage bonus. The 1.5x natural-attack ability existed in the data but could never be granted.

This PR also fixes:

  • Secondary natural attacks now get half the damage bonus (CRB p.131). They used to get the full bonus.
  • The 1.5x natural-attack option is only offered to characters it can apply to: a single natural attack, the Improved Bite evolution, or a dragon disciple's Dragon Bite. The player still picks it per weapon. It's also renamed from "- Single" to "- 1.5x Str" so it's clear which option to pick.
  • TEMPORARY type is no longer added again on each rebuild. The type is now only added if it isn't already there.
  • A save bug that is not specific to Power Attack. PCGVer2Creator.appendTempBonuses sorted temp bonuses with a comparator that ignored the source and target, so an identical temp bonus applied to two different targets (e.g. two weapons) was saved for only one of them. With Power Attack on both a bite and a tail slap, one of the two weapons (the bite, in the test) lost its to-hit penalty after reload. Ties are now broken on the source/target name.

The commits are meant to be reviewed one at a time. Each is one self-contained change with its own message; the commit that limits the 1.5x option also carries the small TEMPORARY-type fix. PowerAttackNaturalAttackTest (slowtest) covers all of the above, including a save and reload.

Not changed here: Power Attack (Two-Handed), (One-Handed) and (Light) also list Natural in their weapon targets, so Two-Handed's 1.5x is still offered on any natural weapon, as on master.

🤖 Generated with Claude Code

liao1994 and others added 5 commits October 23, 2026 21:05
Power Attack says the damage bonus is halved (-50%) for an off-hand weapon
or a secondary natural weapon, but "Power Attack (Natural Secondary)" used
the same PowerAttackDamageBase*PowerAttackModifier formula as the primary
one, so a secondary natural attack got the full bonus. At BAB +7 an eidolon's
tail slap gained +4 instead of +2.

Halve the base the way "Two-Handed" and "Natural Primary - Single" scale
theirs by 1.5, giving (PowerAttackDamageBase/2)*PowerAttackModifier. The
to-hit penalty is unchanged - it is not halved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The "Power Attack (Natural Primary - Single)" virtual ability was dead
code: it was only granted when the character had an Internal ability of
TYPE.NaturalAttackPrimarySingle (nothing has that type) and its TEMPBONUS
targeted weapon type NaturalPrimarySingle (no weapon has that type). As a
result a primary natural weapon that adds 1-1/2x Str (e.g. a lone bite, or
an eidolon bite with the Improved Bite evolution) only received the 1x
Power Attack bonus instead of 1.5x.

Wire it up to match the working 1x "Power Attack (Natural Primary)"
ability: grant it on PREABILITY TYPE.NaturalAttackPrimary and target the
real NaturalPrimary weapon type, keeping the intended 1.5x multiplier.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
With the previous commit both "Power Attack (Natural Primary)" and
"Power Attack (Natural Primary - Single)" are offered on any primary natural
weapon, and the player picks per weapon. "Single" gave no hint that it is
the one to use on an attack that adds 1-1/2x Strength, such as a lone bite
or a bite with the Improved Bite evolution.

TempBonusHelper builds an attack's bracket label from getKeyName(), so the
key is what the character sheet prints ("*Bite [Power Attack (Natural
Primary - 1.5x Str)]"). Rename the key along with the name and update the
ABILITY:FEAT|VIRTUAL reference that grants it. Nothing else in the data
refers to the old key, and before the previous commit the ability could not
be granted (it keyed off an Internal type nothing has), so no saved
character can have it applied.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…atural attacks

The items in tempBonusItemList are reused on every rebuild, so addType(TEMPORARY)
kept appending the type; only add it when it is not already present.

Only offer "Power Attack (Natural Primary - 1.5x Str)" when the natural attack
actually adds 1-1/2x Str: a lone natural attack (NaturalAttacks < 2) or the
Improved Bite evolution. Adds PowerAttackNaturalAttackTest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rgets

appendTempBonuses sorts the temp bonuses into a TreeSet whose comparator only
looks at the bonus text, so two entries with the same text from different
sources or targets compared equal and one was silently dropped. Applying
Power Attack (Natural Primary) to a bite and Power Attack (Natural Secondary)
to a tail slap saved the shared "WEAPON|TOHIT|-PowerAttackModifier" bonus for
only one of them, so the other weapon lost its -2 to hit on reload.

Break ties on the source/target name so every applied bonus is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Vest

Vest commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@LegacyKing I will check Java, can you please check LST/DATA changes?

@Vest

Vest commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@liao1994, Since you have written code with a bot, here is the reply from mine:

The Java fixes look correct, and halving the secondary natural attack damage bonus matches the feat text. I’d like one data correction before approving:

The new 1.5× eligibility restriction excludes Dragon Disciple’s Dragon Bite. In cr_feats.lst:134, the prerequisite requires either NaturalAttacks < 2 or Improved Bite. However, Dragon Bite explicitly adds 1.5× Strength and is granted alongside two claw attacks. That character satisfies neither condition, so the correct Power Attack variant remains unavailable.

Please extend eligibility to cover this case and add a Dragon Disciple regression test.

One smaller testing point: savingKeepsTheSameToHitBonusOnEachNaturalWeapon() checks the serialized PCG text but never reloads the character, whereas the PR description claims save round-trip coverage. Ideally, reload the character and verify both weapons retain their attack penalties and damage bonuses; otherwise, update the description to reflect the existing coverage.

liao1994 and others added 2 commits October 28, 2026 18:02
Dragon Bite is a primary natural attack that adds 1-1/2 times Strength,
but it comes with the Draconic bloodline's two claws, so a dragon disciple
has NaturalAttacks 3 and no Improved Bite: neither condition for
"Power Attack (Natural Primary - 1.5x Str)" held and the variant was not
offered for the bite.

Add Dragon Disciple ~ Dragon Bite to the abilities that qualify, and test
a Sorcerer 1 (Draconic) / Dragon Disciple 2 with claws and a bite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
savingKeepsTheSameToHitBonusOnEachNaturalWeapon only looked for both
TEMPBONUS lines in the saved PCG text. Rename it to
saveAndReloadKeepsPowerAttackOnEachNaturalWeapon: it now saves the eidolon
to a file, opens it again and checks that the bite and the tail slap each
still get their Power Attack to-hit penalty and damage bonus (-2/+4 and
-2/+2).

Without the PCGVer2Creator fix the reloaded bite gets 0 instead of -2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@liao1994

liao1994 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @Vest, both points are addressed in two new commits:

  • Dragon Bite (8e1061e): Dragon Disciple ~ Dragon Bite now qualifies for "Power Attack (Natural Primary - 1.5x Str)". The new test dragonDiscipleBiteGetsOneAndAHalfDamage builds a Sorcerer 1 (Draconic) / Dragon Disciple 2 with two claws and the bite (NaturalAttacks 3) and checks the bite gets -1 / +3. The other "Dragon Bite" abilities in the PF data (Dragon Shaman, Dahak) don't add 1.5x Str, so no other Dragon Bite needs it. Other 1.5x Str sources outside the Core Rulebook/APG (e.g. the Unchained eidolon evolution Unchained Evolution ~ Bite Str Damage, and Powerful Blows) aren't handled in this PR.
  • Reload coverage (733f4ed): the save test is now saveAndReloadKeepsPowerAttackOnEachNaturalWeapon. It writes the eidolon to a file, reopens it, and checks that the bite and tail slap still get -2/+4 and -2/+2. It fails without the PCGVer2Creator fix (the reloaded bite gets 0 instead of -2).

@LegacyKing LegacyKing assigned LegacyKing and unassigned Vest Oct 31, 2026

@LegacyKing LegacyKing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've added a counter var NaturalAttacks. I'm not seeing how that propogated to the creatures with natural attacks, but overall, seems like a safe change. I approve.

Pinpoint Targeting CATEGORY:FEAT TYPE:Combat PREABILITY:3,CATEGORY=FEAT,Improved Precise Shot,Point-Blank Shot,Precise Shot PREMULT:1,[PREVARGTEQ:PreStatScore_DEX,19],[PREVARGTEQ:FeatDexRequirement,19] PRETOTALAB:16 DESC:You can target the weak points in your opponent's armor. SOURCEPAGE:p.131 BENEFIT:As a standard action, make a single ranged attack. The target does not gain any armor, natural armor, or shield bonuses to its Armor Class. You do not gain the benefit of this feat if you move this round.
Point-Blank Shot CATEGORY:FEAT TYPE:Combat DESC:You are especially accurate when making ranged attacks against close target. BONUS:COMBAT|TOHIT-SHORTRANGE,DAMAGE-SHORTRANGE|1 SOURCEPAGE:p.131 BENEFIT:You get a +1 bonus on attack and damage rolls with ranged weapons at ranges of up to 30 feet.
Power Attack CATEGORY:FEAT TYPE:Combat.AttackOption PRETOTALAB:1 PREVARGTEQ:PreStatScore_STR,13 DEFINE:PowerAttackModifier|0 DEFINE:MonkFlurryPowerAttackModifier|0 DEFINE:PowerAttackDamageModifier|0 DEFINE:PowerAttackDamageBase|0 DESC:You can make exceptionally deadly melee attacks by sacrificing accuracy for strength. ABILITY:FEAT|VIRTUAL|Power Attack (Light)|Power Attack (Off-Hand)|Power Attack (One-Handed)|Power Attack (Two-Handed) ABILITY:FEAT|VIRTUAL|Power Attack (Flurry)|PRECLASS:1,Monk=1 ABILITY:FEAT|VIRTUAL|Power Attack (Natural Secondary)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackSecondary ABILITY:FEAT|VIRTUAL|Power Attack (Natural Primary)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackPrimary ABILITY:FEAT|VIRTUAL|Power Attack (Natural Primary - Single)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackPrimarySingle BONUS:VAR|PowerAttackModifier|(BAB/4)+1 BONUS:VAR|PowerAttackDamageBase|2 BONUS:VAR|PowerAttackDamageModifier|PowerAttackDamageBase*floor(PowerAttackModifier) BONUS:VAR|MonkFlurryPowerAttackModifier|BAB+(FlurryLVL-MonkBAB) SOURCEPAGE:p.131 BENEFIT:You can choose to take a -%1 penalty on all melee attack rolls and combat maneuver checks to gain a +%2 bonus on all melee damage rolls. This bonus to damage is increased by half (+50%%) if you are making an attack with a two-handed weapon, a one handed weapon using two hands, or a primary natural weapon that adds 1-1/2 times your Strength modifier on damage rolls. This bonus to damage is halved (-50%%) if you are making an attack with an off-hand weapon or secondary natural weapon. You must choose to use this feat before making an attack roll, and its effects last until your next turn. The bonus damage does not apply to touch attacks or effects that do not deal hit point damage.|PowerAttackModifier|PowerAttackDamageModifier
Power Attack CATEGORY:FEAT TYPE:Combat.AttackOption PRETOTALAB:1 PREVARGTEQ:PreStatScore_STR,13 DEFINE:PowerAttackModifier|0 DEFINE:MonkFlurryPowerAttackModifier|0 DEFINE:PowerAttackDamageModifier|0 DEFINE:PowerAttackDamageBase|0 DEFINE:NaturalAttacks|0 DESC:You can make exceptionally deadly melee attacks by sacrificing accuracy for strength. ABILITY:FEAT|VIRTUAL|Power Attack (Light)|Power Attack (Off-Hand)|Power Attack (One-Handed)|Power Attack (Two-Handed) ABILITY:FEAT|VIRTUAL|Power Attack (Flurry)|PRECLASS:1,Monk=1 ABILITY:FEAT|VIRTUAL|Power Attack (Natural Secondary)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackSecondary ABILITY:FEAT|VIRTUAL|Power Attack (Natural Primary)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackPrimary ABILITY:FEAT|VIRTUAL|Power Attack (Natural Primary - 1.5x Str)|PREABILITY:1,CATEGORY=Internal,TYPE.NaturalAttackPrimary|PREMULT:1,[PREVARLT:NaturalAttacks,2],[PREABILITY:1,CATEGORY=Special Ability,Evolution ~ Improved Bite,Temp Evolution ~ Improved Bite,Dragon Disciple ~ Dragon Bite] BONUS:VAR|PowerAttackModifier|(BAB/4)+1 BONUS:VAR|PowerAttackDamageBase|2 BONUS:VAR|PowerAttackDamageModifier|PowerAttackDamageBase*floor(PowerAttackModifier) BONUS:VAR|MonkFlurryPowerAttackModifier|BAB+(FlurryLVL-MonkBAB) SOURCEPAGE:p.131 BENEFIT:You can choose to take a -%1 penalty on all melee attack rolls and combat maneuver checks to gain a +%2 bonus on all melee damage rolls. This bonus to damage is increased by half (+50%%) if you are making an attack with a two-handed weapon, a one handed weapon using two hands, or a primary natural weapon that adds 1-1/2 times your Strength modifier on damage rolls. This bonus to damage is halved (-50%%) if you are making an attack with an off-hand weapon or secondary natural weapon. You must choose to use this feat before making an attack roll, and its effects last until your next turn. The bonus damage does not apply to touch attacks or effects that do not deal hit point damage.|PowerAttackModifier|PowerAttackDamageModifier

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we added a new define... lst here looks fine.

Power Attack (Two-Handed) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,TwoHanded;OneHanded;Natural|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,TwoHanded;OneHanded;Natural|WEAPON|DAMAGE|(PowerAttackDamageBase*1.5)*PowerAttackModifier|TYPE=Temporary
Power Attack (Flurry) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Unarmed,Special,Monk|WEAPON|TOHIT|-MonkFlurryPowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Unarmed,Special,Monk|WEAPON|DAMAGE|PowerAttackDamageBase*MonkFlurryPowerAttackModifier|TYPE=Temporary
Power Attack (Natural Secondary) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|DAMAGE|PowerAttackDamageBase*PowerAttackModifier|TYPE=Temporary
Power Attack (Natural Secondary) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|DAMAGE|(PowerAttackDamageBase/2)*PowerAttackModifier|TYPE=Temporary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formula changed here. Seems reasonable.

Power Attack (Natural Secondary) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalSecondary|WEAPON|DAMAGE|(PowerAttackDamageBase/2)*PowerAttackModifier|TYPE=Temporary
Power Attack (Natural Primary) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimary|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimary|WEAPON|DAMAGE|PowerAttackDamageBase*PowerAttackModifier|TYPE=Temporary
Power Attack (Natural Primary - Single) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimarySingle|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimarySingle|WEAPON|DAMAGE|(PowerAttackDamageBase*1.5)*PowerAttackModifier|TYPE=Temporary
Power Attack (Natural Primary - 1.5x Str) KEY:Power Attack (Natural Primary - 1.5x Str) CATEGORY:FEAT VISIBLE:NO TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimary|WEAPON|TOHIT|-PowerAttackModifier|TYPE=Temporary TEMPBONUS:EQ|Weapon,Melee,Natural,NaturalPrimary|WEAPON|DAMAGE|(PowerAttackDamageBase*1.5)*PowerAttackModifier|TYPE=Temporary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed a feat, and it's referenced earlier, so that looks fine.

@Vest
Vest merged commit e197b70 into PCGen:master Oct 31, 2026
4 checks passed
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🚧 PCGen Code Coverage

Overall Project 27.05% -0.01% ❌
Files changed 0% ❌

File Coverage
PlayerCharacter.java 12.09% -0.05% ❌
PCGVer2Creator.java 0% -0.55% ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][DATA][PF1] Power Attack gives ×1 (not ×1.5) on a primary natural weapon that adds 1½× Str

3 participants