forked from GitHub-Mirrors/foundry-sw5e

Things unfinished: - Migration - The update adds new sections to the class sheet to allow some light customisation, this hasn't been included, but could be extended for the sake of dynamic classes with automatic class features and more - The French - The packs have not yet been updated, meaning due to the addition of a progression field to the class item, classes now don't set force or tech points - I updated the function calls in starships, but I didn't update it very thoroughly, it'll need checking - I only did a little testing - There has since been updates to DND5e that hasn't made it to release that patch bugs, those should be implemented Things changed from base 5e: - Short rests and long rests were merged into one function, this needed some rewrites to account for force and tech points, and for printing the correct message Extra Comments: - Unfinished code exists for automatic spell scrolls, this could be extended for single use force or tech powers - Weapon proficiencies probably need revising - Elven accuracy, halfling lucky, and reliable talent are present in the roll logic, this probably needs revising for sw5e - SW5e has a variant rule that permits force powers of any alignment to use either charisma or wisdom, that could be implemented - SW5e's version of gritty realism, [Longer Rests](https://sw5e.com/rules/variantRules/Longer%20Rests) differs from base dnd, this could be implemented - Extra ideas I've had while looking through the code can be found in Todos next to the ideas relevant context
27 lines
1 KiB
JavaScript
27 lines
1 KiB
JavaScript
|
|
/**
|
|
* Override the default Initiative formula to customize special behaviors of the SW5e system.
|
|
* Apply advantage, proficiency, or bonuses where appropriate
|
|
* Apply the dexterity score as a decimal tiebreaker if requested
|
|
* See Combat._getInitiativeFormula for more detail.
|
|
*/
|
|
export const _getInitiativeFormula = function() {
|
|
const actor = this.actor;
|
|
if ( !actor ) return "1d20";
|
|
const init = actor.data.data.attributes.init;
|
|
|
|
// Construct initiative formula parts
|
|
let nd = 1;
|
|
let mods = "";
|
|
if (actor.getFlag("sw5e", "halflingLucky")) mods += "r1=1";
|
|
if (actor.getFlag("sw5e", "initiativeAdv")) {
|
|
nd = 2;
|
|
mods += "kh";
|
|
}
|
|
const parts = [`${nd}d20${mods}`, init.mod, (init.prof !== 0) ? init.prof : null, (init.bonus !== 0) ? init.bonus : null];
|
|
|
|
// Optionally apply Dexterity tiebreaker
|
|
const tiebreaker = game.settings.get("sw5e", "initiativeDexTiebreaker");
|
|
if ( tiebreaker ) parts.push(actor.data.data.abilities.dex.value / 100);
|
|
return parts.filter(p => p !== null).join(" + ");
|
|
};
|