diff --git a/Input.js b/Input.js index 23b94b8..6fc4b57 100644 --- a/Input.js +++ b/Input.js @@ -633,10 +633,13 @@ function handleSetupEnemyStep(text) { } return text case 100: - if (!isNaN(text)) { + if (/^\d+(\s.*)?$/gi.test(text)) { state.setupEnemyStep = 500 - switch (parseInt(text)) { + var value = text.match(/^\d+/gi)[0] + var nameMatches = text.match(/(?<=\s).*/gi) + + switch (parseInt(value)) { case 1: state.tempEnemy = createEnemy("Animated Armor", calculateRoll("6d8+6"), 18, 6, "1d6+2", "d20") break @@ -713,6 +716,8 @@ function handleSetupEnemyStep(text) { state.tempEnemy = createEnemy("Zombie", calculateRoll("3d8+9"), 8, 4, "1d6+1", "d20-2") break } + + if (nameMatches != null) state.tempEnemy.name = nameMatches[0] } return text case 500: diff --git a/Output.js b/Output.js index 5654fe0..595c4f1 100644 --- a/Output.js +++ b/Output.js @@ -66,7 +66,7 @@ const modifier = (text) => { text += "Enter the name of another spell that the enemy knows. If it can target this spell at a player character, add a dice roll for the damage calculation after it (ie. Ray of Frost3d6+2). Type s to stop entering spells or type q to quit.\n" break case 100: - text += `What enemy preset will you choose?\nLevel 1 or lesser\n1. Animated Armor\n2. Awakened Shrub\n3. Brigand\n4. Black Bear\n5. Boar\n6. Cockatrice\n7. Constrictor Snake\n8. Dire Wolf\n9. Ghoul\n10. Giant Centipede\n11. Giant Rat\n12. Giant Wolf Spider\n13. Gnoll\n14. Goblin\n15. Harpy\n16. Hobgoblin\n17. Kobold\n18. Orc\n19. Satyr\n20. Skeleton\n21. Strige\n22. Warhorse\n23. Wolf\n24. Worg\n25. Zombie\n\nEnter the number or q to quit.\n` + text += `What enemy preset will you choose?\nLevel 1 or lesser\n1. Animated Armor\n2. Awakened Shrub\n3. Brigand\n4. Black Bear\n5. Boar\n6. Cockatrice\n7. Constrictor Snake\n8. Dire Wolf\n9. Ghoul\n10. Giant Centipede\n11. Giant Rat\n12. Giant Wolf Spider\n13. Gnoll\n14. Goblin\n15. Harpy\n16. Hobgoblin\n17. Kobold\n18. Orc\n19. Satyr\n20. Skeleton\n21. Strige\n22. Warhorse\n23. Wolf\n24. Worg\n25. Zombie\n\nEnter the number or q to quit. If you want to specify a name, add a space and type the name\n(ie. 25 Thuggish Zombie B)\n` break case 500: var hashtag = `#addenemy "${state.tempEnemy.name}" ${state.tempEnemy.health} ${state.tempEnemy.ac} ${state.tempEnemy.hitModifier} ${state.tempEnemy.damage} ${state.tempEnemy.initiative}`