Exemplo n.º 1
0
 //Aplicar polimorfismo
 public virtual string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
 {
     var dañoRecibido = victima.recibirDaño(this.dañoMecanico, this.dañoNoMecanico);
     Console.SetCursorPosition(0,27);
     Console.BackgroundColor = ConsoleColor.Black;
     Console.WriteLine(" ");
     Console.SetCursorPosition(0, 27);
     Console.BackgroundColor = ConsoleColor.DarkGreen;
     if (victima.hpActual <= 0)
     {
         bvictima.eliminarUnidad(mapa, victima);
     }
     return (this.GetType().Name + " (" + this.icono + ") " + " Ha hecho " + dañoRecibido + " de daño a " + victima.GetType().Name + " (" + victima.icono + ") " + "(HP=" + victima.hpActual + "/" + victima.hpInicial + ")");
 }
Exemplo n.º 2
0
        //Aplicar polimorfismo
        public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
        {
            if (this.TurnosParaUsarPoder > 0)
            {
                this.TurnosParaUsarPoder -= 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Debe esperar " + this.TurnosParaUsarPoder + " turnos más para usar habilidad");
            }

            //Uso de habilidad
            this.TurnosParaUsarPoder = this.enfriamiento * 1;
            int a = new Random().Next(0, 100);
            if (a < 60)
            {
                victima.bandera = this.bandera;
                return (this.GetType().Name + " (" + this.icono + ") " + " Neo-Wololeó a " + victima.GetType().Name + " (" + victima.icono + ") ");
            }
            return (this.GetType().Name + " (" + this.icono + ") " + " Trató de Neo-Wololear a " + victima.GetType().Name + " (" + victima.icono + ") " + " pero no pudo");
        }
Exemplo n.º 3
0
 //Aplicar polimorfismo
 public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
 {
     var dañoRecibido = victima.recibirDaño(this.dañoMecanico, this.dañoNoMecanico);
     Console.SetCursorPosition(0, 27);
     Console.BackgroundColor = ConsoleColor.Black;
     Console.WriteLine(" ");
     Console.SetCursorPosition(0, 27);
     Console.BackgroundColor = ConsoleColor.DarkGreen;
     if (victima.hpActual <= 0)
     {
         bvictima.eliminarUnidad(mapa, victima);
     }
     this.hpActual = -100;
     mapa.matrizTerrestre[this.posicion[0] - 1, this.posicion[1] - 1] = null;
     Console.ForegroundColor = ConsoleColor.Black;
     Console.SetCursorPosition(this.posicion[0], this.posicion[1]);
     Console.Write("·");
     return (this.GetType().Name + " (" + this.icono + ") " + " Ha hecho " + dañoRecibido + " de daño a " + victima.GetType().Name + " (" + victima.icono + ") " + "(HP=" + victima.hpActual + "/" + victima.hpInicial + ")");
 }
Exemplo n.º 4
0
        //Aplicar polimorfismo
        public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
        {
            var dañoRecibido = victima.recibirDaño(this.dañoMecanico, this.dañoNoMecanico);
            Console.SetCursorPosition(0, 27);
            Console.BackgroundColor = ConsoleColor.Black;
            Console.WriteLine(" ");
            Console.SetCursorPosition(0, 27);
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            if (victima.hpActual <= 0)
            {
                bvictima.eliminarUnidad(mapa, victima);
            }

            //Para empujar a la victima hacia atras:
            if (Math.Abs(this.posicion[0] - victima.posicion[0]) > Math.Abs(this.posicion[1] - victima.posicion[1])) //Cuando empuja en el eje x
            {
                if (this.posicion[0] > victima.posicion[0])
                {
                    int[] pos2 = {victima.posicion[0]-1, victima.posicion[1]};
                    victima.moverse(mapa, pos2);
                }
                else
                {
                    int[] pos2 = { victima.posicion[0] + 1, victima.posicion[1] };
                    victima.moverse(mapa, pos2);
                }
            }
            else // Cuando empuja en el eje y
            {
                if (this.posicion[1] > victima.posicion[1])
                {
                    int[] pos2 = { victima.posicion[0], victima.posicion[1]-1 };
                    victima.moverse(mapa, pos2);
                }
                else
                {
                    int[] pos2 = { victima.posicion[0], victima.posicion[1] + 1 };
                    victima.moverse(mapa, pos2);
                }
            }
            return (this.GetType().Name + " (" + this.icono + ") " + " Ha hecho " + dañoRecibido + " de daño a " + victima.GetType().Name + " (" + victima.icono + ") " + "(HP=" + victima.hpActual + "/"+victima.hpInicial+")");
        }
