Recreating History p5
This commit is contained in:
parent
9c6c6c749a
commit
8ed5f98042
1 changed files with 271 additions and 133 deletions
404
SpellBurner.py
404
SpellBurner.py
|
|
@ -1,72 +1,72 @@
|
||||||
# Burning Wheel - Spell Burner
|
# Burning Wheel - Spell Burner
|
||||||
# By 2Shirt (Alan Mason)
|
# By 2Shirt (Alan Mason)
|
||||||
#
|
#
|
||||||
# Version 0.05a
|
# Version 0.06a
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
from math import floor
|
from math import ceil, floor, log
|
||||||
|
|
||||||
facets = {
|
facets = {
|
||||||
'Element': {
|
'Element': {
|
||||||
'Air': {'Actions': 4, 'Ob': 2, 'ResCost': 10},
|
'Air': {'Actions:': 4, 'Ob': 2, 'ResCost': 10},
|
||||||
'Anima': {'Actions': 5, 'Ob': 5, 'ResCost': 12},
|
'Anima': {'Actions:': 5, 'Ob': 5, 'ResCost': 12},
|
||||||
'Arcana': {'Actions': 10, 'Ob': 4, 'ResCost': 13},
|
'Arcana': {'Actions:': 10, 'Ob': 4, 'ResCost': 13},
|
||||||
'Earth': {'Actions': 6, 'Ob': 1, 'ResCost': 8},
|
'Earth': {'Actions:': 6, 'Ob': 1, 'ResCost': 8},
|
||||||
'Fire': {'Actions': 5, 'Ob': 2, 'ResCost': 10},
|
'Fire': {'Actions:': 5, 'Ob': 2, 'ResCost': 10},
|
||||||
'Heaven': {'Actions': 8, 'Ob': 3, 'ResCost': 10},
|
'Heaven': {'Actions:': 8, 'Ob': 3, 'ResCost': 10},
|
||||||
'Water': {'Actions': 3, 'Ob': 2, 'ResCost': 9},
|
'Water': {'Actions:': 3, 'Ob': 2, 'ResCost': 9},
|
||||||
'White': {'Actions': 7, 'Ob': 4, 'ResCost': 11},
|
'White': {'Actions:': 7, 'Ob': 4, 'ResCost': 11},
|
||||||
},
|
},
|
||||||
|
|
||||||
'Impetus': {
|
'Impetus': {
|
||||||
'Control': {'Actions': 16, 'Ob': 5, 'ResCost': 5},
|
'Control': {'Actions:': 16, 'Ob': 5, 'ResCost': 5},
|
||||||
'Create': {'Actions': 32, 'Ob': 6, 'ResCost': 6},
|
'Create': {'Actions:': 32, 'Ob': 6, 'ResCost': 6},
|
||||||
'Destroy': {'Actions': 2, 'Ob': 2, 'ResCost': 3},
|
'Destroy': {'Actions:': 2, 'Ob': 2, 'ResCost': 3},
|
||||||
'Enhance': {'Actions': 12, 'Ob': 4, 'ResCost': 4},
|
'Enhance': {'Actions:': 12, 'Ob': 4, 'ResCost': 4},
|
||||||
'Influence': {'Actions': 4, 'Ob': 3, 'ResCost': 3},
|
'Influence': {'Actions:': 4, 'Ob': 3, 'ResCost': 3},
|
||||||
'Tax': {'Actions': 1, 'Ob': 1, 'ResCost': 2},
|
'Tax': {'Actions:': 1, 'Ob': 1, 'ResCost': 2},
|
||||||
'Transmute (Control)': {'Actions': 25, 'Ob': 8, 'ResCost': 7},
|
'Transmute (Control)': {'Actions:': 25, 'Ob': 8, 'ResCost': 7},
|
||||||
'Transmute (Create)': {'Actions': 25, 'Ob': 9, 'ResCost': 7},
|
'Transmute (Create)': {'Actions:': 25, 'Ob': 9, 'ResCost': 7},
|
||||||
'Transmute (Destroy)': {'Actions': 25, 'Ob': 5, 'ResCost': 7},
|
'Transmute (Destroy)': {'Actions:': 25, 'Ob': 5, 'ResCost': 7},
|
||||||
'Transmute (Enhance)': {'Actions': 25, 'Ob': 7, 'ResCost': 7},
|
'Transmute (Enhance)': {'Actions:': 25, 'Ob': 7, 'ResCost': 7},
|
||||||
'Transmute (Influence)': {'Actions': 25, 'Ob': 6, 'ResCost': 7},
|
'Transmute (Influence)': {'Actions:': 25, 'Ob': 6, 'ResCost': 7},
|
||||||
'Transmute (Tax)': {'Actions': 25, 'Ob': 4, 'ResCost': 7},
|
'Transmute (Tax)': {'Actions:': 25, 'Ob': 4, 'ResCost': 7},
|
||||||
},
|
},
|
||||||
|
|
||||||
'Origin': {
|
'Origin': {
|
||||||
'Personal': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
'Personal': {'Actions:': 1, 'Ob': 0, 'ResCost': 0},
|
||||||
'Presence': {'Actions': 2, 'Ob': 2, 'ResCost': 2},
|
'Presence': {'Actions:': 2, 'Ob': 2, 'ResCost': 2},
|
||||||
'Sight': {'Actions': 4, 'Ob': 4, 'ResCost': 4},
|
'Sight': {'Actions:': 4, 'Ob': 4, 'ResCost': 4},
|
||||||
},
|
},
|
||||||
|
|
||||||
'Duration': {
|
'Duration': {
|
||||||
'Instantaneous': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
'Instantaneous': {'Actions:': 1, 'Ob': 0, 'ResCost': 0},
|
||||||
'Sustained': {'Actions': 2, 'Ob': 2, 'ResCost': 2},
|
'Sustained': {'Actions:': 2, 'Ob': 2, 'ResCost': 2},
|
||||||
'Elapsed Time (Seconds)': {'Actions': 2, 'Ob': 1, 'ResCost': 2},
|
'Elapsed Time (Seconds)': {'Actions:': 2, 'Ob': 1, 'ResCost': 2},
|
||||||
'Elapsed Time (Exchanges)': {'Actions': 6, 'Ob': 2, 'ResCost': 4},
|
'Elapsed Time (Exchanges)': {'Actions:': 6, 'Ob': 2, 'ResCost': 4},
|
||||||
'Elapsed Time (Minutes)': {'Actions': 8, 'Ob': 3, 'ResCost': 5},
|
'Elapsed Time (Minutes)': {'Actions:': 8, 'Ob': 3, 'ResCost': 5},
|
||||||
'Elapsed Time (Hours)': {'Actions': 12, 'Ob': 4, 'ResCost': 7},
|
'Elapsed Time (Hours)': {'Actions:': 12, 'Ob': 4, 'ResCost': 7},
|
||||||
'Elapsed Time (Days)': {'Actions': 24, 'Ob': 5, 'ResCost': 8},
|
'Elapsed Time (Days)': {'Actions:': 24, 'Ob': 5, 'ResCost': 8},
|
||||||
'Elapsed Time (Months)': {'Actions': 43, 'Ob': 7, 'ResCost': 9},
|
'Elapsed Time (Months)': {'Actions:': 43, 'Ob': 7, 'ResCost': 9},
|
||||||
'Elapsed Time (Years)': {'Actions': 81, 'Ob': 9, 'ResCost': 10},
|
'Elapsed Time (Years)': {'Actions:': 81, 'Ob': 9, 'ResCost': 10},
|
||||||
'Permanent': {'Actions': 500, 'Ob': 10, 'ResCost': 100},
|
'Permanent': {'Actions:': 500, 'Ob': 10, 'ResCost': 100},
|
||||||
},
|
},
|
||||||
|
|
||||||
'Area of Effect': {
|
'Area of Effect': {
|
||||||
'Caster': {'Actions': 1, 'Ob': 0, 'ResCost': 0},
|
'Caster': {'Actions:': 1, 'Ob': 0, 'ResCost': 0},
|
||||||
'Single Target': {'Actions': 2, 'Ob': 1, 'ResCost': 2},
|
'Single Target': {'Actions:': 2, 'Ob': 1, 'ResCost': 2},
|
||||||
'Presence': {'Actions': 3, 'Ob': 2, 'ResCost': 3},
|
'Presence': {'Actions:': 3, 'Ob': 2, 'ResCost': 3},
|
||||||
'Half Presence': {'Actions': 3, 'Ob': 1, 'ResCost': 2},
|
'Half Presence': {'Actions:': 3, 'Ob': 1, 'ResCost': 2},
|
||||||
'Double Presence': {'Actions': 6, 'Ob': 4, 'ResCost': 4},
|
'Double Presence': {'Actions:': 6, 'Ob': 4, 'ResCost': 4},
|
||||||
'Natural Effect': {'Actions': 4, 'Ob': 3, 'ResCost': 4},
|
'Natural Effect': {'Actions:': 4, 'Ob': 3, 'ResCost': 4},
|
||||||
'Half Natural Effect': {'Actions': 3, 'Ob': 2, 'ResCost': 3},
|
'Half Natural Effect': {'Actions:': 3, 'Ob': 2, 'ResCost': 3},
|
||||||
'Double Natural Effect': {'Actions': 8, 'Ob': 6, 'ResCost': 8},
|
'Double Natural Effect': {'Actions:': 8, 'Ob': 6, 'ResCost': 8},
|
||||||
'Area (Paces)': {'Actions': 4, 'Ob': 2, 'ResCost': 3},
|
'Area (Paces)': {'Actions:': 4, 'Ob': 2, 'ResCost': 3},
|
||||||
'Area (Tens of Paces)': {'Actions': 6, 'Ob': 4, 'ResCost': 5},
|
'Area (Tens of Paces)': {'Actions:': 6, 'Ob': 4, 'ResCost': 5},
|
||||||
'Area (Hundreds of Paces)': {'Actions': 8, 'Ob': 6, 'ResCost': 6},
|
'Area (Hundreds of Paces)': {'Actions:': 8, 'Ob': 6, 'ResCost': 6},
|
||||||
'Area (Miles)': {'Actions': 10, 'Ob': 8, 'ResCost': 8},
|
'Area (Miles)': {'Actions:': 10, 'Ob': 8, 'ResCost': 8},
|
||||||
'Area (Tens of Miles)': {'Actions': 15, 'Ob': 9, 'ResCost': 9},
|
'Area (Tens of Miles)': {'Actions:': 15, 'Ob': 9, 'ResCost': 9},
|
||||||
'Area (Hundreds of Miles)': {'Actions': 20, 'Ob': 10, 'ResCost': 10},
|
'Area (Hundreds of Miles)': {'Actions:': 20, 'Ob': 10, 'ResCost': 10},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,28 +97,28 @@ class Facet():
|
||||||
def updateStats(self, *args):
|
def updateStats(self, *args):
|
||||||
if self.option.get() == 'Anima':
|
if self.option.get() == 'Anima':
|
||||||
try:
|
try:
|
||||||
self.obLabel.destroy()
|
self.obValueLabel.destroy()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
self.ob.set(5)
|
self.ob.set(5)
|
||||||
self.obCombobox = ttk.Combobox(self.obFrame, textvariable=self.ob, width=2)
|
self.obCombobox = ttk.Combobox(self.frame, textvariable=self.ob, width=2)
|
||||||
self.obCombobox['values'] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
self.obCombobox['values'] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
self.obCombobox.state(['readonly'])
|
self.obCombobox.state(['readonly'])
|
||||||
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
||||||
self.obCombobox.grid(column=1, row=1, sticky=(W, E))
|
self.obCombobox.grid(column=6, row=self.row, sticky=W)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.obCombobox.destroy()
|
self.obCombobox.destroy()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
self.ob.set(facets[self.type.get()][self.option.get()]['Ob'])
|
self.ob.set(facets[self.type.get()][self.option.get()]['Ob'])
|
||||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
self.obValueLabel = ttk.Label(self.frame, textvariable=self.ob)
|
||||||
self.obLabel.grid(column=1, row=1, sticky=(W, E))
|
self.obValueLabel.grid(column=6, row=self.row, sticky=W)
|
||||||
self.actions.set(facets[self.type.get()][self.option.get()]['Actions'])
|
self.actions.set(facets[self.type.get()][self.option.get()]['Actions:'])
|
||||||
self.frame.updateAll()
|
self.frame.updateAll()
|
||||||
|
|
||||||
def createWidgets(self):
|
def createWidgets(self):
|
||||||
self.typeSelect = ttk.Combobox(self.frame, textvariable=self.type)
|
self.typeSelect = ttk.Combobox(self.frame, textvariable=self.type, width=15)
|
||||||
self.typeSelect['values'] = sorted(facets.keys())
|
self.typeSelect['values'] = sorted(facets.keys())
|
||||||
self.typeSelect.state(['readonly'])
|
self.typeSelect.state(['readonly'])
|
||||||
self.typeSelect.bind('<<ComboboxSelected>>', self.updateOptions)
|
self.typeSelect.bind('<<ComboboxSelected>>', self.updateOptions)
|
||||||
|
|
@ -129,15 +129,17 @@ class Facet():
|
||||||
self.optionSelect.bind('<<ComboboxSelected>>', self.updateStats)
|
self.optionSelect.bind('<<ComboboxSelected>>', self.updateStats)
|
||||||
self.optionSelect.grid(column=3, row=self.row, columnspan=2, sticky=(W, E))
|
self.optionSelect.grid(column=3, row=self.row, columnspan=2, sticky=(W, E))
|
||||||
|
|
||||||
self.obFrame = ttk.Labelframe(self.frame, text='Ob')
|
self.obLabel = ttk.Label(self.frame, text='Ob:', width=3)
|
||||||
self.obFrame.grid(column=5, row=self.row, sticky=(W, E))
|
self.obLabel.grid(column=5, row=self.row, sticky=W)
|
||||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
|
||||||
self.obLabel.grid(column=1, row=1, sticky=(W, E))
|
|
||||||
|
|
||||||
self.actionsFrame = ttk.Labelframe(self.frame, text='Actions')
|
self.obValueLabel = ttk.Label(self.frame, textvariable=self.ob, width=6)
|
||||||
self.actionsFrame.grid(column=6, row=self.row, sticky=(W, E))
|
self.obValueLabel.grid(column=6, row=self.row, sticky=W)
|
||||||
self.actionsLabel = ttk.Label(self.actionsFrame, textvariable=self.actions)
|
|
||||||
self.actionsLabel.grid(column=1, row=self.row, sticky=(W, E))
|
self.actionsLabel = ttk.Label(self.frame, text='Actions:')
|
||||||
|
self.actionsLabel.grid(column=7, row=self.row, sticky=W)
|
||||||
|
|
||||||
|
self.actionsValueLabel = ttk.Label(self.frame, textvariable=self.actions, width=3)
|
||||||
|
self.actionsValueLabel.grid(column=8, row=self.row, sticky=W)
|
||||||
|
|
||||||
def getActions(self):
|
def getActions(self):
|
||||||
return float(self.actions.get())
|
return float(self.actions.get())
|
||||||
|
|
@ -163,8 +165,13 @@ class Distiller():
|
||||||
self.obTmp = 0
|
self.obTmp = 0
|
||||||
self.actionsTmp = 0
|
self.actionsTmp = 0
|
||||||
for x in self.tobedistilled:
|
for x in self.tobedistilled:
|
||||||
self.obTmp += x.getOb()
|
try:
|
||||||
self.actionsTmp += x.getActions()
|
self.obTmp += x.getOb()
|
||||||
|
self.actionsTmp += x.getActions()
|
||||||
|
except AttributeError:
|
||||||
|
for y in x:
|
||||||
|
self.obTmp += y.getOb()
|
||||||
|
self.actionsTmp += y.getActions()
|
||||||
if self.round is 'true':
|
if self.round is 'true':
|
||||||
self.ob.set(str(roundMinOne(self.obTmp/2)))
|
self.ob.set(str(roundMinOne(self.obTmp/2)))
|
||||||
self.actions.set(str(roundMinOne(self.actionsTmp/2)))
|
self.actions.set(str(roundMinOne(self.actionsTmp/2)))
|
||||||
|
|
@ -173,22 +180,24 @@ class Distiller():
|
||||||
self.actions.set(str(self.actionsTmp/2))
|
self.actions.set(str(self.actionsTmp/2))
|
||||||
|
|
||||||
def createWidgets(self):
|
def createWidgets(self):
|
||||||
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row, columnspan=6, sticky=(W, E))
|
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row, columnspan=8, sticky=(W, E))
|
||||||
|
|
||||||
self.titleLabel = ttk.Label(self.frame, text=self.title, justify='right')
|
self.titleLabel = ttk.Label(self.frame, text=self.title, justify='right')
|
||||||
self.titleLabel.grid(column=4, row=self.row + 1, sticky=(W, E))
|
self.titleLabel.grid(column=4, row=self.row + 1, sticky=(W, E))
|
||||||
|
|
||||||
self.obFrame = ttk.Labelframe(self.frame, text='Ob')
|
self.obLabel = ttk.Label(self.frame, text='Ob:')
|
||||||
self.obFrame.grid(column=5, row=self.row + 1, sticky=(W, E))
|
self.obLabel.grid(column=5, row=self.row + 1, sticky=(W, E))
|
||||||
self.obLabel = ttk.Label(self.obFrame, textvariable=self.ob)
|
|
||||||
self.obLabel.grid(column=1, row=self.row + 1, sticky=(W, E))
|
|
||||||
|
|
||||||
self.actionsFrame = ttk.Labelframe(self.frame, text='Actions')
|
self.obValueLabel = ttk.Label(self.frame, textvariable=self.ob)
|
||||||
self.actionsFrame.grid(column=6, row=self.row + 1, sticky=(W, E))
|
self.obValueLabel.grid(column=6, row=self.row + 1, sticky=(W, E))
|
||||||
self.actionsLabel = ttk.Label(self.actionsFrame, textvariable=self.actions)
|
|
||||||
self.actionsLabel.grid(column=1, row=self.row + 1, sticky=(W, E))
|
|
||||||
|
|
||||||
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row + 2, columnspan=6, sticky=(W, E))
|
self.actionsLabel = ttk.Label(self.frame, text='Actions:')
|
||||||
|
self.actionsLabel.grid(column=7, row=self.row + 1, sticky=(W, E))
|
||||||
|
|
||||||
|
self.actionsValueLabel = ttk.Label(self.frame, textvariable=self.actions)
|
||||||
|
self.actionsValueLabel.grid(column=8, row=self.row + 1, sticky=(W, E))
|
||||||
|
|
||||||
|
ttk.Separator(self.frame, orient=HORIZONTAL).grid(column=1, row=self.row + 2, columnspan=8, sticky=(W, E))
|
||||||
|
|
||||||
def getActions(self):
|
def getActions(self):
|
||||||
return float(self.actions.get())
|
return float(self.actions.get())
|
||||||
|
|
@ -214,12 +223,20 @@ class MajorisSigil():
|
||||||
self.frame.addSigil()
|
self.frame.addSigil()
|
||||||
|
|
||||||
def toggleSigil(self, *args):
|
def toggleSigil(self, *args):
|
||||||
self.ob.set('1')
|
if self.enabled.get():
|
||||||
self.obCombobox['values'] = ('1', '2')
|
self.ob.set('1')
|
||||||
self.obCombobox.state(['!disabled'])
|
self.obCombobox.state(['!disabled'])
|
||||||
self.actionsEntry.state(['!disabled'])
|
self.obCombobox['values'] = ('1', '2')
|
||||||
self.actionsEntry.delete(0,'end')
|
self.actionsEntry.state(['!disabled'])
|
||||||
self.actionsEntry.insert(0, '10')
|
self.actionsEntry.delete(0,'end')
|
||||||
|
self.actionsEntry.insert(0, '10')
|
||||||
|
else:
|
||||||
|
self.ob.set('')
|
||||||
|
self.obCombobox['values'] = ('')
|
||||||
|
self.obCombobox.state(['disabled'])
|
||||||
|
self.actionsEntry.delete(0,'end')
|
||||||
|
self.actionsEntry.state(['disabled'])
|
||||||
|
self.frame.updateAll()
|
||||||
|
|
||||||
def validateMultiplier(self, *args):
|
def validateMultiplier(self, *args):
|
||||||
try:
|
try:
|
||||||
|
|
@ -235,42 +252,43 @@ class MajorisSigil():
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.actionsEntry.delete(0,'end')
|
self.actionsEntry.delete(0,'end')
|
||||||
self.actionsEntry.insert(0, '10')
|
self.actionsEntry.insert(0, '10')
|
||||||
|
self.frame.updateAll()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def correctMultiplier(self, *args):
|
def correctMultiplier(self, *args):
|
||||||
pass
|
self.frame.updateAll()
|
||||||
|
|
||||||
def createWidgets(self):
|
def createWidgets(self):
|
||||||
self.toggle = Checkbutton(self.frame, text='Majoris Sigil', command=self.toggleSigil,
|
self.addButton = ttk.Button(self.frame, text='+', command=self.addSigil, width=3)
|
||||||
variable=self.enabled, onvalue='1', offvalue='0')
|
self.addButton.grid(column=1, row=self.row)
|
||||||
self.toggle.grid(column=1, row=self.row, sticky=W)
|
|
||||||
|
self.toggle = Checkbutton(self.frame, text='Majoris', command=self.toggleSigil,
|
||||||
|
variable=self.enabled, onvalue=True, offvalue=False)
|
||||||
|
self.toggle.grid(column=2, row=self.row, sticky=W)
|
||||||
|
|
||||||
self.obCombobox = ttk.Combobox(self.frame, textvariable=self.ob, width=2)
|
self.obCombobox = ttk.Combobox(self.frame, textvariable=self.ob, width=2)
|
||||||
self.obCombobox.state(['readonly'])
|
self.obCombobox.state(['readonly'])
|
||||||
self.obCombobox['values'] = ('')
|
self.obCombobox['values'] = ('')
|
||||||
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
self.obCombobox.bind('<<ComboboxSelected>>', self.frame.updateAll)
|
||||||
self.obCombobox.grid(column=2, row=self.row, sticky=W)
|
self.obCombobox.grid(column=3, row=self.row, sticky=W)
|
||||||
self.obCombobox.state(['disabled'])
|
self.obCombobox.state(['disabled'])
|
||||||
|
|
||||||
self.actionsLabel = ttk.Label(self.frame, text='Multiplier')
|
self.actionsLabel = ttk.Label(self.frame, text='Multiplier')
|
||||||
self.actionsLabel.grid(column=3, row=self.row, sticky=W)
|
self.actionsLabel.grid(column=4, row=self.row, sticky=W)
|
||||||
|
|
||||||
self.actionsEntry = ttk.Entry(self.frame, validate='focusout',
|
self.actionsEntry = ttk.Entry(self.frame, validate='focusout',
|
||||||
validatecommand=self.validateMultiplier, width=4)
|
validatecommand=self.validateMultiplier, width=5)
|
||||||
self.actionsEntry.grid(column=4, row=self.row, sticky=(W, E))
|
self.actionsEntry.grid(column=5, row=self.row, sticky=W)
|
||||||
self.actionsEntry.state(['disabled'])
|
self.actionsEntry.state(['disabled'])
|
||||||
|
|
||||||
self.addButton = ttk.Button(self.frame, text='+', command=self.addSigil, width=6)
|
|
||||||
self.addButton.grid(column=5, row=self.row, sticky=(W, E))
|
|
||||||
|
|
||||||
def getMultiplier(self):
|
def getMultiplier(self):
|
||||||
if self.enabled == '1':
|
if self.enabled.get():
|
||||||
return float(self.actionsEntry.get())
|
return float(self.actionsEntry.get())
|
||||||
else:
|
else:
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
||||||
def getOb(self):
|
def getOb(self):
|
||||||
if self.enabled == '1':
|
if self.enabled.get():
|
||||||
return int(self.ob.get())
|
return int(self.ob.get())
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -280,28 +298,119 @@ class MajorisSigil():
|
||||||
self.frame = frame
|
self.frame = frame
|
||||||
self.row = row
|
self.row = row
|
||||||
self.multiplier = StringVar()
|
self.multiplier = StringVar()
|
||||||
self.enabled = StringVar()
|
self.enabled = BooleanVar()
|
||||||
self.enabled.set('0')
|
self.enabled.set(False)
|
||||||
self.ob = StringVar()
|
self.ob = StringVar()
|
||||||
self.createWidgets()
|
self.createWidgets()
|
||||||
# self.updateStats()
|
|
||||||
|
|
||||||
class App(ttk.Frame):
|
class App(ttk.Frame):
|
||||||
|
def addExtraFacet(self, *args):
|
||||||
|
if len(self.extraFacets) == 9:
|
||||||
|
self.extraFacetButton.destroy()
|
||||||
|
self.extraFacets.append(Facet(self, 11+len(self.extraFacets)))
|
||||||
|
self.configureGrid()
|
||||||
|
|
||||||
def addSigil(self, *args):
|
def addSigil(self, *args):
|
||||||
self.i = self.i + 1
|
self.extraFacetRow = self.extraFacetRow + 1
|
||||||
if self.i < 35:
|
if self.extraFacetRow < 36:
|
||||||
self.sigils.append(MajorisSigil(self, self.i))
|
self.majorisSigils.append(MajorisSigil(self, self.extraFacetRow))
|
||||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=2)
|
self.configureGrid()
|
||||||
|
|
||||||
|
def generateRange(self, limit, *args):
|
||||||
|
self.rangeList = []
|
||||||
|
for i in range(limit):
|
||||||
|
self.rangeList.append(str(i))
|
||||||
|
return self.rangeList
|
||||||
|
|
||||||
|
def configureGrid(self, *args):
|
||||||
|
for child in self.winfo_children(): child.grid_configure(padx=2, pady=2)
|
||||||
|
|
||||||
def updateAll(self, *args):
|
def updateAll(self, *args):
|
||||||
#Distillations
|
# Distillations
|
||||||
self.distiller1.updateStats()
|
self.distiller1.updateStats()
|
||||||
self.distiller2.updateStats()
|
self.distiller2.updateStats()
|
||||||
self.distiller3.updateStats()
|
self.distiller3.updateStats()
|
||||||
#Final Spell
|
|
||||||
# ToDO
|
# After Final Distillation
|
||||||
#self.capValue
|
self.finalObValue = roundMinOne(self.distiller3.getOb())
|
||||||
#self.minorisCombobox['values'] # set current limit
|
self.finalActionsValue = roundMinOne(self.distiller3.getActions())
|
||||||
|
|
||||||
|
# Cap Sigil
|
||||||
|
if self.capValue.get():
|
||||||
|
self.finalObValue -= 1
|
||||||
|
|
||||||
|
# Minoris Sigil(s)
|
||||||
|
try:
|
||||||
|
self.finalObValue -= int(self.minorisValue.get())
|
||||||
|
# Limit minoris sigil amount
|
||||||
|
limit = int(self.minorisValue.get()) + self.finalObValue
|
||||||
|
if limit < 1:
|
||||||
|
self.minorisCombobox['values'] = (0)
|
||||||
|
else:
|
||||||
|
self.minorisCombobox['values'] = tuple(range(int(limit)))
|
||||||
|
del limit
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Majoris Sigil(s)
|
||||||
|
for s in self.majorisSigils:
|
||||||
|
self.finalObValue += s.getOb()
|
||||||
|
self.finalActionsValue *= s.getMultiplier()
|
||||||
|
|
||||||
|
# Extention(s)
|
||||||
|
try:
|
||||||
|
self.finalObValue -= 1*int(self.extendValue.get())
|
||||||
|
self.finalActionsValue *= 5**int(self.extendValue.get())
|
||||||
|
# Limit number of extentions
|
||||||
|
origOb = roundMinOne(self.distiller3.getOb())
|
||||||
|
minOb = roundUp(origOb / 2)
|
||||||
|
if self.finalObValue > minOb:
|
||||||
|
limit = self.finalObValue - minOb + 1 + int(self.extendValue.get())
|
||||||
|
else:
|
||||||
|
limit = int(self.extendValue.get()) + 1 # current number
|
||||||
|
self.extendCombobox['values'] = tuple(range(int(limit)))
|
||||||
|
del limit
|
||||||
|
del minOb
|
||||||
|
del origOb
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Compression(s)
|
||||||
|
cTest = self.finalActionsValue
|
||||||
|
curCompress = int(self.compressValue.get())
|
||||||
|
try:
|
||||||
|
if curCompress > 0:
|
||||||
|
self.finalObValue += 1*curCompress
|
||||||
|
self.finalActionsValue = roundMinOne(ceil(self.finalActionsValue*(1/2)**curCompress))
|
||||||
|
# Limit number of compressions
|
||||||
|
if self.finalActionsValue == 1:
|
||||||
|
if roundMinOne(self.distiller3.getActions()) == 1:
|
||||||
|
limit = 1
|
||||||
|
else:
|
||||||
|
for x in range(curCompress+1):
|
||||||
|
cTest = ceil(cTest/2)
|
||||||
|
#print('cTest (', x, ') ', cTest)
|
||||||
|
if cTest == 1:
|
||||||
|
#print('\tSet limit: ', x + 2)
|
||||||
|
limit = x + 2
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# VERY WRONG, SHOULDN'T HAPPEN
|
||||||
|
limit = 1
|
||||||
|
else:
|
||||||
|
limit = ceil(log(1/self.finalActionsValue, 1/2)) + 1 + curCompress
|
||||||
|
self.compressCombobox['values'] = tuple(range(int(limit)))
|
||||||
|
del limit
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Final Spell Stats
|
||||||
|
if self.capValue.get():
|
||||||
|
self.finalOb.set(roundMinOne(self.finalObValue))
|
||||||
|
else:
|
||||||
|
self.finalOb.set(str(roundMinOne(self.finalObValue)) + '^')
|
||||||
|
self.finalActions.set(int(self.finalActionsValue))
|
||||||
|
self.configureGrid()
|
||||||
|
|
||||||
def createWidgets(self):
|
def createWidgets(self):
|
||||||
# 1st Distillation
|
# 1st Distillation
|
||||||
|
|
@ -322,69 +431,98 @@ class App(ttk.Frame):
|
||||||
|
|
||||||
# 3rd Distillation
|
# 3rd Distillation
|
||||||
self.facet5 = Facet(self, 10, 'Area of Effect')
|
self.facet5 = Facet(self, 10, 'Area of Effect')
|
||||||
self.facet6 = Facet(self, 11)
|
|
||||||
self.facet7 = Facet(self, 12)
|
self.extraFacetButton = ttk.Button(self, text='+', command=self.addExtraFacet, width=3)
|
||||||
|
self.extraFacetButton.grid(column=1, row=19)
|
||||||
|
|
||||||
self.distiller3 = Distiller(self, 20, 'Final Distillation',
|
self.distiller3 = Distiller(self, 20, 'Final Distillation',
|
||||||
(self.distiller1, self.distiller2, self.facet5, self.facet6, self.facet7),
|
(self.distiller1, self.distiller2, self.facet5, self.extraFacets),
|
||||||
round='true'
|
round='true'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Sigils
|
||||||
|
ttk.Label(self, text='Sigils').grid(column=1, row=24)
|
||||||
|
|
||||||
# Adjustments - Cap & Minoris Sigil(S)
|
# Adjustments - Cap & Minoris Sigil(S)
|
||||||
self.capCheckbutton = Checkbutton(self, text='Cap', command=self.updateAll,
|
self.capCheckbutton = Checkbutton(self, text='Cap', command=self.updateAll,
|
||||||
variable=self.capValue, onvalue='1', offvalue='0')
|
variable=self.capValue, onvalue=True, offvalue=False)
|
||||||
self.capCheckbutton.grid(column=1, row=24, sticky=W)
|
self.capCheckbutton.grid(column=2, row=25, sticky=W)
|
||||||
|
|
||||||
self.minorisLabel = ttk.Label(self, text='Minoris Sigils')
|
self.minorisLabel = ttk.Label(self, text='Minoris')
|
||||||
self.minorisLabel.grid(column=3, row=24, sticky=E)
|
self.minorisLabel.grid(column=4, row=25, sticky=E)
|
||||||
|
|
||||||
self.minorisCombobox = ttk.Combobox(self, textvariable=self.minorisValue, width=2)
|
self.minorisCombobox = ttk.Combobox(self, textvariable=self.minorisValue, width=2)
|
||||||
self.minorisCombobox.state(['readonly'])
|
self.minorisCombobox.state(['readonly'])
|
||||||
self.minorisCombobox['values'] = ('0')
|
self.minorisCombobox['values'] = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
# self.minorisCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
self.minorisCombobox.bind('<<ComboboxSelected>>', self.updateAll)
|
||||||
self.minorisCombobox.grid(column=4, row=24, sticky=W)
|
self.minorisCombobox.grid(column=5, row=25, sticky=W)
|
||||||
|
|
||||||
# Adjustments - Majoris Sigil(S)
|
# Adjustments - Majoris Sigil(S)
|
||||||
self.sigils.append(MajorisSigil(self, self.i))
|
self.majorisSigils.append(MajorisSigil(self, self.extraFacetRow))
|
||||||
|
|
||||||
# Adjustments - Compress & Extend
|
# Adjustments - Compress & Extend
|
||||||
self.compressLabel = ttk.Label(self, text='Compressions')
|
self.compressLabel = ttk.Label(self, text='Compressions')
|
||||||
self.compressLabel.grid(column=1, row=35, sticky=W)
|
self.compressLabel.grid(column=2, row=36, sticky=W)
|
||||||
|
|
||||||
self.compressCombobox = ttk.Combobox(self, textvariable=self.compressValue, width=2)
|
self.compressCombobox = ttk.Combobox(self, textvariable=self.compressValue, width=2)
|
||||||
self.compressCombobox.state(['readonly'])
|
self.compressCombobox.state(['readonly'])
|
||||||
self.compressCombobox['values'] = ('0')
|
self.compressCombobox['values'] = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
# self.compressCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
self.compressCombobox.bind('<<ComboboxSelected>>', self.updateAll)
|
||||||
self.compressCombobox.grid(column=2, row=35, sticky=W)
|
self.compressCombobox.grid(column=3, row=36, sticky=W)
|
||||||
|
|
||||||
self.extendLabel = ttk.Label(self, text='Extentions')
|
self.extendLabel = ttk.Label(self, text='Extentions')
|
||||||
self.extendLabel.grid(column=3, row=35, sticky=W)
|
self.extendLabel.grid(column=4, row=36, sticky=W)
|
||||||
|
|
||||||
self.extendCombobox = ttk.Combobox(self, textvariable=self.extendValue, width=2)
|
self.extendCombobox = ttk.Combobox(self, textvariable=self.extendValue, width=2)
|
||||||
self.extendCombobox.state(['readonly'])
|
self.extendCombobox.state(['readonly'])
|
||||||
self.extendCombobox['values'] = ('0')
|
self.extendCombobox['values'] = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
# self.extendCombobox.bind('<<ComboboxSelected>>', self.updateStats)
|
self.extendCombobox.bind('<<ComboboxSelected>>', self.updateAll)
|
||||||
self.extendCombobox.grid(column=4, row=35, sticky=W)
|
self.extendCombobox.grid(column=5, row=36, sticky=W)
|
||||||
|
|
||||||
# Final Spell Results
|
# Final Spell Results
|
||||||
# ToDO
|
ttk.Separator(self, orient=HORIZONTAL).grid(column=1, row=37, columnspan=8, sticky=(W, E))
|
||||||
|
|
||||||
|
self.titleLabel = ttk.Label(self, text='Final Spell Stats', justify='right')
|
||||||
|
self.titleLabel.grid(column=4, row=38, sticky=(W, E))
|
||||||
|
|
||||||
|
self.obLabel = ttk.Label(self, text='Ob:')
|
||||||
|
self.obLabel.grid(column=5, row=38, sticky=(W, E))
|
||||||
|
|
||||||
|
self.obValueLabel = ttk.Label(self, textvariable=self.finalOb)
|
||||||
|
self.obValueLabel.grid(column=6, row=38, sticky=(W, E))
|
||||||
|
|
||||||
|
self.actionsLabel = ttk.Label(self, text='Actions:')
|
||||||
|
self.actionsLabel.grid(column=7, row=38, sticky=(W, E))
|
||||||
|
|
||||||
|
self.actionsValueLabel = ttk.Label(self, textvariable=self.finalActions)
|
||||||
|
self.actionsValueLabel.grid(column=8, row=38, sticky=(W, E))
|
||||||
|
|
||||||
def __init__(self, master):
|
def __init__(self, master):
|
||||||
Frame.__init__(self, master)
|
Frame.__init__(self, master)
|
||||||
self.frame = master
|
self.frame = master
|
||||||
self.capValue = StringVar()
|
self.capValue = BooleanVar()
|
||||||
self.capValue.set('0')
|
self.capValue.set(False)
|
||||||
self.compressValue = StringVar()
|
self.compressValue = StringVar()
|
||||||
|
self.compressValue.set(0)
|
||||||
self.extendValue = StringVar()
|
self.extendValue = StringVar()
|
||||||
|
self.extendValue.set(0)
|
||||||
self.minorisValue = StringVar()
|
self.minorisValue = StringVar()
|
||||||
self.i = 25
|
self.minorisValue.set(0)
|
||||||
self.sigils = []
|
self.extraFacetRow = 26
|
||||||
|
self.extraFacets = []
|
||||||
|
self.finalOb = StringVar()
|
||||||
|
self.finalObValue = 1
|
||||||
|
self.finalActions = StringVar()
|
||||||
|
self.finalActionsValue = 1
|
||||||
|
self.majorisSigils = []
|
||||||
self.createWidgets()
|
self.createWidgets()
|
||||||
self.updateAll()
|
self.updateAll()
|
||||||
for child in self.winfo_children(): child.grid_configure(padx=5, pady=2)
|
self.configureGrid()
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.title('Spell Burner')
|
root.title('Spell Burner')
|
||||||
|
#root.resizable(0, 0) # disable window resizing
|
||||||
|
root.resizable(width=FALSE, height=FALSE) # disable window resizing
|
||||||
|
|
||||||
app = App(root)
|
app = App(root)
|
||||||
app.grid(column=0, row=0, sticky=(N, W, E, S))
|
app.grid(column=0, row=0, sticky=(N, W, E, S))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue