diff --git a/Input.js b/Input.js index 965148c..0d1bcc7 100644 --- a/Input.js +++ b/Input.js @@ -117,7 +117,7 @@ const modifier = (text) => { return { text } } - if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, generateNameSynonyms, setDefaultDifficultySynonyms, showDefaultDifficultySynonyms, renameCharacterSynonyms, cloneCharacterSynonyms, createLocationSynonyms, showLocationsSynonyms, goToLocationSynonyms, removeLocationSynonyms, getLocationSynonyms, clearLocationsSynonyms, goNorthSynonyms, goSouthSynonyms, goEastSynonyms, goWestSynonyms, encounterSynonyms, showEnemiesSynonyms, addEnemySynonyms, removeEnemySynonyms, initiativeSynonyms, turnSynonyms, fleeSynonyms, versionSynonyms, resetSynonyms), function () {return true}) + if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, generateNameSynonyms, setDefaultDifficultySynonyms, showDefaultDifficultySynonyms, renameCharacterSynonyms, cloneCharacterSynonyms, createLocationSynonyms, showLocationsSynonyms, goToLocationSynonyms, removeLocationSynonyms, getLocationSynonyms, clearLocationsSynonyms, goNorthSynonyms, goSouthSynonyms, goEastSynonyms, goWestSynonyms, encounterSynonyms, showEnemiesSynonyms, addEnemySynonyms, removeEnemySynonyms, clearEnemiesSynonyms, initiativeSynonyms, turnSynonyms, fleeSynonyms, versionSynonyms, resetSynonyms), function () {return true}) if (found == null) { if (state.characterName == null) { @@ -201,6 +201,7 @@ const modifier = (text) => { if (text == null) text = processCommandSynonyms(command, commandName, versionSynonyms, doVersion) if (text == null) text = processCommandSynonyms(command, commandName, setAcSynonyms, doSetAc) if (text == null) text = processCommandSynonyms(command, commandName, encounterSynonyms, doEncounter) + if (text == null) text = processCommandSynonyms(command, commandName, showEnemiesSynonyms, doShowEnemies) if (text == null) text = processCommandSynonyms(command, commandName, helpSynonyms, doHelp) if (text == null) { var character = getCharacter() @@ -1558,7 +1559,7 @@ function doEncounter(command) { if (encounter.enemies.length > 0) { state.prefix += "You encounter the following enemies:\n" for (var enemy of encounter.enemies) { - state.prefix += `${enemy.name} (Health: ${enemy.health} AC: ${enemy.ac})\n` + state.prefix += `${enemy.name} (Health: ${enemy.health} AC: ${enemy.ac} Initiative: ${enemy.initiative})\n` } } @@ -1568,6 +1569,11 @@ function doEncounter(command) { return text } +function doShowEnemies(command) { + state.show = "showEnemies" + return " " +} + function doTake(command) { var arg0 = getArgument(command, 0) if (arg0 == null) { diff --git a/Output.js b/Output.js index ca0860c..3c2df13 100644 --- a/Output.js +++ b/Output.js @@ -217,6 +217,19 @@ const modifier = (text) => { case "clearInventory": text += `[${possessiveName} inventory has been emptied]\n` break + case "showEnemies": + text += "*** ENEMIES ***\n" + + if (state.enemies.length == 0) { + text += "There are no enemies present here. Call #encounter to generate a scripted set or #addenemy to add your own\n" + } else { + for (var enemy of state.enemies) { + text += `${enemy.name} (Health: ${enemy.health} AC: ${enemy.ac} Initiative: ${enemy.initiative})\n` + } + } + + text += "******************\n\n" + break case "reset": text += "[All settings have been reset]\n" break