Exemplo n.º 5
0
 //Aplicar polimorfismo
 public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
 {
     if (this.TurnosParaUsarPoder > 0)
     {
         this.TurnosParaUsarPoder -= 1;
         return (this.GetType().Name + " (" + this.icono + ") " + " Debe esperar " + this.TurnosParaUsarPoder + " turnos más para curar");
     }
     victima.hpActual += 100;
     if (victima.hpActual > victima.hpInicial)
     {
         victima.hpActual = victima.hpInicial*1;
     }
     Console.SetCursorPosition(0, 27);
     Console.BackgroundColor = ConsoleColor.Black;
     Console.WriteLine(" ");
     Console.SetCursorPosition(0, 27);
     Console.BackgroundColor = ConsoleColor.DarkGreen;
     this.TurnosParaUsarPoder = this.enfriamiento * 1;
     return (this.GetType().Name + " (" + this.icono + ") " + " Ha sanado 100 HP a " + victima.GetType().Name + " (" + victima.icono + ") " + "(HP=" + victima.hpActual + "/" + victima.hpInicial + ")");
 }
Exemplo n.º 6
0
        //Aplicar polimorfismo
        public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
        {
            if (victima.bandera != this.bandera)
            {
                var dañoRecibido = victima.recibirDaño(this.dañoMecanico, this.dañoNoMecanico);

                if (victima.hpActual <= 0)
                {
                    bvictima.eliminarUnidad(mapa, victima);
                }
                return (this.GetType().Name + " (" + this.icono + ") " + " Ha hecho " + dañoRecibido + " de daño a " + victima.icono + "(HP=" + victima.hpActual + "/" + victima.hpInicial + ")");
            }

            if (this.TurnosParaUsarPoder > 0)
            {
                this.TurnosParaUsarPoder -= 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Debe esperar " + this.TurnosParaUsarPoder + " turnos más para usar habilidad");
            }

            //Uso de habilidad
            //int a = new Random().Next(1, 2);
            if (victima.hpInicial != victima.hpActual) //Reparar
            {
                victima.hpActual += 100;
                if (victima.hpActual > victima.hpInicial)
                {
                    victima.hpActual = victima.hpInicial * 1;
                }
                this.TurnosParaUsarPoder = this.enfriamiento * 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Ha reparado 100 HP a " + victima.GetType().Name + " (" + victima.icono + ") " + "(HP=" + victima.hpActual +"/"+victima.hpInicial+ ")");
            }
            else
            {
                victima.dañoMecanico += 15;
                victima.dañoNoMecanico += 15;
                this.TurnosParaUsarPoder = this.enfriamiento * 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Ha mejorado 15 de ataque a " + victima.GetType().Name + " (" + victima.icono + ") ");
            }
        }
Exemplo n.º 7
0
        //Aplicar polimorfismo
        public override string atacar(Unidad victima, Mapa mapa, Batallon bvictima, Batallon bAtacante)
        {
            if (this.TurnosParaUsarPoder > 0)
            {
                this.TurnosParaUsarPoder -= 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Debe esperar " + this.TurnosParaUsarPoder + " turnos más para usar habilidad");
            }

            //Uso de habilidad
            int a = new Random().Next(1, 2);
            if (a==1) //Velocidad
            {
                victima.velocidad /= 2;
                this.TurnosParaUsarPoder = this.enfriamiento * 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Ha hecho mas lento por 4 turnos a " + victima.GetType().Name + " (" + victima.icono + ") ");
            }
            else // Daño
            {
                victima.dañoMecanico /= 2;
                victima.dañoNoMecanico /= 2;
                this.TurnosParaUsarPoder = this.enfriamiento * 1;
                return (this.GetType().Name + " (" + this.icono + ") " + " Ha bajado el daño a la mitad a " + victima.GetType().Name + " (" + victima.icono + ") ");
            }
        }
