Skip to content

Commit

Permalink
Added multiple defenses penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
AdoenLunnae committed Sep 26, 2018
1 parent d147a73 commit 7666f5c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions func.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math


def getdmg(atq, aroll, base, deff, droll, ta, acu):
def getdmg(atq, aroll, base, deff, droll, ta, acu, numdef):
if acu:
abs = 20 + 10 * ta
diff = 10 * math.trunc((atq + aroll - abs) / 10)
Expand All @@ -16,7 +16,10 @@ def getdmg(atq, aroll, base, deff, droll, ta, acu):
return u'No produce daño'

else:
diff = 10 * math.trunc((atq + aroll - deff - droll) / 10)
pendef=[0, -30, -50, -70, -90]
totalat= atq+aroll
totaldef= deff+droll+pendef[numdef]
diff = 10 * math.trunc((totalat-totaldef) / 10)
if diff > 0:
abso = 20 + 10 * ta
diff -= abso
Expand Down
14 changes: 10 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ def __init__(self):
drolllabel = ttk.Label(defframe, text='Tirada')
deflabel = ttk.Label(defframe, text='Hab. Defensa')
talabel = ttk.Label(defframe, text='TA')
numdeflabel = ttk.Label(defframe, text=u'Defensa Nº')

aroll, atq, dmg, droll, deff, ta, acu = tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), \
tk.StringVar(), tk.StringVar(), tk.IntVar()
aroll, atq, dmg, droll, deff, ta, acu, numdef = tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), \
tk.StringVar(), tk.StringVar(), tk.IntVar(), tk.StringVar()
aroll.set(0)
droll.set(0)
atq.set(0)
Expand All @@ -36,8 +37,11 @@ def __init__(self):
dmgbox = ttk.Entry(atqframe, width=12, textvariable=dmg)
taselect = ttk.Combobox(defframe, width=10, textvariable=ta)
acubutton = ttk.Checkbutton(defframe, text=u'Acumulación', variable=acu)
numdef = ttk.Combobox(defframe, width=10, textvariable=numdef)
taselect['values'] = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
numdef['values'] = (u'1ª', u'2ª', u'3ª', u'4ª', u'5ª+')
taselect.current(0)
numdef.current(0)

atqframe.grid(column=0, row=0)
defframe.grid(column=0, row=1)
Expand All @@ -57,7 +61,9 @@ def __init__(self):
taselect.grid(column=2, row=1)
final = ttk.Label(self.raiz, text='No pasa nada')
final.grid(column=0, row=2)
acubutton.grid(column=1, row=2)
acubutton.grid(column=0, row=2)
numdeflabel.grid(column=1, row=2)
numdef.grid(column=2, row=2)
while 1:
if acu.get():
deff.set(0)
Expand All @@ -69,7 +75,7 @@ def __init__(self):
drollbox.configure(state='normal')
try:
final.configure(text=getdmg(int(atq.get()), int(aroll.get()), int(dmg.get()),
int(deff.get()), int(droll.get()), int(ta.get()), acu.get()))
int(deff.get()), int(droll.get()), int(ta.get()), acu.get(), int(numdef.get()[0])))
except ValueError:
final.configure(text='No pasa nada')
self.raiz.update_idletasks()
Expand Down
Empty file added modif.py
Empty file.

0 comments on commit 7666f5c

Please sign in to comment.