Exemple #1
0
static int encounter(int theme){
	struct character *foe;
	int ret,i,num=NUM_CHAR_SLOTS;
	int plvl=0;

	for(i=0;i<NUM_CHAR_SLOTS;i++){
		if(pdata.chars[i]==NULL || pdata.chars[i]->battleready==BATTLE_UNAVAILABLE)
			num--;
		else if(plvl<(ret=character_level(pdata.chars[i])))
			plvl=ret;
	}

	gen_random_map(theme);

	foe=malloc(num*sizeof(*foe));
	for(i=0;i<num;i++){
		create_character(foe+i);
		set_level(foe+i,get_random(plvl-(plvl/8),plvl));
		foe[i].jp=pdata.d_level*100;
		spend_jp_random(foe+i);
	}

	ret=start_battle(pdata.chars,foe,num);

	if(ret){
		for(i=0;i<NUM_CHAR_SLOTS;i++)
			if(pdata.chars[i]->battleready==BATTLE_READY)
				jp_reward(pdata.chars[i]);
	}

	free(foe);

	return ret;
}
Exemple #2
0
void            salle11()
{
  int           action;
  char          *entree;
  int           randmob;

  entree = malloc(sizeof(char*));
  action = 0;
  g_map[4][0].visited = 1;
  g_map[4][0].content = 1;
  look();
  srand(time(NULL));
  randmob = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 3)
        {
	  my_putstr("\nVous avez raison, quittons vite cette réserve flippante !\n");
	  g_map[4][0].content = 0;
	  SALLE = 8;
          salle08();
        }

      /*Prendre*/
      if (action == 5)
        {
          prendre();
          action = 0;
        }
      /*fin prendre*/

      if ((action == 1) || (action == 2) || (action == 4))
	{
	  erreur_depla();
	  action = 0;
	}
    }
}
Exemple #3
0
void            salle12()
{
  int           action;
  int           randmob;
  int           randmuni;
  int           randmedic;

  action = 0;
  g_map[4][1].visited = 1;
  g_map[4][1].content = 1;
  srand(time(NULL));
  randmob = rand();
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 3)
        {
	  if (DIAG_S12A09 == 0)
	    {
	      my_putstr("\nJ'arrive dans une grande salle. Oh mon dieu, il y a des hommes au sol...\n");
	      //sleep(2);
	      my_putstr("J'en compte quatre. Il y a du sang partout... Ils s'en sont moins bien sortis que moi...\n");
	      //sleep(2);
	      my_putstr("J'ai pris leurs pouls, tous morts.\n");
	      //sleep(7);
	      my_putstr("Je ne peux rien faire pour eux, continuons.\n");
	      DIAG_S12A09 = 1;
	    }
	  else
	    {
	      my_putstr("OK, je me dirige vers la salle suivante.\n");
	    }
	  g_map[4][1].content = 0;
	  SALLE = 9;
	  salle09();
	}
      if (action == 4)
        {
	  my_putstr("Je traverse un long couloir... Tout est silencieux ici, pas tres rassurant...\n");
	  my_putstr("Je suis arrive dans une grande salle.\n");
	  g_map[4][1].content = 0;
	  SALLE = 13;
	  salle13();
	}
      if (action == 5)
        {
          prendre();
          action = 0;
        }
      if ((action >= 1) && (action <= 2))
        {
	  erreur_depla();
	  action = 0;
        }
    }
}
Exemple #4
0
void            salle18()
{

  char      *mort;
  int     choix;
  int           action;
  int           randmob;
  int           randmuni;
  int           randmedic;


  choix = 0;
  mort = NULL;
  action = 0;
  g_map[7][1].visited = 1;
  g_map[7][1].content = 1;
  look();
  srand(time(NULL));
  srand(time(NULL));
  randmob = rand();
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 3)
        {
	  g_map[7][1].content = 0;
	  SALLE = 17;
	  salle17();
	}
      if (action == 4)
	{
	  my_putstr("\nVous etes sur de vouloir aller par la ???\nL'air c'est extrement rafrechie ici... ce n'est pas un bon signe\n\n");
	  my_putstr("Dois-je continuer ???\n   >");
	  while (choix == 0)
	    {
	      mort = readLine();
	      if (strcmp(mort, "oui") == 0)
		choix = 1;
	      else if (strcmp(mort, "non") == 0)
		choix = 2;
	    }
	  if (choix == 1)
	    {
	      if (COMBI == 0)
		{
		  my_putstr("J'entre dans le hangar !\nIl y a un enorme trou dans la coque !\n");
		  my_putstr("Je me sens mal !...\n");
		  //sleep(2);
		  my_putstr("Je...\n");
		  gameover();
		  score("radiations");
		}
	      else
		{
		  my_putstr("\nPfiou!!! Heureusement que j'ai ma combinaison sinon je ne pense pas survivre.\n\n");
		  g_map[7][1].content = 0;
		  SALLE = 19;
		  salle19();
		  choix = 0;
		}
	    }
	  else
	    {
	      my_putstr("\nVous avez surement raison une foi de plus,je vais vous ecouter\n\n");
	      choix = 0;
	      action = 0;
	    }
	}
      /*Prendre*/
      if (action == 5)
        {
          prendre();
          action = 0;
        }
      /*fin prendre*/
      if ((action >= 1) && (action <= 2))
        {
	  erreur_depla();
	  action = 0;
        }
    }
}
Exemple #5
0
void            salle16()
{
  int           action;
  int           randmuni;
  int           randmedic;


  action = 0;
  g_map[7][0].visited = 1;
  g_map[7][0].content = 1;
  look();
  srand(time(NULL));
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 3)
        {
	  my_putstr("\nVous avez raison, je ferai mieux de ne pas rester dans le coin trop longtemps !\n");
	  g_map[7][0].content = 0;
	  SALLE = 15;
          salle15();
        }
      if (action == 4)
        {
	  if (BOSS_BATTU == 0)
	    {
	      start_battle();
	    }
	  else
	    {
	      my_putstr("Le cadavre de la larve géante gît au sol... C'est répugnant !\n");
	      my_putstr("Je ne vois rien à faire pour le moment, à moins que vous ne sachiez comment combler le trou béant dans la coque ?\n");
	    }
	  action = 0;
        }
      /*Prendre*/
      if (action == 5)
        {
          prendre();
          action = 0;
        }
      /*fin prendre*/
      if ((action >= 1) && (action <= 2))
        {
          erreur_depla();
          action = 0;
        }
    }
}
Exemple #6
0
void            salle06()
{
  int           action;
  int           randmob;
  int           randmuni;
  int           randmedic;


  action = 0;
  g_map[2][1].visited = 1;
  g_map[2][1].content = 1;
  look();
  srand(time(NULL));
  randmob = rand();
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 1)
        {
	  my_putstr("\nCe couloir ouvre sur plusieurs portes. Il y a des noms a l'entree de chaque porte. ");
	  my_putstr("COLAS, CURLLY, ... Ce doit etre les quartiers des hommes de l'equipage.\n");
	  my_putstr("Esperons que j'en aprenne d'avantage sur l'equipage.");
	  g_map[2][1].content = 0;
	  SALLE = 5;
          salle05();
        }
      if (action == 2)
        {
	  my_putstr("\nOn dirait... Des quartiers ! Tout est en desordre, mais je devine aux bottes et aux accessoires sur les lits que ce doit etre les quartiers des femmes.\n\n");
	  g_map[2][1].content = 0;
	  SALLE = 7;
	  salle07();
        }
      if (action == 3)
        {
	  if (CARTE_ACCES == 0)
            {
              my_putstr("\nLa porte est fermee. On dirait qu'il faut une badge d'acces.\n");
	      my_putstr("Super, je suis piegee dans un vaisseau flippant, enfermee avec des cadavres...\n");
	      my_putstr("Tout. Va. Bien !\n\n");
              action = 0;
            }
          else
            {
	      my_putstr("J'essaye le badge sur le boitier de la porte...\n");
	      //sleep(2);
	      my_putstr("Et... Ca marche, la porte s'est ouverte !\n");
              g_map[2][1].content = 0;
              SALLE = 3;
              salle03();
            }
        }
      if (action == 4)
        {
          erreur_depla();
          action = 0;
        }
      if (action == 5)
        {
          prendre();
	  action = 0;
        }
    }
}
Exemple #7
0
void            salle23()
{
  int           action;
  int           randmob;
  int           randmuni;
  int           randmedic;


  action = 0;
  g_map[5][2].visited = 1;
  g_map[5][2].content = 1;
  look();
  srand(time(NULL));
  randmob = rand();
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 1)
        {
	  my_putstr("\nC'est dommage de quitter cette reserve j'en suis sur que d'autre chose qui pourrait mettre utile se cache dedant.\n\n");
	  g_map[5][2].content = 0;
	  SALLE = 13;
	  salle13();
	}
      if (action == 4)
        {
	  my_putstr("\nDes etageres remplie de cartons a ne plus savoir quoi en faire apparament, j'espere en tirer profit");
	  my_putstr(" pour tout le temp que je met a chercher dans chaque carton...\n\n");
	  g_map[5][2].content = 0;
	  SALLE = 24;
	  salle24();
	}

      /*Prendre*/
      if (action == 5)
        {
          prendre();
          action = 0;
        }
      /*fin prendre*/
      if ((action >= 2) && (action <= 3))
        {
	  erreur_depla();
	  action = 0;
        }
    }
}
Exemple #8
0
void            salle05()
{
  int           action;
  int           randmob;
  int           randmuni;
  int           randmedic;


  action = 0;
  g_map[2][0].visited = 1;
  g_map[2][0].content = 1;
  look();
  srand(time(NULL));
  randmob = rand();
  randmuni = rand();
  randmedic = rand();
  MUNI_MAP = 0;
  MEDIC_MAP = 0;

  if (randmedic%10 == 0)
    {
      MEDIC_MAP = 1;
    }
  if ((randmob%4 == 0) && (ARME_EQUIP > 0))
    {
      start_battle();
    }
  if ((randmuni%4 == 0))
    {
      MUNI_MAP = 4;
    }
  while (action == 0)
    {
      /*On propose ici le prompt au joueur*/
      action = readline();
      /*Traitement de laction :*/
      if (action == 2)
        {
	  my_putstr("\nje traverse un petit couloir etroit. Je commence a avoir sacrementpeur...\n\n");
	      g_map[2][0].content = 0;
	      SALLE = 6;
	      salle06();
	}
      if (action == 4)
        {
	  my_putstr("\nOn retourne vers le cadavre du sergent, vous etes sur de vouloir vraiment y retourner ? Moi personnelement cela ne me plait pas.");
	  g_map[2][0].content = 0;
	  SALLE = 8;
	  salle08();
	}
      if (action == 5)
        {
          prendre();
	  action = 0;
        }
      if ((action == 1) || (action == 3))
        {
	  erreur_depla();
	  action = 0;
        }
    }
}