jolheiser a révisé ce gist . Aller à la révision
1 file changed, 15 deletions
macro.js
@@ -11,20 +11,6 @@ if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span | |||
11 | 11 | ||
12 | 12 | AudioHelper.play({src: "sounds/dice.wav"}); | |
13 | 13 | ||
14 | - | ChatMessage.create({flavor: "Attack Roll", content: ` | |
15 | - | const table = game.tables.getName("High Variance"); | |
16 | - | const roll = await table.roll(); | |
17 | - | const result = roll.results[0]; | |
18 | - | const mod = actor.data.data.abilities[actor.data.data.attributes.spellcasting].mod; | |
19 | - | const pb = actor.data.data.attributes.prof; | |
20 | - | const resultNum = />?(\d+)<?/.exec(result.text)[1] | |
21 | - | const finalNum = parseInt(resultNum) + mod + pb; | |
22 | - | let finalText = finalNum; | |
23 | - | if (resultNum === "1") finalText = `<span style="color:red">${finalNum}</span>`; | |
24 | - | if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span>`; | |
25 | - | ||
26 | - | AudioHelper.play({src: "sounds/dice.wav"}); | |
27 | - | ||
28 | 14 | ChatMessage.create({flavor: "Attack Roll", content: ` | |
29 | 15 | <div class="dice-roll"> | |
30 | 16 | <div class="dice-result"> | |
@@ -45,5 +31,4 @@ ChatMessage.create({flavor: "Attack Roll", content: ` | |||
45 | 31 | <h4 class="dice-total">${finalText}</h4> | |
46 | 32 | </div> | |
47 | 33 | </div> | |
48 | - | `}); | |
49 | 34 | `}); |
jolheiser a révisé ce gist . Aller à la révision
1 file changed, 26 insertions, 12 deletions
macro.js
@@ -11,25 +11,39 @@ if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span | |||
11 | 11 | ||
12 | 12 | AudioHelper.play({src: "sounds/dice.wav"}); | |
13 | 13 | ||
14 | + | ChatMessage.create({flavor: "Attack Roll", content: ` | |
15 | + | const table = game.tables.getName("High Variance"); | |
16 | + | const roll = await table.roll(); | |
17 | + | const result = roll.results[0]; | |
18 | + | const mod = actor.data.data.abilities[actor.data.data.attributes.spellcasting].mod; | |
19 | + | const pb = actor.data.data.attributes.prof; | |
20 | + | const resultNum = />?(\d+)<?/.exec(result.text)[1] | |
21 | + | const finalNum = parseInt(resultNum) + mod + pb; | |
22 | + | let finalText = finalNum; | |
23 | + | if (resultNum === "1") finalText = `<span style="color:red">${finalNum}</span>`; | |
24 | + | if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span>`; | |
25 | + | ||
26 | + | AudioHelper.play({src: "sounds/dice.wav"}); | |
27 | + | ||
14 | 28 | ChatMessage.create({flavor: "Attack Roll", content: ` | |
15 | 29 | <div class="dice-roll"> | |
16 | 30 | <div class="dice-result"> | |
17 | 31 | <div class="dice-formula">1d[High Variance] + ${mod} + ${pb}</div> | |
18 | 32 | <div class="dice-tooltip" style="display: none;"> | |
19 | - | <section class="tooltip-part"> | |
20 | - | <div class="dice"> | |
21 | - | <header class="part-header flexrow"> | |
22 | - | <span class="part-formula">1d[High Variance]</span> | |
23 | - | ||
24 | - | <span class="part-total">${result.text}</span> | |
25 | - | </header> | |
26 | - | <ol class="dice-rolls"> | |
27 | - | <li class="roll die High Variance">${result.text}</li> | |
28 | - | </ol> | |
33 | + | <section class="tooltip-part"> | |
34 | + | <div class="dice"> | |
35 | + | <header class="part-header flexrow"> | |
36 | + | <span class="part-formula">1d[High Variance]</span> | |
37 | + | <span class="part-total">${result.text}</span> | |
38 | + | </header> | |
39 | + | <ol class="dice-rolls"> | |
40 | + | <li class="roll die High Variance">${result.text}</li> | |
41 | + | </ol> | |
42 | + | </div> | |
43 | + | </section> | |
29 | 44 | </div> | |
30 | - | </section> | |
31 | - | </div> | |
32 | 45 | <h4 class="dice-total">${finalText}</h4> | |
33 | 46 | </div> | |
34 | 47 | </div> | |
48 | + | `}); | |
35 | 49 | `}); |
jolheiser a révisé ce gist . Aller à la révision
1 file changed, 1 deletion
macro.js
@@ -8,7 +8,6 @@ const finalNum = parseInt(resultNum) + mod + pb; | |||
8 | 8 | let finalText = finalNum; | |
9 | 9 | if (resultNum === "1") finalText = `<span style="color:red">${finalNum}</span>`; | |
10 | 10 | if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span>`; | |
11 | - | console.log(finalText); | |
12 | 11 | ||
13 | 12 | AudioHelper.play({src: "sounds/dice.wav"}); | |
14 | 13 |
jolheiser a révisé ce gist . Aller à la révision
1 file changed, 6 insertions, 2 deletions
macro.js
@@ -4,7 +4,11 @@ const result = roll.results[0]; | |||
4 | 4 | const mod = actor.data.data.abilities[actor.data.data.attributes.spellcasting].mod; | |
5 | 5 | const pb = actor.data.data.attributes.prof; | |
6 | 6 | const resultNum = />?(\d+)<?/.exec(result.text)[1] | |
7 | - | const final = parseInt(resultNum) + mod + pb; | |
7 | + | const finalNum = parseInt(resultNum) + mod + pb; | |
8 | + | let finalText = finalNum; | |
9 | + | if (resultNum === "1") finalText = `<span style="color:red">${finalNum}</span>`; | |
10 | + | if (resultNum === "20") finalText = `<span style="color:green">${finalNum}</span>`; | |
11 | + | console.log(finalText); | |
8 | 12 | ||
9 | 13 | AudioHelper.play({src: "sounds/dice.wav"}); | |
10 | 14 | ||
@@ -26,7 +30,7 @@ ChatMessage.create({flavor: "Attack Roll", content: ` | |||
26 | 30 | </div> | |
27 | 31 | </section> | |
28 | 32 | </div> | |
29 | - | <h4 class="dice-total">${final}</h4> | |
33 | + | <h4 class="dice-total">${finalText}</h4> | |
30 | 34 | </div> | |
31 | 35 | </div> | |
32 | 36 | `}); |
jolheiser a révisé ce gist . Aller à la révision
2 files changed, 227 insertions
high-variance-dice.json(fichier créé)
@@ -0,0 +1,195 @@ | |||
1 | + | { | |
2 | + | "name": "High Variance", | |
3 | + | "img": "icons/svg/d20-highlight.svg", | |
4 | + | "description": "", | |
5 | + | "results": [ | |
6 | + | { | |
7 | + | "type": 0, | |
8 | + | "weight": 1, | |
9 | + | "range": [ | |
10 | + | 1, | |
11 | + | 3 | |
12 | + | ], | |
13 | + | "drawn": false, | |
14 | + | "_id": "CNDpsKRWfy1MEL3r", | |
15 | + | "text": "<span style=\"color:red\">1</span>", | |
16 | + | "documentId": null, | |
17 | + | "flags": {}, | |
18 | + | "img": "icons/svg/d20-black.svg" | |
19 | + | }, | |
20 | + | { | |
21 | + | "type": 0, | |
22 | + | "weight": 1, | |
23 | + | "range": [ | |
24 | + | 4, | |
25 | + | 5 | |
26 | + | ], | |
27 | + | "drawn": false, | |
28 | + | "_id": "NeXBHaTGorZGuyok", | |
29 | + | "text": "2", | |
30 | + | "documentId": null, | |
31 | + | "flags": {}, | |
32 | + | "img": "icons/svg/d20-black.svg" | |
33 | + | }, | |
34 | + | { | |
35 | + | "type": 0, | |
36 | + | "weight": 1, | |
37 | + | "range": [ | |
38 | + | 6, | |
39 | + | 7 | |
40 | + | ], | |
41 | + | "drawn": false, | |
42 | + | "_id": "vAtM8PcTGaJ4Qm36", | |
43 | + | "text": "3", | |
44 | + | "documentId": null, | |
45 | + | "flags": {}, | |
46 | + | "img": "icons/svg/d20-black.svg" | |
47 | + | }, | |
48 | + | { | |
49 | + | "type": 0, | |
50 | + | "weight": 1, | |
51 | + | "range": [ | |
52 | + | 8, | |
53 | + | 8 | |
54 | + | ], | |
55 | + | "drawn": false, | |
56 | + | "_id": "Tf7jLYlASY0IXJmG", | |
57 | + | "text": "4", | |
58 | + | "documentId": null, | |
59 | + | "flags": {}, | |
60 | + | "img": "icons/svg/d20-black.svg" | |
61 | + | }, | |
62 | + | { | |
63 | + | "type": 0, | |
64 | + | "weight": 1, | |
65 | + | "range": [ | |
66 | + | 9, | |
67 | + | 9 | |
68 | + | ], | |
69 | + | "drawn": false, | |
70 | + | "_id": "0EyF4w8Mdq50bkUU", | |
71 | + | "text": "5", | |
72 | + | "documentId": null, | |
73 | + | "flags": {}, | |
74 | + | "img": "icons/svg/d20-black.svg" | |
75 | + | }, | |
76 | + | { | |
77 | + | "type": 0, | |
78 | + | "weight": 1, | |
79 | + | "range": [ | |
80 | + | 10, | |
81 | + | 10 | |
82 | + | ], | |
83 | + | "drawn": false, | |
84 | + | "_id": "XVm06G7ALw7VxwyW", | |
85 | + | "text": "6", | |
86 | + | "documentId": null, | |
87 | + | "flags": {}, | |
88 | + | "img": "icons/svg/d20-black.svg" | |
89 | + | }, | |
90 | + | { | |
91 | + | "type": 0, | |
92 | + | "weight": 1, | |
93 | + | "range": [ | |
94 | + | 11, | |
95 | + | 11 | |
96 | + | ], | |
97 | + | "drawn": false, | |
98 | + | "_id": "4RJKBewwniqO5vBz", | |
99 | + | "text": "15", | |
100 | + | "documentId": null, | |
101 | + | "flags": {}, | |
102 | + | "img": "icons/svg/d20-black.svg" | |
103 | + | }, | |
104 | + | { | |
105 | + | "type": 0, | |
106 | + | "weight": 1, | |
107 | + | "range": [ | |
108 | + | 12, | |
109 | + | 12 | |
110 | + | ], | |
111 | + | "drawn": false, | |
112 | + | "_id": "PLjGTLyCMmyVAUOF", | |
113 | + | "text": "16", | |
114 | + | "documentId": null, | |
115 | + | "flags": {}, | |
116 | + | "img": "icons/svg/d20-black.svg" | |
117 | + | }, | |
118 | + | { | |
119 | + | "type": 0, | |
120 | + | "weight": 1, | |
121 | + | "range": [ | |
122 | + | 13, | |
123 | + | 13 | |
124 | + | ], | |
125 | + | "drawn": false, | |
126 | + | "_id": "aqRC9SAKseB3kc24", | |
127 | + | "text": "17", | |
128 | + | "documentId": null, | |
129 | + | "flags": {}, | |
130 | + | "img": "icons/svg/d20-black.svg" | |
131 | + | }, | |
132 | + | { | |
133 | + | "type": 0, | |
134 | + | "weight": 1, | |
135 | + | "range": [ | |
136 | + | 14, | |
137 | + | 15 | |
138 | + | ], | |
139 | + | "drawn": false, | |
140 | + | "_id": "5AgxhHsvtPRdXPme", | |
141 | + | "text": "18", | |
142 | + | "documentId": null, | |
143 | + | "flags": {}, | |
144 | + | "img": "icons/svg/d20-black.svg" | |
145 | + | }, | |
146 | + | { | |
147 | + | "type": 0, | |
148 | + | "weight": 1, | |
149 | + | "range": [ | |
150 | + | 16, | |
151 | + | 17 | |
152 | + | ], | |
153 | + | "drawn": false, | |
154 | + | "_id": "CkxRAfMKLVESQh8B", | |
155 | + | "text": "19", | |
156 | + | "documentId": null, | |
157 | + | "flags": {}, | |
158 | + | "img": "icons/svg/d20-black.svg" | |
159 | + | }, | |
160 | + | { | |
161 | + | "type": 0, | |
162 | + | "weight": 1, | |
163 | + | "range": [ | |
164 | + | 18, | |
165 | + | 20 | |
166 | + | ], | |
167 | + | "drawn": false, | |
168 | + | "_id": "Rgx3fX4e4BWTaEr6", | |
169 | + | "text": "<span style=\"color:green\">20</span>", | |
170 | + | "documentId": null, | |
171 | + | "flags": {}, | |
172 | + | "img": "icons/svg/d20-black.svg" | |
173 | + | } | |
174 | + | ], | |
175 | + | "replacement": true, | |
176 | + | "displayRoll": false, | |
177 | + | "folder": null, | |
178 | + | "flags": { | |
179 | + | "exportSource": { | |
180 | + | "world": "hotbed", | |
181 | + | "system": "dnd5e", | |
182 | + | "coreVersion": "11.315", | |
183 | + | "systemVersion": "2.4.1" | |
184 | + | } | |
185 | + | }, | |
186 | + | "_stats": { | |
187 | + | "systemId": "dnd5e", | |
188 | + | "systemVersion": "2.4.1", | |
189 | + | "coreVersion": "11.315", | |
190 | + | "createdTime": 1702319249667, | |
191 | + | "modifiedTime": 1702321974523, | |
192 | + | "lastModifiedBy": "ecDJcA6q1LI8LxNv" | |
193 | + | }, | |
194 | + | "formula": "1d20" | |
195 | + | } |
macro.js(fichier créé)
@@ -0,0 +1,32 @@ | |||
1 | + | const table = game.tables.getName("High Variance"); | |
2 | + | const roll = await table.roll(); | |
3 | + | const result = roll.results[0]; | |
4 | + | const mod = actor.data.data.abilities[actor.data.data.attributes.spellcasting].mod; | |
5 | + | const pb = actor.data.data.attributes.prof; | |
6 | + | const resultNum = />?(\d+)<?/.exec(result.text)[1] | |
7 | + | const final = parseInt(resultNum) + mod + pb; | |
8 | + | ||
9 | + | AudioHelper.play({src: "sounds/dice.wav"}); | |
10 | + | ||
11 | + | ChatMessage.create({flavor: "Attack Roll", content: ` | |
12 | + | <div class="dice-roll"> | |
13 | + | <div class="dice-result"> | |
14 | + | <div class="dice-formula">1d[High Variance] + ${mod} + ${pb}</div> | |
15 | + | <div class="dice-tooltip" style="display: none;"> | |
16 | + | <section class="tooltip-part"> | |
17 | + | <div class="dice"> | |
18 | + | <header class="part-header flexrow"> | |
19 | + | <span class="part-formula">1d[High Variance]</span> | |
20 | + | ||
21 | + | <span class="part-total">${result.text}</span> | |
22 | + | </header> | |
23 | + | <ol class="dice-rolls"> | |
24 | + | <li class="roll die High Variance">${result.text}</li> | |
25 | + | </ol> | |
26 | + | </div> | |
27 | + | </section> | |
28 | + | </div> | |
29 | + | <h4 class="dice-total">${final}</h4> | |
30 | + | </div> | |
31 | + | </div> | |
32 | + | `}); |