Example #1
0
    def stab(self, target):
        roll = dice.d4()
        crit = dice.d10()
        hit = dice.hit(self, self.dex)
        if crit == 10:
            roll += dice.d4()
            print("Crit!")
        else:
            pass    # pass or continue?

        if hit == True:
            self.deal_dmg(roll, self.dex, target)
        else:
            print("You swing, but you missed!\n")
Example #2
0
 def fireball(self, hit, evade, enemyMod):
     if ((hit > evade + enemyMod) and self.magic_slots > 0):
         damage = (dice.d4(1) + dice.d4(1) + dice.d4(1) + dice.d4(1) +
                   dice.d4(1) + dice.d4(1)) + self.intMod
         self.magic_slots -= 1
     elif ((hit <= evade + enemyMod) and self.magic_slots > 0):
         damage = ((dice.d4(1) + dice.d4(1) + dice.d4(1)) + self.intMod)
         self.magic_slots -= 1
     elif (self.magic_slots <= 0):
         print("no magic left")
         damage = 0
     return damage
Example #3
0
    def scratch(self, target):
        roll = dice.d4()

        hit = dice.hit(self, self.dex)
        if hit == True:
            self.deal_dmg(roll, self.dex, target)
            self.blood = True
        else:
            print("Couldn't break through defense!")
Example #4
0
    def rapidhot_attack(self, target):  # In future(when there are more enemies in combat)
                                        # change the attack to be able to attack more enemies

        for i in range(3):
            roll = dice.d4()
            hit = dice.hit(self, self.dex - i * 2)  # test and balance
            if hit == True:
                dmg = roll
                self.deal_dmg(dmg, self.dex, target)
            else:
                print(f"{self.name} shot, but missed!")
Example #5
0
E3 = Entry(bd =3)
L4 = Label(text="Total Modifier:")
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)
Example #6
0
 def finesseWeaponAttack(self, hit, evade):
     if hit > (evade / 2):
         damage = (dice.d4(1) + dice.d4(1)) + self.dexMod
     else:
         damage = dice.d4(1) + self.dexMod
     return damage
Example #7
0
 def heavyWeaponAttack(self, hit, evade):
     if hit > (evade / 2):
         damage = (dice.d8(1)) + self.strMod
     else:
         damage = dice.d4(1) + self.strMod
     return damage
Example #8
0
# 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()
Example #9
0
def t1():
    """this function creates a treasure representing an average
    citicens likly pocket coinage
    """
    sc = D.d4(-1)
    kc = D.d10()
Example #10
0
# -*- coding: utf-8 -*-
"""
Created on Wed Oct  3 15:59:32 2018

@author: Nathan
"""

# list comp confusion
from dice import d4

test = int(input("Positive Int Please :"))

x = [d4() for i in range(test)]

print(x)
Example #11
0
 def unarmedAttack(self, hit, evade):
     if hit > evade:
         damage = (dice.d4(1)) + self.strMod
     else:
         damage = 0
     return damage