Ejemplo n.º 1
0
void enemyObjChk(Enemy * enemy[20], int eneNum, int yChange, int xChange, Player * chris)
{
    //declare variable
    char newLoc;

    //target location
    newLoc = mvinch(enemy[eneNum]->yPos+yChange, enemy[eneNum]->xPos+xChange);

    //kill event
    if(enemy[eneNum]->health<1 && enemy[eneNum]->type!='.')
    {
        moveText();
        mvprintw(56, 10, "You killed a %s!", getWord(enemy[eneNum]->type));
        enemy[eneNum]->type = '.';
    }

    //case 1: clear: move there
    if(newLoc == '.')
    {
        mvaddch(enemy[eneNum]->yPos, enemy[eneNum]->xPos, '.');
        mvaddch(enemy[eneNum]->yPos + yChange, enemy[eneNum]->xPos +xChange, enemy[eneNum]->type);
        enemy[eneNum]->xPos += xChange;
        enemy[eneNum]->yPos += yChange;
    }

    //case 2: hero: attack
    else if(newLoc == '@')
    {
        combat(enemy[eneNum]->yPos, enemy[eneNum]->xPos, chris, enemy);
    }
    //otherwise creature will not be able to move
}//end of enemyObjChk
Ejemplo n.º 2
0
/**
 * @brief Permet de vérifier si la pièce peut bouger, et se déplace si oui
 * @param[in] colonnneO la colonne d'origine de la pièce
 * @param[in] ligneO la ligne d'origine de la pièce
 * @param[in] colonne la colonne où la pièce doit se déplacer
 * @param[in] ligne la ligne où la pièce doit se déplacer
 * @param[in] camp le camp de la pièce
 * @return un booléen pour savoir si le mouvement est possible
 * et si la pièce a été déplacée
 * @see bool Stratego::deplacementPossible(char colonneO, int ligneO,
 *							char colonne, int ligne) const
 */
