diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b543b7d..e83f5593 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,11 +16,8 @@ jobs: - name: Set Release Notes for Github id: set-release-notes-github run: | - echo "**Module items are now coming from a 5e V3.x world. 0.1.2 is the last module version that was built on 5e 2.x. Moving forward all development will be for 5e 3.x, use 0.1.2 if you want to maintain full compatability with 5e 2.x, I will not be doing any more development for 2.x directly.**" >> release_notes.txt - echo "- Updates:" >> release_notes.txt - echo " - Opportunity Attack: Added support for deadly reach. Updated dialog titles to make it clear what actor the opportunity attack reaction is for" >> release_notes.txt echo "- Bugfixes:" >> release_notes.txt - echo " - General: Fixed hidden startup error" >> release_notes.txt + echo " - Counterspell: Fix counterspell blanket hiding all spell cards when turned on" >> release_notes.txt echo "release-notes-github<> $GITHUB_ENV cat release_notes.txt >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV diff --git a/module.json b/module.json index f51fc4ec..77ecf221 100644 --- a/module.json +++ b/module.json @@ -7,7 +7,7 @@ "name": "Gambit" } ], - "version": "0.1.3", + "version": "0.1.4", "compatibility": { "minimum": "11", "verified": "11", diff --git a/scripts/macros/counterspell.js b/scripts/macros/counterspell.js index 3bfe896a..a17a9a97 100644 --- a/scripts/macros/counterspell.js +++ b/scripts/macros/counterspell.js @@ -5,13 +5,7 @@ export async function counterspell({ workflowData }) { const workflow = await MidiQOL.Workflow.getWorkflow(`${workflowUuid}`); if(!workflow) return; if(workflow.item.type !== "spell" || workflow.item.name.toLowerCase() === "counterspell") return; - - let lastMessage = game.messages.contents[game.messages.contents.length - 1] - if(lastMessage) { - lastMessage.update({ - whisper: [game.users.find((u) => u.isGM && u.active).id] - }); - } + const lastMessage = game.messages.contents[game.messages.contents.length - 1]; if (!game.combat) return; @@ -92,6 +86,8 @@ export async function counterspell({ workflowData }) { let browserUser; for (const validTokenPrimary of findCounterspellTokensPrimary) { + if(lastMessage) lastMessage.update({ whisper: [game.users.find((u) => u.isGM && u.active).id] }); + let workflowStatus = workflow.aborted; if(workflowStatus === true) return; let actorUuidPrimary = validTokenPrimary.actor.uuid; @@ -113,10 +109,12 @@ export async function counterspell({ workflowData }) { const {counterspellSuccess, counterspellLevel} = await socket.executeAsUser("showCounterspellDialog", browserUser.id, originTokenUuidPrimary, actorUuidPrimary, validTokenPrimary.document.uuid, castLevel, dialogTitlePrimary); if (counterspellSuccess === false || !counterspellSuccess) { + if(lastMessage) lastMessage.update({ whisper: [] }); await socket.executeAsGM("deleteChatMessage", { chatId: notificationMessage._id }); continue; } if (counterspellSuccess === true) { + if(lastMessage) lastMessage.update({ whisper: [] }); await socket.executeAsGM("deleteChatMessage", { chatId: notificationMessage._id }); castLevel = counterspellLevel; let findCounterspellTokensSecondary = findCounterspellTokens(validTokenPrimary, (checkedToken, initiatingToken) => { @@ -147,15 +145,18 @@ export async function counterspell({ workflowData }) { const {counterspellSuccess, counterspellLevel} = await socket.executeAsUser("showCounterspellDialog", browserUser.id, originTokenUuidSecondary, actorUuidSecondary, validTokenSecondary.document.uuid, castLevel, dialogTitleSecondary); if (counterspellSuccess === true) { + if(lastMessage) lastMessage.update({ whisper: [] }); await socket.executeAsGM("deleteChatMessage", { chatId: notificationMessageSecondary._id }); castLevel = counterspellLevel; break; } if (!counterspellSuccess && isLastToken) { + if(lastMessage) lastMessage.update({ whisper: [] }); await socket.executeAsGM("deleteChatMessage", { chatId: notificationMessageSecondary._id }); return workflow.aborted = true; } if (!counterspellSuccess) { + if(lastMessage) lastMessage.update({ whisper: [] }); await socket.executeAsGM("deleteChatMessage", { chatId: notificationMessageSecondary._id }); continue; }