Ejemplo n.º 1
0
 public Simulacion(Bitmons bitmons, Mapa mapa, int filas, int columnas, int meses)
 {
     InitializeComponent();
     this.bitmons  = bitmons;
     this.mapa     = mapa;
     this.filas    = filas;
     this.columnas = columnas;
     this.meses    = meses;
 }
Ejemplo n.º 2
0
 //para generar el mapa
 public void generarMapas(Mapa cMapa, Bitmons cBitmons)
 {
     for (int i = 0; i <= cMapa.Mterrenos.GetUpperBound(0); i++)
     {
         for (int j = 0; j <= cMapa.Mterrenos.GetUpperBound(1); j++)
         {
             Console.ForegroundColor = ConsoleColor.Black;
             string celda = "";
             foreach (Bitmon bitmon in cBitmons.bitmons_simulacion[i, j])
             {
                 celda += bitmon.especie[0].ToString() + bitmon.especie[1].ToString() + bitmon.especie[2].ToString();
             }
             while (celda.Count() <= 6)
             {
                 celda += " ";
             }
             celda = celda.Insert(3, ",");
             if (cMapa.Mterrenos[i, j].tipo == "Desierto")
             {
                 Console.BackgroundColor = ConsoleColor.Yellow;
                 Console.Write(celda);
             }
             else if (cMapa.Mterrenos[i, j].tipo == "Vegetacion")
             {
                 Console.BackgroundColor = ConsoleColor.Green;
                 Console.Write(celda);
             }
             else if (cMapa.Mterrenos[i, j].tipo == "Acuatico")
             {
                 Console.BackgroundColor = ConsoleColor.Blue;
                 Console.Write(celda);
             }
             else if (cMapa.Mterrenos[i, j].tipo == "Nieve")
             {
                 Console.BackgroundColor = ConsoleColor.White;
                 Console.Write(celda);
             }
             else if (cMapa.Mterrenos[i, j].tipo == "Volcan")
             {
                 Console.BackgroundColor = ConsoleColor.Red;
                 Console.Write(celda);
             }
         }
         Console.Write("\n");
     }
     Console.BackgroundColor = ConsoleColor.Black;
     Console.ForegroundColor = ConsoleColor.White;
 }
