@@ -32,6 +32,9 @@ public partial class BattleDirector : Node2D
3232
3333 private SongData _curSong ;
3434
35+ private bool battleLost = false ;
36+ private bool battleWon = false ;
37+
3538 #endregion
3639
3740 #region Note Handling
@@ -116,6 +119,12 @@ private void Begin()
116119
117120 public override void _Process ( double delta )
118121 {
122+ //check if either one is dead until one is true, feel free to remove if we have a more efficent way of checking
123+ //alternatively, stop the other process since the battle is over
124+ if ( ! battleLost || ! battleWon )
125+ {
126+ CheckBattleStatus ( ) ;
127+ }
119128 TimeKeeper . CurrentTime = Audio . GetPlaybackPosition ( ) ;
120129 CD . CheckMiss ( ) ;
121130 }
@@ -125,6 +134,15 @@ public override void _Process(double delta)
125134
126135 public override void _UnhandledInput ( InputEvent @event )
127136 {
137+ //this one is for calling a debug key to insta-kill the enemy
138+ if ( @event is InputEventKey eventKey && eventKey . Pressed && ! eventKey . Echo )
139+ {
140+ if ( eventKey . Keycode == Key . Key0 )
141+ {
142+ DebugKillEnemy ( ) ;
143+ }
144+ }
145+
128146 if ( @event . IsActionPressed ( "Pause" ) )
129147 {
130148 var pauseMenu = GD . Load < PackedScene > ( "res://scenes/UI/Pause.tscn" ) ;
@@ -209,4 +227,48 @@ private void EventizeRelics()
209227 }
210228 }
211229 #endregion
230+
231+
232+ private void CheckBattleStatus ( )
233+ {
234+ if ( battleLost || battleWon )
235+ return ;
236+
237+ if ( Player . GetCurrentHealth ( ) <= 0 )
238+ {
239+ GD . Print ( "Player is Dead" ) ;
240+ battleLost = true ;
241+ return ;
242+ }
243+
244+ //will have to adjust this to account for when we have multiple enemies at once
245+ if ( Enemy . GetCurrentHealth ( ) <= 0 )
246+ {
247+ GD . Print ( "Enemy is dead" ) ;
248+ battleWon = true ;
249+
250+ //below, old method that just adds a random relic to the inventory
251+ //Reward.GiveRandomRelic(Player.Stats);
252+ //EventizeRelics(); //literally just here to force the ui to update and see if it was added, remove with the proper ui update
253+ //probably won't even need it since we'll be loading to seperate scene anyways
254+
255+ //new method that allows player to choose a relic
256+ ShowRewardSelection ( ) ;
257+
258+ return ;
259+ }
260+ }
261+
262+ private void DebugKillEnemy ( )
263+ {
264+ Enemy . TakeDamage ( 1000 ) ;
265+ }
266+
267+ private void ShowRewardSelection ( )
268+ {
269+ var rewardUI = GD . Load < PackedScene > ( "res://RewardSelectionUI.tscn" )
270+ . Instantiate < RewardSelect > ( ) ;
271+ AddChild ( rewardUI ) ;
272+ rewardUI . Initialize ( Player . Stats ) ;
273+ }
212274}
0 commit comments