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 c6af4e56794a64ad0eb46ea7e0bded30eb93d5a0
parent f28263ad95d13f876af9484abce73a28d68bf196
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Sat, 22 Jun 2024 18:11:04 +0200

Gestion de plusieurs move de monstre

Plutôt réussi pour le coup

Diffstat:
Mutils | 35+++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/utils b/utils @@ -35,6 +35,10 @@ _createdisplaycard(){ sed -E 's/ / : /') $(_dispbufsanddebufs $card) + + Next move : + + $(cat $tmpdir/nextmove-$name | tr -d '_') . } @@ -100,10 +104,6 @@ _makeui() { $(_dispbufsanddebufs player) $(paste $tmpdir/disp-* | column -ts' ') - - Next move - - $(cat $tmpdir/nextmove | tr -d '_') $(paste $tmpdir/stack $tmpdir/discard $tmpdir/exhaust | column -ts' ') . @@ -138,7 +138,7 @@ _makefight() { _setstat fight/player block 0 _newhand _setstat fight/player energy 3 - _nextmove + _createnextmoves _refreshUI } @@ -388,7 +388,7 @@ endturn() { _decreasestatuses _removestatus player flame-barrier _removestatus player rage - _nextmove + _createnextmoves _newhand _hasstatus player brutality && { _heal -3 fight/hand; @@ -510,22 +510,29 @@ _removestatus() { # Ennemies ##### -_nextmove() { - cat fight/ennemies/* | - grep moves | +_createnextmoves() { + + find fight/ennemies/ -type l | + while read en;do + id=$(basename $en) + grep moves "$en" | cut -f2- | tr ' ' '\n' | shuf | head -n1 | - tr ',' ' ' | tr ';' '\n' > $tmpdir/nextmove - <<-. cat > $tmpdir/executablenextmove + tr ',' ' ' | tr ';' '\n' > $tmpdir/nextmove-$id + <<-. cat > $tmpdir/executablenextmove-$id . ./utils - $(< $tmpdir/nextmove sed -E "/attack/ s,$, fight/player fight/ennemies/*,;/defend/ s,$, fight/ennemies/*,") + $(< $tmpdir/nextmove-$id sed -E "/attack/ s,$, fight/player $en,;/defend/ s,$, $en,") . - chmod +x $tmpdir/executablenextmove + done + + chmod +x $tmpdir/executablenextmove-* } _execnextmove() { - $tmpdir/executablenextmove + echo $tmpdir/executablenextmove-* | + tr ' ' ';' | + sh } ####