Skip to content

Commit

Permalink
Fix tweet details for double-bladed lightsabers
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam McKerlie committed Sep 8, 2020
1 parent 2a84b9f commit c63dabc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lightsaber.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
AVERAGE_BLADE_LENGTH = 90

DOUBLE_BLADE_CHANCE = 0.20
DOUBLE_BLADE = False

USE_SENTRY = False

Expand All @@ -44,6 +45,10 @@ def generate_tweet_text(hilt, blade, pommel):
average_length = AVERAGE_HILT_LENGTH + AVERAGE_POMMEL_LENGTH
blade_length = int(AVERAGE_BLADE_LENGTH * (total_length / average_length))

if DOUBLE_BLADE:
total_length = hilt_length * 2
blade_length *= 2

title = get_title(blade_details)

crystal = get_crystal(blade_details)
Expand Down Expand Up @@ -159,6 +164,8 @@ def generate_lightsaber(hilt, blade, button, pommel):
img_w, img_h = img.size

if random.random() <= DOUBLE_BLADE_CHANCE:
global DOUBLE_BLADE
DOUBLE_BLADE = True
saber = Image.new("RGB", (max_width, blade_h + hilt_h), (255, 255, 255))
output_filename = f"d{output_filename}"
bg_w, bg_h = saber.size
Expand Down

0 comments on commit c63dabc

Please sign in to comment.