Skip to content

Commit

Permalink
Merge pull request #37 from Imper1um/36_pf1e_DoubleRollFix
Browse files Browse the repository at this point in the history
Fixing Double Roll and rollMode
  • Loading branch information
Imper1um authored Oct 6, 2023
2 parents 86a9672 + d9c31f7 commit 851b01f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/ceus_RollProvider_pf1.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider {
const skillId = skillRoll.skillId;
const skill = actor.system.skills[skillRoll.skillId];
const rollOptions = rp.baseRollOptions();
rollOptions.rollMode = requestOptions.rollPrivacy;
rollOptions.bonus = requestItem.customBonus;
var completeRoll;
switch (requestItem.trainedOption) {
case "HideUntrained":
Expand Down Expand Up @@ -274,23 +276,32 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider {
const rp = Ceus.current.providerEngine.currentRollProvider;
const skill = actor.system.skills["per"];
const skillId = "per";
const completeRoll = await actor.rollSkill(skillId, skill, rp.baseRollOptions());
const rollOptions = rp.baseRollOptions();
rollOptions.rollMode = requestOptions.rollPrivacy;
rollOptions.bonus = requestItem.customBonus;
const completeRoll = await actor.rollSkill(skillId, rollOptions);
return rp.buildResult(requestOptions, actor, requestItem, completeRoll);
}

async rollSave(requestOptions, actor, requestItem) {
ceus_RollProvider_pf1.log.Trace("rollSave", {requestOptions, actor, requestItem});
const rp = Ceus.current.providerEngine.currentRollProvider;
const saveRoll = rp.getAvailableRolls().find(r => r.id === "Saves").rolls.find(r => r.id === requestItem.rollId);
const completeRoll = await actor.rollSavingThrow(saveRoll.saveId, rp.baseRollOptions());
const rollOptions = rp.baseRollOptions();
rollOptions.rollMode = requestOptions.rollPrivacy;
rollOptions.bonus = requestItem.customBonus;
const completeRoll = await actor.rollSavingThrow(saveRoll.saveId, rollOptions);
return rp.buildResult(requestOptions, actor, requestItem, completeRoll);
}

async rollAbility(requestOptions, actor, requestItem) {
ceus_RollProvider_pf1.log.Trace("rollAbility", {requestOptions, actor, requestItem});
const rp = Ceus.current.providerEngine.currentRollProvider;
const abilityRoll = rp.getAvailableRolls().find(r => r.id === "Abilities").rolls.find(r => r.id === requestItem.rollId);
const completeRoll = await actor.rollAbilityTest(abilityRoll.abilityId, rp.baseRollOptions());
const rollOptions = rp.baseRollOptions();
rollOptions.rollMode = requestItem.rollPrivacy;
rollOptions.bonus = requestItem.customBonus;
const completeRoll = await actor.rollAbilityTest(abilityRoll.abilityId, rollOptions);
return rp.buildResult(requestOptions, actor, requestItem, completeRoll);
}

Expand Down

0 comments on commit 851b01f

Please sign in to comment.