Exemplo n.º 1
0
        public Inventaire()
        {
            item = new List <Item>();
            Item couteau = new arme("couteau");

            item.Add(couteau);
        }
Exemplo n.º 2
0
        public Equipement()
        {
            equipement = new Item[3];
            string name = "vide";
            Item   arme = new arme(name);

            addEquip(arme);

            Item armure = new armure(name);

            addEquip(armure);

            Item chaussure = new chaussure(name);

            addEquip(chaussure);
        }
Exemplo n.º 3
0
        public Shop(Joueur heros)
        {
            item = new List <Item>();


            string name    = "diamant";
            Item   diamant = new armure(name);

            item.Add(diamant);

            name = "fer";
            Item fer = new armure(name);

            item.Add(fer);

            name = "sabrelaser";
            Item sabrelaser = new arme(name);

            item.Add(sabrelaser);

            name = "pistolet laser";
            Item pistoletlaser = new arme(name);

            item.Add(pistoletlaser);

            name = "converse";
            Item converse = new chaussure(name);

            item.Add(converse);

            name = "basket";
            Item basket = new chaussure(name);

            item.Add(basket);

            affShop();
            Vente(heros);
        }
Exemplo n.º 4
0
        public void loadSave()
        {
            String path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            using (StreamReader sr = new StreamReader(path + @"\load_save.txt"))
            {
                int    count = 0;
                string l1;
                sr.ReadLine();
                string[] tab = new string[8];
                while ((l1 = sr.ReadLine()) != null)
                {
                    tab[count] = l1;
                    count++;
                }
                lvl     = float.Parse(tab[0]);
                xp      = float.Parse(tab[1]);
                xp_save = float.Parse(tab[2]);
                x       = int.Parse(tab[3]);
                y       = int.Parse(tab[4]);
                symbole = tab[5];
                money   = float.Parse(tab[6]);
            }
            using (StreamReader sr = new StreamReader(path + @"\load_inventaire.txt"))
            {
                int    count = 0;
                string l1;
                string name;
                sr.ReadLine();
                while ((l1 = sr.ReadLine()) != null)
                {
                    name = l1;
                    if ((name == "couteau") || (name == "pistolet laser") || (name == "sabrelaser"))
                    {
                        Item item = new arme(name);
                        inv.addInventaire(item);
                    }
                    else if ((name == "fer") || (name == "diamant"))
                    {
                        Item item = new armure(name);
                        inv.addInventaire(item);
                    }
                    else if ((name == "basket") || (name == "converse"))
                    {
                        Item item = new chaussure(name);
                        inv.addInventaire(item);
                    }
                }
            }
            using (StreamReader sr = new StreamReader(path + @"\load_equip.txt"))
            {
                int    count = 0;
                string l1;
                string name;
                sr.ReadLine();
                while ((l1 = sr.ReadLine()) != null)
                {
                    name = l1;
                    if ((name == "couteau") || (name == "pistolet laser") || (name == "sabrelaser"))
                    {
                        Item item = new arme(name);
                        equip.equipement[1] = item;
                    }
                    else if ((name == "fer") || (name == "diamant"))
                    {
                        Item item = new armure(name);
                        equip.equipement[2] = item;
                    }
                    else if ((name == "basket") || (name == "converse"))
                    {
                        Item item = new chaussure(name);
                        equip.equipement[3] = item;
                    }
                }
            }
            atk   = (atk_base * (lvl + 1)) + equip.equipement[1].value;
            def   = (def_base * (lvl + 1)) + equip.equipement[0].value;
            speed = (speed_base * (lvl + 1)) + equip.equipement[2].value;
        }