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
8 changes: 6 additions & 2 deletions Globals/SaveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ public class SaveFile
public int LastRoomIdx { get; init; }
public int Area { get; init; }

public int Money { get; init; }
public int[] NoteIds { get; init; }
public int[] RelicIds { get; init; }
public int PlayerHealth { get; init; }
Expand All @@ -384,7 +385,8 @@ public SaveFile(
int[] noteIds,
int[] relicIds,
int playerHealth,
int area
int area,
int money
)
{
RngSeed = rngSeed;
Expand All @@ -394,6 +396,7 @@ int area
RelicIds = relicIds;
PlayerHealth = playerHealth;
Area = area;
Money = money;
}
}

Expand All @@ -408,7 +411,8 @@ public static void SaveGame()
noteIds,
relicIds,
StageProducer.PlayerStats.CurrentHealth,
(int)StageProducer.CurArea
(int)StageProducer.CurArea,
StageProducer.PlayerStats.Money
);
string json = JsonSerializer.Serialize(sv);

Expand Down
1 change: 1 addition & 0 deletions Globals/StageProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private bool LoadGame()
PlayerStats.AddRelic(Scribe.RelicDictionary[relicId]);
}
PlayerStats.CurrentHealth = sv.PlayerHealth;
PlayerStats.Money = sv.Money;
IsInitialized = true;
return true;
}
Expand Down
53 changes: 49 additions & 4 deletions Scenes/BattleDirector/Scripts/BattleDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,41 @@ public override void _Ready()
Harbinger.Init(this);
InitPlayer();
InitEnemies();
InitScoringGuide();
CD.Initialize(curSong);
CD.NoteInputEvent += OnTimedInput;

_focusedButton.GrabFocus();
_focusedButton.Pressed += SyncStartWithMix;
}

private ScoringScreen.ScoreGuide _battleScore;

private void InitScoringGuide()
{
int baseMoney = 0;
foreach (EnemyPuppet enem in _enemies)
{
baseMoney += enem.BaseMoney;
}

_battleScore = new ScoringScreen.ScoreGuide(baseMoney, Player.GetCurrentHealth());
Harbinger.Instance.NotePlaced += (_) =>
{
_battleScore.IncPlaced();
};
Harbinger.Instance.NoteHit += (_) =>
{
_battleScore.IncHits();
};
Harbinger.Instance.NoteHit += (e) =>
{
if (e is Harbinger.NoteHitArgs { Timing: Timing.Perfect })
_battleScore.IncPerfects();
_battleScore.IncHits();
};
}

private void InitPlayer()
{
Player = GD.Load<PackedScene>(PlayerPuppet.LoadPath).Instantiate<PlayerPuppet>();
Expand Down Expand Up @@ -213,8 +241,21 @@ private void CheckBattleStatus(PuppetTemplate puppet) //Called when a puppet die
OnBattleLost();
return;
}
if (puppet is EnemyPuppet && IsBattleWon())
OnBattleWon(); //will have to adjust this to account for when we have multiple enemies at once

if (puppet is EnemyPuppet)
{
if (IsBattleWon())
{
CM.ProcessMode = ProcessModeEnum.Disabled;
var tween = CreateTween();
tween.TweenProperty(puppet, "modulate:a", 0, 2f);
tween.TweenCallback(Callable.From(OnBattleWon));
}
else
{
puppet.Visible = false;
}
}
}

private bool IsBattleWon()
Expand All @@ -224,9 +265,13 @@ private bool IsBattleWon()

private void OnBattleWon()
{
Audio.StreamPaused = true;
CleanUpRelics();
ShowRewardSelection(3);
_battleScore.SetEndHp(Player.GetCurrentHealth());
Audio.ProcessMode = ProcessModeEnum.Always;
ScoringScreen.CreateScore(this, _battleScore).Finished += () =>
{
ShowRewardSelection(3);
};
}

private void OnBattleLost()
Expand Down
1 change: 1 addition & 0 deletions Scenes/ChestScene/ChestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public override void _Process(double delta)

private void GetLoot()
{
GetNode<AudioStreamPlayer>("%Audio").ProcessMode = ProcessModeEnum.Always;
ChestButton.Disabled = true;
RewardSelect.CreateSelection(this, _player.Stats, 3, Stages.Chest).Selected += EndBattle;
}
Expand Down
3 changes: 2 additions & 1 deletion Scenes/ChestScene/ChestScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ script = ExtResource("1_ardd2")
ChestButton = NodePath("CenterContainer/VBoxContainer/ChestButton")
PlayerMarker = NodePath("PlayerMarker")

