Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct Guerreiro{
- int ataque;
- int defesa;
- int pontos_vida;
- int id_jogador;
- }Guerreiro;
- int rolaDados(){
- int i;
- int r = 0;
- for(i = 0; i <3, i++){
- r = r + (1 + rand()%6);
- }
- return rand;
- }
- void criaGuerreiro (Guerreiro *warrior){
- (*warrior).ataque = rolaDados();
- (*warrior).defesa = rolaDados();
- (*warrior).pontos_vida = rolaDados();
- (*warrior).id_jogador = rolaDados();
- }
- void ataca(Guerreiro *g1, Guerreiro *g2){
- g1->ataque += rolaDados();
- g2->defesa += rolaDados();
- int golpe = g1->ataque;
- int escudo = g2->defesa;
- int dano = golpe - escudo;
- if(dano > 0){
- g2->pontos_vida -= dano;
- }0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement