Exemple #1
0
        public void DeckIndisponivelTest()
        {
            var combate = new Combate();

            combate.InicializarObjetos();
            Assert.AreNotEqual(true, combate.Deck1.Disponivel);
        }
 static void Main(string[] args)
 {
     Villano    Vil     = new Villano();
     Superheroe Super   = new Superheroe();
     Personaje  Ganador = new Personaje();
     Combate    Comb    = new Combate(Super, Vil, Ganador, 5);
 }
Exemple #3
0
        public void PreparaDeckTest()
        {
            var combate = new Combate();

            combate.InicializarObjetos();
            Assert.AreNotEqual(null, combate.Deck1);
        }
        private void siguienteTurno_Click(object sender, EventArgs e)
        {
            string s = "";

            Combate.Player_vs_Player(this.p1, this.p2, out s);

            if (!this.p2.ExisteNPC_Guitarra1)
            {
                this.groupBoxGuitarra1_2.Visible = false;
            }

            if (!this.p2.ExisteNPC_Guitarra2)
            {
                this.groupBoxGuitarra2_2.Visible = false;
            }

            if (!this.p2.ExisteNPC_Bajo)
            {
                this.groupBoxBajo_2.Visible = false;
            }

            if (!this.p2.ExisteNPC_Bateria)
            {
                this.groupBoxBateria_2.Visible = false;
            }

            if (!this.p2.ExisteNPC_Voz)
            {
                this.groupBoxVoz_2.Visible = false;
            }

            this.RefrescarForm();

            this.listBox.Items.Add(s);
        }
Exemple #5
0
        /// <summary>
        /// método que nos devuelve un listado de Combates
        /// </summary>
        /// <returns>lista de personas</returns>
        public List <Combate> getListadoCombates()
        {
            List <Combate> listaCombates = new List <Combate>();
            SqlDataReader  miLector;
            Combate        combate;

            try
            {
                conexion = miConexion.getConnection();
                //Creamos comandos
                miComando.CommandText = "select idCombate,fechaCombate from combates";
                miComando.Connection  = conexion;
                miLector = miComando.ExecuteReader();

                //Si hay lineas en el Lector
                while (miLector.Read())
                {
                    combate              = new Combate();
                    combate.idCombate    = (Int32)miLector["idCombate"];
                    combate.fechaCombate = (DateTime)miLector["fechaCombate"];

                    listaCombates.Add(combate);
                }//fin while
            }
            catch (SqlException sql) { throw sql; }


            return(listaCombates);
        }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        _gameController = FindObjectOfType <GameController>();
        _drop           = GetComponentInChildren <Drop>();
        _combate        = GetComponentInChildren <Combate>();
        if (_combate)
        {
            _combate._enemy = this;
        }
        anim = GetComponent <Animator>();

        //Cooldown next action
        restartFlightAttackCooldown();

        if (type == monsterType.voador || destroyOnLeaveScreen)
        {
            leftMargin  = GameObject.FindGameObjectWithTag("marginLeft").transform;
            rightMargin = GameObject.FindGameObjectWithTag("marginRight").transform;
        }

        if (type == monsterType.terrestre && !destroyOnLeaveScreen)
        {
            StartCoroutine(verifyDirection());
        }
    }
        static void Main(string[] args)
        {
            SuperHeroe Heroe = new SuperHeroe("IronMan", 1963, "Tales of Suspense", 100, new SuperPoder(), 2);

            Villano Villano = new Villano("Venom", 1984, "The Amazing Spiderman", 100);

            Combate Combate = new Combate(Heroe, Villano, 1);
        }
Exemple #8
0
        public void DeckDisponivelTest()
        {
            var combate = new Combate();

            combate.InicializarObjetos();
            combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo4 * 2);
            combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo4 * 3);
            Assert.AreNotEqual(false, combate.Deck1.Disponivel);
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Villano    Vil   = new Villano();
            Superheroe Super = new Superheroe();
            Combate    Comb  = new Combate(Super, Vil, 5);

            Super.Atacar(Vil);
            Vil.Atacar(Super);
        }
        static void Main(string[] args)
        {
            Villano    vil  = new Villano();
            Superheroe sup  = new Superheroe();
            Combate    comb = new Combate(sup, vil, 5);

            vil.Atacar(sup);
            sup.Atacar(vil);
        }
Exemple #11
0
        static void Main(string[] args)
        {
            Superpoder superfuerza = new Superpoder(true, 3);

            Superheroe ironman = new Superheroe("Iron Man", 1963, "Marvel", 100, 5, superfuerza);

            Villano thanos = new Villano("Thanos", 1973, "Marvel", 100);

            Combate combate = new Combate(ironman, thanos, ironman, 2);
        }
