Skip to content

Commit

Permalink
0.5.63
Browse files Browse the repository at this point in the history
  • Loading branch information
gambit07 committed Oct 15, 2024
1 parent 7099faf commit f925171
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
- name: Set Release Notes for Github
id: set-release-notes-github
run: |
echo "- Updates:" >> release_notes.txt
echo " - Counterspell: Added animation, if cpr installed can also be enabled/disabled via the medkit" >> release_notes.txt
echo " - Silvery Barbs: Added animation, if cpr installed can also be enabled/disabled via the medkit" >> release_notes.txt
echo "- Bugfixes:" >> release_notes.txt
echo " - Counterspell: Resolve issue with socketed rolls not accounting for the cast level correctly" >> release_notes.txt
echo " - Counterspell: Couple fixes for last update" >> release_notes.txt
echo "release-notes-github<<EOF" >> $GITHUB_ENV
cat release_notes.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Expand Down
9 changes: 7 additions & 2 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,12 @@ export async function remoteAbilityTest({spellcasting, actorUuid}) {

let actor = await fromUuid(actorUuid)

let skillCheck = await actor.rollAbilityTest(spellcasting)
let rollId;
Hooks.once("createChatMessage", async (chatMessage, options, userId) => {
rollId = chatMessage.id;
});

await actor.rollAbilityTest(spellcasting);

return {skillRoll: skillCheck};
return {skillRoll: rollId};
}
15 changes: 10 additions & 5 deletions scripts/macros/counterspell.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export async function counterspell({ workflowData,workflowType,workflowCombat })
let csFailure = false;
let chatContent = [];
let skillCheck;
let skillRoll;
let browserUser;

await initialCounterspellProcess(workflow, lastMessage, castLevel, selectedToken);
Expand Down Expand Up @@ -144,7 +145,10 @@ export async function counterspell({ workflowData,workflowType,workflowCombat })
if(itemRollCastLevel < castLevel) {
if(source && source === "user") skillCheck = await socket.executeAsUser("remoteAbilityTest", browserUser, { spellcasting: validTokenPrimary.actor.system.attributes.spellcasting, actorUuid: validTokenPrimary.actor.uuid });
if(source && source === "gm") skillCheck = await socket.executeAsUser("remoteAbilityTest", gmUser, { spellcasting: validTokenPrimary.actor.system.attributes.spellcasting, actorUuid: validTokenPrimary.actor.uuid });
let { skillTotal = skillCheck.skillRoll.total, skillFlavor = skillCheck.skillRoll.options.flavor } = skillCheck;
skillRoll = game.messages.get(skillCheck.skillRoll)?.rolls[0];
let skillTotal = skillRoll.total;
let skillFlavor = skillRoll.options.flavor;

let abjurationCheck = validTokenPrimary.actor.items.some(i => i.name.toLowerCase() === "improved abjuration");
abjurationCheck ? skillTotal = skillTotal + validTokenPrimary.actor.system?.attributes?.prof : skillTotal = skillTotal;
if (skillTotal >= spellThreshold) {
Expand All @@ -163,7 +167,7 @@ export async function counterspell({ workflowData,workflowType,workflowCombat })

await helpers.addReaction({actorUuid: `${validTokenPrimary.actor.uuid}`});

await socket.executeAsUser("replaceChatCard", gmUser, {actorUuid: validTokenPrimary.actor.uuid, itemUuid: chosenSpell.uuid, chatContent: chatContent, rollData: skillCheck.skillRoll});
await socket.executeAsUser("replaceChatCard", gmUser, {actorUuid: validTokenPrimary.actor.uuid, itemUuid: chosenSpell.uuid, chatContent: chatContent, rollData: skillRoll});

if(csFailure === true) continue;

Expand Down Expand Up @@ -294,9 +298,10 @@ export async function counterspell({ workflowData,workflowType,workflowCombat })
if(itemRollCastLevel < castLevel) {
if(source && source === "user") skillCheck = await socket.executeAsUser("remoteAbilityTest", browserUser, { spellcasting: validTokenSecondary.actor.system.attributes.spellcasting, actorUuid: validTokenSecondary.actor.uuid });
if(source && source === "gm") skillCheck = await socket.executeAsUser("remoteAbilityTest", gmUser, { spellcasting: validTokenSecondary.actor.system.attributes.spellcasting, actorUuid: validTokenSecondary.actor.uuid });
let { skillTotal = skillCheck.skillRoll.total, skillFlavor = skillCheck.skillRoll.options.flavor } = skillCheck;
skillRoll = game.messages.get(skillCheck.skillRoll)?.rolls[0];
let skillTotal = skillRoll.total;
let skillFlavor = skillRoll.options.flavor;

skillCheck = await validTokenSecondary.actor.rollAbilityTest(validTokenSecondary.actor.system.attributes.spellcasting);
let abjurationCheck = validTokenSecondary.actor.items.some(i => i.name.toLowerCase() === "improved abjuration");
abjurationCheck ? skillTotal = skillTotal + validTokenSecondary.actor.system?.attributes?.prof : skillTotal = skillTotal;
if (skillTotal >= spellThreshold) {
Expand All @@ -315,7 +320,7 @@ export async function counterspell({ workflowData,workflowType,workflowCombat })

await helpers.addReaction({actorUuid: `${validTokenSecondary.actor.uuid}`});

await socket.executeAsUser("replaceChatCard", gmUser, {actorUuid: validTokenSecondary.actor.uuid, itemUuid: chosenSpell.uuid, chatContent: chatContent, rollData: skillCheck.skillRoll});
await socket.executeAsUser("replaceChatCard", gmUser, {actorUuid: validTokenSecondary.actor.uuid, itemUuid: chosenSpell.uuid, chatContent: chatContent, rollData: skillRoll});


if(csFailure === true) continue;
Expand Down

0 comments on commit f925171

Please sign in to comment.