Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1852] Allow for choosing a skill's ability on the character sheet #1854

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Re-add ability used in skill and tool checks to roll flavour. Remove …
…some now-redundant code.
  • Loading branch information
Fyorl committed Oct 13, 2022
commit 8d2e921bb3b1aa6ac6f3221af0c0c0cfc90f3708
18 changes: 1 addition & 17 deletions module/dice/d20-roll.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ export default class D20Roll extends Roll {
const content = await renderTemplate(template ?? this.constructor.EVALUATION_TEMPLATE, {
formula: `${this.formula} + @bonus`,
defaultRollMode,
rollModes: CONFIG.Dice.rollModes,
abilities: CONFIG.DND5E.abilities
rollModes: CONFIG.Dice.rollModes
});

let defaultButton = "normal";
Expand Down Expand Up @@ -252,21 +251,6 @@ export default class D20Roll extends Roll {
this.terms = this.terms.concat(bonus.terms);
}

// Customize the modifier
if ( form.ability?.value ) {
const abl = this.data.abilities[form.ability.value];
this.terms = this.terms.flatMap(t => {
if ( t.term === "@mod" ) return new NumericTerm({number: abl.mod});
if ( t.term === "@abilityCheckBonus" ) {
const bonus = abl.bonuses?.check;
if ( bonus ) return new Roll(bonus, this.data).terms;
return new NumericTerm({number: 0});
}
return t;
});
this.options.flavor += ` (${CONFIG.DND5E.abilities[form.ability.value]})`;
}

// Apply advantage or disadvantage
this.options.advantageMode = advantageMode;
this.options.rollMode = form.rollMode.value;
Expand Down
3 changes: 2 additions & 1 deletion module/documents/actor/actor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ export default class Actor5e extends Actor {
const reliableTalent = (skl.value >= 1 && this.getFlag("dnd5e", "reliableTalent"));

// Roll and return
const flavor = game.i18n.format("DND5E.SkillPromptTitle", {skill: CONFIG.DND5E.skills[skillId]?.label ?? ""});
const flavor = game.i18n.format("DND5E.SkillPromptTitle", {skill: CONFIG.DND5E.skills[skillId]?.label ?? ""})
+ ` (${CONFIG.DND5E.abilities[skl.ability]})`;
const rollData = foundry.utils.mergeObject({
parts: parts,
data: data,
Expand Down
2 changes: 1 addition & 1 deletion module/documents/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ export default class Item5e extends Item {
parts: parts,
data: rollData,
title: title,
flavor: title,
flavor: title + ` (${CONFIG.DND5E.abilities[abl]})`,
dialogOptions: {
width: 400,
top: options.event ? options.event.clientY - 80 : null,
Expand Down