Skip to content

Commit

Permalink
fix: correctly retrieve creatures from bestiary in encounters
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Aug 11, 2023
1 parent ad30f98 commit 195d871
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/encounter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class EncounterParser {
}

if (!name || typeof name != "string") return {};
let existing = this.plugin.bestiary.find((c) => c.name == name);
let existing = this.plugin.getCreatureFromBestiary(name);
let creature = existing
? Creature.from(existing)
: new Creature({ name });
Expand Down
1 change: 0 additions & 1 deletion src/tracker/ui/Controls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
EXPAND,
FORWARD,
GROUP,
MAP,
NEW,
PLAY,
REDO,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function crToString(cr: string | number): string {
const decimalPart = cr % 1;
const wholePart = Math.floor(cr);
if (decimalPart == 0) return wholePart.toString();
let str = (wholePart == 0) ? "" : wholePart.toString();
let str = wholePart == 0 ? "" : wholePart.toString();
if (decimalPart in DECIMAL_TO_VULGAR_FRACTION) {
str += DECIMAL_TO_VULGAR_FRACTION[decimalPart];
} else {
Expand All @@ -45,5 +45,5 @@ export function getFromCreatureOrBestiary<T>(
): T {
const fromBase = getter(creature);
if (fromBase) return fromBase;
return getter(plugin.bestiary.find(c => c.name == creature.name));
}
return getter(plugin.getCreatureFromBestiary(creature.name));
}

0 comments on commit 195d871

Please sign in to comment.