Ejemplo n.º 3
0
 //Para cada bitmon, revisa si se encuentra en un terreno que le haga daño
 public void Entorno(Mapa cMapa, Bitmons cBitmons)
 {
     for (int i = 0; i < cMapa.Mterrenos.GetUpperBound(0); i++)
     {
         for (int j = 0; j < cMapa.Mterrenos.GetUpperBound(1); j++)
         {
             foreach (Bitmon bitmon in cBitmons.bitmons_simulacion[i, j])
             {
                 string t = cMapa.Mterrenos[i, j].getTerreno();
                 if (bitmon.debilidad.Contains(t) && bitmon.especie == "")
                 {
                     bitmon.TiempoVida -= 2;
                 }
                 else
                 {
                     bitmon.TiempoVida -= 1;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        //configuracion inicial del mapa
        public void Spawn(Mapa mapa)
        {
            int filas    = mapa.Mterrenos.GetUpperBound(0) + 1;
            int columnas = mapa.Mterrenos.GetUpperBound(1) + 1;

            //creacion de arrays para los bitmons y terrenos del usuario
            bitmons_simulacion = new List <Bitmon> [filas, columnas];

            for (int i = 0; i < filas; i++)
            {
                for (int j = 0; j < columnas; j++)
                {
                    bitmons_simulacion[i, j] = new List <Bitmon> {
                    };
                }
            }

            while (true)
            {
                int f;
                int c;
                int t;

                Console.WriteLine("Generando mapa \n1.-Ingresar Bitmon \n2.-Continuar");
                if (Console.ReadLine() == "1")
                {
                    Console.WriteLine("Generando Bitmons, escoja fila y columna donde crear Bitmon:");
                    Console.Write("Fila: ");
                    string fs = Console.ReadLine();
                    int.TryParse(fs, out f);
                    while (f.ToString() != fs || f < 1 || f > filas)
                    {
                        Console.Write("Numero de fila fuera de rango \nFila: ");
                        fs = Console.ReadLine();
                        int.TryParse(fs, out f);
                    }
                    Console.Write("Columna: ");
                    string cs = Console.ReadLine();
                    int.TryParse(cs, out c);
                    while (c.ToString() != cs || c < 1 || c > columnas)
                    {
                        Console.Write("Numero de columna fuera de rango \nColumna: ");
                        cs = Console.ReadLine();
                        int.TryParse(cs, out c);
                    }
                    List <string> tipos = new List <string> {
                        "Taplan", "Wetar", "Gofue", "Dorvalo", "Doti", "Ent"
                    };
                    Console.WriteLine("Introduzca la clase de bitmon que desea:");
                    Console.WriteLine("1.-Taplan \n2.-Wetar \n3.-Gofue \n4.-Dorvalo \n5.-Doti \n6.-Ent");
                    string ts = Console.ReadLine();
                    int.TryParse(ts, out t);
                    while (t.ToString() != ts || t < 1 || t > 6)
                    {
                        Console.WriteLine("Introduzca clase de Bitmon valida:");
                        Console.WriteLine("1.-Taplan \n2.-Wetar \n3.-Gofue \n4.-Dorvalo \n5.-Doti \n6.-Ent");
                        ts = Console.ReadLine();
                        int.TryParse(ts, out t);
                    }

                    if ((mapa.Mterrenos[f - 1, c - 1].tipo != "Agua" && tipos[t - 1] == "Wetar") || bitmons_simulacion[f - 1, c - 1].Count() >= 2)
                    {
                        Console.WriteLine("No se puede introducir el bitmon");
                    }
                    else
                    {
                        Bitmon b = new Bitmon(tipos[t - 1]);
                        bitmons_simulacion[f - 1, c - 1].Add(b);
                        bitmons_s.Add(b);
                    }
                }
                else
                {
                    break;
                }
            }
        }
Ejemplo n.º 5
0
 //movimiento x mes para los bitmons
 public void movimientos(Mapa mapa)
 {
     List <Bitmon>[,] bit_mov = new List <Bitmon> [bitmons_simulacion.GetUpperBound(0) + 1, bitmons_simulacion.GetUpperBound(1) + 1];
     for (int i = 0; i <= bitmons_simulacion.GetUpperBound(0); i++)
     {
         for (int j = 0; j <= bitmons_simulacion.GetUpperBound(1); j++)
         {
             bit_mov[i, j] = new List <Bitmon> {
             };
         }
     }
     for (int i = 0; i <= bitmons_simulacion.GetUpperBound(0); i++)
     {
         for (int j = 0; j <= bitmons_simulacion.GetUpperBound(1); j++)
         {
             foreach (Bitmon bitmon in bitmons_simulacion[i, j])
             {
                 if (RevisarAlrededores(bit_mov, i, j))
                 {
                     if (bitmon.especie == "Wetar")
                     {
                         int m = 1;
                         while (m > 0)
                         {
                             int m1 = rnd.Next(-1, 2);
                             int m2 = rnd.Next(-1, 2);
                             try
                             {
                                 if (bitmon.especie == "Wetar" && mapa.Mterrenos[i + m1, j + m2].getTerreno() == "Acuatico" && bit_mov[i + m1, j + m2].Count() < 2)
                                 {
                                     bit_mov[i + m1, j + m2].Add(bitmon);
                                 }
                                 m -= 1;
                             }
                             catch
                             {
                                 continue;
                             }
                         }
                     }
                     else if (bitmon.especie == "Dorvalo")
                     {
                         int m = 2;
                         while (m > 0)
                         {
                             int m1 = rnd.Next(-1, 2);
                             int m2 = rnd.Next(-1, 2);
                             try
                             {
                                 if (bit_mov[i + m1, j + m2].Count() < 2)
                                 {
                                     if (RevisarAlrededores(bit_mov, i + m1, j + m2))
                                     {
                                         while (true)
                                         {
                                             int m3 = rnd.Next(-1, 2);
                                             int m4 = rnd.Next(-1, 2);
                                             try
                                             {
                                                 if (bit_mov[i + m1 + m3, j + m2 + m4].Count() < 2)
                                                 {
                                                     bit_mov[i + m1 + m3, j + m2 + m4].Add(bitmon);
                                                     break;
                                                 }
                                             }
                                             catch { }
                                         }
                                         break;
                                     }
                                     else
                                     {
                                         bit_mov[i + m1, j + m2].Add(bitmon);
                                         break;
                                     }
                                 }
                                 else
                                 {
                                     break;
                                 }
                             }
                             catch
                             {
                                 continue;
                             }
                         }
                     }
                     else if (bitmon.especie == "Ent")
                     {
                         bit_mov[i, j].Add(bitmon);
                     }
                     else
                     {
                         int m = 1;
                         while (m > 0)
                         {
                             int m1 = rnd.Next(-1, 2);
                             int m2 = rnd.Next(-1, 2);
                             try
                             {
                                 if (bit_mov[i + m1, j + m2].Count() < 2)
                                 {
                                     bit_mov[i + m1, j + m2].Add(bitmon);
                                     m -= 1;
                                 }
                             }
                             catch
                             {
                                 continue;
                             }
                         }
                     }
                 }
                 else
                 {
                     bit_mov[i, j].Add(bitmon);
                     continue;
                 }
             }
         }
     }
     bitmons_simulacion = bit_mov;
 }
Ejemplo n.º 6
0
 //movimiento x mes para los bitmons
 public void movimientos(Mapa mapa)
 {
     List <Bitmon>[,] bit_mov = new List <Bitmon> [bitmons_simulacion.GetUpperBound(0) + 1, bitmons_simulacion.GetUpperBound(1) + 1];
     for (int i = 0; i <= bitmons_simulacion.GetUpperBound(0); i++)
     {
         for (int j = 0; j <= bitmons_simulacion.GetUpperBound(0); j++)
         {
             bit_mov[i, j] = new List <Bitmon> {
             };
         }
     }
     for (int i = 0; i <= bitmons_simulacion.GetUpperBound(0); i++)
     {
         for (int j = 0; j <= bitmons_simulacion.GetUpperBound(0); j++)
         {
             foreach (Bitmon bitmon in bitmons_simulacion[i, j])
             {
                 if (bitmon.especie == "Wetar")
                 {
                     int m = 1;
                     while (m > 0)
                     {
                         int m1 = rnd.Next(-1, 2);
                         int m2 = rnd.Next(-1, 2);
                         try
                         {
                             if (bitmon.especie == "Wetar" && mapa.Mterrenos[i + m1, j + m2].getTerreno() == "Agua" && bitmons_simulacion[i + m1, j + m2].Count() < 2 && bit_mov[i + m1, j + m2].Count() < 2)
                             {
                                 bit_mov[i + m1, j + m2].Add(bitmon);
                             }
                             m -= 1;
                         }
                         catch
                         {
                             continue;
                         }
                     }
                 }
                 else if (bitmon.especie == "Dorvalo")
                 {
                     int m = 2;
                     while (m > 0)
                     {
                         int m1 = rnd.Next(-1, 2);
                         int m2 = rnd.Next(-1, 2);
                         try
                         {
                             if (mapa.Mterrenos[i + m1, j + m2].getTerreno() != "Acuatico" && bitmons_simulacion[i + m1, j + m2].Count() < 2 && bit_mov[i + m1, j + m2].Count() < 2)
                             {
                                 bit_mov[i + m1, j + m2].Add(bitmon);
                             }
                             m -= 1;
                         }
                         catch
                         {
                             continue;
                         }
                     }
                 }
                 else if (bitmon.especie == "Ent")
                 {
                     bit_mov[i, j].Add(bitmon);
                 }
                 else
                 {
                     int m = 1;
                     while (m > 0)
                     {
                         int m1 = rnd.Next(-1, 2);
                         int m2 = rnd.Next(-1, 2);
                         try
                         {
                             if (bitmons_simulacion[i + m1, j + m2].Count() < 2 && bit_mov[i + m1, j + m2].Count() < 2)
                             {
                                 bit_mov[i + m1, j + m2].Add(bitmon);
                                 m -= 1;
                             }
                             Console.ReadKey();
                         }
                         catch
                         {
                             continue;
                         }
                     }
                 }
             }
         }
     }
     bitmons_simulacion = bit_mov;
 }