bool Stratego::mouvement(char colonneO, int ligneO, char colonne, int ligne, int camp) {
	char piece = getPiece(colonneO, ligneO);

	if (!estPieceDe(piece, camp) || !estDansTerrain(colonne, ligne))
		return (false);

	if (piece == BOMBE || piece == DRAPEAU || piece == BOMBE+MINUS || piece == DRAPEAU+MINUS)
		return (false);

	if (!deplacementPossible(colonneO, ligneO, colonne, ligne))
		return (false);

	char pieceDest = getPiece(colonne, ligne);
	if (pieceDest != VIDE) {
		if(!campsOpposes(piece, pieceDest))
			return (false);
		else {
			combat(colonneO, ligneO, colonne, ligne);
			return (true);
		}
	}
	else { // Case destination vide
		put(colonne, ligne, piece);
		put(colonneO, ligneO, VIDE);
	}
	return (true);
}
Ejemplo n.º 3
0
void farm(DATA *player, int p_atk, int p_def, DATA *monster) {
	int m_atk, m_def;
	srand(time(NULL));
	m_atk = rand() % 5;
	m_def = rand() % 5;
	combat(player, p_atk, p_def, monster, m_atk, m_def);
}
Ejemplo n.º 4
0
Archivo: combat.c Proyecto: J4g0n/SDA
int bataille(monstre mobs, hero oreh) {
	int r;
	while ((mobs->HP>0)&&(oreh->HP>0)) {
		r=combat(mobs,oreh);
	}
	return r;
}
Ejemplo n.º 5
0
void Room::doAction()
{
	if(room[playerLoc.X][playerLoc.Y].isDoor())
	{
		destRoomDoor = room[playerLoc.X][playerLoc.Y].getDestRoomDoor();
		needsChange = true;
	}
	else if(room[playerLoc.X][playerLoc.Y].isBoss())
	{
		cout << "You chose to fight the Boss!" << endl; 
		Sleep(2500);
		while(_kbhit()) _getch();
		Boss *Vicki;
		Vicki = new Boss;

		
		Warrior *player;
		player = new Warrior;
		bool playerIsAlive = true;
		bool playersTurn = true;
		bool enemyIsAlive = true;
		combat(player, Vicki, playerIsAlive, playersTurn, enemyIsAlive);
		if(playerIsAlive == true)
		{
			cout<<"WHAT??? YOU WON?!?!?!";
		}
		else
		{
			cout<<"Yo dead.";
		}
		system("pause");
		exit(0);

	}
}
Ejemplo n.º 6
0
bool Room::tryMove(int dx, int dy)
{
	if( playerLoc.X + dx >= 0 && playerLoc.X + dx < roomWidth
		&& !room[playerLoc.X + dx][playerLoc.Y + dy].getSolid())
	{
		playerLoc.X += dx;
	}
	if(playerLoc.Y + dy >= 0 && playerLoc.Y + dy < roomHeight
		&& !room[playerLoc.X + dx][playerLoc.Y + dy].getSolid())
	{
		playerLoc.Y += dy;
	}
	else
	{
		return false;
	}

	if(room[playerLoc.X][playerLoc.Y].getEncounterChance() > rand()%100)
	{

		cout << "You have encountered a monster!" << endl; 
		Sleep(2500);
		Warrior *player, *enemy;
		enemy = new Warrior;
		player = new Warrior;
		bool playerIsAlive = true;
		bool playersTurn = true;
		bool enemyIsAlive = true;
		combat(player, enemy, playerIsAlive, playersTurn, enemyIsAlive);
		//combat(Warrior *player, Wizard *enemy, bool &playerIsAlive, bool &playersTurn, bool &enemyIsAlive)
	}

	return true;
}
Ejemplo n.º 7
0
//Fonction qui fait le combat entre 2 pokemons, renvoie si le joueur à gagner (1) ou non (0)
int combat (Pokemon pok1, Pokemon pok2, int diff)
{
  Attaque attselect;
  Attaque attAI;
  int dommage;
  //Affiche les deux pokemons selon l'affichage qui leur correspond (1 pour le joueur, 0 l'adversaire)
  get_Pokemon(0, pok2);
  get_Pokemon(1, pok1);
  //Demande au joueur de choisir une attaque
  attselect = choix_attaque(pok1);
  //Netoie l'écran
  nettoie();
  //Calcule et inflige les dommages au pokemon adverse
  dommage = hit(attselect, pok1, pok2);
  pok2.HP = pok2.HP - dommage;
  //Si le pokemon adverse est en vie, sinon nettoie l'écran et fini le combat
  if (en_vie(pok2))
    {
      //Choisi une attaque selon l'AI et inflige les dommages
      if (diff == 1) attAI = att_AI_min(pok2, pok1);
      if (diff == 2) attAI = att_AI_rand(pok2);
      if (diff == 3) attAI = att_AI_max(pok2, pok1);
      dommage = hit(attAI, pok2, pok1);
      pok1.HP = pok1.HP - dommage;
      //Si le pokemon du joueur est en vie, on recommence toute la séquence, sinon on affiche le message de défaite
      if (en_vie(pok1)) return(combat(pok1, pok2, diff));
      nettoie();
      printf("Dommage ! Vous avez perdu le combat contre %s.\n\n", pok2.Nom);
      return(0);
    }
  nettoie();
  printf("Bravo ! Vous avez gagne le combat contre %s.\n\n", pok2.Nom);
  return(1);
}
Ejemplo n.º 8
0
int game(long emplacement)
{
	system("clear");
	
	printf("Vous entrez dans une nouvelle salle du donjon et...\n");
	
 	long int min = 1;
	long int max = 3;
	long int nbaleatoire = 1;
 	nbaleatoire = (rand() %(max - min +1))+ min;
// 	nbaleatoire = 2;
	switch (nbaleatoire)
	{
		case 1:
			printf("Vous tombez sur un piège !\n");
			piege(emplacement);
		break;
		case 2:
			printf("Vous rencontrez un monstre !\n");
			combat(emplacement);
		break;
		case 3:
			printf("Vous entrez dans une salle contenant un bassin de guerison !\n");
			guerison(emplacement);
		break;
// 		case4:
// 			enigme(emplacement);
// 		break;
		default:
			rien(emplacement);
		break;
	}

}
Ejemplo n.º 9
0
void Monde::deplacement(int decalageX, int decalageY)
{
     if(getPlayerMap()->getElements(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY)==' ')
        {
            getPlayerMap()->modifierElements(playerActuel->getPosX(),playerActuel->getPosY(),' ');
            attron(COLOR_PAIR(2)|A_INVIS);
            mvaddch(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY,playerActuel->getChar());
            attroff(COLOR_PAIR(2));
            attron(COLOR_PAIR(3));
            mvaddch(playerActuel->getPosX(),playerActuel->getPosY(),' ');
            playerActuel->setPosYX(playerActuel->getPosY()+decalageY,playerActuel->getPosX()+decalageX);
            attroff(COLOR_PAIR(3)|A_INVIS);

        }
        else if(getPlayerMap()->getElements(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY)=='A')
        {
            clear();
            printw("AFFICHE!");
            while(tolower(getch())!='e')
            {

            }
            clear();
            //getPlayerMap()->afficherMap();
            afficherMap2();
            attron(COLOR_PAIR(2));
            mvaddch(playerActuel->getPosX(),playerActuel->getPosY(),playerActuel->getChar());
            attroff(COLOR_PAIR(2));
        }
        else if(getPlayerMap()->getElements(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY)=='X')
        {
            clear();
            combat(new Monstre);
            clear();
            //getPlayerMap()->afficherMap();
            afficherMap2();
            attron(COLOR_PAIR(2));
            mvaddch(playerActuel->getPosX(),playerActuel->getPosY(),playerActuel->getChar());
            attroff(COLOR_PAIR(2));
        }
        else if(getPlayerMap()->getElements(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY)=='P')
        {
            attron(COLOR_PAIR(2));
            mvaddch(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY,playerActuel->getChar());
            attroff(COLOR_PAIR(2));
            attron(COLOR_PAIR(3));
            mvaddch(playerActuel->getPosX(),playerActuel->getPosY(),' ');
            playerActuel->setPosYX(playerActuel->getPosY()+decalageY,playerActuel->getPosX()+decalageX);
            attroff(COLOR_PAIR(3));
        }
        else if(getPlayerMap()->getElements(playerActuel->getPosX()+decalageX,playerActuel->getPosY()+decalageY)=='O')
        {

            playerActuel->setMapActuelle(m_monde[0][1]);
            insererPlayer(0,1,39,37);
            clear();
            afficherMap2();
        }
}
Ejemplo n.º 10
0
void MainMenu::run()
{
    cacheActivated = false;
    sf::RenderWindow& mWindow = Window::getWindow();
    this->loadTexturesAndSetSprites();

    while(mWindow.isOpen())
    {
        sf::Event event;
        while(mWindow.pollEvent(event))
        {
            if(event.type == event.Closed)
            {
                mWindow.close();
            }
        }
        switch(this->checkHitBoxs(sf::Mouse::getPosition(mWindow)))
        {
        case 0:
            cacheActivated = false;
            break;

        case 1:
            cacheActivated = true;
            cache.setPosition(450, 300);
            if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
                combat();
            break;

        case 2:
            cacheActivated = true;
            cache.setPosition(450, 375);
            //ajouter ici le lancement de la page des options
            break;

        case 3:
            cacheActivated = true;
            cache.setPosition(450, 450);
            if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
                mWindow.close();
            break;

        default:
            break;

        }

        mWindow.clear();
        mWindow.draw(SBackground);
        mWindow.draw(SPlayButton);
        mWindow.draw(SOptionsButton);
        mWindow.draw(SQuitButton);
        if(cacheActivated)
            mWindow.draw(cache);
        mWindow.display();

    }
}
Ejemplo n.º 11
0
	void location::combatcheck(player &mainchar)
	{
		if(bigmonB == true)
		{
			combat(bigmon);
			bigmonB = false;
		}
		else
		{
			int num;
			num = rand() % 100 + 1;
			
			if(num <= randmonchance)
			{
				combat(randmon);
			}
		}
	}
Ejemplo n.º 12
0
    void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const
    {
        std::unique_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat());
        combat->mTargetActorId = mTargetActorId;

        ESM::AiSequence::AiPackageContainer package;
        package.mType = ESM::AiSequence::Ai_Combat;
        package.mPackage = combat.release();
        sequence.mPackages.push_back(package);
    }
