Skip to content

Commit

Permalink
Merge pull request #12 from DavidAremaCarretero/fix_getInitiatives
Browse files Browse the repository at this point in the history
Update Combat.js
  • Loading branch information
mclemente authored Oct 6, 2023
2 parents c54baaa + ecb4300 commit fde940f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ let lastInitiative = 0;
let disableOpenSheet;

function getInitiatives(combatTracker) {
combatTracker = combatTracker[0].children;
let firstPlace = combatTracker[0].children;
firstPlace = Number(firstPlace[firstPlace.length - 1].innerText);
let lastPlace = combatTracker[combatTracker.length - 1];
lastPlace = Number(lastPlace.children[lastPlace.children.length - 1].innerText);
let initiatives = $(combatTracker).find('.initiative');
if (!initiatives.length > 0) {
return;
}

let firstPlace = Number(initiatives[0].innerText);
let lastPlace = Number(initiatives[initiatives.length - 1].innerText);
if (firstPlace > lastPlace) {
firstInitiative = firstPlace + 1;
lastInitiative = lastPlace - 1;
Expand Down

0 comments on commit fde940f

Please sign in to comment.