@@ -14,7 +14,8 @@ class LMRTFYRoller extends Application {
14
14
this . chooseOne = data . chooseOne ?? false ;
15
15
16
16
if ( game . system . id === 'pf2e' ) {
17
- this . dc = data . dc ;
17
+ this . dc = data . dc ;
18
+ this . pf2Roll = '' ;
18
19
}
19
20
20
21
if ( data . title ) {
@@ -135,7 +136,7 @@ class LMRTFYRoller extends Application {
135
136
}
136
137
}
137
138
138
- async _makeRoll ( event , rollMethod , rollId , rollFor ) {
139
+ async _makeRoll ( event , rollMethod , ... args ) {
139
140
let fakeEvent = { }
140
141
switch ( this . advantage ) {
141
142
case - 1 :
@@ -162,21 +163,21 @@ class LMRTFYRoller extends Application {
162
163
// system specific roll handling
163
164
switch ( game . system . id ) {
164
165
case "pf2e" : {
165
- switch ( rollFor ) {
166
+ switch ( this . pf2Roll ) {
166
167
case this . pf2eRollFor . ABILITY :
167
- const modifier = LMRTFY . buildAbilityModifier ( actor , rollId ) ;
168
+ const modifier = LMRTFY . buildAbilityModifier ( actor , args [ 0 ] ) ;
168
169
game . pf2e . Check . roll ( modifier , { type : 'skill-check' , dc : this . dc , actor } , event ) ;
169
170
break ;
170
171
171
172
case this . pf2eRollFor . SAVE :
172
- const save = actor . saves [ rollId ] . check ;
173
+ const save = actor . saves [ args [ 0 ] ] . check ;
173
174
const saveOptions = actor . getRollOptions ( [ 'all' , `${ save . ability } -based` , 'saving-throw' , save . name ] ) ;
174
175
save . roll ( { event, saveOptions, dc : this . dc } ) ;
175
176
break ;
176
177
177
178
case this . pf2eRollFor . SKILL :
178
179
// system specific roll handling
179
- const skill = actor . data . data . skills [ rollId ] ;
180
+ const skill = actor . data . data . skills [ args [ 0 ] ] ;
180
181
// roll lore skills only for actors who have them ...
181
182
if ( ! skill ) continue ;
182
183
@@ -194,7 +195,7 @@ class LMRTFYRoller extends Application {
194
195
}
195
196
196
197
default : {
197
- await actor [ rollMethod ] . call ( actor , rollId , { event : fakeEvent } ) ;
198
+ await actor [ rollMethod ] . call ( actor , ... args , { event : fakeEvent } ) ;
198
199
}
199
200
}
200
201
}
@@ -346,19 +347,22 @@ class LMRTFYRoller extends Application {
346
347
_onAbilityCheck ( event ) {
347
348
event . preventDefault ( ) ;
348
349
const ability = event . currentTarget . dataset . ability ;
349
- this . _makeRoll ( event , LMRTFY . abilityRollMethod , ability , ( game . system . id === 'pf2e' ) ? this . pf2eRollFor . ABILITY : null ) ;
350
+ if ( game . system . id === 'pf2e' ) this . pf2Roll = this . pf2eRollFor . ABILITY ;
351
+ this . _makeRoll ( event , LMRTFY . abilityRollMethod , ability ) ;
350
352
}
351
353
352
354
_onAbilitySave ( event ) {
353
355
event . preventDefault ( ) ;
354
356
const saves = event . currentTarget . dataset . ability ;
355
- this . _makeRoll ( event , LMRTFY . saveRollMethod , saves , ( game . system . id === 'pf2e' ) ? this . pf2eRollFor . SAVE : null ) ;
357
+ if ( game . system . id === 'pf2e' ) this . pf2Roll = this . pf2eRollFor . SAVE ;
358
+ this . _makeRoll ( event , LMRTFY . saveRollMethod , saves ) ;
356
359
}
357
360
358
361
_onSkillCheck ( event ) {
359
362
event . preventDefault ( ) ;
360
363
const skill = event . currentTarget . dataset . skill ;
361
- this . _makeRoll ( event , LMRTFY . skillRollMethod , skill , ( game . system . id === 'pf2e' ) ? this . pf2eRollFor . SKILL : null ) ;
364
+ if ( game . system . id === 'pf2e' ) this . pf2Roll = this . pf2eRollFor . SKILL ;
365
+ this . _makeRoll ( event , LMRTFY . skillRollMethod , skill ) ;
362
366
}
363
367
364
368
async _onCustomFormula ( event ) {
0 commit comments