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 550fccb1dbb57f7739a7d4ea0ec98ec28833de6a
parent bfe59bae2513b213206a47dc5a40570f99e27a0e
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 20 Jun 2024 19:12:44 +0200

Implémentation de la vulnérabilité

Diffstat:
Mutils | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/utils b/utils @@ -158,14 +158,22 @@ _gameover() { ./reset } +_hasstatus() { + target="${1:?need target}" + status="$2" + grep -Eq "^(de)?bufs.*$status,[0-9]+" "$target" +} + _dodamage() { ffplay -nodisp -autoexit -loglevel panic -i sounds/hit.ogg - damage="$1" - target="$2" - targethealth=$(_getstat "$target" health) - targetblock=$(_getstat "$target" block) - newblock=$(( $targetblock - $damage )) - [ "$newblock" -lt '0' ] && { _setstat "$target" health $(( $targethealth + $newblock ));newblock=0 ; } + damage="$1";target="$2" + targethealth=$(_getstat "$target" health);targetblock=$(_getstat "$target" block) + _hasstatus "$target" vulnerable && multiplier=1.5 || multiplier=1 + newblock=$(echo "($targetblock - $damage*$multiplier)/1" | bc) + # Si la quantité de block qui reste est négative c'est qu'on prend cette + # quantité de dégât + # On remet le block à 0 + [ "$newblock" -lt '0' ] && { _changestat "$target" health $newblock;newblock=0 ; } _setstat "$target" block "$newblock" } @@ -198,10 +206,6 @@ _defend() { _setstat "$target" block "$newblock" } -_hasstatus() { - echo -} - _updatecardexecutability() { currentenergy=$(_getstat "$target" energy) grep -H cost fight/hand/* |