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/Events/Assets/Event1.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/Events/Assets/Event1.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://76wufdnhkrvk"
path="res://.godot/imported/Event1.png-2f5f476395c8adde38110b361ff5d5f3.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Events/Assets/Event1.png"
dest_files=["res://.godot/imported/Event1.png-2f5f476395c8adde38110b361ff5d5f3.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/Events/Assets/Event2.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/Events/Assets/Event2.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cex5vg2ycajdi"
path="res://.godot/imported/Event2.png-a647bc6675ac54fecafbb5f9d56de04d.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Events/Assets/Event2.png"
dest_files=["res://.godot/imported/Event2.png-a647bc6675ac54fecafbb5f9d56de04d.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/Events/Assets/Event3.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/Events/Assets/Event3.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c0d0dwwnotlfq"
path="res://.godot/imported/Event3.png-445c0675f61362532d1032be33503df0.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Events/Assets/Event3.png"
dest_files=["res://.godot/imported/Event3.png-445c0675f61362532d1032be33503df0.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
153 changes: 153 additions & 0 deletions Classes/Events/EventDatabase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
using System;
using Godot;

/// <summary>
/// Holds all game events and their associated logic.
/// </summary>
public class EventDatabase
{
public static readonly EventTemplate[] EventDictionary = new[]
{
new EventTemplate(
1,
"EVENT_EVENT1_DESC",
["EVENT_EVENT1_OPTION1", "EVENT_EVENT1_OPTION2", "EVENT_EVENT1_OPTION3"],
["EVENT_EVENT1_OUTCOME1", "EVENT_EVENT1_OUTCOME2", "EVENT_EVENT1_OUTCOME3"],
[
(self, node) =>
{
int randIndex = StageProducer.GlobalRng.RandiRange(
0,
StageProducer.PlayerStats.CurNotes.Length - 1
);
StageProducer.PlayerStats.RemoveNote(randIndex);
},
(self, node) =>
{
int randIndex = StageProducer.GlobalRng.RandiRange(
0,
StageProducer.PlayerStats.CurRelics.Length - 1
);
StageProducer.PlayerStats.RemoveRelic(randIndex);
},
(self, node) =>
{
StageProducer.PlayerStats.Money /= 2;
},
],
GD.Load<Texture2D>("res://Classes/Events/Assets/Event1.png"),
[
() => StageProducer.PlayerStats.CurNotes.Length > 0,
() => StageProducer.PlayerStats.CurRelics.Length > 0,
() => StageProducer.PlayerStats.Money > 0,
]
),
new EventTemplate(
1,
"EVENT_EVENT2_DESC",
["EVENT_EVENT2_OPTION1", "EVENT_EVENT2_OPTION2"],
["", "EVENT_EVENT2_OUTCOME1"],
[
(self, node) =>
{
var spinner = node.EventSprite;
int spinOutcome = StageProducer.GlobalRng.RandiRange(0, 5);

int outcomeCount = 6;
float sectorAngle = 360f / outcomeCount;
float targetAngle = spinOutcome * sectorAngle;
float fullSpins = 6 * 360f;
float finalRotation = spinner.RotationDegrees % 360f + fullSpins + targetAngle;

var tween = node.CreateTween();
tween
.TweenProperty(spinner, "rotation_degrees", finalRotation, 2.5f)
.SetTrans(Tween.TransitionType.Cubic)
.SetEase(Tween.EaseType.Out);

// Defer execution of the outcome until the tween finishes
tween.TweenCallback(
Callable.From(() =>
{
switch (spinOutcome)
{
case 0:
StageProducer.PlayerStats.Money /= 2;
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME2";
break;
case 1:
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME3";
StageProducer.PlayerStats.CurrentHealth = Math.Max(
1,
StageProducer.PlayerStats.CurrentHealth - 10
);
break;
case 2:
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME4";
StageProducer.PlayerStats.Money += 50;
break;
case 3:
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME5";
StageProducer.PlayerStats.AddNote(
Scribe.GetRandomRewardNotes(1, StageProducer.CurRoom + 10)[
0
]
);
break;
case 4:
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME6";
StageProducer.PlayerStats.AddRelic(
Scribe.GetRandomRelics(
1,
StageProducer.CurRoom + 10,
StageProducer.PlayerStats.RarityOdds
)[0]
);
break;
case 5:
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME7";
StageProducer.PlayerStats.CurrentHealth = Math.Min(
StageProducer.PlayerStats.CurrentHealth + 20,
StageProducer.PlayerStats.MaxHealth
);
break;
}
node.AnyButtonPressed(0);
self.OutcomeDescriptions[0] = ""; //Will need to fix later, currently changes the primary reference
})
);
},
null,
],
GD.Load<Texture2D>("res://Classes/Events/Assets/Event2.png"),
[null, null]
),
new EventTemplate(
2,
"EVENT_EVENT3_DESC",
["EVENT_EVENT3_OPTION1", "EVENT_EVENT3_OPTION2", "EVENT_EVENT3_OPTION3"],
["EVENT_EVENT3_OUTCOME1", "EVENT_EVENT3_OUTCOME2", "EVENT_EVENT3_OUTCOME3"],
[
(self, node) =>
{
StageProducer.PlayerStats.CurrentHealth = Math.Min(
StageProducer.PlayerStats.CurrentHealth + 10,
StageProducer.PlayerStats.MaxHealth
);
},
(self, node) =>
{
StageProducer.PlayerStats.MaxComboBar -= 5;
},
(self, node) =>
{
StageProducer.PlayerStats.Money -= 30;
StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]);
StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]);
},
],
GD.Load<Texture2D>("res://Classes/Events/Assets/Event3.png"),
[null, null, () => StageProducer.PlayerStats.Money >= 30]
),
};
}
1 change: 1 addition & 0 deletions Classes/Events/EventDatabase.cs.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://c7pukvtaeda8h
39 changes: 39 additions & 0 deletions Classes/Events/EventTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using Godot;

