From 3695cb4b951bde7488d0084bcb61d67d7ea9374f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 17 Jun 2023 20:03:02 -0400 Subject: Atbash lasts until you solve a puzzle --- Archipelago/effects.gd | 33 ++++++++++++++++----------------- Archipelago/panel.gd | 11 ++++++++++- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index 04c79b6..80eaa9c 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -4,7 +4,7 @@ var activated = false var effect_running = false var slowness_remaining = 0 var iceland_remaining = 0 -var atbash_remaining = 0 +var atbash_activated = false var queued_iceland = 0 var orig_env @@ -72,33 +72,39 @@ func trigger_iceland_trap(): func trigger_atbash_trap(): - if atbash_remaining == 0: - atbash_remaining += 60 + if not atbash_activated: + atbash_activated = true var apclient = global.get_node("Archipelago") apclient.evaluateSolvability() - else: - atbash_remaining += 60 if not effect_running: _process_effects() +func deactivate_atbash_trap(): + if atbash_activated: + atbash_activated = false + + var apclient = global.get_node("Archipelago") + apclient.evaluateSolvability() + + func _process_effects(): effect_running = true - while slowness_remaining > 0 or iceland_remaining > 0 or atbash_remaining > 0: + while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated: var text = "" + if atbash_activated: + text += "Atbash Trap lasts until you solve a puzzle" if slowness_remaining > 0: + if not text.empty(): + text += "\n" text += "Slowness: %d seconds" % slowness_remaining if iceland_remaining > 0: if not text.empty(): text += "\n" text += "Iceland: %d seconds" % iceland_remaining - if atbash_remaining > 0: - if not text.empty(): - text += "\n" - text += "Atbash: %d seconds" % atbash_remaining self.get_node("label").text = text yield(get_tree().create_timer(1.0), "timeout") @@ -119,12 +125,5 @@ func _process_effects(): orig_env ) - if atbash_remaining > 0: - atbash_remaining -= 1 - - if atbash_remaining == 0: - var apclient = global.get_node("Archipelago") - apclient.evaluateSolvability() - self.get_node("label").text = "" effect_running = false diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index bf43653..da11ddd 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd @@ -21,6 +21,15 @@ func _ready(): else: atbash_text += old_char + self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").connect( + "answer_correct", self, "answer_correct" + ) + + +func answer_correct(): + var effects = get_tree().get_root().get_node("Spatial/AP_Effects") + effects.deactivate_atbash_trap() + func evaluate_solvability(): var apclient = global.get_node("Archipelago") @@ -36,7 +45,7 @@ func evaluate_solvability(): solvable = false if solvable: - if effects.atbash_remaining > 0: + if effects.atbash_activated: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text else: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text -- cgit 1.4.1