From 6e3dfda18fcf77b082ef4772c834f88a26f3f353 Mon Sep 17 00:00:00 2001 From: valentine195 <38669521+valentine195@users.noreply.github.com> Date: Wed, 30 Jun 2021 11:01:21 -0400 Subject: [PATCH] 0.0.4 - Fixed bug related to adding a creature without an initiative value --- manifest.json | 2 +- package.json | 2 +- src/settings.ts | 2 +- src/svelte/Create.svelte | 10 +++++++--- versions.json | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index 215fb493..d8fd24eb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-initiative-tracker", "name": "Obsidian Initiative Tracker", - "version": "0.0.3", + "version": "0.0.4", "minAppVersion": "0.12.5", "description": "TTRPG Initiative Tracker for Obsidian.md", "author": "Jeremy Valentine", diff --git a/package.json b/package.json index db6782bb..688daaf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-initiative-tracker", - "version": "0.0.3", + "version": "0.0.4", "description": "TTRPG Initiative Tracker for Obsidian.md", "main": "main.js", "scripts": { diff --git a/src/settings.ts b/src/settings.ts index e8cd651f..4fe37b32 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -83,7 +83,7 @@ export default class InitiativeTrackerSettings extends PluginSettingTab { "initiative-tracker-additional-container" ); - const importSetting = new Setting(importSettingsContainer) + new Setting(importSettingsContainer) .setName("Import Monsters") .setDesc( "Import monsters from monster files. Only import data that you own." diff --git a/src/svelte/Create.svelte b/src/svelte/Create.svelte index d3dd1b0c..118ccdf9 100644 --- a/src/svelte/Create.svelte +++ b/src/svelte/Create.svelte @@ -10,7 +10,7 @@ import type TrackerView from "src/view"; import { SRDMonsterSuggestionModal } from "src/utils/suggester"; -import type { SRDMonster } from "@types"; + import type { SRDMonster } from "@types"; const dispatch = createEventDispatcher(); @@ -36,7 +36,9 @@ import type { SRDMonster } from "@types"; dispatch("save", { name, hp, - initiative: initiative - modifier, + initiative: + (initiative ?? Math.floor(Math.random() * 19 + 1)) - + modifier, ac, modifier }); @@ -71,7 +73,9 @@ import type { SRDMonster } from "@types"; ac = `${modal.creature.ac}`; modifier = 0; if ((modal.creature).stats) { - const dex = ((modal.creature)?.stats ?? [0, 10])[1]; + const dex = ((modal.creature)?.stats ?? [ + 0, 10 + ])[1]; modifier = Math.floor((dex - 10) / 2); } initiative = Math.floor(Math.random() * 19 + 1) + modifier; diff --git a/versions.json b/versions.json index 8e3ce1eb..d7f74246 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "0.0.3": "0.12.4" + "0.0.4": "0.12.4" }