示例#1
0
 public static void DoPotager(HeroConstructor hero, Enemy enemy)
 {
     Console.WriteLine(enemy.GetName() + " a lancé l'attaque: " + potager.GetName() + "!");
     hero.SetHp(hero.GetHp() - (potager.GetDamage() + enemy.GetAtt() - hero.GetDef()));
     Console.WriteLine(enemy.GetName() + " vous a tappé pour " + (potager.GetDamage() + enemy.GetAtt()) + " - " + hero.GetDef() + "armure = " + (potager.GetDamage() + enemy.GetAtt() - hero.GetDef()) + " dommages");
     Console.WriteLine("il vous reste " + hero.GetHp() + " pvs");
 }
示例#2
0
 public static void UseGingembre(HeroConstructor hero, int heroMaxHp)
 {
     if (hero.GetHp() + 50 <= heroMaxHp)
     {
         hero.SetHp(hero.GetHp() + 50);
     }
     else
     {
         hero.SetHp(heroMaxHp);
     }
     Console.WriteLine("Vous avez récupéré 50hp !!");
 }
示例#3
0
 public static void DoBasicAttack(Attack atk, HeroConstructor hero, Enemy enemy)
 {
     if (atk.GetDamage() <= hero.GetDef())
     {
         Console.WriteLine(enemy.GetName() + " a lancé l'attaque: " + atk.GetName() + "!");
         Console.WriteLine("l'attaque à été complètement bloquée!!!");
     }
     else
     {
         Console.WriteLine(enemy.GetName() + " a lancé l'attaque: " + atk.GetName() + "!");
         hero.SetHp(hero.GetHp() - (atk.GetDamage() + enemy.GetAtt() - hero.GetDef()));
         Console.WriteLine(enemy.GetName() + " vous a tappé pour " + (atk.GetDamage() + enemy.GetAtt()) + " - " + hero.GetDef() + "armure = " + (atk.GetDamage() + enemy.GetAtt() - hero.GetDef()) + " dommages");
         Console.WriteLine("il vous reste " + hero.GetHp() + " pvs");
     }
 }
示例#4
0
 public static void DoSpores(HeroConstructor hero, Enemy enemy)
 {
     Console.WriteLine(enemy.GetName() + " a lancé l'attaque: " + spores.GetName() + "!");
     hero.SetHp(hero.GetHp() - (spores.GetDamage() + enemy.GetAtt()));
     Console.WriteLine(enemy.GetName() + " vous a tappé pour " + (spores.GetDamage() + enemy.GetAtt()) + " - 0 armure = " + (spores.GetDamage() + enemy.GetAtt()) + " dommages");
     hero.SetAtt(hero.GetAtt() - 10);
     Console.WriteLine("votre attaque diminue de 10");
 }
