public bool TryHit(Living target)              //is there still a distinction between dodge and miss?
        {
            double hitChance   = HitChance();          // Example: 0.7
            double dodgeChance = target.DodgeChance(); // Example: 0.3

            Debug.WriteLine("(2.5 / (System.Math.Sqrt(36 + creatureLevel + target.creatureLevel))) * (hitChance / dodgeChance)");
            Debug.WriteLine("2.5 / sqrt(36 +" + creatureLevel + " + " + target.creatureLevel + ") * (" + hitChance + " / " + dodgeChance + ")");
            Debug.WriteLine((2.5 / (System.Math.Sqrt(36 + creatureLevel + target.creatureLevel))) * (hitChance / dodgeChance)); // example: (0.5/(sqrt(1+1)) * (0.7/0.3) = 0.82
            return((0.5 / (System.Math.Sqrt(creatureLevel + target.creatureLevel))) * (hitChance / dodgeChance) > GameEnvironment.Random.NextDouble());
        }
Exemplo n.º 2
0
        private void triggerdTrap(Living victim)
        {
            //not taking armor in to account
            if (victim.DodgeChance() >= GameEnvironment.Random.Next(100))
            {
                victim.Health -= 10;
            }

            //taking armor in to account
            //victim.TakeDamage(trapStrength, damageType);

            triggered = true;
        }