extends Node class_name Spy var threshold: String #Spy order's age threshold var symptoms: Array #Spy order's symptoms var order: bool #Checks if there is an ongoing spy order var count: int #Keeps count of the spy successful orders # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. #Randomization of the spy's directives func spy_rand(): threshold = ["BELOW", "ABOVE"].pick_random() var floor_index = -Globals.floor_count -1 var available_symptoms : Array for i in range(floor_index+1): #Takes into account only the known symptoms available_symptoms.append_array(Patient.symptoms_arrays[i]) print("SPY Symptoms list: " + str(available_symptoms)) available_symptoms.shuffle() print("SPY Symptoms list shuffled: " + str(available_symptoms)) symptoms = available_symptoms.slice(0,2) #Returns 2 random symptoms print("SPY Threshold selected: " + threshold) print("SPY Symptoms selected: " + str(symptoms)) #Checks if a patient meets the spy order's requirements and returns true or false func spy_check(): var requirements_passed = true match threshold: #Check the age requirement "BELOW": if int(Patient.age) > 40: requirements_passed = false "ABOVE": if int(Patient.age) < 40: requirements_passed = false for symptom in symptoms: #Check the symptoms requirement if Patient.symptoms.has(symptom) == false: requirements_passed = false print("Symptom not present in Patient: " + str(symptom)) print("Requirements_passed: " + str(requirements_passed)) return requirements_passed #Resets to initial state func reset(): threshold = "" symptoms.clear() order = false