-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tomagotchi.c
209 lines (164 loc) · 3.59 KB
/
Tomagotchi.c
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//Programa que simula o Tomagotchi
#include <stdlib.h>
#include <stdio.h>
void mostratoma();
void brincar();
void menu();
void rip();
typedef struct toma {
char nome[15];
int saude;
int fome;
int felicidade;
int xp;
}to;
int main ()
{
to toma;
int op;
toma.saude = 100;
toma.fome = 10;
toma.felicidade = 50;
toma.xp = 0;
printf("Bem vindo ao seu Tamagotchi versao 2.0");
printf("\n\n");
printf("\nInforme o nome do seu Tamagotchi\n");
fgets(toma.nome,50,stdin);
system("cls");
printf("seu tamagotchi esta vivo =D\n");
while (op!=6){
mostratoma();
printf("\n1 - Mostar status\n");
printf("2 - Dar comida\n");
printf("3 - Brincar\n");
printf("4 - Dar remedio\n");
printf("5 - Evoluir\n");
printf("6 - Sair\n");
scanf("%d",&op);
fflush(stdin);
if(toma.saude==0){
rip();
}
switch (op){
case 1 : {
system("cls");
printf("Status\n Nome : %s\n Saude : %d\n Fome : %d\n Felicidade : %d\n",toma.nome,toma.saude,toma.fome,toma.felicidade);
break;
}
case 2 :{
system("cls");
printf("voce alimentou seu tamagotchi");
toma.fome+=10;
if(toma.fome==50){
system("cls");
printf("CUIDADO, Seu tamagotchi esta cheio!!!\n");
printf("Ele podera ficar doente...");
}
if(toma.fome==100){
printf("seu tamagotchi esta Doente!!!\n");
printf("RAPIDO de o remedio ao seu tamagotchi...");
toma.saude-=50;
}
if(toma.fome==110){
toma.saude-=50;
}
break;
}
case 3:{
brincar();
toma.felicidade+=10;
break;
}
case 4:{
system("cls");
printf("Voce deu remedio ao seu tamagotchi, ele nao esta mais doente");
toma.saude+=50;
toma.fome=0;
break;
}
case 5:{
system("cls");
if(toma.xp <50){
printf("Seu tamagotchi ainda nao esta pronto para evoluir :(\n");
}
break;
}
default:{return 0;
break;
}
}
}
return 0;
}
void mostratoma(){
printf("\n\n");
printf(" | |\n");
printf("( -.- )\n");
printf("o__(')(')\n");
printf("\n\n");
}
void brincar(){
to toma;
int num,i;
system("cls");
printf("\nPedra Papel ou Tesoura\n");
printf("1-Pedra\n2-Papel\n3-Tesoura\n4-Sair\n");
scanf("%d",&num);
switch (num){
case 1:{
system("cls");
i=1+(rand() %2);
printf("Voce jogou Pedra\n");
if (i==1){
printf("O tamagotchi jogou Pedra\nEMPATE!!!");
}
if (i==2){
printf("O tamagotchi jogou Papel\nVoce Perdeu!!!");
}
if(i==3){
printf("O tamagotchi jogou Tesoura\nVoce Venceu!!!");
}
break;
}
case 2:{
system("cls");
i=1+(rand() %2);
printf("Voce jogou Papel\n");
if (i==1){
printf("O tamagotchi jogou Pedra\nVoce Venceu!!!");
}
if (i==2){
printf("O tamagotchi jogou Papel\nEmpate");
}
if(i==3){
printf("O tamagotchi jogou Tesoura\nVoce Perdeu!!!");
}
break;
}
case 3:{
system("cls");
i=1+(rand() %2);
printf("Voce jogou Tesoura\n");
if (i==1){
printf("O tamagotchi jogou Pedra\nVoce Perdeu!!!");
}
if (i==2){
printf("O tamagotchi jogou Papel\nVoce Venceu!!!");
}
if(i==3){
printf("O tamagotchi jogou Tesoura\nEMPATE!!!");
}
break;
}
case 4:{
break;
}
}
}
void rip (){
system("cls");
printf("Seu tamagotchi MORREU!!!\n");
printf("RIP\n");
printf("GAME OVER");
exit(0);
}