Exemplo n.º 8
0
        public void prepararEstados()
        {
            Console.Title = "Zod-To vs Dr. Fadic";
            this.mapa = new Mapa();

            int[] posBase1 = { 3, 3 };
            int[] posBase2 = { 75, 20 };
            this.b1 = new Base(Guerra.bandos.azul, posBase1);
            mapa.cambiar(posBase1, b1);
            posBase1[0] += 1;
            mapa.cambiar(posBase1, b1);
            posBase1[1] += 1;
            mapa.cambiar(posBase1, b1);
            posBase1[0] -= 1;
            mapa.cambiar(posBase1, b1);

            this.b2 = new Base(Guerra.bandos.rojo, posBase2);
            mapa.cambiar(posBase2, b2);
            posBase2[0] += 1;
            mapa.cambiar(posBase2, b2);
            posBase2[1] += 1;
            mapa.cambiar(posBase2, b2);
            posBase2[0] -= 1;
            mapa.cambiar(posBase2, b2);

            Console.WriteLine("Bienvenido!\n (1) Para simular con un ejercito por defecto\n (2) Para crear un ejercito a tu gusto");
            var a = Console.ReadKey().KeyChar.ToString();
            Console.Clear();
            if (a == "1")
            {
                Console.WriteLine("Elija el tamaño de cada ejercito. 1-9");
                var b = Int32.Parse(Console.ReadKey().KeyChar.ToString());
                this.bat1 = new Batallon(mapa, Guerra.bandos.azul, b, b, b, b, b, b, b, b, b, b, b);
                this.bat2 = new Batallon(mapa, Guerra.bandos.rojo, b, b, b, b, b, b, b, b, b, b, b);
            }
            else
            {
                bool cont = true;
                int a1 = 0;
                int a2 = 0;
                int a3 = 0;
                int a4 = 0;
                int a5 = 0;
                int a6 = 0;
                int a7 = 0;
                int a8 = 0;
                int a9 = 0;
                int a10 = 0;
                int a11 = 0;

                while (cont)
                {
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.BackgroundColor = ConsoleColor.White;
                    Console.Clear();
                    Console.WriteLine("Elija la cantidad de cada tipo de tropa para el ejército azul.\n Presione cualquier otra tecla para continuar\n\n");
                    Console.WriteLine("(1) Terrestre Anti-aereo : " + a1);
                    Console.WriteLine("(2) Anti-infanteria : " + a2);
                    Console.WriteLine("(3) Bombardero : " + a3);
                    Console.WriteLine("(4) Aereo Anti-Aereo : " + a4);
                    Console.WriteLine("(5) Guerrero : " + a5);
                    Console.WriteLine("(6) Kamikaze : " + a6);
                    Console.WriteLine("(7) Arquero : " + a7);
                    Console.WriteLine("(8) Ingeniero : " + a8);
                    Console.WriteLine("(9) Medico : " + a9);
                    Console.WriteLine("(0) Groupie : " + a10);
                    Console.WriteLine("(-)Desmoralizador : " + a11);
                    var b = Console.ReadKey().KeyChar.ToString();
                    if (b == "1")
                    {
                        a1+=1;
                    }
                    else if (b == "2")
                    {
                        a2++;
                    }
                    else if (b == "3")
                    {
                        a3++;
                    }
                    else if (b == "4")
                    {
                        a4++;
                    }
                    else if (b == "5")
                    {
                        a5++;
                    }
                    else if (b == "6")
                    {
                        a6++;
                    }
                    else if (b == "7")
                    {
                        a7++;
                    }
                    else if (b == "8")
                    {
                        a8++;
                    }
                    else if (b == "9")
                    {
                        a9++;
                    }
                    else if (b == "0")
                    {
                        a10++;
                    }
                    else if (b == "-")
                    {
                        a11++;
                    }
                    else
                    {
                        cont = false;
                        this.bat1 = new Batallon(mapa, Guerra.bandos.azul, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
                    }
                }
                cont = true;
                a1 = 0;
                a2 = 0;
                a3 = 0;
                a4 = 0;
                a5 = 0;
                a6 = 0;
                a7 = 0;
                a8 = 0;
                a9 = 0;
                a10 = 0;
                a11 = 0;
                while (cont)
                {
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.BackgroundColor = ConsoleColor.White;
                    Console.Clear();
                    Console.WriteLine("Elija la cantidad de cada tipo de tropa para el ejército rojo.\n Presione cualquier otra tecla para continuar\n\n");
                    Console.WriteLine("(1) Terrestre Anti-aereo : " + a1);
                    Console.WriteLine("(2) Anti-infanteria : " + a2);
                    Console.WriteLine("(3) Bombardero : " + a3);
                    Console.WriteLine("(4) Aereo Anti-Aereo : " + a4);
                    Console.WriteLine("(5) Guerrero : " + a5);
                    Console.WriteLine("(6) Kamikaze : " + a6);
                    Console.WriteLine("(7) Arquero : " + a7);
                    Console.WriteLine("(8) Ingeniero : " + a8);
                    Console.WriteLine("(9) Medico : " + a9);
                    Console.WriteLine("(0) Groupie : " + a10);
                    Console.WriteLine("(-)Desmoralizador : " + a11);
                    var b = Console.ReadKey().KeyChar.ToString();
                    if (b == "1")
                    {
                        a1 += 1;
                    }
                    else if (b == "2")
                    {
                        a2++;
                    }
                    else if (b == "3")
                    {
                        a3++;
                    }
                    else if (b == "4")
                    {
                        a4++;
                    }
                    else if (b == "5")
                    {
                        a5++;
                    }
                    else if (b == "6")
                    {
                        a6++;
                    }
                    else if (b == "7")
                    {
                        a7++;
                    }
                    else if (b == "8")
                    {
                        a8++;
                    }
                    else if (b == "9")
                    {
                        a9++;
                    }
                    else if (b == "0")
                    {
                        a10++;
                    }
                    else if (b == "-")
                    {
                        a11++;
                    }
                    else
                    {
                        cont = false;
                        this.bat2 = new Batallon(mapa, Guerra.bandos.rojo, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
                    }
                }

            }

            mapa.mostrarMapa();
        }