Skip to content

Commit

Permalink
0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gambit07 committed Mar 19, 2024
1 parent 2aef184 commit 4833b73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF" >> $GITHUB_ENV
cat release_notes.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Gambit"
}
],
"version": "0.1.3",
"version": "0.1.4",
"compatibility": {
"minimum": "11",
"verified": "11",
Expand Down
15 changes: 8 additions & 7 deletions scripts/macros/counterspell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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) => {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4833b73

Please sign in to comment.