Une version rudimentaire de Slay The Spire dans le terminal - retour accueil
git clone git://bebou.netlib.re/sts-term
Log | Files | Refs |
commit eee23e72a9b627ade2d14b374c5afd4a4562b9ff parent 2023e99ba161c5d5f8f905066d153a92f7b9425a Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Wed, 19 Jun 2024 16:22:16 +0200 gestion du block Les dégâts d'attaque vont d'abord dans le block Diffstat:
M | utils | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/utils b/utils @@ -13,9 +13,10 @@ norm="\x1b[0m" makeui() { [ ! -e "player" ] && { printf "player doesn't exist\n"; exit 1; } + currentenergy=$(grep energy player | cut -f2) grep cost hand/* | awk "\$2>$currentenergy{print}" | - cut -d':' -f1 | xargs -n1 basename > $tmpdir/nonexeccards + cut -d':' -f1 | xargs -r -n1 basename > $tmpdir/nonexeccards tree --noreport stack > $tmpdir/stack tree --noreport hand > $tmpdir/hand tree --noreport discard > $tmpdir/discard @@ -68,8 +69,12 @@ attack() { damage="$1" target="$2" targethealth=$(grep health "$target" | cut -f2) - newhealth=$(( $targethealth - $damage )) + targetblock=$(grep block "$target" | cut -f2) + newblock=$(( $targetblock - $damage )) + newhealth=$(( $targethealth + $newblock )) + [ "$newblock" -lt '0' ] && newblock=0 setstat "$target" health "$newhealth" + setstat "$target" block "$newblock" } defend() {