Refactoring

This commit is contained in:
LoafyLemon 2022-09-29 22:19:55 +01:00
parent 860dea3baa
commit d6e8efaaa3
43 changed files with 408 additions and 381 deletions

View File

@ -115,7 +115,7 @@ init python:
if self.image is None:
return
if isinstance(self.image, basestring):
if isinstance(self.image, str):
d = renpy.get_registered_image(self.image)
else:
d = self.image

View File

@ -43,9 +43,9 @@ init python:
self._overlay = overlay
self._mask = mask
self.child = ImageReference(child) if isinstance(child, basestring) else child
self.overlay = ImageReference(overlay) if isinstance(overlay, basestring) else overlay
self.mask = ImageReference(mask) if isinstance(mask, basestring) else mask
self.child = ImageReference(child) if isinstance(child, str) else child
self.overlay = ImageReference(overlay) if isinstance(overlay, str) else overlay
self.mask = ImageReference(mask) if isinstance(mask, str) else mask
self.radius = radius
self.tag_prefix = tag_prefix
self.target = (0, 0)

View File

@ -32,9 +32,10 @@ default ag_se_imperio_sb = event_class(
default ag_spell_list = []
label update_astoria_spells:
$ del ag_spell_list[:] # Clear list
python:
del ag_spell_list[:] # Clear list
if not ag_st_imperio.is_complete():
$ ag_spell_list.append(ag_st_imperio)
ag_spell_list.append(ag_st_imperio)
else:
$ ag_spell_list.append(ag_se_imperio_sb) # Susan
ag_spell_list.append(ag_se_imperio_sb) # Susan
return

View File

@ -59,7 +59,7 @@ screen spectrevision():
zorder 16
tag spectrevision
for i in xrange(wrackspurts_count):
for i in range(wrackspurts_count):
add "object" at OBJwrackspurt
add "spectrevision"

View File

@ -125,7 +125,7 @@ label upgrades_menu(xx=150, yy=90):
item_bought = True
for i in xrange(1, min(_iter+1, len(_list))):
for i in range(1, min(_iter+1, len(_list))):
if not _list[i].unlocked:
_list[i].unlock()
ton_clothing_upgrades += 1
@ -233,14 +233,14 @@ screen upgrades_menuitem(xx, yy):
yfill True
# TODO: Reduce the clutter and optimize the code.
for i in upgrades_dict[current_category]["outfits"].itervalues():
for i in upgrades_dict[current_category]["outfits"].values():
$ linear_price = 0
if len(i) > 0 and (i[0].unlocked or upgrades_show_locked):
vbox:
hbox:
spacing 0
for x in xrange(len(i)):
for x in range(len(i)):
if x < len(i)-1:
if not i[x+1].unlocked:
$ linear_price += i[x+1].price

View File

@ -55,7 +55,7 @@ init -1 python:
def complete_chibi_moves(**elapsed):
"""Resume old chibi action after (multiple) reduced move calls."""
q = []
for chibi, (t, a) in chibi_moves.iteritems():
for chibi, (t, a) in chibi_moves.items():
et = elapsed.get(chibi, 0)
t -= et
q.append((chibi, t, a))
@ -198,7 +198,7 @@ init -1 python:
old_action = self.action
if action:
move_action = action
elif isinstance(self.action_info[2], basestring):
elif isinstance(self.action_info[2], str):
# Action info provides a move action
move_action = self.action_info[2]
else:
@ -209,7 +209,7 @@ init -1 python:
# Calculate movement time
times = []
for i in xrange(len(path) - 1):
for i in range(len(path) - 1):
dist = math.sqrt((path[i][0] - path[i+1][0])**2 + (path[i][1] - path[i+1][1])**2)
time = dist / (float(self.speed) * speed)
if loop_time > 0:
@ -308,7 +308,7 @@ init -1 python:
yield d
def clear(self):
for k in self.layers.iterkeys():
for k in self.layers.keys():
self.layers[k] = None
def __getitem__(self, key):
@ -319,7 +319,7 @@ init -1 python:
# Layer must be defined at init
raise KeyError(key)
if isinstance(value, basestring) and '.' in value:
if isinstance(value, str) and '.' in value:
# Assume value is a filename and resolve it
if value.startswith('~') or not self.special:
# Avoid special directory

View File

@ -77,7 +77,7 @@ init python:
it = 0
seg = 0
for i in xrange(len(times)):
for i in range(len(times)):
if it + times[i] > st:
seg = i
break

View File

@ -27,6 +27,9 @@ init python:
# def __del__(self):
# print("Outfit with hash: {} has been garbage collected.".format(self.hash))
def __hash__(self):
return self.hash
def __eq__(self, obj):
if not isinstance(obj, DollOutfit):
return NotImplemented

File diff suppressed because it is too large Load Diff

View File

@ -126,14 +126,15 @@ label genie_intro_E1:
gen "I think I will stick around for a little bit..." ("base", xpos="far_left", ypos="head")
# Highlight important objects
$ fireplace_OBJ.idle = At("fireplace_idle_shadow", pulse_hover)
$ cupboard_OBJ.idle = At("cupboard_idle", pulse_hover)
$ phoenix_OBJ.idle = At("phoenix_idle", pulse_hover)
$ door_OBJ.idle = At("door_idle", pulse_hover)
$ desk_OBJ.idle = At("ch_gen sit_behind_desk", pulse_hover)
python:
fireplace_OBJ.idle = At("fireplace_idle_shadow", pulse_hover)
cupboard_OBJ.idle = At("cupboard_idle", pulse_hover)
phoenix_OBJ.idle = At("phoenix_idle", pulse_hover)
door_OBJ.idle = At("door_idle", pulse_hover)
desk_OBJ.idle = At("ch_gen sit_behind_desk", pulse_hover)
$ achievements.unlock("start")
$ genie_intro.E1_complete = True
achievements.unlock("start")
genie_intro.E1_complete = True
jump main_room_menu
@ -198,8 +199,9 @@ label skip_to_hermione:
jump day_start
label send_letters:
$ letter_hg_2.send() # Arrives on day 2
$ letter_work_unlock.send() # Arrives on day 4
$ letter_favors.send() # Arrives on day 8
$ letter_cards_unlock.send() # Arrives on day 24
python:
letter_hg_2.send() # Arrives on day 2
letter_work_unlock.send() # Arrives on day 4
letter_favors.send() # Arrives on day 8
letter_cards_unlock.send() # Arrives on day 24
return

View File

@ -76,20 +76,20 @@ init python:
if not self.iconset:
raise Exception('Events: "iconset" list was not defined for "{}". You need to add at least one set of icons.'.format(self.title))
elif len(self.iconset) < self._max_tiers:
for i in xrange(self._max_tiers-len(self.iconset)):
for i in range(self._max_tiers-len(self.iconset)):
self.iconset.append([self.iconset[0][0], self.iconset[0][1]])
if self.icons and len(self.icons) < self._max_tiers:
raise Exception('Events: "icons" list does not match the number of events for "{}".'.format(self.title))
for i in xrange(self._max_tiers):
for j in xrange(len(self.events[i])):
for i in range(self._max_tiers):
for j in range(len(self.events[i])):
self.events[i][j] += [False]
def start(self):
self.counter += 1
for i in xrange(len(self.events[self._tier])):
for i in range(len(self.events[self._tier])):
if self.events[self._tier][i][1] == False:
self.events[self._tier][i][1] = True
self.points += 1
@ -100,8 +100,8 @@ init python:
def start_advance(self):
self.counter += 1
for i in xrange(self._max_tiers):
for j in xrange(len(self.events[i])):
for i in range(self._max_tiers):
for j in range(len(self.events[i])):
if self.events[i][j][1] == False:
self.events[i][j][1] = True
self._tier = i
@ -111,7 +111,7 @@ init python:
self.start_random()
def start_random(self):
events_filtered = filter(lambda x: '_intro' not in x[0], self.events[self._tier])
events_filtered = [x for x in self.events[self._tier] if '_intro' not in x[0]]
random_event = events_filtered[random.randint(0, len(events_filtered)-1)][0]
return renpy.jump(random_event)
@ -168,8 +168,8 @@ init python:
# Reset the event completely
def reset(self):
for i in xrange(self._max_tiers):
for j in xrange(len(self.events[i])):
for i in range(self._max_tiers):
for j in range(len(self.events[i])):
self.events[i][j][1] = False
self._tier = 0
self._points = 0
@ -240,13 +240,13 @@ init python:
def status(self):
"""Print currently defined keys and values in the console."""
for key, value in self.iteritems():
print key + " == " + str(value)
for key, value in self.items():
print(key + " == " + str(value))
return
def reset(self):
"""Reset all key values back to default values depending on the value type."""
for key in self.iterkeys():
for key in self.keys():
if isinstance(self[key], (float, int)):
self[key] = 0
elif isinstance(self[key], bool):

View File

@ -104,30 +104,31 @@ label increase_house_points(house, points):
#TODO Check and fix teleport/heal effect position (chibis are now anchored bottom-left)
label teleport(position=None,effect=True,poof_label=None):
python:
if position == "genie":
$ teleport_xpos = genie_chibi.pos[0]+75
$ teleport_ypos = genie_chibi.pos[1]
$ teleport_zorder = 3
teleport_xpos = genie_chibi.pos[0]+75
teleport_ypos = genie_chibi.pos[1]
teleport_zorder = 3
elif position == "hermione":
$ teleport_xpos = hermione_chibi.pos[0]+45
$ teleport_ypos = hermione_chibi.pos[1]
$ teleport_zorder = 3
teleport_xpos = hermione_chibi.pos[0]+45
teleport_ypos = hermione_chibi.pos[1]
teleport_zorder = 3
elif position == "cho":
$ teleport_xpos = cho_chibi.pos[0]+45
$ teleport_ypos = cho_chibi.pos[1]
$ teleport_zorder = 3
teleport_xpos = cho_chibi.pos[0]+45
teleport_ypos = cho_chibi.pos[1]
teleport_zorder = 3
elif position == "astoria":
$ teleport_xpos = astoria_chibi.pos[0]+45
$ teleport_ypos = astoria_chibi.pos[1]
$ teleport_zorder = 3
teleport_xpos = astoria_chibi.pos[0]+45
teleport_ypos = astoria_chibi.pos[1]
teleport_zorder = 3
elif position == "desk":
$ teleport_xpos = 320
$ teleport_ypos = 450
$ teleport_zorder = 5
teleport_xpos = 320
teleport_ypos = 450
teleport_zorder = 5
else:
$ teleport_xpos = position[0]
$ teleport_ypos = position[1]
$ teleport_zorder = 2
teleport_xpos = position[0]
teleport_ypos = position[1]
teleport_zorder = 2
if effect == True:
$ renpy.play('sounds/magic4.ogg')

View File

@ -34,7 +34,7 @@ screen help(page='tutorials'):
textbutton _("About") action [SelectedIf(page == 'about'), Show("help", config.intra_transition, "about")]
screen tutorials_help():
for entry, tutorial in tutorial_dict.iteritems():
for entry, tutorial in tutorial_dict.items():
$ title = tutorial[0]
textbutton "[title]":

View File

@ -6,7 +6,7 @@ screen mods():
use game_menu("Mods"):
default selection = next(iter(mods_list.iterkeys()))
default selection = next(iter(mods_list.keys()))
default checkbox_enabled = gui.theme("check_true")
default checkbox_disabled = gui.theme("check_false")
@ -26,7 +26,7 @@ screen mods():
style_prefix gui.theme("slot")
for mod in mods_list.itervalues():
for mod in mods_list.values():
$ name = mod["Name"]
$ desc = mod["Description"]
$ author = mod["Author"]

View File

@ -64,7 +64,7 @@ screen file_slots(title):
transpose True
for i in xrange(gui.file_slot_cols * gui.file_slot_rows):
for i in range(gui.file_slot_cols * gui.file_slot_rows):
$ slot = i + 1
@ -123,7 +123,7 @@ screen file_slots(title):
$ page_modifier = max(0, int(FilePageName(str(page_modifier+9), str(page_modifier+9)))-9)
for page in xrange(1+page_modifier, 10+page_modifier):
for page in range(1+page_modifier, 10+page_modifier):
textbutton "[page]":
xminimum 40
action FilePage(page)

View File

@ -171,7 +171,7 @@ screen choice(items):
spacing 2
xpos choice_width - 5
align (1.0, 0.5)
for i in xrange(0, max_progress):
for i in range(0, max_progress):
if i < len(progress):
add progress[i]
else:

View File

@ -19,13 +19,14 @@ label brewing:
label brewing_menu(xx=150, yy=90):
$ items_shown = 36
$ current_filter = "Unlocked"
$ current_sorting = "A-z"
python:
items_shown = 36
current_filter = "Unlocked"
current_sorting = "A-z"
$ menu_items = brewing_sortfilter(inventory.get_instances_of_type("potion"), current_sorting, current_filter)
$ menu_items_length = len(menu_items)
$ current_item = next(iter(menu_items), None)
menu_items = brewing_sortfilter(inventory.get_instances_of_type("potion"), current_sorting, current_filter)
menu_items_length = len(menu_items)
current_item = next(iter(menu_items), None)
show screen brewing(xx, yy)

View File

@ -380,8 +380,8 @@ init -1 python:
canvas = rv.canvas()
surf = canvas.get_surface()
for x in xrange(w):
for y in xrange(h):
for x in range(w):
for y in range(h):
hue = float(y) / h
r, g, b = Color(hsv=(hue, 1.0, 1.0)).rgb
color = (r * 255, g * 255, b * 255)
@ -407,8 +407,8 @@ init -1 python:
canvas = rv.canvas()
surf = canvas.get_surface()
for x in xrange(w):
for y in xrange(h):
for x in range(w):
for y in range(h):
hue = float(y) / h
color = (255.0, 255.0, 255.0, x)
surf.set_at((x, y), color)

File diff suppressed because it is too large Load Diff

View File

@ -185,21 +185,22 @@ define waifu_chapters = {
label waifu_book:
# Setup
$ day = 1
python:
day = 1
$ shea_points = 0
$ stevens_points = 0
$ leena_points = 0
shea_points = 0
stevens_points = 0
leena_points = 0
$ generic_ending = waifu_progression["generic_ending"]
$ shea_ending = waifu_progression["shea_ending"]
$ stevens_ending = waifu_progression["stevens_ending"]
$ leena_ending = waifu_progression["leena_ending"]
$ harem_ending = waifu_progression["harem_ending"]
generic_ending = waifu_progression["generic_ending"]
shea_ending = waifu_progression["shea_ending"]
stevens_ending = waifu_progression["stevens_ending"]
leena_ending = waifu_progression["leena_ending"]
harem_ending = waifu_progression["harem_ending"]
$ shea_dates = waifu_chapters["shea_dates"]
$ stevens_dates = waifu_chapters["stevens_dates"]
$ leena_dates = waifu_chapters["leena_dates"]
shea_dates = waifu_chapters["shea_dates"]
stevens_dates = waifu_chapters["stevens_dates"]
leena_dates = waifu_chapters["leena_dates"]
call book_start

Some files were not shown because too many files have changed in this diff Show More