Browse Source

Import pop corn fighting project

DricomDragon 4 years ago
parent
commit
f5500804f3
3 changed files with 314 additions and 0 deletions
  1. 80 0
      braveCorn/Perso.txt
  2. 8 0
      braveCorn/Phrases.txt
  3. 226 0
      braveCorn/main.cpp

+ 80 - 0
braveCorn/Perso.txt

@@ -0,0 +1,80 @@
+-Euuuuuuuuuh
+-Bob
+-Joe
+-Jim
+-Marcel
+-Sangoku
+-Marius
+-Bruce
+-Link
+-Redk
+-LeMonsieur
+-Lamadame
+-Jackie
+-Michelle
+-Luffy
+-Samuel
+-OnePunchMan
+-Pasteque
+-Vegeta
+-Freezer
+-Paprika
+-Mario
+-Luigi
+-°°°°°°°°
+-Peach
+-Samus
+-Nami
+-La Mort
+-Le Soleil
+-HubertPop
+-Taxi
+-DeadPool
+-DeadPoule
+-DeadCoq
+-HanCOCK
+-Iron Man
+-Ta gueule !
+-Squeezy
+-Amixem
+-SuperKonar
+-FuriousJumper
+-LaGrosseBaguette
+-Pewdiepie
+-DesNomsDebiles
+-LeSwag
+-LeRespect
+-LeSeum
+-LaVie
+-Nirvana
+-Une Girafe
+-Un lion trop classe
+-Ton cul !
+-MonsieurLol
+-MadameLol
+-MisterPoop
+-MissPee
+-Topsy Krett
+-42
+-ACDC
+-LesEtoiles
+-LeNeant
+-TrouNoir
+-BlackHole
+-WhiteHole
+-TrouDeVerre
+-666
+-Sacha
+-Pikachu
+-Salameche
+-Tortipousse
+-UnArbre
+-CeciEstCoderEnC++ParMariusEtBruce
+-Amaury
+-Damien
+-Patrick
+-Sebastien
+-JeanEude Delacompta
+-Bastienne
+-Sarah Conor
+-Daisy

+ 8 - 0
braveCorn/Phrases.txt

@@ -0,0 +1,8 @@
+- Euuuuuuuuh  
+- a demoli 
+- vient de martiriser violemment 
+- vient de briser tout les os de 
+- vient de retirer l'ame de 
+- se retire apres avoir battu 
+- vient de ridiculiser 
+- a vaincu 

+ 226 - 0
braveCorn/main.cpp

