From 52b91a1aca6640b1797a63afc8a9e9a778b0964a Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 25 Dec 2021 16:52:34 -0500 Subject: Added capability to cause two npcs to attack each other --- files/dmtool.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'files/dmtool.bash') diff --git a/files/dmtool.bash b/files/dmtool.bash index 8bbd673..43aba72 100644 --- a/files/dmtool.bash +++ b/files/dmtool.bash @@ -81,7 +81,7 @@ _dmtool() { COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" - local commands="ls cp mkdir mv rm attacks roll damage heal reset set edit add del spellcasting help git" + local commands="ls cp mkdir mv rm attacks roll attack damage heal reset set edit add del spellcasting help git" if [[ $COMP_CWORD -gt 1 ]]; then local lastarg="${COMP_WORDS[$COMP_CWORD-1]}" case "${COMP_WORDS[1]}" in @@ -93,7 +93,7 @@ _dmtool() _dmtool_complete_entries fi ;; - attacks|roll|damage|heal|set|edit|del|spellcasting) + attacks|roll|attack|damage|heal|set|edit|del|spellcasting) if [[ $COMP_CWORD -le 2 ]]; then _dmtool_complete_entries else @@ -105,6 +105,16 @@ _dmtool() opts="$(${COMP_WORDS[0]} attacks ${COMP_WORDS[2]})" COMPREPLY+=($(compgen -W "$opts" -- ${cur})) ;; + attack) + COMPREPLY+=($(compgen -W "-1 -2" -- ${cur})) + if [[ $COMP_CWORD -eq 3 ]]; then + local IFS=$'\n' + opts="$(${COMP_WORDS[0]} attacks ${COMP_WORDS[2]})" + COMPREPLY+=($(compgen -W "$opts" -- ${cur})) + elif [[ $COMP_CWORD -eq 4 ]]; then + _dmtool_complete_entries + fi + ;; damage) COMPREPLY+=($(compgen -W "--magical -m --silvered -s --adamantine -a" -- ${cur})) if [[ $COMP_CWORD -eq 4 ]]; then -- cgit v1.2.3