Ejemplo n.º 13
0
int combat (Pokemon x, Pokemon y, int i) //L'entier i va permettre de compter le nombre total d'actions réalisées.
//Si ce nombre est impair alors le vainqueur est le dresseur 1, sinon le dresseur 2 gagne cette manche.
{
  int val = 0; //val va etre la condition pour sortir de la boucle while.
  //L'utilisateur ne pourra pas sortir tant qu'il n'aura pas fait une action correcte
  printf("---------Pokemon de l'adversaire---------\n");
  get_pokemon (0, y);
  printf("\n---------Votre Pokemon---------\n");
  get_pokemon (1, x);

  while (val == 0)
    {
         printf("\n Dresseur %d, veuillez selectionner une attaque \n", (i % 2) + 1);
      int num_atq = getc(stdin);//getc va renvoyer le code ASCII du premier caractere de la chaine rentree par l'utilisateur.
      clear_buffer();//on nettoie le buffer au cas ou plus d'un caractere a ete utilise.
      switch (num_atq)//on filtre sur le code ASCII
        {
        case 49 ://Si l'utilisateur a tape 1 comme premier caractere
        {
          hit (x->attaques[0],x , y);
          val = 1;
        }
        break;
        case 50 : //Si l'utilisateur a tape 2 comme premier caractere
        {
          hit (x->attaques[1],x , y);
          val = 1;
        }
        break;
        case 51 : //Si l'utilisateur a tape 3 comme premier caractere
        {
          hit (x->attaques[2],x , y);
          val = 1;
        }
        break;
        case 52 : //Si l'utilisateur a tape 4 comme premier caractere
        {
          hit (x->attaques[3],x , y);
          val = 1;
        }
        break;
        default : //Si l'utilisateur a tape autre chose comme premier caractere
          printf ("Action incorrecte, l'attaque doit etre comprise entre 1 et 4.\n\n");
          break;
        }
    }

  if (y->hp <= 0)
    {
      return (i % 2);
    }
  i++;
  return (combat(y, x, i));
}
Ejemplo n.º 14
0
/*! \brief Check entites at location
 *
 * Check for any entities in the specified co-ordinates.
 * Runs combat routines if a character and an enemy meet,
 * and de-activate the enemy if it was defeated.
 *
 * \sa combat_check()
 * \param   ox x-coord to check
 * \param   oy y-coord to check
 * \param   who Id of entity doing the checking
 * \returns index of entity found+1 or 0 if none found
 */
int entityat(int ox, int oy, t_entity who)
{
    t_entity i;

    for (i = 0; i < MAX_ENT; i++)
    {
        if (g_ent[i].active && ox == g_ent[i].tilex && oy == g_ent[i].tiley)
        {
            if (who >= PSIZE)
            {
                if (g_ent[who].eid == ID_ENEMY && i < PSIZE)
                {
                    if (combat(0) == 1)
                    {
                        g_ent[who].active = 0;
                    }
                    return 0;
                }
                return i + 1;
            }
            else
            {
                if (g_ent[i].eid == ID_ENEMY)
                {
                    if (combat(0) == 1)
                    {
                        g_ent[i].active = 0;
                    }
                    return 0;
                }
                if (i >= PSIZE)
                {
                    return i + 1;
                }
            }
        }

    }
    return 0;
}
Ejemplo n.º 15
0
void Game::escape(Hero& newHero,Monster& newMonster)
{
	if(newHero.getStealth()>(5*newMonster.getLevel()))
	{
		cout<<"You have escaped from "<<newMonster.getName()<<" with your high stealth...";
		if(newHero.getStealth()>(10*newMonster.getLevel()))
			cout<<"\nIt was a piece of cake considering your stealth abilities...";
		return;
	}
	cout<<"Your insuffient training in such stealthy activities has let you down..\n The monster sees you and begins to attack...";
	_getch();
	combat(newHero,newMonster);
}
Ejemplo n.º 16
0
bool player::moveNextRoom()
{
    int choice;
    choice = currentRoom->chooseAdjacentRoom();     //Picks a random valid door

    if(choice == 1)
        setCurrentRoom(currentRoom->getNorth());
    if(choice == 2)
        setCurrentRoom(currentRoom->getEast());
    if(choice == 3)
        setCurrentRoom(currentRoom->getSouth());
    if(choice == 4)
        setCurrentRoom(currentRoom->getWest());

    return combat();        //combat() only returns false if player dies
}
Ejemplo n.º 17
0
Archivo: combat.c Proyecto: rj76/kq
/*! \brief Does current location call for combat?
 *
 * This function checks the zone at the specified co-ordinates
 * and calls combat based on the map and zone.
 *
 * PH: it seems that this is rarely used (?) - only called by
 * entityat().
 * WK: I have altered entityat() slightly to bypass this function.
 * This function is no longer used. I have not noticed any
 * negative side effects.
 *
 * \param   comx x-coord of player
 * \param   comy y-coord of player
 * \returns outcome of combat() or 0 if no combat
 *
 */
int combat_check (int comx, int comy)
{
   int zn;
   int i;

   zn = z_seg[comy * g_map.xsize + comx];

   /*  RB TODO: adding a break will make this a bit faster, plus
    *           calling combat with the FIRST zone, not the LAST
    *           one.
    * PH: done this 20020222
    */
   for (i = 0; i < NUM_BATTLES; i++) {
      /* if (battles[i].mapnum == g_map.map_no && battles[i].zonenum == zn) */
         return combat (i);
   }
   return 0;
}
Ejemplo n.º 18
0
/**
 * @brief Si une case sur le chemin de l'éclaireur est occupée, cette fonction
 * détremine si un combat est nécesssaire ou si le mouvement est impossible
 * param[in] colDep la colonne d'origine de la pièce éclaireur
 * param[in] ligDep la ligne d'origine de la pièce éclaireur
 * param[in] colDest la colonne où la pièce éclaireur doit se déplacer
 * param[in] ligDest la ligne où la pièce éclaireur doit se déplacer
 * @return false : mouvement impossible, true : combat effectué
 */
