Recreating history p2
This commit is contained in:
parent
30a1c6c741
commit
4c0e099c0b
1 changed files with 216 additions and 26 deletions
242
SpellBurner.py
242
SpellBurner.py
|
|
@ -1,14 +1,14 @@
|
|||
# Burning Wheel - Spell Burner
|
||||
# By 2Shirt (Alan Mason)
|
||||
#
|
||||
# Version 0.02a
|
||||
# Version 0.03a
|
||||
from tkinter import *
|
||||
from tkinter import ttk
|
||||
from math import floor
|
||||
|
||||
facets = {
|
||||
'Elements': {
|
||||
'Element': {
|
||||
'Air': {'Actions': 4, 'Ob': 2, 'ResCost': 10},
|
||||
'Anima (Target)': {'Actions': 5, 'Ob': 0, 'ResCost': 12},
|
||||
'Anima': {'Actions': 5, 'Ob': 5, 'ResCost': 12},
|
||||
'Arcana': {'Actions': 10, 'Ob': 4, 'ResCost': 13},
|
||||
'Earth': {'Actions': 6, 'Ob': 1, 'ResCost': 8},
|
||||
|
|
@ -18,7 +18,7 @@ facets = {
|
|||
'White': {'Actions': 7, 'Ob': 4, 'ResCost': 11},
|
||||
},
|
||||
|
||||
'Impeti': {
|
||||
'Impetus': {
|
||||
'Control': {'Actions': 16, 'Ob': 5, 'ResCost': 5},
|
||||
'Create': {'Actions': 32, 'Ob': 6, 'ResCost': 6},
|
||||
'Destroy': {'Actions': 2, 'Ob': 2, 'ResCost': 3},
|
||||
|
|
@ -33,13 +33,13 @@ facets = {
|
|||
'Transmute (Tax)': {'Actions': 25, 'Ob': 4, 'ResCost': 7},
|
||||
},
|
||||
|
||||
'Origins': {
|
||||
'Origin': {
|
||||
'Personal': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
||||
'Presence': {'Actions': 2, 'Ob': 2, 'ResCost': 2},
|
||||
'Sight': {'Actions': 4, 'Ob': 4, 'ResCost': 4},
|
||||
},
|
||||
|
||||
'Durations': {
|
||||
'Duration': {
|
||||
'Instantaneous': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
||||
'Sustained': {'Actions': 2, 'Ob': 2, 'ResCost': 2},
|
||||
'Elapsed Time (Seconds)': {'Actions': 2, 'Ob': 1, 'ResCost': 2},
|
||||
|
|
@ -52,7 +52,7 @@ facets = {
|
|||
'Permanent': {'Actions': 500, 'Ob': 10, 'ResCost': 100},
|
||||
},
|
||||
|
||||
'Areas of Effect': {
|
||||
'Area of Effect': {
|
||||
'Caster': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
||||
'Single Target': {'Actions': 2, 'Ob': 1, 'ResCost': 2},
|
||||
'Presence': {'Actions': 3, 'Ob': 2, 'ResCost': 3},
|
||||
|
|
@ -70,11 +70,51 @@ facets = {
|
|||
},
|
||||
}
|
||||
|
||||
def roundBW(x):
|
||||
if (floor(x) == 0):
|
||||
return 1
|
||||
elif (x - floor(x) >= 0.5):
|
||||
return floor(x) + 1
|
||||
else:
|
||||
return floor(x)
|
||||
|
||||
def roundDown(x):
|
||||
if (floor(x) == 0):
|
||||
return 1
|
||||
else:
|
||||
return floor(x)
|
||||
|
||||
def roundUp(x):
|
||||
return ceil(x)
|
||||
|
||||
class Facet(ttk.Frame):
|
||||
def updateOptions(self, *args):
|
||||
self.optionSelect['values'] = sorted(facets[self.type.get()].keys())
|
||||
try:
|
||||
self.optionSelect['values'] = sorted(facets[self.type.get()].keys())
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def updateStats(self, *args):
|
||||
self.ob.set(facets[self.type.get()][self.option.get()]['Ob'])
|
||||
if self.option.get() == 'Anima':
|
||||
## Todo ##
|
||||
try:
|
||||
self.obLabel.destroy()
|
||||
except AttributeError:
|
||||
pass
|
||||
self.ob.set(5)
|
||||
self.obCombobox = ttk.Combobox(self.obFrame, textvariable=self.ob, width=2)
|
||||
self.obCombobox['values'] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
self.obCombobox.state(['readonly'])
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.parent.updateAll)
|
||||
self.obCombobox.grid(column=1, row=1, sticky=W)
|
||||
else:
|
||||
try:
|
||||
self.obCombobox.destroy()
|
||||
except AttributeError:
|
||||
pass
|
||||
self.ob.set(facets[self.type.get()][self.option.get()]['Ob'])
|
||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
||||
self.obLabel.grid(column=1, row=1, sticky=W)
|
||||
self.actions.set(facets[self.type.get()][self.option.get()]['Actions'])
|
||||
self.parent.updateAll()
|
||||
|
||||
|
|
@ -106,7 +146,7 @@ class Facet(ttk.Frame):
|
|||
def getOb(self):
|
||||
return float(self.ob.get())
|
||||
|
||||
def __init__(self, master):
|
||||
def __init__(self, master, default=''):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
self.actions = StringVar()
|
||||
|
|
@ -115,7 +155,9 @@ class Facet(ttk.Frame):
|
|||
self.ob.set('0')
|
||||
self.option = StringVar()
|
||||
self.type = StringVar()
|
||||
self.type.set(default)
|
||||
self.createWidgets()
|
||||
self.updateOptions()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class Distiller(ttk.Frame):
|
||||
|
|
@ -123,17 +165,14 @@ class Distiller(ttk.Frame):
|
|||
self.obTmp = 0
|
||||
self.actionsTmp = 0
|
||||
for x in self.tobedistilled:
|
||||
# print(x.getOb())
|
||||
# print(x.getActions())
|
||||
self.obTmp += x.getOb()
|
||||
self.actionsTmp += x.getActions()
|
||||
# print(self.obTmp)
|
||||
# print(self.actionsTmp)
|
||||
self.ob.set(str(self.obTmp/2))
|
||||
self.actions.set(str(self.actionsTmp/2))
|
||||
# print(self.ob)
|
||||
# print(self.actions)
|
||||
# print('----------------------')
|
||||
if self.round is 'true':
|
||||
self.ob.set(str(roundBW(self.obTmp/2)))
|
||||
self.actions.set(str(roundBW(self.actionsTmp/2)))
|
||||
else:
|
||||
self.ob.set(str(self.obTmp/2))
|
||||
self.actions.set(str(self.actionsTmp/2))
|
||||
|
||||
def createWidgets(self):
|
||||
self.titleLabel = ttk.Label(self, text=self.title, justify='right')
|
||||
|
|
@ -155,27 +194,120 @@ class Distiller(ttk.Frame):
|
|||
def getOb(self):
|
||||
return float(self.ob.get())
|
||||
|
||||
def __init__(self, master, title, tobedistilled, *args):
|
||||
def __init__(self, master, title, tobedistilled, round='false', *args):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
self.title = title
|
||||
self.tobedistilled = tobedistilled
|
||||
self.round = round
|
||||
self.actions = StringVar()
|
||||
self.ob = StringVar()
|
||||
self.createWidgets()
|
||||
self.updateStats()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class MajorisSigil(ttk.Frame):
|
||||
|
||||
def addSigil(self, *args):
|
||||
self.addButton.destroy()
|
||||
self.parent.addSigil()
|
||||
|
||||
def toggleSigil(self, *args):
|
||||
self.ob.set('1')
|
||||
self.obCombobox['values'] = ('1', '2')
|
||||
self.obCombobox.state(['!disabled'])
|
||||
self.actionsEntry.state(['!disabled'])
|
||||
self.actionsEntry.delete(0,'end')
|
||||
self.actionsEntry.insert(0, '10')
|
||||
|
||||
def validateMultiplier(self, *args):
|
||||
try:
|
||||
if (float(self.actionsEntry.get()) < 10):
|
||||
print('<10')
|
||||
self.actionsEntry.delete(0,'end')
|
||||
self.actionsEntry.insert(0, '10')
|
||||
elif (float(self.actionsEntry.get()) > 100):
|
||||
print('>100')
|
||||
self.actionsEntry.delete(0,'end')
|
||||
self.actionsEntry.insert(0, '100')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
self.actionsEntry.delete(0,'end')
|
||||
self.actionsEntry.insert(0, '10')
|
||||
except TypeError:
|
||||
print('TypeError')
|
||||
self.actionsEntry.delete(0,'end')
|
||||
self.actionsEntry.insert(0, '10')
|
||||
return 1
|
||||
|
||||
def correctMultiplier(self, *args):
|
||||
pass
|
||||
|
||||
def createWidgets(self):
|
||||
self.toggle = Checkbutton(self, text='Majoris Sigil', command=self.toggleSigil,
|
||||
variable=self.enabled, onvalue='1', offvalue='0')
|
||||
self.toggle.grid(column=1, row=1, sticky=W)
|
||||
|
||||
self.obCombobox = ttk.Combobox(self, textvariable=self.ob)
|
||||
self.obCombobox.state(['readonly'])
|
||||
self.obCombobox['values'] = ('')
|
||||
self.obCombobox.bind('<<ComboboxSelected>>', self.parent.updateAll)
|
||||
self.obCombobox.grid(column=2, row=1, sticky=W)
|
||||
self.obCombobox.state(['disabled'])
|
||||
|
||||
self.actionsEntry = ttk.Entry(self, validate='focusout',
|
||||
validatecommand=self.validateMultiplier, width=4)
|
||||
self.actionsEntry.grid(column=3, row=1, sticky=W)
|
||||
self.actionsEntry.state(['disabled'])
|
||||
|
||||
self.addButton = ttk.Button(self, text='+', command=self.addSigil)
|
||||
self.addButton.grid(column=4, row=1, sticky=W)
|
||||
|
||||
def getMultiplier(self):
|
||||
if self.enabled == '1':
|
||||
return float(self.actionsEntry.get())
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
def getOb(self):
|
||||
if self.enabled == '1':
|
||||
return int(self.ob.get())
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def __init__(self, master, *args):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
self.multiplier = StringVar()
|
||||
self.enabled = StringVar()
|
||||
self.enabled.set('0')
|
||||
self.ob = StringVar()
|
||||
self.createWidgets()
|
||||
# self.updateStats()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=0)
|
||||
|
||||
class App(ttk.Frame):
|
||||
def addSigil(self, *args):
|
||||
self.i = self.i + 1
|
||||
if self.i < 17:
|
||||
self.sigils.append(MajorisSigil(self))
|
||||
self.sigils[-1].grid(column=1, row=self.i, sticky=W)
|
||||
|
||||
def updateAll(self, *args):
|
||||
#Distillations
|
||||
self.distiller1.updateStats()
|
||||
self.distiller2.updateStats()
|
||||
self.distiller3.updateStats()
|
||||
#Final Spell
|
||||
#self.capValue
|
||||
# self.minorisCombobox['values'] # set current limit
|
||||
|
||||
def createWidgets(self):
|
||||
self.facet1 = Facet(self)
|
||||
# 1st Distillation
|
||||
self.facet1 = Facet(self, 'Element')
|
||||
self.facet1.grid(column=1, row=1, sticky=W)
|
||||
self.facet2 = Facet(self)
|
||||
self.facet2 = Facet(self, 'Impetus')
|
||||
self.facet2.grid(column=1, row=2, sticky=W)
|
||||
|
||||
self.distiller1 = Distiller(self, '1st Distillation',
|
||||
|
|
@ -183,9 +315,10 @@ class App(ttk.Frame):
|
|||
)
|
||||
self.distiller1.grid(column=1, row=3, sticky=W)
|
||||
|
||||
self.facet3 = Facet(self)
|
||||
# 2nd Distillation
|
||||
self.facet3 = Facet(self, 'Origin')
|
||||
self.facet3.grid(column=1, row=4, sticky=W)
|
||||
self.facet4 = Facet(self)
|
||||
self.facet4 = Facet(self, 'Duration')
|
||||
self.facet4.grid(column=1, row=5, sticky=W)
|
||||
|
||||
self.distiller2 = Distiller(self, '2nd Distillation',
|
||||
|
|
@ -193,7 +326,8 @@ class App(ttk.Frame):
|
|||
)
|
||||
self.distiller2.grid(column=1, row=6, sticky=W)
|
||||
|
||||
self.facet5 = Facet(self)
|
||||
# 3rd Distillation
|
||||
self.facet5 = Facet(self, 'Area of Effect')
|
||||
self.facet5.grid(column=1, row=7, sticky=W)
|
||||
self.facet6 = Facet(self)
|
||||
self.facet6.grid(column=1, row=8, sticky=W)
|
||||
|
|
@ -201,13 +335,69 @@ class App(ttk.Frame):
|
|||
self.facet7.grid(column=1, row=9, sticky=W)
|
||||
|
||||
self.distiller3 = Distiller(self, 'Final Distillation',
|
||||
(self.distiller1, self.distiller2, self.facet5, self.facet6, self.facet7)
|
||||
(self.distiller1, self.distiller2, self.facet5, self.facet6, self.facet7),
|
||||
round='true'
|
||||
)
|
||||
self.distiller3.grid(column=1, row=10, sticky=W)
|
||||
|
||||
# Adjustments - Cap & Minoris Sigil(S)
|
||||
self.frameCapMinoris = ttk.Frame(self)
|
||||
self.frameCapMinoris.grid(column=1, row=11, sticky=(N, W, E, S))
|
||||
self.frameCapMinoris.columnconfigure(0, weight=1)
|
||||
self.frameCapMinoris.rowconfigure(0, weight=1)
|
||||
|
||||
self.capCheckbutton = Checkbutton(self.frameCapMinoris, text='Cap', command=self.updateAll,
|
||||
variable=self.capValue, onvalue='1', offvalue='0')
|
||||
self.capCheckbutton.grid(column=1, row=1, sticky=W)
|
||||
|
||||
self.minorisLabel = ttk.Label(self.frameCapMinoris, text='Minoris Sigils')
|
||||
self.minorisLabel.grid(column=3, row=1, sticky=E)
|
||||
|
||||
self.minorisCombobox = ttk.Combobox(self.frameCapMinoris, textvariable=self.minorisValue)
|
||||
self.minorisCombobox.state(['readonly'])
|
||||
self.minorisCombobox['values'] = ('0')
|
||||
# self.minorisCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.minorisCombobox.grid(column=4, row=1, sticky=E)
|
||||
|
||||
# Adjustments - Majoris Sigil(S)
|
||||
self.i = self.i + 1
|
||||
self.sigils.append(MajorisSigil(self))
|
||||
self.sigils[-1].grid(column=1, row=self.i, sticky=W)
|
||||
|
||||
# Adjustments - Compress & Extend
|
||||
self.frameCompressExtend = ttk.Frame(self)
|
||||
self.frameCompressExtend.grid(column=1, row=17, sticky=(N, W, E, S))
|
||||
self.frameCompressExtend.columnconfigure(0, weight=1)
|
||||
self.frameCompressExtend.rowconfigure(0, weight=1)
|
||||
|
||||
self.compressLabel = ttk.Label(self.frameCompressExtend, text='Compressions')
|
||||
self.compressLabel.grid(column=1, row=1, sticky=W)
|
||||
|
||||
self.compressCombobox = ttk.Combobox(self.frameCompressExtend, textvariable=self.compressValue)
|
||||
self.compressCombobox.state(['readonly'])
|
||||
self.compressCombobox['values'] = ('0')
|
||||
# self.compressCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.compressCombobox.grid(column=2, row=1, sticky=W)
|
||||
|
||||
self.extendLabel = ttk.Label(self.frameCompressExtend, text='Extentions')
|
||||
self.extendLabel.grid(column=3, row=1, sticky=W)
|
||||
|
||||
self.extendCombobox = ttk.Combobox(self.frameCompressExtend, textvariable=self.extendValue)
|
||||
self.extendCombobox.state(['readonly'])
|
||||
self.extendCombobox['values'] = ('0')
|
||||
# self.extendCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
||||
self.extendCombobox.grid(column=4, row=1, sticky=W)
|
||||
|
||||
def __init__(self, master):
|
||||
Frame.__init__(self, master)
|
||||
self.parent = master
|
||||
self.capValue = StringVar()
|
||||
self.capValue.set('0')
|
||||
self.compressValue = StringVar()
|
||||
self.extendValue = StringVar()
|
||||
self.minorisValue = StringVar()
|
||||
self.i = 11
|
||||
self.sigils = []
|
||||
self.createWidgets()
|
||||
self.updateAll()
|
||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue