Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"Advantage": {
"override": "Advantage Override from",
"suppressed": "Advantage Suppressed by",
"prefix": "Advantage from"
"prefix": "Advantage from",
"doubleProf": "Double Proficiency"
},
"Normal": {
"override": "Normal Override from"
Expand Down
3 changes: 2 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"Advantage": {
"override": "Source de la priorité d'avantage :",
"suppressed": "Source de l'avantage supprimé :",
"prefix": "Source de l'avantage :"
"prefix": "Source de l'avantage :",
"doubleProf": "Double compétence"
},
"Normal": {
"override": "Source de la priorité normal :"
Expand Down
3 changes: 2 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"Advantage": {
"override": "Vantagem anulada por",
"suppressed": "Vantagem suprimida por",
"prefix": "Vantagem de"
"prefix": "Vantagem de",
"doubleProf": "Proficiência Dupla"
},
"Normal": {
"override": "Substituição normal de"
Expand Down
30 changes: 28 additions & 2 deletions src/reminders.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,15 @@ export class ConcentrationReminder extends AbilitySaveReminder {
}

export class SkillReminder extends AbilityCheckReminder {
constructor(actor, abilityId, skillId) {
constructor(actor, abilityId, skillId, doubleProf, pace) {
super(actor, abilityId);

/** @type {string} */
this.skillId = skillId;
/** @type {boolean} */
this.doubleProf = doubleProf;
/** @type {{ advantage: boolean, disadvantage: boolean }} */
this.pace = pace;
}

/** @override */
Expand All @@ -465,14 +469,27 @@ export class SkillReminder extends AbilityCheckReminder {
};
return modes;
}

_customUpdateOptions(accumulator) {
super._customUpdateOptions(accumulator);

if (this.doubleProf) {
const label = game.i18n.localize("adv-reminder.Source.Advantage.doubleProf");
accumulator.advantage(label);
}
if (this.pace?.advantage) accumulator.advantage("&Reference[travelpace]");
if (this.pace?.disadvantage) accumulator.disadvantage("&Reference[travelpace]");
}
}

export class ToolReminder extends AbilityCheckReminder {
constructor(actor, abilityId, toolId) {
constructor(actor, abilityId, toolId, doubleProf) {
super(actor, abilityId);

/** @type {string} */
this.toolId = toolId;
/** @type {boolean} */
this.doubleProf = doubleProf;
}

get rollModes() {
Expand All @@ -485,6 +502,15 @@ export class ToolReminder extends AbilityCheckReminder {
};
return modes;
}

_customUpdateOptions(accumulator) {
super._customUpdateOptions(accumulator);

if (this.doubleProf) {
const label = game.i18n.localize("adv-reminder.Source.Advantage.doubleProf");
accumulator.advantage(label);
}
}
}

export class InitiativeReminder extends AbilityCheckReminder {
Expand Down
19 changes: 15 additions & 4 deletions src/rollers/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ export default class CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const skillId = config.skill;
const doubleProf = this.isDoubleProf(config);
const pace = dnd5e.dataModels.shared.MovementField.getTravelPaceMode(config.pace, config.skill);
new SkillMessage(actor, ability, skillId).addMessage(dialog);
if (showSources) new SkillSource(actor, ability, skillId).updateOptions(dialog);
new SkillReminder(actor, ability, skillId).updateOptions(config.rolls[0].options);
if (showSources) new SkillSource(actor, ability, skillId, doubleProf, pace).updateOptions(dialog);
new SkillReminder(actor, ability, skillId, doubleProf, pace).updateOptions(config.rolls[0].options);
}

preRollToolV2(config, dialog, message) {
Expand All @@ -164,9 +166,10 @@ export default class CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const toolId = config.tool;
const doubleProf = this.isDoubleProf(config);
new ToolMessage(actor, ability, toolId).addMessage(dialog);
if (showSources) new ToolSource(actor, ability, toolId).updateOptions(dialog);
new ToolReminder(actor, ability, toolId).updateOptions(config.rolls[0].options);
if (showSources) new ToolSource(actor, ability, toolId, doubleProf).updateOptions(dialog);
new ToolReminder(actor, ability, toolId, doubleProf).updateOptions(config.rolls[0].options);
}

preRollInitiativeDialogV2(config, dialog, message) {
Expand Down Expand Up @@ -236,4 +239,12 @@ export default class CoreRollerHooks {
if (!configure) debug("fast-forwarding the roll, stop processing");
return !configure;
}

isDoubleProf(config) {
const actor = config.subject;
const skill = actor.system.skills?.[config.skill];
const tool = actor.system.tools?.[config.tool];
debug("isDoubleProf", skill, tool);
return !!skill?.prof.hasProficiency && !!tool?.prof.hasProficiency;
}
}
7 changes: 5 additions & 2 deletions src/rollers/midi.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ export default class MidiRollerHooks extends CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const skillId = config.skill;
const doubleProf = this.isDoubleProf(config);
const pace = dnd5e.dataModels.shared.MovementField.getTravelPaceMode(config.pace, config.skill);
new SkillMessage(actor, ability, skillId).addMessage(dialog);
if (showSources) new MidiSkillSource(actor, ability, skillId).updateOptions(dialog);
if (showSources) new MidiSkillSource(actor, ability, skillId, doubleProf, pace).updateOptions(dialog);
}

preRollToolV2(config, dialog, message) {
Expand All @@ -180,8 +182,9 @@ export default class MidiRollerHooks extends CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const toolId = config.tool;
const doubleProf = this.isDoubleProf(config);
new ToolMessage(actor, ability, toolId).addMessage(dialog);
if (showSources) new ToolSource(actor, ability, toolId).updateOptions(dialog);
if (showSources) new ToolSource(actor, ability, toolId, doubleProf).updateOptions(dialog);
}

preRollInitiativeDialogV2(config, dialog, message) {
Expand Down
11 changes: 7 additions & 4 deletions src/rollers/rsr.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ export default class ReadySetRollHooks extends CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const skillId = config.skill;
const doubleProf = this.isDoubleProf(config);
const pace = dnd5e.dataModels.shared.MovementField.getTravelPaceMode(config.pace, config.skill);
if (this._doMessages(config, dialog)) {
new SkillMessage(actor, ability, skillId).addMessage(dialog);
if (showSources) new SkillSource(actor, ability, skillId).updateOptions(dialog);
if (showSources) new SkillSource(actor, ability, skillId, doubleProf, pace).updateOptions(dialog);
}

if (this._doReminder(config, dialog, message))
new SkillReminder(actor, ability, skillId).updateOptions(config.rolls[0].options);
new SkillReminder(actor, ability, skillId, doubleProf, pace).updateOptions(config.rolls[0].options);
}

preRollToolV2(config, dialog, message) {
Expand All @@ -151,13 +153,14 @@ export default class ReadySetRollHooks extends CoreRollerHooks {
const actor = config.subject;
const ability = config.ability;
const toolId = config.tool;
const doubleProf = this.isDoubleProf(config);
if (this._doMessages(config)) {
new ToolMessage(actor, ability, toolId).addMessage(dialog);
if (showSources) new ToolSource(actor, ability, toolId).updateOptions(dialog);
if (showSources) new ToolSource(actor, ability, toolId, doubleProf).updateOptions(dialog);
}

if (this._doReminder(config))
new ToolReminder(actor, ability, toolId).updateOptions(config.rolls[0].options);
new ToolReminder(actor, ability, toolId, doubleProf).updateOptions(config.rolls[0].options);
}

preRollInitiativeDialogV2(config, dialog, message) {
Expand Down