[gd_scene load_steps=31 format=3 uid="uid://k5aj2slxar7w"]

[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_8ui1h"]
[ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="2_614v4"]
[ext_resource type="Script" uid="uid://dcokqes5wwo3k" path="res://scripts/plants/NerdusReturnAttack.cs" id="3_614v4"]
[ext_resource type="Resource" uid="uid://dme4nvp28otq6" path="res://resources/effects/NerdusEffect.tres" id="4_ga4vy"]
[ext_resource type="Script" uid="uid://btkmd86pn828y" path="res://scripts/plants/behaviours/HpBasedBehaviour.cs" id="5_o1ggp"]

[sub_resource type="Animation" id="Animation_ga4vy"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_o1ggp"]
_data = {
&"RESET": SubResource("Animation_ga4vy")
}

[sub_resource type="Animation" id="Animation_yxvnw"]
length = 1.16668
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5]
}

[sub_resource type="Animation" id="Animation_o12iv"]
length = 1.16668
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [7, 8, 9, 10, 11, 12, 13]
}

[sub_resource type="Animation" id="Animation_6e60l"]
length = 1.16668
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [14, 15, 16, 17, 18, 19, 20]
}

[sub_resource type="Animation" id="Animation_v7ffp"]
length = 0.500008
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [21, 22, 23, 24, 25, 26]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Hurtbox")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.416667),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"ReturnAllDamage"
}]
}

[sub_resource type="Animation" id="Animation_rb7ob"]
length = 0.500008
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [28, 29, 30, 31, 32, 33]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Hurtbox")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.416667),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"ReturnAllDamage"
}]
}

[sub_resource type="Animation" id="Animation_6a4q1"]
length = 0.500008
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [35, 36, 37, 38, 39, 40]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Hurtbox")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.416667),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"ReturnAllDamage"
}]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_pddnl"]
_data = {
&"attack_full": SubResource("Animation_v7ffp"),
&"attack_hdamage": SubResource("Animation_6a4q1"),
&"attack_ldamage": SubResource("Animation_rb7ob"),
&"idle_full": SubResource("Animation_yxvnw"),
&"idle_hdamage": SubResource("Animation_6e60l"),
&"idle_ldamage": SubResource("Animation_o12iv")
}

[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_8ui1h"]

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o12iv"]
animation = &"nerdus/attack_full"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6e60l"]
animation = &"nerdus/attack_ldamage"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_v7ffp"]
animation = &"nerdus/attack_hdamage"

[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_614v4"]
blend_point_0/node = SubResource("AnimationNodeAnimation_o12iv")
blend_point_0/pos = 1.0
blend_point_1/node = SubResource("AnimationNodeAnimation_6e60l")
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_v7ffp")
blend_point_2/pos = 0.0
min_space = 0.0
blend_mode = 1

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ga4vy"]
animation = &"nerdus/idle_full"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o1ggp"]
animation = &"nerdus/idle_hdamage"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yxvnw"]
animation = &"nerdus/idle_ldamage"

[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_o12iv"]
blend_point_0/node = SubResource("AnimationNodeAnimation_ga4vy")
blend_point_0/pos = 1.0
blend_point_1/node = SubResource("AnimationNodeAnimation_o1ggp")
blend_point_1/pos = 0.0
blend_point_2/node = SubResource("AnimationNodeAnimation_yxvnw")
blend_point_2/pos = 0.5
min_space = 0.0
blend_mode = 1

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_6e60l"]
advance_mode = 2

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_v7ffp"]
switch_mode = 2
advance_mode = 2

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rb7ob"]
advance_mode = 2
advance_expression = "get(\"triggered\")
"

[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_rb7ob"]
states/Attack/node = SubResource("AnimationNodeBlendSpace1D_614v4")
states/Attack/position = Vector2(558, 100)
states/Idle/node = SubResource("AnimationNodeBlendSpace1D_o12iv")
states/Idle/position = Vector2(337, 100)
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_6e60l"), "Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_v7ffp"), "Idle", "Attack", SubResource("AnimationNodeStateMachineTransition_rb7ob")]
graph_offset = Vector2(98, -52)

[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_6a4q1"]
graph_offset = Vector2(-406, 116)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_8ui1h")
nodes/TimeScale/position = Vector2(100, 140)
nodes/Tree/node = SubResource("AnimationNodeStateMachine_rb7ob")
nodes/Tree/position = Vector2(-220, 160)
node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]

[sub_resource type="CircleShape2D" id="CircleShape2D_8ui1h"]
radius = 24.0

[sub_resource type="RectangleShape2D" id="RectangleShape2D_ga4vy"]
size = Vector2(73, 48)

[node name="Nerdus" instance=ExtResource("1_8ui1h")]
MaxHP = 200.0

[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_614v4")
hframes = 7
vframes = 6

[node name="AnimationPlayer" parent="." index="1"]
libraries = {
&"": SubResource("AnimationLibrary_o1ggp"),
&"nerdus": SubResource("AnimationLibrary_pddnl")
}

[node name="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeBlendTree_6a4q1")
advance_expression_base_node = NodePath("../Hurtbox")
parameters/TimeScale/scale = 1.0
parameters/Tree/Attack/blend_position = 1.0
parameters/Tree/Idle/blend_position = 1.0

[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(0, 3)
shape = SubResource("CircleShape2D_8ui1h")

[node name="Hurtbox" type="Area2D" parent="." index="4"]
collision_layer = 0
collision_mask = 8
script = ExtResource("3_614v4")
returnEffect = ExtResource("4_ga4vy")
bitesToPeas = 1.6

[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(3.5, 3)
shape = SubResource("RectangleShape2D_ga4vy")

[node name="Behaviour" type="Node" parent="." index="5"]
script = ExtResource("5_o1ggp")
parameters = Array[String](["parameters/Tree/Attack/blend_position", "parameters/Tree/Idle/blend_position"])

[connection signal="OnHPChanged" from="." to="Hurtbox" method="OnHPChanged"]
[connection signal="OnHPChanged" from="." to="Behaviour" method="OnHPChanged"]
