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 |

commit d8e96b5280cda7c036122a8caef81d9e64dfab64
parent 2626b7d17e66477cea6b4eaa4235c843abbeb776
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Wed, 19 Jun 2024 13:55:04 +0200

makemap et makeplayer dans le même fichier

qui s'appelle makegame

Diffstat:
Amakegame | 48++++++++++++++++++++++++++++++++++++++++++++++++
Dmakemap | 9---------
Dmakeplayer | 30------------------------------
3 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/makegame b/makegame @@ -0,0 +1,48 @@ +#! /bin/sh + +addcard() { + nbcard=$(find deck -name "$2-*" | wc -l) + [ "$nbcard" = '0' ] && count=1 || count=$nbcard + for i in $(seq $count $(( $count + $1 - 1)));do + <<-. cat > A + . ./utils + $(cat bdd/cards/$2 | sed -E '/(cost|defend)/ s/$/ player/;/attack/ s/$/ "$1"/') + discard "\$0" + refreshUI + . + chmod +x A + mv A deck/$2-$i + cp deck/$2-$i stack + done +} + +addrelic() { + cp bdd/relics/$1 relic/$1 +} + +makemap() { +for floor in $(seq 1 10);do + mkdir -p map/$floor + find bdd/ennemies -type f | + shuf | head -n1 | + xargs -I{} cp {} map/$floor +done +} + +mkdir -p deck relics discard stack hand + +c=$(./pickrandom characters) +< $c grep -Ev "(deck|relic)" > player +< $c grep deck | + cut -f2- | + tr ' ' '\n' | + uniq -c | + while read line;do + addcard $line + done +< $c grep relic | + cut -f2- | + xargs -I{} cp bdd/relics/{} relics + +makemap + diff --git a/makemap b/makemap @@ -1,9 +0,0 @@ -#! /bin/sh - -for floor in $(seq 1 10);do - mkdir -p map/$floor - find bdd/ennemies -type f | - shuf | head -n1 | - xargs -I{} cp {} map/$floor -done - diff --git a/makeplayer b/makeplayer @@ -1,30 +0,0 @@ -#! /bin/sh - -addcard() { - nbcard=$(find deck -name "$2-*" | wc -l) - [ "$nbcard" = '0' ] && count=1 || count=$nbcard - for i in $(seq $count $(( $count + $1 - 1)));do - cp bdd/cards/$2 deck/$2-$i - cp bdd/cards/$2 stack/$2-$i - done -} - -addrelic() { - cp bdd/relics/$1 relic/$1 -} - -mkdir -p deck relics discard stack hand - -c=$(./pickrandom characters) -< $c grep -Ev "(deck|relic)" > player -< $c grep deck | - cut -f2- | - tr ' ' '\n' | - uniq -c | - while read line;do - addcard $line - done -< $c grep relic | - cut -f2- | - xargs -I{} cp bdd/relics/{} relics -