public delegate void EventAction(EventTemplate self, EventScene contextNode);
public delegate bool EventCondition();

//TODO: Consider making event option struct for better parallelizing of option parameters

public class EventTemplate
{
public int Id;
public string EventDescription;
public string[] ButtonDescriptions;
public string[] OutcomeDescriptions;
public Texture2D Texture;
public EventAction[] OptionActions;
public EventCondition[] OptionEnabledConditions;

public EventTemplate() { }

public EventTemplate(
int id,
string eventDescription,
string[] buttonDescriptions,
string[] outcomeDescriptions,
EventAction[] optionActions,
Texture2D texture,
EventCondition[] optionEnabledConditions = null
)
{
Id = id;
EventDescription = eventDescription;
ButtonDescriptions = buttonDescriptions;
OutcomeDescriptions = outcomeDescriptions;
OptionActions = optionActions;
Texture = texture;
OptionEnabledConditions = optionEnabledConditions;
}
}
1 change: 1 addition & 0 deletions Classes/Events/EventTemplate.cs.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://4ro8fwi5f8uk
8 changes: 6 additions & 2 deletions Globals/SaveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ public class SaveFile
public int[] RelicIds { get; init; }
public int PlayerHealth { get; init; }
public int Shortcuts { get; init; }
public int PlayerMaxCombo { get; init; }

public SaveFile(
ulong rngSeed,
Expand All @@ -396,7 +397,8 @@ public SaveFile(
int playerHealth,
int area,
int money,
int shortcuts
int shortcuts,
int playerMaxCombo
)
{
RngSeed = rngSeed;
Expand All @@ -408,6 +410,7 @@ int shortcuts
Area = area;
Money = money;
Shortcuts = shortcuts;
PlayerMaxCombo = playerMaxCombo;
}
}

Expand All @@ -424,7 +427,8 @@ public static void SaveGame()
StageProducer.PlayerStats.CurrentHealth,
StageProducer.CurLevel.Id,
StageProducer.PlayerStats.Money,
StageProducer.PlayerStats.Shortcuts
StageProducer.PlayerStats.Shortcuts,
StageProducer.PlayerStats.MaxComboBar
);
string json = JsonSerializer.Serialize(sv);

