Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Classes/Notes/assets/heal_note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Classes/Notes/assets/heal_note.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cdf3g3174du4r"
path="res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Notes/assets/heal_note.png"
dest_files=["res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Classes/Notes/assets/quarter_note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Classes/Notes/assets/quarter_note.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://uksjoqp7p0gq"
path="res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Notes/assets/quarter_note.png"
dest_files=["res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Classes/Notes/assets/vampire_note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Classes/Notes/assets/vampire_note.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dg0lmu0pip4lr"
path="res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Notes/assets/vampire_note.png"
dest_files=["res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
169 changes: 151 additions & 18 deletions Globals/FunkEngineNameSpace.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
using Godot;
using System;
using System.Linq;
using Godot;

namespace FunkEngine;

public struct SongData
{
public int Bpm;
public double SongLength;
public int NumLoops;
}

public struct ArrowData
{
public Color Color;
public string Key;
public NoteChecker Node;
public ArrowType Type;
}

public enum ArrowType
{
Up = 0,
Expand All @@ -10,14 +27,6 @@
Right = 3,
}

public enum BattleEffectTrigger
{
NotePlaced,
NoteHit,
SelfNoteHit,
OnPickup,
}

public enum Timing
{
Miss = 0,
Expand All @@ -27,6 +36,22 @@
Perfect = 4,
}

public struct BattleConfig
{
public MapRooms RoomType { get; private set; }
public MapGrid.Room CurRoom { get; private set; }
public SongData CurSong { get; set; }
public int TodoEnemyAndChart;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Rename and document the TodoEnemyAndChart field.

The field name suggests incomplete implementation. Consider:

  1. Documenting the intended purpose
  2. Using a more descriptive name
  3. Adding XML documentation

Would you like me to help implement this feature or create an issue to track it?

}

public enum BattleEffectTrigger
{
NotePlaced,
NoteHit,
SelfNoteHit,
OnPickup,
}

public enum Stages
{
Title,
Expand All @@ -35,19 +60,127 @@
Map,
}

public struct SongData
public enum MapRooms
{
public int Bpm;
public double SongLength;
public int NumLoops;
Battle,
Chest,
Boss,
}

public struct ArrowData
public class MapGrid
{
public Color Color;
public string Key;
public NoteChecker Node;
public ArrowType Type;
private int[,] _map;
private Room[] _rooms;
private int _curIdx = 0;
private int _curRoom = 0;

Check warning on line 75 in Globals/FunkEngineNameSpace.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MapGrid._curRoom' is assigned but its value is never used

Check warning on line 75 in Globals/FunkEngineNameSpace.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MapGrid._curRoom' is assigned but its value is never used
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unused field _curRoom.

The field _curRoom is assigned but never used, as flagged by static analysis.

-    private int _curRoom = 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private int _curRoom = 0;
🧰 Tools
🪛 GitHub Check: build

[warning] 75-75:
The field 'MapGrid._curRoom' is assigned but its value is never used


[warning] 75-75:
The field 'MapGrid._curRoom' is assigned but its value is never used


public Room[] GetRooms()
{
return _rooms;
}

public class Room
{
public Room(int idx, int x, int y)
{
Idx = idx;
X = x;
Y = y;
}

public void SetType(MapRooms type)
{
Type = type;
}

public void AddChild(int newIdx)
{
if (Children.Contains(newIdx))
return;
Children = Children.Append(newIdx).ToArray();
}

public int Idx { get; private set; }
public int[] Children { get; private set; } = Array.Empty<int>();
public int X { get; private set; }
public int Y { get; private set; }
public MapRooms Type { get; private set; }
}

public void InitMapGrid(int width, int height, int paths)
{
_curIdx = 0;
_rooms = Array.Empty<Room>();
_map = new int[width, height]; //x,y

int startX = (width / 2);
_rooms = _rooms.Append(new Room(_curIdx, startX, 0)).ToArray();
_map[startX, 0] = _curIdx++;

for (int i = 0; i < paths; i++)
{
GeneratePath_r(startX, 0, width, height);
}
CreateCommonChildren(width, height);
AddBossRoom(width, height);
}

//Start at x, y, assume prev room exists. Picks new x pos within +/- 1, attaches recursively
private void GeneratePath_r(int x, int y, int width, int height)
{
int nextX = StageProducer.GlobalRng.RandiRange(
Math.Max(x - 1, 0),
Math.Min(x + 1, width - 1)
);
if (_map[nextX, y + 1] == 0)
{
_rooms = _rooms.Append(new Room(_curIdx, nextX, y + 1)).ToArray();
_map[nextX, y + 1] = _curIdx;
_rooms[_map[x, y]].AddChild(_curIdx++);
_rooms[^1].SetType(MapRooms.Battle);
if (y > 0 && y % 3 == 0)
{
_rooms[^1].SetType(MapRooms.Chest);
}
}
else
{
_rooms[_map[x, y]].AddChild(_map[nextX, y + 1]);
}
if (y < height - 2)
{
GeneratePath_r(nextX, y + 1, width, height);
}
}

//Asserts that if there is a room at the same x, but y+1 they are connected
private void CreateCommonChildren(int width, int height)
{
foreach (Room room in _rooms)
{
Vector2I curPos = new Vector2I(room.X, room.Y);
if (room.Y + 1 >= height)
continue;
if (_map[curPos.X, curPos.Y + 1] == 0)
continue;
GD.Print("Added child on same X.");
room.AddChild(_map[curPos.X, curPos.Y + 1]);
}
}

//Adds a boss room at the end of rooms, all max height rooms connect to it.
private void AddBossRoom(int width, int height)
{
_rooms = _rooms.Append(new Room(_curIdx, width / 2, height)).ToArray();
_rooms[_curIdx].SetType(MapRooms.Boss);
for (int i = 0; i < width; i++) //Attach all last rooms to a boss room
{
if (_map[i, height - 1] != 0)
{
_rooms[_map[i, height - 1]].AddChild(_curIdx);
}
}
}
}

public interface IBattleEvent
Expand Down
34 changes: 34 additions & 0 deletions Globals/Scribe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,40 @@ public partial class Scribe : Node
director.Enemy.TakeDamage(2 * (int)timing);
}
),
new Note(
"PlayerHeal",
"Basic player note, heals player",
GD.Load<Texture2D>("res://Classes/Notes/assets/heal_note.png"),
null,
1,
(director, note, timing) =>
{
director.Player.Heal((int)timing);
}
),
new Note(
"PlayerVampire",
"Steals health from enemy",
GD.Load<Texture2D>("res://Classes/Notes/assets/vampire_note.png"),
null,
1,
(director, note, timing) =>
{
director.Player.Heal((int)timing);
director.Enemy.TakeDamage((int)timing);
}
),
new Note(
"PlayerQuarter",
"Basic note at a quarter of the cost",
GD.Load<Texture2D>("res://Classes/Notes/assets/quarter_note.png"),
null,
1,
(director, note, timing) =>
{
director.Enemy.TakeDamage((int)timing);
}
),
Comment on lines +71 to +81
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Consider adding cost validation for PlayerQuarter note.

While the implementation is correct, consider adding validation to ensure the quarter cost is properly enforced.


🏁 Script executed:

#!/bin/bash
# Search for cost validation in NotePlacementBar
ast-grep --pattern 'CanPlaceNote($_) {
  $$$
  if ($_ == "PlayerQuarter") {
    $$$
  }
  $$$
}'

Length of output: 98


Action Required: Add explicit cost validation for "PlayerQuarter" in the cost-checking logic.
Our initial search using the provided AST pattern did not locate any validation for "PlayerQuarter" in the expected cost validation routines (e.g., within the NotePlacementBar logic). It appears that the quarter cost is not being explicitly enforced at this point. Please confirm that this omission is unintentional and, if so, add the necessary cost validation (or a corresponding inline comment if it's deliberate).

  • File: Globals/Scribe.cs (Lines 71-81 snippet remains unchanged)
  • Action: Modify or enhance the cost validation logic (likely in NotePlacementBar or similar module) to ensure that the quarter cost for "PlayerQuarter" is properly enforced.

};

public static readonly RelicTemplate[] RelicDictionary = new[]
Expand Down
Loading