Revamp boss logic

This commit is contained in:
2025-03-18 00:12:36 -07:00
parent f50eaa1847
commit 13e2ef90c8
84 changed files with 2547 additions and 3655 deletions

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=12 format=3 uid="uid://by67pn7fdsg1m"]
[gd_scene load_steps=13 format=3 uid="uid://by67pn7fdsg1m"]
[ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"]
[ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/dungeon/floors/Floor00.tscn" id="2_0m8h8"]
[ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor01.tscn" id="2_merfv"]
[ext_resource type="PackedScene" uid="uid://g28xmp6cn16h" path="res://src/map/dungeon/floors/Floor10.tscn" id="3_caf7v"]
[ext_resource type="PackedScene" uid="uid://dmiqwmivkjgmq" path="res://src/map/dungeon/floors/Floor02.tscn" id="4_8y0oy"]
[ext_resource type="PackedScene" uid="uid://dl1scvkp8r5sw" path="res://src/map/dungeon/floors/Floor03.tscn" id="5_uag72"]
[ext_resource type="PackedScene" uid="uid://cikq7vuorlpbl" path="res://src/map/dungeon/floors/Floor04.tscn" id="6_55rmo"]
@@ -14,6 +15,6 @@
[node name="Map" type="Node3D"]
script = ExtResource("1_bw70o")
_floors = Array[PackedScene]([ExtResource("2_0m8h8"), ExtResource("11_y74f3"), ExtResource("2_merfv"), ExtResource("4_8y0oy"), ExtResource("5_uag72"), ExtResource("6_55rmo"), ExtResource("7_f6kwn"), ExtResource("8_ne2vg"), ExtResource("9_abpbr"), ExtResource("10_caf7v")])
_floors = Array[PackedScene]([ExtResource("2_0m8h8"), ExtResource("3_caf7v"), ExtResource("11_y74f3"), ExtResource("2_merfv"), ExtResource("4_8y0oy"), ExtResource("5_uag72"), ExtResource("6_55rmo"), ExtResource("7_f6kwn"), ExtResource("8_ne2vg"), ExtResource("9_abpbr"), ExtResource("10_caf7v")])
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]

View File

@@ -10,18 +10,16 @@ public partial class BossFloor : Node3D, IDungeonFloor
{
public override void _Notification(int what) => this.Notify(what);
private BossRoomA BossRoom;
[Node] private BossRoomA BossFloorA { get; set; } = default!;
public ImmutableList<IDungeonRoom> Rooms => [];
public void InitializeDungeon()
{
var bossRoomScene = GD.Load<PackedScene>($"res://src/map/dungeon/scenes/BossRoom.tscn");
BossRoom = bossRoomScene.Instantiate<BossRoomA>();
FloorIsLoaded = true;
FloorIsLoaded = true;
}
public bool FloorIsLoaded { get; set; }
public Transform3D GetPlayerSpawnPoint() => BossRoom.PlayerSpawn.GlobalTransform;
public Transform3D GetPlayerSpawnPoint() => BossFloorA.PlayerSpawn.GlobalTransform;
}

View File

@@ -1,4 +1,4 @@
using Chickensoft.AutoInject;
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
@@ -9,28 +9,37 @@ public partial class BossRoomA : Node3D, IBossRoom
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] public IGame Game => this.DependOn<IGame>();
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
[Node] public Node3D HorseHeadStatue { get; set; } = default!;
[Node] public Node3D OxFaceStatue { get; set; } = default!;
[Node] public Boss OxFace { get; set; } = default!;
[Node] public BossTypeA OxFace { get; set; } = default!;
[Node] public Boss HorseFace { get; set; } = default!;
[Node] public BossTypeA HorseFace { get; set; } = default!;
[Node] public Area3D ActivateTrap { get; set; } = default!;
[Node] public Node3D GateCollision { get; set; } = default!;
[Node] private Area3D _exit { get; set; } = default!;
public void Setup()
{
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
OxFace.IsDefeated.Sync += BossStatusUpdate;
HorseFace.IsDefeated.Sync += BossStatusUpdate;
OxFace.CurrentHP.Sync += BossStatusUpdate;
HorseFace.CurrentHP.Sync += BossStatusUpdate;
_exit.AreaEntered += Exit_AreaEntered;
}
private void ActivateTrap_BodyEntered(Node3D body) => StartBossFight();
private void ActivateTrap_BodyEntered(Node3D body)
{
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
StartBossFight();
}
public void StartBossFight()
{
@@ -45,9 +54,14 @@ public partial class BossRoomA : Node3D, IBossRoom
GateCollision.CallDeferred(MethodName.QueueFree);
}
private void BossStatusUpdate(bool obj)
private void BossStatusUpdate(double hp)
{
if (OxFace.IsDefeated.Value && HorseFace.IsDefeated.Value)
if (OxFace.CurrentHP.Value <= 0 && HorseFace.CurrentHP.Value <= 0)
OnBossFightEnded();
}
public void ExitReached()
=> Game.FloorExitReached();
private void Exit_AreaEntered(Area3D area) => ExitReached();
}