Exemple #12
0
        public void LancaDeckDisponivel()
        {
            var combate = new Combate();

            combate.InicializarObjetos();
            combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo1 * 2);
            combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo1 * 3);
            combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo1 * 4);
            combate.Ninja1.LancarItem(1f, combate.Deck1.GetItem());
            Assert.AreEqual(1, combate.Ninja1.ItensLancados.Count);
        }
Exemple #13
0
 private void BuscarCombateSalvaje()
 {
     foreach (Hierba hierba in mapa.Hierbas)
     {
         if (protagonista.CollisionsWith(hierba))
         {
             if (r.Next(1, 100) <= 5 ? true : false)
             {
                 Combate combate = new Combate(
                     ref protagonista, CargarPokemonSalvaje(), this);
                 SdlHardware.ResetScroll();
                 bgSound.StopMusic();
                 combate.Run();
                 bgSound.BackgroundPlay();
             }
         }
     }
 }
Exemple #14
0
 public void LancaDeckIndisponivel()
 {
     try
     {
         var combate = new Combate();
         combate.InicializarObjetos();
         combate.Deck1.VerificaDisponibilidade(Configuracao.TempoCartaTipo1 * 2);
         combate.Ninja1.LancarItem(1f, combate.Deck1.GetItem());
         if (combate.Ninja1.ItensLancados.Count > 0)
         {
             Assert.Fail();
         }
     }
     catch (JogadaInvalidaException)
     {
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
 public void SetCombate(Combate combate)
 {
     this.Combate = combate;
 }
 public Juego(bool resultado, int nivel, Combate combate)
 {
     this.Resultado = resultado;
     this.Nivel     = nivel;
     this.Combate   = combate;
 }
 private void Start()
 {
     hitbox = FindObjectOfType <Combate>();
 }
    // Update is called once per frame
    void Update()
    {
        //estado 1, combatiendo
        if (estado == 1) {
            // Debug.Log("1");

            //ejecutarCombate nos devuelve true si solo queda una ciudad viva
            combate.ejecutarCombate();
            turnos++;
            if (combate.combateTerminado()) {
                estado = 2;
                turnos=0;
            }
            if (turnos==1500){
                estado=2;
                turnos=0;
            }
            //Debug.Log("hola holita");
            //estado = 3;
        }
        //estado 2, transicion entre combates
        if (estado == 2) {
            //despejar el tablero
            //Debug.Log("estado 2");
            //graficosIni();

            Debug.Log("el numero del combate es: " + numCombate);
            if (numCombate > 15) {
                //reproduce
                estado = 3;
                numGeneracion++;
                numCombate = 0;
            }
            else {
                //combaten
                combate = new Combate(arr_ciudades[4 * numCombate], arr_ciudades[4 * numCombate + 1], arr_ciudades[4 * numCombate + 2], arr_ciudades[4 * numCombate + 3]);

                estado = 1;
                numCombate++;
            }

        }
        //estado 3, reproduccion
        if (estado == 3) {
            //seleccionar pareja a reproducir en funcion de fitness
            Debug.Log("toca reproducir");

            //ejecutar reproduccion
            arr_ciudades = Ciudad.ordenaArrCiudades(arr_ciudades);
            writeFile(numGeneracion);
            int[] fitnessAcumulado = new int[64];
            fitnessAcumulado[0] = arr_ciudades[0].getFitness();
            for (int i = 1; i < 64; i++) {
                fitnessAcumulado[i] = arr_ciudades[i].getFitness() + fitnessAcumulado[i - 1];
            }
            Ciudad[] nuevasCiudades = new Ciudad[16];
            int j;
            int k;
            for (int i = 0; i < 16; i++) {
                int valRandom = Random.Range(0, fitnessAcumulado[63]);
                Debug.Log(valRandom);
                j = 0;
                while (valRandom > fitnessAcumulado[j] && j < 64) {
                    j++;
                }
                k = 0;
                int valRandom2 = Random.Range(0, fitnessAcumulado[63]);
                bool quedate = true;
                while (quedate){
                    while (valRandom2 > fitnessAcumulado[k] && k < 64)
                    {
                        k++;
                    }
                    if (k != j){

                        quedate = false;
                    }
                    else
                    {
                        valRandom2 = Random.Range(0, fitnessAcumulado[63]);
                    }

                }

                nuevasCiudades[i] = arr_ciudades[j].reproducir(arr_ciudades[k], numGeneracion);
            }
            for (int i = 0; i < 16; i++) {
                arr_ciudades[i + 48] = nuevasCiudades[i];
            }
            arr_ciudades = randomizar(arr_ciudades);
            estado = 1;
            Debug.Log("acaba una generacion");

        }
        if (estado == 0) {
            Debug.Log("estado 0");
            estado = 2;
        }

        actualizarGraficos();
        /*
        for (int i = 0; i < 4; i++) {
            //ejecutarcombate(arr_ciudades[i]);
        }

            actualizarGraficos();*/
    }
        private void Form1_Load(object sender, EventArgs e)
        {
            frmCombate f = new frmCombate();
            f.Focus();
            com = new Combate(10,12,int.Parse(_noRounds),60,int.Parse(_tiempoRound));
            Detener.Enabled = false;

            int min = int.Parse(_tiempoRound) / 60;
            int seg = int.Parse(_tiempoRound) - (min * 60);
            txtCronometro.Text = min.ToString() + ":" + seg.ToString();
            txtRound.Text = com.round.ToString();
        }
 public Juego()
 {
     this.Resultado = false;
     this.Nivel     = 0;
     this.Combate   = new Combate();
 }
Exemple #21
0
 void Awake()
 {
     combat = GetComponent <Combate>();
 }
    // Update is called once per frame
    void Update()
    {
        //estado 1, combatiendo
        if (estado == 1)
        {
            // Debug.Log("1");

            //ejecutarCombate nos devuelve true si solo queda una ciudad viva
            combate.ejecutarCombate();
            turnos++;
            if (combate.combateTerminado())
            {
                estado = 2;
                turnos = 0;
            }
            if (turnos == 1500)
            {
                estado = 2;
                turnos = 0;
            }
            //Debug.Log("hola holita");
            //estado = 3;
        }
        //estado 2, transicion entre combates
        if (estado == 2)
        {
            //despejar el tablero
            //Debug.Log("estado 2");
            //graficosIni();


            Debug.Log("el numero del combate es: " + numCombate);
            if (numCombate > 15)
            {
                //reproduce
                estado = 3;
                numGeneracion++;
                numCombate = 0;
            }
            else
            {
                //combaten
                combate = new Combate(arr_ciudades[4 * numCombate], arr_ciudades[4 * numCombate + 1], arr_ciudades[4 * numCombate + 2], arr_ciudades[4 * numCombate + 3]);

                estado = 1;
                numCombate++;
            }
        }
        //estado 3, reproduccion
        if (estado == 3)
        {
            //seleccionar pareja a reproducir en funcion de fitness
            Debug.Log("toca reproducir");

            //ejecutar reproduccion
            arr_ciudades = Ciudad.ordenaArrCiudades(arr_ciudades);
            writeFile(numGeneracion);
            int[] fitnessAcumulado = new int[64];
            fitnessAcumulado[0] = arr_ciudades[0].getFitness();
            for (int i = 1; i < 64; i++)
            {
                fitnessAcumulado[i] = arr_ciudades[i].getFitness() + fitnessAcumulado[i - 1];
            }
            Ciudad[] nuevasCiudades = new Ciudad[16];
            int      j;
            int      k;
            for (int i = 0; i < 16; i++)
            {
                int valRandom = Random.Range(0, fitnessAcumulado[63]);
                Debug.Log(valRandom);
                j = 0;
                while (valRandom > fitnessAcumulado[j] && j < 64)
                {
                    j++;
                }
                k = 0;
                int  valRandom2 = Random.Range(0, fitnessAcumulado[63]);
                bool quedate    = true;
                while (quedate)
                {
                    while (valRandom2 > fitnessAcumulado[k] && k < 64)
                    {
                        k++;
                    }
                    if (k != j)
                    {
                        quedate = false;
                    }
                    else
                    {
                        valRandom2 = Random.Range(0, fitnessAcumulado[63]);
                    }
                }

                nuevasCiudades[i] = arr_ciudades[j].reproducir(arr_ciudades[k], numGeneracion);
            }
            for (int i = 0; i < 16; i++)
            {
                arr_ciudades[i + 48] = nuevasCiudades[i];
            }
            arr_ciudades = randomizar(arr_ciudades);
            estado       = 1;
            Debug.Log("acaba una generacion");
        }
        if (estado == 0)
        {
            Debug.Log("estado 0");
            estado = 2;
        }


        actualizarGraficos();

        /*
         * for (int i = 0; i < 4; i++) {
         *  //ejecutarcombate(arr_ciudades[i]);
         * }
         *
         *
         *  actualizarGraficos();*/
    }