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 594fd32915e62be610fe6dfe5baa2071641096fb
parent 0a16b0dc83f4e702b213f300846c2ceeb88055df
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Fri, 21 Jun 2024 21:33:16 +0200

Ajout feed

On sait maintenant quelle carte tue un monstre (si c'est une carte)

Diffstat:
Abdd/cards/feed | 3+++
Mutils | 22+++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/bdd/cards/feed b/bdd/cards/feed @@ -0,0 +1,3 @@ +_cost 1 +_attack 10 1 +_exhaust diff --git a/utils b/utils @@ -129,9 +129,14 @@ _wingold() { } _killennemie() { + local target + target="$1";card="${2:-something else}" + echo "killed ennemie $target with card $card" echo rm -rf "$(readlink -e $target)" + echo "$card" | grep -q "/feed-" && _changestat player maxhealth +3; rm -rf "$(readlink -e $target)" if [ $(find fight/ennemies -type f | wc -l) = '0' ];then + echo "end of combat" _hasrelic burning-blood && _heal +6 _wingold _choosecard @@ -143,24 +148,23 @@ _killennemie() { # modifie d'une valeur relative # value doit avoir l'opérateur (+3, -3, *3) _changestat() { - target="$1" - stat="$2" - value="$3" + local target + target="$1";stat="$2";value="$3";card="$4" curvalue=$(_getstat "$target" "$stat") - _setstat "$target" "$stat" $(( $curvalue $value )) + _setstat "$target" "$stat" $(( $curvalue $value )) "$card" } # set la valeur absolue _setstat() { - target="$1" - stat="$2" - value="$3" + local target + target="$1";stat="$2";value="$3";card="$4" if [ "$stat" = "health" -a "$value" -le '0' ];then case "$target" in ("*player*") _gameover;; - (*) _killennemie "$target";; + (*) _killennemie "$target" "$card";; esac fi + echo sed -i --follow-symlinks -E "/^$stat / s/ .*/ $value/" "$target" sed -i --follow-symlinks -E "/^$stat / s/ .*/ $value/" "$target" } @@ -198,7 +202,7 @@ _dodamage() { # 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' ] && { echo _changestat "$target" health $newblock;_changestat "$target" health $newblock;newblock=0 ; } + [ "$newblock" -lt '0' ] && { echo _changestat "$target" health $newblock;_changestat "$target" health "$newblock" "$card";newblock=0 ; } echo _setstat "$target" block "$newblock" _setstat "$target" block "$newblock" }