Пример #1
0
        public Room(int x, int y)
        {
            int level = Program.ObteJuego().GetLevel();

            this.x = x;
            this.y = y;
            descr  = FileReader.RandomDescr("Text/roomDescr.txt");
            if (!(x == 0 && y == 0))
            {
                double prob = (level < 4) ? 0.1 + 0.3 * level / 4d : 0.4;
                if (CustomMath.RandomUnit() < prob)
                {
                    ene = new Enemigo(Enemigo.eneList[CustomMath.RandomIntNumber(Enemigo.eneList.Length - 1)], (int)Math.Pow(level, 1.2));
                }

                if (CustomMath.RandomUnit() < 0.02)
                {
                    if (CustomMath.RandomUnit() < 0.5)
                    {
                        item[0] = new ItemPocion("Poción de vida", CustomMath.RandomIntNumber(75, 50), ItemPocion.PocionType.hp);
                    }
                    else
                    {
                        item[0] = new ItemPocion("Poción de mana", CustomMath.RandomIntNumber(75, 50), ItemPocion.PocionType.mana);
                    }
                }
            }
        }
Пример #2
0
        public Room(int x, int y)
        {
            int level = Program.GetLevel();

            this.x = x;
            this.y = y;
            descr  = FileReader.RandomDescr("Text/roomDescr.txt");
            if (!(x == 0 && y == 0))
            {
                if (CustomMath.RandomUnit() < 0.0375)
                {
                    if (CustomMath.RandomUnit() < 0.5)
                    {
                        item[0] = new ItemPocion("Poción de vida", CustomMath.RandomIntNumber(75, 50), ItemPocion.PocionType.hp);
                    }
                    else
                    {
                        item[0] = new ItemPocion("Poción de mana", CustomMath.RandomIntNumber(75, 50), ItemPocion.PocionType.mana);
                    }
                }
            }
        }
Пример #3
0
        public static bool LookAtBag()
        {
            Item[] bag = Program.ObteJuego().pl.GetBag();
            for (int i = 0; i < bag.Length; i++)
            {
                int ii = i;
                int x  = 0;
                if (ii >= 5)
                {
                    ii -= 5;
                    x   = 1;
                }
                if (bag[i] != null)
                {
                    if (bag[i].GetType().BaseType == typeof(ItemEquipable))
                    {
                        ItemEquipable equipo = (ItemEquipable)bag[i];
                        ConsoleBuffer.ObteBuffer().Print(1 + 50 * x, 2 + ii * 3, equipo.GetName());
                        string texto = "";
                        if (equipo.ModifierHp() < 0)
                        {
                            texto += "HP(" + equipo.ModifierHp() + ") ";
                        }
                        else
                        {
                            texto += "HP(+" + equipo.ModifierHp() + ") ";
                        }

                        if (equipo.ModifierAtt() < 0)
                        {
                            texto += "ATT(" + equipo.ModifierAtt() + ") ";
                        }
                        else
                        {
                            texto += "ATT(+" + equipo.ModifierAtt() + ") ";
                        }

                        if (equipo.ModifierDef() < 0)
                        {
                            texto += "DEF(" + equipo.ModifierDef() + ") ";
                        }
                        else
                        {
                            texto += "DEF(+" + equipo.ModifierDef() + ") ";
                        }

                        ConsoleBuffer.ObteBuffer().Print(5 + 50 * x, 3 + ii * 3, texto);
                    }
                    else if (bag[i].GetType() == typeof(ItemPocion))
                    {
                        ItemPocion consumable = (ItemPocion)bag[i];
                        ConsoleBuffer.ObteBuffer().Print(1 + 50 * x, 2 + ii * 3, consumable.GetName());
                        if (consumable.GetPocionType() == ItemPocion.PocionType.hp)
                        {
                            ConsoleBuffer.ObteBuffer().Print(1 + 50 * x, 3 + ii * 3, "    +" + consumable.GetFlatCant().ToString() + "% HP");
                        }
                        else
                        {
                            ConsoleBuffer.ObteBuffer().Print(1 + 50 * x, 3 + ii * 3, "    +" + consumable.GetFlatCant().ToString() + "% Mana");
                        }
                    }
                    else
                    {
                        ConsoleBuffer.ObteBuffer().Print(1 + 50 * x, 2 + ii * 3, bag[i].GetName());
                    }
                }
            }
            ConsoleBuffer.ObteBuffer().PrintBackground();
            ConsoleBuffer.ObteBuffer().Print(1, ConsoleBuffer.ObteBuffer().height - 2, "Pulsa cualquier boton para salir");
            ConsoleBuffer.ObteBuffer().Print(1, 0, "MOCHILA");
            ConsoleBuffer.ObteBuffer().SmallMap();
            ConsoleBuffer.ObteBuffer().PrintScreen();
            Console.ReadKey();
            return(true);
        }
