Skip to content

Commit

Permalink
Allow magic and normal dice to be rolled at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickBauer committed Mar 18, 2023
1 parent 2a5429b commit a4991c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### 1.2.4
* Allow magic and normal dice to be rolled at the same time

### 1.2.2
* Added option to change the color for magic dice

Expand Down
13 changes: 4 additions & 9 deletions src/module/chat/FateRoll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,19 @@ export class FateRoll extends FateRollDataModel {
}

async rollMagic(userId = "", magicCount: number) {
const magicRoll = new Roll(`${magicCount}dMe`).roll({ async: false });
const normalRoll = new Roll(`${4 - magicCount}dF`).roll({ async: false });
const roll = new Roll(`${magicCount}dMe + ${4 - magicCount}dF`).roll({ async: false });

this.updateSource({
faces: [...magicRoll.terms[0].results, ...normalRoll.terms[0].results].map((r) => r.count ?? r.result),
faces: [...roll.terms[0].results, ...roll.terms[2].results].map((r) => r.count ?? r.result),
});

magicRoll.terms[0].options.sfx = {
roll.terms[0].options.sfx = {
specialEffect: "PlayAnimationParticleSparkles",
};

if (game.modules.get("dice-so-nice")?.active) {
const user = userId ? game.users.get(userId) : game.user;

await Promise.all([
game.dice3d.showForRoll(magicRoll, user, true),
game.dice3d.showForRoll(normalRoll, user, true),
]);
await game.dice3d.showForRoll(roll, user, true);
}

return this;
Expand Down
2 changes: 1 addition & 1 deletion system/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "fatex",
"title": "FateX - Fate Extended",
"description": "An extended implementation of Fate and its derivative systems",
"version": "1.2.3",
"version": "1.2.4",
"authors": [
{
"name": "Patrick Bauer",
Expand Down

0 comments on commit a4991c2

Please sign in to comment.