Skip to content

Commit

Permalink
Fix DamageAlteration predicates for base damage (#16080)
Browse files Browse the repository at this point in the history
processBaseDamage() wasn't getting passed the roll options and was using
the domains (also a string[]) as if they were the roll options when applied
alterations.
  • Loading branch information
xyzzy42 authored Aug 16, 2024
1 parent 6d90066 commit 72bb25f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/module/system/damage/weapon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ class WeaponDamagePF2e {
rule.beforeRoll?.(domains, options);
}

const baseDamage = WeaponDamagePF2e.#processBaseDamage(unprocessedBaseDamage, { actor, item: weapon, domains });
const baseDamage = WeaponDamagePF2e.#processBaseDamage(unprocessedBaseDamage, {
actor,
item: weapon,
domains,
options,
});

// Splash damage
const hasScatterTrait = weaponTraits.some((t) => t.startsWith("scatter-"));
Expand Down Expand Up @@ -539,7 +544,12 @@ class WeaponDamagePF2e {
/** Apply damage alterations to weapon base damage. */
static #processBaseDamage(
unprocessed: ConvertedNPCDamage | WeaponDamage,
{ actor, item, domains }: { actor: ActorPF2e; item: ItemPF2e<ActorPF2e>; domains: string[] },
{
actor,
item,
domains,
options,
}: { actor: ActorPF2e; item: ItemPF2e<ActorPF2e>; domains: string[]; options: string[] | Set<string> },
): ConvertedNPCDamage | WeaponDamage {
const damageCategory = "category" in unprocessed ? unprocessed.category : null;
const dice =
Expand Down Expand Up @@ -583,9 +593,9 @@ class WeaponDamagePF2e {
: null;
const alterations = extractDamageAlterations(actor.synthetics.damageAlterations, domains, "base");
for (const alteration of alterations) {
if (dice) alteration.applyTo(dice, { item, test: domains });
if (modifier) alteration.applyTo(modifier, { item, test: domains });
if (persistent) alteration.applyTo(persistent, { item, test: domains });
if (dice) alteration.applyTo(dice, { item, test: options });
if (modifier) alteration.applyTo(modifier, { item, test: options });
if (persistent) alteration.applyTo(persistent, { item, test: options });
}

return {
Expand Down

0 comments on commit 72bb25f

Please sign in to comment.