Skip to content

Commit

Permalink
fix: Embarrassing bug on the skill roll dialog meaning only the first…
Browse files Browse the repository at this point in the history
… skill worked. Also set Average difficulty and Normal roll type as defaults.
  • Loading branch information
xdy committed Aug 30, 2020
1 parent a6b86f5 commit c61cf40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/module/sheets/TwodsixActorSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class TwodsixActorSheet extends ActorSheet {
* @param {Event} event The originating click event
* @private
*/
_onRoll(event: { preventDefault: any; currentTarget: any; shiftKey?: any; }):void {
_onRoll(event:{ preventDefault:any; currentTarget:any; shiftKey?:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const dataset = element.dataset;
Expand Down Expand Up @@ -184,13 +184,14 @@ export class TwodsixActorSheet extends ActorSheet {
const rollParts = dataset.roll.split("+");

const flavorParts:string[] = [];
flavorParts.push(`${skills[0].name}`);
const skill = skills.filter(x => x._id === skillId)[0];
flavorParts.push(`${skill.name}`);

return TwodsixRolls.Roll({
parts: rollParts,
data: skillData,
flavorParts: flavorParts,
title: `${skills[0].name}`,
title: `${skill.name}`,
speaker: ChatMessage.getSpeaker({actor: this.getData().actor}),
});
}
Expand Down
16 changes: 9 additions & 7 deletions src/module/utils/TwodsixRolls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export class TwodsixRolls {
const dialogData = {
formula: usefulParts.join(' '),
data: data,
rollType: CONFIG.TWODSIX.ROLLTYPES.Normal,
rollType: "Normal",
rollTypes: CONFIG.TWODSIX.ROLLTYPES,
difficulty: "Average",
difficulties: CONFIG.TWODSIX.DIFFICULTIES,
rollMode: game.settings.get('core', 'rollMode'),
rollModes: CONFIG.Dice.rollModes,
difficulty: CONFIG.TWODSIX.DIFFICULTIES.Normal,
difficulties: CONFIG.TWODSIX.DIFFICULTIES
rollModes: CONFIG.Dice.rollModes
};

const buttons = {
Expand All @@ -32,7 +32,7 @@ export class TwodsixRolls {
form: html[0].children[0],
rollParts: usefulParts,
flavorParts,
speaker,
speaker
});
rolled = true;
},
Expand Down Expand Up @@ -82,8 +82,10 @@ export class TwodsixRolls {

if (data['rollType'] && data['rollType'].length > 0) {
rollParts[0] = CONFIG.TWODSIX.ROLLTYPES[data['rollType']];
flavorParts.push("with");
flavorParts.push(`${data['rollType']}`);
if (data['rollType'] != 'Normal') {
flavorParts.push("with");
flavorParts.push(`${data['rollType']}`);
}
}

//So that the result is the Effect of the skill roll.
Expand Down

0 comments on commit c61cf40

Please sign in to comment.