示例#5
0
        public bool Fight(HeroConstructor hero, Enemy enemy)
        {
            string option;
            bool   tourJoueur = true;
            bool   victoire;
            int    enemyHpReset  = enemy.GetHp();
            int    enemyAttReset = enemy.GetAtt();
            int    enemyDefReset = enemy.GetDef();
            int    heroHpReset   = hero.GetHp();
            int    heroAttReset  = hero.GetAtt();
            int    heroDefReset  = hero.GetDef();

            //début du combat

            while (true)
            {
                //tour de l'ennemi
                if (tourJoueur == false)
                {
                    Attack atk = enemy.ChoixAttackEnemy();

                    if (enemy.GetTheType() == "plaine" && atk == enemy.attackList[2])
                    {
                        EnemyPlaine.DoOgm(enemy);
                    }
                    else if (enemy.GetTheType() == "plaine" && atk == enemy.attackList[3])
                    {
                        EnemyPlaine.DoPotager(hero, enemy);
                    }
                    else if (enemy.GetTheType() == "foret" && atk == enemy.attackList[2])
                    {
                        EnemyForet.DoOgm2(enemy);
                    }
                    else if (enemy.GetTheType() == "foret" && atk == enemy.attackList[3])
                    {
                        EnemyForet.DoDoubleBaffe(hero, enemy);
                    }
                    else if (enemy.GetTheType() == "bossPlaine")
                    {
                        Enemy.DoBasicAttack(atk, hero, enemy);
                    }
                    else if (enemy.GetTheType() == "bossforet" && atk == enemy.attackList[0] || atk == enemy.attackList[1])
                    {
                        Enemy.DoBasicAttack(atk, hero, enemy);
                    }
                    else if (enemy.GetTheType() == "bossforet" && atk == enemy.attackList[2])
                    {
                        EnemyForet.DoDoubleBaffe(hero, enemy);
                    }
                    else if (enemy.GetTheType() == "bossforet" && atk == enemy.attackList[3])
                    {
                        Boss.DoSpores(hero, enemy);
                    }
                    else if (atk == enemy.attackList[0] || atk == enemy.attackList[1])
                    {
                        Enemy.DoBasicAttack(atk, hero, enemy);
                    }

                    tourJoueur = true;
                }
                if (hero.GetHp() <= 0)
                {
                    Console.WriteLine("Vous vous etes fait tuer par " + enemy.GetName());
                    //on reset les stats du joueur et de l'ennemi
                    hero.SetHp(heroHpReset);
                    hero.SetAtt(heroAttReset);
                    hero.SetDef(heroDefReset);
                    enemy.SetHp(enemyHpReset);
                    enemy.SetAtt(enemyAttReset);
                    enemy.SetDef(enemyDefReset);
                    return(victoire = false);
                }
                if (tourJoueur == true)

                {
                    Console.WriteLine("c'est votre tour!");
                    Console.WriteLine("Hp = " + hero.GetHp() + " /// Att = " + hero.GetAtt() + " /// Def = " + hero.GetDef());
                    option = FightMenu(enemy);
                    if (option == "attack")
                    {
                        hero.AttackMenu();
                        Attack atk = hero.ChoixAttaqueHero();

                        if (hero.GetClasse() == "Découpe" && atk == hero.GetAttacKList()[2])
                        {
                            AttackDecoupe.DoJulienne(hero, enemy);
                        }
                        else if (hero.GetClasse() == "Découpe" && atk == hero.GetAttacKList()[3])
                        {
                            AttackDecoupe.DoHachage(hero, enemy, enemyHpReset);
                        }
                        else if (hero.GetClasse() == "Cuisson" && atk == hero.GetAttacKList()[2])
                        {
                            AttackCuisson.DoFlambage(hero, enemy);
                        }
                        else if (hero.GetClasse() == "Cuisson" && atk == hero.GetAttacKList()[3])
                        {
                            AttackCuisson.DoPyrolise(hero, enemy);
                        }
                        else if (hero.GetClasse() == "Pâte" && atk == hero.GetAttacKList()[2])
                        {
                            AttackPate.DoMalaxage(hero, enemy);
                        }
                        else if (hero.GetClasse() == "Pâte" && atk == hero.GetAttacKList()[3])
                        {
                            AttackPate.DoEtalage(hero, enemy);
                        }
                        else if (atk == hero.GetAttacKList()[0] || atk == hero.GetAttacKList()[1])
                        {
                            Attack.DoBasicAttack(atk, hero, enemy);
                        }

                        tourJoueur = false;
                    }
                    else if (option == "herb")
                    {
                        Herb herb = hero.ChoixHerbs();
                        if (herb != null)
                        {
                            Console.WriteLine(hero.GetName() + " a utilisé: " + herb.GetName() + "!");

                            if (herb == herbs[0])
                            {
                                Herb.UseRomarin(enemy);
                            }
                            else if (herb == herbs[1])
                            {
                                Herb.UseThym(enemy);
                            }
                            else if (herb == herbs[2])
                            {
                                Herb.UseCoriandre(enemy);
                            }
                        }
                        else
                        {
                            Console.WriteLine("vous n'en n'avez pas dans votre inventaire!!");
                        }
                    }
                    else if (option == "spice")
                    {
                        Spice spice = hero.ChoixSpice();
                        if (spice != null)
                        {
                            Console.WriteLine(hero.GetName() + " a utilisé: " + spice.GetName() + "!");
                            if (spice == spices[0])
                            {
                                Spice.UsePaprika(hero);
                            }
                            else if (spice == spices[1])
                            {
                                Spice.UseCanelle(hero);
                            }
                            else if (spice == spices[2])
                            {
                                Spice.UseGingembre(hero, heroHpReset);
                            }
                        }
                        else
                        {
                            Console.WriteLine("vous n'en n'avez pas dans votre inventaire!!");
                        }
                    }
                    else if (option == "infos")
                    {
                        enemy.StatsMenuEnemy();
                        enemy.AttackMenuEnemy();
                    }

                    if (enemy.GetHp() > 0)
                    {
                        Console.WriteLine(enemy.GetName() + " a " + enemy.GetHp() + "hp");
                    }
                }
                if (enemy.GetHp() <= 0)
                {
                    Console.WriteLine(enemy.GetName() + " est mort!!");
                    //on reset les stats du joueur et de l'ennemis
                    hero.SetHp(heroHpReset);
                    hero.SetAtt(heroAttReset);
                    hero.SetDef(heroDefReset);
                    enemy.SetHp(enemyHpReset);
                    enemy.SetAtt(enemyAttReset);
                    enemy.SetDef(enemyDefReset);

                    if (hero.getXp() + enemy.xp >= hero.getNextLvl())
                    {
                        Console.WriteLine("Vous avez gagné un niveau!!");
                        Console.WriteLine(hero.GetName() + " passe niveau " + (hero.getLvl() + 1) + "!!!");
                        Console.WriteLine("Hp --> +100 | Att --> +10 | Def --> +10");
                        hero.SetXp(enemy.xp - (hero.getNextLvl() - hero.getXp()));
                        hero.SetLvl(hero.getLvl() + 1);
                        hero.SetNextLvl(hero.getNextLvl() * 2 + 50);
                        hero.SetHp(hero.GetHp() + 100);
                        hero.SetAtt(hero.GetAtt() + 10);
                        hero.SetDef(hero.GetDef() + 10);
                    }
                    else if (hero.getXp() + enemy.xp < hero.getNextLvl())
                    {
                        hero.SetXp(hero.getXp() + enemy.xp);
                    }

                    if (enemy.GetTheType() == "bossplaine" || enemy.GetTheType() == "bossforet" || enemy.GetTheType() == "bossmer" || enemy.GetTheType() == "bossdesert" || enemy.GetTheType() == "bossmontagne" || enemy.GetTheType() == "bossruine")
                    {
                        Console.WriteLine("Vous avez gagné \"" + enemy.reward.GetName() + "\"!!!");
                        hero.inventory.ingredientList.Add(enemy.reward);
                    }
                    Console.ReadLine();
                    return(victoire = true);
                }
            }
        }
