Skip to content

Commit

Permalink
added ability to alter randomly given spell as suggested by GorillaOf…
Browse files Browse the repository at this point in the history
…Destiny - also prefills dropdown with default values
  • Loading branch information
Ludicro committed Dec 1, 2024
1 parent ddf3698 commit ea90c02
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ def create_dropdowns(self):
ttk.Label(bottom_frame, text="Select Line Type:").grid(row=0, column=3)
lineType_dropdown = ttk.Combobox(bottom_frame, textvariable=self.lineType_var, values=["Straight", "Centre Circle"])
lineType_dropdown.grid(row=1, column=3, padx=5)


# Set default values
self.level_var.set("None")
self.school_var.set("None")
self.duration_var.set("Instantaneous")
self.range_var.set("None")
self.area_var.set("None")
self.dtype_var.set("None")
self.condition_var.set("None")
self.concentration_var.set("No")
self.ritual_var.set("No")
self.shape_var.set("Polygon")
self.lineType_var.set("Straight")


def load_attributes(self, filename):
with open(filename, "r") as f:
Expand Down Expand Up @@ -263,6 +278,25 @@ def random_spell(self):
if lineType == line_shapes.straight and (shape == bases.quadratic or shape == bases.cubic):
shape = bases.polygon

# Update dropdown values to match random selections
self.level_var.set(level)
self.school_var.set(school)
self.duration_var.set(duration)
self.range_var.set(rang)
self.area_var.set(area)
self.dtype_var.set(dtype)
self.condition_var.set(condition)
self.concentration_var.set("Yes" if concentration else "No")
self.ritual_var.set("Yes" if ritual else "No")
self.shape_var.set({
bases.polygon: "Polygon",
bases.quadratic: "Quadratic",
bases.circle: "Circle",
bases.cubic: "Cubic",
bases.golden: "Golden"
}[shape])
self.lineType_var.set("Centre Circle" if lineType == line_shapes.centre_circle else "Straight")

# Convert the level to lowercase in case of "None"
level = level.lower()

Expand Down

0 comments on commit ea90c02

Please sign in to comment.