Skip to content

Commit

Permalink
Fixed roll messages with DsN and isArtifact for apply Damage
Browse files Browse the repository at this point in the history
  • Loading branch information
bithir committed Jul 9, 2024
1 parent 4d295d9 commit 6f125dd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
3 changes: 2 additions & 1 deletion script/common/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ export class SymbaroumActor extends Actor {
reference: item.system.reference,
isMelee: item.system.isMelee,
isDistance: item.system.isDistance,
isArtifact: item.system.isArtifact,
doAlternativeDamage: doAlternativeDamage,
qualities: item.system.qualities,
damage: {
Expand Down Expand Up @@ -992,7 +993,7 @@ export class SymbaroumActor extends Actor {
favour: 0,
modifier: 0,
poison: 0,
isMystical: weapon.qualities.mystical || weapon.system.isArtifact,
isMystical: weapon.qualities.mystical || weapon.isArtifact,
isAlternativeDamage: false,
alternativeDamageAttribute: "none",
introText: actingCharName + game.i18n.localize("COMBAT.CHAT_INTRO") + weapon.name,
Expand Down
6 changes: 4 additions & 2 deletions script/common/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -3553,9 +3553,10 @@ async function attackResult(rollData, functionStuff) {
actor: actorid,
}),
content: html,
roll: JSON.stringify(createRollData(rolls)),
rolls: [createRollData(rolls)],
rollMode: game.settings.get("core", "rollMode"),
};
ChatMessage.applyRollMode(chatData, "roll");
let NewMessage = await ChatMessage.create(chatData);
if (flagDataArray.length > 0) {
await createModifyTokenChatButton(flagDataArray);
Expand Down Expand Up @@ -4002,8 +4003,9 @@ async function standardPowerResult(rollData, functionStuff) {
}
} else if (rolls.length > 0) {
// Only shows rolls if they are displayed to
chatData.roll = JSON.stringify(createRollData(rolls));
chatData.rolls = [createRollData(rolls)];
}
ChatMessage.applyRollMode(chatData, "roll");
let NewMessage = await ChatMessage.create(chatData);
if (trueActorSucceeded && functionStuff.addTargetEffect.length > 0) {
for (let effect of functionStuff.addTargetEffect) {
Expand Down
41 changes: 20 additions & 21 deletions script/common/macro.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,8 @@ export class SymbaroumMacros {
} else return;
}

/**********************************************
* Macro: addExp
*/

// Built-in macros
async addExp() {
let defaultCheck = "checked"; // set to unchecked
getPlayerList() {
let actorslist = [];

if (canvas.tokens.controlled.length > 0) {
Expand All @@ -216,8 +211,26 @@ export class SymbaroumMacros {
});
Array.prototype.push.apply(actorslist, gameacts);
}
return actorslist;
}

/**********************************************
* Macro: addExp
*/

// Built-in macros
async addExp() {
let defaultCheck = "checked"; // set to unchecked

let allKeys = "";
const actorslist = this.getPlayerList();

if(actorslist.length === 0) {
ui.notifications.info(`No actor available for you to add exp to`);
return;
} else if(actorslist.length === 1) {
defaultCheck = "checked";
}
actorslist.forEach((t) => {
allKeys =
allKeys.concat(`<div style="flex-basis: auto;flex-direction: row;display: flex;">
Expand Down Expand Up @@ -383,21 +396,7 @@ export class SymbaroumMacros {
*/
async rollAnyAttribute() {
let defaultCheck = "unchecked"; // set to unchecked
let actorslist = [];

if(canvas.tokens.controlled.length > 0) {
// If no actor selected
// Time to get busy
canvas.tokens.controlled.map(e => {
if(game.user.isGM || e.actor.owner && e.actor.type === "player" && e.hasPlayerOwner) {
actorslist.push(e.actor);
}
});
} else {
// if there are no controlled tokens on the map, select all player actors in the actor catalogue
let gameacts = game.actors.filter(e => { if( (game.user.isGM || e.owner) && e.type === "player" && e.hasPlayerOwner) { return e; } });
Array.prototype.push.apply(actorslist, gameacts);
}
let actorslist = this.getPlayerList();

if(actorslist.length === 0) {
ui.notifications.info(`No actor available for you to do an attribute test`);
Expand Down
6 changes: 4 additions & 2 deletions script/common/roll.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function rollAttribute(actor, actingAttributeName, targetActor, tar
alias: actingCharName,
actor: actor.id
}),
roll: JSON.stringify(createRollData(rolls)),
rolls: [createRollData(rolls)],
rollMode: game.settings.get('core', 'rollMode'),
content: html,
};
Expand All @@ -105,6 +105,7 @@ export async function rollAttribute(actor, actingAttributeName, targetActor, tar
} else if (chatData.rollMode === 'selfroll') {
chatData.whisper = [game.user];
}
ChatMessage.applyRollMode(chatData, "roll");
ChatMessage.create(chatData);
return(rollData);
}
Expand Down Expand Up @@ -177,7 +178,7 @@ export async function rollDeathTest(actor, withFavour, modifier) {
speaker: {
actor: actor.id
},
roll: JSON.stringify(createRollData(rolls)),
rolls: createRollData(rolls),
rollMode: game.settings.get('core', 'rollMode'),
content: html,
};
Expand All @@ -186,6 +187,7 @@ export async function rollDeathTest(actor, withFavour, modifier) {
} else if (chatData.rollMode === 'selfroll') {
chatData.whisper = [game.user];
}
ChatMessage.applyRollMode(chatData, "roll");
ChatMessage.create(chatData);
if(actor.system.nbrOfFailedDeathRoll != nbrOfFailedDeathRoll) {
await actor.update({"system.nbrOfFailedDeathRoll":nbrOfFailedDeathRoll });
Expand Down

0 comments on commit 6f125dd

Please sign in to comment.