From 073a74bb2260d46e43748066a51ba579e2e8ef46 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 25 Nov 2025 17:32:27 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=9A=B8Rebalanded=20fight=20to=20make?= =?UTF-8?q?=20it=20more=20likely=20to=20win?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/CSharp/Common/Fight/Actions/BlobAttackAction.cs | 9 +++------ scripts/CSharp/Common/Fight/AllyFighters.cs | 2 +- scripts/CSharp/Common/Fight/FightWorld.cs | 8 ++++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/CSharp/Common/Fight/Actions/BlobAttackAction.cs b/scripts/CSharp/Common/Fight/Actions/BlobAttackAction.cs index fa3da73..f0e7f90 100644 --- a/scripts/CSharp/Common/Fight/Actions/BlobAttackAction.cs +++ b/scripts/CSharp/Common/Fight/Actions/BlobAttackAction.cs @@ -4,11 +4,8 @@ using Babushka.scripts.CSharp.Common.Util; namespace Babushka.scripts.CSharp.Common.Fight.Actions; -public class BlobAttackAction : FighterAction +public class BlobAttackAction(int damage = 3) : FighterAction { - // settings - private const int Damage = 3; - public override Variant> GetAnimationEnd() { return 1; @@ -21,7 +18,7 @@ public class BlobAttackAction : FighterAction public override void ExecuteAction() { - FightWorld.Instance.allyFighters.vesnaFighter.AddHealth(-Damage); + FightWorld.Instance.allyFighters.vesnaFighter.AddHealth(-damage); } public override async Task AnimateAction(AllFightersVisual allFightersVisual) @@ -34,7 +31,7 @@ public class BlobAttackAction : FighterAction await currentFighterVisual.AnimatePosToTarget(targetFighterVisual); _ = targetFighterVisual.AnimateHit(); - targetFighterVisual.SpawnDamageIndicatorNumber(Damage); + targetFighterVisual.SpawnDamageIndicatorNumber(damage); await currentFighterVisual.AnimatePosToBase(); } } \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/AllyFighters.cs b/scripts/CSharp/Common/Fight/AllyFighters.cs index 765a9cb..2881ee7 100644 --- a/scripts/CSharp/Common/Fight/AllyFighters.cs +++ b/scripts/CSharp/Common/Fight/AllyFighters.cs @@ -7,7 +7,7 @@ public class AllyFighters public FightWorld.Fighter vesnaFighter = new() { type = FightWorld.Fighter.Type.Vesna, - maxHealth = 20, + maxHealth = 60, availableActions = [ new AllyAttackAction() diff --git a/scripts/CSharp/Common/Fight/FightWorld.cs b/scripts/CSharp/Common/Fight/FightWorld.cs index be34387..a6ec8d4 100644 --- a/scripts/CSharp/Common/Fight/FightWorld.cs +++ b/scripts/CSharp/Common/Fight/FightWorld.cs @@ -133,7 +133,7 @@ public partial class FightWorld : Node { var enemyGroups = new List(); - var enemyGroupCount = GD.RandRange(1, 3); + var enemyGroupCount = GD.RandRange(1, 2); for (var i = 0; i < enemyGroupCount; i++) { @@ -150,7 +150,7 @@ public partial class FightWorld : Node fighters = [] }; - var enemyCount = GD.RandRange(1, 3); + var enemyCount = GD.RandRange(2, 3); for (var i = 0; i < enemyCount; i++) { @@ -178,10 +178,10 @@ public partial class FightWorld : Node { type = type, health = null, - maxHealth = 12, + maxHealth = GD.RandRange(8, 20), availableActions = [ - new BlobAttackAction() + new BlobAttackAction(GD.RandRange(2, 5)) ] }; From 3c370e30a0fa7423827b669b51cf3abc3b770514 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 25 Nov 2025 18:07:21 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8Added=20end=20of=20night=20scene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefabs/fight/fight_scene_switcher.tscn | 1 + scripts/CSharp/Common/Fight/FightSceneSwitcher.cs | 13 +++++++++++++ scripts/CSharp/Common/Fight/FightWorld.cs | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/prefabs/fight/fight_scene_switcher.tscn b/prefabs/fight/fight_scene_switcher.tscn index 8680ba4..f97f04b 100644 --- a/prefabs/fight/fight_scene_switcher.tscn +++ b/prefabs/fight/fight_scene_switcher.tscn @@ -6,3 +6,4 @@ script = ExtResource("1_5dt1r") _fightRoomScenePath = "res://scenes/Babushka_scene_fight_world_room.tscn" _fightHappeningScene = "res://scenes/Babushka_scene_fight_happening.tscn" +_nightEndScene = "res://scenes/Babushka_scene_indoor_vesnas_room.tscn" diff --git a/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs b/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs index 3e4f9c2..185c7b7 100644 --- a/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs +++ b/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs @@ -11,6 +11,7 @@ public partial class FightSceneSwitcher : Node [Export] private Node _sceneRoot = null!; [Export] private string _fightRoomScenePath = null!; [Export] private string _fightHappeningScene = null!; + [Export] private string _nightEndScene = null!; private void LoadNext() { @@ -36,6 +37,12 @@ public partial class FightSceneSwitcher : Node if (!FightWorld.Instance.currentRoom.paths.TryGetValue(pathIndex, out var nextRoom)) throw new Exception("Trying to go down a non-existent path"); + if (nextRoom.specialRoom == FightWorld.Room.Special.EndOfNight) + { + ExitFightWorld(); + return; + } + FightWorld.Instance.currentRoom = nextRoom; LoadNext(); } @@ -60,4 +67,10 @@ public partial class FightSceneSwitcher : Node FightWorld.Instance.fightHappeningData = null; LoadNext(); } + + public void ExitFightWorld() + { + SceneTransitionThreaded.Instance.ChangeSceneToFile(_nightEndScene); + _ = UnloadAfterDelay(); + } } \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/FightWorld.cs b/scripts/CSharp/Common/Fight/FightWorld.cs index a6ec8d4..7cfb3b4 100644 --- a/scripts/CSharp/Common/Fight/FightWorld.cs +++ b/scripts/CSharp/Common/Fight/FightWorld.cs @@ -14,8 +14,14 @@ public partial class FightWorld : Node public class Room { + public enum Special + { + None, + EndOfNight + } public required Dictionary paths; public required List enemyGroups; + public Special specialRoom = Special.None; } public class FighterGroup @@ -108,6 +114,13 @@ public partial class FightWorld : Node { rooms.Add(GenerateDisconnectedRoom()); } + + rooms.Add(new Room + { + paths = [], + enemyGroups = [], + specialRoom = Room.Special.EndOfNight + }); // Connect rooms linearly for (var i = 0; i < rooms.Count - 1; i++) From 3f4dfccbc690576bb3af196dec81a98342500a9f Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 25 Nov 2025 18:43:48 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9BMake=20the=20FightWorld=20reset?= =?UTF-8?q?=20when=20sleeping=20in=20the=20bed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/Babushka_scene_indoor_vesnas_room.tscn | 10 ++++++++-- scripts/CSharp/Common/Fight/FightWorld.cs | 3 +-- scripts/CSharp/Common/Fight/NightStarter.cs | 16 ++++++++++++++++ scripts/CSharp/Common/Fight/NightStarter.cs.uid | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 scripts/CSharp/Common/Fight/NightStarter.cs create mode 100644 scripts/CSharp/Common/Fight/NightStarter.cs.uid diff --git a/scenes/Babushka_scene_indoor_vesnas_room.tscn b/scenes/Babushka_scene_indoor_vesnas_room.tscn index bfe129d..f5adf59 100644 --- a/scenes/Babushka_scene_indoor_vesnas_room.tscn +++ b/scenes/Babushka_scene_indoor_vesnas_room.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=14 format=3 uid="uid://ceaa2qj2bmw43"] +[gd_scene load_steps=15 format=3 uid="uid://ceaa2qj2bmw43"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_c6eln"] [ext_resource type="Texture2D" uid="uid://cugtxcfuds31r" path="res://art/indoor/Babushka_bg_01.png" id="2_j25a2"] [ext_resource type="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="8_j25a2"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="8_phqdf"] [ext_resource type="Resource" uid="uid://csj15gnlx1jmx" path="res://resources/quests/demo/8_goto_bed.tres" id="9_heyef"] +[ext_resource type="Script" uid="uid://puw74w6lmcvl" path="res://scripts/CSharp/Common/Fight/NightStarter.cs" id="10_j25a2"] [ext_resource type="Texture2D" uid="uid://cop1vjvhwlsec" path="res://art/indoor/room export/Room_01_shelf.png" id="13_11fdt"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="18_3gevq"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="23_408bg"] @@ -120,9 +121,14 @@ _id = 0 [node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"] shape = SubResource("CircleShape2D_2spkc") +[node name="NightStarter" type="Node" parent="."] +script = ExtResource("10_j25a2") +_sceneIndexToLoad = 1 + [connection signal="Interacted" from="BedInteraction" to="BedInteraction/QuestCompleter" method="Trigger"] -[connection signal="InteractedTool" from="BedInteraction" to="." method="LoadSceneAtIndex"] +[connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"] [connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"] +[connection signal="LoadScene" from="NightStarter" to="." method="LoadSceneAtIndex"] [editable path="Vesna"] [editable path="BedInteraction"] diff --git a/scripts/CSharp/Common/Fight/FightWorld.cs b/scripts/CSharp/Common/Fight/FightWorld.cs index 7cfb3b4..083b60f 100644 --- a/scripts/CSharp/Common/Fight/FightWorld.cs +++ b/scripts/CSharp/Common/Fight/FightWorld.cs @@ -72,7 +72,6 @@ public partial class FightWorld : Node public override void _EnterTree() { Instance = this; - MyEnterTree(); } #endregion @@ -82,7 +81,7 @@ public partial class FightWorld : Node public FightHappeningData? fightHappeningData = null; public AllyFighters allyFighters = new(); - public void MyEnterTree() + public void ResetFightWorld() { Generate(); currentRoom = world!.rooms[0]; diff --git a/scripts/CSharp/Common/Fight/NightStarter.cs b/scripts/CSharp/Common/Fight/NightStarter.cs new file mode 100644 index 0000000..2690dc1 --- /dev/null +++ b/scripts/CSharp/Common/Fight/NightStarter.cs @@ -0,0 +1,16 @@ +using Godot; +using System; +using Babushka.scripts.CSharp.Common.Fight; + +public partial class NightStarter : Node +{ + [Export] private int _sceneIndexToLoad; + + [Signal] public delegate void LoadSceneEventHandler(int index); + + public void StartNight() + { + FightWorld.Instance.ResetFightWorld(); + EmitSignalLoadScene(_sceneIndexToLoad); + } +} diff --git a/scripts/CSharp/Common/Fight/NightStarter.cs.uid b/scripts/CSharp/Common/Fight/NightStarter.cs.uid new file mode 100644 index 0000000..14436e0 --- /dev/null +++ b/scripts/CSharp/Common/Fight/NightStarter.cs.uid @@ -0,0 +1 @@ +uid://puw74w6lmcvl