extends Quest

func setup() -> void:
	name = "A Sticky Situation"
	var event_weights = [1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5]
	var num_events = 3 # event_weights.pick_random()
	#The first event is guaranteed to be at the 50% mark.
	var first : bool = true
	var pranges : Array = []
	var margin : float = 0.1
	for i in range(num_events):
		var evt : Quest.Event = Quest.Event.new()
		evt.type = Quest.Event.Type.COMBAT
		evt.enemies = ["goo"]
		evt.time = 5
		if first:
			#Make invisible
			evt.progress_point = .5
			pranges.append([margin, evt.progress_point-margin])
			pranges.append([evt.progress_point+margin, 1 - margin])
			first = false
		else:
			evt.hidden = true
			pranges.shuffle()
			var range = pranges.pop_back()
			evt.progress_point = randf_range(range[0], range[1])
			if evt.progress_point - range[0] >= 2 * margin:
				pranges.append([range[0], evt.progress_point - margin])
			if range[1] - evt.progress_point >= 2 * margin:
				pranges.append([evt.progress_point + margin, range[1]])
		events.append(evt)
	events.sort_custom(func(a,b): return a.progress_point < b.progress_point)
	desc = "Nestor’s Woods is facing a slime invasion and the farmers are getting nervous, send an adventurer to help squash that sticky situation!"
	location = Quest.Locations.NESTORS_WOODS
	rewards = {"exp":10, "gold":5}
	guild_rewards = {"glory":10, "gold":5}
	covenant_cost = 5
	
