mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 21:20:27 -04:00
Added name generation.
This commit is contained in:
parent
efb48e57c7
commit
9763373d33
3 changed files with 117 additions and 1 deletions
15
Input.js
15
Input.js
|
@ -48,6 +48,7 @@ const setAutoXpSynonyms = ["setautoxp", "autoxp"]
|
|||
const showAutoXpSynonyms = ["showautoxp"]
|
||||
const setDefaultDifficultySynonyms = ["setdefaultdifficulty", "defaultdifficulty", "setdefaultdc", "defaultdc", "setdefaultac", "defaultac"]
|
||||
const showDefaultDifficultySynonyms = ["showdefaultdifficulty", "showdefaultdc", "showdefaultac"]
|
||||
const generateNameSynonyms = ["generatename", "name", "randomname", "makename", "createname"]
|
||||
const helpSynonyms = ["help"]
|
||||
|
||||
const modifier = (text) => {
|
||||
|
@ -80,7 +81,7 @@ const modifier = (text) => {
|
|||
return { text }
|
||||
}
|
||||
|
||||
if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, resetSynonyms), function () {return true})
|
||||
if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, generateNameSynonyms, resetSynonyms), function () {return true})
|
||||
|
||||
if (found == null) {
|
||||
if (state.characterName == null) {
|
||||
|
@ -144,6 +145,7 @@ const modifier = (text) => {
|
|||
if (text == null) text = processCommandSynonyms(command, commandName, showAutoXpSynonyms, doShowAutoXp)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, setDefaultDifficultySynonyms, doSetDefaultDifficulty)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, showDefaultDifficultySynonyms, doShowDefaultDifficulty)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, generateNameSynonyms, doGenerateName)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, helpSynonyms, doHelp)
|
||||
if (text == null) {
|
||||
var character = getCharacter()
|
||||
|
@ -1654,6 +1656,17 @@ function doRemoveCharacter(command) {
|
|||
return `[Character ${arg0} was not found.]`
|
||||
}
|
||||
|
||||
function doGenerateName(command) {
|
||||
var gender = searchArgument(command, /^(male)|(female)$/gi)
|
||||
if (gender == null) gender = "male"
|
||||
|
||||
var genre = searchArgument(command, /^(fantasy)|(modern)|(scifi)|(nordic)$/gi)
|
||||
if (genre == null) genre = "fantasy"
|
||||
|
||||
state.show = "none"
|
||||
return `[The character's name is ${generateName(genre, gender.toLowerCase() == "male")}]`
|
||||
}
|
||||
|
||||
function doClearSpells(command) {
|
||||
var character = getCharacter()
|
||||
character.spells = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue