From 50b2c04cb4a024eb8f25f8a1c9e1e2a0f72b2a35 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 4 Nov 2025 13:55:37 +0100 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20fighters=20keep=20fi?= =?UTF-8?q?ghting=20at=200=20hp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/CSharp/Common/Fight/FightHappening.cs | 13 ++++++++ scripts/CSharp/Common/Fight/FighterTurn.cs | 32 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/scripts/CSharp/Common/Fight/FightHappening.cs b/scripts/CSharp/Common/Fight/FightHappening.cs index e1df008..328710c 100644 --- a/scripts/CSharp/Common/Fight/FightHappening.cs +++ b/scripts/CSharp/Common/Fight/FightHappening.cs @@ -192,6 +192,8 @@ public partial class FightHappening : Node HappeningData.actionStaging = null; HappeningData.fightersEnterStaging = null; + RemoveDeadFighters(); + if (!FightWorld.Instance.allyFighters.IsAlive()) { ChangeState(FightState.EnemyWin); @@ -345,6 +347,17 @@ public partial class FightHappening : Node vesnaFighter.health = vesnaFighter.maxHealth; GD.Print("Vesna has been revived. This is for the current prototype only"); } + + private void RemoveDeadFighters() + { + foreach (var f in HappeningData.fighterTurn) + { + if (f.IsDead()) + { + HappeningData.fighterTurn.Remove(f); + } + } + } #endregion // Game Logic diff --git a/scripts/CSharp/Common/Fight/FighterTurn.cs b/scripts/CSharp/Common/Fight/FighterTurn.cs index 4f546d8..198afa5 100644 --- a/scripts/CSharp/Common/Fight/FighterTurn.cs +++ b/scripts/CSharp/Common/Fight/FighterTurn.cs @@ -1,9 +1,12 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.Diagnostics; +using System.Linq; namespace Babushka.scripts.CSharp.Common.Fight; -public class FighterTurn +public class FighterTurn : IEnumerable { private class Node { @@ -13,7 +16,8 @@ public class FighterTurn private Node? _currentNode; - public FightWorld.Fighter Current => _currentNode?.fighter ?? throw new InvalidOperationException("No current fighter"); + public FightWorld.Fighter Current => + _currentNode?.fighter ?? throw new InvalidOperationException("No current fighter"); public void Next() { @@ -84,7 +88,7 @@ public class FighterTurn { // if removing current, keep current // it will be implicitly deleted by loss of reference on the next Next() call - + node.next = node.next.next; return true; } @@ -94,4 +98,26 @@ public class FighterTurn return false; } + + public IEnumerator GetEnumerator() + { + if (_currentNode == null) return Enumerable.Empty().GetEnumerator(); + + var list = new List(); + var n = _currentNode; + while (true) + { + list.Add(n.fighter); + if (n.next == _currentNode) + break; + n = n.next; + } + + return list.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } \ No newline at end of file From f51275ccc024477ec92e3f36d22b569114fea1fd Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 4 Nov 2025 16:42:16 +0100 Subject: [PATCH 2/7] =?UTF-8?q?=E2=9C=A8=20made=20dead=20fighters=20shrink?= =?UTF-8?q?=20to=20telegraph=20to=20the=20player=20that=20they=20are=20dea?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CSharp/Common/Fight/AllFightersVisual.cs | 2 +- scripts/CSharp/Common/Fight/FighterVisual.cs | 22 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/scripts/CSharp/Common/Fight/AllFightersVisual.cs b/scripts/CSharp/Common/Fight/AllFightersVisual.cs index e24f218..d015d2b 100644 --- a/scripts/CSharp/Common/Fight/AllFightersVisual.cs +++ b/scripts/CSharp/Common/Fight/AllFightersVisual.cs @@ -59,7 +59,7 @@ public partial class AllFightersVisual : Node if (from == FightHappening.FightState.ActionAnim) { - _fighterVisuals.Values.ForEach(fv => fv.UpdateHealthBar()); + _fighterVisuals.Values.ForEach(fv => fv.UpdateVisuals()); } } diff --git a/scripts/CSharp/Common/Fight/FighterVisual.cs b/scripts/CSharp/Common/Fight/FighterVisual.cs index b5924df..4b0bb60 100644 --- a/scripts/CSharp/Common/Fight/FighterVisual.cs +++ b/scripts/CSharp/Common/Fight/FighterVisual.cs @@ -7,7 +7,6 @@ using Godot.Collections; namespace Babushka.scripts.CSharp.Common.Fight; - public partial class FighterVisual : Node2D { #region Shortcuts @@ -28,22 +27,21 @@ public partial class FighterVisual : Node2D public void Initialize(FightWorld.Fighter fighter) { _boundFighter = fighter; - UpdateMirrorState(); - UpdateHealthBar(); + UpdateVisuals(); } - /// - /// fighter visuals should always look to the right in the scene. - /// This function flips the sprites horizontally, when the fighter is an enemy. - /// - private void UpdateMirrorState() + public void UpdateVisuals() { - _visualParent.Scale = new Vector2(_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1, 1); - } + // fighter visuals should always look to the right in the scene. + // This function flips the sprites horizontally, when the fighter is an enemy. + _visualParent.Scale = new Vector2( + _boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1, + _boundFighter.IsDead() ? .3f : 1); - public void UpdateHealthBar() - { healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth); + + //if (_boundFighter.IsDead()) + // _visualParent.Scale = new Vector2(1.4f, 0.3f); } public void SetTargetSelectionActive(bool value) From edbd4a182b35ceb17d9d504ed72014702ed55279 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 11 Nov 2025 10:19:37 +0100 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=8E=A8Removed=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/CSharp/Common/Fight/FighterVisual.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/CSharp/Common/Fight/FighterVisual.cs b/scripts/CSharp/Common/Fight/FighterVisual.cs index 4b0bb60..04d1002 100644 --- a/scripts/CSharp/Common/Fight/FighterVisual.cs +++ b/scripts/CSharp/Common/Fight/FighterVisual.cs @@ -39,9 +39,6 @@ public partial class FighterVisual : Node2D _boundFighter.IsDead() ? .3f : 1); healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth); - - //if (_boundFighter.IsDead()) - // _visualParent.Scale = new Vector2(1.4f, 0.3f); } public void SetTargetSelectionActive(bool value) From c814d7606db7eba65e0c2eb4a32cd50746bf1e0b Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 11 Nov 2025 11:12:54 +0100 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=90=9BFixed=20wrong=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/Babushka_scene_bootstrap.tscn | 2 +- scenes/Babushka_scene_farm_outside_2d.tscn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scenes/Babushka_scene_bootstrap.tscn b/scenes/Babushka_scene_bootstrap.tscn index fe66be1..6ae60a7 100644 --- a/scenes/Babushka_scene_bootstrap.tscn +++ b/scenes/Babushka_scene_bootstrap.tscn @@ -5,6 +5,6 @@ [node name="BabushkaSceneBootstrap" type="Node2D"] [node name="BabushkaSceneStartMenu" parent="." instance=ExtResource("1_15ton")] -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_fight_world_room.tscn") +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d.tscn") [node name="SceneParent" type="Node" parent="."] diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index 250ec57..c9a605c 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -39,7 +39,7 @@ [ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="35_64mdn"] [ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"] [ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="36_fv1t2"] -[ext_resource type="Texture2D" uid="uid://b4krfobwq3r3h" path="res://art/test_tomatos.png" id="36_l7ekk"] +[ext_resource type="Texture2D" uid="uid://cyyxqmphcrjj" path="res://art/farm/farming/farmobjekte/tomaten/tomaten_template.png" id="36_l7ekk"] [ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"] [ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"] [ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_taxvr"] From 74096f2c7144ead0f5e21d8b072279436e5f3c04 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 11 Nov 2025 12:44:36 +0100 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=90=9BFixed=20sprite=20outline=20fall?= =?UTF-8?q?back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 6fcf84f..e7f1380 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -13,7 +13,7 @@ public partial class InteractionArea2D : Node2D [Export] private bool _useOutline = true; [Export] private ShaderMaterial _outlineMaterial; [Export] private CanvasItem? _spriteToOutline; // keep to not break old usages. TODO: remove later - [Export] private CanvasItem[] _spritesToOutline; + [Export] private CanvasItem[] _spritesToOutline = []; [Export] private bool _showLabel = true; [Export] private int _id = -1; // TODO: remove From 1531ffbf8d358c6bfb4bcbea9af101c85152b646 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 11 Nov 2025 12:49:38 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=E2=9C=A8Sleeping=20in=20bed=20now=20loads?= =?UTF-8?q?=20the=20new=20fight=20world=20scene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/Babushka_scene_indoor_vesnas_room.tscn | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scenes/Babushka_scene_indoor_vesnas_room.tscn b/scenes/Babushka_scene_indoor_vesnas_room.tscn index c2b4f8d..bfe129d 100644 --- a/scenes/Babushka_scene_indoor_vesnas_room.tscn +++ b/scenes/Babushka_scene_indoor_vesnas_room.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://ceaa2qj2bmw43"] +[gd_scene load_steps=14 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"] @@ -17,6 +17,10 @@ size = Vector2(3836, 1086) [sub_resource type="RectangleShape2D" id="RectangleShape2D_2spkc"] size = Vector2(238.25, 189.75) +[sub_resource type="CircleShape2D" id="CircleShape2D_phqdf"] +resource_local_to_scene = true +radius = 381.93 + [sub_resource type="CircleShape2D" id="CircleShape2D_2spkc"] resource_local_to_scene = true radius = 509.071 @@ -24,7 +28,7 @@ radius = 509.071 [node name="VesnasRoom" type="Node2D"] y_sort_enabled = true script = ExtResource("1_c6eln") -_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_forest_fight_1_2d.tscn") +_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_fight_world_room.tscn") [node name="Colliders" type="Node2D" parent="."] position = Vector2(1297, 5292) @@ -97,10 +101,13 @@ _followNode = NodePath("../Vesna/CharacterBody2D") [node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")] [node name="BedInteraction" parent="." instance=ExtResource("8_phqdf")] -position = Vector2(-1429, 487) -_useSprite = false +position = Vector2(-1415, 489) _id = 1 +[node name="CollisionShape3D" parent="BedInteraction/Area2D" index="0"] +position = Vector2(-382, 9) +shape = SubResource("CircleShape2D_phqdf") + [node name="QuestCompleter" type="Node" parent="BedInteraction"] script = ExtResource("8_j25a2") questResource = ExtResource("9_heyef") @@ -108,7 +115,6 @@ toStatus = 2 [node name="DoorInteraction" parent="." instance=ExtResource("8_phqdf")] position = Vector2(777, 201) -_useSprite = false _id = 0 [node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"] @@ -119,4 +125,5 @@ shape = SubResource("CircleShape2D_2spkc") [connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"] [editable path="Vesna"] +[editable path="BedInteraction"] [editable path="DoorInteraction"] From 54bfc3c021186836bae80a1b6508f2e7b8eab654 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 11 Nov 2025 14:06:58 +0100 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20enemy=20groups=20sho?= =?UTF-8?q?w=20in=20different=20spots=20and=20even=20when=20all=20enemies?= =?UTF-8?q?=20are=20dead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs b/scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs index 12c316d..de19a5c 100644 --- a/scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs +++ b/scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Babushka.scripts.CSharp.Common.Util; using Godot; @@ -15,15 +16,14 @@ public partial class FightRoomSceneSetup : Node { var room = FightWorld.Instance.currentRoom!; - var i = 0; - foreach (var availableParent in _enemyGroupSpawns.Shuffle()) + foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups)) { - var enemyGroup = room.enemyGroups[i]; + if (group.AreAllDead()) + continue; + var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate(); - roamingEnemyGroup.Initialize(enemyGroup, _fightSceneSwitcher); - availableParent.AddChild(roamingEnemyGroup); - if (i >= room.enemyGroups.Count - 1) break; - i++; + roamingEnemyGroup.Initialize(group, _fightSceneSwitcher); + parent.AddChild(roamingEnemyGroup); } } } \ No newline at end of file