View File

@@ -12,7 +12,6 @@ public partial class ExitRoom : DungeonRoom
[Dependency] public IGame Game => this.DependOn<IGame>();
[Node] private Area3D _exit { get; set; } = default!;
[Node] private Area3D _room { get; set; } = default!;
public override void _Ready()
{

View File

@@ -6,4 +6,5 @@
[node name="Floor10" type="Node3D"]
script = ExtResource("1_0xjxw")
[node name="Boss Floor A" parent="." instance=ExtResource("2_rbjfi")]
[node name="BossFloorA" parent="." instance=ExtResource("2_rbjfi")]
unique_name_in_owner = true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=132 format=4 uid="uid://5ja3qxn8h7iw"]
[gd_scene load_steps=134 format=4 uid="uid://5ja3qxn8h7iw"]
[ext_resource type="Script" uid="uid://tqyybt313web" path="res://src/map/dungeon/code/BossRoomA.cs" id="1_0h3lb"]
[ext_resource type="Texture2D" uid="uid://vjbe1lg810gh" path="res://src/map/dungeon/models/Set A/15. Boss Floor A/15_A1_BOSS FLOOR A_VER_swirled_column.png" id="2_06eum"]
@@ -758,6 +758,9 @@ _surfaces = [{
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_d6sdf")
[sub_resource type="BoxShape3D" id="BoxShape3D_01whq"]
size = Vector3(3.42822, 1.92615, 1.85886)
[sub_resource type="ArrayMesh" id="ArrayMesh_2xh7e"]
_surfaces = [{
"aabb": AABB(-10.8214, -29.365, -6.19888e-06, 21.6429, 58.73, 1.14441e-05),
@@ -1594,7 +1597,10 @@ size = Vector3(44.8284, 85.1827, 35.0648)
size = Vector3(23.3561, 85.1827, 86.7729)
[sub_resource type="BoxShape3D" id="BoxShape3D_2y86l"]
size = Vector3(57.711, 85.1827, 121.41)
size = Vector3(24.4394, 85.1827, 121.41)
[sub_resource type="BoxShape3D" id="BoxShape3D_blf77"]
size = Vector3(59.626, 85.1827, 51.1984)
[sub_resource type="BoxShape3D" id="BoxShape3D_ukub6"]
size = Vector3(11.6031, 85.1827, 18.5975)
@@ -1662,12 +1668,12 @@ data = PackedVector3Array(-1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1,
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_1txpk"]
data = PackedVector3Array(-1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_01whq"]
size = Vector3(3.42822, 1.92615, 1.85886)
[sub_resource type="BoxShape3D" id="BoxShape3D_pkvyy"]
size = Vector3(6.25977, 15.6429, 37.6357)
[sub_resource type="BoxShape3D" id="BoxShape3D_1qa0g"]
size = Vector3(12.4734, 10.2039, 7.09571)
[node name="Boss Floor A" type="Node3D"]
script = ExtResource("1_0h3lb")
@@ -1678,6 +1684,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.135796, -15.9299, 0)
[node name="COLLISION 2" type="MeshInstance3D" parent="Model/15_A1_BOSS FLOOR A_VER_2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -88.3533, 14.402, -0.620708)
visible = false
mesh = SubResource("ArrayMesh_dyjpi")
skeleton = NodePath("")
@@ -1688,11 +1695,13 @@ skeleton = NodePath("")
[node name="COLLISION 3" type="MeshInstance3D" parent="Model/15_A1_BOSS FLOOR A_VER_2"]
transform = Transform3D(19.342, 0, 0, 0, 3.58, 0, 0, 0, 4.493, -118.368, 16.3753, 28.1552)
visible = false
mesh = SubResource("ArrayMesh_tyise")
skeleton = NodePath("")
[node name="COLLISION" type="MeshInstance3D" parent="Model/15_A1_BOSS FLOOR A_VER_2"]
transform = Transform3D(19.342, 0, 0, 0, 3.12, 0, 0, 0, 4.493, -118.368, 16.0099, 6.55423)
visible = false
mesh = SubResource("ArrayMesh_tyise")
skeleton = NodePath("")
@@ -1702,6 +1711,13 @@ transform = Transform3D(0.816274, 0, 0, 0, 1.99383, 0, 0, 0, 1.99383, -145.76, 1
mesh = SubResource("ArrayMesh_xlsos")
skeleton = NodePath("")
[node name="StaticBody3D6" type="StaticBody3D" parent="Model/15_A1_BOSS FLOOR A_VER_2/GateCollision"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.000244141, 2.08616e-07, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Model/15_A1_BOSS FLOOR A_VER_2/GateCollision/StaticBody3D6"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.337311, 0.0641477, -0.00570393)
shape = SubResource("BoxShape3D_01whq")
[node name="BOSS FLOOR_001" type="MeshInstance3D" parent="Model/15_A1_BOSS FLOOR A_VER_2"]
transform = Transform3D(-0.188597, 0, -3.10851e-08, 0, 0.0695013, 0, 5.62062e-08, 0, -0.104304, -81.6436, 15.2955, 15.4911)
mesh = SubResource("ArrayMesh_31d0h")
@@ -1822,9 +1838,13 @@ transform = Transform3D(1, 0, -4.26326e-14, 0, 1, 0, 3.41061e-13, 0, 1, -66.351,
shape = SubResource("BoxShape3D_0u7qe")
[node name="CollisionShape3D7" type="CollisionShape3D" parent="Collision/StaticBody3D3"]
transform = Transform3D(1, 0, -4.26326e-14, 0, 1, 0, 3.41061e-13, 0, 1, -26.3376, -8.11585, 60.0398)
transform = Transform3D(1, 0, 1.84741e-12, 0, 1, 0, 4.54747e-13, 0, 1, -9.70184, 2.74369, 60.0398)
shape = SubResource("BoxShape3D_2y86l")
[node name="CollisionShape3D29" type="CollisionShape3D" parent="Collision/StaticBody3D3"]
transform = Transform3D(1, 0, 6.03961e-12, 0, 1, 0, 4.54747e-13, 0, 1, -27.2952, 2.74369, 24.934)
shape = SubResource("BoxShape3D_blf77")
[node name="CollisionShape3D8" type="CollisionShape3D" parent="Collision/StaticBody3D3"]
transform = Transform3D(1, 0, -4.26326e-14, 0, 1, 0, 3.41061e-13, 0, 1, 191.381, -8.11585, 25.5622)
shape = SubResource("BoxShape3D_ukub6")
@@ -1917,20 +1937,13 @@ transform = Transform3D(19.342, 0, 0, 0, 3.12, 0, 0, 0, 4.493, -118.232, 0.07999
[node name="CollisionShape3D" type="CollisionShape3D" parent="Collision/StaticBody3D5"]
shape = SubResource("ConcavePolygonShape3D_1txpk")
[node name="StaticBody3D6" type="StaticBody3D" parent="Collision"]
transform = Transform3D(0.816274, 0, 0, 0, 1.99383, 0, 0, 0, 1.99383, -145.624, -0.6323, 17.4223)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Collision/StaticBody3D6"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.337311, 0.0641477, -0.00570393)
shape = SubResource("BoxShape3D_01whq")
[node name="Doors" type="Node3D" parent="."]
[node name="Spawn Points" type="Node3D" parent="."]
[node name="PlayerSpawn" type="Marker3D" parent="Spawn Points"]
unique_name_in_owner = true
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -53.747, -2.58899, 17.731)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -53.747, -2.5101, 17.731)
[node name="ItemDatabase" parent="Spawn Points" instance=ExtResource("23_gov56")]
unique_name_in_owner = true
@@ -1957,7 +1970,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -102.157, -2.30863, 13.0139)
[node name="HorseFace" parent="Room" instance=ExtResource("25_a482y")]
unique_name_in_owner = true
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, -102.157, -2.30863, 13.0139)
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, -102.157, -0.510939, 13.0139)
visible = false
[node name="OxFaceStatue" parent="Room" instance=ExtResource("26_futcf")]
@@ -1966,7 +1979,17 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -101.5
[node name="OxFace" parent="Room" instance=ExtResource("27_g6y6v")]
unique_name_in_owner = true
transform = Transform3D(-0.15, 0, -2.26494e-08, 0, 0.15, 0, 2.26494e-08, 0, -0.15, -101.703, -2.44182, 22.0955)
transform = Transform3D(-0.15, 0, -2.26494e-08, 0, 0.15, 0, 2.26494e-08, 0, -0.15, -101.703, -0.479859, 22.0955)
visible = false
[node name="Exit" type="Area3D" parent="Room"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -250.02, -7.44633, 15.2627)
collision_layer = 256
collision_mask = 256
[node name="CollisionShape3D" type="CollisionShape3D" parent="Room/Exit"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.59105, 7.59621, 2.59402)
shape = SubResource("BoxShape3D_1qa0g")
[node name="Minimap" type="Node3D" parent="."]