Пример #4
0
        public static bool LookAtBag()
        {
            Item[] bag = Program.pl.GetBag();
            for (int i = 0; i < bag.Length; i++)
            {
                int ii = i;
                int x  = 0;
                if (ii >= 5)
                {
                    ii -= 5;
                    x   = 1;
                }
                if (bag[i] != null)
                {
                    if (bag[i].GetType() == typeof(ItemArmor))
                    {
                        ItemArmor equipo = (ItemArmor)bag[i];
                        Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName());
                        string texto = "";
                        if (equipo.ModifierHp() < 0)
                        {
                            texto += "HP(" + equipo.ModifierHp() + ") ";
                        }
                        else
                        {
                            texto += "HP(+" + equipo.ModifierHp() + ") ";
                        }

                        if (equipo.ModifierDef() < 0)
                        {
                            texto += "DEF(" + equipo.ModifierDef() + ") ";
                        }
                        else
                        {
                            texto += "DEF(+" + equipo.ModifierDef() + ") ";
                        }

                        if (equipo.GetAvoidPercInt() < 0)
                        {
                            texto += "DEF PROB.(" + equipo.GetAvoidPercInt() + ")";
                        }
                        else
                        {
                            texto += "DEF PROB.(+" + equipo.GetAvoidPercInt() + ")";
                        }

                        Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto);
                    }
                    else if (bag[i].GetType() == typeof(ItemWeapon))
                    {
                        ItemWeapon equipo = (ItemWeapon)bag[i];
                        Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName());
                        string texto = "";
                        if (equipo.ModifierAtt() < 0)
                        {
                            texto += "ATT(" + equipo.ModifierAtt() + ") ";
                        }
                        else
                        {
                            texto += "ATT(+" + equipo.ModifierAtt() + ") ";
                        }

                        if (equipo.ModifierAttM() < 0)
                        {
                            texto += "ATT M.(" + equipo.ModifierAttM() + ") ";
                        }
                        else
                        {
                            texto += "ATT M.(+" + equipo.ModifierAttM() + ") ";
                        }

                        if (equipo.GetHitPercInt() < 0)
                        {
                            texto += "ATT PROB.(" + equipo.GetHitPercInt() + ")";
                        }
                        else
                        {
                            texto += "ATT PROB.(+" + equipo.GetHitPercInt() + ")";
                        }

                        Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto);
                    }
                    else if (bag[i].GetType() == typeof(ItemGema))
                    {
                        ItemGema equipo = (ItemGema)bag[i];
                        Program.buffer.Print(1 + 50 * x, 2 + ii * 3, equipo.GetName());
                        string texto = "";
                        if (equipo.ModifierHp() < 0)
                        {
                            texto += "HP(" + equipo.ModifierHp() + ") ";
                        }
                        else
                        {
                            texto += "HP(+" + equipo.ModifierHp() + ") ";
                        }

                        if (equipo.ModifierAttM() < 0)
                        {
                            texto += "ATT M.(" + equipo.ModifierAttM() + ") ";
                        }
                        else
                        {
                            texto += "ATT M.(+" + equipo.ModifierAttM() + ") ";
                        }

                        if (equipo.ModifierManaM() < 0)
                        {
                            texto += "MANA M.(" + equipo.ModifierManaM() + ")";
                        }
                        else
                        {
                            texto += "MANA M.(+" + equipo.ModifierManaM() + ")";
                        }

                        Program.buffer.Print(5 + 50 * x, 3 + ii * 3, texto);
                    }
                    else if (bag[i].GetType() == typeof(ItemPocion))
                    {
                        ItemPocion consumable = (ItemPocion)bag[i];
                        Program.buffer.Print(1 + 50 * x, 2 + ii * 3, consumable.GetName());
                        if (consumable.GetPocionType() == ItemPocion.PocionType.hp)
                        {
                            Program.buffer.Print(1 + 50 * x, 3 + ii * 3, "    +" + consumable.GetFlatCant().ToString() + "% HP");
                        }
                        else
                        {
                            Program.buffer.Print(1 + 50 * x, 3 + ii * 3, "    +" + consumable.GetFlatCant().ToString() + "% Mana");
                        }
                    }
                    else
                    {
                        Program.buffer.Print(1 + 50 * x, 2 + ii * 3, bag[i].GetName());
                    }
                }
            }
            Program.buffer.PrintBackground();
            Program.buffer.Print(1, Program.buffer.height - 2, "Pulsa cualquier boton para salir");
            Program.buffer.Print(1, 0, "MOCHILA");
            Program.SmallMap();
            Program.buffer.PrintScreen();
            Console.ReadKey();
            return(true);
        }
