From 0db3845fdc68344828e80ab45cd53a6977a766de Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Tue, 16 May 2023 20:17:12 -0400 Subject: [PATCH] fix: Encounters pull FS creatures correctly --- src/encounter/ui/Encounter.svelte | 4 ++-- src/main.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/encounter/ui/Encounter.svelte b/src/encounter/ui/Encounter.svelte index 8a32f775..f49afc93 100644 --- a/src/encounter/ui/Encounter.svelte +++ b/src/encounter/ui/Encounter.svelte @@ -21,7 +21,7 @@ setContext("plugin", plugin); export let name: string = "Encounter"; - export let creatures: Map; + export let creatures: Map = new Map(); export let players: string[]; export let party: string = null; export let hide: string[] = []; @@ -63,7 +63,7 @@ difficulty = encounterDifficulty( playerLevels, totalXP, - [...creatureMap.values()].reduce((acc, curr) => acc + curr) + [...creatureMap.values()].reduce((acc, curr) => acc + curr, 0) ); } } diff --git a/src/main.ts b/src/main.ts index 55df8d50..ed2f6b1e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -97,8 +97,8 @@ export default class InitiativeTracker extends Plugin { } getPlayerByName(name: string) { - if (!this.playerCreatures.has(name)) return new Creature({ name }); - return Creature.from(this.playerCreatures.get(name)); + if (!this.players.has(name)) return new Creature({ name }); + return Creature.from(this.players.get(name)); } getPlayersForParty(party: string) { return (