-
Notifications
You must be signed in to change notification settings - Fork 0
/
Batalla.sh
executable file
·156 lines (155 loc) · 4.52 KB
/
Batalla.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
source functions.sh
echo -e " \e[1;31m╔══════════════════════════════════════════╗`tput sgr0`
\e[1;31m║ \e[2;34m PokeGear`tput sgr0` \e[1;31m║`tput sgr0`
\e[1;31m ║╔════════════════════════════════════════╗║`tput sgr0`
\e[1;31m║║ ║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100mBatalla`tput sgr0` \e[1;31m║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100mSe recomienda bajar el zoom`tput sgr0` \e[1;31m ║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100mQue quieres hacer`tput sgr0` \e[1;31m║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100m1-Buscar Partida`tput sgr0` \e[1;31m║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100m2-Crear Partida`tput sgr0` \e[1;31m║║`tput sgr0`
\e[1;31m║║`tput sgr0`\e[100mB-Salir`tput sgr0` \e[1;31m║║`tput sgr0`
\e[1;31m║║ ║║
║║ ║║
║║ ║║
║╚════════════════════════════════════════╝║
║ • ║
║ • • ║
║ • ║
╚══════════════════════════════════════════╝`tput sgr0` "
read conec
case $conec in
1)
Buscador $1
;;
2)
Creador $1
;;
b|B)
./PokeGear.sh $1
;;
*)
./Batalla.sh $1
;;
esac
sleep 1
Intro
echo "Elige tu pokémon"
num=`ls ../../Usuarios/$1 | wc -l`
for p in `seq $num`
do
poke=`ls ../../Usuarios/$1 | head -n$p | tail -1`
cara=`echo "$poke" | wc -c`
let cara=$cara-5
echo -n "$p "
echo "$poke" | cut -c -$cara
done
read -p "Introduce su numero:" poke
elegit=`ls ../../Usuarios/$1 | head -n$poke | tail -1`
cat ../../Usuarios/$1/$elegit >> CB.txt
lineas=0
echo "Esperando a que el otro elija su pokémon......."
while [ $lineas -eq 0 ]
do
prep=`cat CB.txt | wc -l`
if [ $prep -eq 2 ]
then
lineas=1
fi
done
admin=`echo "$partida" | cut -c 10-`
usu=`cat Nom2.txt`
hptotad=`cat CB.txt | grep $admin$ | cut -d " " -f 3`
hptotus=`cat CB.txt | grep $usu$ | cut -d " " -f 3`
velad=`cat CB.txt | grep $admin$ | cut -d " " -f 5`
velus=`cat CB.txt | grep $usu$ | cut -d " " -f 5`
echo "QUE EMPIEZE EL COMBATE!"
muerte=0
while [ $muerte = 0 ]
do
Visual $1
Moviments $1
echo "Espera a que tu contrincante elija movimiento..."
Espera $1
case $conec in
1)
usu=$1
#vida0=`cat CB.txt | grep $admin$ | cut -d " " -f 3 `
#vida1=`cat CB.txt | grep $usu$ | cut -d " " -f 3 `
sleep 1
Visual $1
sleep 1.5
Muerte $1
sleep 1
clear
Visual $1
sleep 1.5
Muerte $1
#vida0d=`cat CB.txt | grep $admin$ | cut -d " " -f 3`
#vida1d=`cat CB.txt | grep $usu$ | cut -d " " -f 3`
#let danyor0=$vida0-$vida0d
#let danyor1=$vida1-$vida1d
#echo "`cat CB.txt | grep $admin$ | cut -d " " -f 1` ha perdido $danyor0 de vida"
#echo "`cat CB.txt | grep $usu$ | cut -d " " -f 1` ha perdido $danyor1 de vida"
clear
;;
2)
usu=`cat Nom2.txt`
admin=$1
Movimientos0=("`cat ataques.txt | grep -w $admin$ | cut -d " " -f 1`")
Movimientos1=("`cat ataques.txt | grep -w $usu$ | cut -d " " -f 1`")
Tipos1=("`cat CB.txt | grep -w $usu$ | cut -d " " -f 6`" "`cat CB.txt | grep -w $usu$ | cut -d " " -f 11`")
Tipos0=("`cat CB.txt | grep -w $admin$ | cut -d " " -f 6`" "`cat CB.txt | grep -w $admin$ | cut -d " " -f 11`")
Calculo $1
if [ $velad -gt $velus ]
then
Daño0 $1
else
Daño1 $1
fi
Visual $1
sleep 1.5
Muerte $1
if [ $velus -lt $velad ]
then
Daño1 $1
else
Daño0 $1
fi
clear
Visual $1
sleep 1.5
Muerte $1
rm ataques.txt
clear
;;
esac
done
clear
vidaPoke1=`cat CB.txt | grep $admin$ | cut -d " " -f 3 `
vidaPoke2=`cat CB.txt | grep $usu$ | cut -d " " -f 3 `
if [ $vidaPoke1 -eq 0 ]
then
echo "$usu ha ganado"
punts=`cat ../../Puntos/$usu.txt`
let punts=$punts+100
echo "$punts" > ../../Puntos/$usu.txt
else
echo "$admin ha ganado"
punts=`cat ../../Puntos/$admin.txt`
let punts=$punts+50
echo "$punts" > ../../Puntos/$admin.txt
fi
echo "Saliendo..."
sleep 2s
case $conec in
1) cd ../..
./PokeGear.sh $1
;;
2) cd ..
rm -r PartidaDe$1
cd ..
./PokeGear.sh $1
;;
esac