public void attaquer(Perso_principal pp) { Console.WriteLine("Attaquer avec quoi?" + "\n" + pp.monStuf); int index = int.Parse(Console.ReadLine()); int attaque = pp.Force + (pp.monStuf.elements[index - 1].stat_obj); int stop = 1; while (Sante > 0 || stop == 0 || pp.Sante > 0) { Console.WriteLine("1) Attaquer\n2) Fuire?"); int choix = int.Parse(Console.ReadLine()); if (choix == 1) { if (attaque > Force) { Console.WriteLine("Attaque réussie, il pert : " + (0.8 * attaque) + " points de vie"); Sante = Sante - (0.8 * attaque); } else { if ((attaque * 100) / Force > 25) { int chanceVictoire = randint.Next(0, 2); if (chanceVictoire == 0) { Console.WriteLine("Attaque réussie, il pert : " + (0.8 * attaque) + " points de vie"); Sante = Sante - (0.8 * attaque); } else { Console.WriteLine("Echec de l'attaque tu perds 10pts de vie" + "\n" + pp); pp.Sante = -10; } } if ((attaque * 100) / Force < 25) { Console.WriteLine("Echec de l'attaque tu perds 10pts de vie" + "\n" + pp); pp.Sante = -10; } } if (Sante <= 0) { Console.WriteLine("Il est KO"); } if (pp.Sante <= 0) { Console.WriteLine("Vous êtes KO") } } else { stop = 0; } } }
public void donner_Obj(Perso_principal pp) { if (accepter_objet < pp.Persuasion) { Console.WriteLine("Quel objet donner?"); Console.WriteLine(pp.monStuf); int index = int.Parse(Console.ReadLine()); if (pp.monStuf.Elements(index) == "cachets") { Etat = "Sommeil"; pp.monStuf.supprItem(index - 1); Console.WriteLine("Il s'est endormi"); } else { pp.monStuf.supprItem(index - 1); Console.WriteLine("Merci infiniment"); } } else { if (((pp.Persuasion * 100) / accepter_objet) > 25) { int chanceDont = randint.Next(0, 2); if (chanceDont == 0) { Console.WriteLine("Désolé je ne peux rien n'accepter de la part des patients"); } else { Console.WriteLine("Quel objet donner?"); Console.WriteLine(pp.monStuf); int index = int.Parse(Console.ReadLine()); if (pp.monStuf.Elements(index) == "cachets") { Etat = "Sommeil"; pp.monStuf.supprItem(index - 1); Console.WriteLine("Il s'est endormi"); } else { pp.monStuf.supprItem(index - 1); Console.WriteLine("Merci infiniment"); } } } if (((pp.Persuasion * 100) / accepter_objet) < 25) { Console.WriteLine("Désolé, je ne peux rien accepter des patients"); } } }
static void Main(string[] args) { Map nnn = new Map(30, 30); Console.SetWindowSize(170, 45); // Console.Write(nnn); //perso p = new perso(); //nnn.setPerso(p); //nnn.boxAlea(); //nnn.arbre(); //Console.Write(nnn); //simulTour a = new simulTour(5); //ajouer(); /* int[] position = new int[2]; * string[,] m = new string[10, 10]; * position[0] = 10; * position[1] = 10; * Maison maison = new Maison(4,position, nnn,2); * Console.Write(nnn);*/ /* for (int i = 0; i < position[0]; i++) * { * for (int j = 0; j < position[1]; j++) * { * if (i == 0 || i == position[0]-1) * { * m[i, j] = "-"; * } * if((j==0||j==position[1]-1)&& i!=0 &&i!=position[0]-1) * { * m[i, j] = "|"; * } * if (i != 0 && j != 0 && i != position[0] - 1 && j != position[1]-1) * { * m[i, j] = "a"; * } * } * }*/ /*string affiche =""; * for(int i = 0; i < position[0];i++) * { * affiche += "\n"; * for(int j=0;j<position[1];j++) * { * affiche += m[i,j]; * } * }*/ // Console.Write(nnn); Object_jeu obj = new Object_jeu("a"); Object_jeu obj1 = new Object_jeu("banane"); Object_jeu obj2 = new Object_jeu("c"); Object_jeu obj3 = new Object_jeu("d"); Perso_principal test = new Perso_principal(); test.monStuf.ajouterItem(obj); test.monStuf.ajouterItem(obj1); test.monStuf.ajouterItem(obj2); test.monStuf.ajouterItem(obj1); test.monStuf.ajouterItem(obj2); test.monStuf.ajouterItem(obj1); test.monStuf.ajouterItem(obj3); test.monStuf.ajouterItem(obj1); test.monStuf.ajouterItem(obj2); test.monStuf.ajouterItem(obj3); test.Sex_appeal = 60; Console.WriteLine(test.Sex_appeal); // test.monStuf.ajouterItem(new Object_jeu("hache")); //Console.Write(test.monStuf); test.Sante = -30; test.alerte(); test.manger(); Console.WriteLine("Besion de qqch ? (o/n)"); if (Console.ReadLine() == "ui") { Console.WriteLine("Que voulez-vous?"); if (Console.ReadLine() == "place") { Console.WriteLine("Je suis en : {0},{1}", test.x, test.a); } } Console.Write(test); Console.Write("fini"); Console.ReadKey(); }