From 9b419fcbc3dce2238107cf4cb0fbbc5508df8584 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Wed, 15 Nov 2023 01:03:03 +0100 Subject: [PATCH] Hasten elif chain avoid reevaluating the choice equality --- game/scripts/rooms/main_room/objects/desk.rpy | 132 +++++++++--------- 1 file changed, 69 insertions(+), 63 deletions(-) diff --git a/game/scripts/rooms/main_room/objects/desk.rpy b/game/scripts/rooms/main_room/objects/desk.rpy index 874937d7..5627dd5e 100644 --- a/game/scripts/rooms/main_room/objects/desk.rpy +++ b/game/scripts/rooms/main_room/objects/desk.rpy @@ -46,89 +46,95 @@ label desk: $ renpy.dynamic(__choice = _return) - #Hermione - if __choice == "hermione" and states.her.busy: - if game.daytime: - nar "Hermione is taking classes." - jump main_room_menu + if __choice == "hermione": + if states.her.busy: + if game.daytime: + nar "Hermione is taking classes." + jump main_room_menu + else: + nar "Hermione is already asleep." + jump main_room_menu else: - nar "Hermione is already asleep." - jump main_room_menu - elif __choice == "hermione" and not states.her.busy: - if states.her.map_location == "forest": - nar "Hermione is currently at the Forbidden Forest.\n>Would you like to go there?" - menu: - "-Yes, pay her a visit-": - jump hermione_map_BJ - "-No, summon her to your office-": - pass + if states.her.map_location == "forest": + nar "Hermione is currently at the Forbidden Forest.\n>Would you like to go there?" + menu: + "-Yes, pay her a visit-": + jump hermione_map_BJ + "-No, summon her to your office-": + pass - jump summon_hermione + jump summon_hermione #Luna - elif states.lun.unlocked and __choice == "luna" and states.lun.busy: - if game.daytime: - nar "Luna is taking classes." - jump main_room_menu + elif states.lun.unlocked and __choice == "luna": + if states.lun.busy: + if game.daytime: + nar "Luna is taking classes." + jump main_room_menu + else: + nar "Luna is already asleep." + jump main_room_menu else: - nar "Luna is already asleep." - jump main_room_menu - elif states.lun.unlocked and __choice == "luna" and not states.lun.busy: - jump summon_luna + jump summon_luna #Astoria - elif states.ast.busy and __choice == "astoria": - if game.daytime: - nar "Astoria is taking classes." - jump main_room_menu - else: - nar "Astoria is already asleep." - jump main_room_menu - elif not states.ast.busy and __choice == "astoria": #Summoning after intro events done. - jump summon_astoria + elif __choice == "astoria": + if states.ast.busy: + if game.daytime: + nar "Astoria is taking classes." + jump main_room_menu + else: + nar "Astoria is already asleep." + jump main_room_menu + else: #Summoning after intro events done. + jump summon_astoria #Susan - elif __choice == "susan" and states.sus.busy: - if game.daytime: - nar "Susan is taking classes." - jump main_room_menu + elif __choice == "susan": + if states.sus.busy: + if game.daytime: + nar "Susan is taking classes." + jump main_room_menu + else: + nar "Susan is already asleep." + jump main_room_menu else: - nar "Susan is already asleep." - jump main_room_menu - elif __choice == "susan" and not states.sus.busy: - jump summon_susan + jump summon_susan #Cho - elif __choice == "cho" and states.cho.busy: - if game.daytime: - nar "Cho is taking classes." - jump main_room_menu + elif __choice == "cho": + if states.cho.busy: + if game.daytime: + nar "Cho is taking classes." + jump main_room_menu + else: + nar "Cho is already asleep." + jump main_room_menu else: - nar "Cho is already asleep." - jump main_room_menu - elif __choice == "cho" and not states.cho.busy: - jump summon_cho + jump summon_cho #Snape - elif __choice == "snape" and states.sna.busy: - nar "Professor Snape is unavailable." - if game.daytime: - jump main_room_menu + elif __choice == "snape": + if states.sna.busy: + nar "Professor Snape is unavailable." + if game.daytime: + jump main_room_menu + else: + jump main_room_menu else: - jump main_room_menu - elif __choice == "snape" and not states.sna.busy: - jump summon_snape + jump summon_snape #Tonks - elif __choice == "tonks" and states.ton.busy: - nar "Tonks is unavailable." - if game.daytime: - jump main_room_menu + elif __choice == "tonks": + if states.ton.busy: + nar "Tonks is unavailable." + if game.daytime: + jump main_room_menu + else: + jump main_room_menu else: - jump main_room_menu - elif __choice == "tonks" and not states.ton.busy: - jump summon_tonks + jump summon_tonks #Close elif __choice == "Close":