[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
[node name="Audio" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("2_x78jo")
autoplay = true

Expand Down
1 change: 1 addition & 0 deletions Scenes/Puppets/Enemies/BossBlood/P_BossBlood.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public override void _Ready()
{
CurrentHealth = 100;
MaxHealth = 100;
BaseMoney = 15;
base._Ready();
var enemTween = CreateTween();
enemTween.TweenProperty(Sprite, "position", Vector2.Down * 5, 1f).AsRelative();
Expand Down
1 change: 1 addition & 0 deletions Scenes/Puppets/Enemies/EnemyPuppet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public partial class EnemyPuppet : PuppetTemplate
{
protected EnemyEffect[] BattleEvents = Array.Empty<EnemyEffect>();
public int BaseMoney { get; protected set; } = 0;

public virtual EnemyEffect[] GetBattleEvents()
{
Expand Down
1 change: 1 addition & 0 deletions Scenes/Puppets/Enemies/Parasifly/P_Parasifly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public override void _Ready()
{
CurrentHealth = 50;
MaxHealth = 50;
BaseMoney = 5;
base._Ready();
var enemTween = CreateTween();
enemTween.TweenProperty(Sprite, "position", Vector2.Down * 2, 2f).AsRelative();
Expand Down
1 change: 1 addition & 0 deletions Scenes/Puppets/Enemies/TheGWS/P_TheGWS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public override void _Ready()
{
CurrentHealth = 75;
MaxHealth = 75;
BaseMoney = 10;
base._Ready();
var enemTween = CreateTween();
enemTween.TweenProperty(Sprite, "position", Vector2.Down * 10, 3f).AsRelative();
Expand Down
2 changes: 2 additions & 0 deletions Scenes/Puppets/Scripts/PlayerStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public partial class PlayerStats : Resource
{
public int Money = 0;

public int MaxHealth = 100;
public int CurrentHealth = 100;
public int MaxComboBar = 60;
Expand Down
3 changes: 1 addition & 2 deletions Scenes/Puppets/Scripts/PuppetTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ protected virtual Tween DamageAnimate(int amount)
protected virtual void Kill()
{
Defeated?.Invoke(this);
Visible = false;
}
#endregion

Expand All @@ -127,7 +126,7 @@ public virtual void TakeDamage(DamageInstance dmg)
Tween deathTween = DamageAnimate(amount);
if (CurrentHealth <= 0)
{
deathTween.TweenCallback(Callable.From(Kill));
deathTween.Finished += Kill;
}

TextParticle newText = new TextParticle();
Expand Down
39 changes: 38 additions & 1 deletion Scenes/UI/Inventory.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[ext_resource type="Texture2D" uid="uid://8u3xvcma81d" path="res://Scenes/UI/Assets/UI_CrystalFrame.png" id="3_s6pj7"]
[ext_resource type="Texture2D" uid="uid://burj10os057fx" path="res://Scenes/UI/Assets/UI_CrystalFrameInset.png" id="4_b6trj"]

[node name="Inventory" type="Control" node_paths=PackedStringArray("_relics", "_notes", "_description", "_tabs")]
[node name="Inventory" type="Control" node_paths=PackedStringArray("_relics", "_notes", "_description", "_tabs", "_moneyLabel")]
process_mode = 1
layout_mode = 3
anchors_preset = 15
Expand All @@ -18,6 +18,7 @@ _relics = NodePath("MarginContainer/InvenVBox/Tabs/INVENTORY_TAB_RELICS/MarginCo
_notes = NodePath("MarginContainer/InvenVBox/Tabs/INVENTORY_TAB_NOTES/MarginContainer/NotesBox/NotesGrid")
_description = NodePath("MarginContainer/InvenVBox/DescBox/DescMargin/MarginContainer/Description")
_tabs = NodePath("MarginContainer/InvenVBox/Tabs")
_moneyLabel = NodePath("MoneyContainer/MoneyFrame/MarginContainer/MoneyLabel")

[node name="Background" type="NinePatchRect" parent="."]
self_modulate = Color(1, 1, 1, 0.75)
Expand Down Expand Up @@ -168,3 +169,39 @@ size_flags_vertical = 1
autowrap_mode = 2
clip_text = true
text_overrun_behavior = 1

[node name="MoneyContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -130.0
offset_bottom = 34.0
grow_horizontal = 0
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 5

[node name="MoneyFrame" type="NinePatchRect" parent="MoneyContainer"]
layout_mode = 2
texture = ExtResource("3_s6pj7")
patch_margin_left = 7
patch_margin_top = 7
patch_margin_right = 7
patch_margin_bottom = 7

[node name="MarginContainer" type="MarginContainer" parent="MoneyContainer/MoneyFrame"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_right = 8

[node name="MoneyLabel" type="Label" parent="MoneyContainer/MoneyFrame/MarginContainer"]
layout_mode = 2
size_flags_vertical = 1
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
Loading