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 3194fcbdd150a757148ddcc3ce02e3f45c6f0d66
parent f588463c9a5f009af277e34f45a0bd7ec0281b1d
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Fri, 21 Jun 2024 22:48:53 +0200

Ajout juggernaut

Ajout de local un peu partout, je pense que ça règle des problèmes
(#duper)
feel-no-pain + juggernaut go brrrrrrrr
(en vrai pas un si bon combo que ça)

Diffstat:
Abdd/cards/juggernaut | 2++
Mutils | 51+++++++++++++++++++++++++++++----------------------
2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/bdd/cards/juggernaut b/bdd/cards/juggernaut @@ -0,0 +1,2 @@ +_cost 2 +_status juggernaut 5 player diff --git a/utils b/utils @@ -5,8 +5,8 @@ norm="\x1b[0m" alias ethereal=":" _getstat() { - target="$1" - stat="$2" + local target stat + target="$1";stat="$2" grep -wF "$2" "$target" | cut -f2 } @@ -86,12 +86,13 @@ _makefight() { } _exhaust() { - echo "$1" | grep -q 'sentinel' && + local card + card="$1" + echo "$card" | grep -q 'sentinel' && _changestat player energy +2 _hasstatus player dark-embrace && _draw 1 - _hasstatus player feel-no-pain && { _defend $(_getremainingstatusturns player feel-no-pain) player; } - target="$1" - mv "$target" fight/exhaust + _hasstatus player feel-no-pain && { echo "gaining block from feel no pain"; _defend $(_getremainingstatusturns player feel-no-pain) player; } + mv "$card" fight/exhaust } _addcard() { @@ -129,7 +130,7 @@ _wingold() { } _killennemie() { - local target + local target card target="$1";card="${2:-something else}" echo "killed ennemie $target with card $card" echo rm -rf "$(readlink -e $target)" @@ -148,7 +149,7 @@ _killennemie() { # modifie d'une valeur relative # value doit avoir l'opérateur (+3, -3, *3) _changestat() { - local target + local target stat value card target="$1";stat="$2";value="$3";card="$4" curvalue=$(_getstat "$target" "$stat") _setstat "$target" "$stat" $(( $curvalue $value )) "$card" @@ -156,7 +157,7 @@ _changestat() { # set la valeur absolue _setstat() { - local target + local target stat value card target="$1";stat="$2";value="$3";card="$4" if [ "$stat" = "health" -a "$value" -le '0' ];then case "$target" in @@ -164,6 +165,8 @@ _setstat() { (*) _killennemie "$target" "$card";; esac fi + [ "$stat" = "block" ] && [ "$value" -gt "0" ] && _hasstatus player juggernaut && + _dodamage $(_getremainingstatusturns player juggernaut) fight/ennemies/* player echo sed -i --follow-symlinks -E "/^$stat / s/ .*/ $value/" "$target" sed -i --follow-symlinks -E "/^$stat / s/ .*/ $value/" "$target" } @@ -178,7 +181,7 @@ _decrbfbcost() { find fight -name '*blood-for-blood*' | while read card;do curcost=$(grep cost "$card" | cut -d' ' -f2) - sed -i -E "/_cost/ s/[0-9]/$(( curcost - 1 ))/" "$card" + sed -i -E "/_cost/ s/[0-9]/$(( $curcost - 1 ))/" "$card" done } @@ -218,9 +221,9 @@ _attack() { } _defend() { - #ffplay -nodisp -autoexit -loglevel panic -i sounds/block.ogg - block="$1" - target="$2" + local block target + block="$1";target="$2" + echo _changestat "$target" block "+$block" _changestat "$target" block "+$block" } @@ -241,6 +244,7 @@ _updatecardexecutability() { } _cost() { + local cost cost="$1" currentenergy=$(_getstat player energy) newenergy=$(( $currentenergy - $cost )) @@ -268,6 +272,7 @@ _nodraw () { } _heal() { + local amount src amount="$1";src="$2" maxhealth=$(_getstat player maxhealth) [ "$amount" -lt "0" ] \ @@ -350,9 +355,8 @@ _refreshUI() { ##### _status() { - stat="$1" - nbturns="$2" - target="$3" + local stat nbturns target + stat="$1";nbturns="$2";target="$3" case "$stat" in (vulnerable|weak|strength-down) type="debufs";; (*) type="bufs";; @@ -373,11 +377,12 @@ _status() { } _getstatuses() { + local target target="$1" grep -E '^(de)?bufs ' "$target" | cut -f2- | tr ' ' '\n' | - grep -Ev '(strength|dark-embrace|feel-no-pain|metallicize|rupture|barricade|berserk|brutality|demon-form)' | + grep -Ev '(strength|dark-embrace|feel-no-pain|metallicize|rupture|barricade|berserk|brutality|demon-form|juggernaut)' | cut -d',' -f1 } @@ -401,17 +406,19 @@ _decreasestatuses() { } _hasstatus() { - local target="${1:?need target}" - stat="$2" + local target stat + target="${1:?need target}";stat="$2" grep -Eq "^(de)?bufs.*$stat,-?[0-9]+" "$target" } _getremainingstatusturns() { - local target="$1";stat="$2" + local target stat + target="$1";stat="$2" grep -Eo " $stat,-?[0-9]+" "$target" | cut -d',' -f2 } _removestatus() { + local target stat target="$1" stat="$2" sed -i -E --follow-symlinks "/^(de)?bufs/ s/ $stat,[0-9]+//" "$target" @@ -445,8 +452,8 @@ _execnextmove() { # Les fonctions appelées pas les cartes _strength() { - value="$1" - target="$2" + local value target + value="$1";target="$2" _status strength "$value" "$target" }