bool Stratego::mouvementEclaireur(char colDep, int ligDep, char colDest,
								int ligDest) {
	if (!estDansTerrain(colDest, ligDest))
		return (false);

	char pieceDep = getPiece(colDep, ligDep),
		pieceDest = getPiece(colDest, ligDest);

	if (pieceDest == VIDE) {
		put(colDest, ligDest, pieceDep);
		put(colDep, ligDep, VIDE);
		return (true);
	}
	if (!campsOpposes(pieceDep, pieceDest))
		return (false);
	else {
		combat(colDep, ligDep, colDest, ligDest);
		return (true);
	}
}
Ejemplo n.º 19
0
void combat_final_aux (Dresseur d1, Dresseur d2)
{
  FILE* logs = NULL;
  logs = fopen ("logs.txt","a+");
  int res;
  while ((d1->pokemons != NULL) || (d2->pokemons != NULL))
    {
      res = combat (d1->pokemons->starter, d2->pokemons->starter, 0);
      if (res == 0)
        {
          fprintf (logs, "%s vs %s || %s vs %s || Vainqueur : %s\n", d1->nom, d2->nom, d1->pokemons->starter->nom, d2->pokemons->starter->nom, d1->pokemons->starter->nom);
          if (d2->pokemons->suivant == NULL)
            {
                printf ("%s est K.O\n\n", d2->pokemons->starter->nom);
                printf ("%s remporte le duel!\n", d1->nom);
              fprintf(logs,"Fin du duel\nLe vainqueur est %s\n\n", d1->nom);
              fclose(logs);
              break;
            }
          printf ("%s est K.O\n\n", d2->pokemons->starter->nom);
          d2->pokemons = d2->pokemons->suivant;
        }
      else
        {
          fprintf (logs, "%s vs % || %s vs %s || Vainqueur : %s\n", d1->nom, d2->nom, d1->pokemons->starter->nom, d2->pokemons->starter->nom, d2->pokemons->starter->nom);
          if (d1->pokemons->suivant == NULL)
            {
              printf ("%s remporte le duel!\n", d2->nom);
              fprintf(logs,"Fin du duel\nLe vainqueur est %s\n\n", d2->nom);
              fclose(logs);
              break;
            }
          printf("%s est K.O\n\n",d1->pokemons->starter->nom);

          d1->pokemons = d1->pokemons->suivant;
        };
        clear_screen ();
    }

}
Ejemplo n.º 20
0
void warprocess(int id, unsigned char *buffer, llist *warlist, NODE* bst)
{
  llist *obj, *oobj;
  int code, action;
  NODE *p, *q;  
  int attktype, deftype;
  size_t size;

  unpack(buffer, "hhll", &code, &action, &attktype, &deftype);  
  obj = searchitembyid(warlist, id);
  if(obj)
    {
      obj->data->attktype = attktype;
      obj->data->deftype = deftype;
	  
      oobj = searchitembyid(warlist, obj->data->oid);
      obj->data->state++;
      if(obj->data->state == oobj->data->state) //Same round. Ready to fight then fight.
	{
	  p = searchNodeBySockfd(&bst, obj->data->id);
	  q = searchNodeBySockfd(&bst, oobj->data->id);	  
	  //Fight
	  combat(&obj->data->pdata, obj->data->attktype, obj->data->deftype, 
		 &oobj->data->pdata, oobj->data->attktype, oobj->data->deftype);
	  //one of two die
	  if(obj->data->pdata.hp < 0 || oobj->data->pdata.hp < 0)
	    {	    	      
	      if(obj->data->pdata.hp < 0) 
		{
		  p->data.lose++;
		  q->data.win++;

		  q->data.exp+= p->data.level*10;

		  size = pack(buffer, "hh", 4, -1);
		  sendall(p->sockfd, buffer, &size);

		  size = pack(buffer, "hhl", 4, 0,p->data.level*10);
		  sendall(q->sockfd, buffer, &size);
		}
	      else
		{
		  p->data.win++;
		  q->data.lose++;

		  p->data.exp += q->data.level*10;
		  size = pack(buffer, "hhl", 4, 0,q->data.level*10);
		  sendall(p->sockfd, buffer, &size);
		  size = pack(buffer, "hh", 4, -1);
		  sendall(q->sockfd, buffer, &size);
		}
	      updateDataBySockfd(&bst, p->sockfd);
	      updateDataBySockfd(&bst, q->sockfd);
	    }
	  else //Send result
	    {
	      size = pack(buffer, "hhllll", 4, 5, obj->data->pdata.hp, oobj->data->pdata.hp, 
			  oobj->data->attktype, oobj->data->deftype);
	      sendall(p->sockfd, buffer, &size);
	      size = pack(buffer, "hhllll", 4, 5, oobj->data->pdata.hp, obj->data->pdata.hp,
			  obj->data->attktype, obj->data->deftype);
	      sendall(q->sockfd, buffer, &size);
	    }
	}
    }
}
Ejemplo n.º 21
0
void Game_Manager::update(float timeElapsed)
{
    handle_input_events();
    m_view1.zoom(zoom);


    
    if (monster_time.getElapsedTime().asSeconds() >= 45)
    {
        monster_time.restart();
        int a = rand() % 5 + 1;
        for (int i = 0; i <= a; i++)
        {
            monster_max++;
            monster1.push_back(Monster{ m_app, &m_view1, i });
            monster_state.push_back(true);
        }
    }



    zoom_time = clock_zoom.getElapsedTime();
    if (zoom_time.asSeconds() >  0.05  && zoom_change != ZOOM_NO_CHANGE)
    {
        clock_zoom.restart();
        if (zoom_change == ZOOM_ADD && zoom_rate >= -30)
        {
            zoom = 0.90f;
            zoom_rate--;
        }
        if (zoom_change == ZOOM_LESS  && zoom_rate <= 50)
        {
            zoom = 1.1f;
            zoom_rate++;
        }
        zoom_change = ZOOM_NO_CHANGE;
    }
    else
    {
        zoom = 1;
    }


    if (citizen_number == 0 || oxygen_number == 0.0f)
    {
        fail = true;
        reset();
    }

    if (cinematic_on)
    {
        cinematic_update();
    }

    if (!pause)
    {
        m_view1.setCenter(static_cast<float>(m_x_offset), static_cast<float>(m_y_offset));
        m_app->setView(m_view1);

        //radiation haldling
        radio_bar.scale(1.0f, my_map[selected_tile.clicked_y][selected_tile.clicked_x].get_radiation(), true);
        //oxygen_handling
        if (oxygen_clock.getElapsedTime().asSeconds() > 0.5f)
        {
            oxygen_clock.restart();
            oxygen_number -= 0.0008;
        }
        oxygen_bar.scale(oxygen_number, 1.0f, false);

        buttons[0].update(selected_tile.clicked_x* tile_size, selected_tile.clicked_y * tile_size);
        if (buttons[0].is_activated())
        {
            buttons[0].desactivate();
            execute_action(ACT_DIGING);
        }

        buttons[1].update(selected_tile.goal_x* tile_size, selected_tile.goal_y * tile_size + buttons[1].get_h());

        if (buttons[1].is_activated())
        {
            buttons[1].desactivate();
            execute_action(ACT_MOVE);
        }

        buttons[2].update((selected_tile.clicked_x + 1)* tile_size - buttons[2].get_h(), selected_tile.clicked_y * tile_size + buttons[2].get_h());
        if (buttons[2].is_activated())
        {
            buttons[2].desactivate();
            execute_action(ACT_STOP);
        }

        buttons[3].update(selected_tile.clicked_x* tile_size, selected_tile.clicked_y * tile_size + buttons[3].get_h());
        if (buttons[3].is_activated())
        {
            buttons[3].desactivate();
                if (isOccupied(selected_tile.clicked_x ,selected_tile.clicked_y) )
              {
               if (my_map[selected_tile.clicked_y][selected_tile.clicked_x].get_resources_id() == 0)
             {
            metal_number += my_map[selected_tile.clicked_y][selected_tile.clicked_x].get_ressources();
            }
            if (my_map[selected_tile.clicked_y][selected_tile.clicked_x].get_resources_id() == 1)
            {
                food_number += my_map[selected_tile.clicked_y][selected_tile.clicked_x].get_ressources();
            }
            }
        }

        buttons[4].update(m_screen_x - buttons[4].get_w() - 30, m_screen_y / 2 + buttons[4].get_h());
        if (buttons[4].is_activated())
        {
            buttons[4].desactivate();
            if (isOccupied(selected_tile.clicked_x, selected_tile.clicked_y))
            {
                execute_action(ACT_BUILD_WORKBENCH);
            }
        }

        buttons[5].update(m_screen_x - buttons[5].get_w() - 30, (m_screen_y / 2) + (buttons[5].get_h() + 80));
        if (buttons[5].is_activated())
        {
            buttons[5].desactivate();
            execute_action(ACT_BUILD_GENERATOR);

        }

        buttons[6].update(m_screen_x - buttons[5].get_w() - 30, (m_screen_y / 2) + (buttons[6].get_h() + 80 * 2));
        if (buttons[6].is_activated())
        {
            buttons[6].desactivate();
            execute_action(ACT_BUILD_FARM);
        }

        buttons[7].update(m_screen_x - buttons[7].get_w() - 30, (m_screen_y / 2) + (buttons[7].get_h() + 80 * 3));
        if (buttons[7].is_activated())
        {
            buttons[7].desactivate();

            execute_action(ACT_BUILD_ARMORY);
        }

        buttons[8].update(m_screen_x - buttons[8].get_w() - 30, (m_screen_y / 2) + (buttons[8].get_h() + 80 * 4));
        if (buttons[8].is_activated())
        {
            buttons[8].desactivate();

            execute_action(ACT_BUILD_AERATION);
        }

        buttons[9].update(m_screen_x - buttons[9].get_w() - 30, (m_screen_y / 2) + (buttons[9].get_h() + 80 * 5));
        if (buttons[9].is_activated())
        {
            buttons[9].desactivate();

            execute_action(ACT_BUILD_BUNKER);
        }

        for (int i = 0; i < citizen_max; i++) {
            if (citizen_state[i])
            {
                character1[i].update(my_map, timeElapsed);

                //my_map[character1[i].getY][character1[i].getX].addCharacter(*character1[i]);

                if (!character1[i].alive())
                {
                    citizen_number--;
                    citizen_state[i] = false;
                }
            }
        }

        for (int i = 0; i < monster_max; i++) {
            if (monster_state[i])
            {
                monster1[i].newGoal(character1[1].getX(), character1[1].getY());
                monster1[i].update(my_map, timeElapsed);
                if (!monster1[i].alive())
                {
                    monster_state[i] = false;
                }
            }
        }

        for (size_t x = 0; x < 5; x++)
        {
            for (size_t y = 0; y < 10; y++)
            {
                my_map[x][y].update(timeElapsed);
            }
        }
        //if the mouse is over the right tile

        selected_tile.x = m_selection_vector.x / tile_size;
        selected_tile.y = m_selection_vector.y / tile_size;
        if (selected_tile.x < 0)
        {
            selected_tile.x = 0;
        }
        if (selected_tile.x > 4)
        {
            selected_tile.x = 4;
        }
        if (selected_tile.y < 0)
        {
            selected_tile.y = 0;
        }

        if (mouse_vec.x < m_screen_x - buttons[6].get_w() - 30)
        {
            if (clicked)
            {
                if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
                {
                    if (selected_tile.goal_x != selected_tile.x
                        || selected_tile.goal_y != selected_tile.y)
                    {
                        selected_tile.previous_clicked_x = selected_tile.clicked_x;
                        selected_tile.previous_clicked_y = selected_tile.clicked_y;

                        selected_tile.clicked_x = selected_tile.x;
                        selected_tile.clicked_y = selected_tile.y;
                    }


                }
                if (sf::Mouse::isButtonPressed(sf::Mouse::Right))
                {

                    if (selected_tile.x != selected_tile.clicked_x
                        || selected_tile.y != selected_tile.clicked_y)
                    {
                        selected_tile.goal_x = selected_tile.x;
                        selected_tile.goal_y = selected_tile.y;
                        glissor_on = true;
                    }
                }
            }
        }

        citizen_number_text.refill("Still alive: " + std::to_string(citizen_number));
         food_number_text.refill("Food: " + std::to_string(food_number));
        metal_number_text.refill("Metal: " + std::to_string(metal_number));
    }
    combat(timeElapsed);
}
Ejemplo n.º 22
0
int main(){
	personagem per;
	monstro mon;
	char *map;
	char tEnd=1,tQuit=1,tRoom, test,test2;
	
	item it;
	strcpy(it.nome,"Capa Vampirica\0");
	it.categoria='a';
	it.value=80;

	monstro blair;
	blair.magicD = 160;
	blair.fisicalD = 160;
	blair.distD = 160;
	blair.atkType = 'm';
	blair.atk = 250;
	strcpy(blair.nome,"Bruxa Blair\0");
	strcpy(blair.drop,"Camiseta do TUSCA\0");
	blair.HP = 120;
	blair.XP = 0;

	srand(time(NULL));

	do{
		test=start(&per,&map);
		if(test==2)continue;
		if(test==1)break;
		scanf("%*c");
		do{
			system("cls");
			printf("SALA %i\n",per.pos);

			printf("deseja mexer em seu inventario?(s/n):");
			scanf("%c",&test);
			if(test=='s'){
				invMenu(&per);///cuidado olhar argumentos
			}			

			do{
				printf("Digite a direcao que dejeja seguir:norte-w; sul-s; leste-d; oeste-a; quit game-q:");
				scanf("%c",&test);
			}while(test!='w' && test!='a' && test!='s' && test!='d' && test!='q');

			if(test=='q'){
				printf("deseja salvar o seu progresso?(s/n)");
				scanf("%*c");
				scanf("%*c");
				scanf("%c",&test);
				if(test=='s'){
					test2=save(per);
				}
				tQuit=0;
				break;
			}
			else{
				move(test,&(per.pos));
			}

			printf("SALA %i\n",per.pos);

			switch(map[per.pos]){
				case 0://sala qualquer sem importancia
					tRoom=rand()%100;

					if(tRoom>=35){
						mon=monsterGet(rand()%monsterNum);
						tQuit=combat(&per,&mon);
						break;
					}

					if(tRoom>=15){
						printf("nao ha nada na sala\n");
						break;
					}

					if(tRoom>=5){
						printf("voce encontrou uma fonte de cura, e aproveitou para relaxar e tomar um banho, afinal ate os herois ficam cansados(as).");
						printf(" Alem de especialmente fedidos(as) afinal de contas um covil de monstros nao cheiram tao bem assim (na maioria dos casos)\n");
						heal(&per);
						break;
					}

					item it;
					test2=itemGet(rand()%itemNum,&it);
					printf("voce encontrou um '%s' deseja guardar no seu inventario?(s/n)\n",it.nome);
					scanf("%*c");
					scanf("%c",&test);
					if(test=='s'){
						store(it);
					}

					break;
				case 1://sala 0
					printf("SALA ZERO\n\n");
					printf("Voce esta em uma sala ampla com paredes e chao de pedra, ao seu redor existem varios destrocos pedacos de madeira e pedra, provavelmente vindos do telhado, ");
					printf("ja partido com frestas que permitem observar um o azul do ceu, e da decoracao, que antes imponente e bela agora nao passa de escombros\n\n");
					printf("mas voce eh capaz de identificar no meio disso um pedestal de pedra e sobre ele apenas os pes do que um dia ja foi uma estatua e uma inscricao que diz:\n");
					printf("'voce esta agora em um local seguro jovem aventureiro ou aventureira, aproveite este lugar para se preparar para as aventuras que estao a seguir.'");
					printf("\n o resto estva ilegivel apagado pelo tempo. Voce aproveita a seguranca temporaria para se preparar para o que ha a seguir");
					heal(&per);
					break;
				case 2://sala com primeiro boss Alucard
					printf("voce sente seu corpo ser transportado para um local difente das ruinas em que voce estava anteriormnte, voce agora esta em uma sala nao muito grande,mas");
					printf(" muito bem decorada com itens de beleza rara, apesar de ja ser noite a sala esta bem iluminada e ao olhar na direcao da janela voce ve um homem.\n");
					printf("Ele esta vestindo um longo sobretudo preto com detalhes em vermelho por cima da camisa e calca tambem de coras escuras e logo se vira para voce e diz:\n");
					printf("'seja bem vindo ao meu humilde castelo %s,eu estava lhe esperando. Meu nome eh Alucard sou um dos gurdioes das ruinas dos herois, por favor sente-se",per.nome);
					printf(", vou lhe contar a triste historia deste lugar:\n");
					system("pause");
					system("cls");
					printf("Ha muitos anos este lugar era um reduto de aventureiros que que reuniam nos arredores para desafiar as salas e conquistar as recompensas ");
					printf("que aqui existem, ate que um dia a bruxa Blair, que era uma guardia, assasinou o antigo mestre, tomou seu lugar e comecou a enviar os desafiantes para ");
					printf("a morte certa ate que certa vez os aventureiros se revoltaram contra ela. Uma grande batalha foi travada e o resultado foi um massacre. Eles nao puderam ");
					printf("conta as forcas de Blair e tudo o que restou sao os destrocos da sala zero. Apos isso os poucos que fugiram no inicio da batalha lacraram a entada para que " );
					printf("nenhum desavisado caisse em suas garas. Desde entao Blair tem trazido pessoas aqui atravez de armadilhas para que lutem aqui ate a morte certa, destruindo ");
					printf("os ideais do primeiro mestre. Eu nunca pude fazer nada contra o seu poder, mas agora com voce aqui eh diferente, voce tem potencial para mudar isto.");
					system("pause");
					system("cls");
					printf("Torne-se mais forte para poder derrota-la, eu orei lhe ajudar quando a hora chegar.\nComo prova de minha lealdade lhe dou isto:'\n");
					printf("Voce recebeu a 'capa vampirica' e guardou em seu inventario.");
					store(it);
					printf("'um ultimo aviso cuidado com o proximo guardiao ele pode parecer inofensivo mas eh uma fera selvagem e mortal.'");
					system("pause");
					system("cls");
					printf("voce entao retorna para as ruinas");
					per.rooms[0]=0;
					map[per.pos]=0;
					break;
				case 3://sala com segundo boss galinha
					if(per.rooms[0]!=0){
						printf("nao ha nada na sala\n");
						break;
					}
					printf("Ao entrar na sala voce se ve em meio a um palheiro e bem ao centro voce ve uma galinha.\no que voce deseja fazer:");
					printf("1 - matar a galinha e assar sua carne (ela parece suculenta);");
					printf("2 - andar de fininho e passar tentando nao chamar a atencao;");
					printf("outro - gritar por socoro;");
					scanf("%c",&test);
					switch(test){
						case '1':
							printf("A galinha eh mais poderosa que voce e te mata.");
							tQuit=0;
							break;
						case '2':
							printf("voce passa sem cahmar a atencao e se salva");
							per.rooms[1]=0;
							map[per.pos]=0;
							break;
						default:
							printf("Voce chamou a atencao da galinha, sair vivo nao eh mais uma opcao.");
							tQuit=0;
							break;						
					}
					break;				
				case 4:
					if(per.rooms[1]!=0){
						printf("nao ha nada na sala\n");
						break;
					}
					printf("Voce se encontra agora num lugar que aparenta ser uma arena de combate medieval. Blair se encontra a sua frente com seu cajado em posicao de combate");
					printf("Blair diz: 'me surpreende muito que voce tenha chegado ate aqui, achei que fosse apenas mais um idiota, mas voce tem algum valor.'");
					system("pause");
					test=combat(&per,&blair);
					switch(test){
						case 0:
							tQuit = 0;
							break;
						case 1:
							printf("Com a morte de Blair, Alucard assume o comendo das Ruina dos Herois e voce eh nomeado um dos Guardioes da Ruina. \n");
							printf("Novamente, aventureiros se reunem para desafiar as salas e conquistar suas recompensas.\n");
							printf(" Voce jamais volta para casa, afinal, para que voltar para casa?!");
							printf("\n\nFIM.");
							break;
						case 2:
							printf("Voce foi transportado para a SALA ZERO");
							per.pos = 0;
							break;
					}
			}

			if(tQuit==0)break;

			printf("deseja salvar o seu progresso?(s/n)");
			scanf("%c",&test);
			if(test=='s'){
				save(per);
			}

		}while(tQuit);

		printf("deseja voltar ao menu inicial?(s/n)");
		scanf("%*c");
		scanf("%c",&tEnd);
		system("cls");

	}while(tEnd!='n');
	system("pause");
	return 0;
}
Ejemplo n.º 23
0
int storyProgression(char *help)			// määritellään aliohjelma joka ottaa vastaan charaacter tyyppisen osoittimen ja palauttaa kokonaisluvun
{

	string s[100];							// määritellään string-taulukon koko
	int characterhealth;
	int choice = 0;
	int diceValue = 0;

	s[0] = "\n\nThis story takes place in a modern city in Finland, called Helsinki. A place where people go to work every day to make the wheels of the city turn. A place where creativity and the will to work coalesce into a single being. A place where everyone is happy to work and study. Except for one guy - you.";
	s[1] = "It's mid-day monday. You wake up to the realization that your electronics-project, that was supposed to be turned in last friday is still halfway done and that your upcoming math exam is thirty minutes away from starting.";
	s[2] = "You can still make it to the math exam, altough the road is going to be rough. There are beerbottles lying on the floor everywhere. The floor seems hard to pass through in your current condition. Do you want to get out of bed?";
	s[3] = "1. Yes.";
	s[4] = "2. No!";
	s[5] = "As you struggle up, you realize that someone's arm is wrapped around your waist. Your mouth curls into a grin and you look behind you, only to realize that it's actually a gargantuan swampmonster grasping your waist. Instantly your mildly inflated ego implodes in a sudden spasm into horror and you start trying to get out without waking the colossal beast.";
	s[6] = "As you relax in your bed, you realize that someone's arm is wrapped around your waist. Your mouth curls into a grin and you look behind you, only to realize that it's actually a gargantuan swampmonster grasping your waist. Instantly your mildly inflated ego implodes in a sudden spasm into horror and suddenly the math exam seems like the perfect excuse to make a run for it. You try to get out of bed without waking the colossal beast.";
	s[7] = "The monster sleeps tidily as you slip it's arm back and get up from bed. Your head is spinning like a wheel, while you pick up your clothes and head for the door.";
	s[8] = "Your shaky hand fails to remove the hand with a steady move. The beast wakes up with a monstrous yawn and sets its eyes on you - it smiles and tries to pull you back into the bed. You scream and do your best to rip yourself free.";
	s[9] = "You weren't gripped very tightly and to your joy you succeed. As you run through the door, you hear hideous moaning behind you. When you get out, you find out that in your terror-filled sprint you forgot to pick up your clothes. You check the garbage bin of your tenement to find a piece of rags, that you wrap around your bare waist.";
	s[10] = "You start walking towards your school. It's four kilometers to walk and the thought gives you a shiver. You decide to take a shortcut to make it in time, even though it's through a shady area. As your apartment begins to fade into the mass of grey buildings, a peculiar looking man jumps from behind a corner!";
	s[11] = "It's a mugger! He closes in on you with a crooked smile and a knife firmly in hand. He says: 'Your money, or your life!'\n What will you do?";
	s[12] = "1. Give him your money (saves you from a fight).";
	s[13] = "2. Don't give him anything.";
	s[14] = "Your wallet is in your pants. You don't have your pants. Fight for your life!";
	s[15] = "You hand over your wallet and the mugger walks away.";
	s[16] = "'No mugger is going to stop me from getting my shit together' you think. You still have two kilometers to walk and six minutes to do it, so you start moving yourself with your legs.";
	s[17] = "5 minutes pass.\nYou arrive to your schools doorstep. You take a second to catch your breath and start moving towards the door. You sense that there is a sinister presence lying in wait behind it. There is no time to wait, so you grit your teeth and enter.";
	s[18] = "";
	s[19] = "After the bloody fight, your heart is pounding, your throat is choking and your head is spinning. You barely make the stairs up to your math class. The class door is wide open and you lunge inside. A few grins greet you as you enter with your wheezing breath and pale face.";
	s[20] = "You sit to your designated desk and wait. Everyone seems flustered about the exam. After a short while the teacher lays the math test to your table. It looks intense. Seriously intense. You pick up your calculator, your pride and your will to survive and get ready to fight for your life!";
	s[21] = "You sit to your designated desk and wait. Everyone seems flustered about the exam. After a short while the teacher lays the math test to your table. It looks intense. Seriously intense. You reach for your calculator only to realize that it is still inside your jacket, which is at home. Saddened you pick up your pride and your will to survive and brace yourself to fight for your life.";
	s[23] = "Victory! Finally the deed is done and the slain math test rests in pieces in front of you. You roar triumphantly, pick a piece of the test as a trophy and rush out with newfound strength! There is absolutely nothing you cannot do considering what you just made through!\n\n Few years pass and you get elected for president. Another few years pass and you invent a stable and working fusion generator. The next few years? That story is for another day. Congratulations!";


	cout << s[0] << endl << endl << s[1] << endl << endl << s[2] << endl << endl << s[3] << endl << s[4] << endl << endl;

	cin >> choice;
	cout << endl << endl;

	if (choice == 1)
	{
		cout << s[5] << endl << endl;
	}
	else
	{
		cout << s[6] << endl << endl;
	}

	diceValue = diceRoll(1);	// kutsutaan aliohjelmaa jonka palautusarvo laitetaan muuttujaan diceValue

	bool clothes = true;

	if (diceValue >= 1 && diceValue <= 3)			// tulostetaan erilaisia s-taulukon paikkoja riippuen ehtolauseen toteutumisesta
	{
		cout << "You roll " << diceValue << endl << endl << s[8] << endl << endl;

		system("PAUSE");

		diceValue = diceRoll(1);
		cout << endl << "You roll " << diceValue << endl << endl << s[9] << endl << endl;
		clothes = false;
	}
	else
	{
		cout << endl << "You roll " << diceValue << endl << endl;

		system("PAUSE");

		cout << endl << s[7] << endl;
	}


	cout << s[10] << endl << endl << s[11] << endl << endl;

	if (clothes == true)
	{
		cout << s[12] << endl << s[13] << endl << endl;
		cin >> choice;
		cout << endl << endl;

		if (choice == 2)
		{
			// TAISTELU VS MUGGER
			characterhealth = combat(7, help);				// Kutsutaan aliohjelma, jolle annetaan kokonaisluku määrittämään vihollisen arvoja ja helpin osoite. Aliohjelma palauttaa kokonaisluvun.
			if (characterhealth <= 0)
			{
				return 0;
			}
		}
		else
		{
			cout << s[15] << endl << endl;
		}
	}
Ejemplo n.º 24
0
//Main fonction
int main(void)
{
  int fini = 1;
  int nb_victoire = 0;
  Liste Adversaires = NULL;
  Pokemon mon_pok;
  int diff = 1;

  //Défini les attaques possibles
  Attaque PO = new_attack("Poseidon", 90, "Eau");
  Attaque CH = new_attack("Chalchiuhtlicue", 70, "Eau");
  Attaque LL = new_attack("Llyr", 50, "Eau");
  Attaque AO = new_attack("Ao Kuang", 30, "Eau");
  Attaque HE = new_attack("Hephaestus", 90, "Feu");
  Attaque SV = new_attack("Svarog", 70, "Feu");
  Attaque AR = new_attack("Arshi Tngri", 50, "Feu");
  Attaque TO = new_attack("Tohil", 30, "Feu");
  Attaque ZE = new_attack("Zeus", 90, "Foudre");
  Attaque TH = new_attack("Thunraz", 70, "Foudre");
  Attaque TA = new_attack("Taranis", 50, "Foudre");
  Attaque AT = new_attack("Atamshkai", 30, "Foudre");
  Attaque AN = new_attack("Antheia", 90, "Herbe");
  Attaque KE = new_attack("Kernunnos", 70, "Herbe");
  Attaque YU = new_attack("Yum Caax", 50, "Herbe");
  Attaque EM = new_attack("Emesh", 30, "Herbe");

  //Défini les pokemons possibles
  Pokemon Meliae = new_pokemon("Meliae", "Herbe", 5, 15, 25, 25, 25, KE, TA, LL, TO);
  Pokemon Callirhoe = new_pokemon("Callirhoe", "Eau", 5, 20, 20, 25, 25, CH, AR, YU, AT);
  Pokemon Melinoe = new_pokemon("Melinoe", "Feu", 5, 25, 15, 25, 25, SV, TA, YU, AO);
  Pokemon Eratheis = new_pokemon("Eratheis", "Foudre", 5, 15, 15, 40, 40, TH, LL, AR, EM);
  Pokemon Kimeira = new_pokemon("Kimeira", "Feu", 15, 50, 50, 100, 100, PO, HE, ZE, AN);
  
  //Nettoie l'écran au début du jeu
  nettoie();

  //Le joueur choisit la difficulté
  diff = difficulte();
  
  //Le joueur choisit son pokemon
  mon_pok = choisit_debut (Meliae, Callirhoe, Melinoe, Eratheis);

  //Création de la liste des pokemons adverses Kimeira en dernier pour les modes autres que facile
  if (diff != 1) Adversaires = ajoute(Kimeira, Adversaires);
  Adversaires = ajoute(Meliae, Adversaires);
  Adversaires = ajoute(Callirhoe, Adversaires);
  Adversaires = ajoute(Melinoe, Adversaires);
  Adversaires = ajoute(Eratheis, Adversaires);

  //Nettoie l'écran après avoir choisit le pokemon
  nettoie();

  //Fait des combats tant que le joueur n'a pas perdu, ou qu'il reste des pokemons à combattre
  while (fini && (Adversaires != NULL))
    {
      printf("Votre pokemon %s va affronter %s. Bonne chance !\n\n\n\n", mon_pok.Nom, (Adversaires -> adv).Nom);
      //Si le joueur à gagner
      if ((combat (mon_pok, Adversaires -> adv, diff)) == 1)
	{
	  //Monte le niveau du pokemon
	  mon_pok = level_up(mon_pok);
	  printf("Bravo ! Vous avez gagne un niveau, %s est maintenant niveau %d.\n\n\n\n", mon_pok.Nom, mon_pok.LVL);
	  //Le soigne
	  mon_pok.HP = mon_pok.HPMAX;
	  //Calcule le nombre de combats remportés
	  nb_victoire++;
	  //Si c'était le dernier combat, gagné
	  if (Adversaires -> suivant == NULL) 
	    {
	      printf("Vous avez defait tous vos adversaires.\nGagne !\n\n");
	      fini = 0;
	    }
	  //Sinon on passe au pokemon suivant
	  else
	    {
	      Adversaires = Adversaires -> suivant;
	    }
	}
      //Si le joueur à perdu, on fini le jeu
      else
	{
	  fini = 0;
	  //Avec ou sans s à victoire selon (0,1) ou plus
	  if (nb_victoire > 1)
	    {
	      printf("Dommage, vous avez perdu apres %d victoires.\n\n", nb_victoire);
	    }
	  else
	    {
	      printf("Dommage, vous avez perdu apres %d victoire.\n\n", nb_victoire);
	    }
	}
    }
  return(0);
}