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 5758c973e3c5054b19bb852ddbceee1544e3c809 parent 6ac3399ce211d2411a1aecd1dc0bb0577c8c7cbf Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Thu, 20 Jun 2024 17:07:53 +0200 Implémentation exhaust et impervious pour test Faut vraiment que je regarde pour faire des tests automatisés Diffstat:
A | bdd/cards/impervious | | | 3 | +++ |
M | bdd/characters/ironclad | | | 2 | +- |
M | utils | | | 14 | +++++++++++--- |
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/bdd/cards/impervious b/bdd/cards/impervious @@ -0,0 +1,3 @@ +_cost 2 +_defend 30 +_exhaust diff --git a/bdd/characters/ironclad b/bdd/characters/ironclad @@ -2,6 +2,6 @@ maxhealth 80 health 80 block 0 energy 3 -deck strike defend bash bloodletting shrug-it-off entrench iron-wave pommel-strike battle-trance +deck strike defend bash bloodletting shrug-it-off entrench iron-wave pommel-strike battle-trance impervious relic burning-blood gold 99 diff --git a/utils b/utils @@ -20,6 +20,7 @@ _makeui() { tree --noreport fight/stack > $tmpdir/stack tree --noreport fight/hand > $tmpdir/hand tree --noreport fight/discard > $tmpdir/discard + tree --noreport fight/exhaust > $tmpdir/exhaust cat $tmpdir/nonexeccards | xargs -r -n1 basename | @@ -50,7 +51,7 @@ _makeui() { paste $tmpdir/player $tmpdir/en | column -ts ' ' -o ' ' printf '\n\n' - paste $tmpdir/stack $tmpdir/hand $tmpdir/discard | + paste $tmpdir/stack $tmpdir/hand $tmpdir/discard $tmpdir/exhaust | column -ts ' ' -o ' ' | sed -E 's/-[0-9]/ /g;s,fight/([^ ]*),\1 ,g' } @@ -62,6 +63,7 @@ _makefight() { mkdir -p fight/stack mkdir -p fight/hand mkdir -p fight/discard + mkdir -p fight/exhaust echo "1" > fight/turn basename "$1" > fight/floor @@ -79,14 +81,20 @@ _makefight() { _refreshUI } +_exhaust() { + target="$1" + mv "$target" fight/exhaust +} + _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}"/' | + sed -E '/^_(cost|defend) / s/$/ player/; + /^_attack / s/$/ "${1:?need a target}"/; + /^_exhaust$/ s/$/ "$0"/' | sort) _discard "\$0" _refreshUI