clean and polish

This commit is contained in:
Doze-Zoze committed 2025-06-23 17:50:58 -05:00
1 parent e1a512521d
commit 71b19ef947
5 files changed
+33 -48

No files matched your search

+1 -1
View File
@@ -96,7 +96,7 @@ namespace CalamityMod.ILEditing
On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck;
// Mana Burn (Chaos Stone) and Chalice of the Blood God
IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal;
IL_Player.ApplyLifeAndOrMana += ChaliceBufferHeal;
On_Player.CheckMana_int_bool_bool += AllowNegativeCheckMana;
On_Player.CheckMana_Item_int_bool_bool += AllowNegativeCheckMana;
+1 -26
View File
@@ -628,7 +628,7 @@ namespace CalamityMod.ILEditing
#endregion
#region Chaos Stone and Chalice of the Blood God
private static void ManaSicknessAndChaliceBufferHeal(ILContext il)
private static void ChaliceBufferHeal(ILContext il)
{
ILCursor cursor = new ILCursor(il);
@@ -676,31 +676,6 @@ namespace CalamityMod.ILEditing
}
}
});
//
// The following section enables Mana Burn for Chaos Stone by conditionally replacing Mana Sickness.
//
// Start by finding the vanilla code which applies Mana Sickness (buff ID 94).
if (!cursor.TryGotoNext(c => c.MatchLdcI4(BuffID.ManaSickness)))
{
LogFailure("Conditionally Replace Mana Sickness", "Could not locate the mana sickness buff ID.");
return;
}
// Remove the constant buff ID.
cursor.Remove();
// Load the player onto the stack for use in the following delegate.
cursor.Emit(OpCodes.Ldarg_0);
// Emit code which checks for the Chaos Stone. If equipped, the player gets Mana Burn instead of Mana Sickness.
cursor.EmitDelegate<Func<Player, int>>(player =>
{
if (!player.active || !player.Calamity().ChaosStone)
return BuffID.ManaSickness;
return ModContent.BuffType<ManaBurn>();
});
}
#endregion
+6 -5
View File
@@ -669,6 +669,11 @@ namespace CalamityMod.Items
if (item.type != ModContent.ItemType<EvilSmasher>())
player.Calamity().evilSmasherBoost = 0;
}
if (player.Calamity().ChaosStone && item.mana == 0 && !player.ItemTimeIsZero)
{
player.manaRegenDelay = player.maxRegenDelay;
}
}
public override bool? UseItem(Item item, Player player)
@@ -721,16 +726,12 @@ namespace CalamityMod.Items
return true;
}
}
return base.UseItem(item, player);
}
public override void UseAnimation(Item item, Player player)
{
if (player.Calamity().ChaosStone && item.mana == 0)
{
player.manaRegenDelay = 0.7f * ((1 - (player.statMana / (float)player.statManaMax2)) * 240 + 45);
}
}
public override bool AltFunctionUse(Item item, Player player)
+24 -15
View File
@@ -925,21 +925,6 @@ namespace CalamityMod.NPCs
ApplyDPSDebuff(baseIrradiatedDoTValue, baseIrradiatedDoTValue / 20, ref npc.lifeRegen, ref damage);
}
// Mana Burn
if (manaBurn > 0)
{
if (manaBurnPeak >= 0.1f)
{
manaBurnPeak *= 0.999f;
}
manaBurnPeak = Math.Max(manaBurnPeak, manaBurn);
int burnPerSecond = (int)MathF.Ceiling(manaBurn * 0.5f);
manaBurn -= burnPerSecond/60f;
ApplyDPSDebuff(burnPerSecond, (int)(burnPerSecond*0.25f), ref npc.lifeRegen, ref damage);
} else {
manaBurnPeak = 0;
playerManaBurnIntensity = 0;
}
#endregion
// Debuff vulnerabilities and resistances.
@@ -1415,6 +1400,30 @@ namespace CalamityMod.NPCs
if (((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && (CalamityWorld.death || BossRushEvent.BossRushActive))
npc.lifeRegen = 0;
}
// Mana Burn
//This is at the end to leave it full effect on worms, and to force the DOT numbers to match mana burn
if (manaBurn > 0)
{
if (manaBurnPeak >= 0.1f)
{
manaBurnPeak *= 0.999f;
}
manaBurnPeak = Math.Max(manaBurnPeak, manaBurn);
int burnPerSecond = (int)MathF.Ceiling(manaBurn*0.5f);
manaBurn -= burnPerSecond / 60f;
if (npc.lifeRegen > 0)
npc.lifeRegen = 0;
npc.lifeRegen -= burnPerSecond*2;
damage += (int)(burnPerSecond * 0.5f);
}
else
{
manaBurnPeak = 0;
playerManaBurnIntensity = 0;
}
}
public void ApplyDPSDebuff(int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage)
+1 -1
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.UI.ResourceSets
{
string folder = $"{baseFolder}MP";
CalamityPlayer modPlayer = Main.LocalPlayer.Calamity();
if (modPlayer.ManaBurn)
if (Main.LocalPlayer.statMana < 0)
return folder + "ManaBurn";
if (modPlayer.pHeart)
return folder + "PhantomHeart";