Skip to content

Commit

Permalink
[#4684] Adjust alert feat to add proficiency to initiative if using m…
Browse files Browse the repository at this point in the history
…odern rules.
  • Loading branch information
Fyorl committed Nov 11, 2024
1 parent fd35784 commit a887ee2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions dnd5e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ Hooks.once("i18nInit", () => {
racePl: game.i18n.localize("TYPES.Item.raceLegacyPl")
},
DND5E: {
FlagsAlertHint: game.i18n.localize("DND5E.FlagsAlertHintLegacy"),
LanguagesExotic: game.i18n.localize("DND5E.LanguagesExoticLegacy"),
LongRestHint: game.i18n.localize("DND5E.LongRestHintLegacy"),
LongRestHintGroup: game.i18n.localize("DND5E.LongRestHintGroupLegacy"),
Expand Down
3 changes: 2 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,8 @@
"DND5E.FlagsInitiativeAdv": "Advantage on Initiative",
"DND5E.FlagsInitiativeAdvHint": "Provided by feats or magical items.",
"DND5E.FlagsAlert": "Alert Feat",
"DND5E.FlagsAlertHint": "Provides +5 to Initiative.",
"DND5E.FlagsAlertHint": "Proficient in Initiative rolls.",
"DND5E.FlagsAlertHintLegacy": "Provides +5 to Initiative.",
"DND5E.FlagsJOAT": "Jack of All Trades",
"DND5E.FlagsJOATHint": "Half-Proficiency to Ability Checks in which you are not already Proficient.",
"DND5E.FlagsObservant": "Observant Feat",
Expand Down
8 changes: 5 additions & 3 deletions module/documents/actor/actor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -591,16 +591,18 @@ export default class Actor5e extends SystemDocumentMixin(Actor) {
init.mod = ability.mod ?? 0;

// Initiative proficiency
const isLegacy = game.settings.get("dnd5e", "rulesVersion") === "legacy";
const prof = this.system.attributes.prof ?? 0;
const joat = flags.jackOfAllTrades && (game.settings.get("dnd5e", "rulesVersion") === "legacy");
const joat = flags.jackOfAllTrades && isLegacy;
const ra = this._isRemarkableAthlete(abilityId);
init.prof = new Proficiency(prof, (joat || ra) ? 0.5 : 0, !ra);
const alert = flags.initiativeAlert && !isLegacy;
init.prof = new Proficiency(prof, alert ? 1 : (joat || ra) ? 0.5 : 0, !ra);

// Total initiative includes all numeric terms
const initBonus = simplifyBonus(init.bonus, bonusData);
const abilityBonus = simplifyBonus(ability.bonuses?.check, bonusData);
init.total = init.mod + initBonus + abilityBonus + globalCheckBonus
+ (flags.initiativeAlert ? 5 : 0)
+ (flags.initiativeAlert && isLegacy ? 5 : 0)
+ (Number.isNumeric(init.prof.term) ? init.prof.flat : 0);
}

Expand Down

0 comments on commit a887ee2

Please sign in to comment.