broken holding commit until I eventually get back to this

This commit is contained in:
Ozzatron authored and Cameron Ewell committed 2022-03-09 00:02:13 -05:00
1 parent 0c42bd6e23
commit c55944f716
170 files changed
+960 -1148

No files matched your search

+12 -8
View File
@@ -6,13 +6,13 @@ using CalamityMod.Buffs.Potions;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.Summon;
using CalamityMod.Cooldowns;
using CalamityMod.DataStructures;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
using CalamityMod.Items.Armor;
using CalamityMod.Items.DifficultyItems;
using CalamityMod.Items.Dyes;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Mounts.Minecarts;
@@ -60,7 +60,6 @@ using CalamityMod.Projectiles.Typeless;
using CalamityMod.Skies;
using CalamityMod.Tiles;
using CalamityMod.UI;
using CalamityMod.UI.CooldownIndicators;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -281,7 +280,7 @@ namespace CalamityMod.CalPlayer
private const int DashDisableCooldown = 12;
public bool disableAllDodges = false;
public List<CooldownIndicator> Cooldowns = new List<CooldownIndicator>();
public Dictionary<string, CooldownInstance> Cooldowns = new Dictionary<string, CooldownInstance>(16);
public bool canFireAtaxiaRangedProjectile = false;
public bool canFireAtaxiaRogueProjectile = false;
@@ -2153,8 +2152,13 @@ namespace CalamityMod.CalPlayer
#region UpdateDead
public override void UpdateDead()
{
//Clear all the cooldowns
Cooldowns.RemoveAll(cooldown => cooldown.ResetOnDeath);
// Remove all cooldowns which do not persist through death.
if (Cooldowns.Count > 0)
{
var cooldownEntriesToRemove = Cooldowns.Where((kv) => !kv.Value.source.PersistsThroughDeath);
foreach (var kv in cooldownEntriesToRemove)
Cooldowns.Remove(kv.Key);
}
#region Debuffs
totalDefenseDamage = 0;
@@ -3853,13 +3857,13 @@ namespace CalamityMod.CalPlayer
{
if (!Cooldowns.Exists(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking)))
{
CooldownIndicator durability = new DivingPlatesBreaking(3, player);
Cooldown durability = new DivingPlatesBreaking(3, player);
durability.TimeLeft = abyssalDivingSuitPlateHits;
Cooldowns.Add(durability);
}
else
{
CooldownIndicator durability = Cooldowns.Find(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking));
Cooldown durability = Cooldowns.Find(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking));
durability.TimeLeft = abyssalDivingSuitPlateHits;
}
@@ -7001,7 +7005,7 @@ namespace CalamityMod.CalPlayer
if (abyssalDivingSuitPlateHits < 3)
abyssalDivingSuitPlateHits++;
CooldownIndicator durability = Cooldowns.Find(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking));
Cooldown durability = Cooldowns.Find(cooldown => cooldown.GetType() == typeof(DivingPlatesBreaking));
durability.TimeLeft = abyssalDivingSuitPlateHits;
if (abyssalDivingSuitPlateHits >= 3)
+43 -38
View File
@@ -1,10 +1,10 @@
using CalamityMod.Buffs.Alcohol;
using CalamityMod.Buffs.Cooldowns;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.Potions;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.Summon;
using CalamityMod.Cooldowns;
using CalamityMod.CustomRecipes;
using CalamityMod.DataStructures;
using CalamityMod.Dusts;
@@ -24,7 +24,6 @@ using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs;
using CalamityMod.NPCs.AcidRain;
using CalamityMod.NPCs.Astral;
@@ -33,15 +32,12 @@ using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Other;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Environment;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.UI;
using CalamityMod.UI.CooldownIndicators;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -51,7 +47,6 @@ using System.Linq;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.GameInput;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -62,7 +57,7 @@ namespace CalamityMod.CalPlayer
public partial class CalamityPlayer : ModPlayer
{
#region Post Update Misc Effects
public override void PostUpdateMiscEffects()
public override void PostUpdateMiscEffects()
{
// No category
@@ -166,15 +161,15 @@ namespace CalamityMod.CalPlayer
player.rangedCrit = 4;
}
if (player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>())
heldGaelsLastFrame = true;
if (player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>())
heldGaelsLastFrame = true;
// De-equipping Gael's Greatsword deletes all rage.
else if (heldGaelsLastFrame)
{
heldGaelsLastFrame = false;
rage = 0f;
}
// De-equipping Gael's Greatsword deletes all rage.
else if (heldGaelsLastFrame)
{
heldGaelsLastFrame = false;
rage = 0f;
}
}
#endregion
@@ -505,11 +500,11 @@ namespace CalamityMod.CalPlayer
{
if (DoGCartSegments[i] is null)
{
DoGCartSegments[i] = new DoGCartSegment
{
Center = player.Center - idealRotation.ToRotationVector2() * i * 20f
};
}
DoGCartSegments[i] = new DoGCartSegment
{
Center = player.Center - idealRotation.ToRotationVector2() * i * 20f
};
}
}
Vector2 startingStickPosition = player.Center + stickOffset + new Vector2(direction * (float)Math.Cos(SmoothenedMinecartRotation * 2f) * -34f, 12f);
@@ -581,7 +576,7 @@ namespace CalamityMod.CalPlayer
// Summon bullseyes on nearby targets.
if (spiritOrigin)
{
{
int bullseyeType = ModContent.ProjectileType<SpiritOriginBullseye>();
List<int> alreadyTargetedNPCs = new List<int>();
for (int i = 0; i < Main.maxProjectiles; i++)
@@ -946,28 +941,38 @@ namespace CalamityMod.CalPlayer
}
}
// Cooldowns and timers
// Tick all cooldowns.
// Depending on the code for each individual cooldown, this isn't guaranteed to do anything.
// It may not tick down the timer or not do anything at all.
IList<string> expiredCooldowns = new List<string>(16);
var cdIterator = Cooldowns.Values.GetEnumerator();
while(cdIterator.MoveNext())
{
CooldownInstance instance = cdIterator.Current;
Cooldown cd = instance.source;
foreach (CooldownIndicator cd in Cooldowns)
{
// If applicable, tick down this cooldown instance's timer.
if (cd.CanTickDown)
cd.TimeLeft--;
--instance.timeLeft;
cd.CooldownEffects();
// Tick always runs, even if the timer does not decrement.
cd.Tick(instance);
if (cd.TimeLeft < 0)
// Run on-completion code, play sounds and remove finished cooldowns.
if (instance.timeLeft < 0)
{
cd.OnCompleted(instance);
Main.PlaySound(cd.EndSound);
cd.OnCooldownEnd();
expiredCooldowns.Add(cd.ID);
if (cd.SyncID != "" && Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
{
player.Calamity().SyncCooldown(false, cd.SyncID);
}
// TODO -- netcode for when cooldowns disappear
}
}
}
cdIterator.Dispose();
Cooldowns.RemoveAll(cooldown => cooldown.TimeLeft < 0);
// Remove all expired cooldowns.
foreach (string cdID in expiredCooldowns)
Cooldowns.Remove(cdID);
if (spiritOriginBullseyeShootCountdown > 0)
spiritOriginBullseyeShootCountdown--;
@@ -1057,8 +1062,8 @@ namespace CalamityMod.CalPlayer
hellbornBoost--;
if (persecutedEnchantSummonTimer < 1800)
persecutedEnchantSummonTimer++;
else
{
else
{
persecutedEnchantSummonTimer = 0;
if (Main.myPlayer == player.whoAmI && persecutedEnchant && NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
{
@@ -3367,8 +3372,8 @@ namespace CalamityMod.CalPlayer
{
if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[ModContent.ProjectileType<CryonicShield>()] == 0)
Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<CryonicShield>(), (int)(player.AverageDamage() * 70), 0f, player.whoAmI);
}
else if (player.whoAmI == Main.myPlayer)
}
else if (player.whoAmI == Main.myPlayer)
{
int shieldType = ModContent.ProjectileType<CryonicShield>();
for (int i = 0; i < Main.maxProjectiles; i++)
+9 -9
View File
@@ -1,4 +1,4 @@
using CalamityMod.UI.CooldownIndicators;
using CalamityMod.Cooldowns;
using System;
using System.IO;
using Terraria;
@@ -7,7 +7,7 @@ using Terraria.ModLoader;
namespace CalamityMod.CalPlayer
{
public partial class CalamityPlayer : ModPlayer
public partial class CalamityPlayer : ModPlayer
{
#region Standard Syncs
internal const int GlobalSyncPacketTimer = 15;
@@ -157,15 +157,15 @@ namespace CalamityMod.CalPlayer
//Already being synced when it gets created and then when it expires
if (cooldownID == "")
{
foreach (string key in CooldownIndicator.IDtoType.Keys)
foreach (string key in Cooldown.IDtoType.Keys)
{
ModPacket packet = mod.GetPacket();
packet.Write((byte)CalamityModMessageType.CooldownSync);
packet.Write(player.whoAmI);
packet.Write(key);
int timer = 0;
if (Cooldowns.Exists(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[key]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[key]).TimeLeft;
if (Cooldowns.Exists(cooldown => cooldown.GetType() == Cooldown.IDtoType[key]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == Cooldown.IDtoType[key]).TimeLeft;
packet.Write(timer);
player.SendPacket(packet, server);
}
@@ -178,8 +178,8 @@ namespace CalamityMod.CalPlayer
packet.Write(player.whoAmI);
packet.Write(cooldownID);
int timer = 0;
if (Cooldowns.Exists(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[cooldownID]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == CooldownIndicator.IDtoType[cooldownID]).TimeLeft;
if (Cooldowns.Exists(cooldown => cooldown.GetType() == Cooldown.IDtoType[cooldownID]))
timer = Cooldowns.Find(cooldown => cooldown.GetType() == Cooldown.IDtoType[cooldownID]).TimeLeft;
packet.Write(timer);
player.SendPacket(packet, server);
}
@@ -338,7 +338,7 @@ namespace CalamityMod.CalPlayer
{
string syncID = reader.ReadString();
int timer = reader.ReadInt32();
Type cooldownType = CooldownIndicator.IDtoType[syncID];
Type cooldownType = Cooldown.IDtoType[syncID];
// If this cooldown is present, edit the existing cooldown's timer.
if (Cooldowns.Exists(cooldown => cooldown.GetType() == cooldownType))
@@ -346,7 +346,7 @@ namespace CalamityMod.CalPlayer
// Otherwise create a new cooldown with this timer.
else if (timer > 0)
Cooldowns.Add((CooldownIndicator)Activator.CreateInstance(cooldownType, timer, player));
Cooldowns.Add((Cooldown)Activator.CreateInstance(cooldownType, timer, player));
if (Main.netMode == NetmodeID.Server)
SyncCooldown(true);
+4 -3
View File
@@ -2,6 +2,7 @@ using CalamityMod.Balancing;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Cooldowns;
using CalamityMod.DataStructures;
using CalamityMod.Effects;
using CalamityMod.Events;
@@ -74,7 +75,7 @@ using Terraria.UI;
namespace CalamityMod
{
public class CalamityMod : Mod
public class CalamityMod : Mod
{
// CONSIDER -- I have been advised by Jopo that Mods should never contain static variables
// TODO -- 1.4 fixes the crit reforge price calculation bug, so GetWeaponCrit everywhere can go.
@@ -217,7 +218,7 @@ namespace CalamityMod
GeneralParticleHandler.Load();
}
CooldownIndicator.Load();
Cooldown.Load();
BossRushEvent.Load();
BossHealthBarManager.Load(this);
DraedonStructures.Load();
@@ -397,7 +398,7 @@ namespace CalamityMod
CustomLavaManagement.Unload();
BossHealthBarManager.Unload();
DraedonStructures.Unload();
CooldownIndicator.Unload();
Cooldown.Unload();
TileFraming.Unload();
File renamed without changes.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 151 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 403 B

After

Width:  |  Height:  |  Size: 403 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 171 B

+68
View File
@@ -0,0 +1,68 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using static CalamityMod.CalamityUtils;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Cooldowns
{
public class DivingPlatesBreaking : Cooldown
{
private static Color phase0Color = new Color(147, 218, 183);
private static Color phase1Color = new Color(233, 190, 134);
private static Color phase2Color = new Color(220, 111, 94);
private static Color ringColorLerpStart = new Color(160, 174, 174);
private static Color ringColorLerpEnd = new Color(192, 11, 107);
public override bool CanTickDown(CooldownInstance instance) => !instance.player.Calamity().abyssalDivingSuit;
public override bool ShouldDisplay(CooldownInstance instance) => instance.player.Calamity().abyssalDivingSuit;
public override string DisplayName(CooldownInstance instance) => "Abyssal Diving Suit Plates Durability";
public override string Texture => "CalamityMod/Cooldowns/AbyssalDivingSuitBreakingPlates";
public override string OutlineTexture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlatesOutline";
public override string OverlayTexture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlatesOverlay";
public override Color GetOutlineColor(CooldownInstance instance)
{
if (instance.timeLeft == 0)
return phase0Color;
else if (instance.timeLeft == 1)
return phase1Color;
return phase2Color;
}
public override Color GetCooldownStartColor(CooldownInstance instance) => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override Color GetCooldownEndColor(CooldownInstance instance) => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override bool UseCustomCompactDraw => true;
public override void DrawCompact(CooldownInstance instance, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = GetTexture(Texture);
Texture2D outline = GetTexture(OutlineTexture);
Color outlineColor = GetOutlineColor(instance);
Color startColor = GetCooldownStartColor(instance);
//Draw the outline
spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
//Draw the icon
spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
DrawBorderStringEightWay(spriteBatch, Main.fontMouseText, (3 - instance.timeLeft).ToString(), position + new Vector2(-3, -3) * scale, startColor, Color.Black, scale);
}
}
public class DivingPlatesBroken : Cooldown
{
private static Color outlineColor = new Color(194, 173, 146);
private static Color ringColorLerpStart = new Color(91, 121, 150);
private static Color ringColorLerpEnd = new Color(30, 50, 77);
public override string ID => "AbyssalDivingBrokenPlates";
public override bool ShouldDisplay(CooldownInstance instance) => true;
public override string DisplayName(CooldownInstance instance) => "Abyssal Diving Suit Broken Plates";
public override string Texture => "CalamityMod/Cooldowns/AbyssalDivingSuitBrokenPlates";
public override Color GetOutlineColor(CooldownInstance instance) => outlineColor;
public override Color GetCooldownStartColor(CooldownInstance instance) => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override Color GetCooldownEndColor(CooldownInstance instance) => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion);
public override void OnCompleted(CooldownInstance instance) => instance.player.Calamity().abyssalDivingSuitPlateHits = 0;
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 365 B

@@ -1,36 +1,32 @@
using CalamityMod.DataStructures;
using CalamityMod.Cooldowns;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class OmegaBlueCooldown : CooldownIndicator
public class OmegaBlueCooldown : Cooldown
{
public override string SyncID => "OmegaBlue";
public override bool DisplayMe => true;
public override string Name => TimeLeft > 1500 ? "Abyssal Madness" : "Abyssal Madness Cooldown";
public override string ID => "OmegaBlue";
public override bool ShouldDisplay(CooldownInstance instance) => true;
public override string DisplayName(CooldownInstance instance) => instance.timeLeft > 1500 ? "Abyssal Madness" : "Abyssal Madness Cooldown";
public override string Texture => TimeLeft > 1500 ? "CalamityMod/UI/CooldownIndicators/AbyssalMadnessActive" : "CalamityMod/UI/CooldownIndicators/AbyssalMadness";
public override string TextureOutline => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOutline";
public override string TextureOverlay => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOverlay";
public override string OutlineTexture => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOutline";
public override string OverlayTexture => "CalamityMod/UI/CooldownIndicators/AbyssalMadnessOverlay";
public override Color OutlineColor => TimeLeft > 1500 ? new Color(231, 164, 1) : new Color(72, 135, 205);
public override Color CooldownColorStart => TimeLeft > 1500 ? Color.Lerp(new Color(98, 110, 179), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(98, 110, 179);
public override Color CooldownColorEnd => TimeLeft > 1500 ? Color.Lerp(new Color(179, 132, 98), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(179, 132, 98);
public override Color CooldownStartColor => TimeLeft > 1500 ? Color.Lerp(new Color(98, 110, 179), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(98, 110, 179);
public override Color CooldownEndColor => TimeLeft > 1500 ? Color.Lerp(new Color(179, 132, 98), new Color(216, 176, 80), (TimeLeft - 1500) / 300f) : new Color(179, 132, 98);
public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/OmegaBlueRecharge");
public OmegaBlueCooldown(int duration, Player player) : base(duration, player)
{
}
public override void OnCooldownEnd()
public override void OnCompleted()
{
for (int i = 0; i < 66; i++)
{
@@ -50,18 +46,18 @@ namespace CalamityMod.UI.CooldownIndicators
//Use the adjusted completion
GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownColorStart);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownColorEnd);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].Apply();
}
public override bool UseCustomDrawCompact => true;
public override bool UseCustomCompactDraw => true;
public override void CustomDrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = GetTexture(Texture);
Texture2D outline = GetTexture(TextureOutline);
Texture2D overlay = GetTexture(TextureOverlay);
Texture2D outline = GetTexture(OutlineTexture);
Texture2D overlay = GetTexture(OverlayTexture);
//Draw the outline
spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
File renamed without changes.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 100 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

+20
View File
@@ -0,0 +1,20 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class BloodflareFrenzyCooldown : Cooldown
{
public override string ID => "BloodflareFrenzy";
public override bool ShouldDisplay => true;
public override string DisplayName => "Blood Frenzy Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/BloodflareFrenzy";
public override Color OutlineColor => new Color(229, 171, 124);
public override Color CooldownStartColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - Completion);
public override Color CooldownEndColor => Color.Lerp(new Color(149, 127, 109), new Color(220, 101, 101), 1 - Completion);
public BloodflareFrenzyCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

+23
View File
@@ -0,0 +1,23 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
namespace CalamityMod.Cooldowns
{
public class BloodflareSoulCooldown : Cooldown
{
public override string SyncID => "BloodflareSoul";
public override bool ShouldDisplay => true;
public override string DisplayName => "Bloodflare Soul Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/BloodflareSoul";
public override Color OutlineColor => new Color(255, 205, 219);
public override Color CooldownStartColor => new Color(216, 60, 90);
public override Color CooldownEndColor => new Color(251, 106, 150);
public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BloodflareRangerRecharge");
public BloodflareSoulCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 185 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 426 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 171 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

@@ -1,28 +1,20 @@
using CalamityMod.DataStructures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
using Terraria.ModLoader;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class BrimflameFrenzyCooldown : CooldownIndicator
public class BrimflameFrenzyCooldown : Cooldown
{
public override string SyncID => "BrimflameFrenzy";
public override bool DisplayMe => true;
public override string Name => "Brimflame Frenzy Cooldown";
public override bool ShouldDisplay => true;
public override string DisplayName => "Brimflame Frenzy Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/BrimflameFrenzy";
public override Color OutlineColor => new Color(211, 124, 93);
public override Color CooldownColorStart => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion);
public override Color CooldownColorEnd => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion);
public override Color CooldownStartColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion);
public override Color CooldownEndColor => Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - Completion);
public override LegacySoundStyle EndSound => AfflictedPlayer.Calamity().mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/BrimflameRecharge");
@@ -30,12 +22,12 @@ namespace CalamityMod.UI.CooldownIndicators
{
}
public override bool UseCustomDraw => true;
public override bool UseCustomExpandedDraw => true;
//Add red eyes to the icon
public override void CustomDraw(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
base.CustomDraw(spriteBatch, position, opacity, scale);
base.DrawExpanded(spriteBatch, position, opacity, scale);
Texture2D sprite = GetTexture(Texture + "Eyes");
//Draw the icon
File renamed without changes.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 140 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 328 B

@@ -1,26 +1,16 @@
using CalamityMod.DataStructures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class ChaosStateDisplay : CooldownIndicator
public class ChaosStateDisplay : Cooldown
{
public override bool DisplayMe => CalamityConfig.Instance.VanillaCooldownDisplay && AfflictedPlayer.chaosState;
public override string Name => "Teleportation Cooldown";
public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && AfflictedPlayer.chaosState;
public override string DisplayName => "Teleportation Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/ChaosState" + skinTexture;
public override Color OutlineColor => outlineColor;
public override Color CooldownColorStart => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownColorEnd => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
//It's the same cooldown with different skins each time, basically.
public string skinTexture;
File renamed without changes.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 353 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 172 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 172 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

+191
View File
@@ -0,0 +1,191 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
namespace CalamityMod.Cooldowns
{
public abstract class Cooldown
{
// Do not ever change this value. It is set when a cooldown is registered.
internal ushort netID;
/// <summary>
/// Unique string ID of the cooldown. You can set this to whatever you want.
/// </summary>
public virtual string ID => "";
/// <summary>
/// This method runs once every frame while the cooldown is active.
/// </summary>
public virtual void Tick(CooldownInstance instance) { }
/// <summary>
/// This method runs when the cooldown ends naturally. It is not called if the cooldown is deleted because the player died.
/// </summary>
public virtual void OnCompleted(CooldownInstance instance) { }
/// <summary>
/// Determines whether the cooldown can currently tick down.<br/>
/// For example, this is useful for cooldowns that don't tick down if there are any bosses alive.<br/>
/// You can also use it so that cooldowns which persist through death do not tick down while the player is dead.
/// </summary>
public virtual bool CanTickDown(CooldownInstance instance) => true;
/// <summary>
/// Set this to true to make this cooldown remain even when the player dies.<br/>
/// All cooldowns with PersistsThroughDeath set to false disappear immediately when the player dies.
/// </summary>
public virtual bool PersistsThroughDeath => false;
/// <summary>
/// When the cooldown ends, this sound is played. Leave at <b>null</b> for no sound.
/// </summary>
public virtual LegacySoundStyle EndSound => null;
/// <summary>
/// Whether or not this cooldown should appear in the cooldown rack UI.
/// </summary>
public virtual bool ShouldDisplay(CooldownInstance instance) => true;
/// <summary>
/// The name of the cooldown, appears when the player hovers over the indicator
/// </summary>
public virtual string DisplayName(CooldownInstance instance) => "";
/// <summary>
/// The texture of the cooldown indicator.<br/>
/// <b>These must be 20x20 pixels when at 2x2 scale.</b>
/// </summary>
public virtual string Texture => "";
/// <summary>
/// This texture is overlaid atop the cooldown when the cooldown rack is rendering in compact mode.
/// </summary>
public virtual string OverlayTexture => $"{Texture}Overlay";
/// <summary>
/// This outline texture is rendered around the base icon texture.
/// </summary>
public virtual string OutlineTexture => $"{Texture}Outline";
internal static string DefaultChargeBarTexture = "CalamityMod/Cooldowns/BarBase";
/// <summary>
/// The texture of this cooldown's "charge bar", or the circle rendered by shaders.<br/>
/// This is only used when the cooldown rack is rendering in expanded mode and when UseCustomExpandedDraw is set to false.<br/>
/// <b>These must be 44x44 pixels when at 2x2 scale.</b>
/// </summary>
public virtual string ChargeBarTexture => DefaultChargeBarTexture;
/// <summary>
/// The background texture of this cooldown's "charge bar", or the circle rendered by shaders.<br/>
/// This is only used when the cooldown rack is rendering in expanded mode and when UseCustomExpandedDraw is set to false.<br/>
/// Leave it as the default to have nothing render underneath the charge bar itself.<br/>
/// <b>These must be 44x44 pixels when at 2x2 scale.</b>
/// </summary>
public virtual string ChargeBarBackTexture => DefaultChargeBarTexture;
/// <summary>
/// The color used for the icon outline when rendering in expanded mode.<br/>
/// In compact mode, this color is used for the overlay that goes above the icon.
/// </summary>
public virtual Color GetOutlineColor(CooldownInstance instance) => Color.White;
/// <summary>
/// The color used for the start of the circular cooldown timer rendered by shaders.<br/>
/// This color is only used when drawing in expanded mode and is ignored if a charge bar texture is provided.
/// </summary>
public virtual Color GetCooldownStartColor(CooldownInstance instance) => Color.Gray;
/// <summary>
/// The color used for the end of the circular cooldown timer rendered by shaders.<br/>
/// This color is only used when drawing in expanded mode and is ignored if a charge bar texture is provided.
/// </summary>
public virtual Color GetCooldownEndColor(CooldownInstance instance) => Color.White;
/// <summary>
/// Set this to true to disable default drawing and instead call the function DrawExpanded.<br/>
/// This only applies when the cooldown rack is rendering in expanded mode.
/// </summary>
public virtual bool UseCustomExpandedDraw => false;
/// <summary>
/// This method is called to render the cooldown when the cooldown rack is in expanded mode and UseCustomExpandedDraw is set to true.
/// </summary>
public virtual void DrawExpanded(CooldownInstance instance, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = ModContent.GetTexture(Texture);
Texture2D outline = ModContent.GetTexture(OutlineTexture);
Texture2D barBase = ModContent.GetTexture(ChargeBarTexture);
Color outlineColor = GetOutlineColor(instance);
//Draw the ring
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
ApplyBarShaders(instance, opacity);
spriteBatch.Draw(barBase, position, null, Color.White * opacity, 0, barBase.Size() * 0.5f, scale, SpriteEffects.None, 0f);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix);
//Draw the outline
spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
//Draw the icon
spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
}
/// <summary>
/// Set this to true to disable default drawing and instead call the function DrawCompact.<br/>
/// This only applies when the cooldown rack is rendering in compact mode.
/// </summary>
public virtual bool UseCustomCompactDraw => false;
/// <summary>
/// This method is called to render the cooldown when the cooldown rack is in compact mode and UseCustomCompactDraw is set to true.
/// </summary>
public virtual void DrawCompact(CooldownInstance instance, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = ModContent.GetTexture(Texture);
Texture2D outline = ModContent.GetTexture(OutlineTexture);
Texture2D overlay = ModContent.GetTexture(OverlayTexture);
Color outlineColor = GetOutlineColor(instance);
//Draw the outline
spriteBatch.Draw(outline, position, null, outlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
//Draw the icon
spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
//Draw the small overlay
int lostHeight = (int)Math.Ceiling(overlay.Height * (1 - instance.Completion));
Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight);
spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, outlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
}
/// <summary>
/// Renders the circular cooldown timer with a radial shader. This method is only called if UseCustomDraw is set to false.<br/>
/// If the charge bar texture is defined, it is used. Otherwise it renders a flat ring which slides from the start color to the end color.
/// </summary>
public virtual void ApplyBarShaders(CooldownInstance instance, float opacity)
{
if (ChargeBarTexture == DefaultChargeBarTexture)
{
Color startColor = GetCooldownStartColor(instance);
Color endColor = GetCooldownEndColor(instance);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(1 - instance.Completion);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(startColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(endColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].Apply();
}
else
{
GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].SetShaderTexture(ModContent.GetTexture(ChargeBarBackTexture));
GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].UseOpacity(opacity);
GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].UseSaturation(1 - instance.Completion);
GameShaders.Misc["CalamityMod:CircularBarSpriteShader"].Apply();
}
}
}
}
+52
View File
@@ -0,0 +1,52 @@
using System.IO;
using Terraria;
namespace CalamityMod.Cooldowns
{
public struct CooldownInstance
{
/// <summary>
/// The netID of the cooldown represented by this cooldown instance.<br/>
/// This is used to look up gameplay behavior and rendering behavior as the cooldown instance is used in the game engine.
/// </summary>
internal ushort netID;
/// <summary>
/// The player that the cooldown is applying to
/// </summary>
public Player player;
/// <summary>
/// The total, original duration of the cooldown. This value is in frames, 60 per second.
/// </summary>
public int duration;
/// <summary>
/// The remaining duration of the cooldown. This value is in frames, 60 per second.
/// </summary>
public int timeLeft;
/// <summary>
/// A ratio of how "completed" an instance of a cooldown is.
/// </summary>
public float Completion => duration != 0 ? timeLeft / (float)duration : 0;
internal void Write(BinaryWriter writer)
{
writer.Write(netID);
byte playerIDByte = (byte)player.whoAmI;
writer.Write(playerIDByte);
writer.Write(duration);
writer.Write(timeLeft);
}
internal void Read(BinaryReader reader)
{
netID = reader.ReadUInt16();
byte playerIDByte = reader.ReadByte();
player = Main.player[playerIDByte];
duration = reader.ReadInt32();
timeLeft = reader.ReadInt32();
}
}
}
@@ -1,5 +1,3 @@
using CalamityMod.CalPlayer;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -7,13 +5,13 @@ using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class CooldownRackUI
{
public static int MaxLargeIcons = 10;
public static bool CompactIcons => Main.LocalPlayer.Calamity().Cooldowns.FindAll(cooldown => cooldown.DisplayMe).Count > MaxLargeIcons || CalamityConfig.Instance.CooldownDisplay == 1;
public static bool CompactIcons => Main.LocalPlayer.Calamity().Cooldowns.FindAll(cooldown => cooldown.ShouldDisplay).Count > MaxLargeIcons || CalamityConfig.Instance.CooldownDisplay == 1;
public static Vector2 Spacing => CompactIcons ? Vector2.UnitX * Main.UIScale * 28f : Vector2.UnitX * Main.UIScale * 46f;
@@ -26,7 +24,7 @@ namespace CalamityMod.UI.CooldownIndicators
if (Main.playerInventory || CalamityConfig.Instance.CooldownDisplay < 1)
return;
List<CooldownIndicator> cooldownsToDraw = Main.LocalPlayer.Calamity().Cooldowns.FindAll(cooldown => cooldown.DisplayMe);
List<Cooldown> cooldownsToDraw = Main.LocalPlayer.Calamity().Cooldowns.FindAll(cooldown => cooldown.ShouldDisplay);
if (cooldownsToDraw.Count == 0)
return;
@@ -39,7 +37,7 @@ namespace CalamityMod.UI.CooldownIndicators
string mouseHover = "";
foreach (CooldownIndicator cd in cooldownsToDraw)
foreach (Cooldown cd in cooldownsToDraw)
{
float iconOpacity = (float)Math.Sin(Main.GlobalTime) * 0.1f + 0.6f;
@@ -48,16 +46,16 @@ namespace CalamityMod.UI.CooldownIndicators
if (iconRectangle.Intersects(mouse))
{
mouseHover = cd.Name;
mouseHover = cd.DisplayName;
iconOpacity = MathHelper.Clamp((float)Math.Sin(Main.GlobalTime % MathHelper.Pi) * 2f, 0, 1) * 0.1f + 0.9f;
}
if ((cd.UseCustomDraw && !CompactIcons) || (cd.UseCustomDrawCompact && CompactIcons))
if ((cd.UseCustomExpandedDraw && !CompactIcons) || (cd.UseCustomCompactDraw && CompactIcons))
{
if (CompactIcons)
cd.CustomDrawCompact(spriteBatch, displayPosition, iconOpacity, uiScale);
cd.DrawCompact(spriteBatch, displayPosition, iconOpacity, uiScale);
else
cd.CustomDraw(spriteBatch, displayPosition, iconOpacity, uiScale);
cd.DrawExpanded(spriteBatch, displayPosition, iconOpacity, uiScale);
}
else
@@ -75,10 +73,10 @@ namespace CalamityMod.UI.CooldownIndicators
}
public static void DrawIndividualIcon(CooldownIndicator cooldown, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
public static void DrawIndividualIcon(Cooldown cooldown, SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = ModContent.GetTexture(cooldown.Texture);
Texture2D outline = ModContent.GetTexture(cooldown.TextureOutline);
Texture2D outline = ModContent.GetTexture(cooldown.OutlineTexture);
Texture2D barBase = ModContent.GetTexture(cooldown.ChargeBarTexture);
//Draw the ring
@@ -103,7 +101,7 @@ namespace CalamityMod.UI.CooldownIndicators
//Draw the small overlay
if (CompactIcons)
{
Texture2D overlay = ModContent.GetTexture(cooldown.TextureOverlay);
Texture2D overlay = ModContent.GetTexture(cooldown.OverlayTexture);
int lostHeight = (int)Math.Ceiling(overlay.Height * (1 - cooldown.Completion));
Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight);
+59
View File
@@ -0,0 +1,59 @@
using System.Collections.Generic;
namespace CalamityMod.Cooldowns
{
public static class CooldownRegistry
{
// Indexed by ushort netID. Contains every registered cooldown.
// Cooldowns are given netIDs when they are registered.
// Cooldowns are useless until they are registered.
public static Cooldown[] registry;
private const ushort defaultSize = 256;
private static ushort nextCDNetID = 0;
private static Dictionary<string, ushort> nameToNetID = null;
public static void Load()
{
registry = new Cooldown[defaultSize];
nameToNetID = new Dictionary<string, ushort>(defaultSize);
}
public static void Unload()
{
registry = null;
nameToNetID?.Clear();
nameToNetID = null;
}
/// <summary>
/// Registers a cooldown for use in netcode. Cooldowns are useless until this has been done.
/// </summary>
/// <param name="cd"></param>
/// <returns></returns>
public static bool Register(Cooldown cd)
{
int currentMaxID = registry.Length;
// This case only happens when you cap out at 65,536 cooldown registrations (which should never occur).
// It just stops you from registering more cooldowns.
if (nextCDNetID == currentMaxID)
return false;
cd.netID = nextCDNetID;
nameToNetID[cd.ID] = cd.netID;
++nextCDNetID;
// If the end of the array is reached, double its size.
if (nextCDNetID == currentMaxID && currentMaxID < ushort.MaxValue)
{
Cooldown[] largerArray = new Cooldown[currentMaxID * 2];
for (int i = 0; i < currentMaxID; ++i)
largerArray[i] = registry[i];
registry = largerArray;
}
return true;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

+22
View File
@@ -0,0 +1,22 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class CounterScarfCooldown : Cooldown
{
public override string SyncID => "CounterScarf";
public override bool ShouldDisplay => true;
public override string DisplayName => "Scarf Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/CounterScarf";
public override Color OutlineColor => Color.Lerp(new Color(255, 115, 178), new Color(255, 76, 76), (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f);
public override Color CooldownStartColor => new Color(194, 75, 97);
public override Color CooldownEndColor => new Color(255, 76, 76);
public CounterScarfCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

+29
View File
@@ -0,0 +1,29 @@
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Cooldowns
{
public class DivineBlessCooldown : Cooldown
{
public override string SyncID => "DivineBless";
public override bool ShouldDisplay => true;
public override string DisplayName => "Divine Bless Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/DivineRecharge";
public override Color OutlineColor => new Color(233, 192, 68);
public override Color CooldownStartColor => new Color(177, 105, 33);
public override Color CooldownEndColor => new Color(233, 192, 68);
public DivineBlessCooldown(int duration, Player player) : base(duration, player)
{
}
public override void OnCompleted()
{
if (AfflictedPlayer.whoAmI == Main.myPlayer)
Projectile.NewProjectile(AfflictedPlayer.Center, Vector2.Zero, ProjectileType<AllianceTriangle>(), 0, 0f, AfflictedPlayer.whoAmI);
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 163 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 154 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 492 B

After

Width:  |  Height:  |  Size: 492 B

+22
View File
@@ -0,0 +1,22 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class DraconicElixirCooldown : Cooldown
{
public override string SyncID => "DraconicElixir";
public override bool ShouldDisplay => true;
public override string DisplayName => "Draconic Surge Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/DraconicElixir";
public override Color OutlineColor => Color.Lerp(new Color(141, 199, 90), new Color(221, 187, 106), (float)Math.Sin(Main.GlobalTime) * 0.5f + 0.5f);
public override Color CooldownStartColor => new Color(165, 22, 46);
public override Color CooldownEndColor => new Color(216, 103, 43);
public DraconicElixirCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 401 B

+21
View File
@@ -0,0 +1,21 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class EvasionScarfCooldown : Cooldown
{
public override string SyncID => "EvasionScarf";
public override bool ShouldDisplay => true;
public override string DisplayName => "Scarf Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/EvasionScarf";
public override Color OutlineColor => Color.Lerp(new Color(255, 194, 150), new Color(255, 160, 150), (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f);
public override Color CooldownStartColor => new Color(132, 23, 32);
public override Color CooldownEndColor => new Color(164, 52, 45);
public EvasionScarfCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

@@ -1,27 +1,17 @@
using CalamityMod.DataStructures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class FleshTotemCooldown : CooldownIndicator
public class FleshTotemCooldown : Cooldown
{
public override string SyncID => "FleshTotem";
public override bool DisplayMe => true;
public override string Name => "Contact Damage Halving Cooldown";
public override bool ShouldDisplay => true;
public override string DisplayName => "Contact Damage Halving Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture;
public override Color OutlineColor => outlineColor;
public override Color CooldownColorStart => cooldownColorStart;
public override Color CooldownColorEnd => cooldownColorEnd;
public override Color CooldownStartColor => cooldownColorStart;
public override Color CooldownEndColor => cooldownColorEnd;
//It's the same cooldown with different skins each time, basically.
public string skinTexture;
File renamed without changes.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 349 B

@@ -1,27 +1,17 @@
using CalamityMod.DataStructures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class GlobalDodgeCooldown : CooldownIndicator
public class GlobalDodgeCooldown : Cooldown
{
public override string SyncID => "GlobalDodge";
public override bool DisplayMe => true;
public override string Name => "Dodge Cooldown";
public override bool ShouldDisplay => true;
public override string DisplayName => "Dodge Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture;
public override Color OutlineColor => outlineColor;
public override Color CooldownColorStart => cooldownColorStart;
public override Color CooldownColorEnd => cooldownColorEnd;
public override Color CooldownStartColor => cooldownColorStart;
public override Color CooldownEndColor => cooldownColorEnd;
//It's the same cooldown with different skins each time, basically.
public string skinTexture;
File renamed without changes.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

+21
View File
@@ -0,0 +1,21 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class GodslayerDashCooldown : Cooldown
{
public override string SyncID => "GodslayerDash";
public override bool ShouldDisplay => true;
public override string DisplayName => "Godslayer Dash Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/GodslayerDash";
public override Color OutlineColor => Color.Lerp(new Color(173, 66, 203), new Color(252, 109, 202), Completion);
public override Color CooldownStartColor => new Color(252, 109, 202);
public override Color CooldownEndColor => new Color(119, 254, 254);
public GodslayerDashCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 453 B

After

Width:  |  Height:  |  Size: 453 B

+21
View File
@@ -0,0 +1,21 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class InkBombCooldown : Cooldown
{
public override string SyncID => "InkBomb";
public override bool ShouldDisplay => true;
public override string DisplayName => "Ink Bomb Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/InkBomb";
public override Color OutlineColor => new Color(205, 182, 137);
public override Color CooldownStartColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), Completion);
public override Color CooldownEndColor => Color.Lerp(new Color(177, 147, 89), new Color(105, 103, 126), Completion);
public InkBombCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

@@ -1,26 +1,17 @@
using CalamityMod.DataStructures;
using CalamityMod.Cooldowns;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using CalamityMod.CalPlayer;
namespace CalamityMod.UI.CooldownIndicators
namespace CalamityMod.Cooldowns
{
public class JetpackCooldown : CooldownIndicator
public class JetpackCooldown : Cooldown
{
public override bool DisplayMe => true;
public override string Name => "Jet Boost Cooldown";
public override bool ShouldDisplay => true;
public override string DisplayName => "Jet Boost Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/" + skinTexture;
public override Color OutlineColor => outlineColor;
public override Color CooldownColorStart => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownColorEnd => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - Completion);
//It's the same cooldown with different skins each time, basically.
public string skinTexture;
File renamed without changes.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 172 B

+20
View File
@@ -0,0 +1,20 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class LionHeartShieldCooldown : Cooldown
{
public override string SyncID => "LionHeartShield";
public override bool ShouldDisplay => true;
public override string DisplayName => "Energy Shell Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/LionHeartShield";
public override Color OutlineColor => new Color(232, 239, 239);
public override Color CooldownStartColor => new Color(17, 242, 244);
public override Color CooldownEndColor => Color.White;
public LionHeartShieldCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

+19
View File
@@ -0,0 +1,19 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class NebulousCoreCooldown : Cooldown
{
public override bool ShouldDisplay => true;
public override string DisplayName => "Nebulous Core Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/NebulousCore";
public override Color OutlineColor => Color.Lerp(new Color(252, 109, 203), new Color(58, 91, 146), Completion);
public override Color CooldownStartColor => new Color(148, 62, 216);
public override Color CooldownEndColor => new Color(255, 187, 207);
public NebulousCoreCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

+20
View File
@@ -0,0 +1,20 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Cooldowns
{
public class PermafrostConcoctionCooldown : Cooldown
{
public override string SyncID => "ConcoctionCooldown";
public override bool ShouldDisplay => true;
public override string DisplayName => "Permafrost's Concoction Cooldown";
public override string Texture => "CalamityMod/UI/CooldownIndicators/PermafrostConcoction";
public override Color OutlineColor => new Color(0, 218, 255);
public override Color CooldownStartColor => new Color(144, 184, 205);
public override Color CooldownEndColor => new Color(232, 246, 254);
public PermafrostConcoctionCooldown(int duration, Player player) : base(duration, player)
{
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 349 B

Loaded 100 of 170 files, more files were not shown because too many files have changed in this diff. Show more