Exemple #1
0
        private int CanAttackCharacter(Character character, Monster monster)
        {
            if (App.disabledRandom)
            {
                return(App.globalForcedRandomValue);
            }


            int DiceRoll = (monster.d10.Next() % 20) + 1;

            if (DiceRoll == 20)
            {
                return(2);
            }
            if (DiceRoll == 1)
            {
                return(0);
            }
            if ((DiceRoll + monster.attributes.defense + monster.attributes.level)
                > (character.attributes.level + character.ItemAttackModifier() + character.attributes.attack))
            {
                return(1);
            }
            return(0);
        }
Exemple #2
0
 //Calculates accuracy, taking into account speed stats, speed modifiers, and item speed values.
 public int CharacterAccuracy(Character character)
 {
     return(character.attributes.attack + character.ItemAttackModifier() + character.attributes.level + (character.d10.Next() % 20 + 1));
 }