mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 13:10:28 -04:00
Added a day counter.
This commit is contained in:
parent
a3d5f9fd6e
commit
c00399ebb7
3 changed files with 34 additions and 4 deletions
29
Input.js
29
Input.js
|
@ -63,6 +63,8 @@ const goNorthSynonyms = ["gonorth", "north", "goup", "up", "n"]
|
|||
const goSouthSynonyms = ["gosouth", "south", "godown", "down", "s"]
|
||||
const goEastSynonyms = ["goeast", "east", "goright", "right", "e"]
|
||||
const goWestSynonyms = ["gowest", "west", "goleft", "left", "w"]
|
||||
const showDaySynonyms = ["showday", "showdate", "day", "date"]
|
||||
const setDaySynonyms = ["setday", "setdate"]
|
||||
const helpSynonyms = ["help"]
|
||||
|
||||
const modifier = (text) => {
|
||||
|
@ -174,6 +176,8 @@ const modifier = (text) => {
|
|||
if (text == null) text = processCommandSynonyms(command, commandName, goWestSynonyms, doGoWest)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, renameCharacterSynonyms, doRenameCharacter)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, cloneCharacterSynonyms, doCloneCharacter)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, showDaySynonyms, doShowDay)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, setDaySynonyms, doSetDay)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, helpSynonyms, doHelp)
|
||||
if (text == null) {
|
||||
var character = getCharacter()
|
||||
|
@ -545,6 +549,7 @@ function init() {
|
|||
if (state.y == null) state.y = 0
|
||||
if (state.autoXp == null) state.autoXp = 0
|
||||
if (state.defaultDifficulty == null) state.defaultDifficulty = 10
|
||||
if (state.day == null) state.day = 0
|
||||
state.show = null
|
||||
state.prefix = null
|
||||
state.critical = null
|
||||
|
@ -938,6 +943,7 @@ function doDamage(command) {
|
|||
|
||||
function doRest(command) {
|
||||
var commandName = getCommandName(command)
|
||||
state.day++
|
||||
state.characters.forEach(function(character) {
|
||||
if (commandName.toLowerCase() == "shortrest") {
|
||||
var max = getHealthMax(character)
|
||||
|
@ -949,7 +955,7 @@ function doRest(command) {
|
|||
|
||||
state.show = "none"
|
||||
})
|
||||
return `\n[All characters have rested and feel rejuvinated]\n`
|
||||
return `\n[All characters have rested and feel rejuvinated. It's now day ${state.day}]\n`
|
||||
}
|
||||
|
||||
function doFlipCommandAbility(command) {
|
||||
|
@ -1183,10 +1189,28 @@ function doNote(command) {
|
|||
} else {
|
||||
state.notes.push(history[history.length - 1].text)
|
||||
state.show = "none"
|
||||
return "\n[The last action was successfully added to the notes]"
|
||||
return "\n[The last action was successfully added to the notes]\n"
|
||||
}
|
||||
}
|
||||
|
||||
function doShowDay(command) {
|
||||
state.show = "none"
|
||||
return `\n[It is day ${state.day}]\n`
|
||||
}
|
||||
|
||||
function doSetDay(command) {
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null || isNaN(arg0)) {
|
||||
state.show = "none"
|
||||
return "\n[Error: Not enough parameters. See #help]\n"
|
||||
}
|
||||
|
||||
state.day = parseInt(arg0)
|
||||
|
||||
state.show = "none"
|
||||
return `\n[The day has been set to day ${state.day}]\n`
|
||||
}
|
||||
|
||||
function doShowNotes(command) {
|
||||
state.show = "showNotes"
|
||||
return " "
|
||||
|
@ -2087,6 +2111,7 @@ function doReset(command) {
|
|||
state.y = null
|
||||
state.defaultDifficulty = null
|
||||
state.autoXp = null
|
||||
state.day = null
|
||||
|
||||
state.show = "reset"
|
||||
return " "
|
||||
|
|
|
@ -244,7 +244,11 @@ const modifier = (text) => {
|
|||
text += "\n#damage value"
|
||||
text += "\n Decreases the character's health by the specified value. Reaching 0 causes the character to become \"unconcious\"."
|
||||
text += "\n#rest"
|
||||
text += "\n Sets all of the characters' health to their maximums. Use #shortrest to only restore half health."
|
||||
text += "\n Sets all of the characters' health to their maximums. Use #shortrest to only restore half health. This command increases the day counter and displays the number of days since your adventure began."
|
||||
text += "\n#showday"
|
||||
text += "\n Shows the number of days since your adventure began."
|
||||
text += "\n#setday"
|
||||
text += "\n Sets the number of days since your adventure began."
|
||||
text += "\n#setxp value"
|
||||
text += "\n Sets the character's experience to the specified value."
|
||||
text += "\n#addxp value"
|
||||
|
|
|
@ -18,8 +18,9 @@ Watch the [tutorial video](https://youtu.be/E5TYU7rDaBQ).
|
|||
|
||||
v. 0.1.1
|
||||
* #note without parameters will store the last action text into the notes
|
||||
* #goto specified with a distance and location name will take you partially toward the target.
|
||||
* #goto specified with a distance and location name will take you partially toward the target
|
||||
* You may use commas in coordinates now
|
||||
* The scenario keeps track of how many days have passed since the adventure has started. See #rest, #showday, #setday.
|
||||
* Minor bug fixes and improvements
|
||||
|
||||
v. 0.1.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue