pf2e-sage-stats 0.2.6 → 0.2.7

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.
package/README.md CHANGED
@@ -14,10 +14,10 @@ sage! macro set name="spell" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}
14
14
  ```
15
15
  ### Saves
16
16
  ```
17
- sage! macro set name="fort" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::fort:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::fort.info:} Fortitude Save {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Saves tier=Server -y
17
+ sage! macro set name="fort" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::fortitude:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::fortitude.info:} Fortitude Save {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Saves tier=Server -y
18
18
  ```
19
19
  ```
20
- sage! macro set name="fortitude" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::fort:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::fort.info:} Fortitude Save {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Saves tier=Server -y
20
+ sage! macro set name="fortitude" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::fortitude:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::fortitude.info:} Fortitude Save {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Saves tier=Server -y
21
21
  ```
22
22
  ```
23
23
  sage! macro set name="ref" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::reflex:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::reflex.info:} Reflex Save {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Saves tier=Server -y
@@ -101,6 +101,12 @@ sage! macro set name="lore" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}}
101
101
  ```
102
102
  ### Skills 5
103
103
  ```
104
+ sage! macro set name="piloting" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::piloting:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::piloting.info:} Piloting Check {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Skills tier=Server -y
105
+ ```
106
+ ```
107
+ sage! macro set name="computers" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} {dice::{d:none}:{d:1}}d20+{{p}::computers:{a:0}} {m} {v} {{p}::name:} (mod `{m:+0}`) {{p}::computers.info:} Computers Check {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Skills tier=Server -y
108
+ ```
109
+ ```
104
110
  sage! macro set name="assurance" dice="[{{p}::{o:out}:{o:m}} {x} {flat::{f:none}:{f}} (10)d20+{0:0}-10 {v} {{p}::name:} Assurance Check {utils::{t:known}:vs} {{t:none}::name:} {utils::{t:known}:`{r:Spell} DC ({c:+0} DC) `} {dc} {utils::{t:known}:dc} {{t:none}::dc.{r:spells}:} {c} {...}]" cat=Skills tier=Server -y
105
111
  ```
106
112
  ```
package/dist/app.js CHANGED
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.screenPlay = exports.sortFolder = exports.formatTracker = exports.newtracker = exports.formatHP = exports.formatTable = exports.formatCommand = exports.formatTSV = exports.flatten = exports.parseStatblock = exports.parseTracker = exports.parseJSON = exports.formatJSON = exports.fromatMap = exports.diceMap = exports.flatMap = exports.stub = void 0;
15
+ exports.screenPlay = exports.sortFolder = exports.formatTracker = exports.newtracker = exports.formatHP = exports.formatTable = exports.formatCommand = exports.formatTSV = exports.flatten = exports.parseStatblock = exports.parseTracker = exports.parseJSON = exports.formatJSON = exports.fromatMap = exports.diceMap = exports.flatMap = exports.charSchema = exports.stub = void 0;
16
16
  const zod_1 = __importDefault(require("zod"));
17
17
  const tsv_1 = require("tsv");
18
18
  const lodash_1 = require("lodash");
@@ -60,6 +60,8 @@ const schema = zod_1.default.object({
60
60
  stealth: zod_1.default.coerce.number().optional(),
61
61
  survival: zod_1.default.coerce.number().optional(),
62
62
  thievery: zod_1.default.coerce.number().optional(),
63
+ piloting: zod_1.default.coerce.number().optional(),
64
+ computers: zod_1.default.coerce.number().optional(),
63
65
  }).default({}),
64
66
  lores: zod_1.default.record(zod_1.default.string(), zod_1.default.object({
65
67
  mod: zod_1.default.coerce.number().default(0),
@@ -118,6 +120,8 @@ const schema = zod_1.default.object({
118
120
  stealth: zod_1.default.array(zod_1.default.string()).optional(),
119
121
  survival: zod_1.default.array(zod_1.default.string()).optional(),
120
122
  thievery: zod_1.default.array(zod_1.default.string()).optional(),
123
+ piloting: zod_1.default.array(zod_1.default.string()).optional(),
124
+ computers: zod_1.default.array(zod_1.default.string()).optional(),
121
125
  }).default({}),
122
126
  });
123
127
  exports.stub = {
@@ -159,6 +163,8 @@ exports.stub = {
159
163
  stealth: 0,
160
164
  survival: 0,
161
165
  thievery: 0,
166
+ piloting: 0,
167
+ computers: 0,
162
168
  },
163
169
  lores: {},
164
170
  melee: {
@@ -189,7 +195,7 @@ const childSchema = zod_1.default.object({
189
195
  maxhp: zod_1.default.coerce.number().default(10),
190
196
  conditions: zod_1.default.string().default(''),
191
197
  });
192
- const charSchema = zod_1.default.object({
198
+ exports.charSchema = zod_1.default.object({
193
199
  init: zod_1.default.coerce.number().default(0),
194
200
  foe: zod_1.default.boolean().default(false),
195
201
  state: zod_1.default.union([zod_1.default.literal('empty'), zod_1.default.literal('arrow'), zod_1.default.literal('check'), zod_1.default.literal('cross')]).default('empty'),
@@ -213,7 +219,7 @@ const formatJSON = (stats) => JSON.stringify(stats, undefined, 2);
213
219
  exports.formatJSON = formatJSON;
214
220
  const parseJSON = (json) => schema.parse(JSON.parse(json));
215
221
  exports.parseJSON = parseJSON;
216
- const parseTracker = (json) => zod_1.default.array(charSchema).parse(JSON.parse(json));
222
+ const parseTracker = (json) => zod_1.default.array(exports.charSchema).parse(JSON.parse(json));
217
223
  exports.parseTracker = parseTracker;
218
224
  const locateName = (statblock) => {
219
225
  const regex = /^([^()]+?)(\s+\(\d+\))?\s+\S+\s+(-?\d+)$/m;
@@ -350,7 +356,7 @@ const parseStatblock = (name, _statblock, alias) => {
350
356
  .replace('', '')
351
357
  .replace(/–/g, '-') + '\n';
352
358
  const basic = locateName(statblock);
353
- const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults), basic), (name && { name: name })), { alias: alias !== null && alias !== void 0 ? alias : (0, abbreviate_1.default)((_a = name !== null && name !== void 0 ? name : basic === null || basic === void 0 ? void 0 : basic.name) !== null && _a !== void 0 ? _a : defaults.name, { length: 3 }).toLowerCase() }), locateInt('perception', statblock)), locateInt('ac', statblock, null, false, 'AC')), locateInt('maxhp', statblock, null, false, 'HP')), { attributes: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.attributes), locateInt('strength', statblock, null, true, 'Str')), locateInt('dexterity', statblock, null, true, 'Dex')), locateInt('constitution', statblock, null, true, 'Con')), locateInt('intelligence', statblock, null, true, 'Int')), locateInt('wisdom', statblock, null, true, 'Wis')), locateInt('charisma', statblock, null, true, 'Cha')), saves: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.saves), locateInt('fortitude', statblock, null, true, 'Fortitude')), locateInt('reflex', statblock, null, true, 'Reflex')), locateInt('fortitude', statblock, null, true, 'Fort')), locateInt('reflex', statblock, null, true, 'Ref')), locateInt('will', statblock, null, true, 'Will')), skills: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.skills), locateInt('acrobatics', statblock, 'Skills')), locateInt('arcana', statblock, 'Skills')), locateInt('athletics', statblock, 'Skills')), locateInt('crafting', statblock, 'Skills')), locateInt('deception', statblock, 'Skills')), locateInt('diplomacy', statblock, 'Skills')), locateInt('intimidation', statblock, 'Skills')), locateInt('medicine', statblock, 'Skills')), locateInt('nature', statblock, 'Skills')), locateInt('occultism', statblock, 'Skills')), locateInt('performance', statblock, 'Skills')), locateInt('religion', statblock, 'Skills')), locateInt('society', statblock, 'Skills')), locateInt('stealth', statblock, 'Skills')), locateInt('survival', statblock, 'Skills')), locateInt('thievery', statblock, 'Skills')), lores: Object.assign(Object.assign({}, locateInts(statblock, 'Skills', 'Lore')), locateIntsAfter(statblock, 'Lore:')), melee: Object.assign({}, locateStrikes(statblock, 'Melee')), ranged: Object.assign({}, locateStrikes(statblock, 'Ranged')), spells: Object.assign({}, locateSpells(statblock)), extra: {}, extraDCs: Object.assign({}, locateInt('stealth', statblock, null, false, 'Stealth DC')), extraDice: {} });
359
+ const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults), basic), (name && { name: name })), { alias: alias !== null && alias !== void 0 ? alias : (0, abbreviate_1.default)((_a = name !== null && name !== void 0 ? name : basic === null || basic === void 0 ? void 0 : basic.name) !== null && _a !== void 0 ? _a : defaults.name, { length: 3 }).toLowerCase() }), locateInt('perception', statblock)), locateInt('ac', statblock, null, false, 'AC')), locateInt('maxhp', statblock, null, false, 'HP')), { attributes: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.attributes), locateInt('strength', statblock, null, true, 'Str')), locateInt('dexterity', statblock, null, true, 'Dex')), locateInt('constitution', statblock, null, true, 'Con')), locateInt('intelligence', statblock, null, true, 'Int')), locateInt('wisdom', statblock, null, true, 'Wis')), locateInt('charisma', statblock, null, true, 'Cha')), saves: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.saves), locateInt('fortitude', statblock, null, true, 'Fortitude')), locateInt('reflex', statblock, null, true, 'Reflex')), locateInt('fortitude', statblock, null, true, 'Fort')), locateInt('reflex', statblock, null, true, 'Ref')), locateInt('will', statblock, null, true, 'Will')), skills: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaults.skills), locateInt('acrobatics', statblock, 'Skills')), locateInt('arcana', statblock, 'Skills')), locateInt('athletics', statblock, 'Skills')), locateInt('crafting', statblock, 'Skills')), locateInt('deception', statblock, 'Skills')), locateInt('diplomacy', statblock, 'Skills')), locateInt('intimidation', statblock, 'Skills')), locateInt('medicine', statblock, 'Skills')), locateInt('nature', statblock, 'Skills')), locateInt('occultism', statblock, 'Skills')), locateInt('performance', statblock, 'Skills')), locateInt('religion', statblock, 'Skills')), locateInt('society', statblock, 'Skills')), locateInt('stealth', statblock, 'Skills')), locateInt('survival', statblock, 'Skills')), locateInt('thievery', statblock, 'Skills')), locateInt('piloting', statblock, 'Skills')), locateInt('computers', statblock, 'Skills')), lores: Object.assign(Object.assign({}, locateInts(statblock, 'Skills', 'Lore')), locateIntsAfter(statblock, 'Lore:')), melee: Object.assign({}, locateStrikes(statblock, 'Melee')), ranged: Object.assign({}, locateStrikes(statblock, 'Ranged')), spells: Object.assign({}, locateSpells(statblock)), extra: {}, extraDCs: Object.assign({}, locateInt('stealth', statblock, null, false, 'Stealth DC')), extraDice: {} });
354
360
  result.untrained = improvisation ? (result.level >= 7 ? result.level : result.level >= 5 ? result.level - 1 : result.level - 2) : 0;
