Skip to content

Commit

Permalink
[#4684] Modify alert feat in 2024 rules to add proficiency
Browse files Browse the repository at this point in the history
The Alert feat when using the modern rules now sets initiative
proficiency, while in the legacy rules it still adds +5.

Closes #4684
  • Loading branch information
arbron committed Nov 11, 2024
1 parent fd35784 commit ec6c95e
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": "Provides proficiency for Initiative.",
"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 @@ -584,6 +584,7 @@ export default class Actor5e extends SystemDocumentMixin(Actor) {
_prepareInitiative(bonusData, globalCheckBonus=0) {
const init = this.system.attributes.init ??= {};
const flags = this.flags.dnd5e || {};
const modernRules = game.settings.get("dnd5e", "rulesVersion") === "modern";

// Compute initiative modifier
const abilityId = init.ability || CONFIG.DND5E.defaultAbilities.initiative;
Expand All @@ -592,15 +593,16 @@ export default class Actor5e extends SystemDocumentMixin(Actor) {

// Initiative proficiency
const prof = this.system.attributes.prof ?? 0;
const joat = flags.jackOfAllTrades && (game.settings.get("dnd5e", "rulesVersion") === "legacy");
const alert = flags.initiativeAlert && modernRules;
const joat = flags.jackOfAllTrades && !modernRules;
const ra = this._isRemarkableAthlete(abilityId);
init.prof = new Proficiency(prof, (joat || ra) ? 0.5 : 0, !ra);
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 && !modernRules ? 5 : 0)
+ (Number.isNumeric(init.prof.term) ? init.prof.flat : 0);
}

Expand Down

0 comments on commit ec6c95e

Please sign in to comment.