Une version rudimentaire de Slay The Spire dans le terminal - retour accueil
git clone git://bebou.netlib.re/sts-term
Log | Files | Refs | README |
makegame (1285B)
1 #! /bin/sh 2 3 export tmpdir=$(mktemp -d) 4 . ./utils 5 6 pickrandom() { 7 local location 8 location="$1" 9 find bdd/"${location:?give location}" -type f | 10 shuf | 11 head -n1 12 } 13 14 addrelic() { 15 cp bdd/relics/$1 relic/$1 16 } 17 18 addennemie() { 19 local ennemie floor nben 20 ennemie="$1";floor="$2" 21 nben=$(find map/$floor/ -name "$(basename $ennemie)-*" | wc -l) 22 < "$ennemie" sed -E 's/(attack|defend)/_\1/g' > "map/$floor/$(basename $ennemie)-$(( $nben + 1))" 23 } 24 25 makemap() { 26 for floor in $(seq 1 10);do 27 nben=$(seq 2 | shuf | head -n1) 28 echo mkdir -p map/$floor 29 mkdir -p map/$floor 30 for i in $(seq $nben);do 31 pickrandom ennemies | 32 while read en;do 33 echo addennemie "$en" "$floor" 34 addennemie "$en" "$floor" 35 done 36 done 37 done 38 } 39 40 mkdir -p deck relics 41 42 c=$(pickrandom characters) 43 < $c grep -Ev "(deck|relic)" > player 44 if [ "$1" = "test" ];then 45 find bdd/cards -type f | 46 while read card;do 47 _addcard 1 "$(basename $card)" 48 done 49 else 50 < $c grep deck | 51 cut -f2- | 52 tr ' ' '\n' | 53 uniq -c | 54 while read line;do 55 nb=$(echo "$line" | cut -d ' ' -f1) 56 cardtype=$(echo "$line" | cut -d ' ' -f2) 57 _addcard "$nb" "$cardtype" 58 done 59 fi 60 < $c grep relic | 61 cut -f2- | 62 xargs -I{} cp bdd/relics/{} relics 63 64 makemap 65 _makefight map/1 66 [ "$1" = "test" ] && 67 mv fight/stack/* fight/hand 68 _refreshUI 69