Skip to content

Commit

Permalink
Fix consuming lockon
Browse files Browse the repository at this point in the history
Targeting data contained the uuid, but was being compared to the plain
id, so the comparison was always false.

Fixes: #801
  • Loading branch information
BoltsJ committed Dec 2, 2024
1 parent 841a43f commit 285b84f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/module/flows/attack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,14 @@ export async function printAttackCard(

// If user is GM, apply status changes to attacked tokens
Hooks.on("createChatMessage", async (cm: ChatMessage, options: any, id: string) => {
// Consume lock-on if we are a GM
if (!game.user?.isGM) return;
// Consume lock-on if we are the primary GM
// @ts-expect-error Types user collection missing activeGM
if (!game.users?.activeGM?.isSelf) return;
const atkData: AttackFlag = cm.getFlag(game.system.id, "attackData") as any;
if (!atkData || !atkData.targets) return;
atkData.targets.forEach(target => {
// Find the target in this scene
const tokenActor = game.canvas.scene?.tokens.find(token => token.id === target.id)?.actor;
const tokenActor = game.canvas.scene?.tokens.find(token => token.uuid === target.id)?.actor;
if (!tokenActor) return;
const statusToApply = [];
const statusToRemove = [];
Expand Down

0 comments on commit 285b84f

Please sign in to comment.