Пример #5
0
        public void Effect()
        {
            if (hasEffect)
            {
                do
                {
                    int    efecto = CustomMath.RandomIntNumber(3);
                    Player pl     = Program.pl;
                    if (efecto == 0)
                    {
                        List <int> r = new List <int>();
                        for (int i = 0; i < pl.GetArrMal().Length; i++)
                        {
                            if (pl.GetArrMal()[i] != null)
                            {
                                r.Add(i);
                            }
                        }
                        if (r.Count > 0)
                        {
                            Program.buffer.InsertText("Al rezar, sientes como tu cuerpo se siente mas ligero");
                            int temp = CustomMath.RandomIntNumber(r.Count - 1);
                            Program.buffer.InsertText("¡La " + pl.GetArrMal()[r[temp]].GetName() + " ha desaparecido!");
                            pl.GetArrMal()[r[temp]] = null;
                            hasEffect = false;
                        }
                    }
                    else if (efecto == 1)
                    {
                        Item item;

                        if (CustomMath.RandomUnit() < 0.75)
                        {
                            if (CustomMath.RandomUnit() < 0.5)
                            {
                                item = new ItemPocion("Gran poción de Vida", 100, ItemPocion.PocionType.hp);
                            }
                            else
                            {
                                item = new ItemPocion("Gran poción de Maná", 100, ItemPocion.PocionType.mana);
                            }
                        }
                        else
                        {
                            double prob = CustomMath.RandomUnit();
                            if (prob < 0.5)
                            {
                                item = new ItemScroll("Pergamino de visión", 0);
                            }
                            else
                            {
                                item = new ItemScroll("Pergamino de salida", 1);
                            }
                        }

                        if (!pl.FilledBag())
                        {
                            pl.GetItem(item);
                            Program.buffer.InsertText("Un objeto ha aparecido en tu mochila");
                            hasEffect = false;
                        }
                        else if (GetItem(item))
                        {
                            Program.buffer.InsertText("Ha aparecido un objeto en la sala");
                            hasEffect = false;
                        }
                    }
                    else if (efecto == 2)
                    {
                        Program.buffer.InsertText("Los ojos los tienes más despiertos y eres capaz de ver en la oscuridad");
                        hasEffect = false;
                        List <Room> r = Program.lvlLayout;
                        for (int i = 0; i < r.Count; i++)
                        {
                            if (r[i].IsVisible() == 0)
                            {
                                r[i].SetVisible(3);
                            }
                        }
                        if (pl.GetMaldicion(4))
                        {
                            for (int i = 0; i < pl.GetArrMal().Length; i++)
                            {
                                if (pl.GetArrMal()[i].GetId() == 4)
                                {
                                    pl.GetArrMal()[i] = null;
                                    i = pl.GetArrMal().Length;
                                    Program.buffer.InsertText("¡Has perdido la Maldición del ciego!");
                                }
                            }
                        }
                    }
                    else if (efecto == 3 && CustomMath.RandomUnit() < 0.5)
                    {
                        for (int i = 0; i < pl.GetArrMal().Length; i++)
                        {
                            pl.GetArrMal()[i] = null;
                        }

                        pl.ExcesoMaldito = 0;
                        pl.RestoreHealth();
                        pl.RestoreMana();
                        Program.buffer.InsertText("¡Tu cuerpo se siente renacido!");
                        Program.buffer.InsertText("¡Has recuperado toda la vida!");
                        Program.buffer.InsertText("¡Has recuperado todo el maná!");
                        Program.buffer.InsertText("¡Todas las maldiciones se han desvanecido!");
                        hasEffect = false;
                    }
                } while (hasEffect);
            }
        }