diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index ba20aefe40..66f26cdea1 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -3,7 +3,6 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; -using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index 32c4224576..960f716168 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -30,11 +30,6 @@ namespace CalamityMod.Buffs.DamageOverTime { owner = p.owner; projectileCount++; - if (projectileCount >= 5) - { - projectileCount = 5; - break; - } } } diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index 6b893d8bc9..885ef41cf5 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Buffs.DamageOverTime Projectile tick = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), bleedTickDamage, 0f, applicator.whoAmI, target.whoAmI); tick.DamageType = DamageClass.Ranged; // Uncommon for DirectStrikes, but it needs to be able to crit. + tick.CritChance = (int)applicator.GetTotalCritChance(DamageClass.Ranged); // All ticks of Shred have a 3x base crit multiplier and have supercrits enabled. CalamityGlobalProjectile cgp = tick.Calamity(); diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index 2145aba8db..62fe6749ab 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -8,7 +8,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 47068b9b71..ebc6f14169 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,12 +1,10 @@ using CalamityMod.DataStructures; -using CalamityMod.NPCs; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 2ce9745729..a0b2a92520 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -8,7 +8,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 7cafbbd2d4..7229f2502f 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -1,10 +1,8 @@ using CalamityMod.DataStructures; -using CalamityMod.NPCs; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index e7b836d7ee..0ddfe27068 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -5,8 +5,6 @@ namespace CalamityMod.Buffs.StatDebuffs { public class MarkedforDeath : ModBuff { - public static int DefenseReduction = 5; - public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1753a94b89..76776fb73e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -327,6 +327,7 @@ namespace CalamityMod.CalPlayer public int arsenalCooldown = 0; public int killModeCooldown = 0; public bool demonSwordKillMode = false; + public int oblivionCooldown = 0; public bool exaltedKillMode => (demonSwordKillMode && Player.HeldItem.type == ItemType()); public bool devilsDevastationKillMode => (demonSwordKillMode && Player.HeldItem.type == ItemType()); /// diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 384e65a136..bfab622c1c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2333,6 +2333,8 @@ namespace CalamityMod.CalPlayer arsenalCooldown--; if (killModeCooldown > 0) killModeCooldown--; + if (oblivionCooldown > 0) + oblivionCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; if (transformerCooldown > 0) diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 7e5079007d..8ed529182e 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; @@ -32,6 +34,14 @@ namespace CalamityMod public static ModKeybind[] AccessoryKeybinds = []; + public static List RentedKeybinds = []; + /// + /// We store the keybind then move it to the main list at the end of the frame + /// This ensures that between frames has keybinds in the values needed for drawing + /// This does means there's a 1 frame delay when switching slots for item tooltips to update, but that's never important + /// + public static List KeybindRentalQueue = []; + public override void Load() { // Register keybinds @@ -87,6 +97,24 @@ namespace CalamityMod AccessoryKeybinds = null; } + public override void PostUpdateEverything() + { + RentedKeybinds = KeybindRentalQueue.ToList(); + KeybindRentalQueue.Clear(); + } + } + + public class AccessoryKeybindManager : GlobalItem + { + public override bool InstancePerEntity => true; + + internal int KeybindId { get; set; } + + public override void UpdateEquip(Item item, Player player) + { + if (CalamityItemSets.HasAccessoryKeybind[item.type]) + CalamityKeybinds.KeybindRentalQueue.Add(item.type); + } } public static class CalamityKeybindsExtensions @@ -104,20 +132,16 @@ namespace CalamityMod return CalamityKeybinds.HeldItem.JustPressed; if (!CalamityItemSets.HasAccessoryKeybind[item.type]) - throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); - int keybindToUse = 0; - - for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) { - if (Main.LocalPlayer.armor[i].type == item.type) - break; - if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) - keybindToUse++; + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].JustPressed; } - if (keybindToUse > 6) - return false; - return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustPressed; + + return false; } /// @@ -134,21 +158,16 @@ namespace CalamityMod return CalamityKeybinds.HeldItem.JustReleased; if (!CalamityItemSets.HasAccessoryKeybind[item.type]) - throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); - int keybindToUse = 0; - - for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) { - if (Main.LocalPlayer.armor[i].type == item.type) - break; - if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) - keybindToUse++; + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].JustReleased; } - if (keybindToUse > 6) - return false; - return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustReleased; + return false; } @@ -165,21 +184,16 @@ namespace CalamityMod return CalamityKeybinds.HeldItem.Current; if (!CalamityItemSets.HasAccessoryKeybind[item.type]) - throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); - int keybindToUse = 0; - - for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) { - if (Main.LocalPlayer.armor[i].type == item.type) - break; - if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) - keybindToUse++; + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].Current; } - if (keybindToUse > 6) - return false; - return CalamityKeybinds.AccessoryKeybinds[keybindToUse].Current; + return false; } @@ -196,30 +210,20 @@ namespace CalamityMod if (!CalamityItemSets.HasAccessoryKeybind[item.type]) return CalamityKeybinds.HeldItem; - if (!Main.LocalPlayer.armor.Any(x => x.type == item.type)) - return null; - - int keybindToUse = 0; - - for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) { - if (Main.LocalPlayer.armor[i].type == item.type) - break; - if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) - keybindToUse++; + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index]; } - - if (keybindToUse > 6) - return null; - - return CalamityKeybinds.AccessoryKeybinds[keybindToUse]; + return null; } - + public static bool HasBoundDynamicHotkey(this Item item) { var h = item.GetDynamicModHotkey(); if (h == null) return false; - if (h?.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count() == 0) + if (h?.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count == 0) return false; return true; } diff --git a/ChatTags/CustomColorEffectHandler.cs b/ChatTags/CustomColorEffectHandler.cs index b99db87773..03cda39a56 100644 --- a/ChatTags/CustomColorEffectHandler.cs +++ b/ChatTags/CustomColorEffectHandler.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items.Accessories.Wings; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Rarities; using CalamityMod.Utilities.Daybreak; @@ -35,6 +36,8 @@ namespace CalamityMod.ChatTags return new CalamityRed.CustomTextSnippet(text); if (options.Equals("exo", StringComparison.OrdinalIgnoreCase)) return new ExoticRainbow.CustomTextSnippet(text); + if (options.Equals("doze", StringComparison.OrdinalIgnoreCase)) + return new TiredTailTextEffects(text); return new TextSnippet(text); } } diff --git a/Cooldowns/OblivionCooldown.cs b/Cooldowns/OblivionCooldown.cs new file mode 100644 index 0000000000..2e87ddcbb4 --- /dev/null +++ b/Cooldowns/OblivionCooldown.cs @@ -0,0 +1,17 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class OblivionCooldown : CooldownHandler + { + public static new string ID => "OblivionCooldown"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Projectiles/Melee/Yoyos/OblivionYoyo"; + public override string OutlineTexture => "CalamityMod/Cooldowns/OblivionCooldownOutline"; + public override Color OutlineColor => Color.MediumVioletRed; + public override Color CooldownStartColor => Color.DarkRed; + public override Color CooldownEndColor => Color.Red; + } +} diff --git a/Cooldowns/OblivionCooldownOutline.png b/Cooldowns/OblivionCooldownOutline.png new file mode 100644 index 0000000000..edc4369894 Binary files /dev/null and b/Cooldowns/OblivionCooldownOutline.png differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index e9ff7b8999..6bacb6fc1e 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -266,6 +266,9 @@ namespace CalamityMod.Effects // The swirling aura effect seen around Horrible Hog while its idling. internal static Asset HorribleHogAuraShader; + + // The shader effect for the primitive trails drawn for Providence's HolyBurnOrb/HolyLight projectiles. + internal static Asset ProvidenceHolyOrbTrailShader; #endregion #region Big E's Shaders @@ -273,6 +276,7 @@ namespace CalamityMod.Effects internal static Asset SeaPrismColorBlendingShader; internal static Asset Dissolve; + internal static Asset PaletteSwap; internal static Asset BrainOfCthulhuForcefield; #endregion @@ -537,6 +541,9 @@ namespace CalamityMod.Effects HorribleHogAuraShader = LoadShader("HorribleHogAuraShader"); RegisterMiscShader(HorribleHogAuraShader, "ScaryAuraPass", "HorribleHogAura"); + + ProvidenceHolyOrbTrailShader = LoadShader("ProvidenceHolyOrbTrailShader"); + RegisterMiscShader(ProvidenceHolyOrbTrailShader, "TrailPass", "ProvidenceHolyOrbTrail"); #endregion #region Loading Big E's Shaders @@ -549,6 +556,9 @@ namespace CalamityMod.Effects Dissolve = LoadShader("Dissolve"); RegisterMiscShader(Dissolve, "DissolvePass", "Dissolve"); + PaletteSwap = LoadShader("PaletteSwap"); + RegisterMiscShader(PaletteSwap, "PaletteSwapPass", "PaletteSwap"); + BrainOfCthulhuForcefield = LoadShader("ScreenShaders/BrainOfCthulhuForcefield"); RegisterScreenShader(BrainOfCthulhuForcefield, "BoCShieldPass", "BrainOfCthulhuForcefield"); #endregion diff --git a/Effects/PaletteSwap.fx b/Effects/PaletteSwap.fx new file mode 100644 index 0000000000..2de436b8cd --- /dev/null +++ b/Effects/PaletteSwap.fx @@ -0,0 +1,35 @@ +sampler baseTexture : register(s0); + +float4 sourcePalette[16]; +float4 targetPalette[16]; +float matchThreshold = 0.01; +int paletteSize; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR +{ + float4 color = tex2D(baseTexture, coords) * sampleColor; + + // Check each color in the source palette + for (int i = 0; i < paletteSize; i++) + { + float3 diff = color.rgb - sourcePalette[i].rgb; + float distance = sqrt(dot(diff, diff)); + + // If color is close enough to this palette color, swap it + if (distance <= matchThreshold) + { + color.rgb = targetPalette[i].rgb; + break; // Stop checking once we find a match + } + } + + return color; +} + +technique Technique1 +{ + pass PaletteSwapPass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/PaletteSwap.xnb b/Effects/PaletteSwap.xnb new file mode 100644 index 0000000000..742449fa6d Binary files /dev/null and b/Effects/PaletteSwap.xnb differ diff --git a/Effects/ProvidenceHolyOrbTrailShader.fx b/Effects/ProvidenceHolyOrbTrailShader.fx new file mode 100644 index 0000000000..9f5c67d241 --- /dev/null +++ b/Effects/ProvidenceHolyOrbTrailShader.fx @@ -0,0 +1,68 @@ +// 29JUN2026: fryzahh +// Programmed to work under the use of SanePrimitiveRenderer. +// Never use this shader with PrimitveRenderer. + +sampler baseStreakTexture : register(s0); +sampler distortionTexture : register(s1); + +matrix uTransformMatrix; +float time; +float glowPower; +float pixelationFactor; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output; + output.Position = mul(input.Position, uTransformMatrix); + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Fade out at the horizontal and vertical ends of the streak. + float horizonatalDistanceFromCenter = distance(0.5, coords.y); + float opacity = smoothstep(0.5, 0.5 - 0.486, horizonatalDistanceFromCenter); + + // Glow from the center go out. + float glow = pow(0.1 / horizonatalDistanceFromCenter, glowPower); + + float2 distortionCoords = coords + float2(time * -3.12, 0); + distortionCoords *= float2(0.25, 1); + float distortion = tex2D(distortionTexture, distortionCoords).r * 0.43; + + float2 streakCoords = coords + float2(time * -2.34, 0); + streakCoords *= float2(1.25, 1); + float4 streakMapColor = tex2D(baseStreakTexture, streakCoords + distortion); + + float4 returnColor = (streakMapColor * color * glow) * opacity; + returnColor = round(returnColor * 7) / 7; + return returnColor; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/ProvidenceHolyOrbTrailShader.xnb b/Effects/ProvidenceHolyOrbTrailShader.xnb new file mode 100644 index 0000000000..dda2ab7acc Binary files /dev/null and b/Effects/ProvidenceHolyOrbTrailShader.xnb differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index ce412a01e9..48cbda15d3 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -586,12 +586,14 @@ namespace CalamityMod.Events // Cooldown and boss spawn. if (BossRushSpawnCountdown <= 0 && BossRushStage < Bosses.Count) { - // Cooldown before next boss spawns. + // Cooldown before next boss spawns. Defaults to 1 second. BossRushSpawnCountdown = 60; - // Increase cooldown post-Moon Lord. + // Cooldown increases to 3 seconds in tier 4 and 4 seconds in tier 5. if (BossRushStage >= Bosses.FindIndex(boss => boss.EntityID == NPCID.MoonLordCore)) - BossRushSpawnCountdown += 180; + BossRushSpawnCountdown += 120; + if (BossRushStage >= Bosses.FindIndex(boss => boss.EntityID == ModContent.NPCType())) + BossRushSpawnCountdown += 60; // Override the spawn countdown if specified. if (BossRushStage < Bosses.Count - 1 && Bosses[BossRushStage + 1].SpecialSpawnCountdown != -1) @@ -691,6 +693,18 @@ namespace CalamityMod.Events } } + // Both Twins must be killed to progress. + else if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + { + int bossType = npc.type == NPCID.Spazmatism ? NPCID.Retinazer : NPCID.Spazmatism; + if (!NPC.AnyNPCs(bossType)) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + HostileProjectileKillCounter = 3; + } + } + // Anahita and Leviathan manually check for each other (this probably isn't necessary). else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 67b5ec5794..d57155929a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -63,6 +63,7 @@ namespace CalamityMod.ILEditing // Mechanics / features On_NPC.ApplyTileCollision += AllowFusionFeederToDigThroughSand; + On_NPC.RerollVariation += AllowPatronNameRerollsOnLicenseUse; IL_Player.ApplyEquipFunctional += ScopesRequireVisibilityToZoom; IL_Player.Hurt_PlayerDeathReason_int_int_refHurtInfo_bool_bool_int_bool_float_float_float += DodgeMechanicAdjustments; On_Player.PutHallowedArmorSetBonusOnCooldown += AddHolyProtectionCooldown; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 754ead76f4..f621447cce 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -30,6 +30,7 @@ using CalamityMod.Tiles; using CalamityMod.Utilities.Daybreak; using CalamityMod.Walls; using CalamityMod.Walls.UnsafeWalls; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; @@ -326,6 +327,27 @@ namespace CalamityMod.ILEditing } #endregion + #region Allow Patron Name Rerolls on License Use + private static bool AllowPatronNameRerollsOnLicenseUse(On_NPC.orig_RerollVariation orig, NPC self) + { + bool success = orig(self); + if (success) + { + if (self.type == NPCID.TownBunny) + CalamityWorld.bunnyName = false; + if (self.type == NPCID.TownCat) + CalamityWorld.catName = false; + if (self.type == NPCID.TownDog) + CalamityWorld.dogName = false; + + if (!self.TryGetGlobalNPC(out var calGlobalTownNPC)) + return success; + calGlobalTownNPC.setNewName = true; + } + return success; + } + #endregion + #region Prevent Diabolists from Dropping Stuff in GFB Before Plantera private static void PreventDiabolistLootLogic(On_NPC.orig_NPCLoot orig, NPC self) { @@ -1118,19 +1140,92 @@ namespace CalamityMod.ILEditing { // If an Abyss wall is detected, try to find another teleportation location bool canSpawn = false; - int teleportStartX = 100; + int halfWorldWidth = Main.maxTilesX / 2; + + int teleportStartX = Abyss.AtLeftSideOfWorld ? halfWorldWidth - (halfWorldWidth - 175) + 35 : halfWorldWidth + (halfWorldWidth - 175) - 35; int teleportRangeX = Main.maxTilesX - 200; int teleportStartY = 100; - int underworldLayer = Main.UnderworldLayer; - Vector2 newerPos = self.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, underworldLayer, new Player.RandomTeleportationAttemptSettings + int teleportRangeY = Main.UnderworldLayer; + + int attempts = 0; + int maxAttempts = 1000; + int teleportPositionX = 0; + int teleportPositionY = 0; + Vector2 teleportPosition = new Vector2(teleportPositionX, teleportPositionY) * 16f - new Vector2(self.width * 0.5f + 8, self.height); + while (!canSpawn && attempts < maxAttempts) { - avoidLava = true, - avoidHurtTiles = true, - maximumFallDistanceFromOrignalPoint = 100, - attemptsBeforeGivingUp = 1000 - }); + attempts++; + + if (Abyss.AtLeftSideOfWorld) + teleportPositionX = teleportStartX + Main.rand.Next(teleportRangeX); + else + teleportPositionX = teleportStartX - Main.rand.Next(teleportRangeX); + teleportPositionY = teleportStartY + Main.rand.Next(teleportRangeY); + + teleportPositionX = MathHelper.Clamp(teleportPositionX, 5, Main.maxTilesX - 5); + teleportPositionY = MathHelper.Clamp(teleportPositionY, 5, Main.maxTilesY - 5); + teleportPosition = new Vector2(teleportPositionX, teleportPositionY) * 16f - new Vector2(self.width * 0.5f + 8, self.height); + + if (Collision.SolidCollision(teleportPosition, self.width, self.height)) + continue; + + Tile tile = Framing.GetTileSafely(new Point(teleportPositionX, teleportPositionY)); + bool behindTempleWalls = tile.WallType == WallID.LihzahrdBrickUnsafe && teleportPositionY > Main.worldSurface && !NPC.downedPlantBoss; + bool behindDungeonWalls = Main.wallDungeon[tile.WallType] && teleportPositionY > Main.worldSurface && !NPC.downedBoss3; + if (behindTempleWalls || behindDungeonWalls) + continue; + + int distanceToGround = 0; + int maxFallDistance = 100; + while (distanceToGround < maxFallDistance) + { + Tile groundTile = Framing.GetTileSafely(new Point(teleportPositionX, teleportPositionY + distanceToGround)); + teleportPosition = new Vector2(teleportPositionX, teleportPositionY + distanceToGround) * 16f - new Vector2(self.width * 0.5f + 8, self.height); + Collision.SlopeCollision(teleportPosition, self.velocity, self.width, self.height, self.gravDir); + if (!Collision.SolidCollision(teleportPosition, self.width, self.height)) + { + distanceToGround++; + continue; + } + + if (groundTile.HasUnactuatedTile && Main.tileSolid[groundTile.TileType]) + break; + + distanceToGround++; + } + + teleportPosition.Y -= 16f; + bool inLava = Collision.LavaCollision(teleportPosition, self.width, self.height); + bool onHurtingTile = Collision.AnyHurtingTiles(teleportPosition, self.width, self.height); + bool insideBlocks = Collision.SolidCollision(teleportPosition, self.width, self.height); + bool reachedMaxFallDistance = distanceToGround >= maxFallDistance; + if (inLava || onHurtingTile || insideBlocks || reachedMaxFallDistance) + continue; + + Vector2 checkDirection = Vector2.UnitX * 16f; + if (Collision.TileCollision(teleportPosition - checkDirection, checkDirection, self.width, self.height, false, false, (int)self.gravDir) != checkDirection) + continue; + + checkDirection = Vector2.UnitX * -16f; + if (Collision.TileCollision(teleportPosition - checkDirection, checkDirection, self.width, self.height, false, false, (int)self.gravDir) != checkDirection) + continue; + + checkDirection = Vector2.UnitY * 16f; + if (Collision.TileCollision(teleportPosition - checkDirection, checkDirection, self.width, self.height, false, false, (int)self.gravDir) == checkDirection) + { + checkDirection = Vector2.UnitY * -16f; + if (Collision.TileCollision(teleportPosition - checkDirection, checkDirection, self.width, self.height, false, false, (int)self.gravDir) == checkDirection) + { + canSpawn = true; + teleportPositionY += distanceToGround; + teleportPosition = new Vector2(teleportPositionX, teleportPositionY) * 16f - new Vector2(self.width * 0.5f + 8, self.height); + break; + } + } + } + // Attempt teleporting again with the new location - orig(self, newerPos, Style, extraInfo); + orig(self, teleportPosition, Style, extraInfo); } else { diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index 4d26811f71..054a6893af 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -64,5 +65,7 @@ namespace CalamityMod.Items.Accessories AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly / 2f % 1f, [ new Color(255, 196, 55), new Color(255, 231, 107), new Color(255, 254, 243) ]); } } diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index d934e91c64..d8054bf039 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -68,8 +68,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 58; Item.height = 60; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 2d446d05c8..89a8f45dd3 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -637,5 +637,7 @@ namespace CalamityMod.Items.Accessories AddDecraftCondition(CalamityConditions.DownedSupremeCalamitas, CalamityConditions.DownedExoMechs). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh) } } diff --git a/Items/Accessories/Wings/TiredTail.cs b/Items/Accessories/Wings/TiredTail.cs new file mode 100644 index 0000000000..2620f80d32 --- /dev/null +++ b/Items/Accessories/Wings/TiredTail.cs @@ -0,0 +1,484 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Armor.Auric; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.Items.Armor.Empyrean; +using CalamityMod.Items.Armor.Fearmonger; +using CalamityMod.Items.Armor.GemTech; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Hydrothermic; +using CalamityMod.Items.Armor.OmegaBlue; +using CalamityMod.Items.Armor.Prismatic; +using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories.Wings +{ + // The equip sprite is actually blank as a custom draw layer is used to draw the real sprites without any base sprites conflicting + + [AutoloadEquip(EquipType.Wings)] + public class TiredTail : BaseWings + { + public override float BonusAscentWhileFalling => 0.95f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 4.5f; + public override float BaseAscent => 0.1f; + + float BoostPower => 3f; + + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(210, 8.5f, 2.88f, true, 16, 10f); + } + + public override void SetDefaults() + { + base.SetDefaults(); + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().devItem = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + player.GetModPlayer().tiredTailDraw = true; + if (player.velocity.Y != 0) + { + if (player.dashDelay != -1) //This differs from Starboard - Starboard checks for 1 full second passing after a dash begun, while this happens as soon as the dash ends + player.runSlowdown *= 6; + } + + + } + + public override void UpdateVanity(Player player) + { + player.GetModPlayer().tiredTailDraw = true; + } + + public override bool WingUpdate(Player player, bool inUse) => true; + + public override void AdditionalFlightMovement(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + if (player.TryingToHoverDown && player.controlJump && player.wingTime > 0f && !player.merman) + { + player.wingTime += 0.5f; + player.velocity.Y *= 0.8f; + if (player.velocity.Y > -2f && player.velocity.Y < 1f) + player.velocity.Y = 1E-05f; + + ascentWhenFalling *= 0f; + ascentWhenRising *= 0f; + constantAscend *= 0f; + } + if (player.TryingToHoverUp) + { + ascentWhenFalling *= BoostPower; + ascentWhenRising *= BoostPower; + maxCanAscendMultiplier /= 1.5f; + maxAscentMultiplier /= 1.5f; + constantAscend *= BoostPower; + player.wingTime -= 1; + } + } + + public override void AddRecipes() + { + + CreateRecipe(). + AddIngredient(3). + AddIngredient(ItemID.Sapphire). + AddTile(TileID.DemonAltar). + Register(); + } + } + + public class TiredTailPlayer : ModPlayer + { + public bool tiredTailDraw = false; + public List<(Vector2 pos, float rot)> tailPos; + public override void ResetEffects() + { + //Handled here to prevent issues with instancing of chat tags + if (TiredTailTextEffects.displayTimer > 0) + { + TiredTailTextEffects.expansionFactor += 0.033f; + + TiredTailTextEffects.displayTimer -= 1; + } + else + { + TiredTailTextEffects.expansionFactor = 0f; + } + + tiredTailDraw = false; + } + public override void PostUpdate() + { + if (tiredTailDraw) + { + if (tailPos == null) + { + tailPos = new(); + for (var i = 0; i < 3; i++) + { + + tailPos.Add(new(Player.Center, 0)); + } + } + for (var i = 0; i < tailPos.Count; i++) + { + Vector2 nextCent = Vector2.Zero; + float nextRot = 0; + if (i == 0) + { + nextCent = Player.Center + new Vector2(0, 6); + nextRot = new Vector2(Player.direction, -0.325f).ToRotation(); + } + else + { + nextCent = tailPos[i - 1].Item1; + nextRot = tailPos[i - 1].Item2; + } + + Vector2 destinationOffset = nextCent - tailPos[i].Item1; + if (nextRot != tailPos[i].Item2) + { + float angle = MathHelper.WrapAngle(nextRot - tailPos[i].Item2); + destinationOffset = destinationOffset.RotatedBy(angle * 0.1f); + } + var rotation = destinationOffset.ToRotation(); + + var center = nextCent - destinationOffset.SafeNormalize(Vector2.Zero) * (14 * 1); + if (i == tailPos.Count - 1) + { + center = nextCent - destinationOffset.SafeNormalize(Vector2.Zero) * (21 * 1); + } + tailPos[i] = new(center, rotation); + } + } + else + { + tailPos = null; + } + } + } + public class TailDraw : PlayerDrawLayer + { + List ColorPallettes = new(); + public override void SetStaticDefaults() + { + if (Main.netMode != NetmodeID.Server) + Main.QueueMainThreadAction(() => + { + //Load palettes automatically + var texture = ModContent.Request("CalamityMod/Items/Accessories/Wings/TiredTailPallette", ReLogic.Content.AssetRequestMode.ImmediateLoad).Value; + var BaseArray = new Color[texture.Width * texture.Height]; + texture.GetData(BaseArray); + List pal = new(); + for (var i = 0; i < BaseArray.Length; i++) + { + if (i % texture.Width == 0) + { + if (pal.Count > 0) + ColorPallettes.Add(pal.ToArray()); + pal = new(); + } + pal.Add(BaseArray[i].ToVector4()); + } + ColorPallettes.Add(pal.ToArray()); + ArmorPallettes = + [ + //silva + ([ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[2]), + //god slayer + ([ItemType(),ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[3]), + //hydro + ([ItemType(),ItemType(),ItemType(),ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[4]), + //auric + ([ItemType(),ItemType(),ItemType(),ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[5]), + //fearmonger + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[6]), + //Bloodlfare + ([ItemType(),ItemType(),ItemType(),ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[7]), + //Tarragon + ([ItemType(),ItemType(),ItemType(),ItemType(),ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[8]), + //Omega Blue + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[9]), + //Gem Tech + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[10]), + //Demonshade + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[11]), + //Prismatic + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[12]), + //Empyrean + ([ItemType()], + [ItemType()], + [ItemType()], + ColorPallettes[13]), + //Solar + ([ItemID.SolarFlareHelmet], + [ItemID.SolarFlareBreastplate], + [ItemID.SolarFlareLeggings], + ColorPallettes[14]), + //Vortex + ([ItemID.VortexHelmet], + [ItemID.VortexBreastplate], + [ItemID.VortexLeggings], + ColorPallettes[15]), + //Nebula + ([ItemID.NebulaHelmet], + [ItemID.NebulaBreastplate], + [ItemID.NebulaLeggings], + ColorPallettes[16]), + //Stardust + ([ItemID.StardustHelmet], + [ItemID.StardustBreastplate], + [ItemID.StardustLeggings], + ColorPallettes[17]), + ]; + }); + + } + + List<(List heads, List bodies, List legs, Vector4[] pallette)> ArmorPallettes = []; + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => true; + + public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Wings); + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + var player = drawInfo.drawPlayer; + var modplayer = drawInfo.drawPlayer.GetModPlayer(); + var tex1 = Request("CalamityMod/Items/Accessories/Wings/TiredTailSegment").Value; + var tex2 = Request("CalamityMod/Items/Accessories/Wings/TiredTailTail").Value; + if (modplayer.tailPos != null) + { + var TargetPallette = ColorPallettes[1]; + foreach (var item in ArmorPallettes) + { + if ((item.heads.Count == 0 || item.heads.Any(x => ContentSamples.ItemsByType[x].headSlot == player.head)) + && (item.bodies.Count == 0 || item.bodies.Any(x => ContentSamples.ItemsByType[x].bodySlot == player.body)) + && (item.legs.Count == 0 || item.legs.Any(x => ContentSamples.ItemsByType[x].legSlot == player.legs))) + { + TargetPallette = item.pallette; + break; + } + } + //manual override for Empyrean's transform to work + if (player.Calamity().meldTransformationPower || player.Calamity().meldTransformationForce) + { + TargetPallette = ArmorPallettes.First(x => x.heads.Contains(ItemType())).pallette; + } + using var SegmentLease = RenderTargetPool.Shared.Rent(Main.instance.GraphicsDevice, tex1.Width, tex1.Height); + using var TailLease = RenderTargetPool.Shared.Rent(Main.instance.GraphicsDevice, tex2.Width, tex2.Height); + using (Main.spriteBatch.Scope()) + { + using (SegmentLease.Scope(clearColor: Color.Transparent)) + { + var shaderSnap = new SpriteBatchSnapshot(); + shaderSnap.SortMode = SpriteSortMode.Immediate; + shaderSnap.SamplerState = SamplerState.PointClamp; + shaderSnap.TransformMatrix = Matrix.identity; + Main.spriteBatch.Begin(shaderSnap); + + MiscShaderData paletteSwap = GameShaders.Misc["CalamityMod:PaletteSwap"]; + paletteSwap.Shader.Parameters["sourcePalette"].SetValue(ColorPallettes[0]); + paletteSwap.Shader.Parameters["paletteSize"].SetValue(ColorPallettes[0].Length); + paletteSwap.Shader.Parameters["targetPalette"].SetValue(TargetPallette); + paletteSwap.Shader.Parameters["matchThreshold"].SetValue(0.0001f); + paletteSwap.Apply(); + Main.spriteBatch.Draw(tex1, Vector2.Zero, Color.White); + Main.spriteBatch.End(); + } + using (TailLease.Scope(clearColor: Color.Transparent)) + { + var shaderSnap = new SpriteBatchSnapshot(); + shaderSnap.SortMode = SpriteSortMode.Immediate; + shaderSnap.SamplerState = SamplerState.PointClamp; + shaderSnap.TransformMatrix = Matrix.identity; + Main.spriteBatch.Begin(shaderSnap); + + MiscShaderData paletteSwap = GameShaders.Misc["CalamityMod:PaletteSwap"]; + paletteSwap.Shader.Parameters["sourcePalette"].SetValue(ColorPallettes[0]); + paletteSwap.Shader.Parameters["paletteSize"].SetValue(ColorPallettes[0].Length); + paletteSwap.Shader.Parameters["targetPalette"].SetValue(TargetPallette); + paletteSwap.Shader.Parameters["matchThreshold"].SetValue(0.01f); + paletteSwap.Apply(); + Main.spriteBatch.Draw(tex2, Vector2.Zero, Color.White); + Main.spriteBatch.End(); + } + } + var calamityPlayer = drawInfo.drawPlayer.Calamity(); + //Copied from the rogue steallth visuals + // TODO -- rogue stealth visuals are an utter catastrophe and should be fully destroyed on next stealth rework + float r = 1; + float g = 1; + float b = 1; + float a = 1; + if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && drawInfo.drawPlayer.townNPCs < 3f && CalamityClientConfig.Instance.StealthInvisibility) + { + // A translucent orchid color, the rogue class color + float colorValue = calamityPlayer.rogueStealth / calamityPlayer.rogueStealthMax * 0.9f; //0 to 0.9 + r = 1f - (colorValue * 0.89f); //255 to 50 + g = 1f - colorValue; //255 to 25 + b = 1f - (colorValue * 0.89f); //255 to 50 + a = 1f - colorValue; //255 to 25 + } + + for (var i = modplayer.tailPos.Count - 1; i >= 0; i--) + { + var color2 = Lighting.GetColor(modplayer.tailPos[i].pos.ToTileCoordinates()); + var color = new Color((int)(color2.R * r), (int)(color2.G * g), (int)(color2.B * b), (int)(color2.A * a)); + if (i == modplayer.tailPos.Count - 1) + { + drawInfo.DrawDataCache.Add(new(TailLease.Target, modplayer.tailPos[i].pos - Main.screenPosition, null, color, modplayer.tailPos[i].rot + (float)Math.PI, tex2.Size() / 2f, 1f, SpriteEffects.None, 0)); + } + else + { + drawInfo.DrawDataCache.Add(new(SegmentLease.Target, modplayer.tailPos[i].pos - Main.screenPosition, null, color, modplayer.tailPos[i].rot + (float)Math.PI, tex1.Size() / 2f, 1f, SpriteEffects.None, 0)); + } + } + } + + } + } + + public sealed class TiredTailTextEffects(string text) : TextSnippet + { + //Handled by TiredTailPlayer as this effect is for TiredTail + public static float expansionFactor = 0; + public static int displayTimer = 0; + public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1) + { + //size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale); + + if (color == default || color == Main.MouseTextColorReal) + { + color = Colors.AlphaDarken(HotPink.TextColor); + } + var textarray = text.ToArray(); + for (var i = 0; i < textarray.Length; i++) + { + if (expansionFactor - 10 > i) + { + textarray[i] = (i == 0 ? 'ɔ' : '»'); + } + } + var textToDraw = new string(textarray); + + size = FontAssets.MouseText.Value.MeasureString(textToDraw) * scale; + + if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0)) + { + var pos = position; + using var lease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); + string txt = ""; + var matrix = spriteBatch.transformMatrix; + using (spriteBatch.Scope()) + { + using (lease.Scope(clearColor: Color.Transparent)) + { + var max = FontAssets.MouseText.Value.MeasureString(text) * Math.Min(1f, expansionFactor); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, matrix); + + foreach (var item in textarray) + {//new(92,83,117) + pos = position; + pos.X += Math.Min(FontAssets.MouseText.Value.MeasureString(txt).X, max.X + 9999); + float sin = (MathF.Sin(pos.X * 0.02f + Main.GlobalTimeWrappedHourly * -1.5f) + 1) * 0.5f; + float sin2 = (MathF.Sin(pos.X * 0.02f + Main.GlobalTimeWrappedHourly * -0.9f) + 1) * 0.5f; + float sin3 = MathF.Sin(pos.X * 0.02f + Main.GlobalTimeWrappedHourly * -1.5f + MathHelper.PiOver2); + var c = new Color(171, 153, 204); + if (txt.Length == 0 || txt.Length == text.Length - 1) + c = Color.Cyan; + else if (txt.Length % 4 == 3) + { + c = Color.HotPink; + } + c = Color.Lerp(Colors.AlphaDarken(new Color(0, 255, 200)), c, MathHelper.Clamp(expansionFactor - 2, 0, 1)); + float posMult = Math.Max(MathHelper.Clamp((expansionFactor - 10) * 0.5f, 0, 3), MathHelper.Clamp((expansionFactor - 2) * 0.5f, 0, 1)); + var origin = FontAssets.MouseText.Value.MeasureString(item.ToString()) * 0.5f; + ChatManager.DrawColorCodedString(spriteBatch, FontAssets.MouseText.Value, item.ToString(), origin + pos + new Vector2(0, item == 'ɔ' ? -1 : 0) + new Vector2((-2f + 4 * sin2) * posMult, (-2 + sin * 4) * posMult), c, sin3 * posMult * 0.1f, origin, new Vector2(scale)); + txt += item; + } + spriteBatch.End(); + } + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + foreach (var item in ChatManager.ShadowDirections) + { + spriteBatch.Draw(lease.Target, Vector2.Zero + Vector2.TransformNormal(item * 2, matrix), null, Color.Black, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + spriteBatch.End(); + } + } + return true; + } + + public override void Update() + { + displayTimer = 10; + } + public override float GetStringLength(DynamicSpriteFont font) + { + float size = font.MeasureString(text).X; + return size * Scale; + } + } +} diff --git a/Items/Accessories/Wings/TiredTail.png b/Items/Accessories/Wings/TiredTail.png new file mode 100644 index 0000000000..5f61600e97 Binary files /dev/null and b/Items/Accessories/Wings/TiredTail.png differ diff --git a/Items/Accessories/Wings/TiredTailPallette.png b/Items/Accessories/Wings/TiredTailPallette.png new file mode 100644 index 0000000000..602c4336bd Binary files /dev/null and b/Items/Accessories/Wings/TiredTailPallette.png differ diff --git a/Items/Accessories/Wings/TiredTailSegment.png b/Items/Accessories/Wings/TiredTailSegment.png new file mode 100644 index 0000000000..33aad216b1 Binary files /dev/null and b/Items/Accessories/Wings/TiredTailSegment.png differ diff --git a/Items/Accessories/Wings/TiredTailTail.png b/Items/Accessories/Wings/TiredTailTail.png new file mode 100644 index 0000000000..768b71bc8e Binary files /dev/null and b/Items/Accessories/Wings/TiredTailTail.png differ diff --git a/Items/Accessories/Wings/TiredTail_Wings.png b/Items/Accessories/Wings/TiredTail_Wings.png new file mode 100644 index 0000000000..08ddcaa27a Binary files /dev/null and b/Items/Accessories/Wings/TiredTail_Wings.png differ diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 297a2e4bd0..1a3debbb51 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -80,5 +80,7 @@ namespace CalamityMod.Items.Armor.Demonshade public string ExtensionTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeHelm_Extension"; public Vector2 ExtensionSpriteOffset(PlayerDrawSet drawInfo) => new Vector2(0, -4f); + + public static Color DemonshadeRarityColor() => CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); } } diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 55823811b7..ed39fe7901 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -415,110 +415,6 @@ namespace CalamityMod.Items { if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - - // Developer items - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(249, 197, 255); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(0, 0, 255); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = TheDanceofLight.GetSyncedLightColor(); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh) - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(129, 29, 149); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 255, 255), new Color(0xD1, 0xCC, 0x6F), 4f); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(220, 20, 60); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(207, 17, 117); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(227, 226, 180); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); - if (item.type == ModContent.ItemType()) - { - nameLine.OverrideColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly / 2f % 1f, new Color[] - { - new Color(255, 196, 55), - new Color(255, 231, 107), - new Color(255, 254, 243) - }); - } - - // TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file - // The items that currently violate this are all below: - // Eternity, Flamsteed Ring, Earth - if (item.type == ModContent.ItemType()) - { - List colorSet = new List() - { - new Color(188, 192, 193), // white - new Color(157, 100, 183), // purple - new Color(249, 166, 77), // honey-ish orange - new Color(255, 105, 234), // pink - new Color(67, 204, 219), // sky blue - new Color(249, 245, 99), // bright yellow - new Color(236, 168, 247), // purplish pink - }; - if (nameLine != null) - { - int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % colorSet.Count); - Color currentColor = colorSet[colorIndex]; - Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; - nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); - } - } - if (item.type == ModContent.ItemType()) - { - if (Main.GlobalTimeWrappedHourly % 1f < 0.6f) - { - nameLine.OverrideColor = new Color(89, 229, 255); - } - else if (Main.GlobalTimeWrappedHourly % 1f < 0.8f) - { - nameLine.OverrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTimeWrappedHourly % 1f - 0.6f) / 0.2f); - } - else - { - nameLine.OverrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTimeWrappedHourly % 1f - 0.8f) / 0.2f); - } - } - if (item.type == ModContent.ItemType()) - { - List earthColors = new List() - { - Color.OrangeRed, - Color.MediumTurquoise, - Color.LimeGreen - }; - if (nameLine != null) - { - int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count); - Color currentColor = earthColors[colorIndex]; - Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; - nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); - } - } } #endregion diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs index 5170ee340b..fbdfae0100 100644 --- a/Items/Dyes/ProfanedFlameDye.cs +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Dyes { @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SafeSetDefaults() diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index 7b19417b60..110cdac0fb 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Dyes @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetStaticDefaults() { Item.ResearchUnlockCount = 3; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SafeSetDefaults() diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index a2172c962b..5b21ce7e7a 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -290,8 +290,6 @@ namespace CalamityMod.Items.Fishing bool reset = false; - float oldSpin = 0; - int digDir = 0; float spinSin => MathF.Sin(spin); public override void SetDefaults() diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index e9d47d8eef..c846aef56f 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -117,6 +117,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Cei", "Chetto", "Chill Dude", + "ClockworkShade", "Cobalion", "Daim", "DarkTiny", @@ -189,7 +190,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Runefield", "Sargassum", "sentri", - "Shade", "SharZz", "Shucks", "Silver-Lord of Ash", diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index 0176a2ae0c..4cb746ce79 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; @@ -36,28 +38,27 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - var Prov = CalamityGlobalNPC.holyBoss; - bool canPissOffProvi = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; - return ((!NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHallow || player.ZoneUnderworldHeight)) || canPissOffProvi) && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - var Prov = CalamityGlobalNPC.holyBoss; - bool usingToMakeProviPissedOff = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; - if (usingToMakeProviPissedOff) + int posX = (int)player.position.X; + int posY = (int)(player.position.Y - 100f); + int bossToSpawn = ModContent.NPCType(); + NPC prov = CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, Providence.SpawnSound); + if (Main.getGoodWorld) { - (Main.npc[Prov].ModNPC as Providence).hasBeenGivenFullPower = true; + (prov.ModNPC as Providence).hasBeenGivenFullPower = true; Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0); } - else - { - int posX = (int)player.position.X; - int posY = (int)(player.position.Y - 100f); - int bossToSpawn = ModContent.NPCType(); - CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, Providence.SpawnSound); - } return true; } + + public override void ModifyTooltips(List tooltips) + { + string enrageTooltip = Main.getGoodWorld ? "\n" + this.GetLocalizedValue("EnrageText") : ""; + tooltips.FindAndReplace("[ENRAGE]", enrageTooltip); + } } } diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 79a4fa8f1c..deeaaa7431 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -144,5 +144,7 @@ namespace CalamityMod.Items.Tools AddTile(). Register(); } + + public static Color RarityColor() => new Color(129, 29, 149); } } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 5b65b1c0a3..3176eb58bd 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { Item.width = 38; Item.height = 24; - Item.damage = 200; + Item.damage = 160; Item.mana = 12; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 913475841f..f101f76a05 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -60,5 +60,22 @@ namespace CalamityMod.Items.Weapons.Magic AddTile(). Register(); } + + public static Color RarityColor() + { + List colorSet = [ + new Color(188, 192, 193), // white + new Color(157, 100, 183), // purple + new Color(249, 166, 77), // honey-ish orange + new Color(255, 105, 234), // pink + new Color(67, 204, 219), // sky blue + new Color(249, 245, 99), // bright yellow + new Color(236, 168, 247), // purplish pink + ]; + int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + return Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); + } } } diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index 1c05db456a..74a3367f25 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public int FiringMode = 0; // 0 = hellfireballs, 1 = hellblasts public int ProjectilesFired = 0; + public static readonly SoundStyle FireSound = new SoundStyle("CalamityMod/Sounds/Custom/CalamitasClone/CalClone_BigFireballBit", 4) with { Volume = 0.6f, MaxInstances = 4 }; public override void SetStaticDefaults() { CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; @@ -32,13 +33,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.mana = 28; Item.useAnimation = Item.useTime = 46; Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = FireSound; Item.noMelee = true; Item.knockBack = 7.5f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 22f; } // Shoots twice as fast (and uses half as much mana to compensate) during hellblasts @@ -52,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { ProjectilesFired++; - type = FiringMode == 1 ? ModContent.ProjectileType() : Item.shoot; + type = FiringMode == 1 ? ModContent.ProjectileType() : Item.shoot; Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer); // DUST @@ -86,11 +88,13 @@ namespace CalamityMod.Items.Weapons.Magic { FiringMode = 1; ProjectilesFired = 0; + SoundEngine.PlaySound(SoundID.Item100 with { Volume = 0.8f }, player.Center); } if (FiringMode == 1 && ProjectilesFired >= 10) { FiringMode = 0; ProjectilesFired = 0; + SoundEngine.PlaySound(SoundID.Item100 with { Volume = 0.8f }, player.Center); } return false; } diff --git a/Items/Weapons/Magic/StaffofBlushie.cs b/Items/Weapons/Magic/StaffofBlushie.cs index d89bd90aa0..6b21277e97 100644 --- a/Items/Weapons/Magic/StaffofBlushie.cs +++ b/Items/Weapons/Magic/StaffofBlushie.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -44,5 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic AddTile(). Register(); } + + public static Color RarityColor() => Color.Blue; } } diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs index 48bfd4d5f2..1e03004da4 100644 --- a/Items/Weapons/Magic/Sylvestaff.cs +++ b/Items/Weapons/Magic/Sylvestaff.cs @@ -111,5 +111,7 @@ namespace CalamityMod.Items.Weapons.Magic spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0); return false; } + + public static Color RarityColor() => new Color(249, 197, 255); } } diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index c98dcc9c6a..455b1b864c 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Systems.Collections; using CalamityMod.Rarities; -using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index b1b62226f8..035b9e70ee 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -62,5 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f); } } diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index bad5ef2a16..58cd6afbea 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -76,5 +76,14 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(). Register(); } + + public static Color RarityColor() + { + List earthColors = [ Color.OrangeRed, Color.MediumTurquoise, Color.LimeGreen ]; + int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count); + Color currentColor = earthColors[colorIndex]; + Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; + return Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); + } } } diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index fe800a7be0..2b9106d0ba 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -62,5 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); } } diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 178a6e626d..ca9d8bf80d 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,7 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Systems.Collections; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,9 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static float Lifetime => 15; //Technically has infinite lifetime, but manually sets 15 seconds. See projectile file for details public static float Reach = 512f; public static float Speed = 36f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Lifetime); public override void SetStaticDefaults() { @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 28; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 50; + Item.damage = 35; Item.knockBack = 4f; Item.useTime = 22; Item.useAnimation = 22; @@ -48,5 +50,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Lime; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.oblivionCooldown == 0) + return true; + else + return false; + } } } diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index cc2950afc7..b3df54f05a 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -117,5 +117,7 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f); } } diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs index 1c3b293927..538b2cd881 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,5 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(). Register(); } + + public static Color RarityColor() => new Color(227, 226, 180); } } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 1f941bd2dc..8db0621ddf 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -53,5 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } + + public static Color RarityColor() => new Color(207, 17, 117); } } diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index 9ca4a9a5a4..3b12791325 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.UseSound = SoundID.Item34; + Item.UseSound = SoundID.DD2_BetsyFireballShot; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; @@ -38,9 +38,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i <= 2; i++) + for (int i = 0; i <= 3; i++) { - Projectile.NewProjectile(source, position + velocity * 4f, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.9f, 1.25f), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.9f, 1.25f), type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 8e85adde27..35963d313e 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -76,5 +76,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(255, 255, 255), new Color(0xD1, 0xCC, 0x6F), 4f); } } diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 4a698709e7..fd621e9b44 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -82,5 +82,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddTile(). Register(); } + + public static Color RarityColor() => new Color(220, 20, 60); } } diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 540e906b7e..db863c5e58 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -24,13 +24,13 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 26; Item.height = 48; - Item.damage = 92; + Item.damage = 110; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 2; - Item.useAnimation = 10; + Item.useTime = 3; + Item.useAnimation = 12; Item.reuseDelay = 1; - Item.useLimitPerAnimation = 5; + Item.useLimitPerAnimation = 4; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; Item.UseSound = SoundID.Item109; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue for (float i = 0; i < 9; i++) { float angle = MathHelper.TwoPi / 9f * i; - Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), damage * 3, knockback, player.whoAmI, angle); + Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI, angle); } } else if (stealthSalvo) diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index b4bbba795e..e138faec61 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -495,7 +495,6 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public static int lifetime => 1200; - Color? color = null; public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 734bbd98e5..9dabaa5cbc 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -174,5 +174,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddTile(). Register(); } + + public static Color RarityColor() => new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); } } diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index e588335fb2..ddaac460be 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -53,5 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); } } diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index a9cd33ee10..107a687826 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 88; Item.height = 108; - Item.damage = 110; + Item.damage = 120; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 24; diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 82d159fbb9..b91456d5cc 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 26; Item.height = 28; Item.mana = 10; - Item.damage = 15; + Item.damage = 18; Item.useStyle = ItemUseStyleID.Swing; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 6d44a1e358..e50b70b3cb 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 42; Item.height = 60; - Item.damage = 97; + Item.damage = 95; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 581ff50223..fc4a4f5556 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 56; Item.height = 60; - Item.damage = 75; + Item.damage = 69; Item.useAnimation = Item.useTime = 24; Item.mana = 10; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 53a032d191..cc8c614086 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 64; Item.height = 62; - Item.damage = 215; + Item.damage = 222; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/EnchantedKnifeStaff.cs b/Items/Weapons/Summon/EnchantedKnifeStaff.cs index c2b9993bd0..a4862638f0 100644 --- a/Items/Weapons/Summon/EnchantedKnifeStaff.cs +++ b/Items/Weapons/Summon/EnchantedKnifeStaff.cs @@ -9,11 +9,11 @@ namespace CalamityMod.Items.Weapons.Summon { public class EnchantedKnifeStaff : ModItem, ILocalizedModType { - public static float SwingTime = 20f; - public static float SwingWait = 10f; + public static float SwingTime = 18f; + public static float SwingWait = 6f; public static float ProjectileSpeed = 15f; - public static float DashCooldown = 30f; - public static float DashSpeed = 16f; + public static float ChaseSpeed = 10f; + public static float RecoilSpeed = -4f; public new string LocalizationCategory => "Items.Weapons.Summon"; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index ef31f7934b..51a156fc22 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -101,5 +101,7 @@ namespace CalamityMod.Items.Weapons.Summon AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f); } } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 1d95674621..e2311395fc 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 66; Item.height = 70; - Item.damage = 175; + Item.damage = 160; Item.DamageType = DamageClass.Summon; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 21714b2e37..8177b27702 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -204,5 +204,15 @@ namespace CalamityMod.Items.Weapons.Summon AddTile(). Register(); } + + public static Color RarityColor() + { + if (Main.GlobalTimeWrappedHourly % 1f < 0.6f) + return new Color(89, 229, 255); + else if (Main.GlobalTimeWrappedHourly % 1f < 0.8f) + return Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTimeWrappedHourly % 1f - 0.6f) / 0.2f); + else + return Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTimeWrappedHourly % 1f - 0.8f) / 0.2f); + } } } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index 82327f01db..3ac9033742 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 36; Item.height = 36; - Item.damage = 72; + Item.damage = 70; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 24; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 91a1ff43bd..798bceb466 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 34; Item.height = 24; - Item.damage = 10; + Item.damage = 15; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index 761c97911c..af662a6ce2 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 100; Item.height = 128; - Item.damage = 57; + Item.damage = 50; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 24; diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index be0981aa6b..575526d69b 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 34; Item.height = 34; - Item.damage = 53; + Item.damage = 42; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 85e6139d53..ab5351a978 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -90,7 +90,6 @@ namespace CalamityMod.Items.Weapons.Summon float barScale = 1/(32f/TextureAssets.Item[Type].Width()) * 0.9f; Vector2 barOrigin = barBG.Size() * 0.5f; - float yOffset = 0f; Vector2 drawPos = position + new Vector2(0, (float)TextureAssets.Item[Type].Height() * 0.5f) * scale; Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height); Color colorBG = Color.Black; diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 6dc2fda202..d6f33e4304 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public static float EnemyDetectionDistance = 1200f; - public static int IFrames = 10; + public static int IFrames = 8; // In frames. public static float TimeBeforeCharging = 45f; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 42; Item.height = 42; - Item.damage = 142; + Item.damage = 132; Item.useAnimation = Item.useTime = 24; Item.knockBack = 4f; Item.mana = 10; diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 0bc84b41ec..03ce24238d 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 44; Item.height = 48; - Item.damage = 25; + Item.damage = 22; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index eac44d1874..85ca83d42c 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Summon public class TacticalPlagueEngine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public const int BulletShootRate = 125; + public const int BulletShootRate = 120; public override void SetDefaults() { Item.width = 28; Item.height = 20; - Item.damage = 140; + Item.damage = 110; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 60ffc3da53..e0c75c272b 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -65,5 +65,7 @@ namespace CalamityMod.Items.Weapons.Summon AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f); } } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index a1d77569ae..6efbba9703 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Summon #region Damage Balancing Properties - //Sage Poison's damage is kept in the Sage Poison file - public static float ActiveAttackSlashDmgMult => 5f; + //Sage Poison's damage is kept in the Sage Poison file + public static float ActiveAttackSlashDmgMult => 4f; //Note: the following two only apply when not using the active attack public static float AxeDmgMult => 1.25f; @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 26; Item.height = 36; - Item.damage = 60; + Item.damage = 55; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 24; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 1bb8e2897b..0a1cc384ab 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public static SummonTag summonTag = new SummonTag() { - MultiplicativeTagDamage = 0.3f, //Percentage of damage dealt added by the void. This is doubled by summons. This was tested - 1.5x was too weak to be worth 4 slots. + MultiplicativeTagDamage = 0.25f, //Percentage of damage dealt added by the void. This is doubled by summons. This was tested - 1.5x was too weak to be worth 4 slots. <-- (nvm) AllowsWhipStacking = true, TagOnHit = tagOnHit, TagModifyHitEffects = SummonTag.BlankTagModifyHit, diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index 1adfc5491b..174bb5720a 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public const int SlotCount = 4; - public const int PunchCooldownTime = 36; + public const int PunchCooldownTime = 30; public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index d7a27389e1..40b195b93b 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -42,7 +42,6 @@ Drops: { DownedT2AR: After defeating the second tier of Acid Rain FirstKill: Drops only on the first kill MechBoss: Drops on the first kill of the final Mechanical Boss - ProvidenceEnraged: Drops if Providence has been enraged ProvidenceChallenge: ''' Drops if Providence was defeated only with the [i:CalamityMod/ProfanedSoulArtifact] Profaned Soul Artifact diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 367ad5e519..b20780869a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -150,3 +150,13 @@ WingsofRebirth: { 'Resplendent to the very end' ''' } + +TiredTail: { + DisplayName: Tired Tail + Tooltip: + ''' + {$CommonItemTooltip.FlightAndSlowfall} + {$CommonItemTooltip.PressDownToHover} + {$CommonItemTooltip.PressUpToBooster} + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 3ae132b727..4e949f3dee 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -226,11 +226,11 @@ ProfanedCore: { DisplayName: Profaned Core Tooltip: ''' - Summons Providence when used in the Hallow or Underworld - Use again while Providence is at high health to unleash Her perfect fury + Summons Providence when used in the Hallow or Underworld[ENRAGE] {$Common.NotConsumable} 'The heart of Her Guardians, Her wicked wrath shall burn upon whoever now wields it.' ''' + EnrageText: "[c/64c8fa:The nature of this world will unleash Her perfect fury, beware!]" } ProfanedShard: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 4730855f11..388b1b5def 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -493,7 +493,7 @@ LashesofChaos: { DisplayName: Lashes of Chaos Tooltip: ''' - Alternates between exploding hellfireballs and piercing hellblasts + Alternates between exploding hellfire bursts and piercing brimstone darts 'Watch the world burn...' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 4157a33935..649703383a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -919,8 +919,13 @@ Oblivion: { DisplayName: Oblivion Tooltip: ''' - {$Common.YoyoStatsInfinite} - Fires brimstone darts when enemies are near + {$Common.YoyoStats} + A hightly unstable yoyo that slowly releases homing brimstone hellblasts + Enemy hits with the yoyo charge its power, greatly increasing the fire rate of the hellblasts + At maximum charge, the yoyo bursts into brimstone darts and resets its flight duration + Striking an enemy at maximum charge will overload the yoyo, causing it to release all stored up power and shatter + Shattering the yoyo deals immense damage but leaves it unable to be used for several seconds + [c/C61B40:'I have memories from eyes that are not my own'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index f49d100b63..f4d8087818 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -147,10 +147,10 @@ CausticStaff: { ''' HoldShiftTooltip: ''' - Always inflicts [cbuff:OnFire3] + Always inflicts [cbuff:OnFire3] and [cbuff:Venom] Inflicts [cbuff:CursedInferno] with 2 dragons summoned - Inflicts [cbuff:Venom] with 3 dragons summoned - Inflicts [cbuff:Ichor] and [cbuff:CalamityMod/MarkedforDeath] with 4 dragons summoned + Inflicts [cbuff:Ichor] with 3 dragons summoned + Inflicts [cbuff:CalamityMod/MarkedforDeath] with 4 dragons summoned ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 4a28d5a5dc..c7ede7f1b5 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -43,7 +43,6 @@ BloodRay.DisplayName: Blood Ray BlueBubble.DisplayName: Bubble BlushieStaffProj.DisplayName: Staff of Blushie BrimroseBeam.DisplayName: Brimrose Beam -BrimstoneHellfireballFriendly.DisplayName: Hellfireball CauldronProj.DisplayName: Smauldron CauldronProjSmall.DisplayName: Smaullerdron ChronoIcicleLarge.DisplayName: Chrono Icicle @@ -96,7 +95,6 @@ HadalUrnLamprey.DisplayName: Sea Lamprey HadalUrnStarfish.DisplayName: Marianan Starfish HadalUrnStarfishShard.DisplayName: Starfish Shard HeliumFlashBlast.DisplayName: Helium Flash -HellfireExplosionFriendly.DisplayName: Explosion HellwingBat.DisplayName: Ashen Hellwing HolyFlame.DisplayName: Holy Flame HolyLaser.DisplayName: Holy Laser @@ -292,3 +290,6 @@ FleshTotemMinion.DisplayName: Flesh Totem Minion FleshTotemSoul.DisplayName: Flesh Totem Soul SpectralFeather.DisplayName: Spectral Feather MoonSigil.DisplayName: Moon Sigil +CalamitousDartFriendly.DisplayName: Calamitous Dart Friendly +CalamitousExplosionFriendly.DisplayName: Calamitous Explosion Friendly +CalamitousFireballFriendly.DisplayName: Calamitous Fireball Friendly diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 1dd7bb9076..ba72470e9f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -312,3 +312,5 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard EvilSmasherProjectile.DisplayName: Evil Smasher +OblivionFire.DisplayName: Oblivion Fire +OblivionBolt.DisplayName: Oblivion Bolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 121827ff82..f4b7fda204 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -47,7 +47,7 @@ BrimstoneElementalMinion.DisplayName: Brimstone Elemental BrimstoneExplosionMinion.DisplayName: Explosion BrimstoneFireballMinion.DisplayName: Brimstone Fireball BrimstoneFireSummon.DisplayName: Brimstone Fire -BrimstoneLaserSummon.DisplayName: Brimstone Laser +BrimstoneLaserSummon.DisplayName: Vigil Mini Fireball BrittleStarMinion.DisplayName: Brittle Star CalamarisLamentMinion.DisplayName: Calamari CalamarisLamentProjectile.DisplayName: Calamari Ink diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index bd0c8302a5..213982f7b2 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -129,6 +129,7 @@ Cooldowns: { MasterChefShieldDurability: MJOLNIR Shield Level MasterChefShieldRecharge: MJOLNIR Shield Recharge NebulousCore: Nebulous Core Cooldown + OblivionCooldown: Oblivion Cooldown OldDukeScalesFatigue: Stamina OmegaBlueActive: Abyssal Madness OmegaBlueCooldown: Abyssal Madness Cooldown diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs index 94fd866295..f37a581f3d 100644 --- a/NPCs/BaseWormNPC.cs +++ b/NPCs/BaseWormNPC.cs @@ -652,6 +652,7 @@ namespace CalamityMod.NPCs NPC.lifeMax = 10000; NPC.knockBackResist = 0; NPC.noTileCollide = true; + NPC.dontCountMe = true; NPC.aiStyle = -1; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index fc2a6c5711..1ffdf110b5 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -444,12 +444,12 @@ namespace CalamityMod.NPCs break; // Chaos Elemental - // Rod of Discord @ 1% Normal, 2% Expert+ + // Rod of Discord @ 0.8% Normal, 1% Expert+ case NPCID.ChaosElemental: // Remove the vanilla loot rule for Rod of Discord. npcLoot.RemoveWhere((rule) => rule is CommonDrop conditionalRule && conditionalRule.itemId == ItemID.RodofDiscord); // Define a replacement rule which has an increased chance. - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 100, 50)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 125, 100)); break; // Illuminant Bat diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 2d45fb0d1d..fed2affc2e 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -306,10 +306,13 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnSpawn(IEntitySource source) { + // Don't display the dialogue in Boss Rush + if (BossRushEvent.BossRushActive) + return; + string key = "Mods.CalamityMod.Status.Boss.DoGSpawn"; Color messageColor = Color.Cyan; CalamityUtils.BroadcastLocalizedText(key, messageColor); - DialogueDisplaySystem.StartDialogue("Mods.CalamityMod.DevourerOfGods.Phases", NPC, 0, 120, false, new BossText()); } diff --git a/NPCs/NormalNPCs/DivineSwine.cs b/NPCs/NormalNPCs/DivineSwine.cs index 931bab8b93..8743051f3b 100644 --- a/NPCs/NormalNPCs/DivineSwine.cs +++ b/NPCs/NormalNPCs/DivineSwine.cs @@ -112,7 +112,9 @@ namespace CalamityMod.NPCs.NormalNPCs Main.npcFrameCount[Type] = 14; NPCID.Sets.CountsAsCritter[Type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; - NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(NPCID.GoldBunny) + 3, Type); + NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(NPCID.GoldBunny) + 1, Type); + NPCID.Sets.ImmuneToAllBuffs[Type] = true; + NPCID.Sets.ShimmerImmunity[Type] = true; } public override void SetDefaults() @@ -129,9 +131,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.DeathSound = SoundID.NPCDeath1; NPC.immortal = true; NPC.noGravity = true; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; + + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToElectricity = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = false; } public override void OnSpawn(IEntitySource source) @@ -290,14 +295,10 @@ namespace CalamityMod.NPCs.NormalNPCs SoundEngine.PlaySound(SoundID.Item29 with { Volume = 0.1f }, NPC.Center); SoundEngine.PlaySound(IdleSound, NPC.Center); - if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out var activeSound)) - activeSound.Stop(); + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out ActiveSound swineSpeakInstance)) + swineSpeakInstance.Stop(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Transform(ModContent.NPCType()); - NPC.netUpdate = true; - } + NPC.Transform(ModContent.NPCType()); } } @@ -432,6 +433,9 @@ namespace CalamityMod.NPCs.NormalNPCs GeneralParticleHandler.SpawnParticle(Main.rand.NextBool() ? meatSparkle : meatLight, true, Enums.GeneralDrawLayer.AfterNPCs); } + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out ActiveSound swineSpeakInstance)) + swineSpeakInstance.Stop(); + // Despawn immediately afterwards. NPC.checkDead(); NPC.active = false; @@ -465,6 +469,8 @@ namespace CalamityMod.NPCs.NormalNPCs SoundEngine.PlaySound(SoundID.Item29 with { Volume = 0.1f }, NPC.Center); SoundEngine.PlaySound(IdleSound, NPC.Center); + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out ActiveSound swineSpeakInstance)) + swineSpeakInstance.Stop(); NPC.checkDead(); NPC.active = false; diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs index 5d8522b4fe..0dd70afbc7 100644 --- a/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs @@ -104,11 +104,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog if (SoundEngine.TryGetActiveSound(DevilsTongueSlot, out var activeSound)) activeSound.Stop(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Transform(ModContent.NPCType()); - NPC.netUpdate = true; - } + NPC.Transform(ModContent.NPCType()); } Animate(IdleFrame, IdleFrame, 0, false, dynamicChanges: true); diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 86fc4b4116..20f8127463 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.X *= 0.9f; NPC.rotation = 0f; - if (!SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + if (Timer < 2 && !SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) NearbySoundSlot = SoundEngine.PlaySound(DivineSwine_SwineSpeakLoopingSound, NPC.Center, NearbySoundCallbackMethod); float lightSpawnDistance = MathHelper.Lerp(52f, 84f, Timer / 180f); @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.NormalNPCs GeneralParticleHandler.SpawnParticle(feather, manualDrawLayerOverride: Enums.GeneralDrawLayer.BeforeNPCs); } - if (Timer >= 180f && Main.netMode != NetmodeID.MultiplayerClient) + if (Timer >= 180f) { CustomPulse lightRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2f, 75); GeneralParticleHandler.SpawnParticle(lightRing); @@ -232,7 +232,6 @@ namespace CalamityMod.NPCs.NormalNPCs activeSound.Stop(); NPC.Transform(ModContent.NPCType()); - NPC.netUpdate = true; } } @@ -240,7 +239,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.X *= 0.9f; NPC.rotation = 0f; - if (!SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + if (Timer < 2 && !SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) NearbySoundSlot = SoundEngine.PlaySound(HorribleHog_DevilsTongueLoopingSound, NPC.Center, NearbySoundCallbackMethod); float smokeOpacity = Utils.GetLerpValue(0f, 45f, Timer, true); @@ -264,11 +263,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (SoundEngine.TryGetActiveSound(NearbySoundSlot, out var activeSound)) activeSound.Stop(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Transform(ModContent.NPCType()); - NPC.netUpdate = true; - } + NPC.Transform(ModContent.NPCType()); } } diff --git a/NPCs/NormalNPCs/PiggyGold.cs b/NPCs/NormalNPCs/PiggyGold.cs index de5acee1b0..5f6978d906 100644 --- a/NPCs/NormalNPCs/PiggyGold.cs +++ b/NPCs/NormalNPCs/PiggyGold.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; +using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -16,9 +17,13 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetStaticDefaults() { + Main.npcFrameCount[Type] = 8; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[Type] = true; NPCID.Sets.GoldCrittersCollection.Add(Type); - NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(NPCID.GoldBunny) + 2, Type); - base.SetStaticDefaults(); + NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(ModContent.NPCType()) + 1, Type); } public override void SetDefaults() diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 43ff5d3db8..3a418d463e 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -290,7 +290,7 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - if (Main.getGoodWorld) + if (Main.zenithWorld) NPC.scale *= 0.25f; } @@ -400,8 +400,7 @@ namespace CalamityMod.NPCs.Providence Player player = Main.player[NPC.target]; // Enraged bool and Color shifting - bool getFuckedAI = Main.zenithWorld; - if (getFuckedAI) + if (Main.zenithWorld) NPC.localAI[1] = (float)BossMode.Rainbow; else if (hasBeenGivenFullPower) // Enraged behavior NPC.localAI[1] = (float)BossMode.Enraged; @@ -426,29 +425,15 @@ namespace CalamityMod.NPCs.Providence // Is in spawning animation float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; - if (!spawnAnimation) - { NPC.Opacity = 1f; - } // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Play enrage animation if she gets angy - if (!getFuckedAI && fullPowerAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) + // Sync "enrage" status in FTW + if (NPC.localAI[1] == (float)BossMode.Enraged && calamityGlobalNPC.newAI[3] == 0f) { - AIState = (int)Phase.HolyBlast; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - // Despawn existing projectiles and summon the aura again - DespawnSpecificProjectiles(true); - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, -1); if (Main.netMode != NetmodeID.SinglePlayer) ProvidenceDyeConditionSyncPacket.Send(this); NPC.ForceNetUpdate(false); @@ -811,7 +796,7 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; // Movement - if (getFuckedAI || (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon)) + if (Main.zenithWorld || (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon)) { // Slowly drift down when spawning if (spawnAnimation) @@ -878,14 +863,8 @@ namespace CalamityMod.NPCs.Providence } if (laserPhaseSlow) { - acceleration *= getFuckedAI ? 0.6f : 0.2f; - velocity *= getFuckedAI ? 0.6f : 0.2f; - } - - if (Main.getGoodWorld) - { - velocity *= 1.2f; - acceleration *= 1.2f; + acceleration *= Main.zenithWorld ? 0.6f : 0.2f; + velocity *= Main.zenithWorld ? 0.6f : 0.2f; } if (!targetDead) @@ -898,14 +877,11 @@ namespace CalamityMod.NPCs.Providence float moveUpThreshold = player.position.Y - (NPC.position.Y + NPC.height); if (moveUpThreshold < (laserPhaseSlow ? 150f : 200f)) // 150 - NPC.velocity.Y -= Main.getGoodWorld ? 0.4f : 0.2f; + NPC.velocity.Y -= fullPowerAI ? 0.4f : 0.2f; if (moveUpThreshold > (laserPhaseSlow ? 200f : 250f)) // 200 - NPC.velocity.Y += Main.getGoodWorld ? 0.4f : 0.2f; + NPC.velocity.Y += fullPowerAI ? 0.4f : 0.2f; float speedCap = laserPhaseSlow ? 2f : 6f; - if (Main.getGoodWorld) - speedCap *= 1.5f; - if (NPC.velocity.Y > speedCap) NPC.velocity.Y = speedCap; if (NPC.velocity.Y < -speedCap) @@ -1121,29 +1097,7 @@ namespace CalamityMod.NPCs.Providence GeneralParticleHandler.SpawnParticle(new SparkParticle(startPos, startPos.DirectionTo(destination) * (startPos.Distance(destination) / 10), false, 10, Main.rand.NextFloat(0.2f, 0.5f) * (sc * 2), medColor)); } - // Used to heal her back to full HP during enrage animation - if (fullPowerAI && calamityGlobalNPC.newAI[3] % 9f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = NPC.lifeMax / 400; - if (healAmt > NPC.lifeMax - NPC.life) - healAmt = NPC.lifeMax - NPC.life; - - if (healAmt > 0) - { - NPC.life += healAmt; - NPC.HealEffect(healAmt, true); - NPC.ForceNetUpdate(false); - } - } - } - calamityGlobalNPC.newAI[3] += 1f; - - if (fullPowerAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) - calamityGlobalNPC.newAI[3] += 1f; - return; } @@ -1238,7 +1192,7 @@ namespace CalamityMod.NPCs.Providence borderPosition ??= NPC.Center; borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f); Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30); - if (!targetDead && !getFuckedAI) + if (!targetDead && !Main.zenithWorld) { if (NPC.velocity.Length() <= 2f) NPC.velocity = Vector2.Zero; @@ -1509,7 +1463,7 @@ namespace CalamityMod.NPCs.Providence borderPosition ??= NPC.Center; borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f); - if (!targetDead && !getFuckedAI) + if (!targetDead && !Main.zenithWorld) { if (NPC.velocity.Length() <= 2f) NPC.velocity = Vector2.Zero; @@ -1554,9 +1508,6 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); - - if (Main.getGoodWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -vector2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } } @@ -1581,9 +1532,6 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, 1f, 0f); - - if (Main.getGoodWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -velocity2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, 1f, 0f); } } @@ -1601,7 +1549,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.Crystal: - if (!targetDead && !getFuckedAI) + if (!targetDead && !Main.zenithWorld) NPC.velocity *= 0.9f; NPC.ai[1] += 1f; @@ -1673,7 +1621,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - float timeLeft = fullPowerAI ? (float)(getFuckedAI ? gfbCrystalTime : enragedCrystalTime) : 0f; + float timeLeft = fullPowerAI ? (float)(Main.zenithWorld ? gfbCrystalTime : enragedCrystalTime) : 0f; Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), CrystalDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } @@ -2029,12 +1977,6 @@ namespace CalamityMod.NPCs.Providence return prov.challenge; }, () => Main.expertMode, DropHelper.ProvidenceChallengeText)).Add(ModContent.ItemType()); - npcLoot.AddIf(info => - { - Providence prov = info.npc.ModNPC(); - return prov.hasBeenGivenFullPower; - }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceEnragedText); - npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); @@ -2094,7 +2036,7 @@ namespace CalamityMod.NPCs.Providence public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - bool offColor = NPC.localAI[1] != (float)BossMode.Normal && (NPC.Calamity().newAI[3] >= 180f || Main.zenithWorld); + bool offColor = NPC.localAI[1] != (float)BossMode.Normal; Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; @@ -2861,14 +2803,6 @@ namespace CalamityMod.NPCs.Providence // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - /// - /// This lease should be used to draw all of a projectile's effects onto directly, then be drawn onto the screen as one. This is for opacity reasons - /// - public static RenderTargetLease PrimaryLease { get => field ??= ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); set; } - /// - /// This should be used for secondary effects like trails, then drawn to PrimaryLease. This is for opacity reasons. - /// - public static RenderTargetLease SecondaryLease { get => field ??= ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); set; } public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld; public static int CalculateProvidenceDamage(this int damage) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 4981b94c3f..7b0da70ac2 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -201,11 +201,14 @@ namespace CalamityMod.NPCs.SlimeGod // Make sure Opacity is set to 0.8f if it's below that when the vanish phase starts if (NPC.ai[3] == 0f) { - if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && + !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) { NPC.ai[3] = 1f; NPC.Opacity = 0.8f; } + else + NPC.Opacity = 0.01f; // This line ensures the core doesn't immediately explode into loot if it's currently possessing a paladin } // Emit dust diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 7d30a48077..af132c16ec 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -712,6 +712,8 @@ namespace CalamityMod.NPCs.SlimeGod } } + public override bool CheckActive() => false; + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 20e145acd2..880c170ceb 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -753,6 +753,8 @@ namespace CalamityMod.NPCs.SlimeGod } } + public override bool CheckActive() => false; + public override Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); diff --git a/Prefixes/HorribleWeaponPrefix.cs b/Prefixes/HorribleWeaponPrefix.cs index 8484b58f4f..101edf2f21 100644 --- a/Prefixes/HorribleWeaponPrefix.cs +++ b/Prefixes/HorribleWeaponPrefix.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Prefixes public class Horrible : HorribleWeaponPrefix { public override float damageMult => 0.66f; - public override float sizeMult => 2f; + public override float sizeMult => 1.66f; + public override float knockbackMult => 0.01f; } public abstract class HorribleWeaponPrefix : ModPrefix, ILocalizedModType { @@ -19,6 +20,7 @@ namespace CalamityMod.Prefixes // Stats public virtual float damageMult => 1f; public virtual float sizeMult => 1f; + public virtual float knockbackMult => 1f; public override PrefixCategory Category => PrefixCategory.AnyWeapon; public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally @@ -31,6 +33,7 @@ namespace CalamityMod.Prefixes { damageMult = this.damageMult; scaleMult = this.sizeMult; + knockbackMult = this.knockbackMult; } public override void ModifyValue(ref float valueMult) { diff --git a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 81a55e025a..5b92d10539 100644 --- a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// Internal timer for the projectile's swing animation /// - internal int swingTimer = 0; + public int swingTimer = 0; public static Asset TrailTexture; @@ -212,7 +212,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles List oldProjectileRot = new List { }; List oldProjectilePos = new List { }; - internal int ExistsTime = 20; + public int ExistsTime = 20; public bool inStartup => timer < StartupTime; public bool inCooldown => timer > CooldownStartFrame; diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 3abbfc578f..c70af794b1 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -161,9 +161,6 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { int totalProjectiles = !ProvUtils.StandardAI() ? 8 : 6; - if (Main.getGoodWorld) - totalProjectiles *= 2; - float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 5f; diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 36404593ba..a88beb4dcf 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,18 +1,18 @@ using System; using System.Collections.Generic; -using System.Linq; using CalamityMod.Dusts; +using CalamityMod.Effects; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.Providence; using CalamityMod.Particles; +using CalamityMod.Systems.Graphic; using CalamityMod.Utilities.Daybreak; using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Newtonsoft.Json.Serialization; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -20,14 +20,29 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBurnOrb : ModProjectile, ILocalizedModType { + private static Asset TrailNoiseTexture; + private static Asset TrailDistortionTexture; + private static Asset GlowOrbTexture; + bool started = false; + public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void Load() + { + if (!Main.dedServ) + { + TrailNoiseTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise"); + TrailDistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); + GlowOrbTexture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle"); + } + } + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 32; - ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { @@ -66,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 160; } - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) { if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f) { @@ -74,8 +89,8 @@ namespace CalamityMod.Projectiles.Boss } else { - Projectile.ai[1] += 0.05f; - Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); + Projectile.ai[1] += 0.075f; + Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, MathF.Abs(MathF.Sin(Projectile.ai[1]))); } } else if (Projectile.velocity.Length() < 16f) @@ -87,59 +102,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1); } - public override bool PreDraw(ref Color lightColor) - { - //drawn by the HolyBurnOrbDrawer system - return false; - } - public float FireWidthFunction(float completion, Vector2 pos) - { - float width; - float maxBodyWidth = 32f * Projectile.scale; - float curveRatio = 0.2f; - var positions = Projectile.oldPos.ToList(); - positions.RemoveAll(x => x == Vector2.Zero); - // Crop the tip of the trail into a conic shape. - if (completion < curveRatio) - width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; - else - width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); - - // Pulse inwards and outwards over time. - float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; - float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); - return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; - } - - public Color FireColorFunction(float completion, Vector2 pos) - { - Color mainColor = ProvUtils.GetProjectileColor(255) * 1.3f; - Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); - return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; - } - - public float FireCoreWidthFunction(float completion, Vector2 pos) - { - float width; - float maxBodyWidth = Projectile.scale * 24; - float curveRatio = 0.25f; - var positions = Projectile.oldPos.ToList(); - positions.RemoveAll(x => x == Vector2.Zero); - - if (completion < curveRatio) - width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; - else - width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); - return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; - } - - public Color FireCoreColorFunction(float completion, Vector2 pos) - { - Color mainColor = ProvUtils.GetProjectileColor(255); - Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); - Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); - return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; - } public override void OnKill(int timeLeft) { @@ -173,191 +135,168 @@ namespace CalamityMod.Projectiles.Boss ProvUtils.ApplyDebuffs(target, 120); } - } - - public class HolyBurnOrbDrawer : ModSystem - { - public override void Load() + public float FireWidthFunction(float completion) { - On_Main.DrawProjectiles += DrawAll; + float width; + float maxBodyWidth = 36f * Projectile.scale; + float curveRatio = 0.2f; + + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 12f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 6f, pulseInterpolant); + return (width + additionalPulseWidth); } - private void DrawAll(On_Main.orig_DrawProjectiles orig, Main self) + public Color FireColorFunction(float completion) { - orig(self); - - var device = Main.instance.GraphicsDevice; - - List burnToDraw = []; - List healToDraw = []; - - - foreach (var item in Main.ActiveProjectiles) - { - if (item.type == ModContent.ProjectileType()) - burnToDraw.Add(item); - - if (item.type == ModContent.ProjectileType()) - healToDraw.Add(item); - } - - if ((healToDraw.Count() + burnToDraw.Count()) < 1) - return; - - using (Main.spriteBatch.Scope()) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - //Burn trails - using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) - { - foreach (var item in burnToDraw) - DrawBurnOrbTrail(item); - - } - Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - //Heal trail - using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) - { - foreach (var item in healToDraw) - DrawHealOrbTrail(item); - - } - Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - //Main orb - foreach (var item in burnToDraw) - DrawBurnOrb(item); - foreach (var item in healToDraw) - DrawHealOrb(item); - - //Additive orb - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - foreach (var item in burnToDraw) - DrawBurnOrbAdditive(item); - foreach (var item in healToDraw) - DrawHealOrbAdditive(item); - Main.spriteBatch.End(); - } + Color mainColor = Color.Lerp(ProvUtils.GetProjectileColor(255, true) * 2f, ProvUtils.GetProjectileColor(255), 0.75f); + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; } - void DrawBurnOrbTrail(Projectile Projectile) + public void DrawTrail() { - if (Projectile.ModProjectile is HolyBurnOrb M) + Matrix projection = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -200f, 200f); + Vector2 basePosition = Projectile.Center - Main.screenPosition; + Rectangle screenBounds = new Rectangle(-40, -40, Main.screenWidth + 40, Main.screenHeight + 40); + if (screenBounds.Contains(basePosition.ToPoint())) { - var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); - var len = Math.Min(Projectile.oldPos.Length, 32); - for (var i = 0; i < len; i++) + List path = []; + for (var i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color = M.FireColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = ProvUtils.GetProjectileColor(255, true); - float width = M.FireWidthFunction(i / (float)len, Projectile.oldPos[i]); - Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f); + Vector2 trailDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + path.Add(new Vector3(trailDrawPosition.X, trailDrawPosition.Y, 0f)); + } + + if (path.Count > 2 && Projectile.ai[0] > 6) + { + Effect shader = CalamityShaders.ProvidenceHolyOrbTrailShader.Value; + shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + shader.Parameters["glowPower"].SetValue(1.48f); + + Main.graphics.GraphicsDevice.Textures[0] = TrailNoiseTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; + Main.graphics.GraphicsDevice.Textures[1] = TrailDistortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; + + using var shaderScope = SanePrimitiveRenderer.BeginShaderScope(shader, Matrix.Identity, Matrix.Identity, projection); + using var trailMesh = TriangleStripBuilder.BuildStripPooled(path, progress => FireWidthFunction(progress), progress => FireColorFunction(progress), PrimitiveMeshCache.Shared, textured: true); + shaderScope.Draw(trailMesh.View); } } } - void DrawBurnOrb(Projectile Projectile) + + public override bool PreDraw(ref Color lightColor) { - float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; - Color baseColor2 = ProvUtils.GetProjectileColor(255); - baseColor.A = 0; - baseColor *= lerpMult; - baseColor2 *= lerpMult; - Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f); - - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); - - float upRight = MathHelper.PiOver4; - float up = MathHelper.PiOver2; - float upLeft = 3f * MathHelper.PiOver4; - float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + // Trail drawn by the HolyBurnOrbDrawer system. + DrawBurnOrb(); + DrawBurnOrbAdditive(); + return false; } - void DrawBurnOrbAdditive(Projectile Projectile) + private void DrawBurnOrb() { - var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, ProvUtils.GetProjectileColor(255), 0, texture.Size() * 0.5f, 1f, 0, 0f); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); - } - void DrawHealOrbTrail(Projectile Projectile) - { - if (Projectile.ModProjectile is HolyLight M) - { - var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); - var len = Math.Min(Projectile.oldPos.Length, 32); - for (var i = 0; i < len; i++) - { - Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color = M.FireCoreColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = new Color(0, 25, 0); - float width = M.FireWidthFunction(i / (float)len, Projectile.oldPos[i]); - Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f); - } - } - } - void DrawHealOrb(Projectile Projectile) - { - float vel = Projectile.velocity.Length() / 8; - Projectile.localAI[1] += vel; + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Color brightGreen = new Color(54, 209, 54, 0); - Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Vector2 halfTextureSize = drawTexture.Size() / 2f; - Color halfBrightGreen = brightGreen * 0.5f; - float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); - Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; - Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - brightGreen *= timeLeftColorScale; - halfBrightGreen *= timeLeftColorScale; - - Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; + Color baseColor2 = ProvUtils.GetProjectileColor(255); + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); } - void DrawHealOrbAdditive(Projectile Projectile) + private void DrawBurnOrbAdditive() { - var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, new Color(54, 209, 54), 0, texture.Size() * 0.5f, 1f, 0, 0f); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); + Main.EntitySpriteDraw(GlowOrbTexture.Value, Projectile.Center - Main.screenPosition, null, ProvUtils.GetProjectileColor(255) with { A = 0 }, 0, GlowOrbTexture.Size() * 0.5f, 1f, 0, 0f); + Main.EntitySpriteDraw(GlowOrbTexture.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 }, 0, GlowOrbTexture.Size() * 0.5f, 0.5f, 0, 0f); + } + } + + public class HolyBurnOrbDrawer : ModSystem + { + public static RenderTargetLease TrailPixelationLease { get; private set; } + + private List HolyBurnOrbs = []; + private List HolyLights = []; + + public override void Load() + { + GeneralDrawLayerSystem.OnBeforeProjectiles += DrawOrbTrails; + if (!Main.dedServ) + { + Main.QueueMainThreadAction(() => TrailPixelationLease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice, (w, h) => (w / 2, h / 2))); + } + } + + public override void PostUpdateProjectiles() + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType() && !HolyBurnOrbs.Contains(item)) + HolyBurnOrbs.Add(item); + if (item.type == ModContent.ProjectileType() && !HolyLights.Contains(item)) + HolyLights.Add(item); + } + + HolyBurnOrbs.RemoveAll(p => !p.active || p.timeLeft <= 1); + HolyLights.RemoveAll(p => !p.active || p.timeLeft <= 1); + } + + private void DrawOrbTrails() + { + if ((HolyBurnOrbs.Count + HolyLights.Count) > 0) + { + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + using (TrailPixelationLease.Scope(clearColor: Color.Transparent)) + { + foreach (var item in HolyBurnOrbs) + item.ModProjectile().DrawTrail(); + + foreach (var item in HolyLights) + item.ModProjectile().DrawTrail(); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + // Redraw at double scale to pixelate the trails. + Main.spriteBatch.Draw(TrailPixelationLease.Target, Vector2.Zero, null, Color.White with { A = 0 }, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + + Main.spriteBatch.End(); + } + } } } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index a25b4d1497..5347d93748 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -90,12 +90,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.01f, 0f); - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); @@ -106,12 +106,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.05f, 0f); - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 71fcbfaa70..54fc96cc2d 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,13 +1,13 @@ using System; -using System.Linq; +using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.Effects; using CalamityMod.Enums; -using CalamityMod.NPCs.Providence; +using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; -using CalamityMod.Utilities.Daybreak; -using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -18,13 +18,29 @@ namespace CalamityMod.Projectiles.Boss { public class HolyLight : ModProjectile, ILocalizedModType { + private static Asset TrailNoiseTexture; + private static Asset TrailDistortionTexture; + private static Asset GlowOrbTexture; + public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public override void Load() + { + if (!Main.dedServ) + { + TrailNoiseTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak"); + TrailDistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise"); + GlowOrbTexture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle"); + } + } + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 32; - ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 16; + ProjectileID.Sets.TrailingMode[Type] = 0; } + public override void SetDefaults() { Projectile.localAI[1] = Main.rand.NextFloat(30f); @@ -85,60 +101,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool PreDraw(ref Color lightColor) - { - //drawn by the HolyBurnOrbDrawer system - return false; - } - public float FireWidthFunction(float completion, Vector2 pos) - { - float width; - float maxBodyWidth = 32f * Projectile.scale; - float curveRatio = 0.2f; - var positions = Projectile.oldPos.ToList(); - positions.RemoveAll(x => x == Vector2.Zero); - // Crop the tip of the trail into a conic shape. - if (completion < curveRatio) - width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; - else - width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); - - // Pulse inwards and outwards over time. - float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; - float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); - return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; - } - - public Color FireColorFunction(float completion, Vector2 pos) - { - Color mainColor = new Color(54, 209, 54) * 1.3f; - Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); - return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; - } - - public float FireCoreWidthFunction(float completion, Vector2 pos) - { - float width; - float maxBodyWidth = Projectile.scale * 24; - float curveRatio = 0.25f; - var positions = Projectile.oldPos.ToList(); - positions.RemoveAll(x => x == Vector2.Zero); - - if (completion < curveRatio) - width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; - else - width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); - return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; - } - - public Color FireCoreColorFunction(float completion, Vector2 pos) - { - Color mainColor = new Color(54, 209, 54); - Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); - Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); - return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; - } - public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); @@ -162,5 +124,110 @@ namespace CalamityMod.Projectiles.Boss dust.noLightEmittence = true; } } + + public float FireWidthFunction(float completion) + { + float width; + float maxBodyWidth = 56f * Projectile.scale; + float curveRatio = 0.2f; + + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth); + } + + public Color FireColorFunction(float completion) + { + Color mainColor = new Color(54, 209, 54) * 1.3f; + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public void DrawTrail() + { + Matrix projection = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -200f, 200f); + Vector2 basePosition = Projectile.Center - Main.screenPosition; + Rectangle screenBounds = new Rectangle(-40, -40, Main.screenWidth + 40, Main.screenHeight + 40); + if (screenBounds.Contains(basePosition.ToPoint())) + { + List path = []; + for (var i = 0; i < Projectile.oldPos.Length; i++) + { + Vector2 trailDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + path.Add(new Vector3(trailDrawPosition.X, trailDrawPosition.Y, 0f)); + } + + if (path.Count > 2 && Projectile.ai[0] > 6) + { + Effect shader = CalamityShaders.ProvidenceHolyOrbTrailShader.Value; + shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + shader.Parameters["glowPower"].SetValue(1.48f); + + Main.graphics.GraphicsDevice.Textures[0] = TrailNoiseTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; + Main.graphics.GraphicsDevice.Textures[1] = TrailDistortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; + + using var shaderScope = SanePrimitiveRenderer.BeginShaderScope(shader, Matrix.Identity, Matrix.Identity, projection); + using var trailMesh = TriangleStripBuilder.BuildStripPooled(path, progress => FireWidthFunction(progress), progress => FireColorFunction(progress), PrimitiveMeshCache.Shared, textured: true); + shaderScope.Draw(trailMesh.View); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Trail drawn by the HolyBurnOrbDrawer system. + DrawHealOrb(); + DrawHealOrbAdditive(); + return false; + } + + private void DrawHealOrb() + { + float vel = Projectile.velocity.Length() / 8; + Projectile.localAI[1] += vel; + + Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Color brightGreen = new Color(54, 209, 54, 0); + Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Vector2 halfTextureSize = drawTexture.Size() / 2f; + Color halfBrightGreen = brightGreen * 0.5f; + float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); + Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); + Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; + Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; + brightGreen *= timeLeftColorScale; + halfBrightGreen *= timeLeftColorScale; + + Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3 + Vector2.UnitX * 60f, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3 + Vector2.UnitX * 60f, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + + Main.EntitySpriteDraw(drawTexture, position3 - Vector2.UnitX * 60f, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3 - Vector2.UnitX * 60f, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3 - Vector2.UnitY * 60f, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3 - Vector2.UnitY * 60f, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); + } + + private void DrawHealOrbAdditive() + { + Main.spriteBatch.Draw(GlowOrbTexture.Value, Projectile.Center - Main.screenPosition, null, new Color(54, 209, 54) with { A = 0 }, 0, GlowOrbTexture.Size() * 0.5f, 1f, 0, 0f); + Main.spriteBatch.Draw(GlowOrbTexture.Value, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 }, 0, GlowOrbTexture.Size() * 0.5f, 0.5f, 0, 0f); + } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index c5a137939a..1a972a6df7 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Boss { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; velocity.Y = -Math.Abs(velocity.Y); - if (Main.getGoodWorld) + if (!ProvUtils.StandardAI()) velocity *= 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), BlobDamage, 0f, Projectile.owner); diff --git a/Projectiles/Magic/CalamitousDartFriendly.cs b/Projectiles/Magic/CalamitousDartFriendly.cs new file mode 100644 index 0000000000..df3c1d95d7 --- /dev/null +++ b/Projectiles/Magic/CalamitousDartFriendly.cs @@ -0,0 +1,104 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CalamitousDartFriendly : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + if (Projectile.extraUpdates == 0) + { + Projectile.extraUpdates = 1; + Projectile.velocity *= 0.5f; + } + Projectile.frameCounter++; + if (Projectile.frameCounter >= 10) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + Lighting.AddLight(Projectile.Center, 0.9f * Projectile.Opacity, 0f, 0f); + + + if (Projectile.timeLeft < 51) + Projectile.Opacity -= 0.02f; + + if (Projectile.velocity.X < 0f) + { + Projectile.spriteDirection = -1; + Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); + } + else + { + Projectile.spriteDirection = 1; + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); + } + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; + var dir = Projectile.rotation.ToRotationVector2(); + if (Projectile.spriteDirection == -1) + dir = dir.RotatedBy(MathHelper.Pi); + var spot = Vector2.Lerp(Projectile.Center + dir.RotatedBy(MathHelper.PiOver2) * 26, Projectile.Center + dir.RotatedBy(-MathHelper.PiOver2) * 26, Main.rand.NextFloat()); + for (var i = 0; i < 1; i++) + { + var p = CalamitasMetaball.SpawnParticle(Projectile.Center + Projectile.velocity * 2, Vector2.Zero, 40); + p.rotation = Projectile.rotation + MathHelper.PiOver2; + p.TextureToUse = ModContent.Request("CalamityMod/Particles/PointParticle").Value; + p.SizeScaling = 0.65f; + p = CalamitasMetaball.SpawnParticle(Projectile.Center, Main.rand.NextVector2Circular(3, 3), 24f); + p.SizeScaling = 0.8f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void OnKill(int timeLeft) + { + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/CalamitousExplosionFriendly.cs b/Projectiles/Magic/CalamitousExplosionFriendly.cs new file mode 100644 index 0000000000..1bee87c6ab --- /dev/null +++ b/Projectiles/Magic/CalamitousExplosionFriendly.cs @@ -0,0 +1,94 @@ +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.NPCs.CalClone; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CalamitousExplosionFriendly : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 130; + Projectile.height = 130; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); + if (Projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(CalamitasClone.CalamitousExplosionSound, Projectile.Center); + Projectile.localAI[0] += 1f; + } + bool xflag = false; + bool yflag = false; + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) + { + xflag = true; + } + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) + { + xflag = true; + } + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) + { + yflag = true; + } + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) + { + yflag = true; + } + if (xflag && yflag) + { + Projectile.Kill(); + } + float projTimer = 25f; + if (Projectile.ai[0] > 180f) + { + projTimer -= (Projectile.ai[0] - 180f) / 2f; + } + if (projTimer <= 0f) + { + projTimer = 0f; + Projectile.Kill(); + } + projTimer *= 0.7f; + Projectile.ai[0] += 4f; + var p = CalamitasMetaball.SpawnParticle(Projectile.Center, Main.rand.NextVector2CircularEdge(4, 4), 32f); + p.SizeScaling = 0.96f; + + p = CalamitasMetaball.SpawnParticle(Projectile.Center, Main.rand.NextVector2CircularEdge(3, 3), 40f); + p.SizeScaling = 0.96f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + } +} diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/CalamitousFireballFriendly.cs similarity index 51% rename from Projectiles/Magic/BrimstoneHellfireballFriendly.cs rename to Projectiles/Magic/CalamitousFireballFriendly.cs index d19ac4ede9..736d4ab02e 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/CalamitousFireballFriendly.cs @@ -1,18 +1,17 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Graphics.Metaballs; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class BrimstoneHellfireballFriendly : ModProjectile, ILocalizedModType + public class CalamitousFireballFriendly : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellfireball"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { Main.projFrames[Type] = 6; @@ -22,19 +21,20 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 48; + Projectile.height = 48; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; - Projectile.penetrate = 1; - Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.alpha = 255; } public override void AI() { - //Animation + // Animation Projectile.frameCounter++; if (Projectile.frameCounter > 9) { @@ -42,52 +42,50 @@ namespace CalamityMod.Projectiles.Magic Projectile.frameCounter = 0; } if (Projectile.frame >= 6) - { Projectile.frame = 0; - } - //Fade in + // Fade in if (Projectile.alpha > 5) Projectile.alpha -= 15; if (Projectile.alpha < 5) Projectile.alpha = 5; - //Rotation + // Rotation Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * Projectile.direction; - int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); - Main.dust[brimDust].noGravity = true; - Main.dust[brimDust].velocity *= 0.5f; - Main.dust[brimDust].velocity += Projectile.velocity * 0.1f; - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.05f / 255f, (255 - Projectile.alpha) * 0.05f / 255f); + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; - if (Projectile.localAI[0] == 0f) + Lighting.AddLight(Projectile.Center, 0.5f, 0f, 0f); + + var brimDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(32, 32), (int)CalamityDusts.Brimstone, null, 170, default, 1.1f); + brimDust.noGravity = true; + brimDust.velocity *= 0.5f; + brimDust.velocity += Projectile.velocity * 0.1f; + for (var i = 0; i < 1; i++) { - SoundEngine.PlaySound(BrimstoneElemental.HellfireballSound, Projectile.Center); - Projectile.localAI[0] += 1f; + CalamitasMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(2, 2), 64f); } + } - // Speed up as time goes on - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * (Projectile.velocity.Length() + 0.25f); + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, Projectile.alpha); } public override void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) - { - int fire = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.66f), Projectile.knockBack, Projectile.owner); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs deleted file mode 100644 index 7b73558e5a..0000000000 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class HellfireExplosionFriendly : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 130; - Projectile.height = 130; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Magic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0f); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.localAI[0] += 1f; - } - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - { - projTimer -= (Projectile.ai[0] - 180f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-10, 11); - float rando2 = (float)Main.rand.Next(-10, 11); - float rando3 = (float)Main.rand.Next(3, 9); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Dust dust = Main.dust[brimDust]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rando1; - dust.velocity.Y = rando2; - timerCounter++; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - } - } -} diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index dc4167d4af..e4bbcfa42f 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -69,7 +69,6 @@ namespace CalamityMod.Projectiles.Melee } else if (homeTracker == 1) { - int inc; Projectile.rotation -= MathHelper.Pi / 30f; Vector2 projCenter = Projectile.Center; float homingRange = 150f; diff --git a/Projectiles/Melee/OblivionBolt.cs b/Projectiles/Melee/OblivionBolt.cs new file mode 100644 index 0000000000..966ee0bca9 --- /dev/null +++ b/Projectiles/Melee/OblivionBolt.cs @@ -0,0 +1,99 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OblivionBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Boss/BurningBolt"; + public int time = 0; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 18; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ArmorPenetration = 20; + Projectile.penetrate = 3; + Projectile.timeLeft = 690; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (Projectile.velocity.Length() < Projectile.ai[2]) + { + Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() > Projectile.ai[2]) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.ai[2]; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + + if (Projectile.ai[0] == 2f) + { + if (Projectile.timeLeft > 570) + { + int player = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector = Main.player[player].Center - Projectile.Center; + float scaleFactor = Projectile.velocity.Length(); + vector.Normalize(); + vector *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; + } + } + + Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); + time++; + + var p = SeekersMetaball.SpawnParticle(Projectile.Center + Projectile.velocity * Projectile.MaxUpdates, Vector2.Zero, Terraria.GameContent.TextureAssets.Projectile[Type].Width() * Projectile.scale); + p.rotation = Projectile.rotation; + p.CurrentFrame = Projectile.frame; + p.MaxFrames = Main.projFrames[Type]; + p.TextureToUse = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + p.SizeScaling = 0f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Melee/OblivionFire.cs b/Projectiles/Melee/OblivionFire.cs new file mode 100644 index 0000000000..5d0da2e33e --- /dev/null +++ b/Projectiles/Melee/OblivionFire.cs @@ -0,0 +1,49 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OblivionFire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float Time => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.MaxUpdates = 4; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + Time++; + if (Time >= 100f) + CalamityUtils.HomeInOnNPC(Projectile, false, 300, 2.5f, 20f, true); + CalamitasMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(2, 2), 16f); + } + + public override bool? CanDamage() => Time >= 45f; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + } +} diff --git a/Projectiles/Melee/ScorpiusConstellation.cs b/Projectiles/Melee/ScorpiusConstellation.cs index b7bc4ae366..08c3f54aa1 100644 --- a/Projectiles/Melee/ScorpiusConstellation.cs +++ b/Projectiles/Melee/ScorpiusConstellation.cs @@ -6,7 +6,6 @@ using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -50,7 +49,6 @@ namespace CalamityMod.Projectiles.Melee var StarScale = 0.2f; Projectile.scale = 0.75f*MathF.Min(MathF.Pow((lifetime- Projectile.timeLeft)/ 20f,2f), 1f); Projectile.Opacity = MathF.Min(Projectile.timeLeft / 20f, 1f); - Vector2 ada = default; void SpawnStar(Vector2 offset, float intensity, int flashOffset = 0, int flashMod = 60) { offset += new Vector2(5, 49.25f); //this centers the constellation diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index 257a5f2c41..9be08ffd19 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -1,8 +1,15 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,6 +20,19 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 2; + //How many hits the yoyo has gotten. Starts at 1 to avoid a dividing by zero error + public int hitCounter = 1; + //20 hits to maximum + public int hitCountMax = 21; + public int time = 0; + //Used for visual intensity rising as the yoyo gets more hits + public float power = 0; + public float powerMax = 1; + //The grace period after the yoyo reaches max power to avoid insta-shattering + public int graceTimer = 0; + public bool shatter = false; + //Yoyo bag behavior + public bool cloneYoyo = false; public override void SetStaticDefaults() { @@ -33,21 +53,328 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.penetrate = -1; Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * MaxUpdates; + Projectile.localNPCHitCooldown = 15 * MaxUpdates; } public override void AI() { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 9f, 48f, 5, ModContent.ProjectileType(), 0.5, damageType: Projectile.DamageType); - if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + var player = Main.player[Projectile.owner]; + //Using yoyo glove or yoyo bag makes yoyos run out of air time 2-4x faster (randomized) when the second yoyo is out + //Therefore, we set the flight to infinite, but manually set it to recall after 15 seconds and update it across both yoyos + if (time >= 1800) + { + if (!cloneYoyo) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.Projectile.ai[0] = -1f; + } + } + } + } + } + // Determine if the yoyo is a yoyo bag/yoyo glove clone + if (!cloneYoyo) + { + int MainYoyo = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type && proj.owner == Projectile.owner) + { + MainYoyo = x; + break; + } + } + if (Projectile.whoAmI != MainYoyo) + cloneYoyo = true; + //Yoyo behavior. Nothing will trigger on yoyos from yoyo bag + + //Fireball spawning. Fire rate increases with how many hits the yoyo has gotten + if (time % (120 / hitCounter) == 0 && !shatter && Projectile.owner == Main.myPlayer) + { + float randRot = Main.rand.NextFloat(0, MathHelper.TwoPi); + Vector2 spawnVel = randRot.ToRotationVector2() * 2f; + Projectile flames = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, spawnVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.85f), Projectile.knockBack, Projectile.owner); + } + if (graceTimer > 0) + graceTimer--; + if (shatter) + { + //Constantly keep the yoyo out, even if the player lets go of the mouse + Projectile.ai[0] = 0f; + Projectile.Center = player.Calamity().mouseWorld; + //Charge up visuals + power += 0.01f; + float fade = Utils.GetLerpValue(powerMax + 2, 0, power); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Main.rand.NextBool() ? Color.Red : Color.MediumVioletRed); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, DustID.FireworksRGB, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = true; + dust.color = Color.DarkRed; + } + if (time == 240) + { + #region Visuals and Sounds + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i < 2; i++) + { + Particle centerVoid = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), (2.2f + i * 0.5f), 0f, 80, false); + GeneralParticleHandler.SpawnParticle(centerVoid); + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + Particle backBlast1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f, 18); + GeneralParticleHandler.SpawnParticle(backBlast1, false, GeneralDrawLayer.AfterEverything); + + Particle backBlast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f, 30); + GeneralParticleHandler.SpawnParticle(backBlast2, false, GeneralDrawLayer.AfterEverything); + + Particle backBlast3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f, 30); + GeneralParticleHandler.SpawnParticle(backBlast3, false, GeneralDrawLayer.AfterEverything); + + Particle ring1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion2", new Vector2(0.01f, 0.085f), MathHelper.PiOver2, -4f, 4f, 30); + GeneralParticleHandler.SpawnParticle(ring1); + + Particle ring2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), 0f, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring2); + + Particle ring3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), MathHelper.PiOver4, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring3); + + Particle ring4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), -MathHelper.PiOver4, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring4); + + for (int i = 0; i < 19; i++) + { + int dustStyle = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 2.2f); + dust.velocity = new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f); + dust.noGravity = true; + dust.color = Color.MediumVioletRed; + } + for (int i = 0; i < (25); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); + dust.noGravity = false; + dust.velocity = new Vector2(18, 18).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.color = Color.DarkRed; + } + Owner.SetScreenshake(6f); + SoundStyle boom = new("CalamityMod/Sounds/Custom/CalamitasClone/BulletHellEnd"); + SoundEngine.PlaySound(boom with { Volume = 1.5f }, Projectile.Center); + #endregion + if (Projectile.owner == Main.myPlayer) + { + float blastSize = 240; + float minMultiplier = 0.25f; + int hitsToMinMult = 3; + int debuff1 = ModContent.BuffType(); + int debufftime = 180; + //I promise this is balanced + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 50f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debufftime; + blast.timeLeft = 2; + blast.DamageType = Projectile.DamageType; + blast.CritChance = 100; + } + + //Set cooldown + player.Calamity().oblivionCooldown = 300; + int duration = CalamityUtils.SecondsToFrames(5); + player.AddCooldown(OblivionCooldown.ID, duration, true); + + //We manually kill the projectile to skip the retracting, to make it look like the yoyo is destroyed + //This needs to happen for both the main and secondary yoyo + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + p.Kill(); + } + } + } + } + } + //If the player gets more than 200 blocks away, kill the yoyo + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) Projectile.Kill(); + time++; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + //Only applies to the main yoyo + if (!cloneYoyo) + { + hitCounter++; + if (!shatter) + { + power += 0.05f; + SoundStyle onHit = new("CalamityMod/Sounds/Item/TearsOfHeavenUse"); + SoundEngine.PlaySound(onHit, Projectile.Center); + if (power > powerMax) + { + power = powerMax; + } + } + if (hitCounter == hitCountMax) + { + //Refresh duration on both yoyos + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.time = 0; + } + } + } + //Start a 1.5 second grace period where the yoyo cannot damage enemies. This is to avoid instant shattering after reaching max power + graceTimer = 90; + //Small burst and a ring of darts + if (Projectile.owner == Main.myPlayer) + { + int totalProjectiles = 18; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 8f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); + } + float blastSize = 120; + float minMultiplier = 0.25f; + int hitsToMinMult = -1; + int debuff1 = ModContent.BuffType(); + int debufftime = 180; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debufftime; + blast.timeLeft = 2; + blast.DamageType = Projectile.DamageType; + } + #region Visuals and Sounds + SoundStyle boom = new("CalamityMod/Sounds/Custom/CalamitasClone/CalClone_BigFireballBit", 4); + SoundEngine.PlaySound(boom with { Volume = 1.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.MediumVioletRed, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.12f + 0.005f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.DarkOrchid, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.12f + 0.01f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.2f, 2f, 24); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 1f, 24); + GeneralParticleHandler.SpawnParticle(innerGlow); + #endregion + } + //If the yoyo hits while at maximum, reset the duration of both yoyos and trigger shattering + if (hitCounter > hitCountMax && !shatter) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch with { Volume = 4f }, Projectile.Center); + Owner.SetScreenshake(3f); + shatter = true; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.time = 0; + } + } + } + } + } + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + + //During the grace period after reaching max power, the yoyo cannot hit enemies for 1.5s to avoid unfair shattering + public override bool? CanDamage() => graceTimer == 0; + + //Avoids instantly spawning a fireball + public override void OnSpawn(IEntitySource source) + { + time = 1; + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D shineTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + float rotationAngle = MathHelper.PiOver4; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + //Only applies to the main yoyo + if (!cloneYoyo) + { + //Red backglow, scales in size with power + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Red with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.3f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.MediumVioletRed with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.2f * randSize * power, SpriteEffects.None, 0); + + //X, scales in size with power + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Red with { A = 0 }, rotationAngle, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.75f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, rotationAngle, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.25f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Red with { A = 0 }, rotationAngle + MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.75f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, rotationAngle + MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.25f * randSize * power, SpriteEffects.None, 0); + + //Yoyo drawing + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + + //Red cross, doesn't scale in size unless shattering + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.DarkRed with { A = 0 }, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.DarkRed with { A = 0 }, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + + //Black backglow, scales in size with power + for (int i = 0; i < 2; i++) + { + Particle backglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.25f * (power * 2), 0f, 10, false); + GeneralParticleHandler.SpawnParticle(backglow); + backglow.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; + backglow.DrawLayer = Enums.GeneralDrawLayer.BeforeNPCs; + } + } + else + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/AbyssalFire.cs b/Projectiles/Ranged/AbyssalFire.cs index 039a95a092..f878da3300 100644 --- a/Projectiles/Ranged/AbyssalFire.cs +++ b/Projectiles/Ranged/AbyssalFire.cs @@ -1,20 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.DataStructures; -using CalamityMod.Dusts; -using CalamityMod.Effects; using CalamityMod.Enums; -using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Utilities.Daybreak; using CalamityMod.Utilities.Daybreak.Buffers; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -22,7 +16,6 @@ using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Ranged { @@ -153,15 +146,7 @@ namespace CalamityMod.Projectiles.Ranged } private float PrimitiveWidthFunction(float completionRatio, Vector2 vertexPos) { - float width; float maxBodyWidth = Projectile.scale * MaxLaserWidth * (1 + MathF.Pow(Utils.GetLerpValue(450, 500, VoidragonHoldout.ModProjectile().beamTimer, true), 3.5f) * 4); - float shrinkRatio = 0.018f; - - //if (completionRatio < shrinkRatio) - // width = MathF.Sin(completionRatio / shrinkRatio * MathHelper.PiOver2) * maxBodyWidth + shrinkRatio; - //else - // width = Utils.Remap(completionRatio, shrinkRatio, 1f, maxBodyWidth, 0f); - return maxBodyWidth * Utils.GetLerpValue(0f, 0.05f, completionRatio, true) * Utils.GetLerpValue(LaserLength, LaserLength - 0.1f, completionRatio, true); } diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index d10e45801b..f342548221 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,7 +16,6 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/FireProj"; public static int Lifetime => 60; - public static int Fadetime => 50; public ref float Time => ref Projectile.ai[0]; public int MistType = -1; @@ -29,13 +29,13 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() { Time++; - if (Time < Fadetime && Main.rand.NextBool(6)) + if (Main.rand.NextBool(6)) { Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); @@ -47,13 +47,21 @@ namespace CalamityMod.Projectiles.Ranged } cinder.noGravity = true; cinder.scale *= cinderSize * 1.2f; - cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); + cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Lifetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Lifetime * 0.1f, 0.1f, 1f); } if (MistType == -1) MistType = Main.rand.Next(3); Lighting.AddLight(Projectile.Center, 0.75f, 0.15f, 0.15f); + if (Projectile.timeLeft > Lifetime - 8) + return; + float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); + float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); + var p = CataclysmMetaball.SpawnParticle(Projectile.Center, Vector2.Zero, Terraria.GameContent.TextureAssets.Projectile[Type].Width() * fireSize); + p.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + p.TextureToUse = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + p.SizeScaling = 0.6f; } // Keeping the flames in place when hitting a block @@ -69,11 +77,7 @@ namespace CalamityMod.Projectiles.Ranged // Expanding hitbox public override void ModifyDamageHitbox(ref Rectangle hitbox) { - int size = (int)Utils.Remap(Time, 0f, Fadetime, 10f, 40f); - - // Shrinks again after fading - if (Time > Fadetime) - size = (int)Utils.Remap(Time, Fadetime, Lifetime, 40f, 0f); + int size = (int)Utils.Remap(Time, 0f, Lifetime, 10f, 40f); hitbox.Inflate(size, size); } @@ -87,68 +91,18 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 1200); // Gas up the enemy - int smokeCount = 3 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); + int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); for (int i = 0; i < smokeCount; i++) { - bool Smoketype = Main.rand.NextBool(); Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f); - Vector2 smokeVel = Vector2.UnitY * (Smoketype ? Main.rand.NextFloat(-0.8f, -2f) : Main.rand.NextFloat(-1.2f, -0.2f)) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); - Particle smoke = new MediumMistParticle(smokePos, smokeVel, new Color(255, 50, 50), Color.DimGray, Smoketype ? Main.rand.NextFloat(0.4f, 0.75f) : Main.rand.NextFloat(1.5f, 2f), 220 - Main.rand.Next(50), 0.1f); + Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); + Particle smoke = new MediumMistParticle(smokePos, smokeVel, Color.MediumVioletRed, Color.Purple, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } } public override bool PreDraw(ref Color lightColor) { - Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; - - // The conga line of colors to sift through - Color color1 = new Color(255, 110, 100, 200); - Color color2 = new Color(255, 50, 50, 70); - Color color3 = new Color(255, 100, 100, 100); - Color color4 = new Color(200, 35, 30, 100); - float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); - float vOffset = Math.Min(Time, 20f); - float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); - float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); - - if (timeRatio >= 1f) - return false; - - for (float j = 1f; j >= 0f; j -= length) - { - // Color - Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : - ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : - ((timeRatio < 0.35f) ? color2 : - ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : - ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : - Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); - fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); - Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); - - // Positions and rotations - Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; - float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; - float trailRot = MathHelper.PiOver4 - mainRot; - - // Draw one backtrail - Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; - Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); - - // Draw the main fire - Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); - - // Draw the masking smoke - if (MistType > 2 || MistType < 0) - return false; - Main.spriteBatch.SetBlendState(BlendState.Additive); - Rectangle frame = mist.Frame(1, 3, 0, MistType); - Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); - Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - } return false; } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index c285d8f872..76d5abf7f7 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/Boss/SignusScythe"; - private int originalDamage; - public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; diff --git a/Projectiles/Rogue/DuststormInABottleHoldout.cs b/Projectiles/Rogue/DuststormInABottleHoldout.cs index 194a525056..cac45d647a 100644 --- a/Projectiles/Rogue/DuststormInABottleHoldout.cs +++ b/Projectiles/Rogue/DuststormInABottleHoldout.cs @@ -20,8 +20,6 @@ namespace CalamityMod.Projectiles.Rogue public override int StartupTime { get; set; } public override int CooldownTime { get; set; } - bool isChannelable = false; - int explodeTimer = 0; public override void Defaults() diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 7d43617505..fc4e98f5c0 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -14,16 +14,19 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = Projectile.height = 4; + Projectile.width = Projectile.height = 6; Projectile.light = 0.5f; Projectile.alpha = 0; - Projectile.extraUpdates = 4; Projectile.scale = 1.18f; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.timeLeft = 600; Projectile.tileCollide = false; + Projectile.MaxUpdates = 6; + Projectile.penetrate = 5; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; AIType = ProjectileID.BulletHighVelocity; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index ccddc0d234..66d9de7a51 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -255,7 +255,7 @@ namespace CalamityMod.Projectiles.Summon //Increment attack cooldown if (Projectile.ai[1] > 0f) { - Projectile.ai[1]++; + Projectile.ai[1] += Main.rand.NextFloat(0.5f, 2f); } //Set the minion to be ready for attack if (Projectile.ai[1] > 60f) diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 69c063bd29..151eafd682 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -1,5 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using CalamityMod.Graphics.Metaballs; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Summon public class BrimstoneLaserSummon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -17,8 +18,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = Projectile.height = 10; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.CursedBullet; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 120; @@ -29,13 +28,23 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.5f, Projectile.Opacity * 0.05f, Projectile.Opacity * 0.05f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + CalamityUtils.HomeInOnNPC(Projectile, false, 300, 5.5f, 10f, true); + + if (Projectile.Calamity().HomingTarget < 0) + { + Projectile.velocity.Y += 0.025f; + } + + CalamitasMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(2, 2), 16f); + + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); - public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 50, Projectile.alpha); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Summon/BrimstoneLaserSummon.png b/Projectiles/Summon/BrimstoneLaserSummon.png deleted file mode 100644 index 9b0d2a4f50..0000000000 Binary files a/Projectiles/Summon/BrimstoneLaserSummon.png and /dev/null differ diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index 190e23a20c..c2dfc942ed 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -48,27 +48,23 @@ namespace CalamityMod.Projectiles.Summon public static int GetDust(float type) { - if (type >= 4f && Main.rand.NextBool(5)) + if (type >= 3f && Main.rand.NextBool(5)) return DustID.IchorTorch; - if (type >= 3f && Main.rand.NextBool(4)) - return DustID.VenomStaff; - if (type >= 2f && Main.rand.NextBool(3)) + if (type >= 2f && Main.rand.NextBool(5)) return DustID.CursedTorch; - return DustID.Torch; + return Main.rand.NextBool(4) ? DustID.VenomStaff : DustID.Torch; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire3, 60); + target.AddBuff(BuffID.OnFire3, 300); + target.AddBuff(BuffID.Venom, 300); if (MinionCount >= 2f) - target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(BuffID.CursedInferno, 300); if (MinionCount >= 3f) - target.AddBuff(BuffID.Venom, 60); + target.AddBuff(BuffID.Ichor, 300); if (MinionCount >= 4f) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(ModContent.BuffType(), 60); - } + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 300d9a1f3c..3bb152d00c 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon homeInVector.Normalize(); if (targetDist > 200f) { - float velocity = 6f; + float velocity = 10f; Projectile.velocity = (Projectile.velocity * 40f + homeInVector * velocity) / 41f; } else diff --git a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs index 14adef8764..4556370957 100644 --- a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon public const float SegmentDistance = 20; public static int FadeoutTime = 20; public static int ElectrifyTimer = 180; - public static float ZapDamageMultiplier = 0.5f; + public static float ZapDamageMultiplier = 1f; //Sounds public static readonly SoundStyle ZapSound = SoundID.Item94 with { Volume = SoundID.Item94.Volume * 0.5f }; diff --git a/Projectiles/Summon/EnchantedKnifeSummon.cs b/Projectiles/Summon/EnchantedKnifeSummon.cs index 9aa3853d86..aef98f6ded 100644 --- a/Projectiles/Summon/EnchantedKnifeSummon.cs +++ b/Projectiles/Summon/EnchantedKnifeSummon.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Projectiles.Summon } private Action _currentState; - private ref float DashTimer => ref Projectile.ai[0]; private ref float SwingTimer => ref Projectile.ai[1]; @@ -62,14 +61,21 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 32; } + public override bool? CanDamage() => SwingTimer >= SwingWait && SwingTimer <= SwingWait + SwingTime ? base.CanDamage() : false; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = MathHelper.Clamp(Utils.GetLerpValue(3, 0, Projectile.numHits), 0.25f, 1); + modifiers.SourceDamage *= damageMult; + } + #region AI public override void MinionAI() { if (!HasSpawned) { + IFrames = -1; TrailCacheLength = 4; - DashTimer = Main.rand.Next(30); Projectile.velocity = Projectile.DirectionFrom(Owner.Center); CurrentState = GoToOwnerState; HasSpawned = true; @@ -157,7 +163,7 @@ namespace CalamityMod.Projectiles.Summon if (SwingTimer == SwingWait + SwingTime * 0.5f && Main.myPlayer == Projectile.owner) { Vector2 spawnPosition = SwingCenter + predictiveDirection.SafeNormalize(-Vector2.UnitY) * 40f; - Projectile.NewProjectileDirect( + Projectile.NewProjectile( Projectile.GetSource_FromThis(), spawnPosition, predictiveDirection, @@ -166,14 +172,30 @@ namespace CalamityMod.Projectiles.Summon Projectile.knockBack, Projectile.owner); } - - if (DashTimer >= DashCooldown) + if ((SwingTimer == SwingWait && SwingDirection == 1) || (SwingTimer == SwingWait + SwingTime && SwingDirection == -1)) { - Vector2 dashVelocity = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, DashSpeed); + Projectile.ResetLocalNPCHitImmunity(); + Projectile.numHits = 0; + } + + if (Vector2.Distance(SwingCenter, Target.Center) > 48f + MathF.Min(Target.width, Target.height) * 0.8f) + { + Vector2 dashVelocity = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, ChaseSpeed); if (!float.IsNaN(dashVelocity.X) && !float.IsNaN(dashVelocity.Y)) Projectile.velocity = dashVelocity; - DashTimer = 0f; } + else if (Vector2.Distance(SwingCenter, Target.Center) < 40f + MathF.Min(Target.width, Target.height) * 0.5f) + { + Vector2 dashVelocity = CalamityUtils.CalculatePredictiveAimToTarget(SwingCenter, Target, RecoilSpeed); + if (!float.IsNaN(dashVelocity.X) && !float.IsNaN(dashVelocity.Y)) + Projectile.velocity = dashVelocity; + } + else + Projectile.velocity *= 0.5f; + + // Cancel out choppy movement + if (Projectile.velocity.Length() < 1f) + Projectile.velocity *= 0f; SwingTimer += 1f * SwingDirection; if (SwingTimer == 0f || SwingTimer == SwingWait + SwingTime + SwingWait) @@ -183,9 +205,6 @@ namespace CalamityMod.Projectiles.Summon else HasStartedSwinging = true; } - - if (Projectile.DistanceSQ(Target.Center) > 320f * 320f) - DashTimer += Main.rand.NextBool((int)DashCooldown) ? 2 : 1; } private void OnStateChange(Action newState) diff --git a/Projectiles/Summon/FrostBeam.cs b/Projectiles/Summon/FrostBeam.cs index 115b330c06..2d7284f8ca 100644 --- a/Projectiles/Summon/FrostBeam.cs +++ b/Projectiles/Summon/FrostBeam.cs @@ -24,12 +24,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 200; Projectile.coldDamage = true; Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 5f) + Projectile.localAI[0]++; + if (Projectile.localAI[0] > 2f && Projectile.ai[0] == 0f) { for (int i = 0; i < 6; i++) { @@ -43,33 +46,32 @@ namespace CalamityMod.Projectiles.Summon } } } - public override void OnKill(int timeLeft) + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 70; - Projectile.position -= Projectile.Size * 0.5f; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 3; - Projectile.Damage(); - int flowerPetalCount = Main.rand.Next(3, 5 + 1); - float thetaDelta = Projectile.velocity.ToRotation(); - float weaveDistanceMin = 2f; - float weaveDistanceOutwardMax = 3f; - float weaveDistanceInner = 0.5f; - for (float theta = 0f; theta < MathHelper.TwoPi; theta += 0.05f) + if (Projectile.ai[0] == 0f) { - Vector2 velocity = theta.ToRotationVector2() * + Projectile.ai[0]++; + Projectile.ExpandHitboxBy(128); + Projectile.Damage(); + int flowerPetalCount = Main.rand.Next(3, 5 + 1); + float thetaDelta = Projectile.velocity.ToRotation(); + float weaveDistanceMin = 2f; + float weaveDistanceOutwardMax = 3f; + float weaveDistanceInner = 0.5f; + for (float theta = 0f; theta < MathHelper.TwoPi; theta += 0.05f) + { + Vector2 velocity = theta.ToRotationVector2() * (weaveDistanceMin + // The 0.5 in here is to prevent the petal from looping back into itself. With a 0.5 addition, it is perfect, coming back to (0,0) // instead of weaving backwards. (float)(Math.Sin(thetaDelta + theta * flowerPetalCount) + 0.5f + weaveDistanceInner) * weaveDistanceOutwardMax); - Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.MushroomSpray, velocity); - dust.noGravity = true; - dust.scale = 1.35f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.MushroomSpray, velocity); + dust.noGravity = true; + dust.scale = 1.35f; + } + Projectile.Kill(); } } } diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 83cce4898f..1d5b62f0f9 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 9; Projectile.localAI[1]++; - if (Projectile.localAI[1] > 2) + if (Projectile.localAI[1] > 3) { Projectile.localAI[1] = 0; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] < 300f) Projectile.ai[1]++; - float delay = 60f - Projectile.ai[1] / 60f * 10f; + float delay = 60f - Projectile.ai[1] / 60f * 9f; if (Projectile.localAI[0] > delay) { Projectile.localAI[0] = 0f; diff --git a/Projectiles/Summon/MoonFist.cs b/Projectiles/Summon/MoonFist.cs index ca9f891814..b7fb680e86 100644 --- a/Projectiles/Summon/MoonFist.cs +++ b/Projectiles/Summon/MoonFist.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = -1; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 10; + Projectile.localNPCHitCooldown = -1; Projectile.netImportant = true; Projectile.timeLeft = 90000; Projectile.DamageType = DamageClass.Summon; @@ -122,13 +122,13 @@ namespace CalamityMod.Projectiles.Summon public void AttackTarget(NPC target) { - int reelBackTime = 32; - int homeDelay = 27; + int reelBackTime = 30; + int homeDelay = 15; int attackTime = 150; int attackCycleInterval = reelBackTime + attackTime; // Teleport to the enemy if it's far away. - if (!Projectile.WithinRange(target.Center, 1200f)) + if (!Projectile.WithinRange(target.Center, 960f)) { Vector2 teleportDestination = target.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(250f, 300f); DoTeleport(teleportDestination); @@ -145,11 +145,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = (int)Math.Round(MathHelper.Lerp(6f, 11f, AttackTimer / reelBackTime)); // Reel back and look at the target. - float hoverOffset = MathHelper.Lerp(200f, 480f, AttackTimer / reelBackTime); + float hoverOffset = MathHelper.Lerp(160f, 320f, AttackTimer / reelBackTime); hoverOffset += MathHelper.Lerp(-10f, 75f, Projectile.identity % 9f / 1f); float spin = MathHelper.Lerp(-0.27f, 0.27f, Projectile.identity / 7f % 1f); Vector2 hoverDestination = target.Center - target.SafeDirectionTo(target.Center, Vector2.UnitY).RotatedBy(spin) * hoverOffset; - Vector2 idealVelocity = Projectile.SafeDirectionTo(hoverDestination) * MathHelper.Min(25f, Projectile.Distance(hoverDestination)); + Vector2 idealVelocity = Projectile.SafeDirectionTo(hoverDestination) * MathHelper.Min(12f, Projectile.Distance(hoverDestination)); Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.02f); Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.03f).MoveTowards(idealVelocity, 0.5f); @@ -164,6 +164,8 @@ namespace CalamityMod.Projectiles.Summon } else if (DelayUntilNextPunch <= 0) { + Projectile.ResetLocalNPCHitImmunity(); + // Home towards the target briefly after the initial charge. if (AttackTimer >= reelBackTime + homeDelay) Projectile.velocity = Projectile.SuperhomeTowardsTarget(target, 34f, 24f); @@ -203,14 +205,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } - public override bool MinionContactDamage() => true; + public override bool MinionContactDamage() => DelayUntilNextPunch <= 0 && AttackTimer > 0f; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Rebound on collision. - if (DelayUntilNextPunch > 0 || AttackTimer <= 0f) - return; - // Create some cool particles to go with the hit. Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Hitbox.ClosestPointInRect(Projectile.Center), 0.5f); for (int i = 0; i < 7; i++) @@ -235,7 +233,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item74 with { Pitch = -0.36f }, Projectile.Center); DelayUntilNextPunch = WarloksMoonFist.PunchCooldownTime - 10; - Projectile.velocity = Projectile.SafeDirectionTo(target.Center, -Vector2.UnitY).RotatedBy(0.16f) * Projectile.velocity.Length() * -0.45f; + Projectile.velocity = Projectile.SafeDirectionTo(target.Center, -Vector2.UnitY).RotatedBy(0.16f) * Projectile.velocity.Length() * -0.3f; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs index d73745b2f2..80dabcd0bd 100644 --- a/Projectiles/Summon/PolypLauncherProjectile.cs +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon dust_splash += 1; } int split = 0; - int shardAmt = Main.rand.Next(1, 5); + int shardAmt = Main.rand.Next(2, 4); while (split < shardAmt) { //Calculate the velocity of the projectile diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs index 1c30e6c755..25e50d12c9 100644 --- a/Projectiles/Summon/PolypLauncherSentry.cs +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -52,22 +52,22 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] -= 1f; return; } - Projectile.ai[1] += Main.rand.Next(1, 3); + Projectile.ai[1]++; - NPC potentialTarget = Projectile.Center.MinionHoming(800f, player, false); + NPC potentialTarget = Projectile.Center.MinionHoming(400f, player, false); if (Projectile.owner == Main.myPlayer && potentialTarget != null) { - if (Projectile.ai[1] > 40f) + if (Projectile.ai[1] > 75f) { Vector2 spawnPosition = new Vector2(Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2)); float shootSpeed = 16f; float gravity = -PolypLauncherProjectile.Gravity; float distance = Vector2.Distance(spawnPosition, potentialTarget.Center); - float angle = 0.25f * (float)Math.Asin(MathHelper.Clamp(gravity * distance * 1.5f / (float)Math.Pow(shootSpeed, 2), -1f, 1f)); + float angle = 0.25f * MathF.Asin(MathHelper.Clamp(gravity * distance * 1.5f / MathF.Pow(shootSpeed, 2f), -1f, 1f)); - Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.1f); + Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.05f); velocity.X *= (potentialTarget.Center.X - Projectile.Center.X < 0).ToDirectionInt(); Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); diff --git a/Projectiles/Summon/RustyBeaconPulse.cs b/Projectiles/Summon/RustyBeaconPulse.cs index c8a403f834..2256e9fa3f 100644 --- a/Projectiles/Summon/RustyBeaconPulse.cs +++ b/Projectiles/Summon/RustyBeaconPulse.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56); - Projectile.scale = MathHelper.Lerp(0.5f, 7f, LifetimeCompletion); + Projectile.scale = MathHelper.Lerp(0.5f, 5f, LifetimeCompletion); Projectile.rotation += Projectile.localAI[0] * 0.012f; } diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 4435cc6f3d..3f8d7012ba 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; // Hover in place. - Projectile.velocity = -Vector2.UnitY * (float)Math.Sin(MathHelper.TwoPi * Projectile.timeLeft / 96f) * 3f; + Projectile.velocity = -Vector2.UnitY * MathF.Sin(MathHelper.TwoPi * Projectile.timeLeft / 96f) * 3f; // Look at nearby enemies. NPC potentialTarget = Projectile.Center.MinionHoming(1000f, Owner); @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = (Projectile.Center.X < potentialTarget.Center.X).ToDirectionInt(); // Release pulses of irradiated energy. - if (Projectile.timeLeft % RustyBeaconPrototype.PulseReleaseRate == RustyBeaconPrototype.PulseReleaseRate / 2) + if (Projectile.timeLeft % RustyBeaconPrototype.PulseReleaseRate == 1) { SoundEngine.PlaySound(SoundID.DD2_WitherBeastAuraPulse with { Volume = 1.6f }, Projectile.Center); diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index 1c8edf6dc0..c82622f6c3 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -21,18 +21,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; Projectile.minionSlots = 0f; Projectile.extraUpdates = 1; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; } + public override bool? CanDamage() => false; + public override void AI() { Player player = Main.player[Projectile.owner]; @@ -50,6 +47,7 @@ namespace CalamityMod.Projectiles.Summon return; } + Projectile.timeLeft = 2; NPC target = Projectile.Center.MinionHoming(SkeletalDragonMother.DistanceToCheck * 0.666f, player); if (target != null) diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 1d93cc03e1..7779c16e44 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 20; Projectile.minionSlots = 6f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; diff --git a/Rarities/BurnishedAuric.cs b/Rarities/BurnishedAuric.cs index dfbc5c0a2c..add6120cf8 100644 --- a/Rarities/BurnishedAuric.cs +++ b/Rarities/BurnishedAuric.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Rarities { public class BurnishedAuric : ModRarity { - // Burnished Auric is Rarity 15 (Once was known as Violet) + // Burnished Auric is the rarity for Post-Yharon gear + // It is a unique rarity and does not have its items rarity change on reforge. public override Color RarityColor => TextClr * 2f; public static float MaxY = 4.5f; diff --git a/Rarities/CalamityRed.cs b/Rarities/CalamityRed.cs index 9ea280216b..8b9d121ac2 100644 --- a/Rarities/CalamityRed.cs +++ b/Rarities/CalamityRed.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Rarities { public class CalamityRed : ModRarity { - // Calamity Red is Rarity 17 + // Calamity Red is the rarity for Post-SCal gear. It is considered the "same tier" as Exotic Rainbow for matters of sell value. + // It is a unique rarity and does not have its items rarity change on reforge. public override Color RarityColor => TextClr * 2f; public static float MaxY = 4.5f; diff --git a/Rarities/ColorTool.cs b/Rarities/ColorTool.cs index 45eb3a0820..4a5b029452 100644 --- a/Rarities/ColorTool.cs +++ b/Rarities/ColorTool.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Rarities public static int RarityBurnishedAuric => ModContent.GetInstance().Type; public static int RarityCalamityRed => ModContent.GetInstance().Type; public static int RarityExoticRainbow => ModContent.GetInstance().Type; + public static int RarityCustomDev => ModContent.GetInstance().Type; public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset) @@ -37,6 +38,11 @@ namespace CalamityMod.Rarities ExoticRainbow.Draw(Item, line); return false; } + if (Item.rare == RarityCustomDev) + { + HotPink.Draw(Item, line); + return false; + } } return true; } diff --git a/Rarities/CosmicPurple.cs b/Rarities/CosmicPurple.cs index 1c3e382f4a..d52a15a49c 100644 --- a/Rarities/CosmicPurple.cs +++ b/Rarities/CosmicPurple.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Rarities { public class CosmicPurple : ModRarity { - // Cosmic Purple is Rarity 14 (once was known as Dark Blue) + // Cosmic Purple is the rarity for Post-DoG gear. + // It is a unique rarity and does not have its items rarity change on reforge. public override Color RarityColor => TextClr * 2f; public static float MaxY = 4.5f; diff --git a/Rarities/DarkOrange.cs b/Rarities/DarkOrange.cs index 30959e183a..6526cfa05d 100644 --- a/Rarities/DarkOrange.cs +++ b/Rarities/DarkOrange.cs @@ -3,7 +3,9 @@ using Terraria.ModLoader; namespace CalamityMod.Rarities { - // Draedon's Arsenal "Rust" / "Bronze" rarity + // Dark Orange is used for Draedon's Arsenal items. + // It is a unique rarity and does not have its items rarity change on reforge. + public class DarkOrange : ModRarity { public override Color RarityColor => new Color(204, 71, 35); diff --git a/Rarities/ExoticRainbow.cs b/Rarities/ExoticRainbow.cs index cf065cc707..af47d1a2f2 100644 --- a/Rarities/ExoticRainbow.cs +++ b/Rarities/ExoticRainbow.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Rarities { public class ExoticRainbow : ModRarity { - // Exotic Rainbow is Rarity 17 (same as Calamity Red) + // Exotic Rainbow is the rarity for Post-SCal gear. It is considered the "same tier" as Calamity Red for matters of sell value. + // It is a custom rarity and does not have its items rarity change on reforge. public override Color RarityColor => TextClr * 2f; public static float MaxY = 4.5f; diff --git a/Rarities/HotPink.cs b/Rarities/HotPink.cs index 38dfd4abf9..1f915e2bae 100644 --- a/Rarities/HotPink.cs +++ b/Rarities/HotPink.cs @@ -1,21 +1,102 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; +using Terraria.UI.Chat; namespace CalamityMod.Rarities { public class HotPink : ModRarity { - // Hot Pink is Rarity 16 - public override Color RarityColor => new Color(255, 0, 255); + // Hot Pink is used for developer items. It Has a system built in for custom rarity effects. + // It is a unique rarity and does not have its items rarity change on reforge. + public override Color RarityColor => TextColor; + public static Color TextColor => new Color(255, 0, 255); - // Hot Pink cannot turn into other rarities via prefix - /*public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + public static Dictionary> CustomRarities = new() { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - };*/ + { ModContent.ItemType(), text => new TiredTailTextEffects(text) } + }; + public static Dictionary> CustomColors = new() + { + { ModContent.ItemType(), AngelicAlliance.RarityColor }, + { ModContent.ItemType(), Contagion.RarityColor }, + { ModContent.ItemType(), CrystylCrusher.RarityColor }, + { ModContent.ItemType(), TheDanceofLight.GetSyncedLightColor }, + { ModContent.ItemType(), DemonshadeHelm.DemonshadeRarityColor }, + { ModContent.ItemType(), DemonshadeHelm.DemonshadeRarityColor }, + { ModContent.ItemType(), DemonshadeHelm.DemonshadeRarityColor }, + { ModContent.ItemType(), DraconicDestruction.RarityColor }, + { ModContent.ItemType(), Earth.RarityColor }, + { ModContent.ItemType(), Endogenesis.RarityColor }, + { ModContent.ItemType(), Eternity.RarityColor }, + { ModContent.ItemType(), FlamsteedRing.RarityColor }, + { ModContent.ItemType(), IllustriousKnives.RarityColor }, + { ModContent.ItemType(), NanoblackReaper.RarityColor }, + { ModContent.ItemType(), ShatteredCommunity.GetRarityColor }, // Yes, this reuses Shattered Community's color + { ModContent.ItemType(), ProfanedSoulCrystal.RarityColor }, + { ModContent.ItemType(), RedSun.RarityColor }, + { ModContent.ItemType(), ScarletDevil.RarityColor }, + { ModContent.ItemType(), ShatteredCommunity.GetRarityColor }, + { ModContent.ItemType(), SomaPrime.RarityColor }, + { ModContent.ItemType(), StaffofBlushie.RarityColor }, + { ModContent.ItemType(), Svantechnical.RarityColor }, + { ModContent.ItemType(), Sylvestaff.RarityColor }, + { ModContent.ItemType(), TemporalUmbrella.RarityColor }, + { ModContent.ItemType(), TriactisTruePaladinianMageHammerofMight.RarityColor } + }; + + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + if (CustomColors.TryGetValue(Item.type, out var color)) // For items which use a custom item color, give them that custom color. + { + textColor = color.Invoke(); + } + TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray(); + + if (CustomRarities.ContainsKey(Item.type)) // For items in the custom rarity table, give them custom rarity effects. + { + for (int i = 0; i < snippets.Length; i++) + { + TextSnippet textSnippet = snippets[i]; + if (snippets[i].GetType() == typeof(TextSnippet)) + { + snippets[i] = CustomRarities[Item.type].Invoke(textSnippet.Text); + continue; + } + } + } + else + ChatManager.ConvertNormalSnippets(snippets); + + ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X, Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true); + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextColor), lightColor ?? Color.White, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + } } diff --git a/Rarities/PureGreen.cs b/Rarities/PureGreen.cs index 5752ae8335..b48cf7c502 100644 --- a/Rarities/PureGreen.cs +++ b/Rarities/PureGreen.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Rarities { -2 => ItemRarityID.Purple, -1 => ModContent.RarityType(), - _ => Type, // Cannot reach Cosmic Purple or Burnished Auric + _ => Type, // All higher rarities are unique, and so it cannot go up. }; } } diff --git a/Rarities/Turquoise.cs b/Rarities/Turquoise.cs index 27428d0c1a..a0e5eda2b4 100644 --- a/Rarities/Turquoise.cs +++ b/Rarities/Turquoise.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Rarities -2 => ItemRarityID.Red, -1 => ItemRarityID.Purple, 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), // Cannot reach Cosmic Purple + 2 => ModContent.RarityType(), // All higher rarities are unique, and so it cannot go up past Pure Green _ => Type, }; } diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 33b94b0f75..57c5e761e3 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Systems public override int NPCType => ModContent.NPCType(); public static int ProvidenceTrack => (int)CalamityMod.Instance.GetMusicFromMusicMod("Providence"); public static int SilenceTrack => MusicLoader.GetMusicSlot(CalamityMod.Instance, "Sounds/Music/Silence"); - public override int? MusicModMusic => ProvidenceSpawnState() < 180f && ProvUtils.StandardAI() ? SilenceTrack : ProvidenceTrack; + public override int? MusicModMusic => ProvidenceSpawnState() < 180f ? SilenceTrack : ProvidenceTrack; public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; public override void SpecialVisuals(Player player, bool isActive) { - if (ProvidenceSpawnState() == 180f && ProvUtils.StandardAI()) + if (ProvidenceSpawnState() == 180f) Main.musicFade[ProvidenceTrack] = 1f; } public static float ProvidenceSpawnState() diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 43d08c5de4..8dc2c08734 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -169,8 +169,13 @@ namespace CalamityMod.Systems.Collections ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + /// + /// If for an item type, this item is an accessory which uses a keybind for an active ability.
+ /// Used for assigning it one of the dedicated keybind slots based on slot order with other accessories that use keybinds.
+ /// Defaults to . + ///
public static bool[] HasAccessoryKeybind = Factory.CreateNamedSet("HasAccessoryKeybind") - .Description("Counts this item as having an accessory keybind. Used to detect which keybind goes to which accessory") + .Description("Counts this item as having an accessory keybind. Used for assigning which keybind goes to which accessory.") .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(),ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); } diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index ee239e25e2..6ba7f98fe0 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -115,8 +115,6 @@ namespace CalamityMod public static string CataclysmKilledLast = CalamityUtils.GetTextValue("Condition.Drops.CataclysmKilledLast"); public static string CatastropheKilledLast = CalamityUtils.GetTextValue("Condition.Drops.CatastropheKilledLast"); public static string CynosureText = CalamityUtils.GetTextValue("Condition.Drops.Cynosure"); - - public static string ProvidenceEnragedText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceEnraged"); public static string ProvidenceChallengeText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceChallenge"); #endregion diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 9b41cd6be3..a53da1a1f8 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -1,18 +1,11 @@ using System; -using System; -using System.Collections.Generic; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Reflection; using CalamityMod.Balancing; -using CalamityMod.Balancing; -using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Events; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; @@ -22,22 +15,17 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.Yharon; using CalamityMod.Packets; using CalamityMod.Systems.Collections; -using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using static Terraria.ModLoader.ModContent; namespace CalamityMod