示例#6
0
        public void NewFrame()
        {
            MapCase currentCase = map.FindHero();

            if (currentCase.enemyHere != null)
            {
                Console.Clear();
                Console.WriteLine("\nCOMBAT!!!");
                Console.WriteLine("vs " + currentCase.enemyHere.GetName());
                bool result = Fight(hero, currentCase.enemyHere);
                if (result == true)
                {
                    if (map.FindHero().GetTerrain() == "plaine")
                    {
                        map.SpawnBoss("plaine", 4, 9, boss[0], 1);
                    }
                    else if (map.FindHero().GetTerrain() == "foret")
                    {
                        map.SpawnBoss("foret", 4, 12, boss[1], 1);
                    }
                    currentCase.enemyHere     = null;
                    currentCase.defeatedEnemy = true;
                }
                else if (result == false)
                {
                    Console.Clear();
                    Console.WriteLine("vous etes mort...");
                    hero.SetHp(100);
                }
            }
            else if (currentCase.chestHere == true)
            {
                Console.Clear();
                Chest chest = new Chest("coffre");
                Console.WriteLine("Vous avez trouvé un coffre!!!");
                Console.WriteLine("Voici son contenu: ");

                string content = chest.SetContent();
                chest.ShowContent();
                Console.ReadLine();
                if (content == "weapon")
                {
                    hero.inventory.weaponList.Add(chest.weapon[0]);
                    hero.SetAtt(hero.GetAtt() + chest.weapon[0].statAtt);
                    hero.SetDef(hero.GetDef() + chest.weapon[0].statDef);
                    hero.SetHp(hero.GetHp() + chest.weapon[0].statHp);
                }
                else if (content == "consommable")
                {
                    for (int i = 0; i < chest.herb.Count; i++)
                    {
                        hero.inventory.herbList.Add(chest.herb[i]);
                    }
                    for (int i = 0; i < chest.spice.Count; i++)
                    {
                        hero.inventory.spiceList.Add(chest.spice[i]);
                    }
                }


                currentCase.chestHere   = false;
                currentCase.openedChest = true;
            }
            else
            {
                Console.Clear();
                map.AfficheMap();
                GameMenu();
            }
        }