Lunic Corps shield behavior fixes

This commit is contained in:
Ozzatron committed 2023-08-17 15:24:25 -04:00
1 parent 741a254b25
commit d7be5f2be4
4 files changed
+23 -7

No files matched your search

+8 -4
View File
@@ -3586,12 +3586,16 @@ namespace CalamityMod.CalPlayer
// This number is not an integer, and stores exact per-frame recharge progress.
lunicCorpsShieldPartialRechargeProgress += LunicCorpsHelmet.ShieldDurabilityMax / (float)LunicCorpsHelmet.TotalShieldRechargeTime;
// Cast to int to get whole number of shield points recharged this frame.
int pointsActuallyRecharged = (int)lunicCorpsShieldPartialRechargeProgress;
// Floor the value to get whole number of shield points recharged this frame.
int pointsActuallyRecharged = (int)MathF.Floor(lunicCorpsShieldPartialRechargeProgress);
// Give those points to the real shield durability. Then remove them from recharge progress.
LunicCorpsShieldDurability += pointsActuallyRecharged;
// Give those points to the real shield durability, capping the result. Then remove them from recharge progress.
LunicCorpsShieldDurability = Math.Min(LunicCorpsShieldDurability + pointsActuallyRecharged, LunicCorpsHelmet.ShieldDurabilityMax);
lunicCorpsShieldPartialRechargeProgress -= pointsActuallyRecharged;
// Update the cooldown rack's durability indicator.
if (cooldowns.TryGetValue(Cooldowns.LunicCorpsShieldDurability.ID, out var cdDurability))
cdDurability.timeLeft = LunicCorpsShieldDurability;
}
// Add light if this shield is currently active
+12 -2
View File
@@ -1,6 +1,5 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.LunicCorps;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -82,13 +81,24 @@ namespace CalamityMod.Cooldowns
public static new string ID => "MasterChefShieldRecharge";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/MasterChefShieldDurability";
public override string Texture => "CalamityMod/Cooldowns/LunicCorpsShieldRecharge";
public override string OutlineTexture => "CalamityMod/Cooldowns/LunicCorpsShieldOutline";
public override string OverlayTexture => "CalamityMod/Cooldowns/LunicCorpsShieldOverlay";
public override bool SavedWithPlayer => false;
public override bool PersistsThroughDeath => false;
public override Color OutlineColor => new Color(133, 204, 237);
public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override SoundStyle? EndSound => LunicCorpsHelmet.ActivationSound;
public override void Tick() => instance.player.Calamity().playedLunicCorpsShieldSound = false;
// When the recharge period completes, grant 1 point of shielding immediately so the rest my refill normally.
// The shield durability cooldown is added elsewhere, in Misc Effects.
public override void OnCompleted()
{
CalamityPlayer modPlayer = instance.player.Calamity();
if (modPlayer.LunicCorpsShieldDurability <= 0)
modPlayer.LunicCorpsShieldDurability = 1;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

+3 -1
View File
@@ -81,8 +81,10 @@ namespace CalamityMod.Cooldowns
public static new string ID => "WulfrumRoverDriveRecharge";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override LocalizedText DisplayName => GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/WulfrumRoverDrive";
public override string OutlineTexture => "CalamityMod/Cooldowns/WulfrumRoverDriveOutline";
public override string OverlayTexture => "CalamityMod/Cooldowns/WulfrumRoverDriveOverlay";
public override bool SavedWithPlayer => false;
public override bool PersistsThroughDeath => false;
public override Color OutlineColor => new Color(194, 255, 67);