Une version rudimentaire de Slay The Spire dans le terminal - retour accueil
git clone git://bebou.netlib.re/sts-term
Log | Files | Refs |
commit 424c6c5e8446580f4b709f8a45a06501cc505a10 Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Tue, 18 Jun 2024 23:33:33 +0200 Premier commit * Des cartes, un personnage, des ennemies et une relique dans bdd * makeplayer qui lance une partie en peuplant le deck, le fichier personnage, la carte * pickrandom choisit un élément de la bdd au hasard * playround début du jeu d'un round * reset supprime l'état du jeu en cours * makemap peuple la carte Diffstat:
A | bdd/cards/bash | | | 5 | +++++ |
A | bdd/cards/defend | | | 4 | ++++ |
A | bdd/cards/shrug-it-off | | | 4 | ++++ |
A | bdd/cards/strike | | | 4 | ++++ |
A | bdd/characters/ironclad | | | 4 | ++++ |
A | bdd/ennemies/jaw-worm | | | 3 | +++ |
A | bdd/ennemies/slime | | | 2 | ++ |
A | bdd/relics/burning-blood | | | 1 | + |
A | displayround | | | 15 | +++++++++++++++ |
A | makemap | | | 9 | +++++++++ |
A | makeplayer | | | 26 | ++++++++++++++++++++++++++ |
A | pickrandom | | | 5 | +++++ |
A | playround | | | 8 | ++++++++ |
A | reset | | | 3 | +++ |
14 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/bdd/cards/bash b/bdd/cards/bash @@ -0,0 +1,5 @@ +cost 2 +attack 8 +defend 0 +draw 0 +vulnerable 2 diff --git a/bdd/cards/defend b/bdd/cards/defend @@ -0,0 +1,4 @@ +cost 1 +attack 0 +defend 6 +draw 0 diff --git a/bdd/cards/shrug-it-off b/bdd/cards/shrug-it-off @@ -0,0 +1,4 @@ +cost 1 +attack 0 +defend 8 +draw 1 diff --git a/bdd/cards/strike b/bdd/cards/strike @@ -0,0 +1,4 @@ +cost 1 +attack 6 +defend 0 +draw 0 diff --git a/bdd/characters/ironclad b/bdd/characters/ironclad @@ -0,0 +1,4 @@ +health 80 +deck strike strike strike strike strike defend defend defend defend bash +relic burning-blood +gold 99 diff --git a/bdd/ennemies/jaw-worm b/bdd/ennemies/jaw-worm @@ -0,0 +1,3 @@ +health 40 +moves attack,9 defend,8 attack,7,defend,5 + diff --git a/bdd/ennemies/slime b/bdd/ennemies/slime @@ -0,0 +1,2 @@ +health 25 +moves attack,6 defend,6 attack,5,defend,4 diff --git a/bdd/relics/burning-blood b/bdd/relics/burning-blood @@ -0,0 +1 @@ +heal 6 diff --git a/displayround b/displayround @@ -0,0 +1,15 @@ +#! /bin/sh + +showstat() { + [ "$2" = "name" ] && { basename $1; return; } + grep "$2" "$1" | sed 's/\t/ : /' +} +echo "Player\n" +showstat player gold +showstat player health +echo +echo "Ennemies\n" +showstat map/1/* name +showstat map/1/* health +echo + diff --git a/makemap b/makemap @@ -0,0 +1,9 @@ +#! /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 @@ -0,0 +1,26 @@ +#! /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 +} +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 + diff --git a/pickrandom b/pickrandom @@ -0,0 +1,5 @@ +#! /bin/sh + +find bdd/"${1:?give location}" -type f | + shuf | + head -n1 diff --git a/playround b/playround @@ -0,0 +1,8 @@ +#! /bin/sh + +find stack -type f | + xargs -n1 basename | + shuf | + head -n5 | + fzy + diff --git a/reset b/reset @@ -0,0 +1,3 @@ +#! /bin/sh + +rm -rf player relics/* deck/* discard/* stack/* map/*