Expand Down
8 changes: 7 additions & 1 deletion Globals/StageProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ private bool LoadGame()
PlayerStats.CurrentHealth = sv.PlayerHealth;
PlayerStats.Money = sv.Money;
PlayerStats.Shortcuts = sv.Shortcuts;
PlayerStats.MaxComboBar = sv.PlayerMaxCombo;
IsInitialized = true;
return true;
}
Expand Down Expand Up @@ -140,13 +141,18 @@ public void PreloadScene(int nextRoomIdx)
.Instantiate<Node>();
});
break;
case Stages.Event:
_loadTask = Task.Run(() =>
{
_preloadStage = GD.Load<PackedScene>(EventScene.LoadPath).Instantiate<Node>();
});
break;
case Stages.Shop:
_loadTask = Task.Run(() =>
{
_preloadStage = GD.Load<PackedScene>(ShopScene.LoadPath).Instantiate<Node>();
});
break;
case Stages.Event:
case Stages.Chest:
_loadTask = Task.Run(() =>
{
Expand Down
27 changes: 26 additions & 1 deletion Globals/Translations/Translations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,29 @@ TUTORIAL_PLACE_6,"Now go ahead, place a note in the bottom lane!",(TODO)
TUTORIAL_FINAL_1,"Good job, you placed a note! You either healed yourself, or dealt damage. I can't tell I'm just a Strawman.",(TODO)
TUTORIAL_FINAL_2,"As a refresher: Hit notes to build a combo and fill the bar. When the bar is full, press one of your buttons for a lane that doesn't have a note at the current beat. Notes in the chart will loop around. Keep it up to win.",(TODO)
TUTORIAL_FINAL_3,"Good luck! I believe in you.",(TODO)
TUTORIAL_BOSS,"This may take some getting used to, but death is ok in the grand scheme of things. Just have some patience with yourself, you'll learn in the end.",(TODO)
TUTORIAL_BOSS,"This may take some getting used to, but death is ok in the grand scheme of things. Just have some patience with yourself, you'll learn in the end.",(TODO)
EVENT_CONTINUE_BUTTON,"Continue",(TODO)
EVENT_EVENT1_DESC,"A bandit approaches you.",(TODO)
EVENT_EVENT1_OPTION1,"Give them a random note",(TODO)
EVENT_EVENT1_OPTION2,"Give them a random relic",(TODO)
EVENT_EVENT1_OPTION3,"Give them half your gold",(TODO)
EVENT_EVENT1_OUTCOME1,"You got robbed of a random note.",(TODO)
EVENT_EVENT1_OUTCOME2,"You got robbed of a random relic.",(TODO)
EVENT_EVENT1_OUTCOME3,"You got robbed of half your gold.",(TODO)
EVENT_EVENT2_DESC,"There is a wheel with different outcomes.",(TODO)
EVENT_EVENT2_OPTION1,"Spin the wheel",(TODO)
EVENT_EVENT2_OPTION2,"Ignore the cool wheel",(TODO)
EVENT_EVENT2_OUTCOME1,"You decided not to spin the wheel.",(TODO)
EVENT_EVENT2_OUTCOME2,"You lost half your money.",(TODO)
EVENT_EVENT2_OUTCOME3,"You took some damage.",(TODO)
EVENT_EVENT2_OUTCOME4,"You won a lot of money!",(TODO)
EVENT_EVENT2_OUTCOME5,"You gained a random note!",(TODO)
EVENT_EVENT2_OUTCOME6,"You gained a random relic!",(TODO)
EVENT_EVENT2_OUTCOME7,"You gained some health!",(TODO)
EVENT_EVENT3_DESC,"There is a field medic on the side of the road.",(TODO)
EVENT_EVENT3_OPTION1,"Receive a bit of healing",(TODO)
EVENT_EVENT3_OPTION2,"Decrease max energy",(TODO)
EVENT_EVENT3_OPTION3,"Purchase 2 heal notes (30g)",(TODO)
EVENT_EVENT3_OUTCOME1,"The medic patched you up.\nYou restored 10 Health.",(TODO)
EVENT_EVENT3_OUTCOME2,"The medic gave you a shot of adrenaline.\nMax Energy reduced by 5.",(TODO)
EVENT_EVENT3_OUTCOME3,"The medic sold you some healing supplies.\nAdded 2 heal notes to your inventory.",(TODO)
Loading