diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index b4e5a2a9ac..1407494672 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1371,10 +1371,13 @@ namespace CalamityMod.ILEditing #region Custom world selection difficulties internal static void GetDifficultyOverride(Terraria.GameContent.UI.Elements.On_AWorldListItem.orig_GetDifficulty orig, AWorldListItem self, out string expertText, out Color gameModeColor) { + // Run the original code and pull out the original text and text color orig(self, out expertText, out gameModeColor); string difficultyText = expertText; Color difficultyColor = gameModeColor; + + // Go through the World Selection Difficulty System's World Difficulty list backwards and choose the latest difficulty that applies for (int i = WorldSelectionDifficultySystem.WorldDifficulties.Count - 1; i >= 0; i--) { WorldSelectionDifficultySystem.WorldDifficulty d = WorldSelectionDifficultySystem.WorldDifficulties[i]; @@ -1388,6 +1391,7 @@ namespace CalamityMod.ILEditing } } + // Set the text and text color expertText = difficultyText; gameModeColor = difficultyColor; } diff --git a/Systems/WorldSelectionDifficultySystem.cs b/Systems/WorldSelectionDifficultySystem.cs index a8ac35bee0..37f9bb3852 100644 --- a/Systems/WorldSelectionDifficultySystem.cs +++ b/Systems/WorldSelectionDifficultySystem.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Systems { public override void PostSetupContent() { + // Load all of the World Difficulties to the World Difficulty list + // The difficulty the world uses will be the latest applicable one, so these are added in order from easiest to hardest + string revenge = CalamityUtils.GetTextValue("UI.Revengeance"); string death = CalamityUtils.GetTextValue("UI.Death"); string rev = CalamityUtils.GetTextValue("UI.Rev"); @@ -30,9 +33,9 @@ namespace CalamityMod.Systems WorldDifficulties.Add(new WorldDifficulty(death + plus + legend, GetLegendDeath, new(220, 255, 132))); } - // Since CalamityWorld is static, and therefore invalid for TryGetHeaderData, make copies for Rev and Death public override void SaveWorldHeader(TagCompound tag) { + // Since CalamityWorld is static, and therefore invalid for TryGetHeaderData, make copies for Rev and Death tag["RevengeanceMode"] = CalamityWorld.revenge; tag["DeathMode"] = CalamityWorld.death; }