355
361
  result.bullwark = plate ? Math.max(3 - result.attributes.dexterity, 0) : 0;
356
362
  return result;
@@ -374,7 +380,7 @@ const toRanged = ([key, value]) => [
374
380
  const flatten = (stats, secretDC = false, defaultSkills = false) => {
375
381
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
376
382
  const untrained = stats.untrained;
377
- const skills = defaultSkills ? Object.assign({ acrobatics: untrained + stats.attributes.dexterity, arcana: untrained + stats.attributes.intelligence, athletics: untrained + stats.attributes.strength, crafting: untrained + stats.attributes.intelligence, deception: untrained + stats.attributes.charisma, diplomacy: untrained + stats.attributes.charisma, intimidation: untrained + stats.attributes.charisma, medicine: untrained + stats.attributes.wisdom, nature: untrained + stats.attributes.wisdom, occultism: untrained + stats.attributes.intelligence, performance: untrained + stats.attributes.charisma, religion: untrained + stats.attributes.wisdom, society: untrained + stats.attributes.intelligence, stealth: untrained + stats.attributes.dexterity, survival: untrained + stats.attributes.wisdom, thievery: untrained + stats.attributes.dexterity }, stats.skills) : stats.skills;
383
+ const skills = defaultSkills ? Object.assign({ acrobatics: untrained + stats.attributes.dexterity, arcana: untrained + stats.attributes.intelligence, athletics: untrained + stats.attributes.strength, crafting: untrained + stats.attributes.intelligence, deception: untrained + stats.attributes.charisma, diplomacy: untrained + stats.attributes.charisma, intimidation: untrained + stats.attributes.charisma, medicine: untrained + stats.attributes.wisdom, nature: untrained + stats.attributes.wisdom, occultism: untrained + stats.attributes.intelligence, performance: untrained + stats.attributes.charisma, religion: untrained + stats.attributes.wisdom, society: untrained + stats.attributes.intelligence, stealth: untrained + stats.attributes.dexterity, survival: untrained + stats.attributes.wisdom, thievery: untrained + stats.attributes.dexterity, piloting: untrained + stats.attributes.dexterity, computers: untrained + stats.attributes.intelligence }, stats.skills) : stats.skills;
378
384
  const lores = defaultSkills ? Object.assign(Object.assign({}, stats.lores), { other: {
379
385
  mod: untrained + stats.attributes.intelligence,
380
386
  name: "Other",
@@ -503,11 +509,11 @@ const newtracker = (status) => {
503
509
  var _a, _b;
504
510
  const regex = /((.+)\s+\((\d+)\/(\d+)\s+HP\):(.*)(\n>(.+)\s+\((\d+)\/(\d+)\s+HP\):(.*))*)/gm;
505
511
  const match = status.match(regex);
506
- const tracker = zod_1.default.array(charSchema).parse([]);
512
+ const tracker = zod_1.default.array(exports.charSchema).parse([]);
507
513
  for (const m of match !== null && match !== void 0 ? match : []) {
508
514
  const mmatch = m.match(/([^>]+)\s+\((\d+)\/(\d+)\s+HP\):(.*)/);
509
515
  const cmatch = m.match(/>\s+(\S+)\s+\((\d+)\/(\d+)\s+HP\):(.*)/g);
510
- const char = charSchema.parse({
516
+ const char = exports.charSchema.parse({
511
517
  name: mmatch === null || mmatch === void 0 ? void 0 : mmatch[1],
512
518
  hp: mmatch === null || mmatch === void 0 ? void 0 : mmatch[2],
513
519
  maxhp: mmatch === null || mmatch === void 0 ? void 0 : mmatch[3],
package/dist/index.js CHANGED
@@ -244,6 +244,15 @@ program.command('track')
244
244
  }, {
245
245
  regex: /^\s*reset/i,
246
246
  map: () => ({ command: 'reset' })
247
+ }, {
248
+ regex: /^\s*purge/i,
249
+ map: () => ({ command: 'purge' })
250
+ }, {
251
+ regex: /^\s*blank/i,
252
+ map: () => ({ command: 'blank' })
253
+ }, {
254
+ regex: /^\s*foe(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
255
+ map: (match) => ({ command: 'foe', name: match[2], alias: match[4], hp: match[6] && parseInt(match[6], 10) })
247
256
  }, {
248
257
  regex: /^\s*heal/i,
249
258
  map: () => ({ command: 'heal' })
@@ -280,6 +289,31 @@ program.command('track')
280
289
  return { command: 'set-init', tag: match[1], value: parseInt(match[2]) };
281
290
  }
282
291
  },
292
+ }, {
293
+ regex: /^\s*([^\s="+-]+)\s*=?"([^"]*)"/,
294
+ map: (match) => {
295
+ return { command: 'set-conditions', tag: match[1], value: match[2] };
296
+ },
297
+ }, {
298
+ regex: /^\s*([^\s="+-]+)\s*\+"([^"]*)"/,
299
+ map: (match) => {
300
+ return { command: 'add-conditions', tag: match[1], value: match[2] };
301
+ },
302
+ }, {
303
+ regex: /^\s*([^\s="+-]+)\s*-"([^"]*)"/,
304
+ map: (match) => {
305
+ return { command: 'rem-conditions', tag: match[1], value: match[2] };
306
+ },
307
+ }, {
308
+ regex: /^\s*([^\s="+-]+)\s*\+\+"([^"]*)"/,
309
+ map: (match) => {
310
+ return { command: 'inc-conditions', tag: match[1], value: match[2] };
311
+ },
312
+ }, {
313
+ regex: /^\s*([^\s="+-]+)\s*--"([^"]*)"/,
314
+ map: (match) => {
315
+ return { command: 'dec-conditions', tag: match[1], value: match[2] };
316
+ },
283
317
  }, {
284
318
  regex: /^\s*(\S+)\s+[sS]?\s*=?"([^"]*)"/,
285
319
  map: (match) => {
@@ -409,6 +443,9 @@ program.command('track')
409
443
  else if (action.command === 'delete') {
410
444
  tracker = tracker.filter((c) => !(c.id === action.tag || c.alias === action.tag || c.name == action.tag)).map((p) => (Object.assign(Object.assign({}, p), { children: p.children.filter((c) => !(c.id === action.tag || c.alias === action.tag || c.name == action.tag)) })));
411
445
  }
446
+ else if (action.command === 'purge') {
447
+ tracker = tracker.filter((c) => !c.foe);
448
+ }
412
449
  else if (action.command === 'exit') {
413
450
  process.exit(0);
414
451
  }
@@ -443,6 +480,11 @@ program.command('track')
443
480
  item.init = Math.max(0, action.value);
444
481
  }
445
482
  }
483
+ else if (action.command === 'blank') {
484
+ tracker.forEach((item) => {
485
+ item.conditions = "";
486
+ });
487
+ }
446
488
  else if (action.command === 'set-conditions') {
447
489
  const item = (_e = tracker.find((c) => c.id === action.tag || c.alias === action.tag || c.name == action.tag)) !== null && _e !== void 0 ? _e : (tracker.flatMap((c) => c.children).find((c) => c.id === action.tag || c.alias === action.tag || c.name == action.tag));
448
490
  if (item) {
@@ -526,6 +568,9 @@ program.command('track')
526
568
  item.init = Math.max(0, item.init + action.value);
527
569
  }
528
570
  }
571
+ else if (action.command === 'foe') {
572
+ tracker.push(app_1.charSchema.parse({ foe: true, name: action.name, alias: action.alias, maxhp: action.hp, hp: action.hp }));
573
+ }
529
574
  }
530
575
  yield promises_1.default.writeFile(argument, JSON.stringify(tracker, undefined, 2), { encoding: 'utf-8' });
531
576
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pf2e-sage-stats",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "An RPG Sage's .tsv stat generation tool",
5
5
  "main": "dist/index.js",
6
6
  "author": "ikariott@gmail.com",
package/src/app.ts CHANGED
@@ -46,6 +46,8 @@ const schema = zod.object({
46
46
  stealth: zod.coerce.number().optional(),
47
47
  survival: zod.coerce.number().optional(),
48
48
  thievery: zod.coerce.number().optional(),
49
+ piloting: zod.coerce.number().optional(),
50
+ computers: zod.coerce.number().optional(),
49
51
  }).default({}),
50
52
  lores: zod.record(zod.string(), zod.object({
51
53
  mod: zod.coerce.number().default(0),
@@ -104,6 +106,8 @@ const schema = zod.object({
104
106
  stealth: zod.array(zod.string()).optional(),
105
107
  survival: zod.array(zod.string()).optional(),
106
108
  thievery: zod.array(zod.string()).optional(),
109
+ piloting: zod.array(zod.string()).optional(),
110
+ computers: zod.array(zod.string()).optional(),
107
111
  }).default({}),
108
112
  })
109
113
 
@@ -148,6 +152,8 @@ export const stub: Required<Schema> = {
148
152
  stealth: 0,
149
153
  survival: 0,
150
154
  thievery: 0,
155
+ piloting: 0,
156
+ computers: 0,
151
157
  },
152
158
  lores: {},
153
159
  melee: {
@@ -182,7 +188,7 @@ const childSchema = zod.object({
182
188
 
183
189
  export type ChildSchema = zod.infer<typeof childSchema>;
184
190
 
185
- const charSchema = zod.object({
191
+ export const charSchema = zod.object({
186
192
  init: zod.coerce.number().default(0),
187
193
  foe: zod.boolean().default(false),
188
194
  state: zod.union([zod.literal('empty'), zod.literal('arrow'), zod.literal('check'), zod.literal('cross')]).default('empty'),
@@ -450,6 +456,8 @@ export const parseStatblock = (name: string | null, _statblock: string, alias: s
450
456
  ...locateInt('stealth', statblock, 'Skills'),
451
457
  ...locateInt('survival', statblock, 'Skills'),
452
458
  ...locateInt('thievery', statblock, 'Skills'),
459
+ ...locateInt('piloting', statblock, 'Skills'),
460
+ ...locateInt('computers', statblock, 'Skills'),
453
461
  },
454
462
  lores: {
455
463
  ...locateInts(statblock, 'Skills', 'Lore'),
@@ -513,6 +521,8 @@ export const flatten = (stats: Schema, secretDC: boolean = false, defaultSkills:
513
521
  stealth: untrained + stats.attributes.dexterity,
514
522
  survival: untrained + stats.attributes.wisdom,
515
523
  thievery: untrained + stats.attributes.dexterity,
524
+ piloting: untrained + stats.attributes.dexterity,
525
+ computers: untrained + stats.attributes.intelligence,
516
526
  ...stats.skills,
517
527
  } : stats.skills;
518
528
 
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@ import clipboardy from 'clipboardy';
8
8
 
9
9
  import pack from '../package.json';
10
10
 
11
- import { sortFolder, formatCommand, formatJSON, formatTSV, fromatMap, parseJSON, parseStatblock, stub, flatMap, formatTable, formatHP, newtracker, parseTracker, formatTracker, screenPlay, diceMap } from './app';
11
+ import { sortFolder, formatCommand, formatJSON, formatTSV, fromatMap, parseJSON, parseStatblock, stub, flatMap, formatTable, formatHP, newtracker, parseTracker, formatTracker, screenPlay, diceMap, charSchema } from './app';
12
12
 
13
13
  const program = new Command(pack.name);
14
14
 
@@ -240,6 +240,15 @@ program.command('track')
240
240
  }, {
241
241
  regex: /^\s*reset/i,
242
242
  map: () => ({ command: 'reset' as const })
243
+ }, {
244
+ regex: /^\s*purge/i,
245
+ map: () => ({ command: 'purge' as const })
246
+ }, {
247
+ regex: /^\s*blank/i,
248
+ map: () => ({ command: 'blank' as const })
249
+ }, {
250
+ regex: /^\s*foe(\s+(\S+))?(\s+(\S+))?(\s+(\d+))?/i,
251
+ map: (match: RegExpMatchArray) => ({ command: 'foe' as const, name: match[2], alias: match[4], hp: match[6] && parseInt(match[6], 10) })
243
252
  }, {
244
253
  regex: /^\s*heal/i,
245
254
  map: () => ({ command: 'heal' as const })
@@ -273,6 +282,31 @@ program.command('track')
273
282
  return { command: 'set-init' as const, tag: match[1], value: parseInt(match[2]) };
274
283
  }
275
284
  },
285
+ }, {
286
+ regex: /^\s*([^\s="+-]+)\s*=?"([^"]*)"/,
287
+ map: (match: RegExpMatchArray) => {
288
+ return { command: 'set-conditions' as const, tag: match[1], value: match[2] };
289
+ },
290
+ }, {
291
+ regex: /^\s*([^\s="+-]+)\s*\+"([^"]*)"/,
292
+ map: (match: RegExpMatchArray) => {
293
+ return { command: 'add-conditions' as const, tag: match[1], value: match[2] };
294
+ },
295
+ }, {
296
+ regex: /^\s*([^\s="+-]+)\s*-"([^"]*)"/,
297
+ map: (match: RegExpMatchArray) => {
298
+ return { command: 'rem-conditions' as const, tag: match[1], value: match[2] };
299
+ },
300
+ }, {
301
+ regex: /^\s*([^\s="+-]+)\s*\+\+"([^"]*)"/,
302
+ map: (match: RegExpMatchArray) => {
303
+ return { command: 'inc-conditions' as const, tag: match[1], value: match[2] };
304
+ },
305
+ }, {
306
+ regex: /^\s*([^\s="+-]+)\s*--"([^"]*)"/,
307
+ map: (match: RegExpMatchArray) => {
308
+ return { command: 'dec-conditions' as const, tag: match[1], value: match[2] };
309
+ },
276
310
  }, {
277
311
  regex: /^\s*(\S+)\s+[sS]?\s*=?"([^"]*)"/,
278
312
  map: (match: RegExpMatchArray) => {
@@ -416,6 +450,8 @@ program.command('track')
416
450
  ...p,
417
451
  children: p.children.filter((c) => !(c.id === action.tag || c.alias === action.tag || c.name == action.tag)),
418
452
  }))
453
+ } else if (action.command === 'purge') {
454
+ tracker = tracker.filter((c) => !c.foe)
419
455
  } else if (action.command === 'exit') {
420
456
  process.exit(0)
421
457
  } else if (action.command === 'heal') {
@@ -452,6 +488,10 @@ program.command('track')
452
488
  if (item) {
453
489
  item.init = Math.max(0, action.value)
454
490
  }
491
+ } else if (action.command === 'blank') {
492
+ tracker.forEach((item) => {
493
+ item.conditions = ""
494
+ })
455
495
  } else if (action.command === 'set-conditions') {
456
496
  const item = tracker.find((c) => c.id === action.tag || c.alias === action.tag || c.name == action.tag) ?? (
457
497
  tracker.flatMap((c) => c.children).find((c) => c.id === action.tag || c.alias === action.tag || c.name == action.tag)
@@ -557,6 +597,8 @@ program.command('track')
557
597
  if (item) {
558
598
  item.init = Math.max(0, item.init + action.value)
559
599
  }
600
+ } else if (action.command === 'foe') {
601
+ tracker.push(charSchema.parse({ foe: true, name: action.name, alias: action.alias, maxhp: action.hp, hp: action.hp }))
560
602
  }
561
603
  }
562
604