Added #showenemies

This commit is contained in:
raeleus 2024-10-06 21:24:45 -07:00
parent eccef5f6b8
commit 51895a0d91
2 changed files with 21 additions and 2 deletions

View file

@ -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) {

View file

@ -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