From f75b4d53868b511f0f435952a33a0bbadfca8b6b Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Tue, 25 Feb 2025 17:42:14 -0800 Subject: [PATCH 1/5] Added 2 new on loop relics. From now on riff == loop Added relics and sprites Added functionality to check when a loop happens. --- Classes/Relics/assets/Auroboros.png | Bin 0 -> 772 bytes Classes/Relics/assets/Auroboros.png.import | 34 +++++++++++++++++ Classes/Relics/assets/Colorboros.png | Bin 0 -> 891 bytes Classes/Relics/assets/Colorboros.png.import | 34 +++++++++++++++++ Globals/FunkEngineNameSpace.cs | 1 + Globals/Scribe.cs | 36 +++++++++++++++++- project.godot | 2 +- .../BattleDirector/scripts/BattleDirector.cs | 15 +++++++- scenes/BattleDirector/scripts/Conductor.cs | 3 +- .../scripts/NotePlacementBar.cs | 18 ++++++++- 10 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 Classes/Relics/assets/Auroboros.png create mode 100644 Classes/Relics/assets/Auroboros.png.import create mode 100644 Classes/Relics/assets/Colorboros.png create mode 100644 Classes/Relics/assets/Colorboros.png.import diff --git a/Classes/Relics/assets/Auroboros.png b/Classes/Relics/assets/Auroboros.png new file mode 100644 index 0000000000000000000000000000000000000000..b264c9359de0481d9897d0eeece917d5f41e26a6 GIT binary patch literal 772 zcmV+f1N;1mP)Px%zDYzuR9J=Wmd#5WK^TXhZEIE&+^PX19#V_C1O-vVOKG9r3cZwEdg#Hk|3hi9 z^xAVSUQ+PhtI%8ZSRy@@ji5-823nO(P2HrjJ&cp=$Lwa~2fg%#Fq7Sx_xa6lz83y* zXh|CFZJ2KG*~C4oljLEtJUt2ULMO(psAkZ2H4&js5ZT1h%cHJ1T z7#R(VaJOg=AWod`#omVLPK;Y^=>DOJ_rHW20~XmL*tX5!XQPwg!VOxmwho0nJb#){ zfC}z)BGhpicz|nzp%7Q3Ad1so`!EfU@9L@vbGL)Gor4iM48b=IX49h zs|j~OrPSFv^97V}l^f?xc>5kkhy8GX2XpYNA?hk2Apr}k_?*~15bwP3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Bs#AW6l`^1_eq&_F?P-XUaiKyd*8*NGBZ9z<@9 z&27w{3t$3qyLJr$LBO5cA>`AAg)ITfb|jrqCm$NzzrSV*h}DE8i2e_4`~{{X^4)T( Ro8("res://Classes/Relics/assets/relic_GoodVibes.png"), new RelicEffect[] { @@ -117,6 +117,38 @@ public partial class Scribe : Node ), } ), + new RelicTemplate( + "Auroboros", + "Bigger number, better person. Increases combo multiplier every riff.", + GD.Load("res://Classes/Relics/assets/Auroboros.png"), + new RelicEffect[] + { + new RelicEffect( + BattleEffectTrigger.OnLoop, + 1, + (director, val) => + { + director.NotePlacementBar.IncreaseBonusMult(val); + } + ), + } + ), + new RelicTemplate( + "Colorboros", + "Taste the rainbow. Charges the freestyle bar every riff.", + GD.Load("res://Classes/Relics/assets/Colorboros.png"), + new RelicEffect[] + { + new RelicEffect( + BattleEffectTrigger.OnLoop, + 20, + (director, val) => + { + director.NotePlacementBar.IncreaseCharge(val); + } + ), + } + ), }; //TODO: Item pool(s) @@ -124,7 +156,7 @@ public partial class Scribe : Node public static RelicTemplate[] GetRandomRelics(RelicTemplate[] ownedRelics, int count) { var availableRelics = Scribe - .RelicDictionary.Where(r => !ownedRelics.Any(o => o.Name == r.Name)) + .RelicDictionary.Where(r => ownedRelics.All(o => o.Name != r.Name)) .ToArray(); availableRelics = availableRelics diff --git a/project.godot b/project.godot index 86d2eb12..53b7e2a2 100644 --- a/project.godot +++ b/project.godot @@ -34,7 +34,7 @@ project/assembly_name="Funk Engine" [game] -input_scheme="QWERT" +input_scheme="ARROWS" [input] diff --git a/scenes/BattleDirector/scripts/BattleDirector.cs b/scenes/BattleDirector/scripts/BattleDirector.cs index bde2fff5..1e6fb77c 100644 --- a/scenes/BattleDirector/scripts/BattleDirector.cs +++ b/scenes/BattleDirector/scripts/BattleDirector.cs @@ -20,7 +20,7 @@ public partial class BattleDirector : Node2D private ChartManager CM; [Export] - private NotePlacementBar NotePlacementBar; + public NotePlacementBar NotePlacementBar; [Export] private Conductor CD; @@ -29,6 +29,7 @@ public partial class BattleDirector : Node2D private AudioStreamPlayer Audio; private double _timingInterval = .1; //secs, maybe make somewhat note dependent + private double _lastBeat; private SongData _curSong; @@ -125,7 +126,11 @@ private void EndBattle() public override void _Process(double delta) { TimeKeeper.CurrentTime = Audio.GetPlaybackPosition(); - CD.CheckMiss(); + double realBeat = TimeKeeper.CurrentTime / (60 / (double)TimeKeeper.Bpm) % CM.BeatsPerLoop; + CD.CheckMiss(realBeat); + if (realBeat < _lastBeat) + ChartLooped?.Invoke(this); + _lastBeat = realBeat; } #endregion @@ -225,6 +230,9 @@ private void ShowRewardSelection(int amount) private delegate void NotePlacedHandler(BattleDirector BD); private event NotePlacedHandler NotePlaced; + private delegate void ChartLoopHandler(BattleDirector BD); + private event ChartLoopHandler ChartLooped; + private void EventizeRelics() { foreach (var relic in Player.Stats.CurRelics) @@ -236,6 +244,9 @@ private void EventizeRelics() case BattleEffectTrigger.NotePlaced: NotePlaced += effect.OnTrigger; break; + case BattleEffectTrigger.OnLoop: + ChartLooped += effect.OnTrigger; + break; } } } diff --git a/scenes/BattleDirector/scripts/Conductor.cs b/scenes/BattleDirector/scripts/Conductor.cs index 55ce9f50..7c02677a 100644 --- a/scenes/BattleDirector/scripts/Conductor.cs +++ b/scenes/BattleDirector/scripts/Conductor.cs @@ -100,10 +100,9 @@ private void AddExampleNotes() } //Check all lanes for misses from missed inputs - public void CheckMiss() + public void CheckMiss(double realBeat) { //On current beat, if prev beat is active and not inputted - double realBeat = TimeKeeper.CurrentTime / (60 / (double)TimeKeeper.Bpm) % CM.BeatsPerLoop; for (int i = 0; i < _laneData.Length; i++) { if ( diff --git a/scenes/BattleDirector/scripts/NotePlacementBar.cs b/scenes/BattleDirector/scripts/NotePlacementBar.cs index 6baf765f..da337b5d 100644 --- a/scenes/BattleDirector/scripts/NotePlacementBar.cs +++ b/scenes/BattleDirector/scripts/NotePlacementBar.cs @@ -9,6 +9,7 @@ public partial class NotePlacementBar : Node private int _currentBarValue; private int _currentCombo; int comboMult; + int bonusMult; int notesToIncreaseCombo; [Export] @@ -126,10 +127,25 @@ public void HitNote() public void MissNote() { _currentCombo = 0; + bonusMult = 0; DetermineComboMult(); UpdateComboMultText(); } + public void IncreaseBonusMult(int amount = 1) + { + bonusMult += amount; + DetermineComboMult(); + UpdateComboMultText(); + } + + public void IncreaseCharge(int amount = 1) + { + _currentBarValue = Math.Min(_currentBarValue + amount, MaxValue); + UpdateNotePlacementBar(_currentBarValue); + UpdateComboMultText(); + } + // Placing a note resets the note placement bar public Note PlacedNote() { @@ -146,7 +162,7 @@ public bool CanPlaceNote() private void DetermineComboMult() { - comboMult = _currentCombo / notesToIncreaseCombo + 1; + comboMult = _currentCombo / notesToIncreaseCombo + 1 + bonusMult; } private void UpdateNotePlacementBar(int newValue) From 638577c0d0c07b4a51195b08a12166b1057474e5 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Tue, 25 Feb 2025 19:05:25 -0800 Subject: [PATCH 2/5] Added some juice to NPB On bar fill, shakes and drops some particles. --- scenes/BattleDirector/NotePlacementBar.tscn | 44 ++++++++++++++++++- .../scripts/NotePlacementBar.cs | 40 +++++++++++++++++ scenes/BattleDirector/test_battle_scene.tscn | 12 ++--- 3 files changed, 88 insertions(+), 8 deletions(-) diff --git a/scenes/BattleDirector/NotePlacementBar.tscn b/scenes/BattleDirector/NotePlacementBar.tscn index 9e3ee4f9..ce10d5a7 100644 --- a/scenes/BattleDirector/NotePlacementBar.tscn +++ b/scenes/BattleDirector/NotePlacementBar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://duhiilcv4tat3"] +[gd_scene load_steps=12 format=3 uid="uid://duhiilcv4tat3"] [ext_resource type="Script" path="res://scenes/BattleDirector/scripts/NotePlacementBar.cs" id="1_456es"] [ext_resource type="Texture2D" uid="uid://cnyr5usjdv0ni" path="res://scenes/BattleDirector/assets/temp_note_queue.png" id="2_3tw16"] @@ -23,7 +23,33 @@ width = 32 height = 98 fill_to = Vector2(0, 1) -[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_currentNote", "_nextNote")] +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_fy2uu"] +lifetime_randomness = 0.32 +particle_flag_disable_z = true +emission_shape = 3 +emission_box_extents = Vector3(40, 5, 1) +inherit_velocity_ratio = 1.0 +direction = Vector3(0, 1, 0) +spread = 13.548 +initial_velocity_min = 124.08 +initial_velocity_max = 176.41 +gravity = Vector3(0, 98, 0) +scale_min = 2.0 +scale_max = 3.0 +turbulence_noise_strength = 0.1 +turbulence_noise_scale = 5.0 +turbulence_influence_min = 0.0 +turbulence_influence_max = 0.018 + +[sub_resource type="Gradient" id="Gradient_2uknl"] +offsets = PackedFloat32Array(0) +colors = PackedColorArray(0.46, 0.2162, 0.39905, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_d62c7"] +gradient = SubResource("Gradient_2uknl") +width = 1 + +[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_particles", "_currentNote", "_nextNote")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -33,6 +59,7 @@ grow_vertical = 2 script = ExtResource("1_456es") notePlacementBar = NodePath("ProgressBar") currentComboMultText = NodePath("TextEdit") +_particles = NodePath("ProgressBar/Rock") _currentNote = NodePath("NoteQueueSprite/NextNote") _nextNote = NodePath("NoteQueueSprite/CurrentNote") @@ -47,8 +74,21 @@ texture_under = SubResource("GradientTexture2D_hhds4") texture_progress = SubResource("GradientTexture2D_0bqho") texture_progress_offset = Vector2(1, 1) +[node name="Rock" type="GPUParticles2D" parent="ProgressBar"] +z_index = 1 +position = Vector2(-1, -32) +emitting = false +amount = 22 +process_material = SubResource("ParticleProcessMaterial_fy2uu") +texture = SubResource("GradientTexture1D_d62c7") +lifetime = 2.0 +preprocess = 0.1 +explosiveness = 0.3 +randomness = 0.05 + [node name="TextEdit" type="TextEdit" parent="."] z_as_relative = false +custom_minimum_size = Vector2(80, 35) layout_mode = 0 offset_right = 80.0 offset_bottom = 35.0 diff --git a/scenes/BattleDirector/scripts/NotePlacementBar.cs b/scenes/BattleDirector/scripts/NotePlacementBar.cs index da337b5d..e111c0b8 100644 --- a/scenes/BattleDirector/scripts/NotePlacementBar.cs +++ b/scenes/BattleDirector/scripts/NotePlacementBar.cs @@ -18,6 +18,9 @@ public partial class NotePlacementBar : Node [Export] TextEdit currentComboMultText; + [Export] + private GpuParticles2D _particles; + [Export] private Sprite2D _currentNote; private Note _currentNoteInstance; @@ -28,6 +31,35 @@ public partial class NotePlacementBar : Node private Note[] _noteDeck; private Queue _noteQueue = new Queue(); + //Juice - https://www.youtube.com/watch?v=LGt-jjVf-ZU + private int _limiter; + private Vector2 _barInitPosition; + private float _randomStrength = 1f; + private float _shakeFade = 10f; + private RandomNumberGenerator _rng = new(); + private float _shakeStrength; + + private void ProcessShake(double delta) + { + _limiter = (_limiter + 1) % 3; + if (_limiter != 1) + return; + if (_currentBarValue >= MaxValue) + { + _shakeStrength = _randomStrength; + } + if (_shakeStrength > 0) + { + _shakeStrength = (float)Mathf.Lerp(_shakeStrength, 0, _shakeFade * delta); + } + notePlacementBar.Position = + _barInitPosition + + new Vector2( + _rng.RandfRange(-_shakeStrength, _shakeStrength), + _rng.RandfRange(-_shakeStrength, _shakeStrength) + ); + } + // Called when the node enters the scene tree for the first time. public override void _Ready() { @@ -36,6 +68,13 @@ public override void _Ready() _currentCombo = 0; comboMult = 1; notesToIncreaseCombo = 4; + + _barInitPosition = notePlacementBar.Position; + } + + public override void _Process(double delta) + { + ProcessShake(delta); } public void Setup(PlayerStats playerStats) @@ -168,6 +207,7 @@ private void DetermineComboMult() private void UpdateNotePlacementBar(int newValue) { notePlacementBar.Value = newValue; + _particles.Emitting = _currentBarValue >= MaxValue; } private void UpdateComboMultText() diff --git a/scenes/BattleDirector/test_battle_scene.tscn b/scenes/BattleDirector/test_battle_scene.tscn index e0b58697..12ab120a 100644 --- a/scenes/BattleDirector/test_battle_scene.tscn +++ b/scenes/BattleDirector/test_battle_scene.tscn @@ -37,12 +37,6 @@ script = ExtResource("3_8hff6") script = ExtResource("2_pcp76") CM = NodePath("../SubViewport") -[node name="SubViewport" parent="." instance=ExtResource("2_cupb3")] -offset_left = 80.0 -offset_top = 180.0 -offset_right = 560.0 -offset_bottom = 360.0 - [node name="NotePlacementBar" parent="." instance=ExtResource("7_3ko4g")] offset_top = 183.0 offset_bottom = 183.0 @@ -54,6 +48,12 @@ offset_right = 81.0 offset_bottom = 175.0 texture = SubResource("GradientTexture2D_bajwn") +[node name="SubViewport" parent="." instance=ExtResource("2_cupb3")] +offset_left = 80.0 +offset_top = 180.0 +offset_right = 560.0 +offset_bottom = 360.0 + [node name="BackGround" type="TextureRect" parent="."] z_index = -1 offset_right = 640.0 From 524505bbb751a06e35169a433696da5d1530b83b Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Thu, 27 Feb 2025 12:52:52 -0800 Subject: [PATCH 3/5] Updated map icons --- scenes/Maps/assets/BattleIcon.png | Bin 285 -> 653 bytes scenes/Maps/assets/BossIcon.png | Bin 300 -> 506 bytes scenes/Maps/assets/ChestIcon.png | Bin 234 -> 663 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/scenes/Maps/assets/BattleIcon.png b/scenes/Maps/assets/BattleIcon.png index a93306c1e2bb3ff32990e348ea1c989d8f237527..d83f33982bd990975fc6082104dbcf9da29f8256 100644 GIT binary patch delta 616 zcmV-u0+;=r0*wWbFnZTl7opZI@+m@Pg9v3~@BpCIwE$()H$2=;5S(=;F=H?B1! z{;&jqh{zX5Lr6d|_a#IeB3={)R;v{rj|TwYd_JRT8dz&#t#!gxRSo7xQN%GuAx1xF zaW)A7{AA*AIDY^Dj4=R!zV875`~7}06CXa|kODfLPVSw>S-9_e2l6UzteqsNT>Wmh zbK{rG#Vej=nR~D68paq@RW+y$y(O{wfTAdzvlLH~#ErLYizG<~zFC%OA=GsZU|1Wv zE@CY%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FiwpuA%tyzS%zei9Rvwnst@F1d*uzh=Yf4B(i)XS!Wr)H`P z7=ly7aJ+sh0#>lq6<&nwm)m#YNobw4($G4b_~262=Mk{N)`17nOON#dKnmZCJg2>) zi_Qy9LpK6XCSSB0czt&geq!>m6%lbSr{5445xG`Ox*6O4M|1-k7@F+Jcrir)0000< KMNUMnLSTX-*l@xC diff --git a/scenes/Maps/assets/ChestIcon.png b/scenes/Maps/assets/ChestIcon.png index d4686e928bcf597ad4f12eb5933d8dea8cbffb02..b4cf0feb869fcd6cd023da6cf603b17f93c742f7 100644 GIT binary patch delta 626 zcmV-&0*(FZ0ha}kFndqZh>8tDo6!X5UPmS zQ9@X_3-*x$Sy93Jiy3)D6n{lQnx-U4VqE~p^PHw>JQspR=;G1HT@1ruYr=KF#ngq-=r5Oxwcd;# z!gD_dBj8a%R#kv8hp>MOFZqL z<{Qz5$EXlM>be%KwE#~y6aPw{*4oC4h*$w`Q%ZTkN-5i1!AdF7T1(e;qqtE1lt)Cw zI|p1W&0$^Fqx;=%=heYnzTxtALinv_x59zZR^0bJS(bUC+?cui>2oXKdcArtoWpjz z<#0FzpKC9{9Lqrgui}}5X%6mS|NBn(76Bov=ip62-}lzuS3X8U?UZpCJ)g)06T zJjx#}LpL}{67Lv&^kFeYD8Fr6Pt>9V?}mtc|C)XLNAw4w-+_ZH~jy@_95*_FrvX+%%OTIg>`q3 zrE~yz>Eb*$!yBLh{sq9ycLAbt0V3KG0A?ltsbvAp00VG!3xEyZ8H-jwv(Q?b>VP%( zuC#;Dp#YZMM~hBOy&bEUU>m9@ynr@}K&+|l#4cE7Mj_EP#5*(s(h!+4PyLc@|4w`2 wK}0mFen_H=lzj=0OIS4x&;Sk401eOpAK^e{m?xqsk^lez07*qoM6N<$f^~6HK>z>% From 42c12778e5e23501e19eb3b5e138bccf1e9376d0 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Thu, 27 Feb 2025 13:16:59 -0800 Subject: [PATCH 4/5] Added note reward functions --- Classes/Notes/Note.cs | 8 +-- Classes/Relics/RelicTemplate.cs | 8 +-- Globals/FunkEngineNameSpace.cs | 7 ++ Globals/Scribe.cs | 15 ++++ .../BattleDirector/scripts/BattleDirector.cs | 5 +- scenes/ChestScene/ChestScene.cs | 2 +- scenes/Puppets/scripts/PlayerStats.cs | 6 ++ scenes/UI/scripts/RewardSelect.cs | 71 +++++++++++++++---- 8 files changed, 99 insertions(+), 23 deletions(-) diff --git a/Classes/Notes/Note.cs b/Classes/Notes/Note.cs index f382b128..cc6fed18 100644 --- a/Classes/Notes/Note.cs +++ b/Classes/Notes/Note.cs @@ -6,16 +6,16 @@ * @class Note * @brief Data structure class for holding data and methods for a battle time note. WIP */ -public partial class Note : Resource +public partial class Note : Resource, IDisplayable { public PuppetTemplate Owner; - public string Name; + public string Name { get; set; } private int _baseVal; public float CostModifier { get; private set; } private Action NoteEffect; //TODO: Where/How to deal with timing. - public string Tooltip; - public Texture2D Texture; + public string Tooltip { get; set; } + public Texture2D Texture { get; set; } public Note( string name, diff --git a/Classes/Relics/RelicTemplate.cs b/Classes/Relics/RelicTemplate.cs index f0a117cc..da8daba4 100644 --- a/Classes/Relics/RelicTemplate.cs +++ b/Classes/Relics/RelicTemplate.cs @@ -2,13 +2,13 @@ using FunkEngine; using Godot; -public partial class RelicTemplate : Resource +public partial class RelicTemplate : Resource, IDisplayable { public RelicEffect[] Effects; - public string Name; + public string Name { get; set; } - public Texture2D Texture; - public string Tooltip; + public Texture2D Texture { get; set; } + public string Tooltip { get; set; } public RelicTemplate( string name = "", diff --git a/Globals/FunkEngineNameSpace.cs b/Globals/FunkEngineNameSpace.cs index 2a2d8df1..04c05161 100644 --- a/Globals/FunkEngineNameSpace.cs +++ b/Globals/FunkEngineNameSpace.cs @@ -192,3 +192,10 @@ public interface IBattleEvent void OnTrigger(BattleDirector BD); BattleEffectTrigger GetTrigger(); } + +public interface IDisplayable +{ + string Name { get; set; } + string Tooltip { get; set; } + Texture2D Texture { get; set; } +} diff --git a/Globals/Scribe.cs b/Globals/Scribe.cs index 769cc39e..376350d8 100644 --- a/Globals/Scribe.cs +++ b/Globals/Scribe.cs @@ -171,4 +171,19 @@ public static RelicTemplate[] GetRandomRelics(RelicTemplate[] ownedRelics, int c } return availableRelics; } + + public static Note[] GetRandomRewardNotes(int count) + { + var availableNotes = Scribe + .NoteDictionary.Where(r => r.Name.Contains("Player")) //TODO: Classifications/pools + .ToArray(); + + availableNotes = availableNotes + .OrderBy(_ => StageProducer.GlobalRng.Randi()) + .Take(count) + .Select(r => r.Clone()) + .ToArray(); + + return availableNotes; + } } diff --git a/scenes/BattleDirector/scripts/BattleDirector.cs b/scenes/BattleDirector/scripts/BattleDirector.cs index 1e6fb77c..33e45b57 100644 --- a/scenes/BattleDirector/scripts/BattleDirector.cs +++ b/scenes/BattleDirector/scripts/BattleDirector.cs @@ -220,7 +220,10 @@ private void CheckBattleStatus(PuppetTemplate puppet) private void ShowRewardSelection(int amount) { - RewardSelect.CreateSelection(this, Player.Stats, amount).Selected += EndBattle; + string type = "Note"; + if (StageProducer.Config.RoomType == Stages.Boss) + type = "Relic"; + RewardSelect.CreateSelection(this, Player.Stats, amount, type).Selected += EndBattle; } #endregion diff --git a/scenes/ChestScene/ChestScene.cs b/scenes/ChestScene/ChestScene.cs index 4688d79f..2b130cbd 100644 --- a/scenes/ChestScene/ChestScene.cs +++ b/scenes/ChestScene/ChestScene.cs @@ -29,7 +29,7 @@ public override void _Process(double delta) private void GetLoot() { ChestButton.Disabled = true; - RewardSelect.CreateSelection(this, Player.Stats, 3).Selected += EndBattle; + RewardSelect.CreateSelection(this, Player.Stats, 3, "Relic").Selected += EndBattle; } private void EndBattle() diff --git a/scenes/Puppets/scripts/PlayerStats.cs b/scenes/Puppets/scripts/PlayerStats.cs index 06a0c08e..f290debc 100644 --- a/scenes/Puppets/scripts/PlayerStats.cs +++ b/scenes/Puppets/scripts/PlayerStats.cs @@ -30,4 +30,10 @@ public void AddRelic(RelicTemplate relic) CurRelics = CurRelics.Append(relic).ToArray(); GD.Print("Adding relic: " + relic.Name); } + + public void AddNote(Note nSelection) + { + CurNotes = CurNotes.Append(nSelection).ToArray(); + GD.Print("Adding note: " + nSelection.Name); + } } diff --git a/scenes/UI/scripts/RewardSelect.cs b/scenes/UI/scripts/RewardSelect.cs index 00e3a039..a1a9c4bb 100644 --- a/scenes/UI/scripts/RewardSelect.cs +++ b/scenes/UI/scripts/RewardSelect.cs @@ -20,13 +20,23 @@ public partial class RewardSelect : CanvasLayer public event SelectionMadeHandler Selected; private PlayerStats _player; - private RelicTemplate[] _choices; - private RelicTemplate _selection; - public void Initialize(PlayerStats player, int amount) + private RelicTemplate[] _rChoices; //TODO: look into simplifying + private RelicTemplate _rSelection; + private Note[] _nChoices; + private Note _nSelection; + + public void Initialize(PlayerStats player, int amount, string type) { _player = player; - GenerateRelicChoices(amount); + if (type == "Relic") + { + GenerateRelicChoices(amount); + } + else + { + GenerateNoteChoices(amount); + } _acceptButton.Pressed += OnSelect; _skipButton.Pressed += OnSkip; @@ -34,16 +44,16 @@ public void Initialize(PlayerStats player, int amount) public override void _Process(double delta) { - _acceptButton.Visible = _selection != null; + _acceptButton.Visible = (_nSelection != null) || (_nChoices != null); } private void GenerateRelicChoices(int amount = 1) { //should probably change this so that the amount of relics offered can be changed when BD calls it //i.e less options when killing trash mobs/basic/weak enemies - _choices = Scribe.GetRandomRelics(_player.CurRelics, amount); + _rChoices = Scribe.GetRandomRelics(_player.CurRelics, amount); - foreach (var relic in _choices) + foreach (var relic in _rChoices) { var button = new DisplayButton(); button.Display(relic.Texture, relic.Tooltip, relic.Name); @@ -53,29 +63,64 @@ private void GenerateRelicChoices(int amount = 1) } } - public static RewardSelect CreateSelection(Node2D parent, PlayerStats playerStats, int amount) + private void GenerateNoteChoices(int amount = 1) + { + //should probably change this so that the amount of relics offered can be changed when BD calls it + //i.e less options when killing trash mobs/basic/weak enemies + _nChoices = Scribe.GetRandomRewardNotes(amount); + + foreach (var note in _nChoices) + { + var button = new DisplayButton(); + button.Display(note.Texture, note.Tooltip, note.Name); + button.Pressed += () => OnNoteSelected(note); + ButtonContainer.AddChild(button); + button.GrabFocus(); + } + } + + public static RewardSelect CreateSelection( + Node2D parent, + PlayerStats playerStats, + int amount, + string type + ) { var rewardUI = GD.Load("res://scenes/UI/RewardSelectionUI.tscn") .Instantiate(); parent.AddChild(rewardUI); - rewardUI.Initialize(playerStats, amount); + rewardUI.Initialize(playerStats, amount, type); parent.GetTree().Paused = true; return rewardUI; } + private void OnNoteSelected(Note choiceNote) + { + _nSelection = choiceNote; + _description.Text = $"{choiceNote.Name}: {choiceNote.Tooltip}"; + } + private void OnRelicSelected(RelicTemplate choiceRelic) { - _selection = choiceRelic; + _rSelection = choiceRelic; _description.Text = $"{choiceRelic.Name}: {choiceRelic.Tooltip}"; } private void OnSelect() { - if (_selection == null) + if (_nSelection == null && _rSelection == null) return; - GD.Print("Relic selected: " + _selection.Name); - _player.AddRelic(_selection); + if (_nSelection != null) + { + GD.Print("Note selected: " + _nSelection.Name); + _player.AddNote(_nSelection); + } + else if (_rSelection != null) + { + GD.Print("Relic selected: " + _rSelection.Name); + _player.AddRelic(_rSelection); + } GetTree().Paused = false; Selected?.Invoke(); QueueFree(); From beee83e872f06683bb798bd041d2ae298dd934a4 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Thu, 27 Feb 2025 14:25:37 -0800 Subject: [PATCH 5/5] Reload in editor --- README.md | 2 +- scenes/BattleDirector/NotePlacementBar.tscn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4888d942..3b6313f2 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,4 @@ Current team members include: #### Attributions: First Song: gameMusic by Magntron - freesound.org -Input buttons by Nicolae (Xelu) Berbece \ No newline at end of file +Input buttons by Nicolae (Xelu) Berbece diff --git a/scenes/BattleDirector/NotePlacementBar.tscn b/scenes/BattleDirector/NotePlacementBar.tscn index fb3b1465..b0935a83 100644 --- a/scenes/BattleDirector/NotePlacementBar.tscn +++ b/scenes/BattleDirector/NotePlacementBar.tscn @@ -49,7 +49,7 @@ colors = PackedColorArray(0.46, 0.2162, 0.39905, 1) gradient = SubResource("Gradient_2uknl") width = 1 -[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_currentNote", "_nextNote", "fullBarParticles")] +[node name="NotePlacementBar" type="Control" node_paths=PackedStringArray("notePlacementBar", "currentComboMultText", "_particles", "_currentNote", "_nextNote", "fullBarParticles")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0