[gd_resource type="BehaviorTree" load_steps=43 format=3 uid="uid://dght2flegv70i"]

[ext_resource type="Script" uid="uid://h113xg55h4r8" path="res://ai/tasks/actions/go_to.gd" id="1_s3kkm"]
[ext_resource type="Script" uid="uid://bsq5dxul0uto" path="res://ai/tasks/actions/use_guild_service.gd" id="2_1441p"]
[ext_resource type="Script" uid="uid://767b4fdlrgr" path="res://ai/tasks/actions/wander.gd" id="2_fe6jf"]
[ext_resource type="Script" uid="uid://b2vuw12mttm40" path="res://ai/tasks/decorators/busy.gd" id="2_mtixs"]
[ext_resource type="Script" uid="uid://bcbfnm21rtkuo" path="res://ai/tasks/conditions/is_unregistered.gd" id="3_mtixs"]
[ext_resource type="Script" uid="uid://xom38ohdwfms" path="res://ai/tasks/conditions/has_quest.gd" id="4_1441p"]
[ext_resource type="Script" uid="uid://bhatmue8jr2ab" path="res://ai/tasks/actions/use_guild_equipment.gd" id="7_nqy1p"]

[sub_resource type="BlackboardPlan" id="BlackboardPlan_6h604"]
var/pos/name = &"pos"
var/pos/type = 5
var/pos/value = Vector2(0, 0)
var/pos/hint = 0
var/pos/hint_string = ""
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 0.0
var/speed/hint = 0
var/speed/hint_string = ""

[sub_resource type="BTComment" id="BTComment_fe6jf"]
custom_name = "Walk from the entrance to the designated start point of the guild."

[sub_resource type="BBVariant" id="BBVariant_1441p"]
type = 5
saved_value = Vector2(900, 700)
resource_name = "(900.0, 700.0)"

[sub_resource type="BTSetVar" id="BTSetVar_mtixs"]
variable = &"pos"
value = SubResource("BBVariant_1441p")

[sub_resource type="BTAction" id="BTAction_0kac8"]
script = ExtResource("1_s3kkm")

[sub_resource type="BTWait" id="BTWait_s3kkm"]
duration = 1.5

[sub_resource type="BTAction" id="BTAction_nqy1p"]
script = ExtResource("2_fe6jf")

[sub_resource type="BTSequence" id="BTSequence_s3kkm"]
custom_name = "Enter the Guild"
children = [SubResource("BTSetVar_mtixs"), SubResource("BTAction_0kac8"), SubResource("BTWait_s3kkm"), SubResource("BTAction_nqy1p")]

[sub_resource type="BTDecorator" id="BTDecorator_nqy1p"]
children = [SubResource("BTSequence_s3kkm")]
script = ExtResource("2_mtixs")
activity = "Arriving"

[sub_resource type="BTRunLimit" id="BTRunLimit_1441p"]
children = [SubResource("BTDecorator_nqy1p")]

[sub_resource type="BTComment" id="BTComment_0kac8"]
custom_name = "Always try to register as a guildmember as their first action"

[sub_resource type="BTCondition" id="BTCondition_s18yy"]
script = ExtResource("3_mtixs")

[sub_resource type="BTAction" id="BTAction_700su"]
script = ExtResource("2_1441p")
employee_name = "Receptionist"
service_name = "register"

[sub_resource type="BTAction" id="BTAction_s18yy"]
script = ExtResource("2_fe6jf")

[sub_resource type="BTSequence" id="BTSequence_1441p"]
custom_name = "Register as a Guildmember"
children = [SubResource("BTCondition_s18yy"), SubResource("BTAction_700su"), SubResource("BTAction_s18yy")]

[sub_resource type="BTDecorator" id="BTDecorator_700su"]
children = [SubResource("BTSequence_1441p")]
script = ExtResource("2_mtixs")
activity = "Registering as an adventurer"

[sub_resource type="BTCondition" id="BTCondition_mtixs"]
script = ExtResource("4_1441p")
invert = true

[sub_resource type="BTAction" id="BTAction_8lwgx"]
script = ExtResource("7_nqy1p")
equipment_name = "Quest Board"
service_name = "quest"

[sub_resource type="BTAction" id="BTAction_mwsop"]
script = ExtResource("2_fe6jf")

[sub_resource type="BTSequence" id="BTSequence_nqy1p"]
custom_name = "Get a Quest"
children = [SubResource("BTCondition_mtixs"), SubResource("BTAction_8lwgx"), SubResource("BTAction_mwsop")]

[sub_resource type="BTDecorator" id="BTDecorator_s18yy"]
children = [SubResource("BTSequence_nqy1p")]
script = ExtResource("2_mtixs")
activity = "Getting a quest"

[sub_resource type="BTProbability" id="BTProbability_s3kkm"]
children = [SubResource("BTDecorator_s18yy")]

[sub_resource type="BTComment" id="BTComment_mwsop"]
custom_name = "TODO: Make them talk to a random other adventurer"

[sub_resource type="BTDecorator" id="BTDecorator_jq6fo"]
children = [SubResource("BTComment_mwsop")]
script = ExtResource("2_mtixs")

[sub_resource type="BTCooldown" id="BTCooldown_mtixs"]
duration = 5.0
trigger_on_failure = true
children = [SubResource("BTDecorator_jq6fo")]

[sub_resource type="BTProbability" id="BTProbability_1441p"]
children = [SubResource("BTCooldown_mtixs")]
_enabled = false

[sub_resource type="BTWait" id="BTWait_8lwgx"]
duration = 3.0
custom_name = "Idle"

[sub_resource type="BTProbability" id="BTProbability_gc1l4"]
children = [SubResource("BTWait_8lwgx")]

[sub_resource type="BTAction" id="BTAction_jq6fo"]
script = ExtResource("2_fe6jf")

[sub_resource type="BTProbability" id="BTProbability_8lwgx"]
children = [SubResource("BTAction_jq6fo")]

[sub_resource type="BTProbabilitySelector" id="BTProbabilitySelector_mtixs"]
children = [SubResource("BTProbability_s3kkm"), SubResource("BTProbability_1441p"), SubResource("BTProbability_gc1l4"), SubResource("BTProbability_8lwgx")]

[sub_resource type="BTComment" id="BTComment_y4ura"]
custom_name = "TODO: Make them wander to a random location after the interaction"

[sub_resource type="BTSequence" id="BTSequence_4w6ij"]
children = [SubResource("BTProbabilitySelector_mtixs"), SubResource("BTComment_y4ura")]

[sub_resource type="BTSelector" id="BTSelector_mwsop"]
children = [SubResource("BTComment_fe6jf"), SubResource("BTRunLimit_1441p"), SubResource("BTComment_0kac8"), SubResource("BTDecorator_700su"), SubResource("BTSequence_4w6ij")]

[sub_resource type="BTRepeat" id="BTRepeat_s3kkm"]
forever = true
children = [SubResource("BTSelector_mwsop")]

[resource]
blackboard_plan = SubResource("BlackboardPlan_6h604")
root_task = SubResource("BTRepeat_s3kkm")
