예제 #1
0
        public override int Passive() //Retorna um inteiro que será o multiplicador de quantas vezes a skill será castada
        {
            int multicastchance = RandomElement.Limiter(0, 100);

            if (multicastchance <= 10)
            {
                return(5);
            }

            if (multicastchance <= 20)
            {
                return(4);
            }

            if (multicastchance <= 30)
            {
                return(3);
            }

            if (multicastchance <= 40)
            {
                return(2);
            }

            return(1);
        }
        /// <summary>
        /// Simula el tiempo de preparación de los pedidos entre 4 y 7 segundos
        /// Actualiza los rtxt correspondientes
        /// </summary>
        private void Preparar()
        {
            try
            {
                //preparo constantemente
                while (true)
                {
                    Thread.Sleep(1000);
                    if (Comercio.PedidosEnPreparacion.Count > 0)
                    {
                        Comercio.Preparar();

                        if (this.rtxt_EnPreparacion.InvokeRequired)
                        {
                            this.rtxt_EnPreparacion.BeginInvoke((MethodInvoker) delegate()
                            {
                                this.rtxt_EnPreparacion.Text = string.Empty;
                                foreach (Pedido item in Comercio.PedidosEnPreparacion)
                                {
                                    this.rtxt_EnPreparacion.Text += item.ToString();
                                }
                            });
                        }
                        if (this.rtxt_ListosParaRetirar.InvokeRequired)
                        {
                            this.rtxt_ListosParaRetirar.BeginInvoke((MethodInvoker) delegate()
                            {
                                this.rtxt_ListosParaRetirar.Text = string.Empty;
                                foreach (Pedido item in Comercio.PedidosListosParaRetirar)
                                {
                                    this.rtxt_ListosParaRetirar.Text += item.ToString();
                                }
                            });
                        }
                    }
                    Thread.Sleep(RandomElement.TiempoPreparacionRandom());
                }
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show(ex.Message,
                                "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                ex.Guardar();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message,
                                "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                e.Guardar();
            }
        }
예제 #3
0
    void FormEnemyQueue()
    {
        int cursor = 0;

        for (int i = 0; i < enemyTanks.Length; i++)
        {
            for (int j = 0; j < enemyTanks[i]; j++)
            {
                enemyQueue[cursor++] = i;
            }
        }
        RandomElement.Shuffle(enemyQueue);

        for (int i = 0; i < prizePerBattle; i++)
        {
            prizeQueue[i] = true;
        }
        for (int i = prizePerBattle; i < totalEnemy; i++)
        {
            prizeQueue[i] = false;
        }
        RandomElement.Shuffle(prizeQueue);
    }
예제 #4
0
 public int Skill3()
 {
     return(RandomElement.Limiter(0, 10) > 8 ? Damage : 3 * Damage); // GRANDE CHANCE DE TER DANO TRIPLICADO
 }
예제 #5
0
 public int Skill2()
 {
     return(RandomElement.Limiter(0, 5) > 3 ? Damage : 2 * Damage); // MEDIA CHANCE DE TER DANO DOBRADO
 }
예제 #6
0
    private void SelectDirection(bool mustChange)
    {
        float[] directChance = { 0.1f, 0.45f, 0.2f, 0.2f };

        if (System.Math.Abs(transform.position.x) < Mathf.Epsilon)
        {
            directChance[0] = 0.1f;
            directChance[1] = 0.45f;
            directChance[2] = 0.2f;
            directChance[3] = 0.2f;
        }
        else if (transform.position.x < 0)
        {
            directChance[2] = 0.15f;
            directChance[3] = 0.25f;
            if (transform.position.x < -2.75f)
            {
                directChance[2] = 0f;
            }
        }
        else if (transform.position.x > 0)
        {
            directChance[2] = 0.25f;
            directChance[3] = 0.15f;
            if (transform.position.x > -2.75f)
            {
                directChance[3] = 0f;
            }
        }
        if (transform.position.y < -2.75f)
        {
            directChance[1] = 0;
        }
        else if (transform.position.y > 2.75f)
        {
            directChance[0] = 0;
        }

        if (mustChange)
        {
            print("must change direction");
            if (moveDirection == Vector2.up)
            {
                directChance[0] = 0f;
            }
            else if (moveDirection == Vector2.down)
            {
                directChance[1] = 0f;
            }
            else if (moveDirection == Vector2.left)
            {
                directChance[2] = 0f;
            }
            else
            {
                directChance[3] = 0f;
            }
        }

        Vector2[] directChoice = { Vector2.up, Vector2.down, Vector2.left, Vector2.right };
        moveDirection = directChoice[RandomElement.Choose(directChance)];

        if (moveDirection == Vector2.up)
        {
            rigidbody2d.rotation = 0f;
        }
        else if (moveDirection == Vector2.down)
        {
            rigidbody2d.rotation = 180f;
        }
        else if (moveDirection == Vector2.left)
        {
            rigidbody2d.rotation = 90f;
        }
        else if (moveDirection == Vector2.right)
        {
            rigidbody2d.rotation = -90f;
        }

        Vector2 position = rigidbody2d.position;

        position.x = Mathf.RoundToInt(position.x / smallestGrid) * smallestGrid;
        position.y = Mathf.RoundToInt(position.y / smallestGrid) * smallestGrid;
        rigidbody2d.MovePosition(position);

        directionChangeTimer = 0;
    }
예제 #7
0
        public bool CountCritic()
        {
            int criticCalc = RandomElement.Limiter(0, 100);

            return(criticCalc <= CriticRate);
        }