Skip to content

Commit

Permalink
fix: Fix logic for alt skills with feat in BAM
Browse files Browse the repository at this point in the history
It was testing if the actor had any alt skill and then if the actor had any alt
feat.  So being trained in Nature and having the Chirurgeon feat would count for
using Treat Wounds.

Change this so after checking for the alt skill it then checks if the
corresponding alt feat is present.  So being trained in Nature requires Natural
Medicine to be present.

And use some() instead of find().
  • Loading branch information
xyzzy42 committed Oct 20, 2024
1 parent 4267d1c commit 52fa852
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/module/feature/macros/basicActionMacros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,17 @@ function prepareActions(selectedActor: ActorPF2e, bamActions: MacroAction[]): Ma
const actionsToUse = bamActions
.filter((x) => {
const hasSkill = selectedActor.skills?.[x.skill]?.rank ?? 0 > 0;
const hasAltSkillAndFeat =
x.altSkillAndFeat?.find((y) => selectedActor.skills?.[y.skill]?.rank) &&
x.altSkillAndFeat?.find((y) => selectedActor.itemTypes.feat.find((feat) => feat.slug === y.feat));
const hasAltSkillAndFeat = x.altSkillAndFeat?.some(
(y) =>
selectedActor.skills?.[y.skill].rank &&
selectedActor.itemTypes.feat.some((feat) => feat.slug === y.feat),
);

return (
showUnusable ||
x.actionType !== "skill_trained" ||
(x.actionType === "skill_trained" && ["npc", "familiar"].includes(selectedActor.type)) ||
selectedActor.itemTypes.feat.find((feat) => feat.slug === "clever-improviser") ||
selectedActor.itemTypes.feat.some((feat) => feat.slug === "clever-improviser") ||
hasSkill ||
hasAltSkillAndFeat
);
Expand Down

0 comments on commit 52fa852

Please sign in to comment.