Fixed Adrenaline still sometimes being placed as an int and breaking stuff, notably in addons like Infernum (whom discovered the bug)

This commit is contained in:
Storm2103 committed 2023-07-29 13:19:59 -06:00
1 parent d07e7060b3
commit a307722542
1 file changed
+7 -8
+7 -8
View File
@@ -1312,15 +1312,14 @@ namespace CalamityMod.CalPlayer
if (tag.ContainsKey("adrenaline"))
{
bool failedToLoadFloatAdrenaline = false;
try
{
adrenaline = tag.GetFloat("adrenaline");
}
catch (Exception) { failedToLoadFloatAdrenaline = true; }
object adrenObj = tag["adrenaline"];
if (failedToLoadFloatAdrenaline)
adrenaline = tag.GetInt("adrenaline") / (10000 / 100f);
if (adrenObj is float adrenFloat)
adrenaline = adrenFloat;
else if (adrenObj is int adrenInt)
adrenaline = adrenInt;
else
adrenaline = 0f;
}
if (tag.ContainsKey("aquaticBoostPower"))