From e2936fdd05a7178772a47f5e7923a75c1b04a357 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 16 Jun 2023 19:05:58 -0400 Subject: Atbash trap --- Archipelago/client.gd | 6 ++++++ Archipelago/effects.gd | 27 ++++++++++++++++++++++++++- Archipelago/panel.gd | 20 +++++++++++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 1fe354a..6211ad7 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -644,6 +644,8 @@ func processItem(item, index, from, flags): effects_node.trigger_slowness_trap() if item_name == "Iceland Trap": effects_node.trigger_iceland_trap() + if item_name == "Atbash Trap": + effects_node.trigger_atbash_trap() func doorIsVanilla(door): @@ -654,6 +656,10 @@ func paintingIsVanilla(painting): return !_mentioned_paintings.has(painting) +func evaluateSolvability(): + emit_signal("evaluate_solvability") + + func colorForItemType(flags): var int_flags = int(flags) if int_flags & 1: # progression diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index a11ab42..04c79b6 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -4,6 +4,7 @@ var activated = false var effect_running = false var slowness_remaining = 0 var iceland_remaining = 0 +var atbash_remaining = 0 var queued_iceland = 0 var orig_env @@ -70,10 +71,23 @@ func trigger_iceland_trap(): _process_effects() +func trigger_atbash_trap(): + if atbash_remaining == 0: + atbash_remaining += 60 + + var apclient = global.get_node("Archipelago") + apclient.evaluateSolvability() + else: + atbash_remaining += 60 + + if not effect_running: + _process_effects() + + func _process_effects(): effect_running = true - while slowness_remaining > 0 or iceland_remaining > 0: + while slowness_remaining > 0 or iceland_remaining > 0 or atbash_remaining > 0: var text = "" if slowness_remaining > 0: text += "Slowness: %d seconds" % slowness_remaining @@ -81,6 +95,10 @@ func _process_effects(): 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") @@ -101,5 +119,12 @@ 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 6ec5e14..bf43653 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd @@ -2,16 +2,29 @@ extends Node var data = {} var orig_text = "" +var atbash_text = "" var orig_color = Color(0, 0, 0, 0) +const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" +const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+" + func _ready(): orig_text = self.get_parent().get_node("Viewport/GUI/Panel/Label").text orig_color = self.get_parent().get_node("Quad").get_surface_material(0).albedo_color + for i in range(0, orig_text.length()): + var old_char = orig_text[i] + if old_char in kAtbashPre: + var j = kAtbashPre.find(old_char) + atbash_text += kAtbashPost[j] + else: + atbash_text += old_char + func evaluate_solvability(): var apclient = global.get_node("Archipelago") + var effects = get_tree().get_root().get_node("Spatial/AP_Effects") var solvable = true var missing = [] @@ -23,7 +36,10 @@ func evaluate_solvability(): solvable = false if solvable: - self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text + if effects.atbash_remaining > 0: + 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 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color else: @@ -37,3 +53,5 @@ func evaluate_solvability(): self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( 0.7, 0.2, 0.2 ) + + self.get_parent().get_node("Viewport").render_target_update_mode = 1 -- cgit 1.4.1