@@ -0,0 +1,226 @@
+#include <iostream>
+#include <fstream>
+#include <ctime>
+#include <cstdlib>
+#include <string>
+
+using namespace std;
+
+int main()
+{
+    cout << "Bienvenue dans le programme de baston développé par du mais !!! XD" << endl;
+
+    /// Initialisation
+    // Initialisation du random
+    srand(time(0));
+
+    // Tableau de caractéristiques
+    int Caracteristique[2][4]; // [joueur][caracteristique]
+
+    /*
+    Caracteristique == Vitesse
+    Caracteristique == Defense en %
+    Caracteristique == Vie
+    Caracteristique == Attaque
+    */
+
+    // Chaines de caracteres
+    string nomPerso1;
+    string nomPerso2;
+    string phraseDeVictime;
+    string nomPari;
+
+    // Variables
+    int nbRand1;
+    int taille;
+    char lettre;
+    const char refe('-');
+
+    // Ouverture du fichier des noms
+    ifstream monFlux("Perso.txt");
+    monFlux.seekg(0, ios::end);
+    taille = monFlux.tellg() ;
+
+    /// Choix des noms
+    // Joueur 1
+    nbRand1 = rand () % (taille-7);
+    monFlux.seekg(nbRand1, ios::beg);
+
+    do{
+        monFlux.seekg(0, ios::cur);
+        monFlux.get(lettre);
+    } while(lettre != refe);
+
+    getline( monFlux, nomPerso1 );
+    cin.clear();
+
+    // Joueur 2
+    nbRand1 = rand () % (taille-7);
+    monFlux.seekg(nbRand1, ios::beg);
+
+    do{
+        monFlux.seekg(0, ios::cur);
+        monFlux.get(lettre);
+    } while(lettre != refe);
+
+    getline( monFlux, nomPerso2 );
+    cin.clear();
+
+    monFlux.close();
+
+    // Affichage de début
+    cout << "Les paris sont ouverts !!!" << endl;
+    cout << nomPerso1;
+    cout << "1 va se battre contre ";
+    cout << nomPerso2;
+    cout << "2" << endl << endl;
+
+    /// Pari
+    // Choix joueur
+    do{
+        cout << "Sur qui voulez-vous parier ?" << endl;
+        cin >> nomPari;
+        if( nomPari != "1" && nomPari != "2" ) {
+            cout << "Ce nombre ne correspond a aucuns des combattants..." << endl;
+        }
+    } while (nomPari != "1" && nomPari != "2");
+
+    // Choix des caractéristiques
+    for (int i=0; i<4;i++){
+        Caracteristique[0][i] = rand() % 21;
+    }
+    for (int i=0; i<4;i++){
+        Caracteristique[1][i] = rand() % 21;
+    }
+
+    //Cheat Perso
+    if(nomPerso1 == "CeciEstCoderEnC++ParMariusEtBruce" || nomPerso1 == "°°°°°°°°"){
+        Caracteristique[0][0] = 666;
+        Caracteristique[0][1] = 666;
+        Caracteristique[0][2] = 666;
+        Caracteristique[0][3] = 666;
+    }
+    if(nomPerso2 == "CeciEstCoderEnC++ParMariusEtBruce" || nomPerso2 == "°°°°°°°°"){
+        Caracteristique[1][0] = 666;
+        Caracteristique[1][1] = 666;
+        Caracteristique[1][2] = 666;
+        Caracteristique[1][3] = 666;
+    }
+
+    //Affichage des caractéristiques
+    cout << endl;
+    cout << "Stats pour " << nomPerso1 << endl;
+    cout << endl;
+    cout << "Vitesse : " << Caracteristique[0][0] << endl;
+    cout << "Defense : " << Caracteristique[0][1] << endl;
+    cout << "Vie : " << Caracteristique[0][2] << endl;
+    cout << "Attaque : " << Caracteristique[0][3] << endl;
+    cout << endl;
+    cout << "Stats pour " << nomPerso2 << endl;
+    cout << endl;
+    cout << "Vitesse : " << Caracteristique[1][0] << endl;
+    cout << "Defense : " << Caracteristique[1][1] << endl;
+    cout << "Vie : " << Caracteristique[1][2] << endl;
+    cout << "Attaque : " << Caracteristique[1][3] << endl;
+    cout << endl;
+    cout << nomPerso1 << ": Prepare toi a mourrir !" << endl;
+    cout << nomPerso2 << ": Tu mourra avant moi !" << endl;
+    cout << endl;
+
+    /// Boucle de combat
+    int Ordre = 0;
+
+    while(Caracteristique[1][2] > 0 && Caracteristique[0][2] > 0)
+    {
+        int Prems = 0;
+        do
+        {
+            if ( (Caracteristique[0][0]<Caracteristique[1][0] && Ordre == 0) || Ordre == 2 )
+            {
+                int Degats1 = Caracteristique[1][3] - Caracteristique[0][1]*0.4;
+
+                if (Degats1 <= 0)
+                {
+                    Degats1 = 1 ;
+                }
+
+                Caracteristique[0][2] = Caracteristique[0][2] - Degats1;
+                Prems = 1;
+
+                cout << nomPerso2 << " inflige " << Degats1 << " a " << nomPerso1 << endl;
+
+                if (Caracteristique [0][2] <= 0)
+                {
+                    Caracteristique [0][2] = 0;
+                }
+
+                cout << "Il reste " << Caracteristique [0][2] << " PV a " << nomPerso1 << endl;
+                Ordre = 1;
+            }
+            else if ((Caracteristique[0][0]>Caracteristique[1][0] && Ordre == 0) || Ordre == 1)
+            {
+                int Degats1 = Caracteristique[0][3] - Caracteristique[1][1]*0.4;
+
+                if (Degats1 <= 0)
+                {
+                    Degats1 = 1 ;
+                }
+
+                Caracteristique[1][2] = Caracteristique[1][2] - Degats1;
+                Prems = 1;
+                cout << nomPerso1 << " inflige " << Degats1 << " a " << nomPerso2 << endl;
+
+                if (Caracteristique [1][2] <= 0)
+                {
+                    Caracteristique [1][2] = 0;
+                }
+
+                cout << "Il reste " << Caracteristique [1][2] << " PV a " << nomPerso2 << endl;
+                Ordre = 2 ;
+            }
+            else
+            {
+                int nki = rand() % 2;
+                Caracteristique[nki][0] =- 1;
+            }
+        } while(Prems == 0);
+    }
+
+    // Choix de la mort
+    ifstream monCul("Phrases.txt");
+    monCul.seekg(0,ios::end);
+    taille = monCul.tellg() ;
+    nbRand1 = rand () % (taille-11);
+    monCul.seekg(nbRand1, ios::beg);
+
+    do{
+        monCul.seekg(0, ios::cur);
+        monCul.get(lettre);
+    } while(lettre != refe);
+
+    getline(monCul,phraseDeVictime);
+
+    // Test de la mort pour affichage
+    if( Caracteristique[1][2] <= 0 ){
+        cout << nomPerso1 << phraseDeVictime  << nomPerso2 << endl;
+        if(nomPari == "1"){
+            cout << "Vous avez reussi votre pari ! Bravo !" << endl;
+        }
+        else{
+            cout << "Vous avez perdu votre pari... Dommage..." << endl;
+        }
+    }
+    else{
+        cout << nomPerso2 << phraseDeVictime << nomPerso1 << endl;
+        if(nomPari == "2"){
+            cout << "Vous avez reussi votre pari ! Bravo !" << endl;
+        }
+        else{
+            cout << "Vous avez perdu votre pari... Dommage..." << endl;
+        }
+    }
+
+    monCul.close();
+
+    return 0;
+}