Exemplo n.º 1
0
 /// <summary>
 /// Instancie dans un dico les sort de la quantité déterminé
 /// </summary>
 /// <param name="quantite">défini la quantité de loot</param>
 /// <param name="type">defini le type de sort</param>
 /// <param name="nom">defini le nom du sort</param>
 /// <param name="list">defini le dico affecté</param>
 public void InstanciationLootSort(int quantite, TypeSort type, NomSort nom, DicoLoot list)
 {
     for (int i = 0; i < quantite; i++)
     {
         Loot_Sort sort = new Loot_Sort();
         list.Add(this.CaseVide(), sort.CreationSort(type, nom));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Affiche l'inventaire et permet la selection d'un sort
        /// </summary>
        static void MenuInventaire()
        {
            string    reponse = string.Empty;
            int       repconv = 0;
            Loot_Sort sorinv  = new Loot_Sort();

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("INVENTAIRE");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("Personnage:");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("-Force={0}\n-Vitesse={1}\n-Vision={2}", bob.Force, bob.Vitesse, bob.Vision);
            Console.WriteLine();
            try
            {
                if (bob.Inventaire.QuantiteLoot() != 0)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    for (int i = 0; i < bob.Inventaire.QuantiteLoot(); i++)
                    {
                        Console.WriteLine("Le sort en {0} est de type {1}", i, bob.Inventaire.GetNomObjet(i));
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine();
                    Console.WriteLine("Quel sort voulez-vous?");
                    reponse = Console.ReadLine();
                    repconv = int.Parse(reponse);

                    if (repconv < bob.Inventaire.QuantiteLoot())
                    {
                        sorinv = (Loot_Sort)bob.Inventaire.GetSort(repconv);
                        sorinv.Affect(bob);
                        bob.Inventaire.EnleveLoot(repconv);

                        Console.WriteLine();
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Personnage nouveau:", bob.Force, bob.Vitesse);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("-Force={0}\n-Vitesse={1}\n-Vision={2}", bob.Force, bob.Vitesse, bob.Vision);
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine();
                        Console.WriteLine("Tapez sur une touche pour continuer");
                        Console.ReadKey();
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Vous n'avez aucun sort. \n Tapez sur une touche pour continuer");
                Console.ReadKey();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Verification de la présence d'un sort et application au personnage
        /// </summary>
        /// <param name="perso"></param>
        static void ApplicationSort(Joueur perso)
        {
            Loot_Sort sor = new Loot_Sort();

            Console.WriteLine("Un objet Trouve");
            Point poin = new Point(xpos, ypos);

            if (list.ContainsKey(poin))
            {
                sor = (Loot_Sort)(list.GetLoot(poin));
                sor.Affect(perso);
                sortname = sor.NomSort;
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // Loot cle = Loot;
            Loot_Sort sor = new Loot_Sort();

            sor.CreationSort(NomSort.Force, 20);      //creation de sort
            bob.Inventaire.Add(sor);                  //Ajout dans l'inventaire
            Loot_Sort sor2 = new Loot_Sort();

            sor2.CreationSort(NomSort.Vitesse, 20);
            bob.Inventaire.Add(sor2);
            Loot_Sort sor3 = new Loot_Sort();

            sor3.CreationSort(NomSort.Vision, 20);
            bob.Inventaire.Add(sor3);
            Loot_ObjetCle cle = new Loot_ObjetCle()
            {
                name = "cle1"
            };

            bob.Inventaire.Add(cle);
            Loot_Sort sor4 = new Loot_Sort();

            sor4.CreationSort(TypeSort.Potion, NomSort.Vision);
            bob.Inventaire.Add(sor4);
            string reponse = string.Empty;

            do
            {
                RemplissageDicoSort(tableau);
                Jeux();

                Console.WriteLine("Un autre essais (o)?");
                reponse = Console.ReadLine();
                list.Clear();
            } while (reponse == "o");
        }
Exemplo n.º 5
0
 /// <summary>
 /// Affect les paramètres d'un adversaire x avec le sort
 /// </summary>
 /// <param name="sort">Sort à appliquer</param>
 /// <param name="x">l'être affacté</param>
 public void InteractionJoueur(Loot_Sort sort, Joueur x)
 {
     sort.Affect(x);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Affect les paramètres d'un être x avec le sort
 /// </summary>
 /// <param name="sort">Sort à appliquer</param>
 /// <param name="x">l'être affacté</param>
 public void InteractionEtre(Loot_Sort sort, Loot_Etre x)
 {
     sort.Affect(x);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Renvoie aleatoirement un type de sort
        /// </summary>
        /// <returns></returns>
        public Loot_Sort CreationSortAleatoire()
        {
            Loot_Sort so = new Loot_Sort();

            return(so.CreationSort((NomSort)(Utilitaire.RandNombre(0, Loot_Sort.NombreTypeSort()))));
        }
Exemplo n.º 8
0
        /// <summary>
        /// renvoie un sort dont le type et le nom sont définie en argument et dont les valeurs sont issue du fichier des settings
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nom"></param>
        /// <returns></returns>
        public Loot_Sort CreationSort(TypeSort type, NomSort nom)
        {
            Loot_Sort sort = new Loot_Sort();

            switch (type)
            {
            case TypeSort.Immediat:
                switch (nom)
                {
                case NomSort.Force:
                    Force        += constantesLoot.SortForce;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Vitesse:
                    Vitesse      += constantesLoot.SortVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Combine:
                    Force        += constantesLoot.SortForce;
                    Vitesse      += constantesLoot.SortVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Teleportation:
                    Position      = _position;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Vision:
                    Vision       += constantesLoot.SortVision;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;
                }
                break;

            case TypeSort.Potion:
                switch (nom)
                {
                case NomSort.Force:
                    Force        += constantesLoot.SortPotionForce;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Vitesse:
                    Vitesse      += constantesLoot.SortPotionVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Combine:
                    Force        += constantesLoot.SortPotionForce;
                    Vitesse      += constantesLoot.SortPotionVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Teleportation:
                    Position = _position;
                    break;

                case NomSort.Vision:
                    Vision       += constantesLoot.SortPotionVision;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;
                }
                break;

            case TypeSort.Carte:
                switch (nom)
                {
                case NomSort.Force:
                    Force        -= constantesLoot.SortCarteForce;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Vitesse:
                    Vitesse      -= constantesLoot.SortCarteVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Combine:
                    Force        -= constantesLoot.SortCarteForce;
                    Vitesse      -= constantesLoot.SortCarteVitesse;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Teleportation:
                    Position      = _position;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;

                case NomSort.Vision:
                    Vision       -= constantesLoot.SortCarteVision;
                    this.NomSort  = nom;
                    this.TypeSort = type;
                    break;
                }
                break;

            default:
                return(null);
            }
            return(sort);
        }