def stealth_attack(self): if(self.stealth_flag == False): damage = (dice.d8(1) + dice.d8(1) + dice.d8(1)) + \ self.strMod + self.dexMod else: damage = 0 return damage
def __init__(self, name): pt.Character.__init__(self, name, class_type='Rogue', hitdice=dice.d8(), prof_saves={ 'dex': 1, 'int': 1 })
def __init__(self, name): pt.Character.__init__(self, name, class_type='Monk', hitdice=dice.d8(), prof_saves={ 'str': 1, 'dex': 1 })
def __init__(self, name): pt.Character.__init__(self, name, class_type='Bard', hitdice=dice.d8(), prof_saves={ 'dex': 1, 'cha': 1 }, non_prof_mod=0.5, cantrips_by_lvl={ 1: 2, 2: 2, 3: 2, 4: 3, 5: 3, 6: 3, 7: 3, 8: 3, 9: 3, 10: 4, 11: 4, 12: 4, 13: 4, 14: 4, 15: 4, 16: 4, 17: 4, 18: 4, 19: 4, 20: 4 }, spells_by_lvl=caster_spell_slots, spells_slots={ 1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9, 7: 10, 8: 11, 9: 12, 10: 14, 11: 15, 12: 15, 13: 16, 14: 18, 15: 19, 16: 19, 17: 20, 18: 22, 19: 22, 20: 22 })
def __init__(self, name): pt.Character.__init__(self, name, class_type='Druid', hitdice=dice.d8(), prof_saves={ 'int': 1, 'wis': 1 }, cantrips_by_lvl=caster_cantrips, spells_by_lvl=caster_spell_slots)
E4 = Entry(bd =3) L5 = Label(text="Result:") if (E1.get() == ""): E1.insert(END, "0") E2.insert(END, "0") E3.insert(END, "0") E4.insert(END, "0") v=StringVar() L6 = Label(textvariable=v) B1 = Button(text="Roll!", command=lambda: v.set(E2.get() + "d(" + E1.get() + '{:+}'.format(int(E3.get())) + ") " + '{:+}'.format(int(E4.get())) + " = " '{:+}'.format(dice.roller(int(E1.get()), int(E2.get()), int(E3.get())) + int(E4.get())))) B2 = Button(text='d2', command=lambda: v.set("d2: " + str(dice.d2()))) B3 = Button(text="d3", command=lambda: v.set("d3: " + str(dice.d3()))) B4 = Button(text="d4", command=lambda: v.set("d4: " + str(dice.d4()))) B6 = Button(text="d6", command=lambda: v.set("d6: " + str(dice.d6()))) B8 = Button(text="d8", command=lambda: v.set("d8: " + str(dice.d8()))) B10 = Button(text="d10", command=lambda: v.set("d10: " + str(dice.d10()))) B20 = Button(text="d20", command=lambda: v.set("d20: " + str(dice.d20()))) B100 = Button(text="d100", command=lambda: v.set("d100: " + str(dice.d100()))) L1.grid(row=0, column=0, columnspan=1) E1.grid(row=1, column=0, columnspan=1) L2.grid(row=2, column=0, columnspan=1) E2.grid(row=3, column=0, columnspan=1) L3.grid(row=4, column=0, columnspan=1) E3.grid(row=5, column=0, columnspan=1) L4.grid(row=6, column=0, columnspan=1) E4.grid(row=7, column=0, columnspan=1) L5.grid(row=8, column=0, columnspan=1, sticky=W) L6.grid(row=9, column=0, columnspan=1, sticky=W) B1.grid(row=0, column=1, columnspan=1, sticky=W, padx = 10) B2.grid(row=0, column=2, columnspan=1, sticky=W, padx = 10)
def levelUP(self): self.hp = self.hp + (dice.d8(1) + self.conMod) self.level += 1
def heavyWeaponAttack(self, hit, evade): if hit > (evade / 2): damage = (dice.d8(1)) + self.strMod else: damage = dice.d4(1) + self.strMod return damage
# using dnd character classes to practice python classes and (more importantly) class inheritance # not sure what main will be used for, lol import dice import class_types import armor # testing Dice d4 = dice.d4() d6 = dice.d6() d8 = dice.d8() d10 = dice.d10() d12 = dice.d12() d20 = dice.d20() """ print(f"Rolling d4: {d4.roll()}") print(f"Rolling d4: {d4.roll()}") print(f"Rolling d4: {d4.roll()}") print(f"Rolling d6: {d6.roll()}") print(f"Rolling d8: {d8.roll()}") print(f"Rolling d20: {d20.roll()}") print(f"Rolling 4d6, indiv: {d6.roll_indiv(4)}") print(f"Rolling 6d8, summed: {d8.roll_sum(4)}") """ Drat = class_types.Bard("Drat of Hithendale") Drat.say_name()
def __init__(self, name): pt.Character.__init__(self, name, class_type='Warlock', hitdice=dice.d8(), prof_saves={ 'wis': 1, 'cha': 1 }, cantrips_by_lvl={ 1: 2, 2: 2, 3: 2, 4: 3, 5: 3, 6: 3, 7: 3, 8: 3, 9: 3, 10: 4, 11: 4, 12: 4, 13: 4, 14: 4, 15: 4, 16: 4, 17: 4, 18: 4, 19: 4, 20: 4 }, spells_known={ 1: 2, 2: 3, 3: 4, 4: 4, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 10, 11: 11, 12: 11, 13: 12, 14: 12, 15: 13, 16: 13, 17: 14, 18: 14, 19: 15, 20: 15 }, spells_by_lvl={ 1: [1], 2: [2], 3: [0, 2], 4: [0, 2], 5: [0, 0, 2], 6: [0, 0, 2], 7: [0, 0, 0, 2], 8: [0, 0, 0, 2], 9: [0, 0, 0, 0, 2], 10: [0, 0, 0, 0, 2], 11: [0, 0, 0, 0, 3], 12: [0, 0, 0, 0, 3], 13: [0, 0, 0, 0, 3], 14: [0, 0, 0, 0, 3], 15: [0, 0, 0, 0, 3], 16: [0, 0, 0, 0, 3], 17: [0, 0, 0, 0, 4], 18: [0, 0, 0, 0, 4], 19: [0, 0, 0, 0, 4], 20: [0, 0, 0, 0, 4] })
def heavyWeaponAttack(self, hit, evade): if hit > evade: damage = (dice.d8(1)) + self.strMod else: damage = 0 return damage