Exemplo n.º 1
0
        public bool isEffectSuccessful(PokeEntity attacker, Move move)
        {
            float threshold = move.EffectChance; // Anything less

            if (threshold == 0)
            {
                return(true);
            }

            Random rand = new Random();
            float  r    = rand.Next(101);

            System.Console.WriteLine($"EFFECT: {move.StatChangeName} : {move.StatChangeValue}");
            return(r <= threshold);
        }
Exemplo n.º 2
0
        public bool isAttackDodged(PokeEntity attacker, Move move) // WE are the defender/dodger
        {
            // Since our data is Gen III+ use formular for Gen III Onward -- for more info: https://bulbapedia.bulbagarden.net/wiki/Statistic#Accuracy_and_evasion
            var   defenderEvasionMultiplier  = this.Stats.Skills["evasion"].StageMultiplier;
            var   attackerAccuracyMultiplier = attacker.Stats.Skills["accuracy"].StageMultiplier;
            float adjustedStages             = defenderEvasionMultiplier - attackerAccuracyMultiplier;
            float threshold = (move.Accuracy * adjustedStages);

            if (threshold >= 75)
            {
                threshold = 75;
            }
            //Select a random number 'r' from 1 to 255 (inclusive) and compare it to 'threshold' to determine if move hits
            Random rand = new Random();
            float  r    = rand.Next(1, 101);

            return(r <= threshold);
        }