Skip to content

Commit 120bcbe

Browse files
committed
Fix JunctionManager reset bug and add verification test
1 parent f040ca8 commit 120bcbe

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

Mythril.Data/JunctionManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class JunctionManager(
1717
public void Initialize()
1818
{
1919
_assignedCadences = _cadences.All.ToNamedDictionary(_ => (Character?)null);
20+
Junctions.Clear();
2021
}
2122

2223
public void AssignCadence(Cadence cadence, Character character, HashSet<string> unlockedAbilities)

Mythril.Tests/ResourceManagerCoreTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,29 @@ public void ResourceManager_PayCosts_CadenceUnlock_RemovesItems()
168168
Assert.AreEqual(0, _resourceManager.Inventory.GetQuantity(unlock.Requirements[0].Item));
169169
}
170170

171+
[TestMethod]
172+
public void ResourceManager_Initialize_ClearsJunctions()
173+
{
174+
// Setup a junction
175+
var character = _resourceManager!.Characters[0];
176+
var stat = ContentHost.GetContent<Stats>().All.First();
177+
var magic = _items!.All.First(i => i.Name == "Fire I");
178+
179+
// Mock ability unlock
180+
_resourceManager.UnlockedAbilities.Add("Recruit:J-Str");
181+
var recruit = ContentHost.GetContent<Cadences>().All.First(c => c.Name == "Recruit");
182+
_resourceManager.JunctionManager.AssignCadence(recruit, character, _resourceManager.UnlockedAbilities);
183+
184+
_resourceManager.JunctionManager.JunctionMagic(character, stat, magic, _resourceManager.UnlockedAbilities);
185+
Assert.AreEqual(1, _resourceManager.JunctionManager.Junctions.Count);
186+
187+
// Initialize
188+
_resourceManager.Initialize();
189+
190+
// Assert
191+
Assert.AreEqual(0, _resourceManager.JunctionManager.Junctions.Count, "Junctions should be cleared on initialization.");
192+
}
193+
171194
[TestMethod]
172195
public void Character_Name_ReturnsCorrectValue()
173196
{

docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to Play Mythril
1+
# How to Play Mythril
22

33
Mythril is a job-based incremental RPG where you manage a party of characters, unlock powerful abilities (Cadences), and tactically manage stats through Junctioning.
44

scripts/data/health_summary.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"failure_count": 1,
44
"metrics": {
55
"monoliths": 0,
6-
"coverage": 91.27,
6+
"coverage": 91.28,
77
"missing_tests": 0,
88
"key_violations": 0,
99
"testid_violations": 0,
@@ -14,7 +14,7 @@
1414
"failures": [
1515
{
1616
"category": "docs_stale",
17-
"message": "docs/instructions.md is stale (11 source changes since last update)",
17+
"message": "docs/instructions.md is stale (13 source changes since last update)",
1818
"metadata": {}
1919
}
2020
]

0 commit comments

Comments
 (0)