modif fichier start et riddle

This commit is contained in:
Kali 2024-02-05 06:05:25 -05:00
parent f2eaa4ac65
commit 021d282c89
5 changed files with 124 additions and 18 deletions

23
adventure/adventuremulti.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Chemin vers le répertoire des jeux
games_dir="./games"
# Afficher les jeux disponibles
echo "Jeux disponibles :"
games=$(ls "$games_dir")
# Afficher les jeux dans un menu numéroté
select game in $games; do
if [ ! -z "$game" ]; then
echo "Vous avez choisi $game."
cd "$games_dir" || exit 1
# Assurez-vous que start.sh est exécutable
chmod +x "$game/start.sh"
# Exécuter start.sh du jeu sélectionné
./$game/rooms/start.sh
break
else
echo "Choix invalide. Veuillez choisir un numéro de jeu valide."
fi
done

View File

@ -0,0 +1,74 @@
#!/bin/bash
# Function to handle enigma scenes
function enigma_scene {
local question="$1"
local options=("${@:2}")
local correct_answer="$2"
echo "$question"
for (( i=0; i<${#options[@]}; i++ )); do
echo "$((i+1)). ${options[i]}"
done
read -p "Votre réponse : " user_choice
if ! [[ "$user_choice" =~ ^[1-9][0-9]*$ ]]; then
echo "Choix invalide. Veuillez entrer un nombre valide."
return 1
elif [ "$user_choice" -le 0 ] || [ "$user_choice" -gt "${#options[@]}" ]; then
echo "Choix invalide. Veuillez entrer un nombre entre 1 et ${#options[@]}."
return 1
elif [ "${options[$((user_choice-1))]}" == "$correct_answer" ]; then
echo "Bonne réponse !"
return 0 # Succès
else
echo "Mauvaise réponse. La réponse correcte était : $correct_answer"
return 1 # Échec
fi
}
# Main game loop
score=0
for _ in {1..3}; do
echo "Bienvenue dans le monde des énigmes."
if enigma_scene "Énigme 1: Quel est le capitale de la France ?" "Paris" "Berlin" "Londres" "Madrid" "Paris"; then
echo "Appuyez sur Entrée pour continuer..."
((score++))
else
echo "Vous reposez l'écran portatif interactif."
read -p "Appuyez sur Entrée pour quitter..."
exit
fi
if enigma_scene "Énigme 2: Quelle est la couleur du ciel par temps clair ?" "Bleu" "Rouge" "Vert" "Jaune" "Bleu"; then
echo "Appuyez sur Entrée pour continuer..."
((score++))
else
echo "Vous reposez l'écran portatif interactif."
read -p "Appuyez sur Entrée pour quitter..."
exit
fi
if enigma_scene "Énigme 3: Combien de planètes dans notre système solaire?" "7" "8" "9" "10" "8"; then
break
else
echo "Vous reposez l'écran portatif interactif."
read -p "Appuyez sur Entrée pour quitter..."
exit
fi
done
# Vérifier le score avant de donner la possibilité de revenir dans mainroom.sh
if [ "$score" -ge 2 ]; then
echo "Félicitations, voici un indice dans ta quête vers l'astroport : indice 1"
read -p "Appuyez sur Entrée pour revenir à la pièce principale..."
else
echo "Vous reposez l'écran portatif interactif."
read -p "Appuyez sur Entrée pour quitter..."
fi
# Lancer mainroom.sh
./mainroom.sh

View File

@ -8,7 +8,7 @@ clear
sed -i='' 's/on/off/' ../logic/leverlogic.ben
# Who doen't love ASCII text, right?
# Who doesn't love ASCII text, right?
# Next up, let's initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
@ -26,7 +26,7 @@ do
done <"$file2"
read -p "Pressez sur [ENTER] pour démarrer..."
#Okay, now that the introduction is out of the way, we can start the first room!
# Okay, now that the introduction is out of the way, we can start the first room!
clear
file1="../art/titleart.ben"
while IFS= read -r line
@ -48,25 +48,29 @@ echo
echo "Vous pouvez vous diriger selon les points cardinaux."
echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, des traces d'animaux"
echo
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u, d et h."
# Now we wait for their response - and send them somewhere accordingly.
while true; do
read -p "> " nsewuh
case $nsewuh in
d ) echo "Vous récupérez un écran portatif interactif par terre."
echo "Appuyez sur Entrée pour continuer..."
read -r
# Exécutez riddle.sh après avoir ramassé l'écran
./edouard.abgrall@ynov.com/rooms/riddle.sh
;;
n ) ./white.sh
exit ;; # These lines will take the player to a new room - a new script file.
exit ;;
s ) ./brown.sh
exit ;; # Be sure to include 'exit' otherwise the game won't quit properly!
exit ;;
e ) ./red.sh
exit ;;
w ) ./green.sh
exit ;;
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un thermos, une scie pliante et un couteau" ;; # Something to say? You can also just echo.
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://ipfs.copylaradio.com/ipfs/QmWyCFvvvrE1xWudCnc14oDvaztLaRZ4guvQFVkkDLwa23#JOUR%201.%20PLANETE%201." ;;
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un thermos, une scie pliante et un couteau" ;;
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://web.archive.org/web/20211129105224/https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

View File

@ -0,0 +1 @@
off

View File

@ -8,7 +8,7 @@ clear
sed -i='' 's/on/off/' ../logic/leverlogic.ben
# Who doen't love ASCII text, right?
# Who doesn't love ASCII text, right?
# Next up, let's initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
@ -26,7 +26,7 @@ do
done <"$file2"
read -p "Pressez sur [ENTER] pour démarrer..."
#Okay, now that the introduction is out of the way, we can start the first room!
# Okay, now that the introduction is out of the way, we can start the first room!
clear
file1="../art/titleart.ben"
while IFS= read -r line
@ -48,25 +48,29 @@ echo
echo "Vous pouvez vous diriger selon les points cardinaux."
echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, des traces d'animaux"
echo
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u, d et h."
# Now we wait for their response - and send them somewhere accordingly.
while true; do
read -p "> " nsewuh
case $nsewuh in
d ) echo "Vous récupérez un écran portatif interactif par terre."
echo "Appuyez sur Entrée pour continuer..."
read -r
# Exécutez riddle.sh après avoir ramassé l'écran
./riddle.sh
;;
n ) ./white.sh
exit ;; # These lines will take the player to a new room - a new script file.
exit ;;
s ) ./brown.sh
exit ;; # Be sure to include 'exit' otherwise the game won't quit properly!
exit ;;
e ) ./red.sh
exit ;;
w ) ./green.sh
exit ;;
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un thermos, une scie pliante et un couteau" ;; # Something to say? You can also just echo.
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://ipfs.copylaradio.com/ipfs/QmWyCFvvvrE1xWudCnc14oDvaztLaRZ4guvQFVkkDLwa23#JOUR%201.%20PLANETE%201." ;;
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un thermos, une scie pliante et un couteau" ;;
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://web.archive.org/web/20211129105224/https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit