NEEDS MORE TESTING: fixed that annoying mp cooldown error spam by moving ascendant insignia (error only triggered once (instead of several), it would be best if it doesnt happen at all)

This commit is contained in:
Storm2103 authored and Cameron Ewell committed 2024-05-27 18:54:37 -04:00
1 parent 941ad97305
commit cef2a8e283
2 files changed
+22 -18

No files matched your search

+9
View File
@@ -2699,6 +2699,15 @@ namespace CalamityMod.CalPlayer
if (Player.dead)
return;
if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0)
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<AscendantInsignia>()));
Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType<AscendantAura>(), 0, 0f);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate"));
ascendantInsigniaCooldown = 2400;
ascendantInsigniaBuffTime = 240; //4 seconds
}
//Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero
if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued)
{
+13 -18
View File
@@ -1337,6 +1337,8 @@ namespace CalamityMod.CalPlayer
if (expiredCooldowns.Count > 0)
SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns);
if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0)
ascendantInsigniaCooldown--;
if (DragonsBreathAudioCooldown > 0)
DragonsBreathAudioCooldown--;
if (DragonsBreathAudioCooldown2 > 0)
@@ -2012,6 +2014,13 @@ namespace CalamityMod.CalPlayer
}
// This section of code ensures set bonuses and accessories with cooldowns go on cooldown immediately if the armor or accessory is removed.
if (!ascendantInsignia && ascendantInsigniaBuffTime > 0)
{
ascendantInsigniaBuffTime = 0;
ascendantInsigniaCooldown = 2400;
Player.AddCooldown(AscendEffect.ID, 2400);
}
if (!brimflameSet && brimflameFrenzy)
{
brimflameFrenzy = false;
@@ -3077,27 +3086,13 @@ namespace CalamityMod.CalPlayer
}
}
if (ascendantInsignia)
if (ascendantInsignia && ascendantInsigniaBuffTime > 0)
{
if (CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0)
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<AscendantInsignia>()));
Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType<AscendantAura>(), 0, 0f);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate"));
ascendantInsigniaCooldown = 2400;
ascendantInsigniaBuffTime = 240; //4 seconds
}
if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0)
ascendantInsigniaCooldown--;
ascendantTrail = true;
infiniteFlight = true;
if (ascendantInsigniaBuffTime == 1)
Player.AddCooldown(AscendEffect.ID, 2400);
if (ascendantInsigniaBuffTime > 0)
{
ascendantTrail = true;
infiniteFlight = true;
ascendantInsigniaBuffTime--;
}
ascendantInsigniaBuffTime--;
}
if (abyssalDivingSuit && !Player.IsUnderwater())