From 698988bdf34aa59e6daa07b08ff090ede2d98666 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 20 Oct 2024 02:04:56 -0700 Subject: [PATCH] fix: Fix logic for alt skills with feat in BAM 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(). --- src/module/feature/macros/basicActionMacros.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/module/feature/macros/basicActionMacros.ts b/src/module/feature/macros/basicActionMacros.ts index 654f6bceb..c67c7d955 100644 --- a/src/module/feature/macros/basicActionMacros.ts +++ b/src/module/feature/macros/basicActionMacros.ts @@ -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 );