예제 #1
0
    def SkillCheck(
        self, skill, ability, DC
    ):  #I even made a method to allow auto implementation of a single skill check. It uses the d20 method.

        roll = Dice(1, 20, skill.mod + ability.mod)

        if (roll.Check(DC) == True):

            return True  #It rings true if the character is successful.

        else:

            return False  #Otherwise it is falseself.
예제 #2
0
    def Attack(
        self, other, ability
    ):  #attack was a bit hard to name, since it could mean the attack value.

        roll = Dice(1, 20, self.attack + ability.mod)

        if (
                roll.Check(other.ac) == True
        ):  #In this case, the character is literally attacking another. Bonuses are dictated by the weapon equipped.

            self.Damage(
                other
            )  #if the attack hits, damage is rolled. What that damage is can be static or a die roll. This system tries to be flexable.

            return True

        else:

            return False  #Of course, failure results in nada; you deal damage only if you hit. Exceptions can be made in other functions.