pf2e-sage-stats 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/app.js +5 -4
  2. package/package.json +1 -1
package/dist/app.js CHANGED
@@ -656,11 +656,12 @@ const formatTracker = (tracker) => {
656
656
  var _a, _b;
657
657
  const aliasSpace = (t) => (t.alias.length > 0 ? 0 : 5);
658
658
  const nameLengthWithAlias = (t) => t.name.length - aliasSpace(t);
659
- const nameLength = tracker.chars.reduce((p, c) => {
659
+ const chars = [...tracker.chars];
660
+ const nameLength = chars.reduce((p, c) => {
660
661
  const length = c.children.reduce((pp, cc) => pp > nameLengthWithAlias(cc) ? pp : nameLengthWithAlias(cc), nameLengthWithAlias(c));
661
662
  return p > length ? p : length;
662
663
  }, 0);
663
- const hpLength = tracker.chars.reduce((p, c) => {
664
+ const hpLength = chars.reduce((p, c) => {
664
665
  const hpLength = c.maxhp.toString().length + 1 + c.hp.toString().length + (c.temphp > 1 ? c.temphp.toString().length + 1 : 0);
665
666
  const length = c.children.reduce((pp, cc) => {
666
667
  const hhpLength = cc.maxhp.toString().length + 1 + cc.hp.toString().length + (cc.temphp > 1 ? cc.temphp.toString().length + 1 : 0);
@@ -681,9 +682,9 @@ const formatTracker = (tracker) => {
681
682
  ':limping:',
682
683
  ':dying:',
683
684
  ].reverse();
684
- const lines = tracker.chars.sort((a, b) => (a.init === b.init) ? (b.foe ? 1 : 0) - (a.foe ? 1 : 0) : b.init - a.init).flatMap((char, index) => {
685
+ const lines = chars.sort((a, b) => (a.init === b.init) ? (b.foe ? 1 : 0) - (a.foe ? 1 : 0) : b.init - a.init).flatMap((char, index) => {
685
686
  const ls = [];
686
- if (tracker.chars[index - 1] && tracker.chars[index - 1].foe !== char.foe) {
687
+ if (chars[index - 1] && chars[index - 1].foe !== char.foe) {
687
688
  ls.push('');
688
689
  }
689
690
  const hp = !char.foe && char.hp > 0 ? (`${char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}/${char.maxhp}`.padStart(hpLength)) : char.hp > 0 ? (`-${char.maxhp - char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}`.padStart(hpLength)) : (`${char.hp}${char.temphp > 0 ? `+${char.temphp}` : ''}`.padStart(hpLength));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pf2e-sage-stats",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "An RPG Sage's .tsv stat generation tool",
5
5
  "author": "ikariott@gmail.com",
6
6
  "license": "MIT",