def attack( self, toHit ): #ac, profBonus, abilityBonus, advantage, damDiceNum, damDiceSize, critMult #d20=d.Dice.rolls(1,20,e.Enemy.getProfBonus(self)+e.Enemy.getAbilityMod(self)) d20 = d.rolls(1, 20) self.profBonus = str(e.getProfBonus(self)) print("Proficiency Bonus: " + self.profBonus) self.abilityMod = str(e.getAbilityMod(self)) print("Ability Modifier: " + self.abilityMod) #print("Ability Modifier: {}".format(e.getAbilityMod(self))) print("D20: {}".format(d20)) total = 0 if d20 == 1: total = "critical miss!" elif d20 == 20: total = "critical hit!" else: total = d20 + e.getProfBonus(self) + e.getAbilityMod(self) if total < toHit: print("Miss!") else: print("Hit!") print("Total: {}".format(total))
def workhorse(): from Dice import Dice d = Dice() roll = (d.rolls(1, 20)) if roll == 20: print(str(roll) + "\nCritical hit!") damage = d.rolls(w1.damage_dice[0] * 5, w1.damage_dice[1]) print(str(damage) + " point(s) of " + w1.type + " damage.") elif roll >= 15: print(roll) print("You hit with a " + w1.name + "!") damage = d.rolls(w1.damage_dice[0], w1.damage_dice[1]) print(str(damage) + " point(s) of " + w1.type + " damage.") else: print(roll) print("You missed!")
def damage(self, x, y, z, c): damagePoints = d.rolls(x * c, y, z) #print(damagePoints) return damagePoints