sts-term

Une version rudimentaire de Slay The Spire dans le terminal - retour accueil

git clone git://bebou.netlib.re/sts-term
Log | Files | Refs | README |

commit ed2270a2484112c4d9455820a75e53ad3c57ad7d
parent 8cc69cb8304dbd9618648ac931481e1d69473d4d
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 20 Jun 2024 15:28:56 +0200

On ajoute une carte à la fin du combat

On corrige aussi l'ajout d'une carte (addcard) et on le transfère dans
utils

Diffstat:
Mutils | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/utils b/utils @@ -73,6 +73,22 @@ _makefight() { _refreshUI } +_addcard() { + nbcard=$(find deck -name "$2-*" | wc -l) + for i in $(seq $(( $nbcard + 1 )) $(( $nbcard + $1 )));do + <<-. cat > A + . ./utils + $(cat bdd/cards/$2 | + sed -E '/(cost|defend)/ s/$/ player/; + /^attack/ s/$/ "${1:?need a target}"/; + /^(attack|defend|cost|status|draw)/ s/^/_/' | sort) + _discard "\$0" + _refreshUI + . + mv A deck/$2-$i + done +} + _hasrelic() { name="$1" return $([ -e "relics/$1" ]) @@ -82,6 +98,7 @@ _killennemie() { rm -rf "$(readlink -e $target)" if [ $(find fight/ennemies -type f | wc -l) = '0' ];then _hasrelic burning-blood && _heal 6 + _choosecard _makefight map/$(( $(cat fight/floor) + 1 )) exit 0 fi @@ -165,6 +182,17 @@ _shufflediscard() { mv fight/discard/* fight/stack } +_choosecard() { + find bdd/cards -type f | + grep -Ev '(strike|defend)$' | + head -n3 | + xargs -n1 basename | + fzy | + while read card;do + _addcard 1 "$card" + done +} + _heal() { _setstat fight/player health $(( $(grep health player | cut -f2) + $1 )) }