Skip to content

Commit

Permalink
Merge branch 'release/0.1.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed May 23, 2024
2 parents afda5f7 + 040b3e0 commit 3c9d410
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.1.4
Fix for weapon properties not properly accounted for in the roll. Closes #7.

## 0.1.3
Fix for the initiative roll defaulting to 1d20 in dnd5e v3.1 or higher. Closes #6.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
![Latest Release Download Count](https://img.shields.io/github/downloads/caewok/fvtt-action-initiative/latest/module.zip)
![All Downloads](https://img.shields.io/github/downloads/caewok/fvtt-action-initiative/total)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/H2H3Y7IJW)

# Action Initiative

Action Initiative implements initiative similar to that of the [Unearthed Arcana Greyhawk Initiative](https://media.wizards.com/2017/dnd/downloads/UAGreyhawkInitiative.pdf). Combatants declare actions in advance each turn; different actions use different combinations of die rolls to determine initiative position. Initiative goes from lowest to highest.
Expand Down
4 changes: 2 additions & 2 deletions scripts/Combatant.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ function weaponTypeFormula(weapon) {
const base = getDiceValueForProperty(`WEAPON_TYPES.${type}`);

// Each property potentially contributes to the formula
if ( !props.length ) return base;
const propF = props.map(prop => getDiceValueForProperty(`WEAPON_PROPERTIES.${prop}`));
if ( !props.size ) return base;
const propF = [...props.values().map(prop => getDiceValueForProperty(`WEAPON_PROPERTIES.${prop}`))];
return `${base} + ${propF.join(" + ")}`;
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const RANGED_WEAPONS = [
"siege"
];

// TODO: Use CONFIG.DND5E.validProperties.weapon instead of CONFIG.DND5E.weaponProperties

/**
* Construct the CONFIG object for this module containing basic properties.
* Must be called in the init hook (or later) to retrieve relevant DND5e properties.
Expand Down Expand Up @@ -155,7 +157,7 @@ export function constructConfigObject() {
const cfgDnD = CONFIG.DND5E;
cfg.weaponTypeKey = "system.type.value";
cfg.weaponProperties = {};
for ( const key of Object.keys(cfgDnD.weaponProperties) ) {
for ( const key of cfgDnD.validProperties.weapon ) {
cfg.weaponProperties[key] = game.i18n.localize(cfgDnD.itemProperties[key].label);
}
}
Expand Down

0 comments on commit 3c9d410

Please sign in to comment.