diff --git a/Backgrounds/FloralParadiseBGStyle.cs b/Backgrounds/FloralParadiseBGStyle.cs deleted file mode 100644 index 9f987956f8..0000000000 --- a/Backgrounds/FloralParadiseBGStyle.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Backgrounds -{ - public class FloralParadiseBGStyle : ModUndergroundBackgroundStyle - { - public override void FillTextureArray(int[] textureSlots) - { - // Corresponds to underground jungle backgrounds. Something custom could probably be made, but for what it is it works sufficiently for the minibiome. - for (int i = 0; i <= 3; i++) - textureSlots[i] = i + 153; - } - } -} diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index 75987a1497..349576088c 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -10,49 +10,24 @@ namespace CalamityMod.Backgrounds private int SSBG2; private int SSBG3; - private int BGBG0; - private int BGBG1; - private int BGBG2; - private int BGBG3; - public override void SetStaticDefaults() { if (Main.dedServ) return; - SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - - BGBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - BGBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); - BGBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); - BGBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); + SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG0"); + SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG1"); + SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG2"); + SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG3"); } public override void FillTextureArray(int[] textureSlots) { - if (Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || - Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || - Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || - Main.LocalPlayer.InModBiome()) - { - textureSlots[0] = SSBG0; - textureSlots[1] = SSBG1; - textureSlots[2] = SSBG2; - textureSlots[3] = SSBG3; - } - if (!Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && - !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && - !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && - !Main.LocalPlayer.InModBiome()) - { - textureSlots[0] = BGBG0; - textureSlots[1] = BGBG1; - textureSlots[2] = BGBG2; - textureSlots[3] = BGBG3; - } + textureSlots[0] = SSBG0; + textureSlots[1] = SSBG1; + textureSlots[2] = SSBG2; + textureSlots[3] = SSBG3; + } } } diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index b8de0ce754..9588037dd2 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -182,15 +182,17 @@ namespace CalamityMod.Backgrounds Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, distortionShader.Shader, CalamityUtils.BackgroundMatrix); - const float distortionXSpeed = -0.012f; - const float distortionYSpeed = 0.02f; - const float noiseScale = 0.075f; - const float noiseStrength = 0.035f; - Vector2 timeOffset = new Vector2(distortionXSpeed, distortionYSpeed) * Main.GlobalTimeWrappedHourly * noiseScale; - Vector2 noiseScaleStrength = new Vector2(noiseScale, noiseStrength); - distortionShader.Shader.Parameters["timeOffset"].SetValue(timeOffset); - distortionShader.Shader.Parameters["noiseScaleStrength"].SetValue(noiseScaleStrength); - distortionShader.SetShaderTexture(distortionTexture); + float distortionXSpeed = -0.012f; + float distortionYSpeed = 0.02f; + float noiseScale = 0.075f; + float noiseStrength = 0.035f; + + distortionShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + distortionShader.Shader.Parameters["noiseScale"].SetValue(noiseScale); + distortionShader.Shader.Parameters["distortionStrength"].SetValue(noiseStrength); + distortionShader.Shader.Parameters["timeOffset"].SetValue(new Vector2(distortionXSpeed, distortionYSpeed)); + Main.graphics.GraphicsDevice.Textures[1] = distortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; Main.spriteBatch.Draw(WaterDistortionTarget.Target, new Rectangle(16, 16, Main.screenWidth, Main.screenHeight), Color.White); } diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 3bc64026d3..0c450ba4f3 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.NormalNPCs.HorribleHog; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; @@ -54,12 +55,22 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges = new List(); + // ENEMIES + #region Horrible Hog + // Take 300% damage from Finch Staff. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(3f, ProjectileID.BabyBird)))); + #endregion + + // BOSSES #region Crabulon // 20% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.8f))); #endregion #region Eater of Worlds + // 55% resist to Lemon 'nade + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); + // 50% resist to Demon Scythe. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); @@ -68,9 +79,6 @@ namespace CalamityMod.Balancing // 25% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(ResistTrueMelee(0.75f)))); - - // 40% resist to Lemon 'nade - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.60f, ProjectileType())))); #endregion #region Brain of Cthulhu: Creepers @@ -87,8 +95,8 @@ namespace CalamityMod.Balancing #endregion #region Wall of Flesh - // 40% resist to Corro/Crimslime Staff. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.WallofFleshEye, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType())))); + // 50% resist to Staff of Necrosteocytes. + NPCSpecificBalancingChanges.AddRange(Bundle(new List { NPCID.WallofFlesh, NPCID.WallofFleshEye }, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); #endregion #region Aquatic Scourge @@ -145,6 +153,10 @@ namespace CalamityMod.Balancing // 25% resist to The Ballista's greatarrows. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + + // 15% resist to Dryad's Tears. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType(), ProjectileType())))); + #endregion #region Duke Fishron @@ -198,6 +210,9 @@ namespace CalamityMod.Balancing // 75% resist to Plaguenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); + // 70% resist to Stardust Dragon Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); + // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(ResistTrueMelee(0.5f)))); @@ -207,12 +222,9 @@ namespace CalamityMod.Balancing // 50% resist to Charged Blaster Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.ChargedBlasterLaser)))); - //45% resist to Duststorm in a Bottle + // 45% resist to Duststorm in a Bottle. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType(), ProjectileType(), ProjectileType())))); - // 40% resist to Stardust Dragon Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - // 35% resist to Aerial Bane. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); @@ -262,9 +274,6 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dazzling Stabber Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Last Prism. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); @@ -279,11 +288,12 @@ namespace CalamityMod.Balancing // 35% resist to Event Horizon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); - #endregion - #region Old Duke - // 20% resist to Time Bolt. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.8f, ProjectileType()))); + // 35% resist to King of Constellations, Tenryu. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType())))); + + // 20% resist to Dazzling Stabber Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); #endregion #region The Devourer of Gods @@ -292,25 +302,18 @@ namespace CalamityMod.Balancing // 60% resist to Corinth Prime's grenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType())))); - + + // 50% resist to Stratus Sphere + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 35% resist to Sulphuric Acid Cannon's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 15% vulnerability to Time Bolt stealth strikes. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); #endregion The Devourer of Gods - #region Yharon - // 15% resist to The Old Reaper's stealth strike rain. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - - // 15% resist to Time Bolt. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - #endregion - #region Exo Mechs: Ares // 35% resist to Devil's Devastation's slash. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); @@ -372,6 +375,9 @@ namespace CalamityMod.Balancing // 45% resist to Wrathwing's stealth strike fireballs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + // 40% resist to Eclipse's Fall + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 40% resist to Omicron's beam. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); diff --git a/BiomeManagers/PolypForestBiome.cs b/BiomeManagers/PolypForestBiome.cs index 564264d40e..a3bdc5de94 100644 --- a/BiomeManagers/PolypForestBiome.cs +++ b/BiomeManagers/PolypForestBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class PolypForestBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaPolypWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/BiomeManagers/RadiantReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs index c613bfbf67..90455c46ad 100644 --- a/BiomeManagers/RadiantReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class RadiantReefsBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaReefsWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 02d7bf8488..88ad13e54e 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -4,6 +4,7 @@ using System; using Mono.Cecil.Cil; using MonoMod.Cil; using CalamityMod.Systems; +using Terraria.ID; namespace CalamityMod.BiomeManagers { @@ -11,7 +12,7 @@ namespace CalamityMod.BiomeManagers public class SunkenSeaBiome : ModBiome { public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override void Load() { //apply the drawblack edits here since all sunken sea biomes will have custom backgrounds @@ -63,8 +64,8 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 || - BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 200 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 200 || + BiomeTileCounterSystem.SunkenSeaReefsTiles > 200 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 200; } } } diff --git a/BiomeManagers/TimelessShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs index 66e93668fd..461599413f 100644 --- a/BiomeManagers/TimelessShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class TimelessShoresBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaShoresWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/Buffs/Alcohol/BaconOilBuff.cs b/Buffs/Alcohol/BaconOilBuff.cs index c2903d95b5..5d8408f271 100644 --- a/Buffs/Alcohol/BaconOilBuff.cs +++ b/Buffs/Alcohol/BaconOilBuff.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Buffs.Alcohol Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; CalamityBuffSets.DebuffDataset[Type] = debuffData; } diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index a5a4cd48d5..4ae1be4f13 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -40,11 +40,6 @@ namespace CalamityMod.Buffs { player.GetDamage() -= 0.1f; } - else if (type == BuffID.Clairvoyance) - { - player.GetDamage() -= 0.02f; - player.GetCritChance() -= 2; - } else if (type == BuffID.SugarRush) { player.moveSpeed -= 0.1f; 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/SeaKingsAssurance.cs b/Buffs/DamageOverTime/SeaKingsAssurance.cs deleted file mode 100644 index accaf0bf21..0000000000 --- a/Buffs/DamageOverTime/SeaKingsAssurance.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using CalamityMod.NPCs; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class SeaKingsAssurance : ModBuff - { - public static Color BaseColor => new Color(31, 78, 155); - public static Color LightColor => new Color(31, 108, 225); - public static void Apply(NPC npc, Vector2 orig) - { - int stacks = 1; - if (npc.HasBuff()) - { - int buffTimer = npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())]; - npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())] += FramesPerStack; - npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())] = ((int)Math.Ceiling((double)buffTimer / FramesPerStack) + 1) * FramesPerStack; - buffTimer = npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())]; - stacks += ((int)Math.Ceiling((double)buffTimer / FramesPerStack)); - } - else - { - npc.AddBuff(ModContent.BuffType(), FramesPerStack); - } - - npc.GetGlobalNPC().StackGlow = 1f; - npc.GetGlobalNPC().StackScale = 1.2f; - - SoundStyle style = new SoundStyle("CalamityMod/Sounds/Item/WaterSplash1"); - SoundEngine.PlaySound(style.WithPitchOffset(1f + ((float)stacks / 6f)).WithVolumeScale(0.2f)); - - float sc = 0.05f + ((float)stacks * 0.06f); - - for (int i = 0; i < 5; i++) - { - float rot = Main.rand.NextFloat(MathHelper.TwoPi) + MathHelper.PiOver2; - if (orig != Vector2.Zero) - { - rot = orig.AngleTo(npc.Center) + MathHelper.PiOver2; - } - - GeneralParticleHandler.SpawnParticle(new CustomPulse( - npc.Center, (rot - MathHelper.PiOver2).ToRotationVector2() * 6f, Color.Lerp(BaseColor, LightColor, sc * 3f), "CalamityMod/Particles/ForwardSmear", new Vector2(Main.rand.NextFloat(0.015f, 0.1f), 0.1f), - rot, sc, sc * 2f, 8 - )); - } - - float range = 20 + ((float)stacks * 15f); - - if (orig == Vector2.Zero) - { - foreach (NPC npc2 in Main.npc) - { - if (npc2 != npc) - { - if (npc2.active && !npc2.friendly && !npc2.isLikeATownNPC) - { - if (npc2.Distance(npc.Center) < range) - { - Apply(npc2, npc.Center); - } - } - } - } - } - } - - /// - /// The number of frames per stack of this buff. - /// For instance, if the buff has less than one of this number's worth of time left, - /// it will count as one stack. - /// - public static int FramesPerStack => 60; - public static SoundStyle ImpactSound => new SoundStyle("CalamityMod/Sounds/Item/WaterSplash1"); - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - BuffID.Sets.LongerExpertDebuff[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.buffTime[buffIndex] = Math.Min(npc.buffTime[buffIndex], 10 * FramesPerStack); - - npc.GetGlobalNPC().assuredStacks = (int)Math.Ceiling((double)(npc.buffTime[buffIndex] / FramesPerStack)); - } - } - - public class SeaKingsAssuranceNPC : GlobalNPC - { - public static readonly Asset Stacks = ModContent.Request("CalamityMod/ExtraTextures/AmidiasTrident_Stacks"); - - public override bool InstancePerEntity => true; - public int assuredStacks = 0; - public int StackFrame = 0; - public float StackRotation = 0f; - public float StackScale = 0f; - public float StackGlow = 0f; - public override void ResetEffects(NPC npc) - { - if (assuredStacks == 0) - { - StackScale *= 0.5f; - } - else - { - StackScale = MathHelper.Lerp(StackScale, 1f, 0.2f); - } - StackGlow *= 0.7f; - assuredStacks = 0; - base.ResetEffects(npc); - } - public override void DrawEffects(NPC npc, ref Color drawColor) - { - base.DrawEffects(npc, ref drawColor); - } - public override void UpdateLifeRegen(NPC npc, ref int damage) - { - } - public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - StackFrame = 0; - if (assuredStacks > 5) StackFrame = 1; - if (assuredStacks > 8) StackFrame = 2; - - Rectangle frame = Stacks.Frame(3, 1, StackFrame); - - if (StackFrame == 2) - { - StackRotation = MathHelper.Lerp(StackRotation, MathHelper.Pi, 0.2f); - } - else - { - StackRotation = MathHelper.Lerp(StackRotation, 0f, 0.1f); - } - - float offset = -28; - - for (int b = 0; b < CalamityGlobalNPC.moddedDebuffTextureList.Count; b++) - { - if (CalamityGlobalNPC.moddedDebuffTextureList[b].Item2.Invoke(npc)) - { - offset = -48; - } - } - - if (StackScale > 0.2f && assuredStacks > 2) - { - spriteBatch.Draw(Stacks.Value, npc.Top - Main.screenPosition + new Vector2(0, offset), frame, Color.White, StackRotation, frame.Size() / 2f, StackScale, SpriteEffects.None, 0f); - - for (int i = 0; i < 4; i++) - { - spriteBatch.Draw(Stacks.Value, npc.Top - Main.screenPosition + new Vector2(0, offset), frame, Color.White.MultiplyRGBA(new(StackGlow, StackGlow, StackGlow, 0f)), StackRotation, frame.Size() / 2f, StackScale, SpriteEffects.None, 0f); - } - } - else - { - StackRotation = 0f; - } - } - } -} diff --git a/Buffs/DamageOverTime/SeaKingsAssurance.png b/Buffs/DamageOverTime/SeaKingsAssurance.png deleted file mode 100644 index b7397c5c44..0000000000 Binary files a/Buffs/DamageOverTime/SeaKingsAssurance.png and /dev/null differ diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index 11edc8040c..960f716168 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -30,16 +30,11 @@ namespace CalamityMod.Buffs.DamageOverTime { owner = p.owner; projectileCount++; - if (projectileCount >= 5) - { - projectileCount = 5; - break; - } } } Item heldItem = Main.player[owner].HeldItem; - int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(debuffData.EnemyLostRegen); + int totalDamage = (int)npc.Calamity().ActiveTypelessDebuffMultiplier.ApplyTo(Main.player[owner].GetTotalDamage().ApplyTo(debuffData.EnemyLostRegen)); if (CalamityUtils.ShouldTriggerSummonPenalty(Main.player[owner], heldItem)) totalDamage = (int)(totalDamage * BalancingConstants.SummonerCrossClassNerf); 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/Cooldowns/Withered.cs b/Buffs/DamageOverTime/Withered.cs similarity index 91% rename from Buffs/Cooldowns/Withered.cs rename to Buffs/DamageOverTime/Withered.cs index 8bcf884976..603ed198cb 100644 --- a/Buffs/Cooldowns/Withered.cs +++ b/Buffs/DamageOverTime/Withered.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Buffs.Cooldowns +namespace CalamityMod.Buffs.DamageOverTime { public class Withered : ModBuff { diff --git a/Buffs/Cooldowns/Withered.png b/Buffs/DamageOverTime/Withered.png similarity index 100% rename from Buffs/Cooldowns/Withered.png rename to Buffs/DamageOverTime/Withered.png diff --git a/Buffs/Pets/BeldumBuff.cs b/Buffs/Pets/BeldumBuff.cs new file mode 100644 index 0000000000..7ee2658caa --- /dev/null +++ b/Buffs/Pets/BeldumBuff.cs @@ -0,0 +1,27 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class BeldumBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().beldum = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/Pets/BeldumBuff.png b/Buffs/Pets/BeldumBuff.png new file mode 100644 index 0000000000..610a378258 Binary files /dev/null and b/Buffs/Pets/BeldumBuff.png differ diff --git a/Buffs/Placeables/CorruptionEffigyBuff.png b/Buffs/Placeables/CorruptionEffigyBuff.png index c4e47d8cc1..d33ee8eb12 100644 Binary files a/Buffs/Placeables/CorruptionEffigyBuff.png and b/Buffs/Placeables/CorruptionEffigyBuff.png differ diff --git a/Buffs/Placeables/CrimsonEffigyBuff.png b/Buffs/Placeables/CrimsonEffigyBuff.png index 0fdde912e0..fe4f8b1fbf 100644 Binary files a/Buffs/Placeables/CrimsonEffigyBuff.png and b/Buffs/Placeables/CrimsonEffigyBuff.png differ diff --git a/Buffs/Potions/Soaring.cs b/Buffs/Potions/Soaring.cs index a9a75af3c5..f3b261e533 100644 --- a/Buffs/Potions/Soaring.cs +++ b/Buffs/Potions/Soaring.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Potions { public class Soaring : ModBuff { - public override LocalizedText Description => base.Description.WithFormatArgs(SoaringPotion.FlightBoost.ToPercent()); + public override LocalizedText Description => base.Description.WithFormatArgs(SoaringPotion.FlightTimeBoost.ToPercent()); public override void SetStaticDefaults() { diff --git a/Buffs/Potions/SwinesWrathBuff.cs b/Buffs/Potions/SwinesWrathBuff.cs index 873555d6c3..14ae221f5b 100644 --- a/Buffs/Potions/SwinesWrathBuff.cs +++ b/Buffs/Potions/SwinesWrathBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Potions; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ namespace CalamityMod.Buffs.Potions public class SwinesWrathBuff : ModBuff { public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); + public static readonly SoundStyle TimerSound2 = new("CalamityMod/Sounds/Custom/TickingTimerReverb"); public override void SetStaticDefaults() { @@ -33,10 +35,14 @@ namespace CalamityMod.Buffs.Potions { player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SwinesWrath" + Main.rand.Next(1, 7 + 1)).ToNetworkText(player.name)), 1000, -1); concoctionPlayer.swinesWrathCounter = -1; + concoctionPlayer.spamTimer = 0; } else if (concoctionPlayer.swinesWrathCounter % 60 == 59) - SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f) }, player.Center); // Gets louder as time progresses + { + SoundEngine.PlaySound(TimerSound2 with { Volume = MathF.Pow((600f - concoctionPlayer.swinesWrathCounter) / 600f, 2) * 0.8f, MaxInstances = -1 }, player.Center); // Gets louder as time progresses + SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f), MaxInstances = -1 }, player.Center); // Gets louder as time progresses + } } } } diff --git a/Buffs/StatBuffs/FortunesFavor.cs b/Buffs/StatBuffs/FortunesFavor.cs deleted file mode 100644 index 64b9d077ee..0000000000 --- a/Buffs/StatBuffs/FortunesFavor.cs +++ /dev/null @@ -1,48 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class FortunesFavor : ModBuff - { - public static int FortunesFavorRegenBoost = 3; - - public override LocalizedText Description => base.Description.WithFormatArgs(FortunesFavorRegenBoost.ToRegenPerSecond()); - - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().fortunesFavor = true; // Draw FX handled in CalamityPlayerDrawEffects as is standard for regen buffs - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().fortunesFavor = true; - } - - internal static void DrawEffects(NPC npc, ref Color drawColor) - { - Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); - - if (Main.rand.NextBool(16)) - { - Particle Plus = new HealingPlus(npcSize, Main.rand.NextFloat(0.3f, 0.5f), new Vector2(0, Main.rand.NextFloat(-2f, -3.5f)) + npc.velocity, Color.Gold, Color.Goldenrod, Main.rand.Next(9, 13)); - GeneralParticleHandler.SpawnParticle(Plus); - } - Lighting.AddLight(npc.Center, Color.Gold.ToVector3() * 0.1f); - } - - } -} diff --git a/Buffs/StatBuffs/FortunesFavor.png b/Buffs/StatBuffs/FortunesFavor.png deleted file mode 100644 index 4f8923c51f..0000000000 Binary files a/Buffs/StatBuffs/FortunesFavor.png and /dev/null differ diff --git a/Buffs/StatBuffs/FulfilledContract.cs b/Buffs/StatBuffs/FulfilledContract.cs new file mode 100644 index 0000000000..1134aa059e --- /dev/null +++ b/Buffs/StatBuffs/FulfilledContract.cs @@ -0,0 +1,21 @@ +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class FulfilledContract : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + Main.buffNoTimeDisplay[Type] = false; + } + } +} diff --git a/Buffs/StatBuffs/FulfilledContract.png b/Buffs/StatBuffs/FulfilledContract.png new file mode 100644 index 0000000000..e365757d90 Binary files /dev/null and b/Buffs/StatBuffs/FulfilledContract.png differ diff --git a/Buffs/StatBuffs/SmashedEvil.cs b/Buffs/StatBuffs/SmashedEvil.cs index 57f5c2ac60..2a67a162d9 100644 --- a/Buffs/StatBuffs/SmashedEvil.cs +++ b/Buffs/StatBuffs/SmashedEvil.cs @@ -1,10 +1,8 @@ using System; using CalamityMod.DataStructures; -using CalamityMod.Items.Accessories; -using Terraria; -using Terraria.Localization; -using Terraria.ModLoader; using CalamityMod.Systems.Collections; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { @@ -12,7 +10,7 @@ namespace CalamityMod.Buffs.StatBuffs { public static DebuffData debuffData = new DebuffData() { - EnemyLostRegen = 40, + EnemyLostRegen = 160, SicknessDebuffScaling = 1, HeatDebuffScaling = 1, ColdDebuffScaling = 1, @@ -39,7 +37,14 @@ namespace CalamityMod.Buffs.StatBuffs .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveWaterDebuffMultiplier, debuffData.WaterDebuffScaling) .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveElectricDebuffMultiplier, debuffData.ElectricDebuffScaling) )))); - totalDPS = totalScaling.ApplyTo(totalDPS); + + //Smashed Evil ignores Mult boosters for now to ignore weakness/resist. Once those systems are changed, return to using totalScaling instead of this mess. + StatModifier finalScaling = new(); + finalScaling += totalScaling.Additive - 1; + finalScaling.Base = totalScaling.Base; + finalScaling.Flat = totalScaling.Flat; + + totalDPS = finalScaling.ApplyTo(totalDPS); var totalDPSAdjusted = totalDPS - debuffData.EnemyVanillaRegenToCancelOut; npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS * debuffData.MultiplierDamageTickSize, debuffData.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); } @@ -53,9 +58,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.lifeRegenTime += 2; - player.GetDamage() += 0.1f; - player.moveSpeed += 0.2f; + player.lifeRegenTime += 4; + player.GetDamage() += 0.20f; } public override void Update(NPC npc, ref int buffIndex) 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/Buffs/Summon/SeashineSwordBuff.cs b/Buffs/Summon/BabyPaladinBuff.cs similarity index 68% rename from Buffs/Summon/SeashineSwordBuff.cs rename to Buffs/Summon/BabyPaladinBuff.cs index c45048954a..41a9ed1b88 100644 --- a/Buffs/Summon/SeashineSwordBuff.cs +++ b/Buffs/Summon/BabyPaladinBuff.cs @@ -3,10 +3,10 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SeashineSwordBuff : BaseSummonBuff + public class BabyPaladinBuff : BaseSummonBuff { - protected override int MinionProjectileType => ModContent.ProjectileType(); + protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff; + protected override ref bool MinionBool => ref BuffModdedOwner.sGod; } } diff --git a/Buffs/Summon/BabySlimeGodBuff.png b/Buffs/Summon/BabyPaladinBuff.png similarity index 100% rename from Buffs/Summon/BabySlimeGodBuff.png rename to Buffs/Summon/BabyPaladinBuff.png diff --git a/Buffs/Summon/BabySlimeGodBuff.cs b/Buffs/Summon/BlightedSlime.cs similarity index 57% rename from Buffs/Summon/BabySlimeGodBuff.cs rename to Buffs/Summon/BlightedSlime.cs index c596e06060..1455f3f3b1 100644 --- a/Buffs/Summon/BabySlimeGodBuff.cs +++ b/Buffs/Summon/BlightedSlime.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BabySlimeGodBuff : BaseSummonBuff + public class BlightedSlime : BaseSummonBuff { - protected override int MinionProjectileType => ModContent.ProjectileType(); + protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.sGod; + protected override ref bool MinionBool => ref BuffModdedOwner.blightedSlime; } } diff --git a/Buffs/Summon/Corroslime.png b/Buffs/Summon/BlightedSlime.png similarity index 100% rename from Buffs/Summon/Corroslime.png rename to Buffs/Summon/BlightedSlime.png diff --git a/Buffs/Summon/Crimslime.png b/Buffs/Summon/BlightedSlimeCrimson.png similarity index 100% rename from Buffs/Summon/Crimslime.png rename to Buffs/Summon/BlightedSlimeCrimson.png diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs deleted file mode 100644 index ca5b6d02ee..0000000000 --- a/Buffs/Summon/Corroslime.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class Corroslime : BaseSummonBuff - { - protected override int MinionProjectileType => ModContent.ProjectileType(); - - protected override ref bool MinionBool => ref BuffModdedOwner.cSlime; - } -} diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs deleted file mode 100644 index dc08297928..0000000000 --- a/Buffs/Summon/Crimslime.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class Crimslime : BaseSummonBuff - { - protected override int MinionProjectileType => ModContent.ProjectileType(); - - protected override ref bool MinionBool => ref BuffModdedOwner.cSlime2; - } -} diff --git a/Buffs/Summon/HotE.cs b/Buffs/Summon/HotE.cs index 3e8eae1f10..18f70d5b7a 100644 --- a/Buffs/Summon/HotE.cs +++ b/Buffs/Summon/HotE.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.allElementals) + if (!modPlayer.allElementals.HasValue) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/Summon/SeaSnailBuff.cs b/Buffs/Summon/SeaSnailBuff.cs index 0e33241c44..0068dd0252 100644 --- a/Buffs/Summon/SeaSnailBuff.cs +++ b/Buffs/Summon/SeaSnailBuff.cs @@ -1,12 +1,37 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SeaSnailBuff : BaseSummonBuff + public class SeaSnailBuff : ModBuff { - protected override int MinionProjectileType => ModContent.ProjectileType(); + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } - protected override ref bool MinionBool => ref BuffModdedOwner.victideSnail; + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.victideSnail = true; + } + + if (!modPlayer.victideSnail) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } } } diff --git a/Buffs/Summon/SeashineSwordBuff.png b/Buffs/Summon/SeashineSwordBuff.png deleted file mode 100644 index a7b9a06f29..0000000000 Binary files a/Buffs/Summon/SeashineSwordBuff.png and /dev/null differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 216a8a02a1..c0ded3f947 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -36,6 +36,7 @@ using CalamityMod.Items.Armor.TitanHeart; using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Dyes; +using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; @@ -68,7 +69,9 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; +using CalamityMod.Tiles.Abyss; using CalamityMod.Utilities; +using CalamityMod.Walls.UnsafeWalls; using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -324,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()); /// @@ -399,19 +403,15 @@ namespace CalamityMod.CalPlayer /// public int hInfernoBoost = 0; public int packetTimer = 0; - public int navyRodAuraTimer = 0; /// Timer variable used to time when Hydrothermic armor's set bonus inferno ring deals damage to targets. public int hydrothermicInfernoTimer = 0; /// Timer variable used to time when Tarragon armor's set bonus life aura deals damage to targets. public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 300; - /// Counter variable used to determine when to spawn Dragon Rage's fireballs. Fireballs are spawned after 10 hits. - public int dragonRageHits = 0; /// Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. public int dragonRageCooldown = 0; /// Counter variable which controls Aquatic Emblem's stat boosts while underwater. public float aquaticBoost = 0; - public int galileoCooldown = 0; /// Used to track Prideful Hunter's Planar Ripper's movement speed boost, along with its visual effects. public int planarSpeedBoost = 0; public int profanedSoulWeaponUsage = 0; @@ -600,6 +600,7 @@ namespace CalamityMod.CalPlayer public bool lordePet = false; public bool frostyBat = false; public bool toastyBat = false; + public bool beldum = false; public bool starSwallowerPetFroge = false; #endregion @@ -840,15 +841,11 @@ namespace CalamityMod.CalPlayer public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool aFossil = false; - public bool aPowder = false; public bool fallingBlockProtection = false; - public bool trapProtection = false; + public bool archaicPowder = false; public bool alluringBait = false; public bool enchantedPearl = false; - public bool fishingStation = false; public bool rBrain = false; - public bool bloodyWormTooth = false; - public bool ivDrip = false; /// NOT the primary Affliction variable, used instead for the Afflicted buff which is given to teammates. public bool afflicted = false; public bool chiRegen = false; @@ -862,13 +859,11 @@ namespace CalamityMod.CalPlayer public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; - public bool badgeOfBravery = false; public bool WarbanneroftheRighteous = false; public bool warbannerGlow = false; public float warbannerDamageMult = 0; public bool tesla = false; public bool teslaVisuals = true; - public bool cryogenSoul = false; public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; @@ -888,8 +883,6 @@ namespace CalamityMod.CalPlayer /// Feral Claws = 1, Power Glove = 2, Mechanical Glove = 3, Fire Gauntlet = 4, Elemental Gauntlet = 5 /// public int gloveLevel = 0; - public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking - public bool eTalisman = false; public bool lastDashWasTabi = false; public bool statisNinjaBelt = false; public bool voidSashVisuals = true; @@ -927,12 +920,8 @@ namespace CalamityMod.CalPlayer /// bool _hasNoNaturalRegen = false; public bool hadLifeRegenHinderingDebuff = false; - public bool alwaysHoneyRegen = false; - public float alwaysHoneyRegenAmount = 0; - public bool honeyTurboRegen = false; public bool honeyDew = false; public bool livingDew = false; - public int jewelBonusDefense = 0; /// /// Counter variable for spawning Toxic Heart's pulses.
/// Incremented on every frame by , and when it reaches 420, it is reset and a pulse is spawned. @@ -960,8 +949,6 @@ namespace CalamityMod.CalPlayer public bool sGlyph = false; public bool sRegen = false; public bool tracersDust = false; - public bool moonWalkers = false; - public bool voidStriders = false; public bool seraphTracers = false; public bool frostFlare = false; public bool evolution = false; @@ -971,9 +958,9 @@ namespace CalamityMod.CalPlayer public bool procDodgeEffects = false; public bool nanotech = false; public int nanotechHitCooldown = 0; - public bool deadshotBrooch = false; + public Item ammoCycleItem = null; public bool shadowMinions = false; - public bool holyMinions = false; + public bool statisMinions = false; public bool alchFlask = false; public bool toxicHeart = false; public bool toxicHeartVisuals = false; @@ -995,6 +982,7 @@ namespace CalamityMod.CalPlayer public bool fleshTotemVisual = false; public int fleshTotemManaStorage = 0; public bool bloodPact = false; + public bool CanBeCritByThePact = false; public bool bloodflareCore = false; public int bloodflareCoreRemainingHealOverTime = 0; @@ -1005,12 +993,9 @@ namespace CalamityMod.CalPlayer public int chaliceHitOriginalDamage = 0; public bool chaliceHeartStyle = false; - public bool elementalHeart = false; public bool crownJewel = false; public bool infectedJewel = false; public bool purity = false; - /// If true, reduces the damage of electricity debuffs by 50%. - public bool eleResist = false; public bool harpyRing = false; public bool angelTreads = false; /// Makes Flesh Knuckles and its upgrades increase the player's max health. @@ -1058,16 +1043,11 @@ namespace CalamityMod.CalPlayer public bool baroclaw = false; public bool IsFirstDashFrame = true; public int fallingBootVelCheckTimer = 0; - public bool voidOfCalamity = false; public bool apollyon = false; - public bool fragmentsOfAnotherWorld = false; public bool crushingEgo = false; public bool fadedIdolatry = false; public bool pSoulArtifact = false; public bool giantPearl = false; - public bool shieldOfTheOcean = false; - public int shieldOfTheOceanParry = 0; - public bool shieldOfTheOceanEmpoweredParry = false; public bool normalityRelocator = false; public bool flameLickedShell = false; public int flameLickedShellParry = 0; @@ -1087,27 +1067,27 @@ namespace CalamityMod.CalPlayer public bool ursaSergeant = false; public bool ursaSergeantVisual = false; public bool scuttlersJewel = false; - public int scuttlerCooldown = 0; public bool thiefsDime = false; public bool dynamoStemCells = false; public bool etherealExtorter = false; - public bool blazingCore = false; - public int blazingCoreParry = 0; - public int blazingCoreSuccessfulParry = 0; - public bool blazingCoreEmpoweredParry = false; + public Item AccessoryParryItem = null; + public bool divineProvidence = false; + public int divineProvParry = 0; + public int divineProvSuccessfulParry = 0; + public bool divineProvEmpoweredParry = false; public bool voltaicJelly = false; public bool jellyChargedBattery = false; /// General cooldown for accessories which spawn projectiles on minion hits. public float summonProjCooldown; - public bool sandElemental = false; + public bool? sandElemental = null; public bool sandElementalVanity = false; - public bool oasisElemental = false; + public bool? oasisElemental = null; public bool oasisElementalVanity = false; - public bool cloudElemental = false; + public bool? cloudElemental = null; public bool cloudElementalVanity = false; - public bool brimElemental = false; + public bool? brimElemental = null; public bool brimElementalVanity = false; - public bool waterElemental = false; + public bool? waterElemental = null; public bool waterElementalVanity = false; public bool fungalClump = false; public bool fungalClumpVanity = false; @@ -1123,7 +1103,6 @@ namespace CalamityMod.CalPlayer public int mageCrownTimer = 0; public int mageCrownCount = 0; public bool dragonScales = false; - public bool gloveOfPrecision = false; public bool gloveOfRecklessness = false; public bool vampiricTalisman = false; public bool electricianGlove = false; @@ -1135,7 +1114,7 @@ namespace CalamityMod.CalPlayer public bool spectralVeil = false; public int spectralVeilImmunity = 0; /// Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped. - public bool hasJetpack = false; + public Item rogueDashItem = null; public bool hasEngineDash = false; public bool plaguedFuelPack = false; public bool blunderBooster = false; @@ -1150,12 +1129,11 @@ namespace CalamityMod.CalPlayer public bool scionsCurioVisuals = false; public float scionsCurioDebuffDamage = 0; public bool frozenCube = false; + public bool frozenCubeVanity = false; public bool frozenCubeVisuals = false; public float frozenCubeDebuffBoost = 0; public float frozenCubeElumphantBoost = 0; public int frozenCubeUsedDefense = 0; - public bool miniOldDuke = false; - public bool miniOldDukeVanity = false; public bool starbusterCore = false; public bool starTaintedGenerator = false; public bool hallowedRune = false; @@ -1228,19 +1206,13 @@ namespace CalamityMod.CalPlayer public bool meteorSet = false; /// Calamity's Necro armor set bonus; gives a temporary 10 second revive when the player is killed before actually dying. public bool necroSet = false; - /// Calamity's Frost armor set bonus; gives a combined 20% damage boost split between melee and ranged based on distance from the closest enemy. + /// Calamity's Frost armor set bonus; gives a combined damage boost split between melee and ranged based on distance from the closest enemy. public bool frostSet = false; - public bool victideBarrierSet = false; - public int victideBarrierHeal = 0; - public bool victideBarrierHead = false; - public bool victideBurrowSet = false; - public bool victideBurrowHead = false; - public bool victideSnailSet = false; + public bool victideSet = false; + public bool victideSummoner = false; public bool sulphurSet = false; - public bool sulphurJump = false; public int sulphurBubbleCooldown = 0; public bool aeroSet = false; - public bool statigelSet = false; public bool tarraSet = false; public bool tarraMelee = false; public bool tarragonCloak = false; @@ -1258,13 +1230,12 @@ namespace CalamityMod.CalPlayer public bool bloodflareFrenzy = false; public int bloodflareMeleeHits = 0; public bool bloodflareRanged = false; - public bool bloodflareThrowing = false; public bool bloodflareMage = false; public int bloodflareMageCooldown = 0; public bool bloodflareSummon = false; public int bloodflareSummonTimer = 0; public bool godSlayer = false; - public bool godSlayerDamage = false; + public bool godSlayerMelee = false; public bool godSlayerRanged = false; public bool godSlayerThrowing = false; public bool godSlayerDashHotKeyPressed = false; @@ -1283,8 +1254,7 @@ namespace CalamityMod.CalPlayer public bool shadeRegen = false; /// Demonshade Greaves' movement speed boost. public bool shadowSpeed = false; - public bool dsSetBonus = false; - public bool auricSetMelee = false; + public bool demonshadeSet = false; public bool daedalusReflect = false; public bool daedalusSplit = false; public bool titanHeartSet = false; @@ -1295,7 +1265,6 @@ namespace CalamityMod.CalPlayer public bool reaverSpeed = false; public bool reaverDefense = false; public bool reaverExplore = false; - public bool fathomSwarmer = false; public bool fathomSwarmerVisage = false; public bool fathomSwarmerBreastplate = false; public bool fathomSwarmerTail = false; @@ -1305,7 +1274,6 @@ namespace CalamityMod.CalPlayer public int tailFrame = 0; public bool astralStarRain = false; public int astralStarRainCooldown = 0; - public int VoidCooldown = 0; public int ursaSergeantCooldown = 0; public int AlchFlaskCooldown = 0; public bool plagueReaper = false; @@ -1353,7 +1321,6 @@ namespace CalamityMod.CalPlayer /// Calamity's Adamantite armor set bonus; adds half of DR to crit chance, and makes landing hits give a stacking defense boost. public bool AdamantiteSet = false; public int AdamantiteSetDecayDelay = 0; - public int ChlorophyteHealDelay = 0; /// /// If true, the player is wearing a post-Moon Lord summoner armor set.
/// Currently unused. @@ -1468,7 +1435,6 @@ namespace CalamityMod.CalPlayer public bool purpleHaze = false; public int purpleHazeStealthTimer = 0; public bool mushy = false; - public bool fortunesFavor = false; public bool PinkJellyRegen = false; public bool GreenJellyRegen = false; public bool AbsorberRegen = false; @@ -1552,10 +1518,8 @@ namespace CalamityMod.CalPlayer public bool CalamarisLament = false; /// Entropy's Vigil. public bool cEyes = false; - /// Corroslime Staff. - public bool cSlime = false; - /// Crimslime Staff. - public bool cSlime2 = false; + /// Blighted Slime Staff. + public bool blightedSlime = false; /// Abandoned Slime Staff. public bool aSlime = false; public bool brittleStar = false; @@ -1586,14 +1550,14 @@ namespace CalamityMod.CalPlayer /// Enchanted Conch. public bool hCrab = false; /// Heart of the Elements. - public bool allElementals = false; + public bool? allElementals = null; /// Heart of the Elements; however, the minions will not attack. public bool allElementalsVanity = false; /// Silva armor's Silva Crystal. public bool sCrystal = false; /// Elemental in a Bottle. public bool sandEleBuff = false; - /// Rare Elemental in a Bottle. + /// Oasis Elemental in a Bottle. public bool oasisEleBuff = false; /// Eye of the Storm. public bool cloudEleBuff = false; @@ -1710,7 +1674,6 @@ namespace CalamityMod.CalPlayer public bool abyssDeath = false; public int abyssBreathCD; - public float caveDarkness = 0f; #endregion #region Transformation @@ -1727,11 +1690,9 @@ namespace CalamityMod.CalPlayer public bool aquaticHeartPrevious; public bool aquaticHeart; public bool snowmanNoseless; - public bool meldTransformationPrevious; public bool meldTransformation; public bool meldTransformationForce; public bool meldTransformationPower; - public bool omegaBlueTransformationPrevious; public bool omegaBlueTransformation; public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; @@ -2164,6 +2125,9 @@ namespace CalamityMod.CalPlayer if (crimEffigy) Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1f - CrimsonEffigy.MaxHealthLossPercent)); + if (CanBeCritByThePact) + Player.statLifeMax2 = (int)(Player.statLifeMax2 * ThePact.MaxLifeMult); + ResetRogueStealth(); calamityBonusLuck = 0f; @@ -2316,14 +2280,13 @@ namespace CalamityMod.CalPlayer lordePet = false; frostyBat = false; toastyBat = false; + beldum = false; starSwallowerPetFroge = false; onyxExcavator = false; rimehound = false; crysthamyr = false; ExoChair = false; - miniOldDuke = false; - miniOldDukeVanity = false; aquaticHeartWaterBuff = false; aquaticHeartIce = false; @@ -2340,7 +2303,7 @@ namespace CalamityMod.CalPlayer nebulousCore = false; godSlayer = false; - godSlayerDamage = false; + godSlayerMelee = false; godSlayerRanged = false; godSlayerThrowing = false; @@ -2349,8 +2312,6 @@ namespace CalamityMod.CalPlayer silvaSummon = false; auricSet = false; - auricSetMelee = false; - GemTechSet = false; CobaltSet = false; @@ -2377,7 +2338,7 @@ namespace CalamityMod.CalPlayer shadeRegen = false; shadowSpeed = false; - dsSetBonus = false; + demonshadeSet = false; wearingRogueArmor = false; blockAllDashes = false; @@ -2403,17 +2364,12 @@ namespace CalamityMod.CalPlayer protolithBangle = false; // Marble band protolithBangleVisual = false; aFossil = false; - aPowder = false; fallingBlockProtection = false; - trapProtection = false; + archaicPowder = false; alluringBait = false; enchantedPearl = false; - fishingStation = false; rBrain = false; - bloodyWormTooth = false; - ivDrip = false; vexation = false; - badgeOfBravery = false; // Clear the Warbanner "cooldown" if not wearing Warbanner. This has absolutely zero effect for a casual player, but is useful for resetting the cooldown's duration. if (!WarbanneroftheRighteous) cooldowns.Remove(WarbanneroftheRighteousBuff.ID); @@ -2444,10 +2400,9 @@ namespace CalamityMod.CalPlayer v8000Engine = false; nanotech = false; nanotechHitCooldown = 0; - deadshotBrooch = false; + ammoCycleItem = null; tesla = false; teslaVisuals = true; - cryogenSoul = false; ascendantInsignia = false; fishStocks = false; magmaStoneVisuals = true; @@ -2459,14 +2414,12 @@ namespace CalamityMod.CalPlayer statisNinjaBelt = false; if (Player.dashDelay != -1) statisVoidSash = false; - alreadyHasFrogLeg = false; - eTalisman = false; nucleogenesis = false; nuclearFuelRod = false; heartOfDarkness = false; profanedSoulRelicBuff = false; shadowMinions = false; - holyMinions = false; + statisMinions = false; alchFlask = false; toxicHeart = false; toxicHeartVisuals = false; @@ -2484,11 +2437,11 @@ namespace CalamityMod.CalPlayer fleshTotemVisual = false; fleshTotemMinion = false; bloodPact = false; + CanBeCritByThePact = false; bloodflareCore = false; chaliceOfTheBloodGod = false; chaliceHeartStyle = false; chaliceBleedoutToApplyOnHurt = 0; // Resets every frame so it doesn't improperly carry over between hits - elementalHeart = false; crownJewel = false; infectedJewel = false; purity = false; @@ -2498,14 +2451,11 @@ namespace CalamityMod.CalPlayer darkSunRing = false; crawCarapace = false; baroclaw = false; - voidOfCalamity = false; apollyon = false; - fragmentsOfAnotherWorld = false; crushingEgo = false; fadedIdolatry = false; pSoulArtifact = false; giantPearl = false; - shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; sPauldron = false; @@ -2523,8 +2473,6 @@ namespace CalamityMod.CalPlayer hallowedRegen = false; hallowedPower = false; tracersDust = false; - moonWalkers = false; - voidStriders = false; seraphTracers = false; ursaSergeant = false; ursaSergeantVisual = false; @@ -2532,7 +2480,8 @@ namespace CalamityMod.CalPlayer thiefsDime = false; dynamoStemCells = false; etherealExtorter = false; - blazingCore = false; + AccessoryParryItem = null; + divineProvidence = false; voltaicJelly = false; jellyChargedBattery = false; starbusterCore = false; @@ -2540,7 +2489,7 @@ namespace CalamityMod.CalPlayer camper = false; corrosiveSpine = false; scionsCurio = false; - frozenCube = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; + frozenCube = false; frozenCubeVanity = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; rottenDogTooth = false; angelicAlliance = false; ChaosStone = false; @@ -2614,18 +2563,12 @@ namespace CalamityMod.CalPlayer necroSet = false; frostSet = false; - victideBarrierSet = false; - victideBarrierHead = false; - victideBurrowSet = false; - victideBurrowHead = false; - victideSnailSet = false; + victideSet = false; + victideSummoner = false; sulphurSet = false; aeroSet = false; - - statigelSet = false; - titanHeartSet = false; titanHeartMask = false; titanHeartMantle = false; @@ -2633,7 +2576,6 @@ namespace CalamityMod.CalPlayer plagueReaper = false; plaguebringerPatronSet = false; plaguebringerCarapace = false; - fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; fathomSwarmerTail = false; @@ -2655,7 +2597,6 @@ namespace CalamityMod.CalPlayer bloodflareMelee = false; bloodflareFrenzy = false; bloodflareRanged = false; - bloodflareThrowing = false; bloodflareMage = false; bloodflareSummon = false; @@ -2671,7 +2612,6 @@ namespace CalamityMod.CalPlayer moonCrown = false; mageCrownVisibility = false; dragonScales = false; - gloveOfPrecision = false; gloveOfRecklessness = false; vampiricTalisman = false; electricianGlove = false; @@ -2679,7 +2619,7 @@ namespace CalamityMod.CalPlayer filthyGlove = false; sandCloak = false; spectralVeil = false; - hasJetpack = false; + rogueDashItem = null; hasEngineDash = false; plaguedFuelPack = false; blunderBooster = false; @@ -2785,7 +2725,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -2840,8 +2779,7 @@ namespace CalamityMod.CalPlayer cosmicViper = false; CalamarisLament = false; cEyes = false; - cSlime = false; - cSlime2 = false; + blightedSlime = false; aSlime = false; brittleStar = false; aquaticStar = false; @@ -2876,17 +2814,17 @@ namespace CalamityMod.CalPlayer cSpirit = false; dCrystal = false; MutatedTruffleBool = false; - sandElemental = false; + sandElemental = null; sandElementalVanity = false; - oasisElemental = false; + oasisElemental = null; oasisElementalVanity = false; - cloudElemental = false; + cloudElemental = null; cloudElementalVanity = false; - brimElemental = false; + brimElemental = null; brimElementalVanity = false; - waterElemental = false; + waterElemental = null; waterElementalVanity = false; - allElementals = false; + allElementals = null; allElementalsVanity = false; fungalClump = false; fungalClumpVanity = false; @@ -2981,10 +2919,8 @@ namespace CalamityMod.CalPlayer pscState = 0; pscLerpColor = Color.White; - meldTransformationPrevious = meldTransformation; meldTransformation = meldTransformationForce = meldTransformationPower = false; - omegaBlueTransformationPrevious = omegaBlueTransformation; omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; rageModeActive = false; @@ -3046,6 +2982,9 @@ namespace CalamityMod.CalPlayer #endregion #region Screen Position Movements + + float HalleyScopeLerp = 0; + bool HalleyToggle = false; public override void ModifyScreenPosition() { // CIT 08FEB2025: Photosensitivity config also disables screenshake @@ -3055,6 +2994,19 @@ namespace CalamityMod.CalPlayer Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); + + if (Player.HeldItem.type != ModContent.ItemType()) + HalleyToggle = false; + else if (Player.HeldItem.JustPressedKeybind()) + HalleyToggle = !HalleyToggle; + + HalleyScopeLerp = MathHelper.Clamp(HalleyScopeLerp + (HalleyToggle ? 0.05f : -0.05f), 0, 1); + if (HalleyScopeLerp > 0) + { + var screenSize = new Vector2(Main.screenWidth, Main.screenHeight); + Vector2 center = Main.screenPosition + screenSize * 0.5f; + Main.screenPosition -= (Vector2.Clamp((center - Main.MouseWorld) / screenSize, new(-0.5f), new(0.5f)) / Main.GameZoomTarget * MathHelper.SmoothStep(0, 1, HalleyScopeLerp)) * new Vector2(1920, 1200) * 0.9f; + } } #endregion @@ -3112,7 +3064,6 @@ namespace CalamityMod.CalPlayer arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; - galileoCooldown = 0; soundCooldown = 0; dogTextCooldown = 0; auralisStealthCounter = 0f; @@ -3141,7 +3092,6 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; rOfDelivarenceRam = false; astralStarRainCooldown = 0; - VoidCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; transformerCooldown = 0; @@ -3160,14 +3110,12 @@ namespace CalamityMod.CalPlayer externalColdImmunity = externalHeatImmunity = false; externalDefenseDamageImmunity = false; - dragonRageHits = 0; dragonRageCooldown = 0; spectralVeilImmunity = 0; jetPackDash = 0; jetPackDirection = 0; andromedaCripple = 0; theBeeCooldown = 0; - scuttlerCooldown = 0; mageCrownTimer = 0; wingProjectileCooldown = 0; hallowedRuneCooldown = 0; @@ -3300,7 +3248,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -3360,12 +3307,11 @@ namespace CalamityMod.CalPlayer miningSetCooldown = 0; shadowSpeed = false; godSlayer = false; - godSlayerDamage = false; + godSlayerMelee = false; godSlayerRanged = false; godSlayerThrowing = false; godSlayerDashHotKeyPressed = false; SpeedBlasterDashStarted = false; - auricSetMelee = false; silvaSet = false; silvaMage = false; silvaSummon = false; @@ -3379,7 +3325,6 @@ namespace CalamityMod.CalPlayer AdamantiteSet = false; WearingPostMLSummonerSet = false; AdamantiteSetDecayDelay = 0; - ChlorophyteHealDelay = 0; omegaBlueChestplate = false; omegaBlueSet = false; molluskHelmet = false; @@ -3398,13 +3343,12 @@ namespace CalamityMod.CalPlayer reaverDefense = false; reaverExplore = false; shadeRegen = false; - dsSetBonus = false; + demonshadeSet = false; titanHeartSet = false; titanHeartMask = false; titanHeartMantle = false; titanCooldown = 0; umbraphileSet = false; - fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; fathomSwarmerTail = false; @@ -3432,13 +3376,9 @@ namespace CalamityMod.CalPlayer meteorSet = false; necroSet = false; frostSet = false; - victideBarrierSet = false; - victideBarrierHead = false; - victideBurrowSet = false; - victideBurrowHead = false; + victideSet = false; aeroSet = false; sulphurSet = false; - statigelSet = false; tarraSet = false; tarraMelee = false; tarragonCloak = false; @@ -3454,7 +3394,6 @@ namespace CalamityMod.CalPlayer bloodflareFrenzy = false; bloodflareMeleeHits = 0; bloodflareRanged = false; - bloodflareThrowing = false; bloodflareMage = false; bloodflareSummon = false; bloodflareSummonTimer = 0; @@ -3463,11 +3402,9 @@ namespace CalamityMod.CalPlayer xerocSet = false; tracersDust = false; GemTechState.OnDeathEffects(); - shieldOfTheOceanParry = 0; - shieldOfTheOceanEmpoweredParry = false; - blazingCoreParry = 0; - blazingCoreEmpoweredParry = false; - blazingCoreSuccessfulParry = 0; + divineProvParry = 0; + divineProvEmpoweredParry = false; + divineProvSuccessfulParry = 0; flameLickedShellParry = 0; flameLickedShellEmpoweredParry = false; profanedCrystalAnim = -1; @@ -3551,7 +3488,7 @@ namespace CalamityMod.CalPlayer if (Player.dead) return; - if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) + if (ascendantInsignia && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && ascendantInsigniaCooldown <= 0) { var source = Player.GetSource_Accessory(FindAccessory()); Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType(), 0, 0f); @@ -3561,7 +3498,7 @@ namespace CalamityMod.CalPlayer } int numOfBlobs = Player.ownedProjectileCounts[ProjectileType()]; - if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && CalamityKeybinds.TransformerHotKey.JustPressed && transformerCooldown <= 0 && true) // Add check if projectiles are active + if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && transformerCooldown <= 0 && true) // Add check if projectiles are active { // Go fire all the blobs int cooldownTime = 300; @@ -3588,7 +3525,8 @@ namespace CalamityMod.CalPlayer } //Only increment the slam if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset slam time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.JustPressed && gSabatonHotkeyFallWindup < 0) + + if (gSabaton && FindAccessory().JustPressedKeybind() && gSabatonHotkeyFallWindup < 0) gSabatonHotkeyFallWindup = 0; if (gSabaton && gSabatonHotkeyFallWindup >= 0 && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { @@ -3634,7 +3572,7 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityKeybinds.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) + if (angelicAlliance && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) { Player.AddBuff(BuffType(), AngelicAlliance.DivineBlessDuration, false); SoundEngine.PlaySound(AngelicAlliance.ActivationSound, Player.Center); @@ -3644,7 +3582,7 @@ namespace CalamityMod.CalPlayer for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (proj.minionSlots <= 0f || !proj.CountsAsClass()) + if ((proj.minionSlots <= 0f && proj.type != ModContent.ProjectileType()) || !proj.CountsAsClass()) continue; if (proj.active && proj.owner == Player.whoAmI) @@ -3661,7 +3599,7 @@ namespace CalamityMod.CalPlayer Player.HealPlayer(AngelicAlliance.HealPerAngelSpawned); } } - if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (spectralVeil && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) { if (!Player.chaosState) @@ -3707,7 +3645,7 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityKeybinds.BoosterDashHotKey.JustPressed && hasJetpack && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (rogueDashItem != null && Main.myPlayer == Player.whoAmI && rogueDashItem.JustPressedKeybind() && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(RogueBooster.ID) && !Player.mount.Active) { jetPackDash = blunderBooster ? 15 : 10; @@ -3718,7 +3656,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item34, Player.Center); } - if (CalamityKeybinds.AmmoCycleHotkey.JustPressed && deadshotBrooch) + if (ammoCycleItem != null && ammoCycleItem.JustPressedKeybind()) { SoundEngine.PlaySound(SoundID.Item149, Player.Center); @@ -3817,9 +3755,9 @@ namespace CalamityMod.CalPlayer else ArmorSetBonusKeyHeldTimer = 0; - if (CalamityKeybinds.AccessoryParryHotKey.JustPressed) + if (AccessoryParryItem != null && AccessoryParryItem.JustPressedKeybind()) { - if (blazingCore && blazingCoreParry == 0 && blazingCoreSuccessfulParry == 0) + if (divineProvidence && divineProvParry == 0 && divineProvSuccessfulParry == 0) { //minor cheese prevention with standing on a spike with later game gear spamming parry :skull: //because of ordering, if they do not have the cooldown, it will not check the projectile array. Likewise if there are no bosses alive. @@ -3827,8 +3765,8 @@ namespace CalamityMod.CalPlayer if (!Player.HasCooldown(ParryCooldown.ID) || Player.ownedProjectileCounts[ProjectileType()] == 0) { Player.SetScreenshake(3.5f); - blazingCoreParry = 30; - SoundEngine.PlaySound(BlazingCore.ParryActivateSound, Player.Center); + divineProvParry = 30; + SoundEngine.PlaySound(DivineProvidence.ParryActivateSound, Player.Center); var mySourceIsIMadeItUp = Player.GetSource_FromThis(); int blazingSun = Projectile.NewProjectile(mySourceIsIMadeItUp, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); Main.projectile[blazingSun].Center = Player.Center; @@ -3845,12 +3783,6 @@ namespace CalamityMod.CalPlayer flameLickedShellParry = FlameLickedShell.flameLickedParry; } } - else if (shieldOfTheOcean && shieldOfTheOceanParry == 0) - { - Player.SetScreenshake(2f); - SoundEngine.PlaySound(ShieldoftheOcean.TriggerSound, Player.Center); - shieldOfTheOceanParry = ShieldoftheOcean.ParryTime; - } } // Trigger for pressing the God Slayer dash key @@ -4026,36 +3958,6 @@ namespace CalamityMod.CalPlayer public override void ArmorSetBonusActivated() { - // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. - if (victideBurrowSet) - { - if (cooldowns.TryGetValue(BubblyBurrow.ID, out CooldownInstance cd)) - { - // Return to normal if you have the ability active - if (cd.timeLeft > VictideHeadBurrow.BurrowCooldown) - { - cd.timeLeft = VictideHeadBurrow.BurrowCooldown + 1; - SyncCooldownDictionary(false); - } - } - else if (!Player.tongued && !Player.shimmering) - { - SoundEngine.PlaySound(SoundID.Item154, Player.Center); - if (Player.whoAmI == Main.myPlayer) - { - Player.AddCooldown(BubblyBurrow.ID, VictideHeadBurrow.BurrowCooldown + VictideHeadBurrow.BurrowDuration); - - var source = Player.GetSource_Misc("1"); - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI); - } - } - } - if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID)) - { - // Explosion and dash are handled in the VictideBarrier file - if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(WardingWave.ID, VictideHeadBarrier.BarrierCooldown); - } if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) { if (Player.whoAmI == Main.myPlayer) @@ -4151,7 +4053,7 @@ namespace CalamityMod.CalPlayer dust.velocity *= 6.6f; } } - if (dsSetBonus) + if (demonshadeSet) { SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center); for (int i = 0; i < 36; i++) @@ -4324,10 +4226,10 @@ namespace CalamityMod.CalPlayer { int foundX = -1; int foundY = -1; - bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; - int xSearchEnd = dungeonOnRightSide ? 20 : Main.maxTilesX - 20; + bool templeOnLeftSide = Main.dungeonX > Main.spawnTileX; + int xSearchEnd = templeOnLeftSide ? 20 : Main.maxTilesX - 20; - if (dungeonOnRightSide) + if (templeOnLeftSide) { for (int i = Main.spawnTileX; i >= xSearchEnd; i -= 2) { @@ -4369,9 +4271,9 @@ namespace CalamityMod.CalPlayer return null; int attempts = 25; - int rangeX = 300; - int rangeY = 300; - int randomFluff = 500; + int rangeX = 100; + int rangeY = 100; + int randomFluff = 400; Point finalTeleportPoint = Point.Zero; for (int i = 0; i < attempts; i++) { @@ -4379,13 +4281,13 @@ namespace CalamityMod.CalPlayer { for (int y = 0; y <= rangeY; y++) { - int teleportPosX = foundX + x + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosX = foundX + (templeOnLeftSide ? x : -x) + Main.rand.Next(-randomFluff, randomFluff); int teleportPosY = foundY + y + Main.rand.Next(-randomFluff, randomFluff); Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); - if (!tileAbove.HasTile && tileBelow.HasTile && tile.WallType == WallID.LihzahrdBrickUnsafe) + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && tile.WallType == WallID.LihzahrdBrickUnsafe) { finalTeleportPoint = new(tile.X(), tile.Y()); if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) @@ -4404,28 +4306,83 @@ namespace CalamityMod.CalPlayer ///
public static Vector2? GetAbyssVoidTeleportPosition(Player player) { - bool canSpawn = false; int halfWorldWidth = Main.maxTilesX / 2; - int abyssStartX = Abyss.AtLeftSideOfWorld ? halfWorldWidth - (halfWorldWidth - 135) + 35 : halfWorldWidth + (halfWorldWidth - 135) - 35; - int abyssXRange = 50; + int abyssEndX = Abyss.AtLeftSideOfWorld ? 0 : Main.maxTilesX; - int teleportStartY = Main.remixWorld ? SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f) : Main.maxTilesY - 300; - int teleportRangeY = 80; + int foundX = -1; + int foundY = -1; - Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + if (Abyss.AtLeftSideOfWorld) { - mostlySolidFloor = false, - avoidAnyLiquid = false, - avoidLava = true, - avoidHurtTiles = true, - avoidWalls = false, - attemptsBeforeGivingUp = 1000, - maximumFallDistanceFromOrignalPoint = 10 - }; + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = abyssStartX; x >= abyssEndX; x -= 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (tile.TileType == ModContent.TileType()) + { + foundX = x; + foundY = y; + break; + } + } - Vector2 teleportPosition = player.CheckForGoodTeleportationSpot(ref canSpawn, abyssStartX, abyssXRange, teleportStartY, teleportRangeY, settings); - return canSpawn ? teleportPosition : null; + if (foundY != -1) + break; + } + } + else + { + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = abyssStartX; x <= abyssEndX; x += 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (tile.TileType == ModContent.TileType()) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + + if (foundY == -1) + return null; + + int attempts = 25; + int rangeX = 100; + int rangeY = 200; + int randomFluff = 200; + Point finalTeleportPoint = new(foundX, foundY); + for (int i = 0; i < attempts; i++) + { + for (int x = 0; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + int teleportPosX = foundX + (Abyss.AtLeftSideOfWorld ? x : -x) + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = foundY - y + Main.rand.Next(-randomFluff, randomFluff); + Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); + Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); + Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); + + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && tile.WallType == ModContent.WallType()) + { + finalTeleportPoint = new(tile.X(), tile.Y()); + if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); } /// @@ -4437,20 +4394,20 @@ namespace CalamityMod.CalPlayer // Define an area around the center to search for a valid spot to tp int teleportStartX = WorldgenManagementSystem.DungeonArchivePos.X; int teleportStartY = WorldgenManagementSystem.DungeonArchivePos.Y; + bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; // Manually search for the Archives from the bottom of the world if the Archive position isn't saved. if (WorldgenManagementSystem.DungeonArchivePos == Point.Zero) { int foundX = -1; int foundY = -1; - bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; int xSearchStart = dungeonOnRightSide ? Main.maxTilesX - 20 : 20; if (dungeonOnRightSide) { - for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) { - for (int x = xSearchStart; x >= Main.maxTilesX / 2; x -= 2) + for (int x = xSearchStart; x >= Main.spawnTileX; x -= 2) { Tile tile = Framing.GetTileSafely(x, y); if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) @@ -4467,9 +4424,9 @@ namespace CalamityMod.CalPlayer } else { - for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) { - for (int x = xSearchStart; x <= Main.maxTilesX / 2; x += 2) + for (int x = xSearchStart; x <= Main.spawnTileX; x += 2) { Tile tile = Framing.GetTileSafely(x, y); if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) @@ -4492,24 +4449,25 @@ namespace CalamityMod.CalPlayer teleportStartY = foundY; } + int attempts = 25; - int rangeX = 100; - int rangeY = 200; - int randomFluff = 60; + int rangeX = 50; + int rangeY = 50; + int randomFluff = 20; Point finalTeleportPoint = Point.Zero; for (int i = 0; i < attempts; i++) { - for (int x = -rangeX; x <= rangeX; x++) + for (int x = 0; x <= rangeX; x++) { for (int y = 0; y <= rangeY; y++) { - int teleportPosX = teleportStartX + x + Main.rand.Next(-randomFluff, randomFluff); - int teleportPosY = teleportStartY + y + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosX = teleportStartX + (dungeonOnRightSide ? -x : x) + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = teleportStartY - y + Main.rand.Next(-randomFluff, randomFluff); Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); - if (!tileAbove.HasTile && tileBelow.HasUnactuatedTile && Main.wallDungeon[tile.WallType]) + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && Main.tileDungeon[tile.TileType] && Main.wallDungeon[tile.WallType]) { finalTeleportPoint = new(tile.X(), tile.Y()); if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) @@ -4878,7 +4836,7 @@ namespace CalamityMod.CalPlayer Player.velocity.Y = 0.5f; } else - Player.velocity.Y = 0f; + Player.velocity.Y = 1E-05f; if (CalamityKeybinds.ExoChairSlowdownHotkey.Current) Player.velocity *= 0.5f; @@ -5264,6 +5222,15 @@ namespace CalamityMod.CalPlayer if (Player.chiselSpeed) Player.pickSpeed += 0.1f; + // Prevent Archaic Powder mining speed from stacking with Ancient Chisel or Ancient Fossil + if (archaicPowder) + { + if (Player.chiselSpeed) + Player.pickSpeed += 0.15f; + if (aFossil) + Player.pickSpeed += AncientFossil.MiningSpeedBoost; + } + if (oceanCrest) { bool surface = Player.Center.Y < Main.worldSurface * 16.0; @@ -5387,7 +5354,7 @@ namespace CalamityMod.CalPlayer EnhancedDarknessSystem.lights.Add(new(lastDeerclopsPosition.Value, scale: DeerclopsAI.borderScale, texture: DeerclopsAI.ArenaTex.Value)); //we draw light around the player when far away so they have some visibility, although very small. This is especially nice in multiplayer. we scale opacity with distance bc it looks better - EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(scale: 0.75f, opacity: MathHelper.Clamp(Main.LocalPlayer.DistanceSQ(lastDeerclopsPosition.Value) / (409600 /*640^2*/), 0, 1))); + EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(scale: 0.75f, opacity: MathHelper.Clamp(Main.LocalPlayer.DistanceSQ(lastDeerclopsPosition.Value) / 409600, 0, 1))); if (darknessIntensity == 0) { @@ -5475,7 +5442,6 @@ namespace CalamityMod.CalPlayer if (!Player.mount.Active) { float runAccMult = 1f + - (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + @@ -5492,11 +5458,9 @@ namespace CalamityMod.CalPlayer (statisVoidSash ? 0.85f : 0f) + (blueCandle ? WeightlessCandle.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - //(exaltedKillMode ? 7f : devilsDevastationKillMode ? 11f : 0) + (hasteLevel * 0.05f); float runSpeedMult = 1f + - (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + @@ -5507,7 +5471,6 @@ namespace CalamityMod.CalPlayer (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - //(exaltedKillMode ? 0.4f : devilsDevastationKillMode ? 0.7f : 0) + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) @@ -5526,10 +5489,15 @@ namespace CalamityMod.CalPlayer else momentumCapacitorBoost = 0f; - if (victideBarrierHead) + if (Player.HasBuff()) { - Player.runAcceleration *= VictideHeadBarrier.RunAccelerationMult; - Player.runSlowdown *= VictideHeadBarrier.RunAccelerationMult; + runAccMult += 0.25f; + Player.runSlowdown *= 1.5f; + if (Player.accRunSpeed > 3) + Player.accRunSpeed += 1.1f; + if (Player.wingAccRunSpeed > 3) + Player.wingAccRunSpeed += 1.1f; + Player.maxRunSpeed += 1.1f; } Player.runAcceleration *= runAccMult; @@ -5842,7 +5810,7 @@ namespace CalamityMod.CalPlayer rainbow.noGravity = true; } } - if (dsSetBonus) + if (demonshadeSet) { if (Main.rand.NextBool(3)) { @@ -6118,7 +6086,10 @@ namespace CalamityMod.CalPlayer float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size * 0.4f; if (ProfanedMoonlightAuroraDrawer is null || ProfanedMoonlightAuroraDrawer.Size != size) + { + ProfanedMoonlightAuroraDrawer?.Dispose(); ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); + } int sourceArea = (int)Math.Ceiling(6f / ProfanedMoonlightAuroraDrawer.Scale) + 1; ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 2 == 0; @@ -6404,11 +6375,14 @@ namespace CalamityMod.CalPlayer if (it.type == ItemType()) playerUsingWeapon = false; + if (it.type == ItemType()) + playerUsingWeapon = false; + // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime ? Player.itemAnimation == Player.itemAnimationMax - 1 // Standard weapon (first frame of use animation) - : Player.itemTime == (int)(it.useTime / Player.GetAttackSpeed()); // Clockwork weapon (first frame of any individual use event) + : Player.itemTime == (int)(it.useTime / Player.GetTotalAttackSpeed()); // Clockwork weapon (first frame of any individual use event) if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) { diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 538ffc89ef..a3d0628a15 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -40,14 +40,7 @@ namespace CalamityMod.CalPlayer PlayerDrawLayers.Shoes.Hide(); } - if (drawInfo.drawPlayer.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - foreach (var layer in PlayerDrawLayerLoader.Layers) - { - layer.Hide(); - } - } - else if (drawInfo.drawPlayer.Calamity().andromedaState != AndromedaPlayerState.Inactive) + if (drawInfo.drawPlayer.Calamity().andromedaState != AndromedaPlayerState.Inactive) { foreach (var layer in PlayerDrawLayerLoader.Layers) { @@ -438,7 +431,7 @@ namespace CalamityMod.CalPlayer #region Armor Visuals // Demonshade Armor - if (calamityPlayer.dsSetBonus && drawInfo.shadow == 0f) + if (calamityPlayer.demonshadeSet && drawInfo.shadow == 0f) { if (Player != null && !Player.dead) { @@ -589,16 +582,6 @@ namespace CalamityMod.CalPlayer WindChilled.DrawEffects(drawInfo); #endregion - if (calamityPlayer.fortunesFavor && drawInfo.shadow == 0f) - { - if (Main.rand.NextBool(12)) - { - Vector2 plusPos = new Vector2(Player.position.X + Main.rand.NextFloat(-8f, 20f), Player.position.Y + Main.rand.NextFloat(-14f, 36f)); - - Particle Plus = new HealingPlus(plusPos, Main.rand.NextFloat(0.33f, 0.66f), new Vector2(0, Main.rand.NextFloat(-2f, -3.5f)) + Player.velocity, Color.Gold, Color.Goldenrod, Main.rand.Next(9, 13)); - GeneralParticleHandler.SpawnParticle(Plus); - } - } if (calamityPlayer.PinkJellyRegen && drawInfo.shadow == 0f) { if (Main.rand.NextBool(24)) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 853c12fbae..048734291e 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -170,10 +170,6 @@ namespace CalamityMod.CalPlayer else itemDrop = ModContent.ItemType(); } - if (ZoneBasaltGully) - { - itemDrop = ModContent.ItemType(); - } return; } @@ -327,6 +323,17 @@ namespace CalamityMod.CalPlayer itemDrop = ModContent.ItemType(); } + // Lower chance of Spadefish in Hardmode and/or when already having a spadefish + if (underground) // Underground + { + bool validattempt = Player.HasItemInInventoryOrOpenVoidBag(ModContent.ItemType()) ? attempt.veryrare : attempt.rare; + int chance = Main.hardMode ? 10 : 4; + if (validattempt && Main.rand.NextBool(chance)) + { + itemDrop = ModContent.ItemType(); + } + } + if (ZoneAstral) { if (attempt.legendary) @@ -360,14 +367,6 @@ namespace CalamityMod.CalPlayer if (Player.ZoneDesert && Main.rand.NextBool()) return; - int commonCatch = ModContent.ItemType(); - if (ZonePolypForest) - commonCatch = ModContent.ItemType(); - else if (ZoneGleamingBurrows) - commonCatch = ModContent.ItemType(); - else if (ZoneTimelessShores) - commonCatch = ModContent.ItemType(); - if (attempt.legendary) { List legendaryCatches = @@ -401,7 +400,7 @@ namespace CalamityMod.CalPlayer else if (Main.rand.NextBool()) // 50% chance the common fish is replaced with driftwood itemDrop = ModContent.ItemType(); else - itemDrop = commonCatch; + itemDrop = ModContent.ItemType(); return; } // There is no complete fishing pool here, so most of it is vanilla default diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index ed3d0c1c42..6703ccd155 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,14 +1,12 @@ using System; using System.Linq; using CalamityMod.Balancing; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; -using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Events; @@ -25,7 +23,6 @@ using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Sulphurous; using CalamityMod.Items.Armor.Tarragon; -using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; @@ -146,7 +143,7 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - + #endregion #region Pre Kill @@ -209,9 +206,9 @@ namespace CalamityMod.CalPlayer chaliceBleedoutBuffer = 0D; chaliceDamagePointPartialProgress = 0D; } - Player.HealPlayer(100); + Player.HealPlayer(Items.Accessories.NebulousCore.HealLifeOnRevive); - Player.AddCooldown(Cooldowns.NebulousCore.ID, CalamityUtils.SecondsToFrames(90)); + Player.AddCooldown(Cooldowns.NebulousCore.ID, Items.Accessories.NebulousCore.ReviveCooldown); return false; } @@ -282,17 +279,11 @@ namespace CalamityMod.CalPlayer // Custom Death Messages + #region DoT Sources if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { - if (fishStocks && fishStockPower < 0) - { - string year = DateTime.Now.ToString("yy"); - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FishStocks" + Main.rand.Next(1, 6 + 1)).ToNetworkText(Player.name, year)); - } if (alcoholPoisoning) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholBig" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (vHex) { // Unique messages appear half the time during each individual stage of SCal's fight @@ -314,13 +305,9 @@ namespace CalamityMod.CalPlayer damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(vHexKeyToUse).ToNetworkText(Player.name)); } if (ZoneCalamity && Player.lavaWet) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SearingLava" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (godSlayerInferno) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.GodSlayerInferno" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (sulphurPoison) { if (!Main.rand.NextBool(4)) // 75% custom @@ -329,123 +316,84 @@ namespace CalamityMod.CalPlayer damageSource = PlayerDeathReason.ByOther(9); // 25% generic Poisoned death text } if (dragonFire) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Dragonfire" + Main.rand.Next(1, 4 + 1)).ToNetworkText(Player.name)); - } if (vermillionFlux) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.VermillionFlux" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (auricRebuke) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRebuke" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (staticDischarge) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.StaticDischarge" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (miracleBlight) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.MiracleBlight" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (holyInferno) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyInferno").ToNetworkText(Player.name)); - } if (holyFlames || banishingFire) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (shadowflame) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Shadowflame").ToNetworkText(Player.name)); - } if (daybroken) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Daybroken").ToNetworkText(Player.name)); - } if (burningBlood) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BurningBlood" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (brainRot) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (heavybleeding) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HeavyBleeding" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (laceration) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (elementalMix) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (crushDepth) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CrushDepth" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (riptide) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Riptide" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (hadopelagicPressure) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HadopelagicPressure" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (brimstoneFlames || weakBrimstoneFlames || demonicFlames) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrimstoneFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (plague) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Plague" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (astralInfection) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInfection" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (nightwither) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Nightwither").ToNetworkText(Player.name)); - } if (vaporfied) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Vaporfied").ToNetworkText(Player.name)); - } if (manaOverloader || ManaBurn) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").ToNetworkText(Player.name)); - } if (witheredDebuff) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").ToNetworkText(Player.name)); - } } + #endregion + + #region Item Sources if (profanedCrystalBuffs && Player.Transformation().Type == ModContent.ItemType()) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProfanedSoulCrystal").ToNetworkText(Player.name)); + + if (fishStocks && fishStockPower < 0) + { + string year = DateTime.Now.ToString("yy"); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FishStocks" + Main.rand.Next(1, 6 + 1)).ToNetworkText(Player.name, year)); } - // Leon Death Noise RE4 - if (Main.zenithWorld) - SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); + if (damageSource.TryGetCausingEntity(out var Entity) && Entity is Projectile && (Entity as Projectile).type == ModContent.ProjectileType()) + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Lemonnade" + Main.rand.Next(1, 4)).ToNetworkText(Player.name)); if (NorfleetCounter > 3 && NorfleetCounter < 1000) damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").ToNetworkText(Player.name)); NorfleetCounter = 0; + #endregion - if (damageSource.TryGetCausingEntity(out var Entity) && Entity is NPC && (Entity as NPC).type == ModContent.NPCType()) + #region NPC Sources + if (damageSource.TryGetCausingEntity(out var Entity2) && Entity2 is NPC && (Entity2 as NPC).type == ModContent.NPCType()) { var npc = Main.npc[damageSource.SourceNPCIndex]; if (npc.ai[3] < 2) //Divinity Devourer { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.DivinityDevourer"+Main.rand.Next(1,4)).ToNetworkText(Player.name)); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.DivinityDevourer" + Main.rand.Next(1, 4)).ToNetworkText(Player.name)); } else if (npc.ai[3] >= 3) + { if (npc.life > npc.lifeMax / 4) //Dimensional Drive { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.DimensionalDrive").ToNetworkText(Player.name)); @@ -454,6 +402,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.UltracosmicMaelstrom" + Main.rand.Next(1, 3)).ToNetworkText(Player.name)); } + } } if (NPC.AnyNPCs(ModContent.NPCType())) @@ -461,6 +410,11 @@ namespace CalamityMod.CalPlayer if (sCalDeathCount < 51) sCalDeathCount++; } + #endregion + + // Leon Death Noise RE4 + if (Main.zenithWorld) + SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); return true; } @@ -470,9 +424,13 @@ namespace CalamityMod.CalPlayer public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Player.Calamity().yharimsGift) - target.AddBuff(ModContent.BuffType(),120); + target.AddBuff(ModContent.BuffType(), 120); - int debuffSpreadProj = ModContent.ProjectileType(); + + if (Player.HasBuff()) + target.AddBuff(ModContent.BuffType(), ThePact.DebuffInflictionDuration); + + int debuffSpreadProj = ModContent.ProjectileType(); if ((Player.Calamity().abaddon || Player.Calamity().apollyon) && (target.Calamity().abaddonEffected || target.Calamity().apollyonEffected) && hit.Crit && abaddonCooldown == 0 && Player.ownedProjectileCounts[debuffSpreadProj] == 0) { int maxTargetNum = target.Calamity().apollyonEffected ? 10 : 6; @@ -599,7 +557,7 @@ namespace CalamityMod.CalPlayer } } - public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref NPC.HitModifiers modifiers)/* tModPorter If you don't need the Projectile, consider using ModifyHitNPC instead */ + public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref NPC.HitModifiers modifiers) { if (proj.npcProj || proj.trap) return; @@ -938,11 +896,11 @@ namespace CalamityMod.CalPlayer modifiers.Cancel(); bool isIgnoredTrap = (proj.type == ProjectileID.PoisonDartTrap) || (proj.type == ProjectileID.VenomDartTrap) || (proj.type == ProjectileID.PoisonDart); - if (Player.Calamity().trapProtection && isIgnoredTrap) + if (Player.Calamity().archaicPowder && isIgnoredTrap) modifiers.Cancel(); bool isReducedTrap = (proj.trap || proj.type == ProjectileID.RollingCactusSpike || proj.type == ProjectileID.Landmine) && !isIgnoredTrap; - if (Player.Calamity().trapProtection && isReducedTrap) + if (Player.Calamity().archaicPowder && isReducedTrap) modifiers.SourceDamage *= (1f - ArchaicPowder.TrapDamageReduction); // Reduce damage dealt by rainbow trails @@ -1163,9 +1121,7 @@ namespace CalamityMod.CalPlayer { if (sulphurSet) Main.npc[proj.Calamity().ParentNPCIndex].AddBuff(BuffID.Poisoned, SulphurousHelmet.SetBonusPoisonDuration); - if (ilSpark) - Main.npc[proj.Calamity().ParentNPCIndex].Calamity().shocked = 120; - } + } } if (proj.hostile && hurtInfo.Damage > 0) @@ -1450,7 +1406,8 @@ namespace CalamityMod.CalPlayer bool sufficientDamageForDodging = actualDamageTaken >= dodgeDamageGateValue; //This is in a method here so the logic below can call it in multiple places - void GenericDodgeEffects() { + void GenericDodgeEffects() + { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); @@ -1510,7 +1467,7 @@ namespace CalamityMod.CalPlayer storedShadowDodge = false; return true; } - + if (!Player.HasCooldown(GlobalDodge.ID) && sufficientDamageForDodging && DodgeEffects.Count > 0) { GenericDodgeEffects(); @@ -1533,6 +1490,14 @@ namespace CalamityMod.CalPlayer #region Modify Hurt public override void ModifyHurt(ref Player.HurtModifiers modifiers) { + if (CanBeCritByThePact && Main.rand.NextFloat() < ThePact.ChanceToBeCrit) + { + modifiers.SourceDamage *= ThePact.CritDmgTaken; + Player.AddBuff(ModContent.BuffType(), ThePact.BoostDuration); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/BloodPactCrit")); + } + + // Calcium Potion knockback reduction if (calcium) modifiers.Knockback *= (1f - CalciumPotion.KnockbackResistance); @@ -1543,7 +1508,7 @@ namespace CalamityMod.CalPlayer #region Custom Hurt Sounds if (hurtSoundTimer == 0) { - if(Player.Transformation().Type != -1 && Player.Transformation().currentTransformation.HurtSound(Player) != null) + if (Player.Transformation().Type != -1 && Player.Transformation().currentTransformation.HurtSound(Player) != null) { var hurtSound = Player.Transformation().currentTransformation.HurtSound(Player).Value; modifiers.DisableSound(); @@ -1598,23 +1563,23 @@ namespace CalamityMod.CalPlayer // It has not yet been mitigated by any means. // - if (blazingCoreParry > 0) //check for active parry + if (divineProvParry > 0) //check for active parry { - if (blazingCoreParry >= 12) //only the first 18 frames (0.3 seconds) counts for a valid parry + if (divineProvParry >= 12) //only the first 18 frames (0.3 seconds) counts for a valid parry { if (!Player.HasCooldown(ParryCooldown.ID)) { - // 17APR2024: Ozzatron: Blazing Core is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. - int blazingCoreParryIFrames = Player.ComputeParryIFrames(); - Player.GiveUniversalIFrames(blazingCoreParryIFrames, true); + // 17APR2024: Ozzatron: Divine Providence is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int divineProvParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(divineProvParryIFrames, true); - blazingCoreEmpoweredParry = true; + divineProvEmpoweredParry = true; modifiers.Cancel(); modifiers.DisableSound(); //prevents hurt sound from playing, had no idea this was a thing } - SoundEngine.PlaySound(BlazingCore.ParrySuccessSound, Player.Center); + SoundEngine.PlaySound(DivineProvidence.ParrySuccessSound, Player.Center); float power = 2; for (int i = 0; i < (int)(20 * power); i++) @@ -1644,12 +1609,12 @@ namespace CalamityMod.CalPlayer Particle orb2 = new CustomPulse(Player.Center, Vector2.Zero, Color.Khaki, "CalamityMod/Particles/BloomRing", new Vector2(1f, 0.5f), 0, 0, 2.1f * power, 25); GeneralParticleHandler.SpawnParticle(orb2); - blazingCoreSuccessfulParry = 60; + divineProvSuccessfulParry = 60; Player.AddCooldown(ParryCooldown.ID, 60 * 30, false, "blazingcore"); //cooldown is frames in seconds multiplied by the desired amount of seconds } - if (blazingCoreParry > 1) - blazingCoreParry = 1; //schedule parry to end next frame + if (divineProvParry > 1) + divineProvParry = 1; //schedule parry to end next frame } else if (flameLickedShellParry > 0) { @@ -1672,23 +1637,6 @@ namespace CalamityMod.CalPlayer FlameLickedShell.handleParry(Player); } } - else if (shieldOfTheOceanParry >= 12) - { - if (!Player.HasCooldown(ParryCooldown.ID)) - { - // Shield of the Ocean is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. - int shieldParryIFrames = Player.ComputeParryIFrames(); - Player.GiveUniversalIFrames(shieldParryIFrames, true); - - shieldOfTheOceanEmpoweredParry = true; - modifiers.FinalDamage *= 0.4f; // 60% DR - modifiers.DisableSound(); - } - - SoundEngine.PlaySound(ShieldoftheOcean.ParrySound, Player.Center); - Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); - ShieldoftheOcean.ActivateParry(Player); - } if (Player.Calamity().scionsCurio) scionsCurioGotHit = true; @@ -2142,12 +2090,6 @@ namespace CalamityMod.CalPlayer } } - if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID)) - { - int healAmt = (int)(hurtInfo.Damage * VictideHeadBarrier.BarrierDamageAbsorptionPercent); - victideBarrierHeal += healAmt; - } - if (daedalusAbsorb && Main.rand.NextBool(DaedalusHeadMagic.AbsorptionChanceDenominator)) { int healAmt = (int)(hurtInfo.Damage * DaedalusHeadMagic.DamageAbsorptionPercent); @@ -2288,12 +2230,13 @@ namespace CalamityMod.CalPlayer } } - if (fleshTotem && hurtInfo.Damage > 0) + if (fleshTotem && hurtInfo.Damage > 0 && fleshTotemManaStorage > 0) { SoundStyle Counter = new SoundStyle("CalamityMod/Sounds/Custom/BrainOfCthulhu/BoC_Rev_Shield_Down"); if (fleshTotemManaStorage >= 100 && fleshTotemVisual) - SoundEngine.PlaySound(Counter with { Volume = 0.75f}, Player.Center); - int lostSoulAmount = fleshTotemManaStorage / 25; + SoundEngine.PlaySound(Counter with { Volume = 0.75f }, Player.Center); + int lostSoulAmount = (fleshTotemManaStorage / 2) / 25; + int lostSoulDamage = (int)Player.GetTotalDamage().ApplyTo(FleshTotem.lostSoulDamage); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { for (int i = 0; i < Main.maxProjectiles; i++) @@ -2303,13 +2246,13 @@ namespace CalamityMod.CalPlayer { for (int k = 0; k < lostSoulAmount; k++) { - Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource), proj.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), FleshTotem.lostSoulDamage, 0f, Main.myPlayer, 0f, 0f, 3f); + Projectile.NewProjectile(Player.GetSource_Accessory_OnHurt(FindAccessory(), hurtInfo.DamageSource), proj.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), lostSoulDamage, 0f, Main.myPlayer, 0f, 0f, 3f); } break; } } } - fleshTotemManaStorage = 0; + fleshTotemManaStorage = fleshTotemManaStorage / 2; } // By setting brainOfConfusionItem, these accessories have this code already, @@ -2437,7 +2380,7 @@ namespace CalamityMod.CalPlayer { int deificProjDamage = (int)(Player.GetBestClassDamage().ApplyTo(DeificAmulet.StarDamage)); - Projectile onHitProj = Main.projectile[Projectile.NewProjectile(source, Player.Center, new Vector2(0,-15 * (rampartOfDeities && n % 2 == 0 ? 0.75f: 1.25f)).RotatedBy(MathHelper.TwoPi/projAmount*n), ModContent.ProjectileType(), deificProjDamage, 4f, Player.whoAmI)]; + Projectile onHitProj = Main.projectile[Projectile.NewProjectile(source, Player.Center, new Vector2(0, -15 * (rampartOfDeities && n % 2 == 0 ? 0.75f : 1.25f)).RotatedBy(MathHelper.TwoPi / projAmount * n), ModContent.ProjectileType(), deificProjDamage, 4f, Player.whoAmI)]; if (onHitProj.whoAmI.WithinBounds(Main.maxProjectiles)) { onHitProj.DamageType = DamageClass.Generic; @@ -2451,19 +2394,38 @@ namespace CalamityMod.CalPlayer } if (ilSpark) { - SoundEngine.PlaySound(SoundID.Item93, Player.Center); - - // Only visual effects are done here - // The actual spark spawning is now handled with the shocked variable in CalamityGlobalNPC - - SeaFoamParticle boom = new(Player.Center, Vector2.Zero, new Color(89, 239, 247), new Color(56, 158, 209), 1f, 200f, Main.rand.NextBool() ? -1f : 1f); - GeneralParticleHandler.SpawnParticle(boom); - - for (int e = 0; e < 6; e++) + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + if (hurtInfo.Damage > 0) { - Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(4.5f, 5.25f); - Dust electric = Dust.NewDustPerfect(Player.Center, DustID.Electric, dustVel, Scale: 0.75f); - electric.noGravity = true; + SoundEngine.PlaySound(SoundID.Item93, Player.Center); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + + // Start with base damage, then apply the best damage class you can + int sDamage = 6; + if (transformer) + sDamage += 42; + sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage); + + if (Player.whoAmI == Main.myPlayer) + { + for (int i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int spark1 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 1); + int spark2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 1); + if (spark1.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark1].timeLeft = 120; + } + if (spark2.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark2].timeLeft = 120; + } + } + } } } if (rBrain) @@ -2533,7 +2495,7 @@ namespace CalamityMod.CalPlayer } } } - else if (godSlayerDamage) //god slayer melee helm + else if (godSlayerMelee) //god slayer melee helm { var source = Player.GetSource_OnHurt(hurtInfo.DamageSource); if (hurtInfo.Damage > GodSlayerHeadMelee.SetBonusHurtDamageThreshold) @@ -2555,7 +2517,7 @@ namespace CalamityMod.CalPlayer } } } - else if (dsSetBonus) + else if (demonshadeSet) { if (Player.whoAmI == Main.myPlayer) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 77bfe9b3c8..774f52511e 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -73,9 +73,9 @@ namespace CalamityMod.CalPlayer if (Player.electrified) { - totalVanillaDoT += eleResist ? 4 : 8; + totalVanillaDoT += 8; if (Player.controlLeft || Player.controlRight) - totalVanillaDoT += eleResist ? 16 : 32; + totalVanillaDoT += 32; } // Tally up total current vanilla DoT so it can be added as extra DoT from Death Mode @@ -109,7 +109,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(burningBlood, 8); ApplyDoTDebuff(brainRot, 8); ApplyDoTDebuff(vaporfied, 8); - int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); + int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3); ApplyDoTDebuff(staticDischarge, staticDoT); ApplyDoTDebuff(heavybleeding, 16); ApplyDoTDebuff(crushDepth, 18); @@ -130,7 +130,7 @@ namespace CalamityMod.CalPlayer // Profaned Soul Crystal turns you into Providence, a God, and you take more damage from God Slayer Inferno ApplyDoTDebuff(godSlayerInferno, profanedCrystalBuffs ? 50 : 40); - int fluxDoT = ((Player.controlLeft || Player.controlRight) ? 50 : 10) / (eleResist ? 2 : 1); + int fluxDoT = ((Player.controlLeft || Player.controlRight) ? 50 : 10); ApplyDoTDebuff(vermillionFlux, fluxDoT); ApplyDoTDebuff(elementalMix, 50); // Never inflicted on the player ApplyDoTDebuff(trueVHex, 50); @@ -138,7 +138,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(dragonFire, dragonfireDoT); ApplyDoTDebuff(miracleBlight, 60); ApplyDoTDebuff(banishingFire, 60); // Never inflicted on the player - int rebukeDoT = ((Player.controlLeft || Player.controlRight) ? 80 : 16) / (eleResist ? 2 : 1); + int rebukeDoT = ((Player.controlLeft || Player.controlRight) ? 80 : 16); ApplyDoTDebuff(auricRebuke, rebukeDoT); // Slowly increase the sulphuric water poisoning effect. Once it's high enough, the player takes damage and the meter resets. @@ -275,7 +275,7 @@ namespace CalamityMod.CalPlayer if (Player.statMana < 0 && Player.Calamity().ChaosStone) { - totalNegativeLifeRegen -= Player.statMana/100f * Items.Accessories.ChaosStone.LostRegenPer100Mana; + totalNegativeLifeRegen -= (Player.statMana/100f * Items.Accessories.ChaosStone.LostRegenPer100Mana) + Items.Accessories.ChaosStone.BaseLostRegen; } // @@ -493,9 +493,6 @@ namespace CalamityMod.CalPlayer if (sRegen) Player.lifeRegen += SpiritGlyph.RegenBoost; - if (fortunesFavor) - Player.lifeRegen += FortunesFavor.FortunesFavorRegenBoost; - if (PinkJellyRegen) Player.lifeRegen += LifeJelly.AuraRegenBoost; @@ -588,9 +585,8 @@ namespace CalamityMod.CalPlayer if (community) { int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier); - bool lesserEffect = Player.buffType.Any(i => CalamityBuffSets.DebuffDataset[i] is not null && CalamityBuffSets.DebuffDataset[i].AlcoholLevel > 0); if (Player.lifeRegen < 0) - Player.lifeRegen += lesserEffect ? 1 : regenBoost; + Player.lifeRegen += regenBoost; } if (manaOverloader) @@ -681,7 +677,7 @@ namespace CalamityMod.CalPlayer { Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); pulseCounter = 0; - if (toxicHeartVisuals) + if (toxicHeartVisuals && !CalamityClientConfig.Instance.MisophoniaSupport) { float soundVolume = Utils.Remap(Player.lifeRegen, minLifeRegen, maxLifeRegen, 1f, 0.3f, true); SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); @@ -698,6 +694,10 @@ namespace CalamityMod.CalPlayer public override void NaturalLifeRegen(ref float regen) { + + if (Player.HasBuff()) + regen *= 1.5f; + // Honey Dew and its upgrades make natural regen more powerful if (purity) regen *= Radiance.NaturalRegenPower; @@ -708,6 +708,8 @@ namespace CalamityMod.CalPlayer else if (honeyDew) regen *= HoneyDew.NaturalRegenPower; + if (Player.HasBuff()) + regen *= ThePact.NaturalRegenBoost; // The Camper counteracts the regen loss while moving horizontally if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) { @@ -739,7 +741,6 @@ namespace CalamityMod.CalPlayer finalRegen += 4f; regeneratorDamage = finalRegen * Regenerator.RegenToDamageRatio; - Player.GetDamage() += regeneratorDamage; if (Player.lifeRegen > 0) Player.lifeRegen = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3ebb1c94af..a1b8566dc6 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -340,7 +340,9 @@ namespace CalamityMod.CalPlayer } // Tabi/Master Ninja Gear dash change - if (lastDashWasTabi) + if (Player.dashDelay != -1) + lastDashWasTabi = false; + else if (lastDashWasTabi) { Player.dashType = 1; } @@ -1136,6 +1138,7 @@ namespace CalamityMod.CalPlayer Asset carpetAuric = ExtraTextureRefs.FlyingCarpetAuric; Asset carpetOriginal = ExtraTextureRefs.FlyingCarpetVanilla; TextureAssets.FlyingCarpet = (auricSet ? carpetAuric : carpetOriginal); + TextureAssets.Buff[ModContent.BuffType()] = WorldGen.crimson ? ExtraTextureRefs.BlightedSlimeCrimIcon : ExtraTextureRefs.BlightedSlimeCorroIcon; for (int l = 0; l < Player.MaxBuffs; l++) { @@ -1455,7 +1458,6 @@ namespace CalamityMod.CalPlayer } // Death Mode effects - caveDarkness = 0f; if (CalamityWorld.death || Main.getGoodWorld) { if (Player.whoAmI == Main.myPlayer) @@ -1848,7 +1850,7 @@ namespace CalamityMod.CalPlayer int numOfPigs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; if (numOfPigs < Player.Calamity().friendlyMinions) { - int pigDamage = 7; + int pigDamage = 12; Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(0, -16).RotatedByRandom(MathHelper.Pi), ModContent.ProjectileType(), pigDamage, 0f, Player.whoAmI, 0, numOfPigs + 1); } } @@ -2024,8 +2026,8 @@ namespace CalamityMod.CalPlayer if (Player.velocity.Y == 0 && fallingBootVelCheckTimer > 10) { float power = Utils.Remap(fallingBootVelCheckTimer, 10, 40, 0.1f, 1); - float scaledPower = (float)Math.Pow(power, 3); - int damage = (int)Player.GetBestClassDamage().ApplyTo(1500 * scaledPower); // Damage scales down thrice + float scaledPower = (float)Math.Pow(power, 2); + int damage = (int)Player.GetBestClassDamage().ApplyTo(300 * scaledPower); // Damage scales down thrice Vector2 playerFeet = Player.Center + Vector2.UnitY * 26 * Player.gravDir; float blastSize = 120 * power; @@ -2239,7 +2241,7 @@ namespace CalamityMod.CalPlayer // First Shadowflame is +1, Statis' Blessing is +2, Statis' Curse inherits both for +3 if (shadowMinions) Player.maxMinions++; - if (holyMinions) + if (statisMinions) Player.maxMinions += 2; if (starTaintedGenerator) @@ -2332,6 +2334,8 @@ namespace CalamityMod.CalPlayer arsenalCooldown--; if (killModeCooldown > 0) killModeCooldown--; + if (oblivionCooldown > 0) + oblivionCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; if (transformerCooldown > 0) @@ -2356,8 +2360,6 @@ namespace CalamityMod.CalPlayer phantomicHeartRegen--; if (phantomicBulwarkCooldown > 0) phantomicBulwarkCooldown--; - if (galileoCooldown > 0) - galileoCooldown--; if (gladiatorTimer > 0) gladiatorTimer--; if (dragonRageCooldown > 0) @@ -2370,8 +2372,6 @@ namespace CalamityMod.CalPlayer raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; - if (VoidCooldown > 0) - VoidCooldown--; if (ursaSergeantCooldown > 0) ursaSergeantCooldown--; if (generalBandCooldown > 0) @@ -2443,8 +2443,6 @@ namespace CalamityMod.CalPlayer ataxiaDmg = 0f; if (hydroHealTimer > 0f) hydroHealTimer -= 0.05f; - if (ataxiaDmg < 0f) - ataxiaDmg = 0f; if (xerocDmg > 0f) xerocDmg -= 2f; if (xerocDmg < 0f) @@ -2537,15 +2535,15 @@ namespace CalamityMod.CalPlayer if (auralisAuroraCooldown > 0) auralisAuroraCooldown--; - if (blazingCore) + if (divineProvidence) { - if (blazingCoreSuccessfulParry > 0) - BlazingCore.HandleStars(Player); - else if (blazingCoreParry > 0) - BlazingCore.HandleParryCountdown(Player); + if (divineProvSuccessfulParry > 0) + DivineProvidence.HandleStars(Player); + else if (divineProvParry > 0) + DivineProvidence.HandleParryCountdown(Player); } - else if (blazingCoreParry > 0) - blazingCoreParry--; + else if (divineProvParry > 0) + divineProvParry--; else if (flameLickedShellParry > 0) { if (flameLickedShell) @@ -2553,13 +2551,6 @@ namespace CalamityMod.CalPlayer else flameLickedShellParry--; } - if (shieldOfTheOceanParry > 0) - { - if (shieldOfTheOcean) - ShieldoftheOcean.HandleParryCountdown(Player); - else - shieldOfTheOceanParry--; - } if (!flameLickedShell && flameLickedShellParry > 0) flameLickedShellParry--; @@ -2587,8 +2578,6 @@ namespace CalamityMod.CalPlayer } else adamantiteSetDefenseBoostInterpolant = 0f; - if (ChlorophyteHealDelay > 0) - ChlorophyteHealDelay--; if (monolithAccursedShader > 0) monolithAccursedShader--; if (monolithBossRushShader > 0) @@ -2776,9 +2765,6 @@ namespace CalamityMod.CalPlayer if (Player.buffTime[l] <= 2 && buffID == ModContent.BuffType()) if (Player.whoAmI == Main.myPlayer) Player.AddCooldown(Cooldowns.TarragonImmunity.ID, TarragonHeadRogue.ImmunityCooldown); - - if (CalamityBuffSets.IsDebuff[buffID]) - Player.GetDamage() += TarragonHeadRogue.RogueDamageBoostWhileDebuffed; } } @@ -2844,6 +2830,10 @@ namespace CalamityMod.CalPlayer if (Player.ichor) Player.statDefense += 5; + // Holding Walking Cane increases movement speed + if (Player.HeldItem.type == ModContent.ItemType()) + Player.moveSpeed += WalkingCane.MoveSpeedBoost; + // Fairy Boots bonus if (fairyBoots) { @@ -3207,11 +3197,7 @@ namespace CalamityMod.CalPlayer // Nebula Headcrab darkness effect if (!Player.headcovered) - { - float screenObstructionAmt = MathHelper.Clamp(caveDarkness, 0f, 0.95f); - float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.7f, 0.1f, 0.3f); - ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, screenObstructionAmt, targetValue); - } + ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, 0f, 0.1f); // Breath lost while at zero breath double breathLoss = Main.remixWorld ? (point.Y < abyssLevel1 ? 1D : 0D) : (point.Y > abyssLevel1 ? 1D : 0D); @@ -3251,7 +3237,7 @@ namespace CalamityMod.CalPlayer (Player.arcticDivingGear ? 5D : 0D) + (aquaticEmblem ? 5D : 0D) + (Player.accMerman ? 8D : 0D) + - (victideBurrowHead ? 2D : 0D) + + (victideSet ? 2D : 0D) + ((aquaticHeart && NPC.downedBoss3) ? 8D : 0D) + (abyssalDivingSuit ? 8D : 0D) + externalBreathTickBoost; @@ -3338,14 +3324,10 @@ namespace CalamityMod.CalPlayer { if (Vector2.Distance(Main.LocalPlayer.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) { - float darkRatio = MathHelper.Clamp(caveDarkness, 0f, 1f); float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); // Reduce the power of Signus darkness based on your light level. - float multiplier = 1f; - - float signusDarkness = signusLifeRatio * multiplier; - darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); + float darkRatio = MathHelper.Clamp(signusLifeRatio, 0f, 1f); ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, LightingEffectsSystem.MaxGFBSignusDarkness * -darkRatio, 0.3f); } } @@ -3680,8 +3662,7 @@ namespace CalamityMod.CalPlayer --bloodflareCoreRemainingHealOverTime; } - - // Reduce how slow Chilled makes the player, because it's cancerous right now + // Reduce how slow Chilled makes the player // The moveSpeed multiplier for Chilled in vanilla is 0.75, so we just multiply by 1.166667 here to make it 0.875, effectively cutting the reduction in half if (Player.chilled) Player.moveSpeed *= 1f + (1f / 6f); @@ -3689,7 +3670,7 @@ namespace CalamityMod.CalPlayer if (purpleHazeStealthTimer > 0) { //this is so janky looking but it's the only way I could get it to work properly - if (!(StealthStrikeAvailable() && Player.HeldItem.DamageType == RogueDamageClass.Instance)) + if (!(StealthStrikeAvailable() && Player.HeldItem.DamageType.CountsAsClass(RogueDamageClass.Instance))) Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.DamageBoost : 0); else stealthDamage -= PurpleHaze.StealthDamageLoss + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.StealthDamageLoss : 0); @@ -3774,10 +3755,7 @@ namespace CalamityMod.CalPlayer continue; float distance = (npc.Center - Player.Center).Length(); if (distance < GiantPearl.AuraRadius) - { npc.AddBuff(ModContent.BuffType(), 20, false); - npc.Calamity().pearlAuraOwner = Player.whoAmI; - } } } } @@ -3797,10 +3775,9 @@ namespace CalamityMod.CalPlayer (reaverSpeed ? ReaverHeadMobility.SetBonusFlightBoost : 0D) + (angelTreads ? AngelTreads.FlightTimeBoost : 0D) + (blueCandle ? WeightlessCandle.WingTimeBoost : 0D) + - (soaring ? SoaringPotion.FlightBoost : 0D) + + (soaring ? SoaringPotion.FlightTimeBoost : 0D) + (prismaticGreaves ? PrismaticGreaves.FlightTimeBoost : 0D) + (plagueReaper ? PlagueReaperMask.SetBonusFlightTimeBoost : 0D) + - (ascendantInsignia ? AscendantInsignia.FlightTimeBoost : Player.empressBrooch ? 0.33D : 0D) + externalFlightTimeMultBoost; if (community) @@ -3890,7 +3867,7 @@ namespace CalamityMod.CalPlayer if (eutrophication) Player.velocity = Vector2.Zero; - if (vaporfied || galvanicCorrosion) + if (vaporfied || galvanicCorrosion || windChilled) Player.velocity *= 0.98f; if (molluskHelmet) @@ -3933,11 +3910,6 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += MathHelper.Lerp(0.05f, 0.15f, manaRatio); } - if (bloodyWormTooth) - { - Player.GetDamage() += 0.1f; - } - // While making the rogue update verify if we should allow these to stack again - Shade if (filthyGlove) { @@ -3988,12 +3960,6 @@ namespace CalamityMod.CalPlayer Player.AddBuff(BuffID.Inferno, 2); } - if (bloodflareThrowing) - { - if (Player.statLife > (int)(Player.statLifeMax2 * BloodflareHeadRogue.DefenseBoostHealthThreshold)) - Player.statDefense += BloodflareHeadRogue.DefenseBoostAboveHealthThreshold; - } - if (bloodflareSummon) { if (Player.statLife <= (int)(Player.statLifeMax2 * BloodflareHeadSummon.DefenseBoostHealthThreshold)) @@ -4195,9 +4161,9 @@ namespace CalamityMod.CalPlayer Player.lavaImmune = true; Player.fireWalk = true; Player.buffImmune[ModContent.BuffType()] = true; + Player.buffImmune[ModContent.BuffType()] = true; Player.buffImmune[BuffID.OnFire] = true; Player.buffImmune[BuffID.Burning] = true; - Player.buffImmune[BuffID.Daybreak] = true; if (Player.wingTimeMax > 0) Player.wingTimeMax = (int)(Player.wingTimeMax * 1.1D); @@ -4422,12 +4388,6 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += beeBoost; } - if (badgeOfBravery) - { - Player.GetDamage() += 0.1f; - Player.GetCritChance() += 10; - } - // Amalgam boosts if (Main.myPlayer == Player.whoAmI) { @@ -5013,6 +4973,53 @@ namespace CalamityMod.CalPlayer RecipeUnlockHandler.HasFoundIceSchematic = true; shouldSync = true; } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundLuxorsGift) + { + RecipeUnlockHandler.HasFoundLuxorsGift = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundFungalSymbiote) + { + RecipeUnlockHandler.HasFoundFungalSymbiote = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundTrinketOfChi) + { + RecipeUnlockHandler.HasFoundTrinketOfChi = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundFrozenCube) + { + RecipeUnlockHandler.HasFoundFrozenCube = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundGladiatorsLocket) + { + RecipeUnlockHandler.HasFoundGladiatorsLocket = true; + shouldSync = true; + } + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundUnstableGraniteCore) + { + RecipeUnlockHandler.HasFoundUnstableGraniteCore = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundCrimsonEffigy) + { + RecipeUnlockHandler.HasFoundCrimsonEffigy = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundCorruptionEffigy) + { + RecipeUnlockHandler.HasFoundCorruptionEffigy = true; + shouldSync = true; + } } if (shouldSync) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index a0102e7693..2839ac6342 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -62,7 +62,7 @@ namespace CalamityMod.CalPlayer #endregion #region On Hit NPC - public override void OnHitNPCWithItem(Item item, NPC target, NPC.HitInfo hit, int damageDone)/* tModPorter If you don't need the Item, consider using OnHitNPC instead */ + public override void OnHitNPCWithItem(Item item, NPC target, NPC.HitInfo hit, int damageDone) { if (Player.whoAmI != Main.myPlayer) return; @@ -153,7 +153,7 @@ namespace CalamityMod.CalPlayer if (cooldown < BlackGlassBand.cooldown) cooldown = BlackGlassBand.cooldown; } - if (protolithBangle && item.DamageType == DamageClass.Ranged) + if (protolithBangle && item.DamageType.CountsAsClass(DamageClass.Ranged)) { int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); @@ -161,7 +161,7 @@ namespace CalamityMod.CalPlayer if (cooldown < ProtolithBangle.cooldown) cooldown = ProtolithBangle.cooldown; } - if (batholithBangle && item.DamageType == DamageClass.Magic) + if (batholithBangle && item.DamageType.CountsAsClass(DamageClass.Magic)) { int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); @@ -207,11 +207,16 @@ namespace CalamityMod.CalPlayer #endregion #region On Hit NPC With Proj - public override void OnHitNPCWithProj(Projectile proj, NPC target, NPC.HitInfo hit, int damageDone)/* tModPorter If you don't need the Projectile, consider using OnHitNPC instead */ + public override void OnHitNPCWithProj(Projectile proj, NPC target, NPC.HitInfo hit, int damageDone) { if (Player.whoAmI != Main.myPlayer) return; + // Don't activate for non-friendly projectiles (obviously). + // Override CanHitNPC if you want a hostile projectile that can also damage enemies. + if (!proj.friendly) + return; + //Undo raider crit after hit if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) { @@ -363,7 +368,7 @@ namespace CalamityMod.CalPlayer if (cooldown < BlackGlassBand.cooldown) cooldown = BlackGlassBand.cooldown; } - if (protolithBangle && proj.DamageType == DamageClass.Ranged) + if (protolithBangle && proj.DamageType.CountsAsClass(DamageClass.Ranged)) { int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); @@ -371,7 +376,7 @@ namespace CalamityMod.CalPlayer if (cooldown < ProtolithBangle.cooldown) cooldown = ProtolithBangle.cooldown; } - if (batholithBangle && proj.DamageType == DamageClass.Magic) + if (batholithBangle && proj.DamageType.CountsAsClass(DamageClass.Magic)) { int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); @@ -613,7 +618,7 @@ namespace CalamityMod.CalPlayer ProjLifesteal(target, proj, damageDone, hit.Crit); ProjOnHit(proj, target, hit.Crit, target.IsAnEnemy(false), targetIsDummy); - NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), hit.Crit, true, proj.noEnchantments); + NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass() && /*This is for Pigion to not count as a whip*/!(proj.type == ModContent.ProjectileType() && proj.minion), hit.Crit, true, proj.noEnchantments); // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (targetIsDummy) @@ -1235,11 +1240,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); if (sulphurSet) target.AddBuff(BuffID.Poisoned, SulphurousHelmet.SetBonusPoisonDuration); - if (ilSpark && Player.Calamity().countsAsAnyWet) - { - int duration = 60; - target.AddBuff(BuffType(), duration); - } if (corrosiveSpine) { target.AddBuff(BuffType(), 120); diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index b366846963..12e96039d4 100644 --- a/CalPlayer/DrawLayers/EncasementParryLayer.cs +++ b/CalPlayer/DrawLayers/EncasementParryLayer.cs @@ -11,12 +11,11 @@ namespace CalamityMod.CalPlayer.DrawLayers public enum EncasementType { BlazingCore, - FlameLickedShell, - ShieldoftheOcean + FlameLickedShell } public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.FrontAccFront); //me when the player layer is called front acc front :skull: - public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : modPlayer.flameLickedShell ? EncasementType.FlameLickedShell : EncasementType.ShieldoftheOcean; + public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.divineProvidence ? EncasementType.BlazingCore : EncasementType.FlameLickedShell; public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -26,9 +25,8 @@ namespace CalamityMod.CalPlayer.DrawLayers bool visible = drawInfo.shadow == 0f && !drawPlayer.dead; visible = encasement switch { - EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0, + EncasementType.BlazingCore => visible && modPlayer.divineProvParry > 0, EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0, - EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0, _ => false }; return visible; @@ -47,7 +45,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { case EncasementType.BlazingCore: tex += "BlazingCoreCrystal"; - currentParry = calPlayer.blazingCoreParry; + currentParry = calPlayer.divineProvParry; defaultOpacity = 0.725f; scale = 1.15f; break; @@ -57,12 +55,6 @@ namespace CalamityMod.CalPlayer.DrawLayers defaultOpacity = 0.875f; scale = 1.2f; break; - case EncasementType.ShieldoftheOcean: - tex += "OceanShieldBubble"; - currentParry = calPlayer.shieldOfTheOceanParry; - defaultOpacity = 0.7f; - scale = 1.3f; - break; default: //should never be this option tex += "BlazingCoreCrystal"; currentParry = 0; diff --git a/CalPlayer/DrawLayers/OceanShieldBubble.png b/CalPlayer/DrawLayers/OceanShieldBubble.png deleted file mode 100644 index e98f8c6037..0000000000 Binary files a/CalPlayer/DrawLayers/OceanShieldBubble.png and /dev/null differ diff --git a/CalPlayer/DrawLayers/SpringStoolLayer.cs b/CalPlayer/DrawLayers/SpringStoolLayer.cs index 5343d50ce5..b2127a1217 100644 --- a/CalPlayer/DrawLayers/SpringStoolLayer.cs +++ b/CalPlayer/DrawLayers/SpringStoolLayer.cs @@ -21,7 +21,7 @@ namespace CalamityMod.CalPlayer.DrawLayers private Asset springTexture; private Asset topTexture; - public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Leggings); + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.PortableStool); public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 8fdfb0d11e..fa6d25e049 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -33,36 +33,37 @@ namespace CalamityMod // Calamity Boss Flag conditions // - public static readonly Condition DownedDesertScourge = Create("Drops.DownedDS", () => DownedBossSystem.downedDesertScourge); - public static readonly Condition DownedCrabulon = Create("Drops.DownedCrabulon", () => DownedBossSystem.downedCrabulon); - public static readonly Condition DownedHiveMind = Create("Drops.DownedHM", () => DownedBossSystem.downedHiveMind); - public static readonly Condition DownedPerforator = Create("Drops.DownedPerfs", () => DownedBossSystem.downedPerforator); - public static readonly Condition DownedSlimeGod = Create("Drops.DownedSG", () => DownedBossSystem.downedSlimeGod); - public static readonly Condition DownedCryogen = Create("Drops.DownedCryo", () => DownedBossSystem.downedCryogen); - public static readonly Condition DownedAquaticScourge = Create("Drops.DownedAS", () => DownedBossSystem.downedAquaticScourge); - public static readonly Condition DownedBrimstoneElemental = Create("Drops.DownedBrim", () => DownedBossSystem.downedBrimstoneElemental); - public static readonly Condition DownedCalamitasClone = Create("Drops.DownedCal", () => DownedBossSystem.downedCalamitasClone); - public static readonly Condition DownedLeviathan = Create("Drops.DownedLevi", () => DownedBossSystem.downedLeviathan); - public static readonly Condition DownedAstrumAureus = Create("Drops.DownedAureus", () => DownedBossSystem.downedAstrumAureus); - public static readonly Condition DownedPlaguebringer = Create("Drops.DownedPBG", () => DownedBossSystem.downedPlaguebringer); - public static readonly Condition DownedRavager = Create("Drops.DownedRav", () => DownedBossSystem.downedRavager); - public static readonly Condition DownedAstrumDeus = Create("Drops.DownedAD", () => DownedBossSystem.downedAstrumDeus); - public static readonly Condition DownedGuardians = Create("Drops.DownedGuard", () => DownedBossSystem.downedGuardians); - public static readonly Condition DownedBumblebird = Create("Drops.DownedBirb", () => DownedBossSystem.downedDragonfolly); - public static readonly Condition DownedProvidence = Create("Drops.DownedProv", () => DownedBossSystem.downedProvidence); - public static readonly Condition DownedSignus = Create("Drops.DownedSig", () => DownedBossSystem.downedSignus); - public static readonly Condition DownedStormWeaver = Create("Drops.DownedSW", () => DownedBossSystem.downedStormWeaver); - public static readonly Condition DownedCeaselessVoid = Create("Drops.DownedCV", () => DownedBossSystem.downedCeaselessVoid); - public static readonly Condition DownedPolterghast = Create("Drops.DownedPolter", () => DownedBossSystem.downedPolterghast); - public static readonly Condition DownedOldDuke = Create("Drops.DownedOD", () => DownedBossSystem.downedBoomerDuke); - public static readonly Condition DownedDevourerOfGods = Create("Drops.DownedDoG", () => DownedBossSystem.downedDoG); - public static readonly Condition DownedYharon = Create("Drops.DownedYharon", () => DownedBossSystem.downedYharon); - public static readonly Condition DownedExoMechs = Create("Drops.DownedExos", () => DownedBossSystem.downedExoMechs); - public static readonly Condition DownedSupremeCalamitas = Create("Drops.DownedSCal", () => DownedBossSystem.downedCalamitas); - public static readonly Condition DownedPrimordialWyrm = Create("Drops.DownedAEW", () => DownedBossSystem.downedPrimordialWyrm); - public static readonly Condition DownedClam = Create("Drops.DownedClam", () => DownedBossSystem.downedCLAM); - public static readonly Condition DownedBuffedClam = Create("Drops.DownedClamHM", () => DownedBossSystem.downedCLAMHardMode); - public static readonly Condition DownedGreatSandShark = Create("Drops.DownedGSS", () => DownedBossSystem.downedGSS); + public static readonly Condition DownedDesertScourge = Create("Drops.DownedDS", () => DownedBossSystem.downedDesertScourge); + public static readonly Condition DownedCrabulon = Create("Drops.DownedCrabulon", () => DownedBossSystem.downedCrabulon); + public static readonly Condition DownedHiveMind = Create("Drops.DownedHM", () => DownedBossSystem.downedHiveMind); + public static readonly Condition DownedPerforator = Create("Drops.DownedPerfs", () => DownedBossSystem.downedPerforator); + public static readonly Condition DownedSlimeGod = Create("Drops.DownedSG", () => DownedBossSystem.downedSlimeGod); + public static readonly Condition DownedCryogen = Create("Drops.DownedCryo", () => DownedBossSystem.downedCryogen); + public static readonly Condition DownedAquaticScourge = Create("Drops.DownedAS", () => DownedBossSystem.downedAquaticScourge); + public static readonly Condition DownedBrimstoneElemental = Create("Drops.DownedBrim", () => DownedBossSystem.downedBrimstoneElemental); + public static readonly Condition DownedCalamitasClone = Create("Drops.DownedCal", () => DownedBossSystem.downedCalamitasClone); + public static readonly Condition DownedLeviathan = Create("Drops.DownedLevi", () => DownedBossSystem.downedLeviathan); + public static readonly Condition DownedAstrumAureus = Create("Drops.DownedAureus", () => DownedBossSystem.downedAstrumAureus); + public static readonly Condition DownedPlaguebringer = Create("Drops.DownedPBG", () => DownedBossSystem.downedPlaguebringer); + public static readonly Condition DownedRavager = Create("Drops.DownedRav", () => DownedBossSystem.downedRavager); + public static readonly Condition DownedAstrumDeus = Create("Drops.DownedAD", () => DownedBossSystem.downedAstrumDeus); + public static readonly Condition DownedGuardians = Create("Drops.DownedGuard", () => DownedBossSystem.downedGuardians); + public static readonly Condition DownedBumblebird = Create("Drops.DownedBirb", () => DownedBossSystem.downedDragonfolly); + public static readonly Condition DownedProvidence = Create("Drops.DownedProv", () => DownedBossSystem.downedProvidence); + public static readonly Condition DownedSignus = Create("Drops.DownedSig", () => DownedBossSystem.downedSignus); + public static readonly Condition DownedStormWeaver = Create("Drops.DownedSW", () => DownedBossSystem.downedStormWeaver); + public static readonly Condition DownedCeaselessVoid = Create("Drops.DownedCV", () => DownedBossSystem.downedCeaselessVoid); + public static readonly Condition DownedPolterghast = Create("Drops.DownedPolter", () => DownedBossSystem.downedPolterghast); + public static readonly Condition DownedOldDuke = Create("Drops.DownedOD", () => DownedBossSystem.downedBoomerDuke); + public static readonly Condition DownedDevourerOfGods = Create("Drops.DownedDoG", () => DownedBossSystem.downedDoG); + public static readonly Condition DownedYharon = Create("Drops.DownedYharon", () => DownedBossSystem.downedYharon); + public static readonly Condition DownedExoMechs = Create("Drops.DownedExos", () => DownedBossSystem.downedExoMechs); + public static readonly Condition DownedSupremeCalamitas = Create("Drops.DownedSCal", () => DownedBossSystem.downedCalamitas); + public static readonly Condition DownedPrimordialWyrm = Create("Drops.DownedAEW", () => DownedBossSystem.downedPrimordialWyrm); + public static readonly Condition DownedHorribleHog = Create("Drops.DownedHorribleHog", () => DownedBossSystem.downedHorribleHog); + public static readonly Condition DownedClam = Create("Drops.DownedClam", () => DownedBossSystem.downedCLAM); + public static readonly Condition DownedBuffedClam = Create("Drops.DownedClamHM", () => DownedBossSystem.downedCLAMHardMode); + public static readonly Condition DownedGreatSandShark = Create("Drops.DownedGSS", () => DownedBossSystem.downedGSS); // Mixed public static readonly Condition DownedHiveMindOrPerforator = Create("Drops.DownedHMOrPerfs",() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); @@ -70,7 +71,7 @@ namespace CalamityMod // Vanilla public static readonly Condition DownedBetsy = Create("Drops.DownedBetsy", () => DownedBossSystem.downedBetsy); - + public static readonly Condition DownedDreadnautilus = Create("Drops.DownedDreadnautilus", () => DownedBossSystem.downedDreadnautilus); // // Calamity Biome conditions // diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 7c72d2f83d..6501b1a176 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -50,10 +50,6 @@ namespace CalamityMod [DefaultValue(false)] public bool BoCSpriteChange { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool EnableVanillaTextureEdits { get; set; } - [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool SunkenSeaBackgroundDistortion { get; set; } @@ -244,8 +240,8 @@ namespace CalamityMod public float FlightBarPosY { get; set; } #endregion - #region Music Toggles - [Header("MusicToggles")] + #region Audio Toggles + [Header("AudioToggles")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -259,6 +255,9 @@ namespace CalamityMod [DefaultValue(false)] public bool AbyssLayer3Alt { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool MisophoniaSupport { get; set; } #endregion #region General Gameplay Changes diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 62b5f44039..8ed529182e 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -1,72 +1,231 @@ -using Terraria.ModLoader; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameInput; +using Terraria.ModLoader; namespace CalamityMod { public class CalamityKeybinds : ModSystem { - public static ModKeybind AccessoryParryHotKey { get; private set; } public static ModKeybind AdrenalineHotKey { get; private set; } - public static ModKeybind AmmoCycleHotkey { get; private set; } - public static ModKeybind AngelicAllianceHotKey { get; private set; } public static ModKeybind ArmorSetBonusHotKey { get; private set; } - public static ModKeybind AscendantInsigniaHotKey { get; private set; } - public static ModKeybind BoosterDashHotKey { get; private set; } public static ModKeybind DashHotkey { get; private set; } public static ModKeybind ExoChairSlowdownHotkey { get; private set; } public static ModKeybind GodSlayerDashHotKey { get; private set; } - public static ModKeybind GravistarSabatonHotkey { get; private set; } public static ModKeybind NormalityRelocatorHotKey { get; private set; } public static ModKeybind RageHotKey { get; private set; } - public static ModKeybind SpectralVeilHotKey { get; private set; } - public static ModKeybind SpringStoolJumpHotKey { get; private set; } - public static ModKeybind TransformerHotKey { get; private set; } - public static ModKeybind SwitchGravityHotkey {get; private set;} + public static ModKeybind SwitchGravityHotkey { get; private set; } public static ModKeybind ExpandDebuffInfo { get; private set; } - public static ModKeybind ThePointerLock {get; private set;} + + + public static ModKeybind HeldItem { get; private set; } + public static ModKeybind Accessory1 { get; private set; } + public static ModKeybind Accessory2 { get; private set; } + public static ModKeybind Accessory3 { get; private set; } + public static ModKeybind Accessory4 { get; private set; } + public static ModKeybind Accessory5 { get; private set; } + public static ModKeybind Accessory6 { get; private set; } + public static ModKeybind Accessory7 { get; private set; } + + 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 - AccessoryParryHotKey = KeybindLoader.RegisterKeybind(Mod, "ActivateAccessoryParry", "N"); AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B"); - AmmoCycleHotkey = KeybindLoader.RegisterKeybind(Mod, "AmmoCycle", "Mouse3"); - AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G"); ArmorSetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y"); - AscendantInsigniaHotKey = KeybindLoader.RegisterKeybind(Mod, "AscendantInsigniaHotKey", "K"); - BoosterDashHotKey = KeybindLoader.RegisterKeybind(Mod, "BoosterDash", "Q"); DashHotkey = KeybindLoader.RegisterKeybind(Mod, "DashDoubleTapOverride", "F"); ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "ExoChairSlowDown", "RightShift"); GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "GodSlayerDash", "H"); - GravistarSabatonHotkey = KeybindLoader.RegisterKeybind(Mod, "GravistarSabatonHotkey", "X"); NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z"); RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V"); - SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z"); - SpringStoolJumpHotKey = KeybindLoader.RegisterKeybind(Mod, "SpringStoolJumpHotKey", "U"); - TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K"); SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T"); ExpandDebuffInfo = KeybindLoader.RegisterKeybind(Mod, "ExpandDebuffInfo", "LeftControl"); - ThePointerLock = KeybindLoader.RegisterKeybind(Mod, "ThePointerLock", "N"); + + HeldItem = KeybindLoader.RegisterKeybind(Mod, "HeldItem", "NumPad0"); + Accessory1 = KeybindLoader.RegisterKeybind(Mod, "Accessory1", "NumPad1"); + Accessory2 = KeybindLoader.RegisterKeybind(Mod, "Accessory2", "NumPad2"); + Accessory3 = KeybindLoader.RegisterKeybind(Mod, "Accessory3", "NumPad3"); + Accessory4 = KeybindLoader.RegisterKeybind(Mod, "Accessory4", "NumPad4"); + Accessory5 = KeybindLoader.RegisterKeybind(Mod, "Accessory5", "NumPad5"); + Accessory6 = KeybindLoader.RegisterKeybind(Mod, "Accessory6", "NumPad6"); + Accessory7 = KeybindLoader.RegisterKeybind(Mod, "Accessory7", "NumPad7"); + + AccessoryKeybinds = [ + Accessory1, + Accessory2, + Accessory3, + Accessory4, + Accessory5, + Accessory6, + Accessory7 + ]; } public override void Unload() { - AccessoryParryHotKey = null; AdrenalineHotKey = null; - AmmoCycleHotkey = null; - AngelicAllianceHotKey = null; ArmorSetBonusHotKey = null; - AscendantInsigniaHotKey = null; - BoosterDashHotKey = null; DashHotkey = null; ExoChairSlowdownHotkey = null; GodSlayerDashHotKey = null; - GravistarSabatonHotkey = null; NormalityRelocatorHotKey = null; RageHotKey = null; - SpectralVeilHotKey = null; - SpringStoolJumpHotKey = null; - TransformerHotKey = null; ExpandDebuffInfo = null; + + Accessory1 = null; + Accessory2 = null; + Accessory3 = null; + Accessory4 = null; + Accessory5 = null; + Accessory6 = null; + Accessory1 = null; + Accessory7 = null; + + 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 + { + /// + /// Gets if the Calamity keybind for the given item was just pressed.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool JustPressedKeybind(this Item item) + { + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.JustPressed; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); + + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) + { + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].JustPressed; + } + + return false; + } + + /// + /// Gets if the Calamity keybind for the given item was just released.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool JustReleasedKeybind(this Item item) + { + + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.JustReleased; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); + + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) + { + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].JustReleased; + } + + return false; + } + + + /// + /// Gets if the Calamity keybind for the given item is currently held down.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool CurrentlyPressingKeybind(this Item item) + { + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.Current; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + Debug.Assert(false, "Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set, but is requesting an accessory keybind"); + + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) + { + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index].Current; + } + + return false; + } + + + /// + /// Gets the Calamity keybind for the given item.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static ModKeybind? GetDynamicModHotkey(this Item item) + { + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + return CalamityKeybinds.HeldItem; + + if (CalamityKeybinds.RentedKeybinds.Contains(item.type)) + { + int index = CalamityKeybinds.RentedKeybinds.IndexOf(item.type); + if (CalamityKeybinds.AccessoryKeybinds.IndexInRange(index)) + return CalamityKeybinds.AccessoryKeybinds[index]; + } + 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) + return false; + return true; } } } diff --git a/CalamityMod.cs b/CalamityMod.cs index ec7526c385..b710d80f4a 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -48,12 +48,6 @@ namespace CalamityMod Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets); } } - - public override void PostSetupContent() - { - // Force open certain ModMenus for various reasons and the added flair of "Hey! Something big has happened! Check it out!" - CalamityMainMenu_Sunken.ForceMenuStyle(); - } #endregion #region Unload 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/ChatTags/SmallTextHandler.cs b/ChatTags/SmallTextHandler.cs new file mode 100644 index 0000000000..44dfcb367c --- /dev/null +++ b/ChatTags/SmallTextHandler.cs @@ -0,0 +1,53 @@ +using System; +using CalamityMod.NPCs.DevourerofGods; +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.GameContent; +using Terraria.UI.Chat; + +namespace CalamityMod.ChatTags +{ + public sealed class SmallTextHandler : AbstractTagHandler + { + protected override string[] TagNames { get; } = ["scale"]; + public override TextSnippet Parse(string text, Color baseColor = new(), string options = null) + { + if (float.TryParse(options, out float result)) + return new SmallTextSnippet(text, baseColor,result); + + return new SmallTextSnippet(text, baseColor); + } + } + public sealed class SmallTextSnippet(string text) : TextSnippet + { + public SmallTextSnippet( string text, Color color, float scale = 0.5f) : this(text) + { + textColor = color; + Scale = scale; + } + + Color textColor = Color.White; + public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1) + { + color = textColor; + + size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * Scale); + + if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0) && Color != Color.Transparent) + { + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, text, position, color, 0, Vector2.Zero, new Vector2(scale)); + } + return true; + } + public override float GetStringLength(DynamicSpriteFont font) + { + float size = font.MeasureString(text).X; + return size * Scale; + } + } +} diff --git a/Cooldowns/BubblyBurrow.cs b/Cooldowns/BubblyBurrow.cs deleted file mode 100644 index 0ff4d6f13b..0000000000 --- a/Cooldowns/BubblyBurrow.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using CalamityMod.Items.Armor.Victide; -using CalamityMod.UI; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.Localization; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Cooldowns -{ - public class BubblyBurrow : CooldownHandler - { - public bool PowerActive => instance.timeLeft > VictideHeadBurrow.BurrowCooldown; - public float PowerPercent => (instance.timeLeft - VictideHeadBurrow.BurrowCooldown) / (float)VictideHeadBurrow.BurrowDuration; - - public static new string ID => "BubblyBurrow"; - public override bool ShouldDisplay => true; - public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.BubblyBurrow" + (PowerActive ? "Active" : "Cooldown")); - public override string Texture => PowerActive ? "CalamityMod/Cooldowns/BubblyBurrow" : "CalamityMod/Cooldowns/BubblyBurrowCooldown"; - public override string OutlineTexture => "CalamityMod/Cooldowns/BubblyBurrowOutline"; - public override string OverlayTexture => "CalamityMod/Cooldowns/BubblyBurrowOverlay"; - public override Color OutlineColor => new Color(158, 158, 255); - public override Color CooldownStartColor => PowerActive ? Color.Lerp(new Color(255, 170, 204), new Color(72, 125, 204), PowerPercent) : new Color(72, 125, 204); - public override Color CooldownEndColor => PowerActive ? Color.Lerp(new Color(255, 170, 204), new Color(97, 255, 255), PowerPercent) : new Color(97, 255, 255); - public override SoundStyle? EndSound => SoundID.Item85; - - public override void OnCompleted() - { - Vector2 playerVelocity = instance.player.velocity / 8f; - if (!Main.dedServ) - { - for (int i = 0; i < 16; i++) - { - Vector2 bubblePos = instance.player.MountedCenter + Main.rand.NextVector2Circular(50f, 50f); - Vector2 bubbleSpeed = Main.rand.NextVector2Circular(1f, 1f) + playerVelocity; - Gore bubble = Gore.NewGoreDirect(instance.player.GetSource_Misc("1"), bubblePos, bubbleSpeed, 411, Main.rand.NextFloat(0.8f, 1.6f)); - bubble.timeLeft = 24 + Main.rand.Next(13); - bubble.type = 411; - } - } - } - - //Charge down at first, and then charge back up - private float AdjustedCompletion => CooldownRackUI.DebugFullDisplay ? CooldownRackUI.DebugForceCompletion : PowerActive ? PowerPercent : 1 - (instance.timeLeft / (float)VictideHeadBurrow.BurrowCooldown); - - public override void ApplyBarShaders(float opacity) - { - //Use the adjusted completion - GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); - GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); - GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); - GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); - GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); - } - - public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) - { - Texture2D sprite = Request(Texture).Value; - Texture2D outline = Request(OutlineTexture).Value; - Texture2D overlay = Request(OverlayTexture).Value; - - //Draw the outline - spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); - - //Draw the icon - spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); - - //Draw the small overlay - int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); - Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); - spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); - } - } -} diff --git a/Cooldowns/BubblyBurrow.png b/Cooldowns/BubblyBurrow.png deleted file mode 100644 index 21b3a91620..0000000000 Binary files a/Cooldowns/BubblyBurrow.png and /dev/null differ diff --git a/Cooldowns/BubblyBurrowCooldown.png b/Cooldowns/BubblyBurrowCooldown.png deleted file mode 100644 index 2fd459cd2e..0000000000 Binary files a/Cooldowns/BubblyBurrowCooldown.png and /dev/null differ diff --git a/Cooldowns/BubblyBurrowOutline.png b/Cooldowns/BubblyBurrowOutline.png deleted file mode 100644 index 76c2b5b9f7..0000000000 Binary files a/Cooldowns/BubblyBurrowOutline.png and /dev/null differ diff --git a/Cooldowns/BubblyBurrowOverlay.png b/Cooldowns/BubblyBurrowOverlay.png deleted file mode 100644 index 5327154aa6..0000000000 Binary files a/Cooldowns/BubblyBurrowOverlay.png and /dev/null differ 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/NPCs/SunkenSea/StormlionSentryMandible.png b/Cooldowns/OblivionCooldownOutline.png similarity index 86% rename from NPCs/SunkenSea/StormlionSentryMandible.png rename to Cooldowns/OblivionCooldownOutline.png index 474cbbfaa0..edc4369894 100644 Binary files a/NPCs/SunkenSea/StormlionSentryMandible.png and b/Cooldowns/OblivionCooldownOutline.png differ diff --git a/Cooldowns/Stooldown.cs b/Cooldowns/Stooldown.cs index 888044482c..082b3d7074 100644 --- a/Cooldowns/Stooldown.cs +++ b/Cooldowns/Stooldown.cs @@ -25,6 +25,6 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => Color.Brown; public override Color CooldownEndColor => Color.Khaki; - public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/AscendantOff"); + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/StooldownResolve"); } } diff --git a/CustomRecipes/RecipeUnlockHandler.cs b/CustomRecipes/RecipeUnlockHandler.cs index 2d2d263f2c..6945b303d4 100644 --- a/CustomRecipes/RecipeUnlockHandler.cs +++ b/CustomRecipes/RecipeUnlockHandler.cs @@ -18,6 +18,16 @@ namespace CalamityMod.CustomRecipes public static bool HasFoundHellSchematic = false; public static bool HasFoundIceSchematic = false; + public static bool HasFoundLuxorsGift = false; + public static bool HasFoundFungalSymbiote = false; + public static bool HasFoundTrinketOfChi = false; + public static bool HasFoundFrozenCube = false; + public static bool HasFoundGladiatorsLocket = false; + public static bool HasFoundUnstableGraniteCore = false; + public static bool HasFoundCrimsonEffigy = false; + public static bool HasFoundCorruptionEffigy = false; + + public static void Save(List boolTagContainer) { boolTagContainer.AddWithCondition("HasUnlockedT1ArsenalRecipes", HasUnlockedT1ArsenalRecipes); @@ -31,6 +41,15 @@ namespace CalamityMod.CustomRecipes boolTagContainer.AddWithCondition("HasFoundJungleSchematic", HasFoundJungleSchematic); boolTagContainer.AddWithCondition("HasFoundHellSchematic", HasFoundHellSchematic); boolTagContainer.AddWithCondition("HasFoundIceSchematic", HasFoundIceSchematic); + + boolTagContainer.AddWithCondition("HasFoundLuxorsGift", HasFoundLuxorsGift); + boolTagContainer.AddWithCondition("HasFoundFungalSymbiote", HasFoundFungalSymbiote); + boolTagContainer.AddWithCondition("HasFoundTrinketOfChi", HasFoundTrinketOfChi); + boolTagContainer.AddWithCondition("HasFoundFrozenCube", HasFoundFrozenCube); + boolTagContainer.AddWithCondition("HasFoundGladiatorsLocket", HasFoundGladiatorsLocket); + boolTagContainer.AddWithCondition("HasFoundUnstableGraniteCore", HasFoundUnstableGraniteCore); + boolTagContainer.AddWithCondition("HasFoundCrimsonEffigy", HasFoundCrimsonEffigy); + boolTagContainer.AddWithCondition("HasFoundCorruptionEffigy", HasFoundCorruptionEffigy); } public static void Load(IList boolTagContainer) @@ -46,6 +65,16 @@ namespace CalamityMod.CustomRecipes HasFoundJungleSchematic = boolTagContainer.Contains("HasFoundJungleSchematic"); HasFoundHellSchematic = boolTagContainer.Contains("HasFoundHellSchematic"); HasFoundIceSchematic = boolTagContainer.Contains("HasFoundIceSchematic"); + + HasFoundLuxorsGift = boolTagContainer.Contains("HasFoundLuxorsGift"); + HasFoundFungalSymbiote = boolTagContainer.Contains("HasFoundFungalSymbiote"); + HasFoundTrinketOfChi = boolTagContainer.Contains("HasFoundTrinketOfChi"); + HasFoundFrozenCube = boolTagContainer.Contains("HasFoundFrozenCube"); + HasFoundGladiatorsLocket = boolTagContainer.Contains("HasFoundGladiatorsLocket"); + HasFoundUnstableGraniteCore = boolTagContainer.Contains("HasFoundUnstableGraniteCore"); + HasFoundCrimsonEffigy = boolTagContainer.Contains("HasFoundCrimsonEffigy"); + HasFoundCorruptionEffigy = boolTagContainer.Contains("HasFoundCorruptionEffigy"); + } public static void SendData(BinaryWriter writer) @@ -63,9 +92,19 @@ namespace CalamityMod.CustomRecipes BitsByte flags2 = new BitsByte(); flags2[0] = HasFoundHellSchematic; flags2[1] = HasFoundIceSchematic; + flags2[2] = HasFoundLuxorsGift; + flags2[3] = HasFoundFungalSymbiote; + flags2[4] = HasFoundTrinketOfChi; + flags2[5] = HasFoundGladiatorsLocket; + flags2[6] = HasFoundUnstableGraniteCore; + flags2[7] = HasFoundCrimsonEffigy; + + BitsByte flags3 = new BitsByte(); + flags3[0] = HasFoundCorruptionEffigy; writer.Write(flags); writer.Write(flags2); + writer.Write(flags3); } public static void ReceiveData(BinaryReader reader) @@ -83,6 +122,16 @@ namespace CalamityMod.CustomRecipes BitsByte flags2 = reader.ReadByte(); HasFoundHellSchematic = flags2[0]; HasFoundIceSchematic = flags2[1]; + HasFoundLuxorsGift = flags2[2]; + HasFoundFungalSymbiote = flags2[3]; + HasFoundTrinketOfChi = flags2[4]; + HasFoundGladiatorsLocket = flags2[5]; + HasFoundUnstableGraniteCore = flags2[6]; + HasFoundCrimsonEffigy = flags2[7]; + + BitsByte flags3 = reader.ReadByte(); + HasFoundCorruptionEffigy = flags3[0]; + } } } diff --git a/DamageClasses/AllClassDamageClass.cs b/DamageClasses/AllClassDamageClass.cs new file mode 100644 index 0000000000..04cfc318c7 --- /dev/null +++ b/DamageClasses/AllClassDamageClass.cs @@ -0,0 +1,18 @@ +using Terraria.ModLoader; + +namespace CalamityMod +{ + public class AllClassDamageClass : DamageClass + { + internal static AllClassDamageClass Instance; + + public override void Load() => Instance = this; + public override void Unload() => Instance = null; + + public override StatInheritanceData GetModifierInheritance(DamageClass damageClass) + { + return StatInheritanceData.Full; + } + public override bool GetEffectInheritance(DamageClass damageClass) => true; + } +} diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 9599aea147..cf54c1512f 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -72,7 +73,12 @@ namespace CalamityMod.DataStructures /// >Used by evil attunements to check if a regular dash is avaialble /// Used by evil attunements to check if a strong dash is avaialble /// - public virtual bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) => true; + public virtual bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) + { + Projectile blade = Projectile.NewProjectileDirect(source, position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * DamageMultiplier); + return false; + } public virtual void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) { @@ -155,20 +161,14 @@ namespace CalamityMod.DataStructures public override bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) { - switch (Combo) + Projectile blade = Projectile.NewProjectileDirect(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 0, 15); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * DamageMultiplier); + if (Combo > 0) { - case 0: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 0, 15); - break; - - case 1: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 1, 20); - break; - - case 2: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 2, 50); - break; + blade.ai[0] = Combo; + blade.ai[1] = (Combo == 2 ? 50 : 20); } + Combo++; if (Combo > 2) Combo = 0; @@ -202,7 +202,8 @@ namespace CalamityMod.DataStructures public override bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) { - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 26, (float)CanLunge); + Projectile blade = Projectile.NewProjectileDirect(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 26, (float)CanLunge); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * DamageMultiplier); CanLunge = 0; return false; } @@ -283,20 +284,14 @@ namespace CalamityMod.DataStructures public override bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) { - switch (Combo) + Projectile blade = Projectile.NewProjectileDirect(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 0, 15); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * DamageMultiplier); + if (Combo > 0) { - case 0: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 0, 15); - break; - - case 1: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 1, 20); - break; - - case 2: - Projectile.NewProjectile(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 2, 50); - break; + blade.ai[0] = Combo; + blade.ai[1] = (Combo == 2 ? 50 : 20); } + Combo++; if (Combo > 2) Combo = 0; @@ -331,6 +326,7 @@ namespace CalamityMod.DataStructures public override bool Shoot(Player player, IEntitySource source, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack, ref int Combo, ref int CanLunge, ref int PowerLungeCounter) { Projectile whipProj = Projectile.NewProjectileDirect(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 0, 0); + whipProj.originalDamage = (int)MathF.Round(whipProj.originalDamage * DamageMultiplier); if (whipProj.ModProjectile is TrueGrovetendersTouch whip) whip.flipped = Combo == 0 ? 1 : -1; Combo++; @@ -373,6 +369,7 @@ namespace CalamityMod.DataStructures PowerLungeCounter = 0; } Projectile proj = Projectile.NewProjectileDirect(source, player.Center, new Vector2(speedX, speedY), ProjectileType(), damage, knockBack, player.whoAmI, 26f, CanLunge > 0 ? 1f : 0f); + proj.originalDamage = (int)MathF.Round(proj.originalDamage * DamageMultiplier); if (proj.ModProjectile is TrueDecaysRetort rapier) rapier.ChargedUp = powerLungeAvailable; CanLunge--; diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index 69e430fd75..f90196804d 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -1,7 +1,6 @@ using System; -using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Accessories; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -157,8 +156,8 @@ namespace CalamityMod.DataStructures public static StatModifier ApplyScalingToStatModifer(StatModifier Modifer, float scaling) { StatModifier output = new(); - output += (Modifer.Additive-1) * scaling; - output *= 1 + (Modifer.Multiplicative-1) * scaling; + output += (Modifer.Additive - 1) * scaling; + output *= 1 + (Modifer.Multiplicative - 1) * scaling; output.Base = Modifer.Base * scaling; output.Flat = Modifer.Flat * scaling; return output; @@ -172,9 +171,9 @@ namespace CalamityMod.DataStructures public static StatModifier ForceModifierPositiveWithScaling(StatModifier Modifer, float scaling) { StatModifier output = new(); - output += MathHelper.Max((Modifer.Additive - 1) * scaling,0); - output *= MathHelper.Max(1 + (Modifer.Multiplicative - 1) * scaling,1); - output.Base = MathHelper.Max(Modifer.Base * scaling,0); + output += MathHelper.Max((Modifer.Additive - 1) * scaling, 0); + output *= MathHelper.Max(1 + (Modifer.Multiplicative - 1) * scaling, 1); + output.Base = MathHelper.Max(Modifer.Base * scaling, 0); output.Flat = MathHelper.Max(Modifer.Flat * scaling, 0); return output; } @@ -185,7 +184,7 @@ namespace CalamityMod.DataStructures ///
public void DefaultUpdateOnPlayer(Player player, int buffType, ref int buffIndex, ref int damage) { - + } /// @@ -206,17 +205,17 @@ namespace CalamityMod.DataStructures )))) : // Bane doesn't scale with debuff multipliers. This should be implemented as a default feature you can apply to debuffs at some point. - buffType == ModContent.BuffType() ? cnpc.ActiveTypelessDebuffMultiplier : StatModifier.Default; + buffType == ModContent.BuffType() ? StatModifier.Default : cnpc.ActiveTypelessDebuffMultiplier; //Ensure at least 25% effectiveness if (totalScaling.Multiplicative <= 0.25f) - totalScaling.Multiplicative = 0.25f; + totalScaling.Multiplicative = 0.25f; if (totalScaling.Additive < 0.25f) totalScaling.Additive = 0.25f; totalDPS = totalScaling.ApplyTo(totalDPS); - var totalDPSAdjusted = totalDPS-EnemyVanillaRegenToCancelOut; - npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS*MultiplierDamageTickSize,MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + var totalDPSAdjusted = totalDPS - EnemyVanillaRegenToCancelOut; + npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS * MultiplierDamageTickSize, MinimumDamageTickSize), ref npc.lifeRegen, ref damage); } /// /// DoT functionality that takes into account Electric debuff's 4x DPS when moving @@ -278,7 +277,7 @@ namespace CalamityMod.DataStructures // If there are no Daybreak impaled spears, Daybroken has 1x potency (it was applied some other way) int adjustedSpears = Math.Max(1, numImpaledSpears); int baseDaybreakDoTValue = (int)(npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(Daybroken.EnemyLostRegen) + (Daybroken.EnemyLostRegen * (adjustedSpears - 1))); - int totalDPSAdjusted = baseDaybreakDoTValue - Daybroken.EnemyVanillaRegenToCancelOut*numImpaledSpears; + int totalDPSAdjusted = baseDaybreakDoTValue - Daybroken.EnemyVanillaRegenToCancelOut * numImpaledSpears; if (numImpaledSpears == 0) { totalDPSAdjusted -= Daybroken.EnemyVanillaRegenToCancelOut; @@ -291,10 +290,10 @@ namespace CalamityMod.DataStructures public static void OiledNPCMethod(NPC npc, int buffType, ref int buffIndex, ref int damage) { var cnpc = npc.Calamity(); - double totalDPS = ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier,Oiled.HeatDebuffScaling).ApplyTo(Oiled.EnemyLostRegen); + double totalDPS = ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier, Oiled.HeatDebuffScaling).ApplyTo(Oiled.EnemyLostRegen); if (totalDPS <= 0) return; - npc.Calamity().ApplyDPSDebuff((int)(totalDPS), damage+(int)Math.Max(totalDPS * Oiled.MultiplierDamageTickSize, Oiled.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + npc.Calamity().ApplyDPSDebuff((int)(totalDPS), damage + (int)Math.Max(totalDPS * Oiled.MultiplierDamageTickSize, Oiled.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); } /// /// Has Dryad's Bane scale with Calamity's town NPC buffs @@ -360,8 +359,8 @@ namespace CalamityMod.DataStructures }; public static DebuffData Shadowflame = new DebuffData() { - EnemyLostRegen = 60, - EnemyVanillaRegenToCancelOut = 60, + EnemyLostRegen = 40, + EnemyVanillaRegenToCancelOut = 30, HeatDebuffScaling = 1 }; public static DebuffData Daybroken = new DebuffData() @@ -419,5 +418,37 @@ namespace CalamityMod.DataStructures NPCLifeRegenMethod = DryadsBaneNPCMethod }; #endregion + + #region Helpers + public static int GetDebuffRegenValue(NPC npc, int type) + { + var debuffData = CalamityBuffSets.DebuffDataset[type]; + if (debuffData == null) + return 0; + + var oldRegen = npc.lifeRegen; + var oldCount = npc.lifeRegenCount; + int dmg = 1; + npc.lifeRegenCount = 0; + npc.lifeRegen = 0; + + int index = npc.FindBuffIndex(type); + + if (debuffData == Oiled) + { + Oiled.NPCLifeRegenMethod(npc, BuffID.Oiled, ref index, ref dmg); + } + else { + debuffData.NPCLifeRegenMethod(npc, type, ref index, ref dmg); + npc.lifeRegen -= debuffData.EnemyVanillaRegenToCancelOut; //ensure vanilla dmg values aren't counted + } + + int done = npc.lifeRegen; + npc.lifeRegen = oldRegen; + npc.lifeRegenCount = oldCount; + return done; + } + + #endregion } } diff --git a/Effects/BasicTextureDistortionShader.fx b/Effects/BasicTextureDistortionShader.fx index a9e45abb3a..4bb930454c 100644 --- a/Effects/BasicTextureDistortionShader.fx +++ b/Effects/BasicTextureDistortionShader.fx @@ -1,14 +1,16 @@ sampler baseTexture : register(s0); sampler distortionTexture : register(s1); +float time; +float noiseScale; +float distortionStrength; float2 timeOffset; -float2 noiseScaleStrength; float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR { - float2 distortedCoords = coords * noiseScaleStrength.x + timeOffset; - float distortion = tex2D(distortionTexture, distortedCoords).r * noiseScaleStrength.y; - return tex2D(baseTexture, coords + distortion) * sampleColor.a; + float2 distortedCoords = coords + float2(time * timeOffset.x, time * timeOffset.y); + float distortion = tex2D(distortionTexture, distortedCoords * noiseScale).r; + return tex2D(baseTexture, coords + distortion * distortionStrength); } technique Technique1 diff --git a/Effects/BasicTextureDistortionShader.xnb b/Effects/BasicTextureDistortionShader.xnb index b556cca62c..4eca078ba2 100644 Binary files a/Effects/BasicTextureDistortionShader.xnb and b/Effects/BasicTextureDistortionShader.xnb differ diff --git a/Effects/BasicTint.fx b/Effects/BasicTint.fx index 8b3b2268c2..ca360c3e68 100644 --- a/Effects/BasicTint.fx +++ b/Effects/BasicTint.fx @@ -3,7 +3,7 @@ sampler uImage1 : register(s1); float3 uColor; float3 uSecondaryColor; float uOpacity; -float uSaturation; +float uSaturation; // Saturation gets used as a "true" opacity float uRotation; float uTime; float4 uSourceRect; @@ -20,7 +20,7 @@ float4 Recolor(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 float4 color = tex2D(uImage0, coords); float originalAlpha = color.a; color.rbg = lerp(color.rbg, uColor, uOpacity); - return color * originalAlpha; + return color * originalAlpha * uSaturation; } diff --git a/Effects/BasicTint.xnb b/Effects/BasicTint.xnb index 4b02bc2bdc..3fe8964653 100644 Binary files a/Effects/BasicTint.xnb and b/Effects/BasicTint.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 18993d5e2d..6bacb6fc1e 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -129,10 +129,10 @@ namespace CalamityMod.Effects // Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1. internal static Asset DoGPortalShader; - // Used to render all-encompassing fog in the Floral Paradise biome. + // Unused, renders all-encompassing fog. internal static Asset FogShader; - // Used to render background water features in the Floral Paradise biome. + // Unused, renders background water features. internal static Asset WaterfallShader; // Metaballs. See the MetaballManager class for comments on how this system works. @@ -257,6 +257,18 @@ namespace CalamityMod.Effects // The shader effect used for Voidragon's Abyssal Fire laser projectile. internal static Asset AbyssalFireShader; + + // A simple chromatic abberation effect shader with support for custom abberation colors. + internal static Asset ChromaticAbberationShader; + + // Distorts a texture using a sine wave of specified amplitude and frequency either vertically or horizontally. + internal static Asset SineWaveDistortionShader; + + // 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 @@ -264,6 +276,7 @@ namespace CalamityMod.Effects internal static Asset SeaPrismColorBlendingShader; internal static Asset Dissolve; + internal static Asset PaletteSwap; internal static Asset BrainOfCthulhuForcefield; #endregion @@ -519,6 +532,18 @@ namespace CalamityMod.Effects AbyssalFireShader = LoadShader("AbyssalFireShader"); RegisterMiscShader(AbyssalFireShader, "LaserPass", "AbyssalFire"); + + ChromaticAbberationShader = LoadShader("ChromaticAbberationShader"); + RegisterMiscShader(ChromaticAbberationShader, "ChormaAbberationPass", "ChromaticAbberation"); + + SineWaveDistortionShader = LoadShader("SineWaveDistortionShader"); + RegisterMiscShader(SineWaveDistortionShader, "SinePass", "SineWaveDistortion"); + + HorribleHogAuraShader = LoadShader("HorribleHogAuraShader"); + RegisterMiscShader(HorribleHogAuraShader, "ScaryAuraPass", "HorribleHogAura"); + + ProvidenceHolyOrbTrailShader = LoadShader("ProvidenceHolyOrbTrailShader"); + RegisterMiscShader(ProvidenceHolyOrbTrailShader, "TrailPass", "ProvidenceHolyOrbTrail"); #endregion #region Loading Big E's Shaders @@ -531,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/ChromaticAbberationShader.fx b/Effects/ChromaticAbberationShader.fx new file mode 100644 index 0000000000..73ee7a5a06 --- /dev/null +++ b/Effects/ChromaticAbberationShader.fx @@ -0,0 +1,48 @@ +sampler baseTexture : register(s0); + +bool useCustomColors; +float abberationStrength; +float2 impactPosition; +float3 primaryAbberationColor; +float3 secondaryAbberationColor; +float3 tertiaryAbberationColor; + +float3 ChromaticAbberation(sampler2D samplerTexture, float2 coords) +{ + // Calculate the distortion level of each color. + float separation = abberationStrength / distance(coords, impactPosition); + float rColor = tex2D(samplerTexture, coords + float2(-1, -1) * separation).r; + float gColor = tex2D(samplerTexture, coords + float2(1, -1) * separation).g; + float bColor = tex2D(samplerTexture, coords + float2(0, 1) * separation).b; + + // Return the three calculations as one singular color. + float3 returnColor = float3(rColor, gColor, bColor); + return returnColor; +} + +float3 ChromaticAbberation_CustomColors(sampler2D samplerTexture, float2 coords) +{ + // Calculate the distortion level of each color. + float separation = abberationStrength / distance(coords, impactPosition); + float4 pColor = tex2D(samplerTexture, coords + float2(-1, -1) * separation) * float4(primaryAbberationColor, 1); + float4 sColor = tex2D(samplerTexture, coords + float2(1, -1) * separation) * float4(primaryAbberationColor, 1); + float4 tColor = tex2D(samplerTexture, coords + float2(0, 1) * separation) * float4(primaryAbberationColor, 1); + + // Return the three calculations as one singular color. + float3 returnColor = saturate(pColor + sColor + tColor); + return returnColor; +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float3 color = useCustomColors ? ChromaticAbberation_CustomColors(baseTexture, coords) : ChromaticAbberation(baseTexture, coords); + return sampleColor * float4(color, 1.0); +} + +technique Technique1 +{ + pass ChormaAbberationPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/ChromaticAbberationShader.xnb b/Effects/ChromaticAbberationShader.xnb new file mode 100644 index 0000000000..2c992a1046 Binary files /dev/null and b/Effects/ChromaticAbberationShader.xnb differ diff --git a/Effects/HorribleHogAuraShader.fx b/Effects/HorribleHogAuraShader.fx new file mode 100644 index 0000000000..7faee3d468 --- /dev/null +++ b/Effects/HorribleHogAuraShader.fx @@ -0,0 +1,68 @@ +sampler vortexNoiseTexture : register(s0); +sampler vortexNoiseTexture2 : register(s1); +sampler distortionTexture : register(s2); + +float time; +float colorPaletteLimit; +float spiralArms; +float spiralAdditionalAngle; +float minPixelFadeDistance; +float maxPixelFadeDistance; + +float2 pixelatonFactor; +float2 spiralTimeOffset; +float2 pixelationFactor; +float3 vortexDarkColor; +float3 vortexBrightColor; + +float inverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // Pixelate. + coords = round(coords * pixelationFactor) / pixelationFactor; + + float2 centeredCoords = coords - 0.5; + float polarAngle = atan2(centeredCoords.y, centeredCoords.x) / 6.283; + float distanceToCenter = length(centeredCoords); + float2 polarCoords = float2(polarAngle, distanceToCenter); + + // Define coordinates for creating the vortex effect. + float vortexRadius = pow(distanceToCenter, 0.6); + float vortexAngle = spiralArms * atan2(centeredCoords.y, centeredCoords.x) / 3.141 + spiralAdditionalAngle * vortexRadius; + float2 vortexPolarCoords = float2(vortexAngle, vortexRadius) * 0.5 + float2(time * spiralTimeOffset.x, time * spiralTimeOffset.y); + + // Add some distortion over it. + float distortion1 = tex2D(distortionTexture, coords * 0.46 + float2(time * -0.02, time * 0.022)).r; + float distortion2 = tex2D(distortionTexture, coords * 0.32 + float2(time * 0.018, time * -0.03)).r; + float totalDistortion = (distortion1 * 0.5) + (distortion2 * 0.5); + + float4 vortexNoiseColor1 = tex2D(vortexNoiseTexture, vortexPolarCoords + totalDistortion); + float4 vortexNoiseColor2 = tex2D(vortexNoiseTexture2, polarCoords + float2(time * -0.02, time * -0.092) + totalDistortion * 0.64); + float4 vortexNoiseColor = lerp(vortexNoiseColor1, vortexNoiseColor2, inverseLerp(0, maxPixelFadeDistance - 0.075, distanceToCenter)); + + // Apply coloration based on pixel brightness. + float brightness = (vortexNoiseColor.r + vortexNoiseColor.g + vortexNoiseColor.b) / 3.0; + vortexNoiseColor.rgb *= lerp(vortexDarkColor, vortexBrightColor, brightness); + + // Quantization. + vortexNoiseColor = round(vortexNoiseColor * colorPaletteLimit) / colorPaletteLimit; + + // Fade out at the edge of the texture. + float edgeFade = inverseLerp(0, minPixelFadeDistance - 0.016, distanceToCenter) * inverseLerp(maxPixelFadeDistance, minPixelFadeDistance, distanceToCenter); + // float edgeOffset = tex2D(edgeFadeTexture, vortexPolarCoords + float2(time * spiralTimeOffset.x, time * spiralTimeOffset.y)).r * 0.13; + // float edgeFade = smoothstep(0.5, opacityCutoffValue, polarCoords.y + edgeOffset); + + return (vortexNoiseColor * edgeFade) * sampleColor.a; +} + +technique Technique1 +{ + pass ScaryAuraPass + { + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/HorribleHogAuraShader.xnb b/Effects/HorribleHogAuraShader.xnb new file mode 100644 index 0000000000..b9d08f97ca Binary files /dev/null and b/Effects/HorribleHogAuraShader.xnb differ 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/Effects/RotateSprite.fx b/Effects/RotateSprite.fx index bd91a83ed0..8da18993da 100644 --- a/Effects/RotateSprite.fx +++ b/Effects/RotateSprite.fx @@ -1,9 +1,7 @@ -float rotation; // The rotation of the sprite. -float4 color; - - -texture sampleTexture; -sampler2D Texture1Sampler = sampler_state { texture = ; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; }; +sampler baseTexture : register(s0); +float rotation; // The rotation of the sprite. +float2 spriteDimensions; // Dimensions of the sprite. +float4 spriteRectangle; // For use with animated sprites. float realCos(float value) { @@ -11,7 +9,7 @@ float realCos(float value) } //This only works on square sprites. -float4 main(float2 uv : TEXCOORD) : COLOR +float4 main(float4 sampleColor : COLOR0, float2 uv : TEXCOORD0) : COLOR0 { float2x2 rotate = float2x2(realCos(rotation), -sin(rotation), sin(rotation), realCos(rotation)); float spriteDiagonal = 1 / (sqrt(2) / 2); @@ -19,14 +17,14 @@ float4 main(float2 uv : TEXCOORD) : COLOR uv += float2(-0.5, -0.5); //remap the uv to (-0.5, -0.5) - (0.5, 0.5) for trig to work. uv = mul(uv, rotate); - uv = mul(uv, downscale); + //uv = mul(uv, downscale); uv += float2(0.5, 0.5); //remap the uv properly //Crop (Attempting to sample a texture with coordinates that arent between 0 to 1 wraps it around if (uv.x < 0 || uv.x >= 1 || uv.y < 0 || uv.y >= 1) return float4(0, 0, 0, 0); - return tex2D(Texture1Sampler, uv) * color; + return tex2D(baseTexture, uv) * sampleColor; } technique Technique1 diff --git a/Effects/RotateSprite.xnb b/Effects/RotateSprite.xnb index fd51404d21..8208af3e57 100644 Binary files a/Effects/RotateSprite.xnb and b/Effects/RotateSprite.xnb differ diff --git a/Effects/SineWaveDistortionShader.fx b/Effects/SineWaveDistortionShader.fx new file mode 100644 index 0000000000..8b2b18ffa4 --- /dev/null +++ b/Effects/SineWaveDistortionShader.fx @@ -0,0 +1,27 @@ +sampler baseTexture : register(s0); + +float time; +float waveAmplitude; +float waveFrequency; +bool distortHorizontally; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 horizontalDistortion = sin(coords.x * waveFrequency + time) * waveAmplitude; + float2 verticalDistortion = sin(coords.y * waveFrequency + time) * waveAmplitude; + + if (distortHorizontally) + coords.y += horizontalDistortion; + else + coords.x += verticalDistortion; + + return tex2D(baseTexture, coords) * sampleColor; +} + +technique Technique1 +{ + pass SinePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/SineWaveDistortionShader.xnb b/Effects/SineWaveDistortionShader.xnb new file mode 100644 index 0000000000..752479a1a4 Binary files /dev/null and b/Effects/SineWaveDistortionShader.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/ExtraTextures/AmidiasTrident_Stacks.png b/ExtraTextures/AmidiasTrident_Stacks.png deleted file mode 100644 index 461c2d64a9..0000000000 Binary files a/ExtraTextures/AmidiasTrident_Stacks.png and /dev/null differ diff --git a/ExtraTextures/BloomFlare.png b/ExtraTextures/BloomFlare.png new file mode 100644 index 0000000000..c92cf061d2 Binary files /dev/null and b/ExtraTextures/BloomFlare.png differ diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index 7eaf854a40..7e19975be1 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.GameContent; @@ -10,13 +11,7 @@ namespace CalamityMod.ExtraTextures [Autoload(Side = ModSide.Client)] public class ExtraTextureRefs : ModSystem { - // Destroyer glowmasks - public static Asset DestroyerHeadGlowmask; - public static Asset DestroyerBodyGlowmask; - public static Asset DestroyerTailGlowmask; - - // WoF, These are not "exactly" the ExtraTextures. But - public static Asset WallOfFleshEyeGlowmask; + // WoF, These are not "exactly" the ExtraTextures public static Asset WallOfFleshDemonSickleTexture; // Flying Carpet Replacements @@ -28,6 +23,10 @@ namespace CalamityMod.ExtraTextures public static Asset LuckIconVanilla; public static Asset LuckIconLesser; + // Blighted Slime Buff icons + public static Asset BlightedSlimeCorroIcon; + public static Asset BlightedSlimeCrimIcon; + // Particles public static Asset CircularSmear; public static Asset CircularSmearFire1; @@ -38,11 +37,6 @@ namespace CalamityMod.ExtraTextures // TODO: - Every other ExtraTextures Reference could be move in here public override void OnModLoad() { - DestroyerHeadGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow", AssetRequestMode.AsyncLoad); - DestroyerBodyGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); - DestroyerTailGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); - - WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); FlyingCarpetVanilla = TextureAssets.FlyingCarpet; @@ -52,6 +46,9 @@ namespace CalamityMod.ExtraTextures LuckIconVanilla = TextureAssets.Buff[BuffID.Lucky]; LuckIconLesser = ModContent.Request("CalamityMod/ExtraTextures/VanillaBuffs/LuckyLesser", AssetRequestMode.AsyncLoad); + BlightedSlimeCorroIcon = ModContent.Request("CalamityMod/Buffs/Summon/BlightedSlime"); + BlightedSlimeCrimIcon = ModContent.Request("CalamityMod/Buffs/Summon/BlightedSlimeCrimson"); + CircularSmear = ModContent.Request("CalamityMod/Particles/CircularSmear", AssetRequestMode.AsyncLoad); CircularSmearFire1 = ModContent.Request("CalamityMod/Particles/CircularSmearFire1", AssetRequestMode.AsyncLoad); CircularSmearFire2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire2", AssetRequestMode.AsyncLoad); diff --git a/ExtraTextures/FadedStarRing.png b/ExtraTextures/FadedStarRing.png new file mode 100644 index 0000000000..29536fb0d7 Binary files /dev/null and b/ExtraTextures/FadedStarRing.png differ diff --git a/ExtraTextures/MagicStarCircle.png b/ExtraTextures/MagicStarCircle.png new file mode 100644 index 0000000000..594256e368 Binary files /dev/null and b/ExtraTextures/MagicStarCircle.png differ diff --git a/ExtraTextures/ShineFlare.png b/ExtraTextures/ShineFlare.png new file mode 100644 index 0000000000..5e8c572de2 Binary files /dev/null and b/ExtraTextures/ShineFlare.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png deleted file mode 100644 index 3e2235cd1d..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow.png and /dev/null differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png deleted file mode 100644 index 4530739af2..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/DestroyerHeadGlow.png and /dev/null differ diff --git a/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png b/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png deleted file mode 100644 index 2fcbcceb81..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow.png and /dev/null differ diff --git a/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png b/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png deleted file mode 100644 index a988d2bbdc..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/SkeletronPrimeHeadGlow.png and /dev/null differ diff --git a/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png b/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png deleted file mode 100644 index 2f52bdb33a..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow.png and /dev/null differ diff --git a/Gores/AquaticScourgeGores/AquaticParasite1.png b/Gores/AquaticScourgeGores/AquaticParasite1.png deleted file mode 100644 index f652388f71..0000000000 Binary files a/Gores/AquaticScourgeGores/AquaticParasite1.png and /dev/null differ diff --git a/Gores/AquaticScourgeGores/AquaticParasite2.png b/Gores/AquaticScourgeGores/AquaticParasite2.png deleted file mode 100644 index 82a0aa1720..0000000000 Binary files a/Gores/AquaticScourgeGores/AquaticParasite2.png and /dev/null differ diff --git a/Gores/AquaticScourgeGores/AquaticSeekerBody.png b/Gores/AquaticScourgeGores/AquaticSeekerBody.png deleted file mode 100644 index fb1978fced..0000000000 Binary files a/Gores/AquaticScourgeGores/AquaticSeekerBody.png and /dev/null differ diff --git a/Gores/AquaticScourgeGores/AquaticSeekerHead.png b/Gores/AquaticScourgeGores/AquaticSeekerHead.png deleted file mode 100644 index ab7b02b78b..0000000000 Binary files a/Gores/AquaticScourgeGores/AquaticSeekerHead.png and /dev/null differ diff --git a/Gores/AquaticScourgeGores/AquaticSeekerTail.png b/Gores/AquaticScourgeGores/AquaticSeekerTail.png deleted file mode 100644 index f4da7fb3a7..0000000000 Binary files a/Gores/AquaticScourgeGores/AquaticSeekerTail.png and /dev/null differ diff --git a/Gores/CalamitasGores/LifeSeeker.png b/Gores/CalamitasGores/LifeSeeker.png deleted file mode 100644 index 398861be36..0000000000 Binary files a/Gores/CalamitasGores/LifeSeeker.png and /dev/null differ diff --git a/Gores/CalamitasGores/LifeSeeker2.png b/Gores/CalamitasGores/LifeSeeker2.png deleted file mode 100644 index d51c94f12d..0000000000 Binary files a/Gores/CalamitasGores/LifeSeeker2.png and /dev/null differ diff --git a/Gores/CalamitasGores/LifeSeeker3.png b/Gores/CalamitasGores/LifeSeeker3.png deleted file mode 100644 index dd3f95427d..0000000000 Binary files a/Gores/CalamitasGores/LifeSeeker3.png and /dev/null differ diff --git a/Gores/CalamitasGores/SoulSlurper.png b/Gores/CalamitasGores/SoulSlurper.png deleted file mode 100644 index 63911dc0f4..0000000000 Binary files a/Gores/CalamitasGores/SoulSlurper.png and /dev/null differ diff --git a/Gores/CalamitasGores/SoulSlurper2.png b/Gores/CalamitasGores/SoulSlurper2.png deleted file mode 100644 index 9f7519fd46..0000000000 Binary files a/Gores/CalamitasGores/SoulSlurper2.png and /dev/null differ diff --git a/Gores/CalamitasGores/SoulSlurper3.png b/Gores/CalamitasGores/SoulSlurper3.png deleted file mode 100644 index d752cbe4e8..0000000000 Binary files a/Gores/CalamitasGores/SoulSlurper3.png and /dev/null differ diff --git a/Gores/CalamitasGores/SoulSlurper4.png b/Gores/CalamitasGores/SoulSlurper4.png deleted file mode 100644 index 2d6924f39f..0000000000 Binary files a/Gores/CalamitasGores/SoulSlurper4.png and /dev/null differ diff --git a/Gores/Cryocore.png b/Gores/Cryocore.png deleted file mode 100644 index cbf2143aa0..0000000000 Binary files a/Gores/Cryocore.png and /dev/null differ diff --git a/Gores/Cryocore2.png b/Gores/Cryocore2.png deleted file mode 100644 index e63a1f27e0..0000000000 Binary files a/Gores/Cryocore2.png and /dev/null differ diff --git a/Gores/DoGBody.png b/Gores/DoGBody.png deleted file mode 100644 index 3bd4321383..0000000000 Binary files a/Gores/DoGBody.png and /dev/null differ diff --git a/Gores/DoGBody2.png b/Gores/DoGBody2.png deleted file mode 100644 index ce1193d555..0000000000 Binary files a/Gores/DoGBody2.png and /dev/null differ diff --git a/Gores/DoGBody3.png b/Gores/DoGBody3.png deleted file mode 100644 index 2e2616f6a3..0000000000 Binary files a/Gores/DoGBody3.png and /dev/null differ diff --git a/Gores/DoGHead.png b/Gores/DoGHead.png deleted file mode 100644 index f33c23b97e..0000000000 Binary files a/Gores/DoGHead.png and /dev/null differ diff --git a/Gores/DoGTail.png b/Gores/DoGTail.png deleted file mode 100644 index 65f911efda..0000000000 Binary files a/Gores/DoGTail.png and /dev/null differ diff --git a/Gores/DoT.png b/Gores/DoT.png deleted file mode 100644 index 2522740775..0000000000 Binary files a/Gores/DoT.png and /dev/null differ diff --git a/Gores/DoT2.png b/Gores/DoT2.png deleted file mode 100644 index 7d83341fd1..0000000000 Binary files a/Gores/DoT2.png and /dev/null differ diff --git a/Gores/DoT3.png b/Gores/DoT3.png deleted file mode 100644 index 872927462a..0000000000 Binary files a/Gores/DoT3.png and /dev/null differ diff --git a/Gores/DoT4.png b/Gores/DoT4.png deleted file mode 100644 index 8865c715ba..0000000000 Binary files a/Gores/DoT4.png and /dev/null differ diff --git a/Gores/DoT5.png b/Gores/DoT5.png deleted file mode 100644 index 19ccf524a2..0000000000 Binary files a/Gores/DoT5.png and /dev/null differ diff --git a/Gores/Foveanator/Foveanator1.png b/Gores/Foveanator/Foveanator1.png deleted file mode 100644 index f83523374e..0000000000 Binary files a/Gores/Foveanator/Foveanator1.png and /dev/null differ diff --git a/Gores/Foveanator/Foveanator2.png b/Gores/Foveanator/Foveanator2.png deleted file mode 100644 index 4f05c9202b..0000000000 Binary files a/Gores/Foveanator/Foveanator2.png and /dev/null differ diff --git a/Gores/Piggy.png b/Gores/Piggy.png new file mode 100644 index 0000000000..576706349c Binary files /dev/null and b/Gores/Piggy.png differ diff --git a/Gores/Piggy2.png b/Gores/Piggy2.png new file mode 100644 index 0000000000..add55f0216 Binary files /dev/null and b/Gores/Piggy2.png differ diff --git a/Gores/PrismShurikenBlade.png b/Gores/PrismShurikenBlade.png deleted file mode 100644 index 650f27e8c1..0000000000 Binary files a/Gores/PrismShurikenBlade.png and /dev/null differ diff --git a/Gores/ScourgePestBody.png b/Gores/ScourgePestBody.png deleted file mode 100644 index e120f5edc7..0000000000 Binary files a/Gores/ScourgePestBody.png and /dev/null differ diff --git a/Gores/ScourgePestBody2.png b/Gores/ScourgePestBody2.png deleted file mode 100644 index 8e07accb80..0000000000 Binary files a/Gores/ScourgePestBody2.png and /dev/null differ diff --git a/Gores/ScourgePestBody3.png b/Gores/ScourgePestBody3.png deleted file mode 100644 index adedc10e2f..0000000000 Binary files a/Gores/ScourgePestBody3.png and /dev/null differ diff --git a/Gores/ScourgePestBody4.png b/Gores/ScourgePestBody4.png deleted file mode 100644 index 7b3f75ea31..0000000000 Binary files a/Gores/ScourgePestBody4.png and /dev/null differ diff --git a/Gores/ScourgePestHead.png b/Gores/ScourgePestHead.png deleted file mode 100644 index b0be38f842..0000000000 Binary files a/Gores/ScourgePestHead.png and /dev/null differ diff --git a/Gores/ScourgePestTail.png b/Gores/ScourgePestTail.png deleted file mode 100644 index 39e6906844..0000000000 Binary files a/Gores/ScourgePestTail.png and /dev/null differ diff --git a/Gores/StasisProbe1.png b/Gores/StasisProbe1.png deleted file mode 100644 index 5ea916d95b..0000000000 Binary files a/Gores/StasisProbe1.png and /dev/null differ diff --git a/Gores/StasisProbeNaked1.png b/Gores/StasisProbeNaked1.png deleted file mode 100644 index c60d12338b..0000000000 Binary files a/Gores/StasisProbeNaked1.png and /dev/null differ diff --git a/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow.png b/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow.png deleted file mode 100644 index cd988d9708..0000000000 Binary files a/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow.png and /dev/null differ diff --git a/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow2.png b/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow2.png deleted file mode 100644 index 2461161b43..0000000000 Binary files a/Gores/SunkenSea/AlphaSeaMinnow/AlphaSeaMinnow2.png and /dev/null differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png new file mode 100644 index 0000000000..8becc53bd0 Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png new file mode 100644 index 0000000000..833c94b601 Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png new file mode 100644 index 0000000000..a4c5766fdb Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png new file mode 100644 index 0000000000..2002e2a9ee Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png differ diff --git a/Gores/SunkenSea/CarrionSwallower/CarrionSwallower.png b/Gores/SunkenSea/CarrionSwallower/CarrionSwallower.png deleted file mode 100644 index 9ce1fb9f9a..0000000000 Binary files a/Gores/SunkenSea/CarrionSwallower/CarrionSwallower.png and /dev/null differ diff --git a/Gores/SunkenSea/CarrionSwallower/CarrionSwallower2.png b/Gores/SunkenSea/CarrionSwallower/CarrionSwallower2.png deleted file mode 100644 index 219840d43c..0000000000 Binary files a/Gores/SunkenSea/CarrionSwallower/CarrionSwallower2.png and /dev/null differ diff --git a/Gores/SunkenSea/Clam/Clam.png b/Gores/SunkenSea/Clam/Clam.png deleted file mode 100644 index d2f7dec5ff..0000000000 Binary files a/Gores/SunkenSea/Clam/Clam.png and /dev/null differ diff --git a/Gores/SunkenSea/Clam/Clam1.png b/Gores/SunkenSea/Clam/Clam1.png new file mode 100644 index 0000000000..ba0409ad2a Binary files /dev/null and b/Gores/SunkenSea/Clam/Clam1.png differ diff --git a/Gores/SunkenSea/Clam/Clam2.png b/Gores/SunkenSea/Clam/Clam2.png index 1238322962..691e235b12 100644 Binary files a/Gores/SunkenSea/Clam/Clam2.png and b/Gores/SunkenSea/Clam/Clam2.png differ diff --git a/Gores/SunkenSea/Clam/Clam3.png b/Gores/SunkenSea/Clam/Clam3.png new file mode 100644 index 0000000000..400b4afe58 Binary files /dev/null and b/Gores/SunkenSea/Clam/Clam3.png differ diff --git a/Gores/SunkenSea/Clam/ClamAlgae.png b/Gores/SunkenSea/Clam/ClamAlgae.png deleted file mode 100644 index 96c5fb5605..0000000000 Binary files a/Gores/SunkenSea/Clam/ClamAlgae.png and /dev/null differ diff --git a/Gores/SunkenSea/Clam/ClamAlgae2.png b/Gores/SunkenSea/Clam/ClamAlgae2.png deleted file mode 100644 index 7895573ce5..0000000000 Binary files a/Gores/SunkenSea/Clam/ClamAlgae2.png and /dev/null differ diff --git a/Gores/SunkenSea/Clam/ClamCoral.png b/Gores/SunkenSea/Clam/ClamCoral.png deleted file mode 100644 index 7d64bc4018..0000000000 Binary files a/Gores/SunkenSea/Clam/ClamCoral.png and /dev/null differ diff --git a/Gores/SunkenSea/Clam/ClamCoral2.png b/Gores/SunkenSea/Clam/ClamCoral2.png deleted file mode 100644 index 27c956b19a..0000000000 Binary files a/Gores/SunkenSea/Clam/ClamCoral2.png and /dev/null differ diff --git a/Gores/SunkenSea/EutrophicRay/EutrophicRay.png b/Gores/SunkenSea/EutrophicRay/EutrophicRay.png deleted file mode 100644 index 396aceb7a2..0000000000 Binary files a/Gores/SunkenSea/EutrophicRay/EutrophicRay.png and /dev/null differ diff --git a/Gores/SunkenSea/EutrophicRay/EutrophicRay2.png b/Gores/SunkenSea/EutrophicRay/EutrophicRay2.png deleted file mode 100644 index e1510c0c33..0000000000 Binary files a/Gores/SunkenSea/EutrophicRay/EutrophicRay2.png and /dev/null differ diff --git a/Gores/SunkenSea/EutrophicRay/RayGore1.png b/Gores/SunkenSea/EutrophicRay/RayGore1.png new file mode 100644 index 0000000000..3ace444fd4 Binary files /dev/null and b/Gores/SunkenSea/EutrophicRay/RayGore1.png differ diff --git a/Gores/SunkenSea/EutrophicRay/RayGore2.png b/Gores/SunkenSea/EutrophicRay/RayGore2.png new file mode 100644 index 0000000000..3ff64c48fd Binary files /dev/null and b/Gores/SunkenSea/EutrophicRay/RayGore2.png differ diff --git a/Gores/SunkenSea/EutrophicRay/RayGore3.png b/Gores/SunkenSea/EutrophicRay/RayGore3.png new file mode 100644 index 0000000000..777469c5cd Binary files /dev/null and b/Gores/SunkenSea/EutrophicRay/RayGore3.png differ diff --git a/Gores/SunkenSea/EutrophicRay/RayGore4.png b/Gores/SunkenSea/EutrophicRay/RayGore4.png new file mode 100644 index 0000000000..8764f51981 Binary files /dev/null and b/Gores/SunkenSea/EutrophicRay/RayGore4.png differ diff --git a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl.png b/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl.png deleted file mode 100644 index be01961e7c..0000000000 Binary files a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl.png and /dev/null differ diff --git a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl2.png b/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl2.png deleted file mode 100644 index dc669f674f..0000000000 Binary files a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl2.png and /dev/null differ diff --git a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl3.png b/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl3.png deleted file mode 100644 index 1944fd7519..0000000000 Binary files a/Gores/SunkenSea/GIldedAxolotl/GildedAxolotl3.png and /dev/null differ diff --git a/Gores/SunkenSea/Grubbolt/Grubbolt.png b/Gores/SunkenSea/Grubbolt/Grubbolt.png deleted file mode 100644 index 6acea8d8a5..0000000000 Binary files a/Gores/SunkenSea/Grubbolt/Grubbolt.png and /dev/null differ diff --git a/Gores/SunkenSea/Grubbolt/Grubbolt2.png b/Gores/SunkenSea/Grubbolt/Grubbolt2.png deleted file mode 100644 index e71263436b..0000000000 Binary files a/Gores/SunkenSea/Grubbolt/Grubbolt2.png and /dev/null differ diff --git a/Gores/SunkenSea/Haunted Chum and Sea Remains/FesteringRemains.png b/Gores/SunkenSea/Haunted Chum and Sea Remains/FesteringRemains.png deleted file mode 100644 index 196d767516..0000000000 Binary files a/Gores/SunkenSea/Haunted Chum and Sea Remains/FesteringRemains.png and /dev/null differ diff --git a/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum.png b/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum.png deleted file mode 100644 index 589fe2d828..0000000000 Binary files a/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum.png and /dev/null differ diff --git a/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum2.png b/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum2.png deleted file mode 100644 index b1c7e2f0d5..0000000000 Binary files a/Gores/SunkenSea/Haunted Chum and Sea Remains/HauntedChum2.png and /dev/null differ diff --git a/Gores/SunkenSea/Jellyghoul/Jellyghoul.png b/Gores/SunkenSea/Jellyghoul/Jellyghoul.png deleted file mode 100644 index afc08ef7ae..0000000000 Binary files a/Gores/SunkenSea/Jellyghoul/Jellyghoul.png and /dev/null differ diff --git a/Gores/SunkenSea/Jellyghoul/Jellyghoul2.png b/Gores/SunkenSea/Jellyghoul/Jellyghoul2.png deleted file mode 100644 index f1681462d6..0000000000 Binary files a/Gores/SunkenSea/Jellyghoul/Jellyghoul2.png and /dev/null differ diff --git a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish.png b/Gores/SunkenSea/LazarusLampfish/LazarusLampfish.png deleted file mode 100644 index b26b49cce2..0000000000 Binary files a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish.png and /dev/null differ diff --git a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish2.png b/Gores/SunkenSea/LazarusLampfish/LazarusLampfish2.png deleted file mode 100644 index d006f89e46..0000000000 Binary files a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish2.png and /dev/null differ diff --git a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish3.png b/Gores/SunkenSea/LazarusLampfish/LazarusLampfish3.png deleted file mode 100644 index cb1508e0a9..0000000000 Binary files a/Gores/SunkenSea/LazarusLampfish/LazarusLampfish3.png and /dev/null differ diff --git a/Gores/SunkenSea/Leerslug/Leerslug.png b/Gores/SunkenSea/Leerslug/Leerslug.png deleted file mode 100644 index fdcaefa78d..0000000000 Binary files a/Gores/SunkenSea/Leerslug/Leerslug.png and /dev/null differ diff --git a/Gores/SunkenSea/Leerslug/Leerslug2.png b/Gores/SunkenSea/Leerslug/Leerslug2.png deleted file mode 100644 index f012792a94..0000000000 Binary files a/Gores/SunkenSea/Leerslug/Leerslug2.png and /dev/null differ diff --git a/Gores/SunkenSea/Mirage Newt/MirageNewt.png b/Gores/SunkenSea/Mirage Newt/MirageNewt.png deleted file mode 100644 index ce4272b30d..0000000000 Binary files a/Gores/SunkenSea/Mirage Newt/MirageNewt.png and /dev/null differ diff --git a/Gores/SunkenSea/Mirage Newt/MirageNewt2.png b/Gores/SunkenSea/Mirage Newt/MirageNewt2.png deleted file mode 100644 index 930ce9bc14..0000000000 Binary files a/Gores/SunkenSea/Mirage Newt/MirageNewt2.png and /dev/null differ diff --git a/Gores/SunkenSea/Mirage Newt/MirageNewt3.png b/Gores/SunkenSea/Mirage Newt/MirageNewt3.png deleted file mode 100644 index 11bd14750f..0000000000 Binary files a/Gores/SunkenSea/Mirage Newt/MirageNewt3.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodBlack.png b/Gores/SunkenSea/Pearlpod/PearlpodBlack.png deleted file mode 100644 index d42d44e8c6..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodBlack.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodBlack2.png b/Gores/SunkenSea/Pearlpod/PearlpodBlack2.png deleted file mode 100644 index eef9f665db..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodBlack2.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodBlack3.png b/Gores/SunkenSea/Pearlpod/PearlpodBlack3.png deleted file mode 100644 index 8791d0d210..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodBlack3.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodPink.png b/Gores/SunkenSea/Pearlpod/PearlpodPink.png deleted file mode 100644 index a8d03fe1cd..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodPink.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodPink2.png b/Gores/SunkenSea/Pearlpod/PearlpodPink2.png deleted file mode 100644 index 78f672c130..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodPink2.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodPink3.png b/Gores/SunkenSea/Pearlpod/PearlpodPink3.png deleted file mode 100644 index a6c8cf5905..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodPink3.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodWhite.png b/Gores/SunkenSea/Pearlpod/PearlpodWhite.png deleted file mode 100644 index c1a450765f..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodWhite.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodWhite2.png b/Gores/SunkenSea/Pearlpod/PearlpodWhite2.png deleted file mode 100644 index 1737b77bd2..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodWhite2.png and /dev/null differ diff --git a/Gores/SunkenSea/Pearlpod/PearlpodWhite3.png b/Gores/SunkenSea/Pearlpod/PearlpodWhite3.png deleted file mode 100644 index f8a8f168c5..0000000000 Binary files a/Gores/SunkenSea/Pearlpod/PearlpodWhite3.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoi.png b/Gores/SunkenSea/PodobooKoi/PodobooKoi.png deleted file mode 100644 index e68deb05db..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoi.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoi2.png b/Gores/SunkenSea/PodobooKoi/PodobooKoi2.png deleted file mode 100644 index fc6e678e33..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoi2.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed.png deleted file mode 100644 index 93cc02efad..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed2.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed2.png deleted file mode 100644 index 3b35ea59fd..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiBubbleEyed2.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiComet.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiComet.png deleted file mode 100644 index 09c8dec8b4..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiComet.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiComet2.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiComet2.png deleted file mode 100644 index 0194fe04d5..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiComet2.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda.png deleted file mode 100644 index c163524603..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda.png and /dev/null differ diff --git a/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda2.png b/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda2.png deleted file mode 100644 index 3935aa8309..0000000000 Binary files a/Gores/SunkenSea/PodobooKoi/PodobooKoiOranda2.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen.png deleted file mode 100644 index b655a527e7..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen2.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen2.png deleted file mode 100644 index 324aeffd13..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaGreen2.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple.png deleted file mode 100644 index aae3859aa8..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple2.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple2.png deleted file mode 100644 index 9383cdba77..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaPurple2.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed.png deleted file mode 100644 index e86217d5f9..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed2.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed2.png deleted file mode 100644 index 3a341d76ff..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaRed2.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise.png deleted file mode 100644 index fe815bf047..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise.png and /dev/null differ diff --git a/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise2.png b/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise2.png deleted file mode 100644 index 17defd1d2f..0000000000 Binary files a/Gores/SunkenSea/PolypPanasea/PolypPanaseaTurquoise2.png and /dev/null differ diff --git a/Gores/SunkenSea/Polyperil/PolyperilBlue.png b/Gores/SunkenSea/Polyperil/PolyperilBlue.png deleted file mode 100644 index ce61222b72..0000000000 Binary files a/Gores/SunkenSea/Polyperil/PolyperilBlue.png and /dev/null differ diff --git a/Gores/SunkenSea/Polyperil/PolyperilGreen.png b/Gores/SunkenSea/Polyperil/PolyperilGreen.png deleted file mode 100644 index 8b57639463..0000000000 Binary files a/Gores/SunkenSea/Polyperil/PolyperilGreen.png and /dev/null differ diff --git a/Gores/SunkenSea/Polyperil/PolyperilPink.png b/Gores/SunkenSea/Polyperil/PolyperilPink.png deleted file mode 100644 index 6ba55362c1..0000000000 Binary files a/Gores/SunkenSea/Polyperil/PolyperilPink.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue.png deleted file mode 100644 index 567f027535..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue2.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue2.png deleted file mode 100644 index 9f64e00f3c..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue2.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue3.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue3.png deleted file mode 100644 index e7551a56e2..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyBlue3.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen.png deleted file mode 100644 index b152a273f6..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen2.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen2.png deleted file mode 100644 index 43f50afc97..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen2.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen3.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen3.png deleted file mode 100644 index 652ad65b71..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyGreen3.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink.png deleted file mode 100644 index c81d50f4e2..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink2.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink2.png deleted file mode 100644 index f6f9f468ae..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink2.png and /dev/null differ diff --git a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink3.png b/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink3.png deleted file mode 100644 index 71a419fafc..0000000000 Binary files a/Gores/SunkenSea/PrismaticGuppy/PrismaticGuppyPink3.png and /dev/null differ diff --git a/Gores/SunkenSea/Prismback/PrismBackGore1.png b/Gores/SunkenSea/Prismback/PrismBackGore1.png new file mode 100644 index 0000000000..1446f7794a Binary files /dev/null and b/Gores/SunkenSea/Prismback/PrismBackGore1.png differ diff --git a/Gores/SunkenSea/Prismback/PrismBackGore2.png b/Gores/SunkenSea/Prismback/PrismBackGore2.png new file mode 100644 index 0000000000..b2fd0ca380 Binary files /dev/null and b/Gores/SunkenSea/Prismback/PrismBackGore2.png differ diff --git a/Gores/SunkenSea/Prismback/PrismBackGore3.png b/Gores/SunkenSea/Prismback/PrismBackGore3.png new file mode 100644 index 0000000000..45487321c7 Binary files /dev/null and b/Gores/SunkenSea/Prismback/PrismBackGore3.png differ diff --git a/Gores/SunkenSea/Prismback/PrismBackGore4.png b/Gores/SunkenSea/Prismback/PrismBackGore4.png new file mode 100644 index 0000000000..be6c485878 Binary files /dev/null and b/Gores/SunkenSea/Prismback/PrismBackGore4.png differ diff --git a/Gores/SunkenSea/Prismback/PrismBackGore5.png b/Gores/SunkenSea/Prismback/PrismBackGore5.png new file mode 100644 index 0000000000..55d6e76bee Binary files /dev/null and b/Gores/SunkenSea/Prismback/PrismBackGore5.png differ diff --git a/Gores/SunkenSea/Prismback/Prismback.png b/Gores/SunkenSea/Prismback/Prismback.png deleted file mode 100644 index 0d5ea0d78a..0000000000 Binary files a/Gores/SunkenSea/Prismback/Prismback.png and /dev/null differ diff --git a/Gores/SunkenSea/Prismback/Prismback2.png b/Gores/SunkenSea/Prismback/Prismback2.png deleted file mode 100644 index 4b5dc72a4e..0000000000 Binary files a/Gores/SunkenSea/Prismback/Prismback2.png and /dev/null differ diff --git a/Gores/SunkenSea/Prismback/Prismback3.png b/Gores/SunkenSea/Prismback/Prismback3.png deleted file mode 100644 index 52857340b8..0000000000 Binary files a/Gores/SunkenSea/Prismback/Prismback3.png and /dev/null differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout.png b/Gores/SunkenSea/Probesnout/Probesnout.png deleted file mode 100644 index c0b8f8adb0..0000000000 Binary files a/Gores/SunkenSea/Probesnout/Probesnout.png and /dev/null differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout2.png b/Gores/SunkenSea/Probesnout/Probesnout2.png deleted file mode 100644 index 3de6b17ddb..0000000000 Binary files a/Gores/SunkenSea/Probesnout/Probesnout2.png and /dev/null differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout3.png b/Gores/SunkenSea/Probesnout/Probesnout3.png deleted file mode 100644 index c8f50fa486..0000000000 Binary files a/Gores/SunkenSea/Probesnout/Probesnout3.png and /dev/null differ diff --git a/Gores/SunkenSea/Probesnout/Probesnout4.png b/Gores/SunkenSea/Probesnout/Probesnout4.png deleted file mode 100644 index cf0133ad3c..0000000000 Binary files a/Gores/SunkenSea/Probesnout/Probesnout4.png and /dev/null differ diff --git a/Gores/SunkenSea/Scavenger/Scavenger.png b/Gores/SunkenSea/Scavenger/Scavenger.png deleted file mode 100644 index 4be4f6e5b4..0000000000 Binary files a/Gores/SunkenSea/Scavenger/Scavenger.png and /dev/null differ diff --git a/Gores/SunkenSea/Scavenger/Scavenger2.png b/Gores/SunkenSea/Scavenger/Scavenger2.png deleted file mode 100644 index fc36e784b8..0000000000 Binary files a/Gores/SunkenSea/Scavenger/Scavenger2.png and /dev/null differ diff --git a/Gores/SunkenSea/Scavenger/Scavenger3.png b/Gores/SunkenSea/Scavenger/Scavenger3.png deleted file mode 100644 index f37a521d25..0000000000 Binary files a/Gores/SunkenSea/Scavenger/Scavenger3.png and /dev/null differ diff --git a/Gores/SunkenSea/SeaFloaty/SeaFloaty.png b/Gores/SunkenSea/SeaFloaty/SeaFloaty.png deleted file mode 100644 index 38c0343762..0000000000 Binary files a/Gores/SunkenSea/SeaFloaty/SeaFloaty.png and /dev/null differ diff --git a/Gores/SunkenSea/SeaFloaty/SeaFloatyGore1.png b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore1.png new file mode 100644 index 0000000000..f168424afd Binary files /dev/null and b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore1.png differ diff --git a/Gores/SunkenSea/SeaFloaty/SeaFloatyGore2.png b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore2.png new file mode 100644 index 0000000000..2d117496cd Binary files /dev/null and b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore2.png differ diff --git a/Gores/SunkenSea/SeaFloaty/SeaFloatyGore3.png b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore3.png new file mode 100644 index 0000000000..e6d79b947c Binary files /dev/null and b/Gores/SunkenSea/SeaFloaty/SeaFloatyGore3.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png new file mode 100644 index 0000000000..828fc5cab8 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png new file mode 100644 index 0000000000..e34333cc3a Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png new file mode 100644 index 0000000000..0835dffcf4 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png new file mode 100644 index 0000000000..fc0b44b6b2 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png new file mode 100644 index 0000000000..c39cf01434 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png differ diff --git a/Gores/SunkenSea/Searslug/Searslug.png b/Gores/SunkenSea/Searslug/Searslug.png deleted file mode 100644 index 50919d11d2..0000000000 Binary files a/Gores/SunkenSea/Searslug/Searslug.png and /dev/null differ diff --git a/Gores/SunkenSea/Searslug/Searslug2.png b/Gores/SunkenSea/Searslug/Searslug2.png deleted file mode 100644 index 5cecafe7eb..0000000000 Binary files a/Gores/SunkenSea/Searslug/Searslug2.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon.png b/Gores/SunkenSea/Sharkoon/Sharkoon.png deleted file mode 100644 index f970a5057d..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon2.png b/Gores/SunkenSea/Sharkoon/Sharkoon2.png deleted file mode 100644 index a43f486c3a..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon2.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon3.png b/Gores/SunkenSea/Sharkoon/Sharkoon3.png deleted file mode 100644 index 37ded0e054..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon3.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon4.png b/Gores/SunkenSea/Sharkoon/Sharkoon4.png deleted file mode 100644 index 14c6732baf..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon4.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon5.png b/Gores/SunkenSea/Sharkoon/Sharkoon5.png deleted file mode 100644 index 68e7fdcc27..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon5.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/Sharkoon6.png b/Gores/SunkenSea/Sharkoon/Sharkoon6.png deleted file mode 100644 index a397daba9c..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/Sharkoon6.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/SharkoonSmall.png b/Gores/SunkenSea/Sharkoon/SharkoonSmall.png deleted file mode 100644 index 5d5a8ff043..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/SharkoonSmall.png and /dev/null differ diff --git a/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png b/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png deleted file mode 100644 index a50626462c..0000000000 Binary files a/Gores/SunkenSea/Sharkoon/SharkoonSmall2.png and /dev/null differ diff --git a/Gores/SunkenSea/Shoreskipper/Shoreskipper.png b/Gores/SunkenSea/Shoreskipper/Shoreskipper.png deleted file mode 100644 index cf34b7503a..0000000000 Binary files a/Gores/SunkenSea/Shoreskipper/Shoreskipper.png and /dev/null differ diff --git a/Gores/SunkenSea/Shoreskipper/Shoreskipper2.png b/Gores/SunkenSea/Shoreskipper/Shoreskipper2.png deleted file mode 100644 index bea9f285b7..0000000000 Binary files a/Gores/SunkenSea/Shoreskipper/Shoreskipper2.png and /dev/null differ diff --git a/Gores/SunkenSea/Steampod/Steampod.png b/Gores/SunkenSea/Steampod/Steampod.png deleted file mode 100644 index 002b1e52fa..0000000000 Binary files a/Gores/SunkenSea/Steampod/Steampod.png and /dev/null differ diff --git a/Gores/SunkenSea/Steampod/Steampod2.png b/Gores/SunkenSea/Steampod/Steampod2.png deleted file mode 100644 index 502f50e75f..0000000000 Binary files a/Gores/SunkenSea/Steampod/Steampod2.png and /dev/null differ diff --git a/Gores/SunkenSea/Steampod/Steampod3.png b/Gores/SunkenSea/Steampod/Steampod3.png deleted file mode 100644 index 871c61b10a..0000000000 Binary files a/Gores/SunkenSea/Steampod/Steampod3.png and /dev/null differ diff --git a/Gores/SunkenSea/StormlionSentry/StormlionSentry.png b/Gores/SunkenSea/StormlionSentry/StormlionSentry.png deleted file mode 100644 index dc5d98002b..0000000000 Binary files a/Gores/SunkenSea/StormlionSentry/StormlionSentry.png and /dev/null differ diff --git a/Gores/SunkenSea/StormlionSentry/StormlionSentry2.png b/Gores/SunkenSea/StormlionSentry/StormlionSentry2.png deleted file mode 100644 index 6adb6639e4..0000000000 Binary files a/Gores/SunkenSea/StormlionSentry/StormlionSentry2.png and /dev/null differ diff --git a/Gores/SunkenSea/StormlionSentry/StormlionSentry3.png b/Gores/SunkenSea/StormlionSentry/StormlionSentry3.png deleted file mode 100644 index aa97a735b4..0000000000 Binary files a/Gores/SunkenSea/StormlionSentry/StormlionSentry3.png and /dev/null differ diff --git a/Gores/TarraHeart.png b/Gores/TarraHeart.png deleted file mode 100644 index dc382d7695..0000000000 Binary files a/Gores/TarraHeart.png and /dev/null differ diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 4000c108ed..93c842f281 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; @@ -83,7 +84,6 @@ namespace CalamityMod.ILEditing On_Player.Teleport += TPOverride; On_TileDrawing.DrawSingleTile += GlowMaskTileRender; On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; - On_Player.ItemCheck_ReleaseCritter += ReleaseCritterVariant; On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck; On_Projectile.AI_007_GrapplingHooks += AllowHooksToGrabArenabox; On_Collision.SolidCollision_Vector2_int_int += ArenaCollision_Vector2_int_int; @@ -142,6 +142,8 @@ namespace CalamityMod.ILEditing IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition; IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition; + IL_WorldGen.IslandHouse += MakeFledgingWingsMoreCommon; + IL_WorldGen.AddBuriedChest_int_int_int_bool_int_bool_ushort += DisableFledglingWingsSecondary; // Removal of vanilla stupidity IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs; @@ -154,8 +156,6 @@ namespace CalamityMod.ILEditing IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; - IL_Projectile.AI_061_FishingBobber += WhitelistVictideBobber; - On_Player.ItemCheck_CheckFishingBobbers += PreventVictideBobberFromJamming; IL_Projectile.CanExplodeTile += MakeMeteoriteExplodable; IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 775374dc21..34e8809ea7 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; @@ -236,14 +237,6 @@ namespace CalamityMod.ILEditing dir = self.direction; dashing = true; - // CIT 16OCT2024: Commented this code out, as there's no reason for custom dash hotkey to use Player.dashTime - // and was causing the return of Celestial Starboard's dash bug from early 1.4 versions - /*if ((self.dashTime <= 0 && self.direction == -1) || (self.dashTime >= 0 && self.direction == 1)) - { - self.dashTime = 15; - return; - }*/ - dashing = true; self.dashTime = 0; self.timeSinceLastDashStarted = 0; @@ -251,7 +244,7 @@ namespace CalamityMod.ILEditing return; } - if (CalamityKeybinds.DashHotkey.GetAssignedKeysOrEmpty().Count == 0) + if (CalamityKeybinds.DashHotkey.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count == 0) orig(self, out dir, out dashing, dashStartAction); else { @@ -326,6 +319,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) { @@ -639,8 +653,14 @@ namespace CalamityMod.ILEditing { if (self.Calamity().ChaosStone) { + if (amount <= -1) + amount = self.GetManaCost(item); + if (pay) + { self.statMana -= item.mana; + CombinedHooks.OnConsumeMana(self, item, amount); + } if (self.statMana < -self.statManaMax2) self.statMana = -self.statManaMax2; return true; @@ -695,7 +715,10 @@ namespace CalamityMod.ILEditing ref FluidField calamityFireDrawer = ref player.Calamity().CalamityFireDrawer; ref Vector2 firePosition = ref player.Calamity().FireDrawerPosition; if (calamityFireDrawer is null || calamityFireDrawer.Size != size) + { + calamityFireDrawer?.Dispose(); calamityFireDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); + } // Update the fire draw position. firePosition = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; @@ -1118,19 +1141,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 { @@ -1653,164 +1749,6 @@ namespace CalamityMod.ILEditing #endregion - #region Sunken Sea critter variants - public static void ReleaseCritterVariant(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) - { - int mouseX = Main.mouseX + (int)Main.screenPosition.X; - int mouseY = Main.mouseY + (int)Main.screenPosition.Y; - int tileX = mouseX / 16; - int tileY = mouseY / 16; - if (item.makeNPC == ModContent.NPCType()) - { - if (!WorldGen.SolidTile(tileX, tileY)) - { - int colorType = (int)BabyGhostBell.JellyColor.Blue; - if (item.type == ModContent.ItemType()) - { - colorType = (int)BabyGhostBell.JellyColor.Green; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)BabyGhostBell.JellyColor.Pink; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)BabyGhostBell.JellyColor.Radiant; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)BabyGhostBell.JellyColor.Gold; - } - player.ApplyItemTime(item); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); - Main.npc[n].ai[1] = colorType; - Main.npc[n].catchItem = item.type; - Main.npc[n].releaseOwner = (short)player.whoAmI; - } - else - { - PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); - } - } - } - else if (item.makeNPC == ModContent.NPCType()) - { - if (!WorldGen.SolidTile(tileX, tileY)) - { - int colorType = (int)PolypPanasea.FishColor.Red; - if (item.type == ModContent.ItemType()) - { - colorType = (int)PolypPanasea.FishColor.Green; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PolypPanasea.FishColor.Turquoise; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PolypPanasea.FishColor.Purple; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PolypPanasea.FishColor.Radiant; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PolypPanasea.FishColor.Gold; - } - player.ApplyItemTime(item); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); - Main.npc[n].ai[1] = colorType; - Main.npc[n].catchItem = item.type; - Main.npc[n].releaseOwner = (short)player.whoAmI; - } - else - { - PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); - } - } - } - else if (item.makeNPC == ModContent.NPCType()) - { - if (!WorldGen.SolidTile(tileX, tileY)) - { - int colorType = (int)PrismaticGuppy.FishColor.Blue; - if (item.type == ModContent.ItemType()) - { - colorType = (int)PrismaticGuppy.FishColor.Green; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PrismaticGuppy.FishColor.Pink; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PrismaticGuppy.FishColor.Radiant; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)PrismaticGuppy.FishColor.Gold; - } - - player.ApplyItemTime(item); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); - Main.npc[n].ai[1] = colorType; - Main.npc[n].catchItem = item.type; - Main.npc[n].releaseOwner = (short)player.whoAmI; - } - else - { - PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); - } - } - } - else if (item.makeNPC == ModContent.NPCType()) - { - if (!WorldGen.SolidTile(tileX, tileY)) - { - int colorType = (int)Slugbun.SlugSkin.Reef; - if (item.type == ModContent.ItemType()) - { - colorType = (int)Slugbun.SlugSkin.Polyp; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)Slugbun.SlugSkin.Burrows; - } - if (item.type == ModContent.ItemType()) - { - colorType = (int)Slugbun.SlugSkin.Radiant; - } - player.ApplyItemTime(item); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC, ai1: colorType); - Main.npc[n].catchItem = item.type; - Main.npc[n].releaseOwner = (short)player.whoAmI; - } - else - { - PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType); - } - } - } - else - { - orig(player, item); - } - } - #endregion - #region Make Celestial Onion give the Master Mode slot public static bool MasterModeCelestialOnionCheck(On_Player.orig_IsItemSlotUnlockedAndUsable orig, Player self, int slot) { diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 3c04413d31..8bf0bb5c8e 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -318,59 +318,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Allow Victide Bobber to Exist - private static void WhitelistVictideBobber(ILContext il) - { - var cursor = new ILCursor(il); - - // Find the label which skips the "flag = true" that kills the projectile - ILLabel flagStorage = null; - if (!cursor.TryGotoNext(MoveType.After, x => x.MatchBeq(out flagStorage))) - { - LogFailure("Allow Victide Bobber to Exist", "Failed to properly navigate label to direct to"); - return; - } - - // Properly perform the skip if the projectile type is the Victide Bobber - cursor.Emit(OpCodes.Ldarg_0); - cursor.Emit(OpCodes.Ldfld, typeof(Projectile).GetField("type")); - cursor.Emit(OpCodes.Ldc_I4, ModContent.ProjectileType()); - cursor.Emit(OpCodes.Beq_S, flagStorage); - } - #endregion - - #region Prevent Victide Bobber from Jammming - private static bool PreventVictideBobberFromJamming(On_Player.orig_ItemCheck_CheckFishingBobbers orig, Player self, bool canUse) - { - // Run through the original stuff - canUse = orig(self, canUse); - - int bobberCount = 0; - foreach (Projectile proj in Main.ActiveProjectiles) - { - if (proj.active && proj.owner == self.whoAmI && proj.bobber) - { - bobberCount++; - if (proj.type == ModContent.ProjectileType()) - { - // Go back to casting if there's nothing loaded - if (proj.ai[1] == 0f) - proj.ai[0] = 0f; - - // Allow you to still use the fishing rod - canUse = true; - } - } - } - - // Unless.. you have a bobber already that's NOT Victide, then back to disabling - if (canUse && bobberCount > 1) - canUse = false; - - return canUse; - } - #endregion - #region Prevent UFO Mount from Dismounting in Water private static void PreventUFODismountInWater(ILContext il) { @@ -797,7 +744,7 @@ namespace CalamityMod.ILEditing cplay.justChangedGravity = cplay.oldGravDir != Player.gravDir; cplay.oldGravDir = Player.gravDir; - if (Main.netMode != NetmodeID.Server && !Main.gameMenu && CalamityClientConfig.Instance.DisableGravityScreenSwap) + if (!Main.dedServ && !Main.gameMenu && CalamityClientConfig.Instance.DisableGravityScreenSwap) { if (Player.gravDir == -1) { @@ -818,6 +765,14 @@ namespace CalamityMod.ILEditing } } } + if (!Main.dedServ && !CalamityClientConfig.Instance.DisableGravityScreenSwap) + { + if (Filters.Scene["CalamityMod:FlipScreen"].IsActive()) + { + Filters.Scene["CalamityMod:FlipScreen"].Opacity = 0f; + Filters.Scene.Deactivate("CalamityMod:FlipScreen"); + } + } if (cplay.justChangedGravity) { Player.gravDir *= -1; diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 6a11c74bec..63e1681843 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -208,5 +208,72 @@ namespace CalamityMod.ILEditing } #endregion Prevent Abyss/Dungeon Interactions + + #region Fledgling Wings Loot Changes + /// + /// Changes the primary loot of Floating Island chests to include Fledging Wings + /// + private static void MakeFledgingWingsMoreCommon(ILContext il) + { + var cursor = new ILCursor(il); + + // How the code we are moving to works: + // Set num13 equal to the number of islands generated. If greater than 3, set to a random number between 0-3 inclusive. Then use that value in a 4-branch switch statement. + // This makes num13 always be a value between 0-3, for the 4 primary items in island loot. + // To accomodate for Fledgling Wings, we must change this to check for being greater than 4, then to set to a random number between 0-4 inclusive, then make the switch have 5 branches. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(13))) + { + LogFailure("Fledgling Wings", "Could not move to the location of determining Floating Island primary loot 1."); + return; + } + + // Emit a delegate which reimplements the logic for choosing the primary loot of floating islands with Fledgling Wings, then return the ID of the item. + var label = il.DefineLabel(); + cursor.EmitDelegate>(() => + { + int island = GenVars.skyIslandHouseCount; + if (island > 4) + island = Main.rand.Next(5); + + return island switch + { + 1 => 65, // Starfury + 2 => 158, // Lucky Horseshoe + 3 => 2219, // Celestial Magnet + 4 => 4978, // Fledgling Wings + _ => 159, // Shiny Red Balloon + }; + }); + + // Store this value in the variable which holds the ID of the item, then branch past the original logic. + cursor.Emit(OpCodes.Stloc, 13); + cursor.Emit(OpCodes.Br, label); + + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdsfld("getGoodWorldGen"))) + { + LogFailure("Fledgling Wings", "Could not move after the switch statement."); + return; + } + cursor.MarkLabel(label); + } + + /// + /// Disables Fledgling Wings being added as secondary loot in floating island chests + /// + private static void DisableFledglingWingsSecondary(ILContext il) + { + var cursor = new ILCursor(il); + + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdloc(9))) + { + LogFailure("Fledgling Wings", "Could not move to the code adding Fledgling Wings as secondary loot."); + return; + } + + // AND with 0 (false) so that the code to add Fledgling Wings as secondary loot never runs. + cursor.Emit(OpCodes.Ldc_I4_0); + cursor.Emit(OpCodes.And); + } + #endregion } } diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index b2129bd402..79d47e65cf 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.ArcticDivingGear). AddIngredient(). - AddIngredient(10). - AddIngredient(10). + AddIngredient(20). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 0a71cbd439..5ef95b91af 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -73,8 +73,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(20). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/AcrobaticBobber.cs b/Items/Accessories/AcrobaticBobber.cs index ffd5b98001..135efdb3a1 100644 --- a/Items/Accessories/AcrobaticBobber.cs +++ b/Items/Accessories/AcrobaticBobber.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Fishing CreateRecipe(). AddIngredient(ItemID.FishingBobber). AddIngredient(5). - AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 642fcd0085..70f87c2ed4 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -1,7 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(18); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Confused]; + } public override void SetDefaults() { diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 7804ef5748..b5497cd0a3 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories public static int MinRegenBoost => 2; public static int MaxRegenBoost => 6; public static float RegenTimeBoost => 1; - public static float NaturalRegenPower => 1.5f; + public static float NaturalRegenPower => 1.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(), MaxRegenBoost.ToRegenPerSecond(), (NaturalRegenPower - 1f).ToPercent(), RegenTimeBoost.ToPercent()); public override void SetDefaults() diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs new file mode 100644 index 0000000000..dc85c6c5b8 --- /dev/null +++ b/Items/Accessories/AmidiasPendant.cs @@ -0,0 +1,63 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class AmidiasPendant : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public const int ShardProjectiles = 2; + public const float ShardAngleSpread = 90; + public int ShardCountdown = 0; + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 46; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (ShardCountdown <= 0) + { + ShardCountdown = 140; + } + if (ShardCountdown > 0) + { + ShardCountdown -= Main.rand.Next(1, 4); + if (ShardCountdown <= 0) + { + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + int speed2 = 25; + float spawnX = Main.rand.Next(-300, 301) + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed2; + int spawnOffset = ShardProjectiles * 15; + float spread = -ShardAngleSpread / 2f; + for (int i = 0; i < ShardProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - spawnOffset; + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(spread + (ShardAngleSpread * i / (float)ShardProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + + int finalDamage = (int)player.GetBestClassDamage().ApplyTo(30); + Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, ModContent.ProjectileType(), finalDamage, 5f, Main.myPlayer); + } + } + } + } + } + } +} diff --git a/Items/Accessories/AmidiasPendant.png b/Items/Accessories/AmidiasPendant.png new file mode 100644 index 0000000000..ff71e1fc5f Binary files /dev/null and b/Items/Accessories/AmidiasPendant.png differ diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index aca8d30b28..054a6893af 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -2,7 +2,9 @@ using CalamityMod.CalPlayer; 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; @@ -39,7 +41,7 @@ namespace CalamityMod.Items.Accessories Item.Calamity().devItem = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AngelicAllianceHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { @@ -63,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/Apollyon.cs b/Items/Accessories/Apollyon.cs index 6a886f3eff..574d9f7dc8 100644 --- a/Items/Accessories/Apollyon.cs +++ b/Items/Accessories/Apollyon.cs @@ -28,8 +28,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(3). - AddIngredient(). + AddIngredient(ItemID.EyeoftheGolem). + AddIngredient(4). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs index 32d8fbc0c0..ea30fe35d4 100644 --- a/Items/Accessories/ArcFlashRing.cs +++ b/Items/Accessories/ArcFlashRing.cs @@ -1,9 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,7 +18,10 @@ namespace CalamityMod.Items.Accessories public static int LightningSpawnPercent = 5; public static float LightningDamageMult = 3f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LightningSpawnPercent, LightningDamageMult); - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index bb6f6d5597..f9fa031628 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -27,15 +27,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.pickSpeed -= MiningSpeedBoost; - player.Calamity().aPowder = true; player.Calamity().fallingBlockProtection = true; - player.Calamity().trapProtection = true; - - // Doesn't stack with downgrades - if (player.chiselSpeed) - player.pickSpeed += 0.15f; - if (player.Calamity().aFossil) - player.pickSpeed += AncientFossil.MiningSpeedBoost; + player.Calamity().archaicPowder = true; } public override void AddRecipes() diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index cd3b024632..70e2f6a4ea 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -15,15 +15,15 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; // These values override Soaring Insignia's - public static double FlightTimeBoost = 0.5D; + public static int FlightTimeBoostFlat = CalamityUtils.SecondsToFrames(4); public static float MoveSpeedBoost = 0.15f; - public static float JumpSpeedBoost = 0.75f; // NOTE: Tooltip shares this number with move speed % as they're equal + public static float JumpSpeedBoost = 1f; public static float AccelerationBoost = 0.5f; public static int AbilityDuration = CalamityUtils.SecondsToFrames(4); public static int AbilityCooldown = CalamityUtils.SecondsToFrames(40); - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoost.ToPercent(), MoveSpeedBoost.ToPercent(), (1f + AccelerationBoost).Round(), AbilityDuration.FramesToSeconds(), AbilityCooldown.FramesToSeconds()); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoostFlat.FramesToSeconds(), MoveSpeedBoost.ToPercent(), JumpSpeedBoost.ToJumpSpeedPercent(), (1f + AccelerationBoost).Round(), AbilityDuration.FramesToSeconds(), AbilityCooldown.FramesToSeconds()); - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AscendantInsigniaHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void SetDefaults() { Item.width = 46; @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Accessories player.empressBrooch = true; player.moveSpeed += MoveSpeedBoost; player.jumpSpeedBoost += JumpSpeedBoost - 0.5f; + player.wingTimeMax += FlightTimeBoostFlat; } public override void AddRecipes() diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index c9bf0aa08d..16b13a9bfe 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -1,7 +1,9 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -22,6 +24,10 @@ namespace CalamityMod.Items.Accessories public const int RamExplosionDamage = 300; public const float RamExplosionKnockback = 20f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 9e450205d1..f09a272bda 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 50; Item.height = 48; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.defense = 4; Item.accessory = true; } @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.HallowedBar, 5). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 14d252e5f0..e1c1798956 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.badgeOfBravery = true; + player.GetDamage() += 0.1f; + player.GetCritChance() += 10; player.GetArmorPenetration() += 5; } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.WarriorEmblem). - AddIngredient(2). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Baroclaw.cs b/Items/Accessories/Baroclaw.cs index 579a0c61c4..a18cbbe9e4 100644 --- a/Items/Accessories/Baroclaw.cs +++ b/Items/Accessories/Baroclaw.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(12). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 846392ae1d..a16a16e50d 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.bloodyWormTooth = true; + player.GetDamage() += 0.1f; player.endurance += 0.1f; } diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index a57a2e73d0..3cb14f971f 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.bloodyWormTooth = true; + player.GetDamage() += 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 1a1b2bac13..19e94e34f6 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -18,12 +18,9 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - // TODO -- Check if its trying to replace the other rogue jetpack. If its the case, return true. - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().hasJetpack; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().hasJetpack = true; + player.Calamity().rogueDashItem = Item; player.GetDamage() += 0.12f; player.Calamity().rogueVelocity += 0.15f; player.Calamity().blunderBooster = true; @@ -32,7 +29,7 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.BoosterDashHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 53a8a5026d..99494921a8 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -71,7 +71,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(ItemID.CharmofMyths). - AddIngredient(5). + AddIngredient(12). + AddIngredient(5). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index ed7d14d158..dca6821906 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -10,12 +10,13 @@ namespace CalamityMod.Items.Accessories public class ChaosStone : ModItem, ILocalizedModType { public static float LostRegenPer100Mana => 8; - public static float DamageMultPer100Mana => 0.05f; + public static int BaseLostRegen => 12; + public static float DamageMultPer100Mana => 0.055f; public new string LocalizationCategory => "Items.Accessories"; public override void ModifyTooltips(List tooltips) { - var regenAmount = Main.LocalPlayer.statManaMax2 == 0 ? 0 : (int)((Main.LocalPlayer.statManaMax2 / 100f) * LostRegenPer100Mana) * 0.5f; + var regenAmount = Main.LocalPlayer.statManaMax2 == 0 ? 0 : (int)((Main.LocalPlayer.statManaMax2 / 100f) * LostRegenPer100Mana + BaseLostRegen) * 0.5f; var dmgAmount = Main.LocalPlayer.statManaMax2 == 0 ? 0 : ((Main.LocalPlayer.statManaMax2 / 100f) * DamageMultPer100Mana * 100); tooltips.FindAndReplaceAll("[REGEN]", regenAmount.ToString("0.#")); tooltips.FindAndReplaceAll("[DAMAGE]", dmgAmount.ToString("0.#")); diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index cf72391472..873027e96e 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.corrosiveSpine = true; player.moveSpeed += 0.05f; - modPlayer.WaterDebuffMultiplier += 0.25f; - modPlayer.SicknessDebuffMultiplier += 0.25f; + modPlayer.WaterDebuffMultiplier += 0.5f; + modPlayer.SicknessDebuffMultiplier += 0.5f; } } } diff --git a/Items/Accessories/CrushingEgo.cs b/Items/Accessories/CrushingEgo.cs index 13c92cc9fb..59bf0db7f5 100644 --- a/Items/Accessories/CrushingEgo.cs +++ b/Items/Accessories/CrushingEgo.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(10). AddIngredient(25). AddIngredient(25). AddTile(). diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 16e3459913..5c3497351d 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().deadshotBrooch = true; + player.Calamity().ammoCycleItem = Item; player.Calamity().ammoCost *= 0.8f; player.GetDamage() += 0.12f; player.GetCritChance() += 7; } - public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/DiamondOfTheDeep.cs b/Items/Accessories/DiamondOfTheDeep.cs index 316af2422c..f0ceeea175 100644 --- a/Items/Accessories/DiamondOfTheDeep.cs +++ b/Items/Accessories/DiamondOfTheDeep.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.accessory = true; } @@ -33,12 +33,12 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(10). - AddIngredient(5). - AddIngredient(10). AddIngredient(5). - AddIngredient(10). - AddIngredient(5). + AddIngredient(20). + AddIngredient(20). + AddIngredient(20). + AddIngredient(20). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/DivineProvidence.cs similarity index 80% rename from Items/Accessories/BlazingCore.cs rename to Items/Accessories/DivineProvidence.cs index 7a6bd7980a..e6771ab241 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/DivineProvidence.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -11,7 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class BlazingCore : ModItem, ILocalizedModType + [LegacyName("BlazingCore")] + public class DivineProvidence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -22,11 +25,12 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Main.LocalPlayer.Calamity().AccessoryParryItem != null ? Main.LocalPlayer.Calamity().AccessoryParryItem : Item); public override void SetDefaults() { Item.width = 42; @@ -39,21 +43,22 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().blazingCore = true; + player.Calamity().divineProvidence = true; + player.Calamity().AccessoryParryItem = Item; player.noKnockback = true; } public static void HandleStars(Player player) { - bool empowered = player.Calamity().blazingCoreEmpoweredParry; + bool empowered = player.Calamity().divineProvEmpoweredParry; float divisor = 3f; int totalFlameProjectiles = 45; int chains = 3; float interval = totalFlameProjectiles / chains * divisor; - double patternInterval = Math.Floor(player.Calamity().blazingCoreSuccessfulParry / interval); + double patternInterval = Math.Floor(player.Calamity().divineProvSuccessfulParry / interval); - if (player.Calamity().blazingCoreSuccessfulParry % 4 == 0) //play sound every 4 frames + if (player.Calamity().divineProvSuccessfulParry % 4 == 0) //play sound every 4 frames { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, player.Center); } @@ -86,19 +91,19 @@ namespace CalamityMod.Items.Accessories offset += 10f; } - player.Calamity().blazingCoreSuccessfulParry--; - if (player.Calamity().blazingCoreSuccessfulParry <= 0) + player.Calamity().divineProvSuccessfulParry--; + if (player.Calamity().divineProvSuccessfulParry <= 0) { offset = 0f; - player.Calamity().blazingCoreEmpoweredParry = false; + player.Calamity().divineProvEmpoweredParry = false; } } public static void HandleParryCountdown(Player player) { - player.Calamity().blazingCoreParry--; + player.Calamity().divineProvParry--; - if (player.Calamity().blazingCoreParry > 0) + if (player.Calamity().divineProvParry > 0) { player.controlJump = false; player.controlDown = false; diff --git a/Items/Accessories/BlazingCore.png b/Items/Accessories/DivineProvidence.png similarity index 100% rename from Items/Accessories/BlazingCore.png rename to Items/Accessories/DivineProvidence.png diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 5bc10a0e90..45535c30db 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -11,7 +12,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int ShitBaseDamage = 57; public static int TornadoBaseDamage = 210; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 35a09913aa..86ec26eac3 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Accessories/ElementalinaBottle.cs b/Items/Accessories/ElementalinaBottle.cs index 0ea04c9cac..cd7d33b0d4 100644 --- a/Items/Accessories/ElementalinaBottle.cs +++ b/Items/Accessories/ElementalinaBottle.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().elementalHeart; + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().allElementals.HasValue; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandElemental = true; + modPlayer.sandElemental = !hideVisual; SpawnElemental(player); } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 89722b2b07..2f099f6b87 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -20,6 +22,10 @@ namespace CalamityMod.Items.Accessories public const int RamExplosionDamage = 100; public const float RamExplosionKnockback = 15f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index d6135d8c6c..16567724e8 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -73,9 +73,6 @@ namespace CalamityMod.Items.Accessories #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eTalisman = true; - player.manaMagnet = true; if (manaFlowerEnabled) player.manaFlower = true; diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 3a270de644..83227565ad 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Accessories public class EyeoftheStorm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; @@ -20,20 +26,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().allElementals.HasValue; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cloudElemental = true; + modPlayer.cloudElemental = !hideVisual; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 172ca19e4e..83c538e911 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories modPlayer.mageCrownVisibility = !hideVisual; player.GetDamage() += (0.02f * modPlayer.mageCrownCount); //2% per feather, up to 10% player.manaCost -= (0.01f * modPlayer.mageCrownCount); //1% per feather, up to 5% - if (modPlayer.mageCrownCount >= 5) //At 5 feathers, grant 5% crit. Static Discharge infliction is handed in CalPlayerOnHit + if (modPlayer.mageCrownCount >= 5) //At 5 feathers, grant 5% crit. Wind Chilled infliction is handed in CalPlayerOnHit { player.GetCritChance() += 5; } @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddRecipeGroup("AnyGoldCrown"). - AddIngredient(6). + AddIngredient(8). AddIngredient(ItemID.Feather, 8). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/FishStocks.cs b/Items/Accessories/FishStocks.cs index a5fab55a28..a3215a46e0 100644 --- a/Items/Accessories/FishStocks.cs +++ b/Items/Accessories/FishStocks.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.value = Item.buyPrice(gold: 7, silver: 77); // Sold by Shady Salesman Item.rare = ItemRarityID.Blue; Item.accessory = true; } + public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().fishStocks = true; diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 3b47623fee..244eddd3d0 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -1,6 +1,8 @@ using System; -using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; +using System.Collections.Generic; using CalamityMod.Dusts; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -15,8 +17,11 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; internal const int flameLickedParry = 30; - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); - + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Main.LocalPlayer.Calamity().AccessoryParryItem != null ? Main.LocalPlayer.Calamity().AccessoryParryItem : Item); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 36; @@ -31,6 +36,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.flameLickedShell = true; + modPlayer.AccessoryParryItem = Item; player.noKnockback = true; } diff --git a/Items/Accessories/FragmentsOfAnotherWorld.cs b/Items/Accessories/FragmentsOfAnotherWorld.cs index 046e44ba43..b863550841 100644 --- a/Items/Accessories/FragmentsOfAnotherWorld.cs +++ b/Items/Accessories/FragmentsOfAnotherWorld.cs @@ -33,9 +33,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.fragmentsOfAnotherWorld = true; - player.buffImmune[ModContent.BuffType()] = true; player.GetAttackSpeed() += MeleeSpeedIncrease; player.specialistDamage *= RangedSpecialistDmgMult; diff --git a/Items/Accessories/FrozenCube.cs b/Items/Accessories/FrozenCube.cs index 6cd386972d..004f4426c6 100644 --- a/Items/Accessories/FrozenCube.cs +++ b/Items/Accessories/FrozenCube.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -13,13 +14,13 @@ namespace CalamityMod.Items.Accessories { public class FrozenCube : ModItem, ILocalizedModType { - public static int mistBaseDamage = 1; - public static int slamBaseDamage = 20; - public static int baseAttackSpeed = 90; - public static int baseAttackCooldown = 180; + public static int mistBaseDamage => 5; + public static int slamBaseDamage => 20; + public static int baseAttackSpeed => 90; + public static int baseAttackCooldown => 180; - public static int usedDefenseDivide = 3; - public static int debuff = ModContent.BuffType(); + public static int usedDefenseDivide => 3; + public static int debuff => ModContent.BuffType(); public static readonly SoundStyle noise = new("CalamityMod/Sounds/Item/ElumphantSound") { Volume = 0.6f }; public static readonly SoundStyle cry = new("CalamityMod/Sounds/Item/ElumphantCry") { Volume = 0.6f }; @@ -31,10 +32,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 34; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFrozenCube) + { + RecipeUnlockHandler.HasFoundFrozenCube = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -45,9 +56,23 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[projectile] < 1 && !player.dead) { int damage = (int)player.GetTotalDamage().ApplyTo(slamBaseDamage); - Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); } } + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.frozenCubeVanity = true; + modPlayer.frozenCubeVisuals = true; + + int projectile = ProjectileType(); + if (player.ownedProjectileCounts[projectile] < 1 && !player.dead) + { + int damage = (int)player.GetTotalDamage().ApplyTo(slamBaseDamage); + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); + } + } + public override void ModifyTooltips(List list) { if (Main.LocalPlayer != null) diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 8f020a1998..2e63782920 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +13,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 36; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFungalSymbiote) + { + RecipeUnlockHandler.HasFoundFungalSymbiote = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index 7852f765ac..ca2d1cce36 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -7,7 +7,6 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("AmidiasPendant")] public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 104e8933bc..6d2e3c4338 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,10 +13,18 @@ namespace CalamityMod.Items.Accessories { Item.width = 48; Item.height = 54; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 25); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundGladiatorsLocket) + { + RecipeUnlockHandler.HasFoundGladiatorsLocket = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index 81a152d40d..3f56f41052 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.gloveOfPrecision = true; player.GetDamage() += 0.10f; player.GetCritChance() += 10; modPlayer.rogueVelocity += 0.15f; diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index e6af6589cf..9ed2cfcdd0 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -22,14 +22,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.harpyRing = true; - player.moveSpeed += 0.1f; + player.moveSpeed += 0.2f; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). - AddIngredient(ItemID.SunplateBlock, 2). + AddIngredient(5). AddIngredient(ItemID.Feather, 5). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 3f22fbf8c0..45437ee6e9 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -20,6 +22,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 8)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), BuffID.Confused]; } public override void SetDefaults() @@ -34,7 +37,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot, bool modded) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.brimElemental || modPlayer.sandElemental || modPlayer.oasisElemental || modPlayer.cloudElemental || modPlayer.waterElemental) + if (modPlayer.brimElemental.HasValue || modPlayer.sandElemental.HasValue || modPlayer.oasisElemental.HasValue || modPlayer.cloudElemental.HasValue || modPlayer.waterElemental.HasValue) { return false; } @@ -47,8 +50,7 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, Main.DiscoR / 255f, Main.DiscoG / 255f, Main.DiscoB / 255f); CalamityPlayer modPlayer = player.Calamity(); - modPlayer.allElementals = true; - modPlayer.elementalHeart = true; + modPlayer.allElementals = !hideVisual; int brimmy = ProjectileType(); int siren = ProjectileType(); @@ -112,7 +114,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.allElementalsVanity = true; - // modPlayer.elementalHeart = true; int brimmy = ProjectileType(); int siren = ProjectileType(); diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index dd58c8f289..d8054bf039 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.UI; namespace CalamityMod.Items.Accessories @@ -66,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; } @@ -81,6 +83,34 @@ namespace CalamityMod.Items.Accessories On_ItemSlot.OverrideLeftClick -= IvDripAlcoholEquip; } + public override void SaveData(TagCompound tag) + { + tag["ContainedAlcoholID"] = containedAlcoholID; + tag["CurrentAlcoholType"] = (int)currentAlcoholType; + } + + public override void LoadData(TagCompound tag) + { + containedAlcoholID = tag.GetInt("ContainedAlcoholID"); + + if (tag.ContainsKey("CurrentAlcoholType")) + currentAlcoholType = (AlcoholType)tag.GetInt("CurrentAlcoholType"); + else + currentAlcoholType = AlcoholType.None; + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(containedAlcoholID); + writer.Write((int)currentAlcoholType); + } + + public override void NetReceive(BinaryReader reader) + { + containedAlcoholID = reader.ReadInt32(); + currentAlcoholType = (AlcoholType)reader.ReadInt32(); + } + private bool IvDripAlcoholEquip(On_ItemSlot.orig_OverrideLeftClick orig, Item[] inv, int context, int slot) { if (context == ItemSlot.Context.InventoryItem || context == ItemSlot.Context.ChestItem) diff --git a/Items/Accessories/InfectedJewel.cs b/Items/Accessories/InfectedJewel.cs index c88977e5ba..7ec49586d9 100644 --- a/Items/Accessories/InfectedJewel.cs +++ b/Items/Accessories/InfectedJewel.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 2; - public static int ReducedDoTAmount = 8; - public static int PostDebuffRegenTimeBoost = CalamityUtils.SecondsToFrames(10); + public static int ReducedDoTAmount = 12; + public static int PostDebuffRegenTimeBoost = CalamityUtils.SecondsToFrames(15); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), ReducedDoTAmount.ToRegenPerSecond(), PostDebuffRegenTimeBoost.FramesToSeconds()); public override void SetDefaults() { diff --git a/Items/Accessories/InterstellarStompers.cs b/Items/Accessories/InterstellarStompers.cs index 2f82b292fb..0991544716 100644 --- a/Items/Accessories/InterstellarStompers.cs +++ b/Items/Accessories/InterstellarStompers.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories Item.expert = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.GravistarSabatonHotkey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index a10d8a46be..1bd9c524fb 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Accessories public class JellyChargedBattery : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 716d7a8cf2..3ba0a52e6f 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -12,19 +12,13 @@ namespace CalamityMod.Items.Accessories public Color? TooltipExtensionColor => new(195, 223, 255); - public override void SetStaticDefaults() - { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.accessory = true; - Item.SetRevExclusive(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 8f9a198dee..acb8755aab 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int ambergrisDashDamage => 350; public static float DashSpeedIncrease => 1f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 2ab98916c6..407e5680c2 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenTimeBoost => 1; - public static float NaturalRegenPower => 1.5f; + public static float NaturalRegenPower => 1.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NaturalRegenPower - 1f).ToPercent(), RegenTimeBoost.ToPercent()); public override void SetDefaults() { diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index d051683737..c2aed99046 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -31,10 +32,18 @@ namespace CalamityMod.Items.Accessories { Item.width = 66; Item.height = 46; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundLuxorsGift) + { + RecipeUnlockHandler.HasFoundLuxorsGift = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 7033bda892..c76d9086dd 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -1,8 +1,11 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,6 +13,17 @@ namespace CalamityMod.Items.Accessories public class NebulousCore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float DamageBoost => 0.12f; + public static int HealLifeOnRevive => 300; + public static int ReviveCooldown => CalamityUtils.SecondsToFrames(90); + public static int MaxStars => 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), HealLifeOnRevive, ReviveCooldown.FramesToSeconds()); + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; @@ -31,12 +45,12 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nebulousCore = true; - player.GetDamage() += 0.1f; + player.GetDamage() += DamageBoost; // Spawn nebula stars if (Main.rand.NextBool(15)) { - // Count the number of current active nebula stars; if this is at least 10, no more can spawn + // Count the number of current active nebula stars; if this is at least 15, no more can spawn int numProj = 0; foreach (Projectile p in Main.ActiveProjectiles) { @@ -45,7 +59,7 @@ namespace CalamityMod.Items.Accessories numProj++; } } - if (Main.rand.Next(15) >= numProj && numProj < 10) + if (Main.rand.Next(15) >= numProj && numProj < MaxStars) { int spawnRadius = 24; for (int j = 0; j < 50; j++) // Attempt to spawn the star randomly around the player diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 39d4b09ccd..388b882207 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.AvengerEmblem). - AddIngredient(2). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 1f3dfd4288..76d204055d 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 10)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType()]; } public override void SetDefaults() @@ -34,7 +36,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nucleogenesis = true; modPlayer.shadowMinions = true; //shadowflame - modPlayer.holyMinions = true; //holy flames + modPlayer.statisMinions = true; modPlayer.voltaicJelly = true; //static discharge modPlayer.starTaintedGenerator = true; //astral infection and irradiated player.GetKnockback() += 3f; diff --git a/Items/Accessories/OasisElementalinaBottle.cs b/Items/Accessories/OasisElementalinaBottle.cs index f3315de701..fbdc11ce02 100644 --- a/Items/Accessories/OasisElementalinaBottle.cs +++ b/Items/Accessories/OasisElementalinaBottle.cs @@ -26,20 +26,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().allElementals.HasValue; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.oasisElemental = true; + modPlayer.oasisElemental = !hideVisual; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 30e331049d..ec74a3a62c 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +14,10 @@ namespace CalamityMod.Items.Accessories public const int ShieldSlamDamage = 50; public const float ShieldSlamKnockback = 3f; public const int ShieldSlamIFrames = 12; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 36; @@ -33,8 +37,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.CrystalShard, 10). + AddIngredient(12). + AddIngredient(ItemID.CrystalShard, 20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index e077129fdf..03aa737e0a 100644 --- a/Items/Accessories/PearlofEnthrallment.cs +++ b/Items/Accessories/PearlofEnthrallment.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static int ElementalDamage = 65; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Confused]; + } public override void SetDefaults() { @@ -23,20 +29,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().allElementals.HasValue; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.waterElemental = true; + modPlayer.waterElemental = !hideVisual; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 7ba1dcb02f..6af7b7c0ad 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -17,12 +17,9 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - // TODO -- Check if the slot contains the other rogue jetpack, in which case, let the player swap accs - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().hasJetpack; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().hasJetpack = true; + player.Calamity().rogueDashItem = Item; player.GetDamage() += 0.08f; player.Calamity().rogueVelocity += 0.15f; player.Calamity().plaguedFuelPack = true; @@ -30,6 +27,6 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.BoosterDashHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); } } diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 30445b7dcc..3d14c9d991 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Items.Accessories player.GetCritChance() += 7; player.magicQuiver = true; CalamityPlayer modPlayer = player.Calamity(); - modPlayer.deadshotBrooch = true; + modPlayer.ammoCycleItem = Item; modPlayer.ammoCost *= 0.8f; } - public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 9d965f53bb..ef3e171889 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Utilities.Daybreak; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -62,6 +64,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields(OwnerPlayer); diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 59558577fa..89a8f45dd3 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; @@ -12,6 +13,7 @@ using CalamityMod.NPCs.Providence; using CalamityMod.Particles; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -219,7 +221,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; - + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; base.SetStaticDefaults(); } @@ -635,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/Radiance.cs b/Items/Accessories/Radiance.cs index 46823c36ed..7f818c6c3b 100644 --- a/Items/Accessories/Radiance.cs +++ b/Items/Accessories/Radiance.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Accessories public static int MinRegenBoost => 2; public static int MaxRegenBoost => 8; - public static int ReducedDoTAmount => 20; - public static int PostDebuffRegenTimeBoost => CalamityUtils.SecondsToFrames(10); + public static int ReducedDoTAmount => 24; + public static int PostDebuffRegenTimeBoost => CalamityUtils.SecondsToFrames(15); public static float RegenTimeBoost => 1; - public static float NaturalRegenPower => 1.5f; + public static float NaturalRegenPower => 1.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(),MaxRegenBoost.ToRegenPerSecond(),ReducedDoTAmount.ToRegenPerSecond(), (NaturalRegenPower - 1f).ToPercent(),RegenTimeBoost.ToPercent()); public override void SetStaticDefaults() { diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 2e45d69df2..fdbbeef494 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.Leather, 5). + AddIngredient(ItemID.FlinxFur, 5). AddIngredient(ItemID.Obsidian, 20). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index d8d417f8bc..f2fd577ead 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.GetDamage() += 0.2f; - player.GetArmorPenetration() += 15; + player.GetArmorPenetration() += 30; } public override void AddRecipes() @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(6). - AddIngredient(15). + AddIngredient(20). AddTile(TileID.TinkerersWorkbench). Register(); } diff --git a/Items/Accessories/Regenerator.cs b/Items/Accessories/Regenerator.cs index dc1bc73dd3..e43dd4bc88 100644 --- a/Items/Accessories/Regenerator.cs +++ b/Items/Accessories/Regenerator.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.regenerator = true; player.longInvince = true; // Gives better iframes because god help you if you end up getting hit twice + player.GetDamage() += player.Calamity().regeneratorDamage; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index be56ae478a..3d63327597 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +13,10 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static int ElementalDamage = 60; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; @@ -21,20 +26,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().allElementals.HasValue; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimElemental = true; + modPlayer.brimElemental = !hideVisual; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index a7524744d6..e028ee7cd1 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +12,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(8); - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Accessories/ScionsCurio.cs b/Items/Accessories/ScionsCurio.cs index 66e34b7350..bf739b81de 100644 --- a/Items/Accessories/ScionsCurio.cs +++ b/Items/Accessories/ScionsCurio.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public class ScionsCurio : ModItem, ILocalizedModType { - public static int postHitDamage = 45; + public static int postHitDamage = 20; public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/Accessories/SeaSpiritAmulet.cs b/Items/Accessories/SeaSpiritAmulet.cs index 53b7568177..5fa568e2e5 100644 --- a/Items/Accessories/SeaSpiritAmulet.cs +++ b/Items/Accessories/SeaSpiritAmulet.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Accessories public class SeaSpiritAmulet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 00ef2c412f..9db1a74924 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,11 +1,6 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.NPCs; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; +using CalamityMod.Items.Armor.Victide; +using CalamityMod.Items.Materials; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,115 +9,40 @@ namespace CalamityMod.Items.Accessories public class ShieldoftheOcean : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static readonly SoundStyle TriggerSound = new("CalamityMod/Sounds/Custom/MossMine"); - public static readonly SoundStyle ParrySound = new("CalamityMod/Sounds/Custom/BubbleCracklePop"); - public const int ParryTime = 30; - // These damage values scale in Expert and Master. - public const int ShoveFallBaseDamage = 80; - public const int ImmuneToShoveBaseDamage = 200; - public override void SetDefaults() { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 2; Item.accessory = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().shieldOfTheOcean = true; - } - - public static void HandleParryCountdown(Player player) - { - player.Calamity().shieldOfTheOceanParry--; - - if (player.Calamity().shieldOfTheOceanParry > 0) + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.controlJump = false; - player.controlDown = false; - player.controlLeft = false; - player.controlRight = false; - player.controlUp = false; - player.controlUseItem = false; - player.controlUseTile = false; - player.controlThrow = false; - player.gravDir = 1f; - player.velocity = Vector2.Zero; - player.velocity.Y = -0.1f; // Ensure Y velocity is not 0, otherwise the flight meter gets reset. - player.RemoveAllGrapplingHooks(); + player.statDefense += 5; + } + // Accessory update comes before set bonus for some reason, so this has to be done + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + { + player.moveSpeed += 0.1f; + player.lifeRegen += 2; } } - // GFB changes: - // Larger radius for pushing away enemies. - // Enemies are pushed much faster. - public static void ActivateParry(Player player) + public override void AddRecipes() { - bool empowered = player.Calamity().shieldOfTheOceanEmpoweredParry; - - // Search for every NPC within a certain radius of the player. - foreach (NPC npc in Main.ActiveNPCs) - { - if (Vector2.Distance(player.Center, npc.Center) > (Main.zenithWorld ? 720f : 240f)) - continue; - - // Inflict Riptide on empowered parries. - // Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry - // Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds - if (empowered) - npc.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(15)); - - // If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries. - // Otherwise, simply deal a large amount of damage to them if empowered. - if (npc.CanBeMoved()) - { - // The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all! - Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f; - npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true, player); - - int scaledFallDamage = CalamityUtils.ScaleWithDifficulty(ShoveFallBaseDamage); - var flungNPC = npc.GetGlobalNPC(); - if (empowered) - flungNPC.ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); - else - flungNPC.ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); - - for (int i = -1; i <= 1; i++) - { - Vector2 particleVel = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.Pi / 6f * i) * 7.5f; - WaterFlavoredParticle pushHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); - GeneralParticleHandler.SpawnParticle(pushHit); - } - } - else - { - if (empowered) - { - int scaledImmuneDamage = CalamityUtils.ScaleWithDifficulty(ImmuneToShoveBaseDamage) * (Main.zenithWorld ? 10 : 1); - Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI); - } - - float randOffset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 6; i++) - { - Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f; - WaterFlavoredParticle bigHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); - GeneralParticleHandler.SpawnParticle(bigHit); - } - } - } - player.Calamity().shieldOfTheOceanEmpoweredParry = false; - - for (int b = 0; b < 20; b++) - { - Vector2 waterVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi / 15f * b) * Main.rand.NextFloat(12f, 24f); - WaterFoamParticle sorryToBurstYourBubble = new(player.Center, waterVel, 15, 0.6f, Color.Blue); - GeneralParticleHandler.SpawnParticle(sorryToBurstYourBubble); - } + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.Starfish, 5). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index a3dee2aa70..eaf536d589 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.CelestialEmblem). - AddIngredient(5). + AddIngredient(8). AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 3cc01929cb..d0d9b60bef 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories Item.expert = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpectralVeilHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/SpringStool.cs b/Items/Accessories/SpringStool.cs index e68a6b1687..9d9ac064f9 100644 --- a/Items/Accessories/SpringStool.cs +++ b/Items/Accessories/SpringStool.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Accessories public class SpringStool : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpringStoolJumpHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((JumpCooldown).FramesToSeconds(), (CritRateBoostAboveTargets)); public static int JumpCooldown = CalamityUtils.SecondsToFrames(20); @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetModPlayer().springStool = true; + player.GetModPlayer().springStoolItem = Item; } public override void AddRecipes() @@ -48,7 +49,8 @@ namespace CalamityMod.Items.Accessories public class SpringStoolPlayer : ModPlayer { - public bool springStool = false; + public bool springStool { get => springStoolItem != null; } + public Item springStoolItem = null; public int springStoolTimer = 0; public bool hasGroundedSinceJump = true; @@ -72,7 +74,8 @@ namespace CalamityMod.Items.Accessories public override void PostUpdateEquips() { - if (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active && hasGroundedSinceJump) + // Ensures the special jump initiates only works when unmounted, not grappled to a surface, and the ability is off cooldown + if (springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && springStoolItem.JustPressedKeybind() && !Player.mount.Active && hasGroundedSinceJump && !(Player.grappling[0] >= 0)) { springStoolTimer = 12; @@ -96,8 +99,9 @@ namespace CalamityMod.Items.Accessories { bool holdingUp = Player.controlUp; bool standingStill = Player.velocity.Y == 0 && Math.Abs(Player.velocity.X) < 0.1f; + bool highEnoughCeiling = !Collision.SolidCollision(new Vector2(Player.position.X, Player.position.Y - 64), Player.width, 64); - if (holdingUp && standingStill && !Player.mount.Active) + if (holdingUp && standingStill && highEnoughCeiling && !Player.mount.Active && !(Player.grappling[0] >= 0) && !Player.pulley) { int boost = 61; if (IsVanillaStoolEquipped(Player)) @@ -212,13 +216,13 @@ namespace CalamityMod.Items.Accessories public override void ResetEffects() { - springStool = false; + springStoolItem = null; springStoolTimer = 0; } public override void UpdateDead() { - springStool = false; + springStoolItem = null; springStoolTimer = 0; hasGroundedSinceJump = true; } diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 994e56cdfc..4f5c8840cf 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Accessories public class StarTaintedGenerator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs index be1707868b..481ddf97f9 100644 --- a/Items/Accessories/StarbusterCore.cs +++ b/Items/Accessories/StarbusterCore.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,6 +9,10 @@ namespace CalamityMod.Items.Accessories public class StarbusterCore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index bb95d2b0ca..d210db091b 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -211,8 +211,8 @@ namespace CalamityMod.Items.Accessories OnePlace((float)player.lifeRegen / 2f), // Divided by 2 to show HP/s, because vanilla! Also normally we'd divide this by 2 in Expert without Well Fed, but we disable that shit Sign(moveSpeedBoost) + TwoPlaces(100f * moveSpeedBoost), TwoPlaces(20f * player.GetJumpBoost())); - // Show wing stats only if over 0 flight time - if (wingFlightTime > 0f) + // Show wing stats only if over 0 flight time and wings are equipped + if (wingFlightTime > 0f && player.equippedWings != null) stats3 += this.GetLocalization("FlightTime").Format(TwoPlaces(wingFlightTime / 60f)); stats3 += "\n" + this.GetLocalization("MiscStats").Format( player.aggro, diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 153d639c83..49616a4fb2 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.holyMinions = true; + modPlayer.statisMinions = true; player.GetKnockback() += 2.5f; player.GetDamage() += 0.12f; } diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 5e6decb0b0..0f45b84c4b 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowMinions = true; - modPlayer.holyMinions = true; + modPlayer.statisMinions = true; player.GetKnockback() += 2.75f; player.GetDamage() += 0.12f; player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index b7a3dd4452..c8c8e3f299 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index a287e37757..14455cee53 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Accessories player.accFishingLine = true; player.accTackleBox = true; player.accLavaFishing = true; - player.Calamity().fishingStation = true; } public override void AddRecipes() diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 981577f498..5934412adc 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,6 +1,8 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.DataStructures; @@ -21,6 +23,7 @@ namespace CalamityMod.Items.Accessories { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(9, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), BuffID.Electrified, BuffID.Frostburn2]; } public override void SetDefaults() @@ -54,7 +57,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(12). AddIngredient(15). AddIngredient(15). - AddIngredient(15). + AddIngredient(20). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/ThePact.cs b/Items/Accessories/ThePact.cs new file mode 100644 index 0000000000..3b8fef1ac1 --- /dev/null +++ b/Items/Accessories/ThePact.cs @@ -0,0 +1,63 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ThePact : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public static float MaxLifeMult => 2; + public static float ChanceToBeCrit => 0.25f; + public static float CritDmgTaken => 2.25f; + public static int BoostDuration => 900; + public static int DebuffInflictionDuration => 60; + public static float NaturalRegenBoost => 1.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeMult, ChanceToBeCrit.ToPercent(), CritDmgTaken); + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } + + public override void SetDefaults() + { + Item.width = 46; + Item.height = 64; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().CanBeCritByThePact = true; + + if (player.HasBuff() && player.miscCounter % 3 == 0 && player.potionDelay > 0) + { + player.potionDelay -= 1; + if (player.potionDelay < 0) + player.potionDelay = 0; + if (player.HasBuff(BuffID.PotionSickness)) + { + for (var i = 0; i < player.buffType.Length; i++) + { + if (player.buffType[i] == BuffID.PotionSickness) + { + player.buffTime[i] = player.potionDelay; + } + } + } + } + } + } +} diff --git a/Items/Accessories/ThePact.png b/Items/Accessories/ThePact.png new file mode 100644 index 0000000000..697214549b Binary files /dev/null and b/Items/Accessories/ThePact.png differ diff --git a/Items/Accessories/ThePointer.cs b/Items/Accessories/ThePointer.cs index cbf05e1b17..7d09678505 100644 --- a/Items/Accessories/ThePointer.cs +++ b/Items/Accessories/ThePointer.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -23,12 +24,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ThePointerLock); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { LockOnHelper.ForceUsability = true; - if (CalamityKeybinds.ThePointerLock.JustPressed) + if (Item.JustPressedKeybind()) { LockOnHelper.Toggle(); if (LockOnHelper.AimedTarget != null) diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index fb3ba3f541..9491464ebb 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"))); - list.IntegrateHotkey(CalamityKeybinds.TransformerHotKey); + list.IntegrateDynamicHotkey(Item); } public override void SetStaticDefaults() { diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 5222c8b13a..86c6024da1 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -18,13 +19,22 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 34; - Item.height = 32; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.width = 36; + Item.height = 54; + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundTrinketOfChi) + { + RecipeUnlockHandler.HasFoundTrinketOfChi = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/TrinketofChi.png b/Items/Accessories/TrinketofChi.png index 7928c1d2d8..58962b4f72 100644 Binary files a/Items/Accessories/TrinketofChi.png and b/Items/Accessories/TrinketofChi.png differ diff --git a/Items/Accessories/UnstableGraniteCore.cs b/Items/Accessories/UnstableGraniteCore.cs index 178ce5ca83..461e1c3fd8 100644 --- a/Items/Accessories/UnstableGraniteCore.cs +++ b/Items/Accessories/UnstableGraniteCore.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -20,11 +21,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 48; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 25); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundUnstableGraniteCore) + { + RecipeUnlockHandler.HasFoundUnstableGraniteCore = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/V8000Engine.cs b/Items/Accessories/V8000Engine.cs index 2c5b7238df..bc2401e8ba 100644 --- a/Items/Accessories/V8000Engine.cs +++ b/Items/Accessories/V8000Engine.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ModContent.ItemType()). AddIngredient(ModContent.ItemType(), 5). AddIngredient(ItemID.Nanites, 200). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 0f8e1ef708..f2c7a03baa 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -1,4 +1,6 @@ -using CalamityMod.Rarities; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -7,6 +9,10 @@ namespace CalamityMod.Items.Accessories public class VeneratedLocket : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Accessories/VoidofCalamity.cs b/Items/Accessories/VoidofCalamity.cs index 17965e2300..32769385b1 100644 --- a/Items/Accessories/VoidofCalamity.cs +++ b/Items/Accessories/VoidofCalamity.cs @@ -1,5 +1,7 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int BrimstoneFlamesDmg => CalamityUtils.ScaleWithDifficulty(15); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; @@ -25,8 +31,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.voidOfCalamity = true; player.GetDamage() += 0.12f; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index 1b880b8310..3d86e9105a 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -2,8 +2,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.NPCs; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Perforator; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -75,7 +79,7 @@ namespace CalamityMod.Items.Accessories float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + 100; // Adds some room so max bonus isnt when you're ON the hitbox float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy - if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && !nPC.dontTakeDamage) + if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && !nPC.dontTakeDamage && !CalamityNPCSets.ProtectedHostileNPC[nPC.type]) { float minDamageMult = 0.10f; int maxTargets = 7; diff --git a/Items/Accessories/Wings/AureateBooster.cs b/Items/Accessories/Wings/AureateBooster.cs index b2f0dce8a1..0048c702c0 100644 --- a/Items/Accessories/Wings/AureateBooster.cs +++ b/Items/Accessories/Wings/AureateBooster.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 6c0a213294..52f9814b2a 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 3f; public override float BaseAscent => 0.15f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 10f, 3f); + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(210, 10f, 3f); public override void SetDefaults() { diff --git a/Items/Accessories/Wings/HadalMantle.cs b/Items/Accessories/Wings/HadalMantle.cs index a0de1808f7..47936b848c 100644 --- a/Items/Accessories/Wings/HadalMantle.cs +++ b/Items/Accessories/Wings/HadalMantle.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/MoonWalkers.cs b/Items/Accessories/Wings/MoonWalkers.cs index 7915738b80..83bbec06ab 100644 --- a/Items/Accessories/Wings/MoonWalkers.cs +++ b/Items/Accessories/Wings/MoonWalkers.cs @@ -121,7 +121,6 @@ namespace CalamityMod.Items.Accessories.Wings modPlayer.angelTreads = true; } modPlayer.tracersDust = !hideVisual && toggleEnabled; - modPlayer.moonWalkers = true; } public override void AddRecipes() @@ -129,7 +128,7 @@ namespace CalamityMod.Items.Accessories.Wings CreateRecipe(). AddIngredient(). AddIngredient(ItemID.SoulofFlight,20). - AddIngredient(ItemID.LunarBar, 5). + AddIngredient(ItemID.LunarBar, 10). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index ef7f77b57e..3fe1670b44 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(3). - AddIngredient(15). - AddIngredient(2). + AddIngredient(45). + AddIngredient(10). + AddIngredient(3). AddTile(). Register(); } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index cd56fbaa3f..3e0536db58 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(10). AddIngredient(ItemID.Feather, 5). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 1ee669e46a..b75906c918 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cryogenSoul = true; if (modPlayer.wingProjectileCooldown <= 0) { if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 4f3b1fb1ec..2b5ae40bee 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 7a1d17a559..d7485793ed 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } 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/Accessories/Wings/VoidStriders.cs b/Items/Accessories/Wings/VoidStriders.cs index 5dd34f3139..261524e395 100644 --- a/Items/Accessories/Wings/VoidStriders.cs +++ b/Items/Accessories/Wings/VoidStriders.cs @@ -123,7 +123,6 @@ namespace CalamityMod.Items.Accessories.Wings modPlayer.angelTreads = true; } modPlayer.tracersDust = !hideVisual && toggleEnabled; - modPlayer.voidStriders = true; } public override void AddRecipes() diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index b9f1911f34..263560efa6 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -51,9 +51,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(10). AddIngredient(). - AddIngredient(ItemID.Chain, 2). + AddIngredient(ItemID.Chain, 3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 6fd88990ef..f837f16b33 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { CreateRecipe(333). - AddIngredient(). + AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index 91630337cb..8ce5c795ef 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { CreateRecipe(333). - AddIngredient(). + AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Ammo/CinderArrow.cs b/Items/Ammo/CinderArrow.cs index e9ced9fd6d..30b7a18227 100644 --- a/Items/Ammo/CinderArrow.cs +++ b/Items/Ammo/CinderArrow.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +14,7 @@ namespace CalamityMod.Items.Ammo public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Item.ResearchUnlockCount = 99; } @@ -19,7 +22,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 36; - Item.damage = 12; + Item.damage = 17; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/DryadsTear.cs b/Items/Ammo/DryadsTear.cs index c71578ffd1..cbbf0de76c 100644 --- a/Items/Ammo/DryadsTear.cs +++ b/Items/Ammo/DryadsTear.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 10; + Item.damage = 18; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index 52dcc7ba58..a4bd1b0057 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,7 @@ namespace CalamityMod.Items.Ammo public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Item.ResearchUnlockCount = 99; } @@ -18,7 +21,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 36; - Item.damage = 15; + Item.damage = 20; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/HailstormBullet.cs b/Items/Ammo/HailstormBullet.cs index 664f50c928..4abdfbf323 100644 --- a/Items/Ammo/HailstormBullet.cs +++ b/Items/Ammo/HailstormBullet.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,13 +13,14 @@ namespace CalamityMod.Items.Ammo public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2, BuffID.Frozen]; Item.ResearchUnlockCount = 99; } public override void SetDefaults() { Item.width = 14; Item.height = 20; - Item.damage = 12; + Item.damage = 9; Item.DamageType = DamageClass.Ranged; Item.consumable = true; Item.knockBack = 2f; diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index f92a3dbda8..3db085e933 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Ammo public static readonly SoundStyle Explosion = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion") { PitchVariance = 0.2f, Volume = 0.6f }; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Item.ResearchUnlockCount = 99; } public override void SetDefaults() diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index 9625571c1c..884655d4ba 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Ammo public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; Item.ResearchUnlockCount = 99; } diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index e530952681..807d7717fe 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Ammo public new string LocalizationCategory => "Items.Ammo"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Item.ResearchUnlockCount = 99; } diff --git a/Items/Ammo/VeriumBolt.cs b/Items/Ammo/VeriumBolt.cs index ae59a0bc45..9749a1b5b8 100644 --- a/Items/Ammo/VeriumBolt.cs +++ b/Items/Ammo/VeriumBolt.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 11; + Item.damage = 15; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 97e9ae7fbd..d11b0a2c1d 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -39,8 +39,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). - AddIngredient(ItemID.SunplateBlock, 8). + AddIngredient(20). AddIngredient(ItemID.Feather, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Aerospec/AerospecHeadMagic.cs b/Items/Armor/Aerospec/AerospecHeadMagic.cs index 76456d1b89..ca262b9bd4 100644 --- a/Items/Armor/Aerospec/AerospecHeadMagic.cs +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -54,8 +54,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Aerospec/AerospecHeadMelee.cs b/Items/Armor/Aerospec/AerospecHeadMelee.cs index f59f2bd760..aa945e437e 100644 --- a/Items/Armor/Aerospec/AerospecHeadMelee.cs +++ b/Items/Armor/Aerospec/AerospecHeadMelee.cs @@ -49,8 +49,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Aerospec/AerospecHeadRanged.cs b/Items/Armor/Aerospec/AerospecHeadRanged.cs index b7689e72e5..4b13b777a4 100644 --- a/Items/Armor/Aerospec/AerospecHeadRanged.cs +++ b/Items/Armor/Aerospec/AerospecHeadRanged.cs @@ -47,8 +47,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). SortAfterFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Aerospec/AerospecHeadRogue.cs b/Items/Armor/Aerospec/AerospecHeadRogue.cs index 6d4b986512..70bf01d7ba 100644 --- a/Items/Armor/Aerospec/AerospecHeadRogue.cs +++ b/Items/Armor/Aerospec/AerospecHeadRogue.cs @@ -61,8 +61,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). SortAfterFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Aerospec/AerospecHeadSummon.cs b/Items/Armor/Aerospec/AerospecHeadSummon.cs index 34e32fa38e..3e71483098 100644 --- a/Items/Armor/Aerospec/AerospecHeadSummon.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -72,8 +72,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index f035355c2f..845d544d6c 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -28,8 +28,7 @@ namespace CalamityMod.Items.Armor.Aerospec public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). - AddIngredient(ItemID.SunplateBlock, 4). + AddIngredient(15). AddIngredient(ItemID.Feather, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 1e8a002664..56e441ef7c 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Armor.Astral public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(ItemID.MeteoriteBar, 9). + AddIngredient(24). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index 6458df3a5a..6b93ddc9de 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -110,8 +110,7 @@ namespace CalamityMod.Items.Armor.Astral public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.MeteoriteBar, 6). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index ec9a0d4f04..80bc512397 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -33,8 +33,7 @@ namespace CalamityMod.Items.Armor.Astral public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(ItemID.MeteoriteBar, 8). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index 4b2eae5319..87adef91cc 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(18). + AddIngredient(20). AddTile(). Register(); @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(18). + AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Armor/Auric/AuricTeslaHeadMagic.cs b/Items/Armor/Auric/AuricTeslaHeadMagic.cs index e4a908579e..1971055fb5 100644 --- a/Items/Armor/Auric/AuricTeslaHeadMagic.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMagic.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(12). + AddIngredient(10). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Auric/AuricTeslaHeadMelee.cs b/Items/Armor/Auric/AuricTeslaHeadMelee.cs index feb38df486..69c73aab3d 100644 --- a/Items/Armor/Auric/AuricTeslaHeadMelee.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMelee.cs @@ -52,9 +52,8 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.bloodflareSet = true; modPlayer.bloodflareMelee = true; modPlayer.godSlayer = true; - modPlayer.godSlayerDamage = true; + modPlayer.godSlayerMelee = true; modPlayer.auricSet = true; - modPlayer.auricSetMelee = true; player.aggro += SetBonusAggroBoost; if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) @@ -104,7 +103,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(12). + AddIngredient(10). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Auric/AuricTeslaHeadRanged.cs b/Items/Armor/Auric/AuricTeslaHeadRanged.cs index acd69acec9..90ea45c870 100644 --- a/Items/Armor/Auric/AuricTeslaHeadRanged.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRanged.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(12). + AddIngredient(10). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Auric/AuricTeslaHeadRogue.cs b/Items/Armor/Auric/AuricTeslaHeadRogue.cs index ffe8c73ddf..7dfee1ddac 100644 --- a/Items/Armor/Auric/AuricTeslaHeadRogue.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRogue.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; modPlayer.bloodflareSet = true; - modPlayer.bloodflareThrowing = true; modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; modPlayer.auricSet = true; @@ -87,8 +86,8 @@ namespace CalamityMod.Items.Armor.Auric Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(RogueDamageBoostAtFullHealth.ToPercent(), SetBonusHurtDamageThreshold, CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodSlayerChestplate.DashCooldown.FramesToSeconds()) - : setBonusTooltipNumber == 2 ? LocalizedText.Format(DefenseBoostAboveHealthThreshold, DefenseBoostHealthThreshold.ToPercent()) - : LocalizedText.Format(CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds(), RogueDamageBoostWhileDebuffed.ToPercent())); + : setBonusTooltipNumber == 2 ? LocalizedText.ToString() + : LocalizedText.Format(CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds())); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } @@ -105,7 +104,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(12). + AddIngredient(10). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Auric/AuricTeslaHeadSummon.cs b/Items/Armor/Auric/AuricTeslaHeadSummon.cs index 206c06785e..f6a84997c7 100644 --- a/Items/Armor/Auric/AuricTeslaHeadSummon.cs +++ b/Items/Armor/Auric/AuricTeslaHeadSummon.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(12). + AddIngredient(10). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs index 5dcf752f3e..8dbef44c5c 100644 --- a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs +++ b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(16). + AddIngredient(50). + AddIngredient(20). AddIngredient(4). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Bloodflare/BloodflareCuisses.cs b/Items/Armor/Bloodflare/BloodflareCuisses.cs index b037201ed0..71b45a6b0c 100644 --- a/Items/Armor/Bloodflare/BloodflareCuisses.cs +++ b/Items/Armor/Bloodflare/BloodflareCuisses.cs @@ -36,7 +36,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(13). + AddIngredient(35). + AddIngredient(15). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index c4f3fea04a..8b66f597f7 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -59,7 +59,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(25). + AddIngredient(10). AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index ff42b9d5dd..b18a7a335a 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -59,7 +59,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(25). + AddIngredient(10). AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index f4c1376e75..45437ee384 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -60,7 +60,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(25). + AddIngredient(10). AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index 230ad7fed4..03c8191af6 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -21,8 +21,6 @@ namespace CalamityMod.Items.Armor.Bloodflare // Set Bonus public static float SetBonusRogueStealth = 1.2f; - public static int DefenseBoostAboveHealthThreshold = 30; - public static float DefenseBoostHealthThreshold = 0.8f; public override void SetDefaults() { @@ -41,10 +39,9 @@ namespace CalamityMod.Items.Armor.Bloodflare { var modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; - modPlayer.bloodflareThrowing = true; modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), DefenseBoostAboveHealthThreshold, DefenseBoostHealthThreshold.ToPercent()); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth()); } public override void UpdateEquip(Player player) @@ -58,7 +55,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(25). + AddIngredient(10). AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 2748a27213..ca4323039d 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -59,7 +59,8 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(25). + AddIngredient(10). AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Brimflame/BrimflameBoots.cs b/Items/Armor/Brimflame/BrimflameBoots.cs index 76732610d6..3f7c688699 100644 --- a/Items/Armor/Brimflame/BrimflameBoots.cs +++ b/Items/Armor/Brimflame/BrimflameBoots.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Armor.Brimflame public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(3). + AddIngredient(10). + AddIngredient(6). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Brimflame/BrimflameCowl.cs b/Items/Armor/Brimflame/BrimflameCowl.cs index 753d63d6ab..e433b7f052 100644 --- a/Items/Armor/Brimflame/BrimflameCowl.cs +++ b/Items/Armor/Brimflame/BrimflameCowl.cs @@ -67,8 +67,8 @@ namespace CalamityMod.Items.Armor.Brimflame public override void AddRecipes() { CreateRecipe(). + AddIngredient(8). AddIngredient(4). - AddIngredient(2). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index e729bb80ae..1d622d7dc7 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Armor.Brimflame public override void AddRecipes() { CreateRecipe(). + AddIngredient(12). AddIngredient(8). - AddIngredient(4). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 1b29e447df..c9ddda3988 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(24). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index 188e83ea26..53d96f4232 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index e5e8e4b668..453fc420c9 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index 0eadffe839..a52e3a6e8e 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 2007d1a7df..cce4c68ae0 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index 2b2026327c..727f0b4279 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 34b19ad388..f4380f4639 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(18). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Demonshade/DemonshadeGreaves.cs b/Items/Armor/Demonshade/DemonshadeGreaves.cs index 1afb8f1d2c..4d63a9c4e0 100644 --- a/Items/Armor/Demonshade/DemonshadeGreaves.cs +++ b/Items/Armor/Demonshade/DemonshadeGreaves.cs @@ -2,7 +2,12 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Armor.Demonshade { @@ -14,6 +19,7 @@ namespace CalamityMod.Items.Armor.Demonshade // Shadow Speed... (elusive) public static float MoveSpeedBoost = 0.3f; public static float AccelerationBoost = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AccelerationBoost.ToPercent()); public override void SetDefaults() { @@ -26,10 +32,47 @@ namespace CalamityMod.Items.Armor.Demonshade Item.Calamity().devItem = true; } + #region Toggleable Acceleration effect + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion + public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - modPlayer.shadowSpeed = true; + modPlayer.shadowSpeed = toggleEnabled; player.moveSpeed += MoveSpeedBoost; } diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 997c216a6f..1a3debbb51 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Demonshade { player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), CalamityUtils.GetArmorSetBonusKey(), EnrageDuration.FramesToSeconds(), (1f + MultDamageBoost).Round(), (1D + MultDamageTakenBoost).Round()); var modPlayer = player.Calamity(); - modPlayer.dsSetBonus = true; + modPlayer.demonshadeSet = true; modPlayer.wearingRogueArmor = true; modPlayer.WearingPostMLSummonerSet = true; player.maxMinions += SetBonusMinionSlotBoost; @@ -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/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index 1727744f85..9051803e8c 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { CreateRecipe(). AddIngredient(9). - AddIngredient(8). - AddIngredient(4). + AddIngredient(50). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index 66e7ff78d1..74dc96e551 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { CreateRecipe(). AddIngredient(12). - AddIngredient(10). - AddIngredient(5). + AddIngredient(75). + AddIngredient(20). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index f6da56b0e4..5c5a11ee04 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor.FathomSwarmer { player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), SetBonusSubmergedSummonDamageBoost.ToPercent(), SetBonusSubmergedDefenseBoost, SetBonusSubmergedRegenBoost.ToRegenPerSecond()); var modPlayer = player.Calamity(); - modPlayer.fathomSwarmer = true; player.spikedBoots = 2; player.maxMinions += SetBonusMinionSlotBoost; player.GetDamage() += SetBonusSummonDamageBoost; @@ -72,9 +71,9 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(6). - AddIngredient(3). + AddIngredient(6). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index cefd8ea258..ea6bdac934 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). - AddIngredient(3). + AddIngredient(20). + AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index b43f8bf6f0..4e0b206b54 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor.GodSlayer { var modPlayer = player.Calamity(); modPlayer.godSlayer = true; - modPlayer.godSlayerDamage = true; + modPlayer.godSlayerMelee = true; var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(); player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusHurtDamageThreshold, hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds()); player.aggro += SetBonusAggroBoost; @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index 1eff59c595..95be023141 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index c89fbe2355..1f3558d511 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index e5dade9642..6e3520da96 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(2). + AddIngredient(15). + AddIngredient(3). AddTile(). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index b35d5bc00d..4a84055052 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index c6961124b2..e41dc81b8b 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index eafe23a27c..06835f8d07 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index e772532f66..ed9ccc7826 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index c906206ff5..fab79f3fc8 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index 86ad6eba9f..886c10563a 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index f896863d03..6e7c575afe 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 83f1874634..c501318e2c 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { CreateRecipe(). AddIngredient(5). - AddIngredient(18). + AddIngredient(25). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index beb164e68f..32bf50a7ab 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { CreateRecipe(). AddIngredient(3). - AddIngredient(12). + AddIngredient(15). AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index d0d6e96c73..09aaf332b1 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue { CreateRecipe(). AddIngredient(4). - AddIngredient(15). + AddIngredient(20). AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index 991ad6b50e..4802b63328 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 307e36a692..756ddeb157 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index 613eb37fb2..aa34f36acc 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 6ab102d56c..7df946b0b4 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Reaver // Set Bonus public static int SetBonusAggroBoost = 600; - public static float SetBonusDebuffDamageReduction = 0.2f; + public static float SetBonusDebuffDamageReduction = 0.5f; public static float SetBonusMobilityReduction = 0.3f; public static int ReaverRageDuration = CalamityUtils.SecondsToFrames(5); public static int ReaverRageDefenseBoost = 5; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 60d307b21b..1d14e87516 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(20). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index 6c7104676c..516b82f1b1 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -44,9 +44,9 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(10). - AddIngredient(3). + AddIngredient(90). + AddIngredient(12). + AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index 1b6ae86e25..9056c9788f 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(5). + AddIngredient(30). + AddIngredient(8). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index 356c625801..f0ba705b0c 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(5). + AddIngredient(30). + AddIngredient(8). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 9faf9d6353..394c7b844d 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). - AddIngredient(7). - AddIngredient(2). + AddIngredient(60). + AddIngredient(10). + AddIngredient(3). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelGreaves.cs b/Items/Armor/Statigel/StatigelGreaves.cs index ecb28cc6d6..9a1a3353b0 100644 --- a/Items/Armor/Statigel/StatigelGreaves.cs +++ b/Items/Armor/Statigel/StatigelGreaves.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). - AddIngredient(7). + AddIngredient(10). + AddIngredient(10). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index c89fd173f6..04a26acd0f 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateArmorSet(Player player) { player.setBonus = CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); - var modPlayer = player.Calamity(); - modPlayer.statigelSet = true; player.GetJumpState().Enable(); Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; @@ -51,8 +49,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index f6c99987d2..e35503a5fb 100644 --- a/Items/Armor/Statigel/StatigelHeadMelee.cs +++ b/Items/Armor/Statigel/StatigelHeadMelee.cs @@ -35,8 +35,6 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateArmorSet(Player player) { player.setBonus = this.GetLocalization("SetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); - var modPlayer = player.Calamity(); - modPlayer.statigelSet = true; player.GetJumpState().Enable(); Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; @@ -53,8 +51,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index 980989d6c0..a0187c6129 100644 --- a/Items/Armor/Statigel/StatigelHeadRanged.cs +++ b/Items/Armor/Statigel/StatigelHeadRanged.cs @@ -31,8 +31,6 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateArmorSet(Player player) { player.setBonus = CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); - var modPlayer = player.Calamity(); - modPlayer.statigelSet = true; player.GetJumpState().Enable(); Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; @@ -47,8 +45,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index 747b2bb836..ed9fb8470d 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Armor.Statigel { player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); - modPlayer.statigelSet = true; player.GetJumpState().Enable(); modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; @@ -54,8 +53,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index 758ec5d5ba..05058e6c99 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Armor.Statigel { player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusSummonDamageBoost.ToPercent(), StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); - modPlayer.statigelSet = true; modPlayer.slimeGod = true; player.GetJumpState().Enable(); Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); @@ -48,18 +47,13 @@ namespace CalamityMod.Items.Armor.Statigel if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + player.AddBuff(ModContent.BuffType(), 3600, true); int minionID = -1; int minionDamage = (int)player.GetTotalDamage().ApplyTo(SlimeDamage); - - if (WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - minionID = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer); - else if (!WorldGen.crimson && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - minionID = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + minionID = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer); if (Main.projectile.IndexInRange(minionID)) Main.projectile[minionID].originalDamage = SlimeDamage; @@ -75,8 +69,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Tarragon/TarragonBreastplate.cs b/Items/Armor/Tarragon/TarragonBreastplate.cs index f51bbea2a2..c7f1a8153d 100644 --- a/Items/Armor/Tarragon/TarragonBreastplate.cs +++ b/Items/Armor/Tarragon/TarragonBreastplate.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(24). AddIngredient(18). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index 5081997c12..491bc384cd 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddIngredient(6). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index ee44143770..72aafa2f5e 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddIngredient(6). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index b066013fdc..54423f9d3d 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddIngredient(6). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index 70adc74719..eb07595466 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Armor.Tarragon modPlayer.tarraThrowing = true; modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds(), RogueDamageBoostWhileDebuffed.ToPercent()); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds()); } public override void UpdateEquip(Player player) @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddIngredient(6). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index 875953b77a..1f2f13fa7f 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(12). AddIngredient(6). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/Tarragon/TarragonLeggings.cs b/Items/Armor/Tarragon/TarragonLeggings.cs index 0b9a6fad3c..1c089b649a 100644 --- a/Items/Armor/Tarragon/TarragonLeggings.cs +++ b/Items/Armor/Tarragon/TarragonLeggings.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.Tarragon public override void AddRecipes() { CreateRecipe(). - AddIngredient(11). + AddIngredient(18). AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Vanity/VictideCoralTurban.cs b/Items/Armor/Vanity/VictideCoralTurban.cs deleted file mode 100644 index fa645616be..0000000000 --- a/Items/Armor/Vanity/VictideCoralTurban.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Vanity -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideVisage", "VictideHeadRanged")] - public class VictideCoralTurban : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.Vanity"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.vanity = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Armor/Vanity/VictideShellmet.cs b/Items/Armor/Vanity/VictideShellmet.cs deleted file mode 100644 index a9656c5ab3..0000000000 --- a/Items/Armor/Vanity/VictideShellmet.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Vanity -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHelm", "VictideHeadMelee")] - public class VictideShellmet : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.Vanity"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.vanity = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index e8b69229de..f8e6c751c8 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Victide @@ -12,13 +11,9 @@ namespace CalamityMod.Items.Armor.Victide public new string LocalizationCategory => "Items.Armor.PreHardmode"; public string BulkTexture => "CalamityMod/Items/Armor/Victide/VictideBreastplate_Bulk"; - public static int RegenBoost = 1; - - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond()); - public override void Load() { - if (!Main.dedServ) + if (Main.netMode != NetmodeID.Server) { //register the faulds texture. This appears either when the leggings or the chestplate is equipped (both works) EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Victide/VictideFaulds_Waist", EquipType.Waist, name: "VictideFaulds"); @@ -27,7 +22,8 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (!Main.dedServ) + + if (Main.netMode != NetmodeID.Server) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; @@ -41,12 +37,18 @@ namespace CalamityMod.Items.Armor.Victide Item.height = 18; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.defense = 4; + Item.defense = 5; //9 } public override void UpdateEquip(Player player) { - player.lifeRegen += RegenBoost; + player.endurance += 0.05f; + player.GetCritChance() += 5; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 5; + player.endurance += 0.1f; + } } public override void AddRecipes() diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index d31857818d..a9a702b35b 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Victide @@ -11,14 +10,10 @@ namespace CalamityMod.Items.Armor.Victide public class VictideGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; - - public static float MoveSpeedBoost = 0.1f; - - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); - public override void SetStaticDefaults() { - if (!Main.dedServ) + + if (Main.netMode != NetmodeID.Server) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; @@ -31,12 +26,12 @@ namespace CalamityMod.Items.Armor.Victide Item.height = 18; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.defense = 3; + Item.defense = 4; //9 } public override void UpdateEquip(Player player) { - player.moveSpeed += MoveSpeedBoost; + player.moveSpeed += Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 0.3f : 0.08f; } public override void AddRecipes() diff --git a/Items/Armor/Victide/VictideHeadBarrier.cs b/Items/Armor/Victide/VictideHeadBarrier.cs deleted file mode 100644 index 46a72067b4..0000000000 --- a/Items/Armor/Victide/VictideHeadBarrier.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using CalamityMod.Cooldowns; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideMask", "VictideHeadMagic")] - public class VictideHeadBarrier : ModItem, ILocalizedModType // Defense/Mobility set - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - - public static int RegenBoost = 1; - public static float RunAccelerationMult = 1.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), RunAccelerationMult.Round()); - - // Set Bonus - public static int BarrierCooldown = CalamityUtils.SecondsToFrames(8); - public static int BarrierDefenseBoost = 4; - public static float BarrierDamageAbsorptionPercent = 0.1f; - public static int BarrierFramesPerHeal = 30; - public static int BarrierDamage = 50; - public static float BarrierExplosionKB = 8f; - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 5; // 12 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - - public override void UpdateArmorSet(Player player) - { - Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); - player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), BarrierDefenseBoost, BarrierDamageAbsorptionPercent.ToPercent(), CalamityUtils.GetArmorSetBonusKey(), BarrierCooldown.FramesToSeconds()); - player.Calamity().victideBarrierSet = true; - - if (!player.HasCooldown(WardingWave.ID)) - { - player.statDefense += BarrierDefenseBoost; - - if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - // Damage will be set once explosion goes off - var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } - } - } - - public override void UpdateEquip(Player player) - { - player.lifeRegen += RegenBoost; - player.Calamity().victideBarrierHead = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadBurrow.cs b/Items/Armor/Victide/VictideHeadBurrow.cs deleted file mode 100644 index 62b3d6234e..0000000000 --- a/Items/Armor/Victide/VictideHeadBurrow.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHeadgear", "VictideHeadRogue")] - public class VictideHeadBurrow : ModItem, ILocalizedModType // Mobility/Utility set - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - - public static float MoveSpeedAccelerationBoost = 0.15f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedAccelerationBoost.ToPercent()); - - // Set Bonus - public static float BaseBurrowSpeed = 8f; // 41 mph - public static float SubmergedBurrowSpeed = 10f; // 51 mph - public static float BaseAcceleration = 0.4f; // For reference, base player running acceleration is 0.08 - public static int BurrowDuration = CalamityUtils.SecondsToFrames(5); - public static int BurrowCooldown = CalamityUtils.SecondsToFrames(30); - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 3; // 10 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - - public override void UpdateArmorSet(Player player) - { - Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); - player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), BurrowDuration.FramesToSeconds(), BurrowCooldown.FramesToSeconds()); - player.Calamity().victideBurrowSet = true; - player.ignoreWater = true; - } - - public override void UpdateEquip(Player player) - { - player.Calamity().victideBurrowHead = true; - player.moveSpeed += MoveSpeedAccelerationBoost; - if (player.Calamity().countsAsAnyWet) - player.gills = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadMagic.cs b/Items/Armor/Victide/VictideHeadMagic.cs new file mode 100644 index 0000000000..c7401a7cac --- /dev/null +++ b/Items/Armor/Victide/VictideHeadMagic.cs @@ -0,0 +1,54 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideMask")] + public class VictideHeadMagic : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 2; //9 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + var modPlayer = player.Calamity(); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.GetDamage() += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.05f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadBarrier.png b/Items/Armor/Victide/VictideHeadMagic.png similarity index 100% rename from Items/Armor/Victide/VictideHeadBarrier.png rename to Items/Armor/Victide/VictideHeadMagic.png diff --git a/Items/Armor/Victide/VictideHeadBarrier_Head.png b/Items/Armor/Victide/VictideHeadMagic_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadBarrier_Head.png rename to Items/Armor/Victide/VictideHeadMagic_Head.png diff --git a/Items/Armor/Victide/VictideHeadMelee.cs b/Items/Armor/Victide/VictideHeadMelee.cs new file mode 100644 index 0000000000..082ab5751b --- /dev/null +++ b/Items/Armor/Victide/VictideHeadMelee.cs @@ -0,0 +1,55 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHelm")] + public class VictideHeadMelee : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 4; //11 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + var modPlayer = player.Calamity(); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.GetDamage() += 0.1f; + player.lifeRegen += 3; + } + player.aggro += 200; + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.05f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + Register(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/Vanity/VictideShellmet.png b/Items/Armor/Victide/VictideHeadMelee.png similarity index 100% rename from Items/Armor/Vanity/VictideShellmet.png rename to Items/Armor/Victide/VictideHeadMelee.png diff --git a/Items/Armor/Vanity/VictideShellmet_Head.png b/Items/Armor/Victide/VictideHeadMelee_Head.png similarity index 100% rename from Items/Armor/Vanity/VictideShellmet_Head.png rename to Items/Armor/Victide/VictideHeadMelee_Head.png diff --git a/Items/Armor/Victide/VictideHeadRanged.cs b/Items/Armor/Victide/VictideHeadRanged.cs new file mode 100644 index 0000000000..3a37641b70 --- /dev/null +++ b/Items/Armor/Victide/VictideHeadRanged.cs @@ -0,0 +1,54 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideVisage")] + public class VictideHeadRanged : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 3; //10 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + var modPlayer = player.Calamity(); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.GetDamage() += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.05f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + Register(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/Vanity/VictideCoralTurban.png b/Items/Armor/Victide/VictideHeadRanged.png similarity index 100% rename from Items/Armor/Vanity/VictideCoralTurban.png rename to Items/Armor/Victide/VictideHeadRanged.png diff --git a/Items/Armor/Vanity/VictideCoralTurban_Head.png b/Items/Armor/Victide/VictideHeadRanged_Head.png similarity index 100% rename from Items/Armor/Vanity/VictideCoralTurban_Head.png rename to Items/Armor/Victide/VictideHeadRanged_Head.png diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs new file mode 100644 index 0000000000..b08263d4e0 --- /dev/null +++ b/Items/Armor/Victide/VictideHeadRogue.cs @@ -0,0 +1,56 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHeadgear")] + public class VictideHeadRogue : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 3; //10 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + var modPlayer = player.Calamity(); + modPlayer.victideSet = true; + modPlayer.rogueStealthMax += 0.6f; + modPlayer.wearingRogueArmor = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.GetDamage() += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.05f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadBurrow.png b/Items/Armor/Victide/VictideHeadRogue.png similarity index 100% rename from Items/Armor/Victide/VictideHeadBurrow.png rename to Items/Armor/Victide/VictideHeadRogue.png diff --git a/Items/Armor/Victide/VictideHeadBurrow_Head.png b/Items/Armor/Victide/VictideHeadRogue_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadBurrow_Head.png rename to Items/Armor/Victide/VictideHeadRogue_Head.png diff --git a/Items/Armor/Victide/VictideHeadSnail.cs b/Items/Armor/Victide/VictideHeadSnail.cs deleted file mode 100644 index b47058994c..0000000000 --- a/Items/Armor/Victide/VictideHeadSnail.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHelmet", "VictideHeadSummon")] - public class VictideHeadSnail : ModItem, ILocalizedModType // Utility/Fishing set - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - - public static int FishingPowerBoost = 5; - public static int AggroReduction = 200; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBoost); - - // Set Bonus - public static int SetBonusGrabRangeBoost = 102; // (2.625 + 6.375 = 9 tiles) - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 1; // 8 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - - public override void UpdateArmorSet(Player player) - { - Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); - player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3()); - player.Calamity().victideSnailSet = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - var source = player.GetSource_ItemUse(Item); - Vector2 position = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } - } - } - - public override void UpdateEquip(Player player) - { - player.fishingSkill += FishingPowerBoost; - player.aggro -= AggroReduction; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadSummon.cs b/Items/Armor/Victide/VictideHeadSummon.cs new file mode 100644 index 0000000000..49d3d275b6 --- /dev/null +++ b/Items/Armor/Victide/VictideHeadSummon.cs @@ -0,0 +1,78 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHelmet")] + public class VictideHeadSummon : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 1; //8 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + var modPlayer = player.Calamity(); + modPlayer.victideSet = true; + modPlayer.victideSummoner = true; + player.maxMinions++; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + var source = player.GetSource_ItemUse(Item); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + var baseDamage = 7; + var minionDamage = (int)player.GetTotalDamage().ApplyTo(7); + + var p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = baseDamage; + } + } + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.GetDamage() += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += 0.1f; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadSnail.png b/Items/Armor/Victide/VictideHeadSummon.png similarity index 100% rename from Items/Armor/Victide/VictideHeadSnail.png rename to Items/Armor/Victide/VictideHeadSummon.png diff --git a/Items/Armor/Victide/VictideHeadSnail_Head.png b/Items/Armor/Victide/VictideHeadSummon_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadSnail_Head.png rename to Items/Armor/Victide/VictideHeadSummon_Head.png diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 4d3f16e4b3..d22c2761f2 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -205,7 +205,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(10). AddIngredient(). AddTile(TileID.Anvils). Register(); @@ -245,7 +245,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(20). AddIngredient(). AddTile(TileID.Anvils). Register(); @@ -281,7 +281,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(15). AddIngredient(). AddTile(TileID.Anvils). Register(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 9d3c100af6..831dbb3b0b 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -204,8 +204,8 @@ namespace CalamityMod.Items stats[(int)VanillaWingID.LeafWings].FlyTime = 170; stats[(int)VanillaWingID.LeafWings].AccRunSpeedOverride = 9f; stats[(int)VanillaWingID.LeafWings].AccRunAccelerationMult = 2f; - // (Spectre Wings) 1 -> 1.5 acceleration multiplier - stats[(int)VanillaWingID.GhostWings].AccRunAccelerationMult = 1.5f; + // (Spectre Wings) 1 -> 2 acceleration multiplier + stats[(int)VanillaWingID.GhostWings].AccRunAccelerationMult = 2f; // 170 -> 210 flight time stats[(int)VanillaWingID.BeetleWings].FlyTime = 210; @@ -479,6 +479,21 @@ namespace CalamityMod.Items } } } + if (modPlayer.victideSet) + { + if ((item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass() || + item.CountsAsClass() || item.CountsAsClass()) && + Main.rand.NextBool(10) && !item.channel) + { + if (player.whoAmI == Main.myPlayer) + { + // Victide All-class Seashells: 200%, soft cap starts at 46 base damage + int seashellDamage = CalamityUtils.DamageSoftCap(damage * 2, 46); + + Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), seashellDamage, 1f, player.whoAmI); + } + } + } return true; } @@ -718,10 +733,6 @@ namespace CalamityMod.Items if (PopupGUIManager.AnyGUIsActive) return false; - // Can't use anything while burrowing - if (player.ownedProjectileCounts[ProjectileType()] > 0) - return false; - if (player.ownedProjectileCounts[ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { @@ -1122,32 +1133,7 @@ namespace CalamityMod.Items modPlayer.volatileGelatinVisuals = !hideVisual; } - // The Frog Leg line is prevented from stacking. - // Additionally, Amphibian boots are directly nerfed so they aren't the best in slot boots at all times. - // - // 21MAY2024: Ozzatron: Disabled this code. Frog Leg is allowed to stack. Amphibian Boots specific nerf is applied below. - /* - switch (item.type) - { - default: - break; - case ItemID.AmphibianBoots: - if (modPlayer.alreadyHasFrogLeg) - player.jumpSpeedBoost -= BalancingConstants.VanillaFrogLegJumpSpeedBoost; - else - player.jumpSpeedBoost += BalancingConstants.AmphibianBootsJumpSpeedBoost - BalancingConstants.VanillaFrogLegJumpSpeedBoost; - modPlayer.alreadyHasFrogLeg = true; - break; - case ItemID.FrogLeg: - case ItemID.FrogFlipper: - case ItemID.FrogGear: - case ItemID.FrogWebbing: - if (modPlayer.alreadyHasFrogLeg) - player.jumpSpeedBoost -= BalancingConstants.VanillaFrogLegJumpSpeedBoost; - modPlayer.alreadyHasFrogLeg = true; - break; - } - */ + // Amphibian boots are directly nerfed so they aren't the best in slot boots at all times. if (item.type == ItemID.AmphibianBoots) player.jumpSpeedBoost += BalancingConstants.AmphibianBootsJumpSpeedBoost - BalancingConstants.VanillaFrogLegJumpSpeedBoost; @@ -1206,17 +1192,20 @@ namespace CalamityMod.Items { player.GetJumpState().Available = true; } - if (player.wingsLogic <= 0 && player.velocity.Y != 0 && player.maxRunSpeed < 8) + if (player.wingsLogic <= 0 && player.velocity.Y != 0 && player.maxRunSpeed < 7) { - player.maxRunSpeed = 5f; + player.maxRunSpeed = 7f; } - player.jumpSpeedBoost += 1.6f; + player.jumpSpeedBoost += 2f; if (player.controlDown) - player.maxFallSpeed *= 1.5f; + player.maxFallSpeed *= (player.Calamity().ironBoots || player.Calamity().gSabaton) ? 1.5f : 2f; else player.maxFallSpeed *= 1.2f; } + if (item.type == ItemID.EmpressFlightBooster) + player.wingTimeMax += 150; + if (item.type == ItemID.DemonWings && !player.mount.Active) player.maxFallSpeed *= 1.2f; @@ -1286,7 +1275,6 @@ namespace CalamityMod.Items float moveSpeedBoost = modPlayer.moveSpeedBonus * 0.06f; float flightSpeedMult = 1f + - (modPlayer.soaring ? SoaringPotion.FlightBoost : 0f) + (modPlayer.reaverSpeed ? ReaverHeadMobility.SetBonusFlightBoost : 0f) + moveSpeedBoost; @@ -1312,14 +1300,14 @@ namespace CalamityMod.Items break; case ItemID.FlameWings: maxAscentMultiplier *= 1.1067f; - constantAscend *= 1.25f; + constantAscend *= 1.2f; break; case ItemID.ButterflyWings: maxAscentMultiplier *= 0.6667f; constantAscend *= 5f; break; case ItemID.GhostWings: - maxAscentMultiplier *= 0.6025f; + maxAscentMultiplier *= 0.6625f; constantAscend *= 5f; break; default: @@ -1338,8 +1326,6 @@ namespace CalamityMod.Items // Then, apply flat grab range boosts. if (player.Calamity().reaverExplore) grabRange += ReaverHeadExplore.SetBonusGrabRangeBoost; - if (player.Calamity().victideSnailSet) - grabRange += VictideHeadSnail.SetBonusGrabRangeBoost; // Nebula boosters have greater pickup range while hovering with Nebula Mantle. if (player.wingsLogic == (int)VanillaWingID.WingsNebula && player.wingTime > 0f && player.controlJump && player.TryingToHoverDown && ItemID.Sets.NebulaPickup[item.type]) diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index a3bf25dbd3..ad89f62418 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -76,7 +76,8 @@ namespace CalamityMod.Items ItemID.LucyTheAxe, ItemID.PewMaticHorn, ItemID.WeatherPain, - ItemID.HoundiusShootius + ItemID.HoundiusShootius, + ModContent.ItemType() }; loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, deerclopsWeapons)); loot.AddRevBagAccessories(); @@ -300,9 +301,17 @@ namespace CalamityMod.Items loot.Add(ModContent.ItemType(), 2, 2, 5); break; + // Reimplement primary loot rule to include Fledgling Wings + case ItemID.FloatingIslandFishingCrate: + RemoveLootRuleFromSkyCrates(loot); + loot.Add(ItemDropRule.OneFromOptionsNotScalingWithLuck(1, ItemID.ShinyRedBalloon, ItemID.LuckyHorseshoe, ItemID.Starfury, ItemID.CelestialMagnet, ItemID.CreativeWings)); + break; + // 2-5 Essences of Sunlight @ 50% // This is our equivalent to Souls of Light/Night case ItemID.FloatingIslandFishingCrateHard: + RemoveLootRuleFromSkyCrates(loot); + loot.Add(ItemDropRule.OneFromOptionsNotScalingWithLuck(1, ItemID.ShinyRedBalloon, ItemID.LuckyHorseshoe, ItemID.Starfury, ItemID.CelestialMagnet, ItemID.CreativeWings)); RemoveHardmodeOresFromBiomeCrates(loot); loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); loot.Add(ModContent.ItemType(), 2, 2, 5); @@ -583,6 +592,34 @@ namespace CalamityMod.Items ItemID.BandofRegeneration, ItemID.ShoeSpikes, ModContent.ItemType()); // Climbing Claws is in Wooden/Pearlwood (vanilla) in case you're curious + + private static void RemoveLootRuleFromSkyCrates(ItemLoot loot) + { + List rules = loot.Get(false); + AlwaysAtleastOneSuccessDropRule main = null; + foreach (IItemDropRule rule in rules) + { + if (rule is AlwaysAtleastOneSuccessDropRule a) + main = a; + } + if (main is null) + return; + + // Remove the primary loot rule and the rule for Fledgling Wings + foreach (IItemDropRule rule in main.rules) + { + if (rule is OneFromOptionsNotScaledWithLuckDropRule one && one.chanceDenominator == 1) + { + one.chanceNumerator = 0; + continue; + } + if (rule is CommonDrop c && c.itemId == ItemID.CreativeWings) + { + c.chanceNumerator = 0; + continue; + } + } + } #endregion #region Goodie Bag Bat Hook diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 033c6153d1..e51b48f5aa 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -169,9 +169,11 @@ namespace CalamityMod.Items float cdmg = 2f + Main.LocalPlayer.Calamity().critDamage + Main.LocalPlayer.GetTotalCritChance(item.DamageType) * 0.02f; tooltips.FirstOrDefault(x => x.Name == "CritChance")!.Text = CalamityUtils.GetText("Common.CritDamageTootip").Format(cdmg.ToPercent()); } - + //Add "Uses X Minion Slots right above "Uses X Mana" - if (ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 || ContentSamples.ProjectilesByType[item.shoot].minionSlots > 0) + //Solutions set their "shoot" to 145 less than the projectile id of the spray, effectively making them a COMPLETELY RANDOM projectile that would change based on the folder structure of the mod. + //So, we must blacklist solutions from the item.shoot check. + if (ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 || (item.ammo != AmmoID.Solution && ContentSamples.ProjectilesByType[item.shoot].minionSlots > 0)) { float cost = ItemID.Sets.StaffMinionSlotsRequired[item.type]; if (item.type == ModContent.ItemType() && Main.LocalPlayer.Calamity().fadedIdolatry) @@ -322,6 +324,22 @@ namespace CalamityMod.Items } } + foreach (var buffID in CalamityItemSets.ExtraDebuffTooltip_Enemy[item.type]) + { + if (!buffIdsInTooltip.ContainsKey(buffID)) + buffIdsInTooltip.Add(buffID, 0); + else if (buffIdsInTooltip[buffID] == 1) + buffIdsInTooltip[buffID] = 2; + } + foreach (var buffID in CalamityItemSets.ExtraDebuffTooltip_Player[item.type]) + { + if (!buffIdsInTooltip.ContainsKey(buffID)) + buffIdsInTooltip.Add(buffID, 1); + else if (buffIdsInTooltip[buffID] == 0) + buffIdsInTooltip[buffID] = 2; + + } + if (buffIdsInTooltip.Count > 0) { bool showTheTip = false; @@ -376,8 +394,9 @@ namespace CalamityMod.Items if (showTheTip) { - var str = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"].First().ToString(); - tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", CalamityUtils.GetTextValue("Misc.AltExpand").Replace("{0}", str)))); + var bind = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"]; + string str = bind.Count == 0 ? GetTextValue("Misc.HotkeyNotBound") : bind.First().ToString(); + tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", GetTextValue("Misc.AltExpand").Replace("{0}", str)))); tooltips[lastTooltipIndex].OverrideColor = new Color(170, 170, 170); } else if (foundDebuff) @@ -397,110 +416,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 @@ -660,7 +575,7 @@ namespace CalamityMod.Items if (item.type == ItemID.DivingHelmet) EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel2")); if (item.type == ItemID.ArcticDivingGear) - EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1") + "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel2")); + EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel") + "\n" + CalamityUtils.GetTextValue("Common.AbyssBreathLevel2")); // Great breath boost if (item.type == ItemID.GillsPotion) @@ -1464,23 +1379,23 @@ namespace CalamityMod.Items /// /// Currently, the dictionary functions as follows:
/// 1-5 insanely fast
- /// 6-9 very fast
- /// 10-14 fast
- /// 15-22 average
- /// 23-29 slow
- /// 30-37 very slow
- /// 38-45 extremely slow
- /// 46+ snail + /// 6-10 very fast
+ /// 11-17 fast
+ /// 18-24 average
+ /// 25-30 slow
+ /// 31-43 very slow
+ /// 44-60 extremely slow
+ /// 61+ snail ///
private static readonly Dictionary SpeedTooltips = new Dictionary() { { 5, Language.GetText("LegacyTooltip.6") }, - { 9, Language.GetText("LegacyTooltip.7") }, - { 14, Language.GetText("LegacyTooltip.8") }, - { 22, Language.GetText("LegacyTooltip.9") }, - { 29, Language.GetText("LegacyTooltip.10") }, - { 37, Language.GetText("LegacyTooltip.11") }, - { 45, Language.GetText("LegacyTooltip.12") }, + { 10, Language.GetText("LegacyTooltip.7") }, + { 17, Language.GetText("LegacyTooltip.8") }, + { 24, Language.GetText("LegacyTooltip.9") }, + { 30, Language.GetText("LegacyTooltip.10") }, + { 43, Language.GetText("LegacyTooltip.11") }, + { 60, Language.GetText("LegacyTooltip.12") }, // TODO: Using int.MaxValue here may be considered kind of strange - only alternatives I can think of require hardcoding. { int.MaxValue, Language.GetText("LegacyTooltip.13") } }; @@ -1759,14 +1674,6 @@ namespace CalamityMod.Items return false; } - - // Rainbow effect originally made for Orderbringer because it used to have a special rarity - // But why did it have one in the first place?? - // Might be used for Miracle stuff later or something idk - /*if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) - { - - }*/ return true; } #endregion diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 9ed8e64673..fd9b336192 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -86,7 +86,6 @@ namespace CalamityMod.Items { ItemID.CrystalDart, Do(DamageExact(20)) }, // VANILLA: 14 DMG { ItemID.CrystalStorm, Do(DamageExact(40)) }, // VANILLA: 32 DMG { ItemID.CrystalVileShard, Do(DamageExact(35)) }, // VANILLA: 25 DMG - { ItemID.CursedArrow, Do(DamageExact(14)) }, // VANILLA: 17 DMG { ItemID.CursedDart, Do(DamageExact(25)) }, // VANILLA: 9 DMG { ItemID.Cutlass, Do(DamageExact(90), UseExact(11)) }, // VANILLA: 53 DMG, 16 UT { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, // VANILLA: 38 DMG @@ -114,7 +113,7 @@ namespace CalamityMod.Items { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, // VANILLA: 35 DMG, 7 VEL { ItemID.FlowerofFire, Do(DamageRatio(0.78f)) }, // VANILLA: 48 DMG. Uses ratios due to remix seed { ItemID.FlowerPow, Do(DamageExact(80)) }, // Displays as 160 damage. VANILLA: 65 DMG (displays as 130) - { ItemID.FlyingKnife, Do(DamageExact(53)) }, // VANILLA: 40 DMG + { ItemID.FlyingKnife, Do(DamageExact(45)) }, // VANILLA: 40 DMG { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(110)) }, // VANILLA: 49 DMG { ItemID.Gatligator, Do(UseExact(6)) }, // VANILLA: 7 UT { ItemID.GoldShortsword, Do(TrueMelee, DamageExact(17)) }, // VANILLA: 12 DMG @@ -128,14 +127,11 @@ namespace CalamityMod.Items { ItemID.Handgun, Do(UseExact(20)) }, // VANILLA: 15 UT { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, // VANILLA: 11 DMG { ItemID.HiveFive, Do(DamageExact(27)) }, // VANILLA: 24 DMG - { ItemID.HornetStaff, Do(DamageExact(18)) }, // VANILLA: 12 DMG { ItemID.IceBlade, Do(UseMeleeSpeed) }, { ItemID.IceBoomerang, Do(ShootSpeedExact(9), UseExact(25)) }, // VANILLA: 20 UT, 11.5 VEL { ItemID.IceRod, Do(ShootSpeedExact(20), UseExact(6)) }, // VANILLA: 9 UT, 12 VEL { ItemID.IceSickle, Do(UseMeleeSpeed, DamageExact(75), ShootSpeedExact(20f)) }, // VANILLA: 50 DMG, 12 VEL - { ItemID.IchorArrow, Do(DamageExact(13)) }, // VANILLA: 16 DMG { ItemID.IchorBullet, Do(DamageExact(11)) }, // VANILLA: 13 DMG - { ItemID.ImpStaff, Do(DamageExact(25)) }, // VANILLA: 17 DMG { ItemID.InfernoFork, Do(DamageExact(83), ShootSpeedExact(11)) }, // VANILLA: 70 DMG, 8 VEL { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, // VANILLA: 100 DMG, 20 UT { ItemID.IronShortsword, Do(TrueMelee, DamageExact(10)) }, // VANILLA: 8 DMG @@ -212,7 +208,7 @@ namespace CalamityMod.Items { ItemID.ShadowbeamStaff, Do(DamageExact(100)) }, // VANILLA: 80 DMG { ItemID.ShadowFlameBow, Do(DamageExact(55)) }, // VANILLA: 47 DMG { ItemID.ShadowFlameHexDoll, Do(DamageExact(40), ShootSpeedExact(30)) }, // VANILLA: 32 DMG, 9 VEL - { ItemID.ShadowFlameKnife, Do(DamageExact(50)) }, // VANILLA: 38 DMG + { ItemID.ShadowFlameKnife, Do(DamageExact(43)) }, // VANILLA: 38 DMG { ItemID.SharpTears, Do(DamageExact(49)) }, // Blood Thorn. VANILLA: 34 DMG { ItemID.Shotgun, Do(DamageExact(36)) }, // VANILLA: 24 DMG { ItemID.SilverBullet, Do(DamageExact(8)) }, // VANILLA: 9 DMG @@ -220,7 +216,6 @@ namespace CalamityMod.Items { ItemID.SkyFracture, Do(DamageExact(46)) }, // VANILLA: 38 DMG { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, // VANILLA: 55 DMG { ItemID.Smolstar, Do(DamageExact(9)) }, // Blade Staff. VANILLA: 6 DMG - { ItemID.SniperRifle, Do(DamageExact(200), UseExact(40)) }, // VANILLA: 185 DMG, 36 UT { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain. VANILLA: 35 DMG { ItemID.SpaceGun, Do(DamageExact(23)) }, // VANILLA: 17 DMG { ItemID.Spear, Do(TrueMelee, DamageExact(14)) }, // VANILLA: 8 DMG @@ -236,7 +231,7 @@ namespace CalamityMod.Items { ItemID.TacticalShotgun, Do(DamageExact(34)) }, // VANILLA: 29 DMG { ItemID.TaxCollectorsStickOfDoom, Do(UseTurn, DamageExact(80), UseExact(10)) }, // Classy Cane. VANILLA: 16 DMG, 15 UT { ItemID.TendonBow, Do(DamageExact(17)) }, // VANILLA: 19 DMG - { ItemID.TerraBlade, Do(DamageExact(95)) }, // VANILLA: 85 DMG + { ItemID.TerraBlade, Do(DamageExact(90)) }, // VANILLA: 85 DMG { ItemID.Terragrim, Do(TrueMeleeNoSpeed, DamageExact(13)) }, // VANILLA: 17 DMG { ItemID.Terrarian, Do(DamageExact(90)) }, // VANILLA: 190 DMG. Required due to fixing iframes so yoyo and shots can hit simultaneously { ItemID.TheEyeOfCthulhu, Do(DamageExact(80)) }, // VANILLA: 115 DMG @@ -252,12 +247,11 @@ namespace CalamityMod.Items { ItemID.ToxicFlask, Do(DamageExact(62), UseExact(33)) }, // VANILLA: 52 DMG, 45 UT { ItemID.Toxikarp, Do(UseExact(9)) }, // VANILLA: 10 UT { ItemID.Trident, Do(TrueMelee, DamageExact(20)) }, // VANILLA: 14 DMG - { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(112)) }, // VANILLA: 72 DMG - { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, // VANILLA: 70 DMG + { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(105)) }, // VANILLA: 72 DMG + { ItemID.TrueNightsEdge, Do(DamageExact(99)) }, // VANILLA: 70 DMG { ItemID.Tsunami, Do(DamageExact(45)) }, // VANILLA: 53 DMG { ItemID.TungstenBullet, Do(DamageExact(8)) }, // VANILLA: 9 DMG { ItemID.TungstenShortsword, Do(TrueMelee, DamageExact(15)) }, // VANILLA: 10 DMG - { ItemID.UnholyArrow, Do(DamageExact(11)) }, // VANILLA: 12 DMG { ItemID.UnholyTrident, Do(DamageRatio(0.91f)) }, // VANILLA: 88 DMG. Uses ratios due to remix seed { ItemID.Uzi, Do(UseExact(8)) }, // VANILLA: 9 UT { ItemID.ValkyrieYoyo, Do(DamageExact(48)) }, // VANILLA: 70 DMG. Has the same stats as Red's Throw @@ -289,6 +283,7 @@ namespace CalamityMod.Items { ItemID.AdamantiteDrill, Do(TrueMeleeNoSpeed, DamageExact(33), TileBoostExact(+0)) }, // VANILLA: 20 DMG, -1 TILE { ItemID.AdamantitePickaxe, Do(TileBoostExact(+1)) }, // VANILLA: 0 TILE { ItemID.AdamantiteWaraxe, Do(UseTimeExact(10), AxePower(160), TileBoostExact(+1)) }, // VANILLA: 8 SPD, 100 AXE, 0 TILE + { ItemID.AshWoodHammer, Do(UseTimeExact(7), HammerPower(25)) }, // VANILLA: 20 SPD, 45 HAM { ItemID.BloodLustCluster, Do(UseTimeExact(13), AxePower(100)) }, // VANILLA: 15 SPD, 75 AXE { ItemID.BonePickaxe, Do(UseTimeExact(6)) }, // VANILLA: 11 SPD { ItemID.BorealWoodHammer, Do(UseTimeExact(11), HammerPower(25)) }, // VANILLA: 23 SPD, 35 HAM @@ -399,6 +394,7 @@ namespace CalamityMod.Items #endregion #region CATEGORY 5: UseTurn + { ItemID.AshWoodSword, Do(UseTurn) }, { ItemID.BeeKeeper, Do(UseTurn) }, { ItemID.BladeofGrass, Do(UseTurn) }, { ItemID.BloodButcherer, Do(UseTurn) }, diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.cs b/Items/Critters/AlphaSeaMinnowGoldItem.cs deleted file mode 100644 index abe6bf332b..0000000000 --- a/Items/Critters/AlphaSeaMinnowGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class AlphaSeaMinnowGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 5); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.png b/Items/Critters/AlphaSeaMinnowGoldItem.png deleted file mode 100644 index 4fde55be43..0000000000 Binary files a/Items/Critters/AlphaSeaMinnowGoldItem.png and /dev/null differ diff --git a/Items/Critters/AlphaSeaMinnowItem.cs b/Items/Critters/AlphaSeaMinnowItem.cs deleted file mode 100644 index c8336e00d5..0000000000 --- a/Items/Critters/AlphaSeaMinnowItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class AlphaSeaMinnowItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 30; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/AlphaSeaMinnowItem.png b/Items/Critters/AlphaSeaMinnowItem.png deleted file mode 100644 index 6971e57df1..0000000000 Binary files a/Items/Critters/AlphaSeaMinnowItem.png and /dev/null differ diff --git a/Items/Critters/BabyFlakCrabItem.cs b/Items/Critters/BabyFlakCrabItem.cs index 61d480672a..bc3fd2082a 100644 --- a/Items/Critters/BabyFlakCrabItem.cs +++ b/Items/Critters/BabyFlakCrabItem.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.LightPurple; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.White; } } } diff --git a/Items/Critters/BabyGhostBellGoldItem.cs b/Items/Critters/BabyGhostBellGoldItem.cs deleted file mode 100644 index 5d9f76989f..0000000000 --- a/Items/Critters/BabyGhostBellGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class BabyGhostBellGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/BabyGhostBellGoldItem.png b/Items/Critters/BabyGhostBellGoldItem.png deleted file mode 100644 index 8108a2f5c5..0000000000 Binary files a/Items/Critters/BabyGhostBellGoldItem.png and /dev/null differ diff --git a/Items/Critters/BabyGhostBellGreenItem.cs b/Items/Critters/BabyGhostBellGreenItem.cs deleted file mode 100644 index a007a1e88a..0000000000 --- a/Items/Critters/BabyGhostBellGreenItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class BabyGhostBellGreenItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/BabyGhostBellGreenItem.png b/Items/Critters/BabyGhostBellGreenItem.png deleted file mode 100644 index a2266ddb83..0000000000 Binary files a/Items/Critters/BabyGhostBellGreenItem.png and /dev/null differ diff --git a/Items/Critters/BabyGhostBellItem.png b/Items/Critters/BabyGhostBellItem.png index da84e29584..7e7e84c4f1 100644 Binary files a/Items/Critters/BabyGhostBellItem.png and b/Items/Critters/BabyGhostBellItem.png differ diff --git a/Items/Critters/BabyGhostBellPinkItem.cs b/Items/Critters/BabyGhostBellPinkItem.cs deleted file mode 100644 index c7e026fb6f..0000000000 --- a/Items/Critters/BabyGhostBellPinkItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class BabyGhostBellPinkItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/BabyGhostBellPinkItem.png b/Items/Critters/BabyGhostBellPinkItem.png deleted file mode 100644 index 5fdd7c08b8..0000000000 Binary files a/Items/Critters/BabyGhostBellPinkItem.png and /dev/null differ diff --git a/Items/Critters/BabyGhostBellRadiantItem.cs b/Items/Critters/BabyGhostBellRadiantItem.cs deleted file mode 100644 index acec17ce8a..0000000000 --- a/Items/Critters/BabyGhostBellRadiantItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class BabyGhostBellRadiantItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(gold: 2); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/BabyGhostBellRadiantItem.png b/Items/Critters/BabyGhostBellRadiantItem.png deleted file mode 100644 index 856633e38a..0000000000 Binary files a/Items/Critters/BabyGhostBellRadiantItem.png and /dev/null differ diff --git a/Items/Critters/GildedAxolotlItem.cs b/Items/Critters/GildedAxolotlItem.cs deleted file mode 100644 index 61bf55c30f..0000000000 --- a/Items/Critters/GildedAxolotlItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.TownNPCs; -using CalamityMod.Rarities; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class GildedAxolotlItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 1); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/GildedAxolotlItem.png b/Items/Critters/GildedAxolotlItem.png deleted file mode 100644 index 47dc612fd3..0000000000 Binary files a/Items/Critters/GildedAxolotlItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodBlackItem.cs b/Items/Critters/PearlpodBlackItem.cs deleted file mode 100644 index 30818b7f72..0000000000 --- a/Items/Critters/PearlpodBlackItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class PearlpodBlackItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PearlpodBlackItem.png b/Items/Critters/PearlpodBlackItem.png deleted file mode 100644 index 892ff72678..0000000000 Binary files a/Items/Critters/PearlpodBlackItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodItem.cs b/Items/Critters/PearlpodItem.cs deleted file mode 100644 index dcdfbcc323..0000000000 --- a/Items/Critters/PearlpodItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class PearlpodItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PearlpodItem.png b/Items/Critters/PearlpodItem.png deleted file mode 100644 index bd60b5c6ad..0000000000 Binary files a/Items/Critters/PearlpodItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodPinkItem.cs b/Items/Critters/PearlpodPinkItem.cs deleted file mode 100644 index e91ad00b95..0000000000 --- a/Items/Critters/PearlpodPinkItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class PearlpodPinkItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 20; - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PearlpodPinkItem.png b/Items/Critters/PearlpodPinkItem.png deleted file mode 100644 index c65355ec5e..0000000000 Binary files a/Items/Critters/PearlpodPinkItem.png and /dev/null differ diff --git a/Items/Critters/SlugbunRadiantItem.cs b/Items/Critters/PiggyGoldItem.cs similarity index 64% rename from Items/Critters/SlugbunRadiantItem.cs rename to Items/Critters/PiggyGoldItem.cs index e1ada3b71d..39ca391053 100644 --- a/Items/Critters/SlugbunRadiantItem.cs +++ b/Items/Critters/PiggyGoldItem.cs @@ -1,13 +1,14 @@ -using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Critters { - public class SlugbunRadiantItem : ModItem, ILocalizedModType + public class PiggyGoldItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; @@ -15,9 +16,9 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Critters/PiggyGoldItem.png b/Items/Critters/PiggyGoldItem.png new file mode 100644 index 0000000000..ab41e817d5 Binary files /dev/null and b/Items/Critters/PiggyGoldItem.png differ diff --git a/Items/Critters/PiggyItem.cs b/Items/Critters/PiggyItem.cs index 3388b74cff..7f54dcc8d7 100644 --- a/Items/Critters/PiggyItem.cs +++ b/Items/Critters/PiggyItem.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Critters public class PiggyItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 10); + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; Item.Calamity().donorItem = true; } diff --git a/Items/Critters/PiggyItem.png b/Items/Critters/PiggyItem.png index 34c9df0b9a..0628198b73 100644 Binary files a/Items/Critters/PiggyItem.png and b/Items/Critters/PiggyItem.png differ diff --git a/Items/Critters/PolypPanaseaGoldItem.cs b/Items/Critters/PolypPanaseaGoldItem.cs deleted file mode 100644 index b36e59810c..0000000000 --- a/Items/Critters/PolypPanaseaGoldItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaGoldItem.png b/Items/Critters/PolypPanaseaGoldItem.png deleted file mode 100644 index b419186c46..0000000000 Binary files a/Items/Critters/PolypPanaseaGoldItem.png and /dev/null differ diff --git a/Items/Critters/PolypPanaseaGreenItem.cs b/Items/Critters/PolypPanaseaGreenItem.cs deleted file mode 100644 index f1b5fded2b..0000000000 --- a/Items/Critters/PolypPanaseaGreenItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaGreenItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaGreenItem.png b/Items/Critters/PolypPanaseaGreenItem.png deleted file mode 100644 index 5348095c25..0000000000 Binary files a/Items/Critters/PolypPanaseaGreenItem.png and /dev/null differ diff --git a/Items/Critters/PolypPanaseaItem.cs b/Items/Critters/PolypPanaseaItem.cs deleted file mode 100644 index 3ad9b72764..0000000000 --- a/Items/Critters/PolypPanaseaItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaItem.png b/Items/Critters/PolypPanaseaItem.png deleted file mode 100644 index 4b961ac2e2..0000000000 Binary files a/Items/Critters/PolypPanaseaItem.png and /dev/null differ diff --git a/Items/Critters/PolypPanaseaPurpleItem.cs b/Items/Critters/PolypPanaseaPurpleItem.cs deleted file mode 100644 index d348d0f10d..0000000000 --- a/Items/Critters/PolypPanaseaPurpleItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaPurpleItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaPurpleItem.png b/Items/Critters/PolypPanaseaPurpleItem.png deleted file mode 100644 index 9125ccacd5..0000000000 Binary files a/Items/Critters/PolypPanaseaPurpleItem.png and /dev/null differ diff --git a/Items/Critters/PolypPanaseaRadiantItem.cs b/Items/Critters/PolypPanaseaRadiantItem.cs deleted file mode 100644 index 452bc6696d..0000000000 --- a/Items/Critters/PolypPanaseaRadiantItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaRadiantItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); // Reminder to change this :) - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaRadiantItem.png b/Items/Critters/PolypPanaseaRadiantItem.png deleted file mode 100644 index 112eed64a6..0000000000 Binary files a/Items/Critters/PolypPanaseaRadiantItem.png and /dev/null differ diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.cs b/Items/Critters/PolypPanaseaTurquoiseItem.cs deleted file mode 100644 index 4b19fb865b..0000000000 --- a/Items/Critters/PolypPanaseaTurquoiseItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class PolypPanaseaTurquoiseItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.png b/Items/Critters/PolypPanaseaTurquoiseItem.png deleted file mode 100644 index 7aba44f54a..0000000000 Binary files a/Items/Critters/PolypPanaseaTurquoiseItem.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyBlue2Item.png b/Items/Critters/PrismaticGuppyBlue2Item.png deleted file mode 100644 index b737e98181..0000000000 Binary files a/Items/Critters/PrismaticGuppyBlue2Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyBlue3Item.png b/Items/Critters/PrismaticGuppyBlue3Item.png deleted file mode 100644 index 0470416d07..0000000000 Binary files a/Items/Critters/PrismaticGuppyBlue3Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyBlueItem.png b/Items/Critters/PrismaticGuppyBlueItem.png deleted file mode 100644 index e69ad0f093..0000000000 Binary files a/Items/Critters/PrismaticGuppyBlueItem.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGold2Item.png b/Items/Critters/PrismaticGuppyGold2Item.png deleted file mode 100644 index 175ddf0a05..0000000000 Binary files a/Items/Critters/PrismaticGuppyGold2Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGold3Item.png b/Items/Critters/PrismaticGuppyGold3Item.png deleted file mode 100644 index aa8226a0cc..0000000000 Binary files a/Items/Critters/PrismaticGuppyGold3Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGoldItem.png b/Items/Critters/PrismaticGuppyGoldItem.png deleted file mode 100644 index 255ef49b6e..0000000000 Binary files a/Items/Critters/PrismaticGuppyGoldItem.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGreen2Item.png b/Items/Critters/PrismaticGuppyGreen2Item.png deleted file mode 100644 index e725beff26..0000000000 Binary files a/Items/Critters/PrismaticGuppyGreen2Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGreen3Item.png b/Items/Critters/PrismaticGuppyGreen3Item.png deleted file mode 100644 index e98484e833..0000000000 Binary files a/Items/Critters/PrismaticGuppyGreen3Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyGreenItem.png b/Items/Critters/PrismaticGuppyGreenItem.png deleted file mode 100644 index 5bf82e62d6..0000000000 Binary files a/Items/Critters/PrismaticGuppyGreenItem.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyItem.cs b/Items/Critters/PrismaticGuppyItem.cs deleted file mode 100644 index eb48ba859f..0000000000 --- a/Items/Critters/PrismaticGuppyItem.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System.IO; -using CalamityMod.NPCs.SunkenSea; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; - -namespace CalamityMod.Items.Critters -{ - public abstract class PrismaticGuppyItem : ModItem, ILocalizedModType - { - public int shapeVariant = 0; - public abstract Texture2D CubicTexture { get; } - public abstract Texture2D AngelicTexture { get; } - - public new string LocalizationCategory => "Items.Misc"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 20); // they sell for more - Item.rare = ItemRarityID.Green; - } - - public override void OnSpawn(IEntitySource source) - { - if (source is EntitySource_Caught catchEntity) - { - if (catchEntity.Entity is NPC n) - { - if (n.type == ModContent.NPCType()) - { - shapeVariant = (int)n.ai[2]; - } - } - } - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D tex = TextureAssets.Item[Item.type].Value; - switch (shapeVariant) - { - case 1: - tex = CubicTexture; - break; - case 2: - tex = AngelicTexture; - break; - } - spriteBatch.Draw(tex, Item.Center - Main.screenPosition, null, lightColor, rotation, tex.Size() / 2, scale, SpriteEffects.None, 0f); - return false; - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D tex = TextureAssets.Item[Item.type].Value; - switch (shapeVariant) - { - case 1: - tex = CubicTexture; - break; - case 2: - tex = AngelicTexture; - break; - } - spriteBatch.Draw(tex, position, null, drawColor, 0, tex.Size() / 2, scale, SpriteEffects.None, 0f); - return false; - } - - public override void SaveData(TagCompound tag) - { - tag.Add("shapeVariant", shapeVariant); - } - - public override void LoadData(TagCompound tag) - { - shapeVariant = tag.GetInt("shapeVariant"); - } - - public override void NetSend(BinaryWriter writer) - { - writer.Write(shapeVariant); - } - - public override void NetReceive(BinaryReader reader) - { - shapeVariant = reader.ReadInt32(); - } - } - - // RIP "Throwing these in an aquarium would be insanity" flavor text - [LegacyName("PrismaticGuppy")] - public class PrismaticGuppyBlueItem : PrismaticGuppyItem - { - public override Texture2D AngelicTexture => angelicTex.Value; - public override Texture2D CubicTexture => cubicTex.Value; - - public static Asset angelicTex; - public static Asset cubicTex; - public override void Load() - { - cubicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyBlue2Item"); - angelicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyBlue3Item"); - } - } - - public class PrismaticGuppyPinkItem : PrismaticGuppyItem - { - public override Texture2D AngelicTexture => angelicTex.Value; - public override Texture2D CubicTexture => cubicTex.Value; - - public static Asset angelicTex; - public static Asset cubicTex; - public override void Load() - { - cubicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyPink2Item"); - angelicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyPink3Item"); - } - } - - public class PrismaticGuppyGreenItem : PrismaticGuppyItem - { - public override Texture2D AngelicTexture => angelicTex.Value; - public override Texture2D CubicTexture => cubicTex.Value; - - public static Asset angelicTex; - public static Asset cubicTex; - public override void Load() - { - cubicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyGreen2Item"); - angelicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyGreen3Item"); - } - } - - public class PrismaticGuppyGoldItem : PrismaticGuppyItem - { - public override Texture2D AngelicTexture => angelicTex.Value; - public override Texture2D CubicTexture => cubicTex.Value; - - public static Asset angelicTex; - public static Asset cubicTex; - public override void Load() - { - cubicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyGold2Item"); - angelicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyGold3Item"); - } - public override void SetDefaults() - { - base.SetDefaults(); - Item.value = Item.sellPrice(gold: 15); // base guppies are said to sell for a lot already - } - } - - public class PrismaticGuppyRadiantItem : PrismaticGuppyItem - { - public override Texture2D AngelicTexture => angelicTex.Value; - public override Texture2D CubicTexture => cubicTex.Value; - - public static Asset angelicTex; - public static Asset cubicTex; - public override void Load() - { - cubicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyRadiant2Item"); - angelicTex = ModContent.Request("CalamityMod/Items/Critters/PrismaticGuppyRadiant3Item"); - } - public override void SetDefaults() - { - base.SetDefaults(); - Item.value = Item.sellPrice(gold: 15); // base guppies are said to sell for a lot already - } - } -} diff --git a/Items/Critters/PrismaticGuppyPink2Item.png b/Items/Critters/PrismaticGuppyPink2Item.png deleted file mode 100644 index 0596565655..0000000000 Binary files a/Items/Critters/PrismaticGuppyPink2Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyPink3Item.png b/Items/Critters/PrismaticGuppyPink3Item.png deleted file mode 100644 index f0c5839dfb..0000000000 Binary files a/Items/Critters/PrismaticGuppyPink3Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyPinkItem.png b/Items/Critters/PrismaticGuppyPinkItem.png deleted file mode 100644 index 8100ed4f6a..0000000000 Binary files a/Items/Critters/PrismaticGuppyPinkItem.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyRadiant2Item.png b/Items/Critters/PrismaticGuppyRadiant2Item.png deleted file mode 100644 index ecceded340..0000000000 Binary files a/Items/Critters/PrismaticGuppyRadiant2Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyRadiant3Item.png b/Items/Critters/PrismaticGuppyRadiant3Item.png deleted file mode 100644 index b07ef47455..0000000000 Binary files a/Items/Critters/PrismaticGuppyRadiant3Item.png and /dev/null differ diff --git a/Items/Critters/PrismaticGuppyRadiantItem.png b/Items/Critters/PrismaticGuppyRadiantItem.png deleted file mode 100644 index f9aa73873b..0000000000 Binary files a/Items/Critters/PrismaticGuppyRadiantItem.png and /dev/null differ diff --git a/Items/Critters/ProbesnoutGoldItem.cs b/Items/Critters/ProbesnoutGoldItem.cs deleted file mode 100644 index ea7ccc7523..0000000000 --- a/Items/Critters/ProbesnoutGoldItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class ProbesnoutGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/ProbesnoutGoldItem.png b/Items/Critters/ProbesnoutGoldItem.png deleted file mode 100644 index fc1d99790a..0000000000 Binary files a/Items/Critters/ProbesnoutGoldItem.png and /dev/null differ diff --git a/Items/Critters/ProbesnoutItem.cs b/Items/Critters/ProbesnoutItem.cs deleted file mode 100644 index e8a0d6ae6e..0000000000 --- a/Items/Critters/ProbesnoutItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class ProbesnoutItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/ProbesnoutItem.png b/Items/Critters/ProbesnoutItem.png deleted file mode 100644 index 3e82f75c69..0000000000 Binary files a/Items/Critters/ProbesnoutItem.png and /dev/null differ diff --git a/Items/Critters/SeaFloatyItem.cs b/Items/Critters/SeaFloatyItem.cs deleted file mode 100644 index b313de7f03..0000000000 --- a/Items/Critters/SeaFloatyItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SeaFloatyItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 3); // These things are actually painful to catch, they can get a 300% value boost - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaFloatyItem.png b/Items/Critters/SeaFloatyItem.png deleted file mode 100644 index 83dc6f5920..0000000000 Binary files a/Items/Critters/SeaFloatyItem.png and /dev/null differ diff --git a/Items/Critters/SeaMinnowGoldItem.cs b/Items/Critters/SeaMinnowGoldItem.cs deleted file mode 100644 index d0ee9d3bf7..0000000000 --- a/Items/Critters/SeaMinnowGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SeaMinnowGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaMinnowGoldItem.png b/Items/Critters/SeaMinnowGoldItem.png deleted file mode 100644 index 95f0da795b..0000000000 Binary files a/Items/Critters/SeaMinnowGoldItem.png and /dev/null differ diff --git a/Items/Critters/SearslugItem.cs b/Items/Critters/SearslugItem.cs deleted file mode 100644 index 46f154ddde..0000000000 --- a/Items/Critters/SearslugItem.cs +++ /dev/null @@ -1,25 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class SearslugItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - ItemID.Sets.IsLavaBait[Type] = true; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 30; - Item.value = Item.sellPrice(silver: 30); - Item.rare = ItemRarityID.Orange; - } - } -} diff --git a/Items/Critters/SearslugItem.png b/Items/Critters/SearslugItem.png deleted file mode 100644 index 31a39cfa0f..0000000000 Binary files a/Items/Critters/SearslugItem.png and /dev/null differ diff --git a/Items/Critters/ShoreskipperItem.cs b/Items/Critters/ShoreskipperItem.cs deleted file mode 100644 index 7eaf1fd339..0000000000 --- a/Items/Critters/ShoreskipperItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class ShoreskipperItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 5); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/ShoreskipperItem.png b/Items/Critters/ShoreskipperItem.png deleted file mode 100644 index 24722e85da..0000000000 Binary files a/Items/Critters/ShoreskipperItem.png and /dev/null differ diff --git a/Items/Critters/SlugbunBurrowsItem.cs b/Items/Critters/SlugbunBurrowsItem.cs deleted file mode 100644 index 616608a04c..0000000000 --- a/Items/Critters/SlugbunBurrowsItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SlugbunBurrowsItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SlugbunBurrowsItem.png b/Items/Critters/SlugbunBurrowsItem.png deleted file mode 100644 index 5f03039d24..0000000000 Binary files a/Items/Critters/SlugbunBurrowsItem.png and /dev/null differ diff --git a/Items/Critters/SlugbunItem.cs b/Items/Critters/SlugbunItem.cs deleted file mode 100644 index fd7c1898a2..0000000000 --- a/Items/Critters/SlugbunItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SlugbunItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SlugbunItem.png b/Items/Critters/SlugbunItem.png deleted file mode 100644 index 81d4609d92..0000000000 Binary files a/Items/Critters/SlugbunItem.png and /dev/null differ diff --git a/Items/Critters/SlugbunPolypItem.cs b/Items/Critters/SlugbunPolypItem.cs deleted file mode 100644 index 9b43f3d9fe..0000000000 --- a/Items/Critters/SlugbunPolypItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SlugbunPolypItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(silver: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SlugbunPolypItem.png b/Items/Critters/SlugbunPolypItem.png deleted file mode 100644 index 6c8a1c45e7..0000000000 Binary files a/Items/Critters/SlugbunPolypItem.png and /dev/null differ diff --git a/Items/Critters/SlugbunRadiantItem.png b/Items/Critters/SlugbunRadiantItem.png deleted file mode 100644 index 60cc5c9cd1..0000000000 Binary files a/Items/Critters/SlugbunRadiantItem.png and /dev/null differ diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 08079cd86a..73c483832c 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -59,8 +59,8 @@ namespace CalamityMod.Items.DraedonMisc CreateRecipe(). AddIngredient(10). AddIngredient(10). - AddIngredient(5). - AddIngredient(ItemID.LunarBar, 5). + AddIngredient(10). + AddIngredient(ItemID.LunarBar, 10). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Dyes/InvisibleDye.cs b/Items/Dyes/InvisibleDye.cs index f575c787a2..59d5da7489 100644 --- a/Items/Dyes/InvisibleDye.cs +++ b/Items/Dyes/InvisibleDye.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; @@ -22,6 +23,15 @@ namespace CalamityMod.Items.Dyes Item.value = Item.sellPrice(silver: 20); } + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). + AddIngredient(ItemID.Lens). + AddTile(TileID.DyeVat). + Register(); + } + #region On Edit Hell To Actually Make Player Body Not Draw public override void Load() { 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/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index 417a8f5c16..7b1a7cac84 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -46,8 +46,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.WoodFishingPole). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index 46f766c8fb..c5f19e68c3 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 63f0aeb0d8..1010d34331 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 7b74df80bf..2d7a844748 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { CreateRecipe(). AddIngredient(ItemID.HotlineFishingHook). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 4d2de64f1f..684d355ddf 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(8). AddTile(). Register(); } diff --git a/Items/Fishing/FishingRods/TrustyOldRod.cs b/Items/Fishing/FishingRods/TrustyOldRod.cs index 2f77e5458c..d19e2a3b81 100644 --- a/Items/Fishing/FishingRods/TrustyOldRod.cs +++ b/Items/Fishing/FishingRods/TrustyOldRod.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 35); // Same price as Sitting Duck's Fishing Pole; Sold by Shady Salesman } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) { diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index d789304590..a122f03b56 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index fe6708af6e..68e14d39f5 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index 104d5559ac..1f136008a4 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Terraria; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -45,13 +46,18 @@ namespace CalamityMod.Items.Fishing { int gemMin = 1; int gemMax = 3; - itemLoot.Add(ItemID.Amethyst, 2, gemMin, gemMax); - itemLoot.Add(ItemID.Topaz, 2, gemMin, gemMax); - itemLoot.Add(ItemID.Sapphire, 4, gemMin, gemMax); - itemLoot.Add(ItemID.Emerald, 4, gemMin, gemMax); - itemLoot.Add(ItemID.Ruby, 8, gemMin, gemMax); - itemLoot.Add(ItemID.Diamond, 10, gemMin, gemMax); - itemLoot.Add(ItemID.Amber, 8, gemMin, gemMax); + + IItemDropRule[] gems = [ + new CommonDrop(ItemID.Amethyst, 2, gemMin, gemMax), + new CommonDrop(ItemID.Topaz, 2, gemMin, gemMax), + new CommonDrop(ItemID.Sapphire, 4, gemMin, gemMax), + new CommonDrop(ItemID.Emerald, 4, gemMin, gemMax), + new CommonDrop(ItemID.Ruby, 8, gemMin, gemMax), + new CommonDrop(ItemID.Diamond, 8, gemMin, gemMax), + new CommonDrop(ItemID.Amber, 8, gemMin, gemMax), + ]; + + itemLoot.Add(new AlwaysAtleastOneSuccessDropRule(gems)); // Add Thorium gems if Thorium is loaded. Mod thorium = ExternalMods.thorium; diff --git a/Items/Fishing/RageBait.cs b/Items/Fishing/RageBait.cs index 43c2ac8f62..22f1d68c6a 100644 --- a/Items/Fishing/RageBait.cs +++ b/Items/Fishing/RageBait.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Fishing Item.height = 12; Item.maxStack = Item.CommonMaxStack; Item.rare = ItemRarityID.Blue; - Item.value = Item.sellPrice(copper: 1); + Item.value = Item.buyPrice(silver: 15); // Sold by Shady Salesman Item.bait = 100; Item.consumable = true; } diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs new file mode 100644 index 0000000000..5b21ce7e7a --- /dev/null +++ b/Items/Fishing/Spadefish.cs @@ -0,0 +1,407 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Achievements; +using Terraria.Graphics.Renderers; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Items.Fishing +{ + public class Spadefish : RogueWeapon, ILocalizedModType + { + public static float SpinsToThrow => 3; + + public static float SpinDamageMult => 0.33f; + + public static float SpinAccel => 1.0175f; + + public static float SpinThrowVelocityMult => 1.5f; + + public override float StealthDamageMultiplier => 2f; + + public static int PickPower => 50; + public new string LocalizationCategory => "Items.Fishing"; + public override void SetDefaults() + { + Item.width = 46; + Item.height = 44; + Item.damage = 30; + Item.knockBack = 2f; + Item.useTime = 40; + Item.useAnimation = 40; + Item.shootSpeed = 12; + Item.DamageType = RogueDamageClass.Instance; + Item.useStyle = ItemUseStyleID.Swing; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.noUseGraphic = true; + Item.pick = PickPower; + + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.Calamity().StealthStrikeAvailable()) + { + type = ModContent.ProjectileType(); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); //This proj sets StealthStrike on its own setdefaults + + player.Calamity().ConsumeStealthByAttacking(); //Due to the holdout, we manually consume stealth here and on spam. + return false; + } + player.Calamity().rogueStealth = 0; + return true; + } + + + #region Toggleable Mining + + public bool CanMine = false; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", CanMine ? this.GetLocalizedValue("TextWhileEnabled") : this.GetLocalizedValue("TextWhileDisabled")); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + CanMine = !CanMine; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("CanMine", CanMine); + } + + public override void LoadData(TagCompound tag) + { + CanMine = tag.GetBool("CanMine"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(CanMine); + } + + public override void NetReceive(BinaryReader reader) + { + CanMine = reader.ReadBoolean(); + } + Asset texture; + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (CanMine) + { + var tex = CalamityUtils.GetTextureEfficient(ref texture, "Terraria/Images/Extra_48").Value; + var dotFrame = tex.Frame(8, 39, 4, 23); + spriteBatch.Draw(tex, position + new Vector2(16, 16) * Main.inventoryScale, dotFrame, Color.White, 0, dotFrame.Size() * 0.5f, Main.inventoryScale, SpriteEffects.None, 0); + } + } + #endregion + } + + public class SpadefishThrown : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Fishing/Spadefish"; + public override void SetDefaults() + { + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = 3; + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.timeLeft = 480; + Projectile.MaxUpdates = 2; + Projectile.ignoreWater = true; + } + bool frameOne = true; + public override void AI() + { + if (frameOne) + { + Projectile.velocity /= Projectile.MaxUpdates; + frameOne = false; + } + if (Projectile.ai[0] <= 1 && Projectile.timeLeft < 450) + Projectile.velocity.Y += 0.08f; + if (Projectile.ai[0] == 0) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + else if (Projectile.ai[0] == 1) + Projectile.rotation += Projectile.velocity.X * 0.15f; + + if (Projectile.timeLeft < 60) + { + Projectile.Opacity = Projectile.timeLeft / 60f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + + if (Projectile.ai[0] == 1) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.velocity = Vector2.Zero; + Projectile.Center += oldVelocity; + Projectile.ai[0] = 2; + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + if (Main.myPlayer == Projectile.owner && Main.LocalPlayer.HeldItem.ModItem is Spadefish s && s.CanMine) + for (var j = -1; j < 2; j++) + for (var k = -1; k < 2; k++) + Dig(Spadefish.PickPower, Projectile.Center.ToTileCoordinates() + new Point(j, k)); + return false; + } + + public static void Dig(int pickPower, Point point) + { + var tile = Main.tile[point]; + var x = tile.X(); + var y = tile.Y(); + + if (!tile.HasTile || Main.tileAxe[tile.TileType] || Main.tileHammer[tile.TileType]) + return; + + int hitIndex = Main.LocalPlayer.hitTile.HitObject(x, y, 1); + + if (tile.TileType == TileID.MysticSnakeRope) + return; + + int pickDmg = Main.LocalPlayer.GetPickaxeDamage(x, y, pickPower, hitIndex, tile); + + + if (!WorldGen.CanKillTile(x, y)) + pickDmg = 0; + + if (Main.getGoodWorld) + pickDmg *= 2; + + if (Main.LocalPlayer.DoesPickTargetTransformOnKill(Main.LocalPlayer.hitTile, pickDmg, x, y, pickPower, hitIndex, tile)) + pickDmg = 0; + + if (Main.LocalPlayer.hitTile.AddDamage(hitIndex, pickDmg) >= 100) + { + AchievementsHelper.CurrentlyMining = true; + Main.LocalPlayer.ClearMiningCacheAt(x, y, 1); + if (Main.netMode == NetmodeID.MultiplayerClient && Main.tileContainer[tile.TileType]) + { + if (tile.TileType == TileID.DisplayDoll || tile.TileType == TileID.HatRack) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 20, x, y); + else + { + WorldGen.KillTile(x, y, fail: true); + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, x, y, 1f); + } + if (tile.TileType == TileID.Containers) + { + NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 1, x, y); + } + if (tile.TileType == TileID.Containers2) + { + NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 5, x, y); + } + if (tile.TileType == TileID.Dressers) + { + NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 3, x, y); + } + } + else + { + bool flag = tile.HasTile; + WorldGen.KillTile(x, y); + if (!Main.dedServ && flag && !tile.HasTile) + { + AchievementsHelper.HandleMining(); + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, x, y); + } + } + AchievementsHelper.CurrentlyMining = false; + } + else + { + WorldGen.KillTile(x, y, fail: true); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, x, y, 1f); + NetMessage.SendData(MessageID.SyncTilePicking, -1, -1, null, Main.myPlayer, x, y, pickDmg); + } + } + if (pickDmg != 0) + { + Main.LocalPlayer.hitTile.Prune(); + } + } + + + + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item178 with { Pitch = -0.5f + 0.25f * Projectile.numHits + (Projectile.Calamity().stealthStrike ? 1f : 0f) }, Projectile.Center); + + Projectile.velocity.X = -Projectile.velocity.X.DirectionalSign(); + Projectile.velocity.Y = -2f; + Projectile.ai[0] = 1; + Projectile.damage /= 2; + Projectile.netUpdate = true; + } + + public override bool PreDraw(ref Color lightColor) + { + var tex = TextureAssets.Projectile[Type]; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, 0); + return false; + } + } + + public class SpadefishHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Fishing/Spadefish"; + + ref float spin => ref Projectile.ai[0]; + ref float startingDir => ref Projectile.ai[1]; + + float throwSpeed = 12; //changing this does nothing, as this is set in the code. This is just a fallback value if something breaks. + + bool reset = false; + + + float spinSin => MathF.Sin(spin); + public override void SetDefaults() + { + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.Calamity().stealthStrike = true; + Projectile.tileCollide = false; + } + + public override void Load() + { + On_LegacyPlayerRenderer.DrawPlayer += spinThePlayer; + } + + private void spinThePlayer(On_LegacyPlayerRenderer.orig_DrawPlayer orig, LegacyPlayerRenderer self, Terraria.Graphics.Camera camera, Player drawPlayer, Vector2 position, float rotation, Vector2 rotationOrigin, float shadow, float scale) + { + var t = ModContent.ProjectileType(); + if (drawPlayer.ownedProjectileCounts[t] <= 0) + { + orig(self, camera, drawPlayer, position, rotation, rotationOrigin, shadow, scale); + return; + } + + var Spade = Main.projectile.FirstOrDefault(p => p.active && p.owner == drawPlayer.whoAmI && p.type == t)?.ModProjectile(); + + if (Spade is null || Spade.startingDir == 0) + { + orig(self, camera, drawPlayer, position, rotation, rotationOrigin, shadow, scale); + return; + } + + using var lease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); + using (lease.Scope(clearColor: Color.Transparent)) + { + orig(self, camera, drawPlayer, position, rotation, rotationOrigin, shadow, scale); + + bool flip = (Spade.spinSin * Spade.startingDir) < 0; + var tex = TextureAssets.Projectile[Type]; + Main.EntitySpriteDraw(tex.Value, drawPlayer.Center + new Vector2(40, 0) - Main.screenPosition, null, Lighting.GetColor(Spade.Projectile.Center.ToTileCoordinates()), Spade.Projectile.rotation - (flip ? MathHelper.PiOver2 : 0), tex.Size() * 0.5f, new Vector2(Spade.Projectile.scale, Spade.Projectile.scale), flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + float width = Spade.spinSin * Spade.startingDir * drawPlayer.direction; + + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.identity); + Main.spriteBatch.Draw(lease.Target, position - Main.screenPosition, null, Color.White, 0, position - Main.screenPosition, new Vector2(MathF.Abs(width), 1), width < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + Main.spriteBatch.End(); + } + } + + public override void AI() + { + var player = Main.player[Projectile.owner]; + if (startingDir == 0) + { + startingDir = Projectile.velocity.X.DirectionalSign(); + throwSpeed = Projectile.velocity.Length(); + Projectile.velocity = Vector2.Zero; + } + player.direction = 1; + player.SetDummyItemTime((int)(player.HeldItem.useTime * player.GetWeaponAttackSpeed(player.HeldItem))); + Projectile.Center = player.Center + new Vector2(48 * spinSin, 0 * MathF.Cos(spin)) * startingDir; + Projectile.rotation = Projectile.DirectionFrom(player.Center).ToRotation() + MathHelper.PiOver4; + if (spin == 0) + { + spin = MathHelper.TwoPi; + } + spin *= Spadefish.SpinAccel; + + int res = reset ? -1 : 1; + if (res != spinSin.DirectionalSign()) + { + Projectile.ResetLocalNPCHitImmunity(); + reset = !reset; + } + + if (Projectile.timeLeft % 5 == 0 && Main.myPlayer == Projectile.owner && Main.LocalPlayer.HeldItem.ModItem is Spadefish s && s.CanMine) + for (var j = -1; j < 2; j++) + for (var k = -1; k < 2; k++) + SpadefishThrown.Dig(Spadefish.PickPower, Projectile.Center.ToTileCoordinates() + new Point(j, k)); + + if (spin > MathHelper.TwoPi * (1 + Spadefish.SpinsToThrow)) + { + player.direction = (int)startingDir; + if (Main.myPlayer == Projectile.owner) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.Center, player.Calamity().mouseRotationFromPlayer.ToRotationVector2() * throwSpeed * Spadefish.SpinThrowVelocityMult, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, player.whoAmI); + p.Calamity().stealthStrike = true; + } + Projectile.Kill(); + } + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item178 with { pitch = (spin-MathHelper.TwoPi) / (MathHelper.TwoPi * Spadefish.SpinsToThrow) - 0.5f }, Projectile.Center); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= Spadefish.SpinDamageMult; + } + } +} diff --git a/Items/Fishing/Spadefish.png b/Items/Fishing/Spadefish.png new file mode 100644 index 0000000000..601b91c115 Binary files /dev/null and b/Items/Fishing/Spadefish.png differ diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 658d83fb17..4ee77f6e42 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -112,31 +112,6 @@ namespace CalamityMod.Items.Fishing } else CalamityMod.Log.Warn("Could not find either Marine Kelp or Marine Kelp Seeds from Thorium. These items will not be added to Stuffed Fish."); - - // Ozzatron 30DEC2022: It is unlikely SoA will ever be ported to 1.4 and beyond. Commenting this out indefinitely. - /* - Mod soa = CalamityMod.Instance.soa; - if (soa is not null) - { - try - { - itemLoot.Add(soa.Find("Welkinbell").Type, 4, herbMin, herbMax); - itemLoot.Add(soa.Find("WelkinbellSeeds").Type, 10, seedMin, seedMax); - - itemLoot.AddIf(() => Main.hardMode, soa.Find("Illumifern").Type, 4, herbMin, herbMax); - itemLoot.AddIf(() => Main.hardMode, soa.Find("IllumifernSeeds").Type, 10, seedMin, seedMax); - - // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. - // Dan Yami has confirmed that downed calls will be added to SoA eventually. - //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("Enduflora").Type, 4, herbMin, herbMax); - //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("EndufloraSeeds").Type, 10, seedMin, seedMax); - } - catch - { - CalamityMod.Log.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); - } - } - */ } public override void ModifyTooltips(List list) diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index c3b72b6b32..afd6550364 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -41,6 +41,16 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) })); + // 10-20 Coral Blocks @ 100%; Individually 20% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[5] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20) + })); + // 4-10 Prism Shards @ 50% // This is our equivalent to Crystal Shards/Ichor itemLoot.Add(ModContent.ItemType(), 2, 4, 10); diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index 357fc7c928..7f21da1466 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -42,6 +42,16 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) })); + // 10-20 Coral Blocks @ 100%; Individually 20% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[5] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 10, 20) + })); + // 4-10 Prism Shards @ 50% // This is our equivalent to Crystal Shards/Ichor itemLoot.Add(ModContent.ItemType(), 2, 4, 10); diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs new file mode 100644 index 0000000000..8ada361cd9 --- /dev/null +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.SunkenSeaCatches +{ + public class PrismaticGuppy : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + ItemID.Sets.CanBePlacedOnWeaponRacks[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 30; + Item.height = 28; + Item.maxStack = 9999; + Item.value = Item.sellPrice(silver: 5); + Item.rare = ItemRarityID.Green; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Fish; + } + } +} \ No newline at end of file diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.png b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.png new file mode 100644 index 0000000000..9d9615c91c Binary files /dev/null and b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.png differ diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index 1598f50cea..950b3dc502 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -1,8 +1,6 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,35 +9,32 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public class SparklingEmpress : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; + + public override void SetStaticDefaults() + { + Item.staff[Type] = true; //so it doesn't look weird af when holding it + } + public override void SetDefaults() { Item.width = 44; Item.height = 44; - Item.damage = 11; - Item.DamageType = DamageClass.Magic; - Item.mana = 3; - Item.useAnimation = Item.useTime = 8; - Item.knockBack = 0.25f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.channel = true; + Item.damage = 10; Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - + Item.DamageType = DamageClass.Magic; + Item.channel = true; //Channel so that you can hold the weapon [Important] Item.rare = ItemRarityID.Green; + Item.mana = 5; + Item.useTime = 20; + Item.useAnimation = 20; + Item.UseSound = SoundID.Item13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, Item.shoot, damage, knockback, player.whoAmI); - holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); - return false; - } + + //Looks scuffed with the laser when there is offset + //public override Vector2? HoldoutOrigin() => new Vector2(10, 10); } } diff --git a/Items/LoreItems/LoreCalamitas.cs b/Items/LoreItems/LoreCalamitas.cs index bc024f9682..385b4b5b28 100644 --- a/Items/LoreItems/LoreCalamitas.cs +++ b/Items/LoreItems/LoreCalamitas.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreCynosure.cs b/Items/LoreItems/LoreCynosure.cs index e0f22a398e..d44011f98c 100644 --- a/Items/LoreItems/LoreCynosure.cs +++ b/Items/LoreItems/LoreCynosure.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreExoMechs.cs b/Items/LoreItems/LoreExoMechs.cs index e198a77bac..9ab17e671e 100644 --- a/Items/LoreItems/LoreExoMechs.cs +++ b/Items/LoreItems/LoreExoMechs.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } diff --git a/Items/LoreItems/LoreSlimeGod.png b/Items/LoreItems/LoreSlimeGod.png index b092509112..a8536f1d61 100644 Binary files a/Items/LoreItems/LoreSlimeGod.png and b/Items/LoreItems/LoreSlimeGod.png differ diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index cb0828ae7b..9b77cf0757 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(3). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Materials/AstralBar.cs b/Items/Materials/AstralBar.cs index c216053063..9144f56b26 100644 --- a/Items/Materials/AstralBar.cs +++ b/Items/Materials/AstralBar.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). AddIngredient(2). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index 2f1ab7ea6b..271968d400 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -5,6 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { + [LegacyName("BloodstoneCore")] public class Bloodstone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs deleted file mode 100644 index 2e5607f957..0000000000 --- a/Items/Materials/BloodstoneCore.cs +++ /dev/null @@ -1,36 +0,0 @@ -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class BloodstoneCore : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 113; - } - - public override void SetDefaults() - { - Item.width = 15; - Item.height = 12; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(gold: 2); - Item.rare = ModContent.RarityType(); - } - - public override void AddRecipes() - { - CreateRecipe(2). - AddIngredient(5). - AddIngredient(). - AddIngredient(). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Materials/BloodstoneCore.png b/Items/Materials/BloodstoneCore.png deleted file mode 100644 index 4784da5dc1..0000000000 Binary files a/Items/Materials/BloodstoneCore.png and /dev/null differ diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index b2b4a1572f..d889896cb2 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Materials AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.Ectoplasm, 3). + AddIngredient(ItemID.Ectoplasm). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index 8cee81dcdf..ff70b1ad9f 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -25,9 +25,10 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(1). - //AddIngredient(2). - AddIngredient(3). + AddIngredient(2). + AddIngredient(ItemID.Coral, 2). + AddIngredient(ItemID.Starfish, 2). + AddIngredient(ItemID.Seashell, 2). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 101ac3199a..2bc0d699c1 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddIngredient(ItemID.Hellstone, 4). + AddIngredient(3). + AddIngredient(ItemID.Hellstone, 2). AddTile(TileID.Hellforge). Register(); } diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index 0368904f0e..441aa69276 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Mounts public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(10). AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Pets/GeyserShell.cs b/Items/Pets/GeyserShell.cs index 10d9d9b507..e5ecc5a9d3 100644 --- a/Items/Pets/GeyserShell.cs +++ b/Items/Pets/GeyserShell.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 2); - Item.rare = ItemRarityID.Pink; + Item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Pets/IronBall.cs b/Items/Pets/IronBall.cs new file mode 100644 index 0000000000..d30b185c3d --- /dev/null +++ b/Items/Pets/IronBall.cs @@ -0,0 +1,30 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class IronBall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Pets"; + public override void SetDefaults() + { + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.UseSound = SoundID.NPCHit4; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(Item.buffType, 15, true); + } + } + } +} diff --git a/Items/Pets/IronBall.png b/Items/Pets/IronBall.png new file mode 100644 index 0000000000..5987ebb2e1 Binary files /dev/null and b/Items/Pets/IronBall.png differ diff --git a/Items/Placeables/Banners/BabyGhostBellBanner.png b/Items/Placeables/Banners/BabyGhostBellBanner.png index 28922c83c1..6c1997b3b2 100644 Binary files a/Items/Placeables/Banners/BabyGhostBellBanner.png and b/Items/Placeables/Banners/BabyGhostBellBanner.png differ diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs new file mode 100644 index 0000000000..a8cd03e747 --- /dev/null +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlindedAnglerBanner : BaseBanner + { + public override int BannerTileStyle => 104; + } +} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.png b/Items/Placeables/Banners/BlindedAnglerBanner.png new file mode 100644 index 0000000000..6f56ac9128 Binary files /dev/null and b/Items/Placeables/Banners/BlindedAnglerBanner.png differ diff --git a/Items/Placeables/Banners/BurrowerBanner.png b/Items/Placeables/Banners/BurrowerBanner.png index b7b032ef0f..fcf058699f 100644 Binary files a/Items/Placeables/Banners/BurrowerBanner.png and b/Items/Placeables/Banners/BurrowerBanner.png differ diff --git a/Items/Placeables/Banners/CarrionSwallowerBanner.cs b/Items/Placeables/Banners/CarrionSwallowerBanner.cs deleted file mode 100644 index 90902798cf..0000000000 --- a/Items/Placeables/Banners/CarrionSwallowerBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class CarrionSwallowerBanner : BaseBanner - { - public override int BannerTileStyle => 131; - } -} diff --git a/Items/Placeables/Banners/CarrionSwallowerBanner.png b/Items/Placeables/Banners/CarrionSwallowerBanner.png deleted file mode 100644 index 06ec2f37d3..0000000000 Binary files a/Items/Placeables/Banners/CarrionSwallowerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/ClamBanner.png b/Items/Placeables/Banners/ClamBanner.png index 1aab94c02e..74b65932d9 100644 Binary files a/Items/Placeables/Banners/ClamBanner.png and b/Items/Placeables/Banners/ClamBanner.png differ diff --git a/Items/Placeables/Banners/EutrophicRayBanner.png b/Items/Placeables/Banners/EutrophicRayBanner.png index 9ea5ff141d..64815b0761 100644 Binary files a/Items/Placeables/Banners/EutrophicRayBanner.png and b/Items/Placeables/Banners/EutrophicRayBanner.png differ diff --git a/Items/Placeables/Banners/GhostBellBanner.png b/Items/Placeables/Banners/GhostBellBanner.png index a9b012f504..74dcd77ed3 100644 Binary files a/Items/Placeables/Banners/GhostBellBanner.png and b/Items/Placeables/Banners/GhostBellBanner.png differ diff --git a/Items/Placeables/Banners/GildedAxolotlBanner.cs b/Items/Placeables/Banners/GildedAxolotlBanner.cs deleted file mode 100644 index 1c91822889..0000000000 --- a/Items/Placeables/Banners/GildedAxolotlBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class GildedAxolotlBanner : BaseBanner - { - public override int BannerTileStyle => 132; - } -} diff --git a/Items/Placeables/Banners/GildedAxolotlBanner.png b/Items/Placeables/Banners/GildedAxolotlBanner.png deleted file mode 100644 index 9fe9cd10c0..0000000000 Binary files a/Items/Placeables/Banners/GildedAxolotlBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/GrubboltBanner.png b/Items/Placeables/Banners/GrubboltBanner.png deleted file mode 100644 index 6c9733e5e4..0000000000 Binary files a/Items/Placeables/Banners/GrubboltBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/HauntedChumBanner.cs b/Items/Placeables/Banners/HauntedChumBanner.cs deleted file mode 100644 index 5613395082..0000000000 --- a/Items/Placeables/Banners/HauntedChumBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class HauntedChumBanner : BaseBanner - { - public override int BannerTileStyle => 134; - } -} diff --git a/Items/Placeables/Banners/HauntedChumBanner.png b/Items/Placeables/Banners/HauntedChumBanner.png deleted file mode 100644 index 711d5fa40f..0000000000 Binary files a/Items/Placeables/Banners/HauntedChumBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/HorribleHogBanner.cs b/Items/Placeables/Banners/HorribleHogBanner.cs new file mode 100644 index 0000000000..63f01a7e35 --- /dev/null +++ b/Items/Placeables/Banners/HorribleHogBanner.cs @@ -0,0 +1,8 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class HorribleHogBanner : BaseBanner + { + public override int BannerTileStyle => 152; + public override int BannerKillRequirement => 25; + } +} diff --git a/Items/Placeables/Banners/HorribleHogBanner.png b/Items/Placeables/Banners/HorribleHogBanner.png new file mode 100644 index 0000000000..a0d8790fc3 Binary files /dev/null and b/Items/Placeables/Banners/HorribleHogBanner.png differ diff --git a/Items/Placeables/Banners/JellyghoulBanner.cs b/Items/Placeables/Banners/JellyghoulBanner.cs deleted file mode 100644 index 760cf5c86b..0000000000 --- a/Items/Placeables/Banners/JellyghoulBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class JellyghoulBanner : BaseBanner - { - public override int BannerTileStyle => 135; - } -} diff --git a/Items/Placeables/Banners/JellyghoulBanner.png b/Items/Placeables/Banners/JellyghoulBanner.png deleted file mode 100644 index 01ded98a8a..0000000000 Binary files a/Items/Placeables/Banners/JellyghoulBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/KelpieSeadragonBanner.cs b/Items/Placeables/Banners/KelpieSeadragonBanner.cs deleted file mode 100644 index a3048b0a20..0000000000 --- a/Items/Placeables/Banners/KelpieSeadragonBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class KelpieSeadragonBanner : BaseBanner - { - public override int BannerTileStyle => 136; - } -} diff --git a/Items/Placeables/Banners/KelpieSeadragonBanner.png b/Items/Placeables/Banners/KelpieSeadragonBanner.png deleted file mode 100644 index 6a08e30355..0000000000 Binary files a/Items/Placeables/Banners/KelpieSeadragonBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/LazarusLampfishBanner.cs b/Items/Placeables/Banners/LazarusLampfishBanner.cs deleted file mode 100644 index 64ea4ba955..0000000000 --- a/Items/Placeables/Banners/LazarusLampfishBanner.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - [LegacyName("BlindedAnglerBanner")] - public class LazarusLampfishBanner : BaseBanner - { - public override int BannerTileStyle => 104; - } -} diff --git a/Items/Placeables/Banners/LazarusLampfishBanner.png b/Items/Placeables/Banners/LazarusLampfishBanner.png deleted file mode 100644 index e6d468d0e6..0000000000 Binary files a/Items/Placeables/Banners/LazarusLampfishBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/LeerslugBanner.cs b/Items/Placeables/Banners/LeerslugBanner.cs deleted file mode 100644 index 16370c2bec..0000000000 --- a/Items/Placeables/Banners/LeerslugBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class LeerslugBanner : BaseBanner - { - public override int BannerTileStyle => 137; - } -} diff --git a/Items/Placeables/Banners/LeerslugBanner.png b/Items/Placeables/Banners/LeerslugBanner.png deleted file mode 100644 index a4eaf2a916..0000000000 Binary files a/Items/Placeables/Banners/LeerslugBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/LostShoalBanner.cs b/Items/Placeables/Banners/LostShoalBanner.cs deleted file mode 100644 index b63af3b21d..0000000000 --- a/Items/Placeables/Banners/LostShoalBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class LostShoalBanner : BaseBanner - { - public override int BannerTileStyle => 138; - } -} diff --git a/Items/Placeables/Banners/LostShoalBanner.png b/Items/Placeables/Banners/LostShoalBanner.png deleted file mode 100644 index 7c9a0febca..0000000000 Binary files a/Items/Placeables/Banners/LostShoalBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/MirageNewtBanner.png b/Items/Placeables/Banners/MirageNewtBanner.png deleted file mode 100644 index 1424910e5c..0000000000 Binary files a/Items/Placeables/Banners/MirageNewtBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/PanaseaBanner.png b/Items/Placeables/Banners/PanaseaBanner.png deleted file mode 100644 index 8c85af80ca..0000000000 Binary files a/Items/Placeables/Banners/PanaseaBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/PearlpodBanner.cs b/Items/Placeables/Banners/PearlpodBanner.cs deleted file mode 100644 index bf3ba1b781..0000000000 --- a/Items/Placeables/Banners/PearlpodBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PearlpodBanner : BaseBanner - { - public override int BannerTileStyle => 141; - } -} diff --git a/Items/Placeables/Banners/PearlpodBanner.png b/Items/Placeables/Banners/PearlpodBanner.png deleted file mode 100644 index e341098eb2..0000000000 Binary files a/Items/Placeables/Banners/PearlpodBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/PiggyBanner.png b/Items/Placeables/Banners/PiggyBanner.png index e6cd993b29..8d755b0036 100644 Binary files a/Items/Placeables/Banners/PiggyBanner.png and b/Items/Placeables/Banners/PiggyBanner.png differ diff --git a/Items/Placeables/Banners/PodobooKoiBanner.cs b/Items/Placeables/Banners/PodobooKoiBanner.cs deleted file mode 100644 index 14ac5680a0..0000000000 --- a/Items/Placeables/Banners/PodobooKoiBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PodobooKoiBanner : BaseBanner - { - public override int BannerTileStyle => 143; - } -} diff --git a/Items/Placeables/Banners/PodobooKoiBanner.png b/Items/Placeables/Banners/PodobooKoiBanner.png deleted file mode 100644 index c2b67aa9cc..0000000000 Binary files a/Items/Placeables/Banners/PodobooKoiBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/PolyperilBanner.cs b/Items/Placeables/Banners/PolyperilBanner.cs deleted file mode 100644 index 6bc04212fd..0000000000 --- a/Items/Placeables/Banners/PolyperilBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PolyperilBanner : BaseBanner - { - public override int BannerTileStyle => 144; - } -} diff --git a/Items/Placeables/Banners/PolyperilBanner.png b/Items/Placeables/Banners/PolyperilBanner.png deleted file mode 100644 index bd04faf38e..0000000000 Binary files a/Items/Placeables/Banners/PolyperilBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/PrismBackBanner.png b/Items/Placeables/Banners/PrismBackBanner.png index cc05ba7917..1f467b4d74 100644 Binary files a/Items/Placeables/Banners/PrismBackBanner.png and b/Items/Placeables/Banners/PrismBackBanner.png differ diff --git a/Items/Placeables/Banners/PrismaticGuppyBanner.cs b/Items/Placeables/Banners/PrismaticGuppyBanner.cs deleted file mode 100644 index 583fa7aa71..0000000000 --- a/Items/Placeables/Banners/PrismaticGuppyBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PrismaticGuppyBanner : BaseBanner - { - public override int BannerTileStyle => 145; - } -} diff --git a/Items/Placeables/Banners/PrismaticGuppyBanner.png b/Items/Placeables/Banners/PrismaticGuppyBanner.png deleted file mode 100644 index 7c2acc6c4b..0000000000 Binary files a/Items/Placeables/Banners/PrismaticGuppyBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/ProbesnoutBanner.cs b/Items/Placeables/Banners/ProbesnoutBanner.cs deleted file mode 100644 index 7ba93318b5..0000000000 --- a/Items/Placeables/Banners/ProbesnoutBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class ProbesnoutBanner : BaseBanner - { - public override int BannerTileStyle => 130; - } -} diff --git a/Items/Placeables/Banners/ProbesnoutBanner.png b/Items/Placeables/Banners/ProbesnoutBanner.png deleted file mode 100644 index 331b966302..0000000000 Binary files a/Items/Placeables/Banners/ProbesnoutBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SandProwlerBanner.cs b/Items/Placeables/Banners/SandProwlerBanner.cs deleted file mode 100644 index 9fef623265..0000000000 --- a/Items/Placeables/Banners/SandProwlerBanner.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - [LegacyName("SeaSerpentBanner")] - public class SandProwlerBanner : BaseBanner - { - public override int BannerTileStyle => 106; - } -} diff --git a/Items/Placeables/Banners/SandProwlerBanner.png b/Items/Placeables/Banners/SandProwlerBanner.png deleted file mode 100644 index c440619fe1..0000000000 Binary files a/Items/Placeables/Banners/SandProwlerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/ScavengerBanner.cs b/Items/Placeables/Banners/ScavengerBanner.cs deleted file mode 100644 index 3c38808a7d..0000000000 --- a/Items/Placeables/Banners/ScavengerBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class ScavengerBanner : BaseBanner - { - public override int BannerTileStyle => 146; - } -} diff --git a/Items/Placeables/Banners/ScavengerBanner.png b/Items/Placeables/Banners/ScavengerBanner.png deleted file mode 100644 index 4d894c8707..0000000000 Binary files a/Items/Placeables/Banners/ScavengerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SeaFloatyBanner.png b/Items/Placeables/Banners/SeaFloatyBanner.png index 3f38042d8a..1578c3e4dc 100644 Binary files a/Items/Placeables/Banners/SeaFloatyBanner.png and b/Items/Placeables/Banners/SeaFloatyBanner.png differ diff --git a/Items/Placeables/Banners/SeaMinnowBanner.png b/Items/Placeables/Banners/SeaMinnowBanner.png index 2419202e4b..aa6eebf84f 100644 Binary files a/Items/Placeables/Banners/SeaMinnowBanner.png and b/Items/Placeables/Banners/SeaMinnowBanner.png differ diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs new file mode 100644 index 0000000000..ef12cc3ebc --- /dev/null +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaSerpentBanner : BaseBanner + { + public override int BannerTileStyle => 106; + } +} diff --git a/Items/Placeables/Banners/SeaSerpentBanner.png b/Items/Placeables/Banners/SeaSerpentBanner.png new file mode 100644 index 0000000000..e384093d74 Binary files /dev/null and b/Items/Placeables/Banners/SeaSerpentBanner.png differ diff --git a/Items/Placeables/Banners/SearslugBanner.cs b/Items/Placeables/Banners/SearslugBanner.cs deleted file mode 100644 index 0d16292aac..0000000000 --- a/Items/Placeables/Banners/SearslugBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SearslugBanner : BaseBanner - { - public override int BannerTileStyle => 147; - } -} diff --git a/Items/Placeables/Banners/SearslugBanner.png b/Items/Placeables/Banners/SearslugBanner.png deleted file mode 100644 index 1851a2640f..0000000000 Binary files a/Items/Placeables/Banners/SearslugBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SharkoonBanner.cs b/Items/Placeables/Banners/SharkoonBanner.cs deleted file mode 100644 index a8bfa5301c..0000000000 --- a/Items/Placeables/Banners/SharkoonBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SharkoonBanner : BaseBanner - { - public override int BannerTileStyle => 129; - } -} diff --git a/Items/Placeables/Banners/SharkoonBanner.png b/Items/Placeables/Banners/SharkoonBanner.png deleted file mode 100644 index e42d222bd7..0000000000 Binary files a/Items/Placeables/Banners/SharkoonBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/ShoreskipperBanner.cs b/Items/Placeables/Banners/ShoreskipperBanner.cs deleted file mode 100644 index 441b371120..0000000000 --- a/Items/Placeables/Banners/ShoreskipperBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class ShoreskipperBanner : BaseBanner - { - public override int BannerTileStyle => 148; - } -} diff --git a/Items/Placeables/Banners/ShoreskipperBanner.png b/Items/Placeables/Banners/ShoreskipperBanner.png deleted file mode 100644 index c08cb19213..0000000000 Binary files a/Items/Placeables/Banners/ShoreskipperBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SlugbunBanner.cs b/Items/Placeables/Banners/SlugbunBanner.cs deleted file mode 100644 index ebdb7624cd..0000000000 --- a/Items/Placeables/Banners/SlugbunBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SlugbunBanner : BaseBanner - { - public override int BannerTileStyle => 149; - } -} diff --git a/Items/Placeables/Banners/SlugbunBanner.png b/Items/Placeables/Banners/SlugbunBanner.png deleted file mode 100644 index c7f6060a39..0000000000 Binary files a/Items/Placeables/Banners/SlugbunBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SteampodBanner.cs b/Items/Placeables/Banners/SteampodBanner.cs deleted file mode 100644 index f62212ebc6..0000000000 --- a/Items/Placeables/Banners/SteampodBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SteampodBanner : BaseBanner - { - public override int BannerTileStyle => 150; - } -} diff --git a/Items/Placeables/Banners/SteampodBanner.png b/Items/Placeables/Banners/SteampodBanner.png deleted file mode 100644 index a503c69f5b..0000000000 Binary files a/Items/Placeables/Banners/SteampodBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/StormlionBanner.png b/Items/Placeables/Banners/StormlionBanner.png index e15ff2bc86..23afbabbfa 100644 Binary files a/Items/Placeables/Banners/StormlionBanner.png and b/Items/Placeables/Banners/StormlionBanner.png differ diff --git a/Items/Placeables/Banners/StormlionScoutBanner.png b/Items/Placeables/Banners/StormlionScoutBanner.png deleted file mode 100644 index 8eda3688b6..0000000000 Binary files a/Items/Placeables/Banners/StormlionScoutBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/StormlionSentryBanner.cs b/Items/Placeables/Banners/StormlionSentryBanner.cs deleted file mode 100644 index 62ba388dca..0000000000 --- a/Items/Placeables/Banners/StormlionSentryBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class StormlionSentryBanner : BaseBanner - { - public override int BannerTileStyle => 142; - } -} diff --git a/Items/Placeables/Banners/StormlionSentryBanner.png b/Items/Placeables/Banners/StormlionSentryBanner.png deleted file mode 100644 index 67bab5c7e6..0000000000 Binary files a/Items/Placeables/Banners/StormlionSentryBanner.png and /dev/null differ diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index 0d65f56b47..860514818c 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { CreateRecipe(). + AddIngredient(30). AddIngredient(5). AddIngredient(20). - AddIngredient(30). AddTile(TileID.HeavyWorkBench). Register(); } diff --git a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png index caf942e9cb..fa4f78154d 100644 Binary files a/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png and b/Items/Placeables/Furniture/BossRelics/SlimeGodRelic.png differ diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index a8a1a05932..199bf8e797 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.CustomRecipes; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -17,10 +18,19 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 2); + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundCorruptionEffigy) + { + RecipeUnlockHandler.HasFoundCorruptionEffigy = true; + CalamityNetcode.SyncWorld(); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Placeables/Furniture/CorruptionEffigy.png b/Items/Placeables/Furniture/CorruptionEffigy.png index d7ba8c6e67..8156c8441a 100644 Binary files a/Items/Placeables/Furniture/CorruptionEffigy.png and b/Items/Placeables/Furniture/CorruptionEffigy.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 5da9b8e3af..75f187544e 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -29,11 +29,6 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddRecipeGroup("HardmodeAnvil"). AddIngredient(10). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(ItemID.FragmentSolar, 12). - AddIngredient(ItemID.FragmentVortex, 12). - AddIngredient(ItemID.FragmentNebula, 12). - AddIngredient(ItemID.FragmentStardust, 12). - AddIngredient(12). AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index 1662948a74..22e6d488ed 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.CustomRecipes; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -9,18 +10,27 @@ namespace CalamityMod.Items.Placeables.Furniture { public new string LocalizationCategory => "Items.Placeables"; - public static float DamageBoost = 0.15f; - public static int DefenseBoost = 6; + public static float DamageBoost = 0.1f; + public static int DefenseBoost = 5; public static float MaxHealthLossPercent = 0.1f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), DefenseBoost, MaxHealthLossPercent.ToPercent()); public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 2); + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundCrimsonEffigy) + { + RecipeUnlockHandler.HasFoundCrimsonEffigy = true; + CalamityNetcode.SyncWorld(); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Placeables/Furniture/CrimsonEffigy.png b/Items/Placeables/Furniture/CrimsonEffigy.png index 28df6f8fa0..1fe7117bd2 100644 Binary files a/Items/Placeables/Furniture/CrimsonEffigy.png and b/Items/Placeables/Furniture/CrimsonEffigy.png differ diff --git a/Items/Placeables/Furniture/ForgottenNobleStatue.cs b/Items/Placeables/Furniture/ForgottenNobleStatue.cs deleted file mode 100644 index 7146286838..0000000000 --- a/Items/Placeables/Furniture/ForgottenNobleStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class ForgottenNobleStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 60; - Item.height = 108; - } - } -} diff --git a/Items/Placeables/Furniture/ForgottenNobleStatue.png b/Items/Placeables/Furniture/ForgottenNobleStatue.png deleted file mode 100644 index f4f6ac7aa1..0000000000 Binary files a/Items/Placeables/Furniture/ForgottenNobleStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.cs b/Items/Placeables/Furniture/ForgottenScholarStatue.cs deleted file mode 100644 index d3acfb2e55..0000000000 --- a/Items/Placeables/Furniture/ForgottenScholarStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class ForgottenScholarStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 56; - Item.height = 96; - } - } -} diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.png b/Items/Placeables/Furniture/ForgottenScholarStatue.png deleted file mode 100644 index 7e27c89408..0000000000 Binary files a/Items/Placeables/Furniture/ForgottenScholarStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/GluttonyBlender.cs b/Items/Placeables/Furniture/GluttonyBlender.cs index f4355809c8..7c1fe747fb 100644 --- a/Items/Placeables/Furniture/GluttonyBlender.cs +++ b/Items/Placeables/Furniture/GluttonyBlender.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Items.Fishing; +using CalamityMod.Tiles.Furniture; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(gold: 5); + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman } } @@ -34,7 +35,6 @@ namespace CalamityMod.Items.Placeables.Furniture new Color(175, 87, 190) ]; ItemID.Sets.IsFood[Type] = true; - ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; } public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { - ItemID.Sets.ExtractinatorMode[Type] = ItemID.OldShoe; + ItemID.Sets.ExtractinatorMode[Type] = Type; } public override void SetDefaults() { @@ -62,5 +62,27 @@ namespace CalamityMod.Items.Placeables.Furniture Item.rare = ItemRarityID.Gray; Item.MakeUsableWithChlorophyteExtractinator(); } + + public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) + { + float dropRand = Main.rand.NextFloat(); + resultStack = 1; + + // 50% chance for Poo + // 25% chance for Clay Block + // 15% chance for Apprentice Bait + // 7.5% chance for Grasshopper + // 2.5% chance for Rage Bait + if (dropRand < 0.025f) + resultType = ModContent.ItemType(); + else if (dropRand < 0.1f) + resultType = ItemID.Grasshopper; + else if (dropRand < 0.25f) + resultType = ItemID.ApprenticeBait; + else if (dropRand < 0.5f) + resultType = ItemID.ClayBlock; + else + resultType = ItemID.PoopBlock; + } } } diff --git a/Items/Placeables/Furniture/OtonilouStatue.cs b/Items/Placeables/Furniture/OtonilouStatue.cs deleted file mode 100644 index b9945b3676..0000000000 --- a/Items/Placeables/Furniture/OtonilouStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class OtonilouStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 214; - Item.height = 414; - } - } -} diff --git a/Items/Placeables/Furniture/OtonilouStatue.png b/Items/Placeables/Furniture/OtonilouStatue.png deleted file mode 100644 index 0142502af3..0000000000 Binary files a/Items/Placeables/Furniture/OtonilouStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs b/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs deleted file mode 100644 index e0225466c7..0000000000 --- a/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CalamityMod.Tiles.Furniture.Paintings; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture.Paintings -{ - public class AmidiasPainting : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 52; - Item.height = 34; - Item.value = Item.buyPrice(gold: 1); - } - } -} diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.png b/Items/Placeables/Furniture/Paintings/AmidiasPainting.png deleted file mode 100644 index 2d555e093f..0000000000 Binary files a/Items/Placeables/Furniture/Paintings/AmidiasPainting.png and /dev/null differ diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index c6cf5f5a1c..ee81185b28 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -62,11 +62,13 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Altixal", "apotofkoolaid", "ArchonSystem", + "Astrum Deus", "Atalya", "Ben-TK", "Big E", "carnymassacre", "CDMusic", + "Cei", "CongratsIsTrash", "Cooper", "CosmaticMango", @@ -79,6 +81,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Fluffy", "fryzahh", "Gpscorpion", + "Hugekraken", "jasper", "LordMetarex", "Moonburn", @@ -89,7 +92,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "sixtydegrees", "StipulateVenus", "Sunny", - "_tofu", "Tomat", "Triangle", "TYESKI", @@ -113,9 +115,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Blockaroz", "Boffin", "Bravioli", - "Cei", "Chetto", "Chill Dude", + "ClockworkShade", "Cobalion", "Daim", "DarkTiny", @@ -143,7 +145,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Grox the Great", "Heart Plus Up!", "Hectique", - "Hugekraken", "Huggles", "Ian-1KV", "IbanPlay", @@ -189,7 +190,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Runefield", "Sargassum", "sentri", - "Shade", "SharZz", "Shucks", "Silver-Lord of Ash", diff --git a/Items/Placeables/Furniture/PiggyCage.png b/Items/Placeables/Furniture/PiggyCage.png index 80435d34b5..037b144a3d 100644 Binary files a/Items/Placeables/Furniture/PiggyCage.png and b/Items/Placeables/Furniture/PiggyCage.png differ diff --git a/Items/Placeables/Furniture/PiggyCageGold.cs b/Items/Placeables/Furniture/PiggyCageGold.cs new file mode 100644 index 0000000000..902d8020a5 --- /dev/null +++ b/Items/Placeables/Furniture/PiggyCageGold.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class PiggyCageGold : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 10); + Item.rare = ItemRarityID.Orange; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Terrarium). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/PiggyCageGold.png b/Items/Placeables/Furniture/PiggyCageGold.png new file mode 100644 index 0000000000..1c76eec452 Binary files /dev/null and b/Items/Placeables/Furniture/PiggyCageGold.png differ diff --git a/Items/Placeables/Furniture/SunkenIdol.cs b/Items/Placeables/Furniture/SunkenIdol.cs deleted file mode 100644 index 9b04d0b7a8..0000000000 --- a/Items/Placeables/Furniture/SunkenIdol.cs +++ /dev/null @@ -1,15 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class SunkenIdol : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.Calamity().donorItem = true; - } - } -} diff --git a/Items/Placeables/Furniture/SunkenIdol.png b/Items/Placeables/Furniture/SunkenIdol.png deleted file mode 100644 index 319fc574b4..0000000000 Binary files a/Items/Placeables/Furniture/SunkenIdol.png and /dev/null differ diff --git a/Items/Placeables/Furniture/TheMonument.cs b/Items/Placeables/Furniture/TheMonument.cs index 4f57836dea..e852c856fa 100644 --- a/Items/Placeables/Furniture/TheMonument.cs +++ b/Items/Placeables/Furniture/TheMonument.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.Furniture Item.width = 40; Item.height = 50; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(gold: 5); + Item.value = Item.buyPrice(platinum: 1); // Sold by Shady Salesman } public override void Load() diff --git a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs index e763e16d37..b1b10e69d4 100644 --- a/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs +++ b/Items/Placeables/FurnitureWulfrum/AnodizedWulfrumTrim.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -21,6 +22,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs index a77f27331c..6c032ef1db 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddTile(TileID.WorkBenches). DisableDecraft(). Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/GreedPot.cs b/Items/Placeables/GreedPot.cs index 582e5f67ed..7fe33db41c 100644 --- a/Items/Placeables/GreedPot.cs +++ b/Items/Placeables/GreedPot.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(gold: 5); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman } } } diff --git a/Items/Placeables/Pylons/CragsPylon.cs b/Items/Placeables/Pylons/CragsPylon.cs index 43631e2f86..ffa871b73e 100644 --- a/Items/Placeables/Pylons/CragsPylon.cs +++ b/Items/Placeables/Pylons/CragsPylon.cs @@ -16,15 +16,5 @@ namespace CalamityMod.Items.Placeables.Pylons Item.value = Item.sellPrice(gold: 2); Item.rare = ItemRarityID.Blue; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddIngredient(10). - AddIngredient(ItemID.Hellstone, 15). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Placeables/SunkenSea/AridSoil.cs b/Items/Placeables/SunkenSea/AridSoil.cs index 4bfe8b3bfb..62d6e28469 100644 --- a/Items/Placeables/SunkenSea/AridSoil.cs +++ b/Items/Placeables/SunkenSea/AridSoil.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/Basalt.cs b/Items/Placeables/SunkenSea/Basalt.cs index a933d258ec..5775f14a4e 100644 --- a/Items/Placeables/SunkenSea/Basalt.cs +++ b/Items/Placeables/SunkenSea/Basalt.cs @@ -1,4 +1,5 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea { @@ -8,6 +9,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/Dunesand.cs b/Items/Placeables/SunkenSea/Dunesand.cs index 495107affc..e5ee013308 100644 --- a/Items/Placeables/SunkenSea/Dunesand.cs +++ b/Items/Placeables/SunkenSea/Dunesand.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); //+5 flat damage ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); diff --git a/Items/Placeables/SunkenSea/EutrophicSand.cs b/Items/Placeables/SunkenSea/EutrophicSand.cs index c334d3a5d2..7779d430ae 100644 --- a/Items/Placeables/SunkenSea/EutrophicSand.cs +++ b/Items/Placeables/SunkenSea/EutrophicSand.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Projectiles.Typeless; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); // -5 flat damage ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(),-5); @@ -22,5 +23,13 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ammo = AmmoID.Sand; Item.notAmmo = true; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } } } diff --git a/Items/Placeables/SunkenSea/Limestone.cs b/Items/Placeables/SunkenSea/Limestone.cs index faa2a7a1d5..0aafaf52c3 100644 --- a/Items/Placeables/SunkenSea/Limestone.cs +++ b/Items/Placeables/SunkenSea/Limestone.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/MossyStone.cs b/Items/Placeables/SunkenSea/MossyStone.cs index b8305438f7..c5f516c955 100644 --- a/Items/Placeables/SunkenSea/MossyStone.cs +++ b/Items/Placeables/SunkenSea/MossyStone.cs @@ -1,4 +1,5 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea { @@ -8,6 +9,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/Navystone.cs b/Items/Placeables/SunkenSea/Navystone.cs index ce7abca02a..2439b3f96b 100644 --- a/Items/Placeables/SunkenSea/Navystone.cs +++ b/Items/Placeables/SunkenSea/Navystone.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/PolypSand.cs b/Items/Placeables/SunkenSea/PolypSand.cs index cc20b3828f..b2b3a72c02 100644 --- a/Items/Placeables/SunkenSea/PolypSand.cs +++ b/Items/Placeables/SunkenSea/PolypSand.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } diff --git a/Items/Placeables/SunkenSea/Runestone.cs b/Items/Placeables/SunkenSea/Runestone.cs index 85774e2da0..41ef34a853 100644 --- a/Items/Placeables/SunkenSea/Runestone.cs +++ b/Items/Placeables/SunkenSea/Runestone.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 200; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/Shellstone.cs b/Items/Placeables/SunkenSea/Shellstone.cs index ad69d66322..3d9bb1f056 100644 --- a/Items/Placeables/SunkenSea/Shellstone.cs +++ b/Items/Placeables/SunkenSea/Shellstone.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/SunkenSea/VolcanicSand.cs b/Items/Placeables/SunkenSea/VolcanicSand.cs index c7003f7cb6..3e24a24b55 100644 --- a/Items/Placeables/SunkenSea/VolcanicSand.cs +++ b/Items/Placeables/SunkenSea/VolcanicSand.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } diff --git a/Items/Placeables/VernalSoil.cs b/Items/Placeables/VernalSoil.cs index c97b7bf940..1affd5ae89 100644 --- a/Items/Placeables/VernalSoil.cs +++ b/Items/Placeables/VernalSoil.cs @@ -1,4 +1,5 @@ -using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -11,5 +12,14 @@ namespace CalamityMod.Items.Placeables } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ItemID.MudBlock, 25). + AddIngredient(ItemID.JungleSpores). + AddTile(TileID.Anvils). + Register(); + } } } diff --git a/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs index aef59907c9..d60c4b01fd 100644 --- a/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs +++ b/Items/Placeables/Walls/AnodizedWulfrumTrimWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { - CreateRecipe(8). - AddIngredient(). + CreateRecipe(4). + AddIngredient(). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs new file mode 100644 index 0000000000..f6249281ec --- /dev/null +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -0,0 +1,31 @@ +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class EutrophicSandWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/Walls/EutrophicSandWall.png b/Items/Placeables/Walls/EutrophicSandWall.png new file mode 100644 index 0000000000..04e425d8b5 Binary files /dev/null and b/Items/Placeables/Walls/EutrophicSandWall.png differ diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/EutrophicSandWallSafe.cs new file mode 100644 index 0000000000..1f003be5a3 --- /dev/null +++ b/Items/Placeables/Walls/EutrophicSandWallSafe.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class EutrophicSandWallSafe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.png b/Items/Placeables/Walls/EutrophicSandWallSafe.png new file mode 100644 index 0000000000..04e425d8b5 Binary files /dev/null and b/Items/Placeables/Walls/EutrophicSandWallSafe.png differ diff --git a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs index 566caf0e2f..18766b942d 100644 --- a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs +++ b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { - CreateRecipe(8). + CreateRecipe(4). AddIngredient(). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Placeables/Walls/WulfrumComplexPanelWall.cs b/Items/Placeables/Walls/WulfrumComplexPanelWall.cs index 17c7c70994..8e8c35a078 100644 --- a/Items/Placeables/Walls/WulfrumComplexPanelWall.cs +++ b/Items/Placeables/Walls/WulfrumComplexPanelWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureWulfrum; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -17,10 +17,8 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { - CreateRecipe(8). - AddIngredient(). - AddIngredient(). - AddIngredient(). + CreateRecipe(4). + AddIngredient(). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Walls/WulfrumPillar.cs b/Items/Placeables/Walls/WulfrumPillar.cs index 224ebd54e7..4d4022dabb 100644 --- a/Items/Placeables/Walls/WulfrumPillar.cs +++ b/Items/Placeables/Walls/WulfrumPillar.cs @@ -17,8 +17,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { - CreateRecipe(8). - AddIngredient(). + CreateRecipe(4). AddIngredient(). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Potions/Alcohol/BaconOil.cs b/Items/Potions/Alcohol/BaconOil.cs index d3b20577ee..96704a3bc2 100644 --- a/Items/Potions/Alcohol/BaconOil.cs +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); + Item.value = Item.buyPrice(silver: 30); // Sold by Shady Salesman Item.rare = ItemRarityID.Blue; } diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 4cbbc4eaf7..c5f4553b86 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Items.Potions { CreateRecipe(15). AddIngredient(ItemID.SuperManaPotion, 15). - AddIngredient(4). AddIngredient(). + AddIngredient(4). AddTile(TileID.Bottles). Register() .DisableDecraft(); diff --git a/Items/Potions/Food/DeliciousMeat.cs b/Items/Potions/Food/DeliciousMeat.cs index fcc87fc022..c62b40d08a 100644 --- a/Items/Potions/Food/DeliciousMeat.cs +++ b/Items/Potions/Food/DeliciousMeat.cs @@ -1,5 +1,13 @@ -using CalamityMod.Items.Tools; +using System; +using CalamityMod.Effects; +using Terraria.Localization; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +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.DataStructures; using Terraria.ID; @@ -9,23 +17,138 @@ namespace CalamityMod.Items.Potions.Food { public class DeliciousMeat : ModItem, ILocalizedModType { + private static Asset FadedStarRing; + private static Asset BloomFlare; + private static int DeliciousMeatCooldown = CalamityUtils.MinutesToFrames(15); + public new string LocalizationCategory => "Items.Potions"; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DeliciousMeatCooldown / 60).FramesToSeconds()); + + public override void Load() + { + if (!Main.dedServ) + { + BloomFlare = ModContent.Request("CalamityMod/ExtraTextures/BloomFlare"); + FadedStarRing = ModContent.Request("CalamityMod/ExtraTextures/FadedStarRing"); + } + } + public override void SetStaticDefaults() { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - Item.ResearchUnlockCount = 5; + Item.ResearchUnlockCount = 1; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); - ItemID.Sets.FoodParticleColors[Type] = new Color[2] { - new Color(147, 197, 206), - new Color(94, 131, 168), - }; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.FoodParticleColors[Type] = new Color[4] { + new Color(27, 103, 155), + new Color(164, 255, 253), + new Color(250, 219, 127), + new Color(248, 211, 179), + }; } + public override void SetDefaults() { - Item.DefaultToFood(32, 30, BuffID.WellFed2, CalamityUtils.MinutesToFrames(30)); - Item.value = Item.buyPrice(silver: 50); // Sold by Archmage - Item.rare = ItemRarityID.Pink; + Item.width = 30; + Item.height = 40; + Item.useAnimation = Item.useTime = 17; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(silver: 50); + Item.maxStack = 1; + Item.UseSound = SoundID.Item2; + Item.useStyle = ItemUseStyleID.EatFood; + Item.buffType = BuffID.WellFed2; + Item.buffTime = CalamityUtils.MinutesToFrames(15); + Item.useTurn = true; + Item.consumable = false; + } + + public override bool CanUseItem(Player player) => player.GetModPlayer().deliciousMeatCooldown <= 0; + public override bool? UseItem(Player player) + { + player.GetModPlayer().deliciousMeatCooldown = DeliciousMeatCooldown; + return null; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + // Spawn some cute sparkles for added effect when dropped in the world. + if (Main.rand.NextBool(45)) + { + int sparkleAmt = Main.rand.Next(1, 3); + for (int i = 0; i < sparkleAmt; i++) + { + Vector2 spawnPosition = Item.Center + Main.rand.NextVector2Circular(Item.width, Item.height); + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + + QuickSparkleParticle sparkle = new(spawnPosition, Vector2.Zero, sparkleColor, Main.rand.NextFloat(0.2f, 0.3f), Main.rand.Next(30, 45)); + GeneralParticleHandler.QueueParticleForNextFrame(sparkle, true); + } + } + + // Additional glowy effects similar to Divine Swine itself. + Main.GetItemDrawFrame(Item.type, out _, out Rectangle itemFrame); + Vector2 origin = itemFrame.Size() * 0.5f; + Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0f, origin.Y); + float sineWave = MathF.Sin((float)Main.timeForVisualEffects / 180f) * 0.5f + 0.5f; + Color drawColor = Color.White * MathHelper.Lerp(0.7f, 0f, sineWave); + + spriteBatch.End(out var snapshot); + + using var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + using (pixelationLease.Scope(clearColor: Color.Transparent)) + { + Effect chromaAbberShader = CalamityShaders.ChromaticAbberationShader.Value; + chromaAbberShader.Parameters["abberationStrength"].SetValue(10f); + chromaAbberShader.Parameters["impactPosition"].SetValue(drawPosition); + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, chromaAbberShader, PixelationManager.PixelationMatrix); + + float starCircleScale = MathHelper.Lerp(0.3f, 0.15f, sineWave); + float starCircleRotation = (float)(Main.timeForVisualEffects / 720f) + whoAmI; + spriteBatch.Draw(FadedStarRing.Value, drawPosition, null, drawColor with { A = 0 }, starCircleRotation, FadedStarRing.Size() * 0.5f, starCircleScale, 0, 0f); + + float bloomFlareScale = MathHelper.Lerp(0.15f, 0.05f, sineWave); + float bloomFlareRotation = (float)(Main.timeForVisualEffects / 540f) + whoAmI; + spriteBatch.Draw(BloomFlare.Value, drawPosition, null, drawColor with { A = 0 }, -bloomFlareRotation, BloomFlare.Size() * 0.5f, bloomFlareScale, 0, 0f); + + spriteBatch.End(); + } + + spriteBatch.Begin(snapshot); + spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + + return true; + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (Main.LocalPlayer.GetModPlayer().deliciousMeatCooldown <= 0) + return; + + Vector2 barScale = new Vector2(1.25f, 1f); + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + Vector2 drawPos = position + new Vector2((frame.Width - barBG.Width * 0.95f) * scale, (frame.Height - 3f) * scale); + Rectangle frameCrop = new Rectangle(0, 0, (int)((1 - Main.LocalPlayer.GetModPlayer().deliciousMeatCooldown / (float)DeliciousMeatCooldown) * barFG.Width), barFG.Height); + Color colorBG = Color.Black; + Color colorFG = Color.White; + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, origin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG * 0.8f, 0f, origin, scale * barScale, 0f, 0f); + } + } + + public class DeliciousMeatPlayer : ModPlayer + { + public int deliciousMeatCooldown = 0; + + public override void PostUpdateMiscEffects() + { + if (deliciousMeatCooldown > 0) + deliciousMeatCooldown--; } } } diff --git a/Items/Potions/Food/DeliciousMeat.png b/Items/Potions/Food/DeliciousMeat.png index 61f729cdd9..5e64fa4c49 100644 Binary files a/Items/Potions/Food/DeliciousMeat.png and b/Items/Potions/Food/DeliciousMeat.png differ diff --git a/Items/Potions/Food/HadalStew.cs b/Items/Potions/Food/HadalStew.cs index 49567ef489..80b3f38274 100644 --- a/Items/Potions/Food/HadalStew.cs +++ b/Items/Potions/Food/HadalStew.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Potions.Food { public new string LocalizationCategory => "Items.Potions"; public static int BuffType = BuffID.WellFed3; - public static int BuffDuration = CalamityUtils.MinutesToFrames(8); + public static int BuffDuration = CalamityUtils.MinutesToFrames(4); public static int SicknessDuration = CalamityUtils.SecondsToFrames(50); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDuration / 3600); @@ -55,14 +55,14 @@ namespace CalamityMod.Items.Potions.Food { CreateRecipe(). AddIngredient(3). - AddIngredient(). + AddIngredient(2). AddIngredient(ItemID.Bowl). AddTile(TileID.CookingPots). Register(); CreateRecipe(). AddIngredient(3). - AddIngredient(). + AddIngredient(2). AddIngredient(ItemID.Bowl). AddTile(TileID.CookingPots). Register(); diff --git a/Items/Potions/Food/LavaChickenBroth.cs b/Items/Potions/Food/LavaChickenBroth.cs index dd69f6fc01..911cc73642 100644 --- a/Items/Potions/Food/LavaChickenBroth.cs +++ b/Items/Potions/Food/LavaChickenBroth.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Potions.Food { public new string LocalizationCategory => "Items.Potions"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/SoupConsumption"); + public static readonly SoundStyle MisophonicUseSound = new("CalamityMod/Sounds/Item/SoupConsumptionMisophonic"); + public SlotId DrinkSoundSlot; public override void SetStaticDefaults() @@ -27,7 +29,7 @@ namespace CalamityMod.Items.Potions.Food Item.width = 56; Item.height = 50; Item.value = 0; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.maxStack = 1; Item.consumable = false; Item.useAnimation = 901; @@ -38,7 +40,10 @@ namespace CalamityMod.Items.Potions.Food } public override bool? UseItem(Player player) { - DrinkSoundSlot = SoundEngine.PlaySound(UseSound, player.Center); + if (!CalamityClientConfig.Instance.MisophoniaSupport) + DrinkSoundSlot = SoundEngine.PlaySound(UseSound, player.Center); + else + DrinkSoundSlot = SoundEngine.PlaySound(MisophonicUseSound, player.Center); return true; } diff --git a/Items/Potions/Food/TheSandwich.cs b/Items/Potions/Food/TheSandwich.cs index f99710a8c7..6d1128ef0e 100644 --- a/Items/Potions/Food/TheSandwich.cs +++ b/Items/Potions/Food/TheSandwich.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Potions.Food public override void SetDefaults() { Item.DefaultToFood(70, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(10)); - Item.value = Item.sellPrice(silver: 20); + Item.value = Item.buyPrice(silver: 55); // Same price as Pad Thai; Sold by Shady Salesman Item.rare = ItemRarityID.Blue; } public override void UseAnimation(Player player) diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index 0404bafdb8..1934f9a9fb 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Potions { public new string LocalizationCategory => "Items.Potions"; - public static float FlightBoost = 0.1f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightBoost.ToPercent()); + public static float FlightTimeBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoost.ToPercent()); public override void SetStaticDefaults() { diff --git a/Items/Potions/TheConcoction.cs b/Items/Potions/TheConcoction.cs index 0c9ebf0c0c..581eb2bdd3 100644 --- a/Items/Potions/TheConcoction.cs +++ b/Items/Potions/TheConcoction.cs @@ -1,8 +1,11 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Rarities; +using CalamityMod.Scenes.MusicScenes; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,10 +17,8 @@ namespace CalamityMod.Items.Potions { public class TheConcoction : ModItem, ILocalizedModType { - private static int hoverTimer = 0; - private static bool wasHovering = false; public new string LocalizationCategory => "Items.Potions"; - + public static int healValue = 9999; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; @@ -28,41 +29,45 @@ namespace CalamityMod.Items.Potions new Color(246, 34, 79) }; } - public override void SetDefaults() { - Item.DefaultToHealingPotion(50, 56, 500); - Item.value = Item.sellPrice(silver: 60); + Item.UseSound = SoundID.Item3; + Item.useStyle = 9; + Item.useTurn = true; + Item.useAnimation = (Item.useTime = 17); + Item.maxStack = Item.CommonMaxStack; + Item.consumable = true; + Item.width = 50; + Item.height = 56; + Item.potion = true; + + Item.value = Item.buyPrice(gold: 1); // Sold by Shady Salesman Item.rare = ItemRarityID.Green; } - - + public override bool CanUseItem(Player player) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + return concoctionPlayer.swinesWrathCounter == -1; + } public override void OnConsumeItem(Player player) { - TheConcoctionPlayer cocPlayer = player.GetModPlayer(); - cocPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600) + player.HealPlayer(TheConcoction.healValue); + SoundEngine.PlaySound(SoundID.Item3, player.Center); + TheConcoctionPlayer concoctionPlayer = player.GetModPlayer(); + concoctionPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600) } - - public override void UpdateInventory(Player player) - { - wasHovering = Main.HoverItem?.type == Type; - } - - // Display different text for the first 10 frames of hovering over the item's tooltip. public override void ModifyTooltips(List tooltips) { - bool isHovering = Main.HoverItem?.type == Type; + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); - if (isHovering && !wasHovering) - hoverTimer = 0; - if (isHovering) - hoverTimer++; - - if (hoverTimer <= 10 && hoverTimer > 0) + if (concoctionPlayer.hoverTimer <= 10 && concoctionPlayer.hoverTimer > 0) { - TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "HealLife"); - healLine?.Text = this.GetLocalization("EasterEggText").Value; + TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (healLine != null) + { + healLine.Text = this.GetLocalization("EasterEggText").Value; + } } } } @@ -70,20 +75,64 @@ namespace CalamityMod.Items.Potions public class TheConcoctionPlayer : ModPlayer { public int swinesWrathCounter = -1; - + public int spamTimer = 0; + public bool holdingHeal = false; + + public int hoverTimer = 0; + public bool wasHovering = false; + public override void PostUpdate() { + if (!holdingHeal && Player.controlQuickHeal && spamTimer >= 0 && Player.InventoryHas(ModContent.ItemType())) + { + Vector2 vel = -Vector2.UnitY.RotatedByRandom(0.4f); + Particle chug = new CustomSpark(Player.Center + vel * 35, vel * Main.rand.NextFloat(2, 3), "CalamityMod/Items/Potions/TheConcoction", false, 22, 0.6f, Color.White, Vector2.One, false, false, 0, false, false, noShrink: true, spin: 0.01f * Math.Sign(vel.X)); + GeneralParticleHandler.SpawnParticle(chug); + SoundStyle tryChug = new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver"); + SoundEngine.PlaySound(tryChug with { pitch = Main.rand.NextFloat(0.6f, 0.8f), MaxInstances = -1 }, Player.Center); + spamTimer += 80; + if (spamTimer > 230) + spamTimer = 230; + holdingHeal = true; + } + if (!Player.controlQuickHeal) + holdingHeal = false; + if (spamTimer > 0) + spamTimer--; + if (spamTimer >= 180) + { + Player.ConsumeItem(ModContent.ItemType()); + swinesWrathCounter = 1200; + spamTimer = -1; + } + if (swinesWrathCounter > 0) { swinesWrathCounter--; - if (swinesWrathCounter <= 600 && !Player.HasBuff()) // When there is 10 seconds left + if (swinesWrathCounter <= 600 && !Player.HasBuff()) { Player.AddBuff(ModContent.BuffType(), 600); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SwinesWrathProc"), Player.Center); } } + + if (Main.myPlayer == Player.whoAmI) + { + // Check if hover over the right item + bool isHovering = Main.HoverItem?.type == ModContent.ItemType(); + + if (isHovering && !wasHovering) + hoverTimer = 0; + + if (isHovering) + hoverTimer++; + else + hoverTimer = 0; + + // Save the state for the next frame + wasHovering = isHovering; + } } } } diff --git a/Items/Potions/TheElixir.cs b/Items/Potions/TheElixir.cs index eae462625c..2200a67d6d 100644 --- a/Items/Potions/TheElixir.cs +++ b/Items/Potions/TheElixir.cs @@ -4,7 +4,9 @@ using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.Chat; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions @@ -25,9 +27,9 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.value = Item.sellPrice(silver: 2); - Item.rare = ItemRarityID.Blue; Item.DefaultToFood(28, 51, 0, 0, true); + Item.value = Item.buyPrice(silver: 10); // Sold by Shady Salesman + Item.rare = ItemRarityID.Blue; } // Player is unable to use the item when Chaos State is enabled to prevent spamming the item. @@ -43,29 +45,33 @@ namespace CalamityMod.Items.Potions public override bool? UseItem(Player player) { + // 25% chance to "fail" a teleport and send the player to one of three random dangerous locations. if (Main.rand.NextBool(4)) { - int locationIndex = Main.rand.Next(3); - if (Main.dedServ) - TheElixirTeleportSyncPacket.Send(player, locationIndex); - - Vector2? location = locationIndex switch + if (Main.netMode == NetmodeID.SinglePlayer) { - 1 => CalamityPlayer.GetAbyssVoidTeleportPosition(player), - 2 => CalamityPlayer.GetTempleTeleportPosition(player), - _ => CalamityPlayer.GetDungeonArchivesTeleportPosition(player) - }; + player.GetModPlayer().RunDangerousLocationTeleportation(); + } + else if (player.whoAmI == Main.myPlayer) + { + TheElixirTeleportSyncPacket.Send(player); + } - if (!location.HasValue) - return false; - - player.AddBuff(BuffID.ChaosState, 300, false); - player.AddBuff(BuffID.Cursed, 300, false); - CalamityPlayer.ModTeleport(player, location.Value, false, TeleportationStyleID.RecallPotion); + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(BuffID.ChaosState, 300, false); + player.AddBuff(BuffID.Cursed, 300, false); + } } //If it doesn't fail, just act like a Potion of Return else - player.DoPotionOfReturnTeleportationAndSetTheComebackPoint(); + { + if (player.whoAmI == Main.myPlayer) + { + player.DoPotionOfReturnTeleportationAndSetTheComebackPoint(); + SoundEngine.PlaySound(SoundID.Item6); + } + } //Dust and Teleport sounds happen regardless of if it fails or not Rectangle rect = player.getRect(); @@ -105,8 +111,25 @@ namespace CalamityMod.Items.Potions } dust.scale *= 0.8f; } - SoundEngine.PlaySound(SoundID.Item6, player.Center); return true; } } + + public class TheElixirPlayer : ModPlayer + { + public void RunDangerousLocationTeleportation() + { + int locationIndex = Main.rand.Next(3); + Vector2? location = null; + if (locationIndex == 0) + location = CalamityPlayer.GetDungeonArchivesTeleportPosition(Player); + if (locationIndex == 1) + location = CalamityPlayer.GetAbyssVoidTeleportPosition(Player); + if (locationIndex == 2) + location = CalamityPlayer.GetTempleTeleportPosition(Player); + + if (location.HasValue) + CalamityPlayer.ModTeleport(Player, location.Value, true, TeleportationStyleID.RecallPotion); + } + } } diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 539b1854a8..b28431bf9e 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). - AddIngredient(ItemID.FallenStar, 20). AddIngredient(8). + AddIngredient(ItemID.FallenStar, 20). + AddIngredient(30). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 48063cc2bc..f9b862ef9c 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -49,9 +49,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SoulofNight, 5). + AddIngredient(5). AddIngredient(7). - AddIngredient(2). + AddIngredient(ItemID.SoulofNight, 5). AddTile(TileID.Hellforge). Register(); } diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 341e60f662..a1c210079a 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 50784255c0..f01a6ca8eb 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.SummonItems int posX = (int)(player.position.X + Main.rand.Next(-250, 251)); int posY = (int)(player.position.Y - 500f); int bossToSpawn = ModContent.NPCType(); - CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, SoundID.ScaryScream); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, CalamityClientConfig.Instance.MisophoniaSupport ? SoundID.Roar : SoundID.ScaryScream); return true; } diff --git a/Items/SummonItems/Portabulb.cs b/Items/SummonItems/Portabulb.cs index 6dd1c5b01e..f271d2b314 100644 --- a/Items/SummonItems/Portabulb.cs +++ b/Items/SummonItems/Portabulb.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(20). - AddIngredient(ItemID.JungleSpores, 15). + AddIngredient(3). AddIngredient(5). AddTile(TileID.Anvils). Register(); diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index c61306273d..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()) || canPissOffProvi) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !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/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index c1fb8b87ce..db47c407a1 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). + AddIngredient(8). AddIngredient(8). - AddIngredient(4). + AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/TownPets/TheHousingContract.cs b/Items/SummonItems/TownPets/TheHousingContract.cs index c646795033..53a959ca3e 100644 --- a/Items/SummonItems/TownPets/TheHousingContract.cs +++ b/Items/SummonItems/TownPets/TheHousingContract.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.SummonItems.TownPets Item.width = 28; Item.height = 28; Item.maxStack = Item.CommonMaxStack; - Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(0, 5)); + Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(gold: 5)); // Same price as other Pet Licenses; Sold by Shady Salesman } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/YharonEgg.cs b/Items/SummonItems/YharonEgg.cs index f5b1b48745..9e5f3d5bf6 100644 --- a/Items/SummonItems/YharonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index 9339432c58..b09100613e 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.value = Item.sellPrice(gold: 3); Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/AcidwoodHammer.cs b/Items/Tools/AcidwoodHammer.cs index 4bd66b4d49..86857307bf 100644 --- a/Items/Tools/AcidwoodHammer.cs +++ b/Items/Tools/AcidwoodHammer.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,21 +10,11 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { - Item.damage = 10; - Item.knockBack = 3.5f; - Item.useTime = 9; - Item.useAnimation = 20; - Item.hammer = 25; - - Item.DamageType = DamageClass.Melee; + Item.CloneDefaults(ItemID.ShadewoodHammer); // Ash Wood > Acidwood > Shadewood Item.width = 40; Item.height = 40; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; + Item.damage = 8; + Item.useTime = 8; // Due to vanilla tool tweaks; otherwise apply 40% hammer power } public override void AddRecipes() { diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index d07fd537db..4d935cd5c6 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -33,8 +33,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index 0caf445b78..b6b8a3f1b1 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityCyanBuyPrice; + Item.value = Item.sellPrice(gold: 4, silver: 50); Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index a0fc904380..6f0c168811 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityCyanBuyPrice; + Item.value = Item.sellPrice(gold: 6); Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 9269689fc5..b62feef26f 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.value = Item.sellPrice(gold: 4, silver: 35); Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index 9f08128517..e7bb1a9bc5 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.value = Item.sellPrice(gold: 4, silver: 35); Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 3af6f63a84..03cf2acb1f 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.value = Item.sellPrice(gold: 10); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.rare = ModContent.RarityType(); @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(18). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/BrimstoneLocus.cs b/Items/Tools/BrimstoneLocus.cs index 19e3fab570..10370ad4a2 100644 --- a/Items/Tools/BrimstoneLocus.cs +++ b/Items/Tools/BrimstoneLocus.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddIngredient(). - AddIngredient(3). + AddIngredient(10). Register(); } } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 2e685defcd..c8ab0cfa54 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Tools.ClimateChange CreateRecipe(). AddRecipeGroup("Sand", 50). AddRecipeGroup("AnyAdamantiteBar", 10). - AddIngredient(ItemID.AncientCloth, 5). + AddIngredient(ItemID.AncientCloth, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 1eced6ca1b..c894283834 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Tools.ClimateChange CreateRecipe(). AddIngredient(). AddIngredient(ItemID.Sundial). - AddIngredient(3). + AddIngredient(12). AddIngredient(ItemID.FragmentSolar, 15). AddTile(TileID.DemonAltar). Register(); @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Tools.ClimateChange CreateRecipe(). AddIngredient(). AddIngredient(ItemID.Moondial). - AddIngredient(3). + AddIngredient(12). AddIngredient(ItemID.FragmentSolar, 15). AddTile(TileID.DemonAltar). Register(); 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/Tools/DisgustingMeat.cs b/Items/Tools/DisgustingMeat.cs index 8a32de7347..5bb7a439c9 100644 --- a/Items/Tools/DisgustingMeat.cs +++ b/Items/Tools/DisgustingMeat.cs @@ -1,6 +1,19 @@ -using CalamityMod.Items.PermanentBoosters; +using System; +using CalamityMod.Effects; +using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Potions.Food; +using CalamityMod.Packets; +using CalamityMod.Packets.Worlds; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +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; using Terraria.ID; using Terraria.ModLoader; @@ -8,90 +21,344 @@ namespace CalamityMod.Items.Tools { public class DisgustingMeat : ModItem, ILocalizedModType { + private static Asset SmallGreyscaleCircle; + public new string LocalizationCategory => "Items.Tools"; + public override void Load() + { + if (!Main.dedServ) + { + SmallGreyscaleCircle = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle"); + } + } + public override void SetStaticDefaults() { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.FoodParticleColors[Type] = new Color[6] { + new Color(61, 69, 41), + new Color(91, 100, 48), + new Color(122, 123, 67), + new Color(128, 69, 46), + new Color(183, 116, 80), + new Color(95, 59, 46), + }; } + public override void SetDefaults() { Item.DefaultToFood(26, 36, 0, 0); Item.value = 0; - Item.UseSound = SoundID.NPCDeath13; - Item.maxStack = 1; - Item.consumable = false; + Item.UseSound = SoundID.NPCHit20; } public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + DisgustingMeatPlayer modPlayer = player.GetModPlayer(); + return !modPlayer.DoingVomitAnimation; + } + public override bool? UseItem(Player player) { if (player.ItemTimeIsZero) { - var calPlayer = player.Calamity(); + DisgustingMeatPlayer modPlayer = player.GetModPlayer(); if (player.altFunctionUse == 2) - { - TryDropBoosterItem(player, ref calPlayer.rageBoostOne, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.rageBoostTwo, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.rageBoostThree, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); - } - else - { - if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry) - { - TryDropBoosterItem(player, ref calPlayer.sTangerine, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.mFruit, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.tCloudberry, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.sStrawberry, ModContent.ItemType()); - } - else - { - for (int i = 0; i < player.ConsumedLifeFruit; i++) - { - int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeFruit); - Main.item[drop].noGrabDelay = 100; - } - player.ConsumedLifeFruit = 0; - for (int j = 0; j < player.ConsumedLifeCrystals; j++) - { - int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeCrystal); - Main.item[drop].noGrabDelay = 100; - } - player.ConsumedLifeCrystals = 0; - } + modPlayer.EjectMiscUpgrades = true; + modPlayer.DoingVomitAnimation = true; - if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart) - { - TryDropBoosterItem(player, ref calPlayer.cShard, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.eCore, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.pHeart, ModContent.ItemType()); - } - else - { - for (int k = 0; k < player.ConsumedManaCrystals; k++) - { - int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.ManaCrystal); - Main.item[drop].noGrabDelay = 100; - } - player.ConsumedManaCrystals = 0; - } - } return true; } return null; } - private static void TryDropBoosterItem(Player player, ref bool condition, int itemType) + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + // Stink particles and flies coming off of the item while it's in the world (yuck!!) ((:sick:)) + if (Main.rand.NextBool(25)) + { + int stinkFumesAmt = Main.rand.Next(1, 3); + for (int i = 0; i < stinkFumesAmt; i++) + { + Vector2 fumesSpawnPosition = Item.Center + Main.rand.NextVector2Circular(Item.width - 8, Item.height - 8); + Color fumesInitialColor = Color.Lerp(Color.OliveDrab, Color.DarkGreen, Main.rand.NextFloat()); + Color fumesFadeColor = Color.Lerp(fumesInitialColor, Color.GhostWhite, Main.rand.NextFloat(0.3f, 0.5f)); + TimedSmokeParticle fumes = new(fumesSpawnPosition, Vector2.Zero, fumesInitialColor, fumesFadeColor, Main.rand.NextFloat(0.15f, 0.2f), Main.rand.NextFloat(0.4f, 0.6f), Main.rand.Next(45, 60), 0.002f * Main.rand.NextBool().ToDirectionInt(), true); + GeneralParticleHandler.QueueParticleForNextFrame(fumes); + } + } + + if (Main.rand.NextBool(150)) + { + Vector2 flyGroupSpawnPosition = Item.Top + new Vector2(Main.rand.NextFloat(-16f, 16f), Main.rand.NextFloat(-8f, 0f)); + int fliesAmt = Main.rand.Next(1, 4); + for (int i = 0; i < fliesAmt; i++) + { + Vector2 flySpawnPosition = flyGroupSpawnPosition + Main.rand.NextVector2Circular(8f, 8f); + float flyScale = Main.rand.NextFloat(0.8f, 1f); + int flyLifetime = Main.rand.Next(360, 480); + FlyParticle fly = new(flySpawnPosition, flyScale, flyLifetime, Item); + GeneralParticleHandler.QueueParticleForNextFrame(fly); + } + } + + // Stink lines. + spriteBatch.End(out var snapshot); + + using var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + using (pixelationLease.Scope(clearColor: Color.Transparent)) + { + Effect sineWaveDistortion = CalamityShaders.SineWaveDistortionShader.Value; + sineWaveDistortion.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 6f + whoAmI); + sineWaveDistortion.Parameters["waveAmplitude"].SetValue(0.25f); + sineWaveDistortion.Parameters["waveFrequency"].SetValue(20f); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, sineWaveDistortion, PixelationManager.PixelationMatrix); + + Main.GetItemDrawFrame(Item.type, out _, out Rectangle itemFrame); + Vector2 baseItemDrawOrigin = itemFrame.Size() * 0.5f; + Vector2 stinkLineScale = new(0.125f, 0.6f); + + int stinkLineAmt = 2; + for (int i = 0; i < stinkLineAmt; i++) + { + float riseAndFall = MathHelper.Lerp(4f, -4f, MathF.Sin((float)Main.timeForVisualEffects / 120f + whoAmI + (i * 14)) * 0.5f + 0.5f); + Vector2 stinkLineDrawPosition = Item.Bottom + new Vector2(Utils.Remap(i, 0, stinkLineAmt - 1, -8f, 8f, true) - 4f, -24f + riseAndFall); + spriteBatch.Draw(SmallGreyscaleCircle.Value, stinkLineDrawPosition - Main.screenPosition - new Vector2(0f, baseItemDrawOrigin.Y), null, Color.DarkOliveGreen * 0.82f, 0f, SmallGreyscaleCircle.Size() * 0.5f, stinkLineScale * 0.7f * Item.scale, 0, 0f); + } + + spriteBatch.End(); + } + + spriteBatch.Begin(snapshot); + spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + } + } + + public class DisgustingMeatPlayer : ModPlayer + { + public static int VomitEjectTime => 75; + + public static int VomitMaxTime => 130; + + public bool DoingVomitAnimation = false; + + public bool EjectMiscUpgrades = false; + + public int VomitTime = 0; + + public override void SyncPlayer(int toWho, int fromWho, bool newPlayer) => DisgustingMeatPlayerSyncPacket.Send(this, toWho, fromWho); + + public override void CopyClientState(ModPlayer targetCopy) + { + DisgustingMeatPlayer clientClone = (DisgustingMeatPlayer)targetCopy; + clientClone.DoingVomitAnimation = DoingVomitAnimation; + clientClone.EjectMiscUpgrades = EjectMiscUpgrades; + clientClone.VomitTime = VomitTime; + clientClone.Player.eyeHelper.CurrentEyeFrame = Player.eyeHelper.CurrentEyeFrame; + } + + public override void SendClientChanges(ModPlayer clientPlayer) + { + DisgustingMeatPlayer clientClone = (DisgustingMeatPlayer)clientPlayer; + if (clientClone.DoingVomitAnimation != DoingVomitAnimation) + DisgustingMeatPlayerSyncPacket.Send(this); + } + + public override void UpdateDead() + { + DoingVomitAnimation = false; + EjectMiscUpgrades = false; + VomitTime = 0; + } + + public override void PostUpdateMiscEffects() + { + if (Player.whoAmI == Main.myPlayer && DoingVomitAnimation) + { + // Eject all necessary items at once. + if (VomitTime == VomitEjectTime) + { + EjectPermanentUpgrades(); + SoundEngine.PlaySound(SoundID.NPCDeath13, Player.Center); + } + + if (VomitTime >= VomitMaxTime) + { + VomitTime = 0; + DoingVomitAnimation = false; + EjectMiscUpgrades = false; + } + + VomitTime++; + } + + // Vomit particles bleeehhhhggghghghgh + if (VomitTime >= VomitEjectTime && VomitTime <= VomitMaxTime) + { + if (Main.rand.NextBool(2)) + { + int dustAmt = Main.rand.Next(2, 5); + for (int i = 0; i < dustAmt; i++) + { + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + Vector2 spawnPosition = Player.Center + new Vector2(9f * Player.direction, -8f); + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + Player.headRotation) * Main.rand.NextFloat(6f, 8f) * Player.direction; + Dust.NewDust(spawnPosition, 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + } + + if (Main.rand.NextBool(3)) + { + Vector2 spawnPosition = Player.Center - new Vector2(9f * Player.direction, 8f); + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + Player.headRotation) * Main.rand.NextFloat(6f, 8f) * Player.direction; + Color color = Color.Lerp(Color.DarkOliveGreen, Color.Green, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle vomit = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(0.8f, 1f), Main.rand.Next(30, 45), rotationSpeed); + GeneralParticleHandler.SpawnParticle(vomit, true); + } + } + } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (DoingVomitAnimation) + { + // Rapidly shift between random angles while vomiting. + float interpolant = Utils.GetLerpValue(0f, VomitEjectTime, VomitTime, true) * Utils.GetLerpValue(VomitMaxTime, VomitMaxTime - 15, VomitTime, true); + float idealRotationDegrees = MathHelper.Lerp(0f, 15f, interpolant); + Player.headRotation = MathHelper.ToRadians(Main.rand.NextFloat(-idealRotationDegrees, idealRotationDegrees)); + + // Close the eyes as well. + Player.eyeHelper.CurrentEyeFrame = Terraria.GameContent.PlayerEyeHelper.EyeFrame.EyeHalfClosed; + if (VomitTime >= VomitEjectTime) + Player.eyeHelper.CurrentEyeFrame = Terraria.GameContent.PlayerEyeHelper.EyeFrame.EyeClosed; + } + } + + private void EjectPermanentUpgrades() + { + var calPlayer = Player.Calamity(); + if (EjectMiscUpgrades) + { + // Rage and Adrenaline upgrades. + TryDropBoosterItem(ref calPlayer.rageBoostOne, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.rageBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.rageBoostThree, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); + + // Celestal Onion. + TryDropBoosterItem(ref calPlayer.extraAccessoryML, ModContent.ItemType()); + + // Demon Heart. + TryDropBoosterItem(ref Player.extraAccessory, ItemID.DemonHeart); + + // Shimmer upgrades. + if (Player.usedAegisCrystal || Player.usedAegisFruit || Player.usedArcaneCrystal || Player.usedAmbrosia || Player.usedGalaxyPearl || Player.usedGummyWorm || NPC.peddlersSatchelWasUsed || NPC.combatBookWasUsed || NPC.combatBookVolumeTwoWasUsed) + { + TryDropBoosterItem(ref Player.usedAegisCrystal, ItemID.AegisCrystal); + TryDropBoosterItem(ref Player.usedAegisFruit, ItemID.AegisFruit); + TryDropBoosterItem(ref Player.usedArcaneCrystal, ItemID.ArcaneCrystal); + TryDropBoosterItem(ref Player.usedAmbrosia, ItemID.Ambrosia); + TryDropBoosterItem(ref Player.usedGalaxyPearl, ItemID.GalaxyPearl); + TryDropBoosterItem(ref Player.usedGummyWorm, ItemID.GummyWorm); + + // Sync the world data immediately for these three specifically since they aren't fully player side. + bool hadSatchel = NPC.peddlersSatchelWasUsed; + TryDropBoosterItem(ref NPC.peddlersSatchelWasUsed, ItemID.PeddlersSatchel); + if (hadSatchel && Main.netMode != NetmodeID.SinglePlayer) + DisableNPCUpgradesSyncPacket.Send(0); + + bool hadCombatBook = NPC.combatBookWasUsed; + TryDropBoosterItem(ref NPC.combatBookWasUsed, ItemID.CombatBook); + if (hadCombatBook && Main.netMode != NetmodeID.SinglePlayer) + DisableNPCUpgradesSyncPacket.Send(1); + + bool hadCombatBookTwo = NPC.combatBookVolumeTwoWasUsed; + TryDropBoosterItem(ref NPC.combatBookVolumeTwoWasUsed, ItemID.CombatBookVolumeTwo); + if (hadCombatBookTwo && Main.netMode != NetmodeID.SinglePlayer) + DisableNPCUpgradesSyncPacket.Send(2); + } + + // Artisan Loaf. + TryDropBoosterItem(ref Player.ateArtisanBread, ItemID.ArtisanLoaf); + } + else + { + // Calamity health booster fruits. + if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry) + { + TryDropBoosterItem(ref calPlayer.sTangerine, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.mFruit, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.tCloudberry, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.sStrawberry, ModContent.ItemType()); + } + + // Life fruit. + if (Player.ConsumedLifeFruit > 0) + { + for (int i = 0; i < Player.ConsumedLifeFruit; i++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.LifeFruit); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedLifeFruit = 0; + } + + // Heart crystals. + if (Player.ConsumedLifeCrystals > 0) + { + for (int j = 0; j < Player.ConsumedLifeCrystals; j++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.LifeCrystal); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedLifeCrystals = 0; + } + + // Calamity mana upgrades. + if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart) + { + TryDropBoosterItem(ref calPlayer.cShard, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.eCore, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.pHeart, ModContent.ItemType()); + } + + // Mana Crystals. + if (Player.ConsumedManaCrystals > 0) + { + for (int k = 0; k < Player.ConsumedManaCrystals; k++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.ManaCrystal); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedManaCrystals = 0; + } + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.SyncPlayer, -1, -1, null, Player.whoAmI); + DisgustingMeatPlayerSyncPacket.Send(this); + } + } + + private void TryDropBoosterItem(ref bool condition, int itemType) { if (condition) { condition = false; - int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, itemType); + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), itemType); Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); } } } diff --git a/Items/Tools/DriftwoodHammer.cs b/Items/Tools/DriftwoodHammer.cs index 4db3883330..d5a85df5c4 100644 --- a/Items/Tools/DriftwoodHammer.cs +++ b/Items/Tools/DriftwoodHammer.cs @@ -10,26 +10,15 @@ namespace CalamityMod.Items.Tools { public new string LocalizationCategory => "Items.Tools"; - public static int NormalUseTime = 11; - public static int FasterUseTime = 8; + public static int NormalUseTime = 9; // Equals Shadewood + public static int FasterUseTime = 7; public override void SetDefaults() { - Item.damage = 13; - Item.knockBack = 4f; - Item.useTime = NormalUseTime; - Item.useAnimation = 31; - Item.hammer = 25; - - Item.DamageType = DamageClass.Melee; + Item.CloneDefaults(ItemID.ShadewoodHammer); // Driftwood (base) = Shadewood Item.width = 40; Item.height = 42; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; + Item.useTime = NormalUseTime; } // The tool is mechanically faster when wet. diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index fc35ce49da..8b7dcf1334 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.value = Item.sellPrice(silver: 75); Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(12). + AddIngredient(18). + AddIngredient(18). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 444ac16aac..6672362d5d 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.value = Item.sellPrice(gold: 7); Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index c586a680e5..b692e7290b 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(). AddRecipeGroup("LunarHamaxe"). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index ca95c84031..bd7f066dfb 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/MarniteDeconstructor.cs b/Items/Tools/MarniteDeconstructor.cs index 25f1c986f9..38d4bc78d6 100644 --- a/Items/Tools/MarniteDeconstructor.cs +++ b/Items/Tools/MarniteDeconstructor.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 4e8ffccdb8..3ee7960dd3 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Blue; } diff --git a/Items/Tools/MonolithHammer.cs b/Items/Tools/MonolithHammer.cs index 0280dc5695..b5e9e68bda 100644 --- a/Items/Tools/MonolithHammer.cs +++ b/Items/Tools/MonolithHammer.cs @@ -12,23 +12,14 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { - Item.damage = 29; - Item.knockBack = 2.5f; - Item.useTime = 5; - Item.useAnimation = 9; - Item.hammer = 35; - Item.tileBoost = 1; - - Item.DamageType = DamageClass.Melee; + Item.CloneDefaults(ItemID.PearlwoodHammer); // Monolith >= Pearlwood Item.width = 46; Item.height = 44; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; + Item.damage = 30; + Item.useAnimation = 14; + Item.tileBoost = 1; } + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 366d49d15d..d896019c96 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index 626b208649..9b3181d210 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.value = Item.sellPrice(gold: 4, silver: 35); Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index 019d52c300..e20c0c045a 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.value = Item.sellPrice(gold: 3); Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(18). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 9a969c5485..e41e1309c4 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -32,8 +32,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/SpawnBlocker/AntiCystOintment.cs b/Items/Tools/SpawnBlocker/AntiCystOintment.cs index 08abe17ffe..113db25d9e 100644 --- a/Items/Tools/SpawnBlocker/AntiCystOintment.cs +++ b/Items/Tools/SpawnBlocker/AntiCystOintment.cs @@ -60,45 +60,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().disablePerfCystSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/AntiCystOintment").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/SpawnBlocker/AntiTumorOintment.cs b/Items/Tools/SpawnBlocker/AntiTumorOintment.cs index 564dc8d4c3..97b59f6657 100644 --- a/Items/Tools/SpawnBlocker/AntiTumorOintment.cs +++ b/Items/Tools/SpawnBlocker/AntiTumorOintment.cs @@ -60,45 +60,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().disableHiveCystSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/AntiTumorOintment").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/SpawnBlocker/BleachBall.cs b/Items/Tools/SpawnBlocker/BleachBall.cs index c2c6df1948..1cf4051fc4 100644 --- a/Items/Tools/SpawnBlocker/BleachBall.cs +++ b/Items/Tools/SpawnBlocker/BleachBall.cs @@ -61,45 +61,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().disableNaturalScourgeSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/BleachBall").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/SpawnBlocker/BrokenWaterFilter.cs b/Items/Tools/SpawnBlocker/BrokenWaterFilter.cs index 9740d03c89..5efb08dac3 100644 --- a/Items/Tools/SpawnBlocker/BrokenWaterFilter.cs +++ b/Items/Tools/SpawnBlocker/BrokenWaterFilter.cs @@ -60,45 +60,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().noStupidNaturalARSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/BrokenWaterFilter").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/SpawnBlocker/SirenproofEarMuffs.cs b/Items/Tools/SpawnBlocker/SirenproofEarMuffs.cs index 29c1e1e10d..f467ff0e9c 100644 --- a/Items/Tools/SpawnBlocker/SirenproofEarMuffs.cs +++ b/Items/Tools/SpawnBlocker/SirenproofEarMuffs.cs @@ -60,45 +60,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().disableAnahitaSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/SirenproofEarMuffs").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/SpawnBlocker/VoodooDemonVoodooDoll.cs b/Items/Tools/SpawnBlocker/VoodooDemonVoodooDoll.cs index dd57546bb3..910e38e235 100644 --- a/Items/Tools/SpawnBlocker/VoodooDemonVoodooDoll.cs +++ b/Items/Tools/SpawnBlocker/VoodooDemonVoodooDoll.cs @@ -62,45 +62,6 @@ namespace CalamityMod.Items.Tools.SpawnBlocker player.Calamity().disableVoodooSpawns |= Enabled; } - /* - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; - spriteBatch.Draw(texture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0); - } - - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture; - - if (state) - { - //Replace with enabled texture - texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - else - { - texture = ModContent.Request("CalamityMod/Items/VoodooDemonVoodooDoll").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } - return false; - } - */ - public override void ModifyTooltips(List tooltips) { string text; diff --git a/Items/Tools/TectonicTruncator.cs b/Items/Tools/TectonicTruncator.cs index 8e56a87c84..ffeedf415b 100644 --- a/Items/Tools/TectonicTruncator.cs +++ b/Items/Tools/TectonicTruncator.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.value = Item.sellPrice(gold: 4, silver: 35); Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/TheGift.cs b/Items/Tools/TheGift.cs index 1fd6f97a7f..25adf7d117 100644 --- a/Items/Tools/TheGift.cs +++ b/Items/Tools/TheGift.cs @@ -1,10 +1,12 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.NPCs; +using CalamityMod.Packets.Entities; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.GameContent; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -15,6 +17,65 @@ namespace CalamityMod.Items.Tools { public new string LocalizationCategory => "Items.Tools"; public static readonly SoundStyle BadBuzzer = new SoundStyle("CalamityMod/Sounds/Custom/BadGiftBuzzer") with { Volume = 0.85f }; + + public static bool CanApplyToNPC(NPC npc) + { + return npc.isLikeATownNPC && !NPCID.Sets.NoTownNPCHappiness[npc.type] && !NPCID.Sets.IsTownPet[npc.type] && !npc.GetGlobalNPC().TheGiftStatus.HasValue; + } + + public static void ApplyGiftEffects(NPC npc, bool positive) + { + Color color = positive ? Color.Green : Color.Red; + SoundEngine.PlaySound(positive ? SoundID.ResearchComplete : BadBuzzer, npc.Center); + + // nothing ever happens.... + for (int i = 0; i < 6; i++) + { + Vector2 spawnPos = npc.Center + Main.rand.NextVector2Circular(30f, 30f); + HealingPlus sparkle = new(spawnPos, 0.5f, (spawnPos - npc.Center).SafeNormalize(Vector2.Zero) * 0.65f, color, color * 0.2f, 25) + { + Rotation = positive ? 0f : MathHelper.PiOver4 + }; + GeneralParticleHandler.SpawnParticle(sparkle); + } + + for (int j = 0; j < 4; j++) + { + Vector2 spawnPos = npc.Center + Main.rand.NextVector2Circular(50f, 50f); + Vector2 arrowVelocity = -Vector2.UnitY * 0.6f * positive.ToDirectionInt(); + StatChangeArrow arrow = new(spawnPos, arrowVelocity, -MathHelper.PiOver2 * positive.ToDirectionInt(), color, color * 0.1f, 0.7f, 40); + GeneralParticleHandler.SpawnParticle(arrow); + } + } + + public static bool TryApplyGift(Item item, NPC npc, bool? forcedOutcome = null) + { + if (!item.active || item.type != ModContent.ItemType() || Main.remixWorld || !CanApplyToNPC(npc)) + return false; + + bool positive = forcedOutcome ?? Main.rand.NextBool(); + var townNPC = npc.GetGlobalNPC(); + townNPC.TheGiftStatus = positive; + townNPC.TheGiftReset = 0.0; + ApplyGiftEffects(npc, positive); + + item.stack--; + if (item.stack <= 0) + { + item.active = false; + item.type = ItemID.None; + } + + if (Main.netMode == NetmodeID.Server) + { + npc.netUpdate = true; + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item.whoAmI); + TheGiftEffectsPacket.Send(npc, positive); + } + + return true; + } + public override void SetDefaults() { Item.width = 30; @@ -26,7 +87,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman Item.rare = ItemRarityID.Green; } @@ -39,46 +100,21 @@ namespace CalamityMod.Items.Tools { // Controls actually applying the effect to an NPC // None of this should work in Remix because Remix disables happiness - if (Item.noGrabDelay <= 0 && !Main.remixWorld) + bool localGiftCollisionCheck = Main.netMode == NetmodeID.SinglePlayer || Item.playerIndexTheItemIsReservedFor == Main.myPlayer; + if (Item.noGrabDelay <= 0 && !Main.remixWorld && localGiftCollisionCheck) { foreach (NPC n in Main.ActiveNPCs) { - // Don't run this code for NPCs that aren't affected by happiness - // Also don't run this if The Gift has already been used on this NPC; they all will hold grudges against you :) - if (!n.isLikeATownNPC || NPCID.Sets.NoTownNPCHappiness[n.type] || NPCID.Sets.IsTownPet[n.type] || n.GetGlobalNPC().TheGiftStatus.HasValue) + if (!CanApplyToNPC(n)) continue; if (Item.Hitbox.Intersects(n.Hitbox)) { - bool positive = Main.rand.NextBool(); - Color c = positive ? Color.Green : Color.Red; - SoundEngine.PlaySound(positive ? SoundID.ResearchComplete : BadBuzzer, n.Center); - n.GetGlobalNPC().TheGiftStatus = positive; - n.GetGlobalNPC().TheGiftReset = 0.0; + if (Main.netMode == NetmodeID.SinglePlayer) + TryApplyGift(Item, n); + else if (Main.netMode == NetmodeID.MultiplayerClient) + RequestApplyTheGiftPacket.Send(Item, n); - // Visual effect to demonstrate that something happened - for (int i = 0; i < 6; i++) - { - Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(30f, 30f); - HealingPlus s = new(spawnPos, 0.5f, (spawnPos - n.Center).SafeNormalize(Vector2.Zero) * 0.65f, c, c * 0.2f, 25) - { - Rotation = positive ? 0f : MathHelper.PiOver4 - }; - GeneralParticleHandler.SpawnParticle(s); - } - for (int j = 0; j < 4; j++) - { - Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(50f, 50f); - Vector2 arrVel = -Vector2.UnitY * 0.6f * positive.ToDirectionInt(); - StatChangeArrow arr = new(spawnPos, arrVel, -MathHelper.PiOver2 * positive.ToDirectionInt(), c, c * 0.1f, 0.7f, 40); - GeneralParticleHandler.SpawnParticle(arr); - } - - Item.active = false; - Item.type = ItemID.None; - Item.stack = 0; - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, Item.whoAmI); // Make sure it can't apply to multiple NPCs at once break; } @@ -92,12 +128,12 @@ namespace CalamityMod.Items.Tools orig(self, player, npc); // Immediately exit early if it's Remix world, or if it's an NPC that should not be affected by happiness - if (Main.remixWorld || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type]) + if (Main.remixWorld || !npc.isLikeATownNPC || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type]) return; var gtnpc = npc.GetGlobalNPC(); // The Monument lowers happiness by a fixed amount. This is not applied to the Tax Collector. - if (npc.type != NPCID.TaxCollector && gtnpc.SearchForTheMonument(npc)) + if (npc.type != NPCID.TaxCollector && gtnpc.AffectedByTheMonument) { float oldHappiness = self._currentPriceAdjustment; self._currentPriceAdjustment += TheMonument.MonumentHappinessReduction; diff --git a/Items/Tools/TinkerersVoucher.cs b/Items/Tools/TinkerersVoucher.cs index 24954690d3..4bdb04a8d8 100644 --- a/Items/Tools/TinkerersVoucher.cs +++ b/Items/Tools/TinkerersVoucher.cs @@ -225,7 +225,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -298,7 +298,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -327,7 +327,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -354,7 +354,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -383,7 +383,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index 828c7d88a9..289d8c5b98 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(15). - AddIngredient(3). + AddIngredient(10). AddIngredient(). Register(); } diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index a7e47e03ea..9e9fa45008 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.value = Item.sellPrice(silver: 5); Item.rare = ItemRarityID.Blue; } @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/WulfrumScaffoldKit.cs b/Items/Tools/WulfrumScaffoldKit.cs index c32bd9c1df..14d0e58bdd 100644 --- a/Items/Tools/WulfrumScaffoldKit.cs +++ b/Items/Tools/WulfrumScaffoldKit.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(10). AddIngredient(). AddTile(TileID.Anvils). Register(); diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index b5d2490121..37e8c3d8fa 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -282,7 +282,7 @@ namespace CalamityMod.Items.Tools { //Intentionally craftable anywhere. CreateRecipe(). - AddIngredient(5). + AddIngredient(10). Register() .DisableDecraft(); } diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 965665155d..90580b17e1 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ModContent.ItemType(), 10); // Equipment - itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); // Vanity diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index 9889e3fbe4..44657ccb8d 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -68,8 +68,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() })); // Equipment diff --git a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs index c3fccfceb4..a68f442348 100644 --- a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs +++ b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { player.Calamity().eskimoSet = true; - player.Calamity().ColdDebuffMultiplier += 0.25f; + player.Calamity().ColdDebuffMultiplier += 0.50f; player.buffImmune[BuffID.Frostburn] = true; } diff --git a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs index 93c2886fbf..4dc579c4ad 100644 --- a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs @@ -14,13 +14,14 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Gladiator"; - public const int HelmetRogueDamageBoostPercent = 3; + public const int HelmetRogueDamageBoostPercent = 8; public const int ChestplateRogueCritBoostPercent = 3; - public const int LeggingRogueVelocityBoostPercent = 3; + public const int LeggingRogueVelocityBoostPercent = 10; + public const float SetBonusRogueStealth = 0.6f; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SetBonusRogueStealth.ToStealth())}"; } public override void ApplyHeadPieceEffect(Player player) @@ -40,10 +41,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { - player.Calamity().rogueStealthMax += 0.6f; + player.Calamity().rogueStealthMax += SetBonusRogueStealth; player.Calamity().wearingRogueArmor = true; - player.GetDamage() += 0.05f; - player.Calamity().rogueVelocity += 0.1f; } } } diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 3e47eb756f..bd5de5f274 100644 --- a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public static int ArmorPenetration = 15; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); @@ -33,7 +35,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 34; Item.height = 32; Item.shootSpeed = 10f; - Item.damage = 24; + Item.damage = 18; Item.ArmorPenetration = ArmorPenetration; Item.mana = 10; Item.useAnimation = Item.useTime = 36; diff --git a/Items/Weapons/DraedonsArsenal/Auger.cs b/Items/Weapons/DraedonsArsenal/Auger.cs index f7ce73b68d..33bc3e191f 100644 --- a/Items/Weapons/DraedonsArsenal/Auger.cs +++ b/Items/Weapons/DraedonsArsenal/Auger.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { Item.width = 26; Item.height = 26; - Item.damage = 60; + Item.damage = 55; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTime = Item.useAnimation = 12; Item.knockBack = 12f; 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/DraedonsArsenal/Vulcan.cs b/Items/Weapons/DraedonsArsenal/Vulcan.cs index 34f1498955..466b0cf0ba 100644 --- a/Items/Weapons/DraedonsArsenal/Vulcan.cs +++ b/Items/Weapons/DraedonsArsenal/Vulcan.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 34; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.damage = 31; + Item.damage = 42; Item.knockBack = 11f; Item.useAnimation = Item.useTime = 11; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index e168061648..432a737f51 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AbyssShocker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 86; diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 196480b42d..04dfc8834c 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AcidGun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index 48329f3ad6..149ceb4924 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AethersWhisper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 134; diff --git a/Items/Weapons/Magic/AlphaDraconis.cs b/Items/Weapons/Magic/AlphaDraconis.cs index 9789aa3161..e889f27f6c 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -72,9 +72,9 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(6). - AddIngredient(5). - AddIngredient(10). + AddIngredient(8). + AddIngredient(4). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index a64e4316dd..8b07413bb3 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -19,6 +21,10 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle CapSound = new("CalamityMod/Sounds/Item/HarpLV6"); public static readonly SoundStyle EndSound = new("CalamityMod/Sounds/Item/HarpEnd"); public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/HarpNoteHit"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Wet, BuffID.Confused]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index dbfc18e573..006328f003 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -1,8 +1,10 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +16,11 @@ namespace CalamityMod.Items.Weapons.Magic public class Apotheosis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index a933cc1bdf..517ed3344d 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.DD2_SkyDragonsFuryShot; + Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -38,12 +40,13 @@ 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) { - int parent = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI); - int child = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI, 1, 0, parent); - Main.projectile[child].penetrate = -1; - Main.projectile[child].tileCollide = false; - Main.projectile[child].scale = 0.75f; - + for (int index = 0; index < 2; ++index) + { + float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 180; + } return false; } diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 3e39e2804f..0f0175da2c 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -7,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Magic public class ArcticBearPaw : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index c7cc0e9a90..9f89c9cd4b 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/AuguroftheVoid.cs b/Items/Weapons/Magic/AuguroftheVoid.cs index d2ef2738fe..3f83281ca4 100644 --- a/Items/Weapons/Magic/AuguroftheVoid.cs +++ b/Items/Weapons/Magic/AuguroftheVoid.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AuguroftheVoid : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index 37e6ec4379..1852760a9c 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public const int BaseDamage = 32; private int counter = 0; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 46; diff --git a/Items/Weapons/Magic/Biofusillade.cs b/Items/Weapons/Magic/Biofusillade.cs index e5f34f725b..90ebcbd833 100644 --- a/Items/Weapons/Magic/Biofusillade.cs +++ b/Items/Weapons/Magic/Biofusillade.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 3485e92f94..a7be10ce23 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -1,6 +1,7 @@ using System; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index a451948664..5c01032e74 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -36,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 606e5db6e8..4670c54a5e 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +17,12 @@ namespace CalamityMod.Items.Weapons.Magic public const int BurnOutReuseDelay = 150; public const float FizzleOutTime = 40f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + CalamityItemSets.ExtraDebuffTooltip_Player[Type] = [ModContent.BuffType()]; + } + public override void SetDefaults() { Item.width = 28; @@ -44,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(5). + AddIngredient(8). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index 8ef09521c1..0f367a59d0 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Magic public class ClothiersWrath : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index dab7555774..11f066f058 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index 646bddac01..78978ee9da 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Cryophobia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frostburn2, BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 2856620fe7..bc7454d962 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.BubbleGun). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(ItemID.ShimmerBlock, 5). + AddIngredient(ItemID.ShimmerBlock, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 15de8c3c0b..1efbc674b0 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class EidolicWail : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 60; 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/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index 6bbe8845ab..c2abdd2338 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Magic public class EvergladeSpray : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.CursedInferno, BuffID.Ichor]; + } public override void SetDefaults() { Item.width = 34; @@ -32,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.GoldenShower). - AddIngredient(3). + AddIngredient(10). AddTile(TileID.Bookcases). Register(); CreateRecipe(). AddIngredient(ItemID.CursedFlames). - AddIngredient(3). + AddIngredient(10). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 8f3e2f1489..c5e2e84bc7 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Magic public class FlareBolt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 7bdd5e22e0..2cd429ec99 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Magic public class ForbiddenSun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 28; @@ -31,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(6). + AddIngredient(10). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 65e04f2664..f7384db5a9 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index ee5d0a68df..4ae9ce6bff 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class FrostBolt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index 56a4cd3c5b..dbf35201bb 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; + Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 1ee7f0c77f..d5be533bb1 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index 22c98c5b65..9f1215d8a1 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HadalUrnOpen"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Venom]; + } public override void SetDefaults() { Item.width = 58; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index bd8cd04e77..aa0592be55 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Systems.Collections; @@ -24,6 +25,13 @@ namespace CalamityMod.Items.Weapons.Magic public static int AftershotCooldownFrames = 17; public static int FullChargeFrames = 88; + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } + public override void SetDefaults() { Item.width = 112; diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 964464d8d0..be7ec75b60 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index daf9021e23..3e2f40c47c 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/HyperdeathRiftScepter.cs b/Items/Weapons/Magic/HyperdeathRiftScepter.cs index 2a2bd2e163..95ae5b436e 100644 --- a/Items/Weapons/Magic/HyperdeathRiftScepter.cs +++ b/Items/Weapons/Magic/HyperdeathRiftScepter.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -19,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 258c342866..f92716a13e 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Ammo; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -16,6 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle CastSound = new("CalamityMod/Sounds/Item/IceBarrageCast"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frozen, BuffID.Frostburn2]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index 36fdb84c17..37165a47a6 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 773ea06d41..916328cff6 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index 542b049cc2..74a3367f25 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -1,9 +1,11 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; 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; @@ -17,6 +19,11 @@ 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()]; + } public override void SetDefaults() { Item.width = 28; @@ -26,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 @@ -46,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 @@ -80,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/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 9adc8327e4..f16e5a7b4c 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index f9fd80822b..d39417d4c1 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.Razorpine). AddIngredient(ItemID.LeafBlower). - AddIngredient(5). + AddIngredient(10). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index d78bf8a75f..4aa5bef678 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.LaserMachinegun). - AddIngredient(7). + AddIngredient(10). AddIngredient(ItemID.Nanites, 100). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index 9e1bfad48f..9ee5961e6a 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index fe5f1c9c71..d061f550bb 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -69,8 +69,8 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(10). - AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(8). + AddIngredient(20). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 6745b62828..9c249c2565 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; private const float Spread = 0.025f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index c18625be66..fc1d07b505 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 66; Item.height = 82; - Item.damage = 290; + Item.damage = 333; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 171a1c539b..ec118563e8 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -46,8 +46,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.DemonScythe). - AddIngredient(6). - AddIngredient(6). + AddIngredient(20). + AddIngredient(8). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/RougeSlash.cs b/Items/Weapons/Magic/RougeSlash.cs index a6d93c7a17..f8b2b7e012 100644 --- a/Items/Weapons/Magic/RougeSlash.cs +++ b/Items/Weapons/Magic/RougeSlash.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Magic public class RougeSlash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.mana = 30; diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 3c886885ef..a0bb9212c9 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; + Item.rare = ItemRarityID.LightPurple; } #region Weapon-Specific Functions diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index b2cb6a3820..d863d9657d 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -46,7 +49,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 7ed607b5d1..3cfbf1f5f5 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public int DartTimer = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index 007414071b..f991cae233 100644 --- a/Items/Weapons/Magic/ShadecrystalBarrage.cs +++ b/Items/Weapons/Magic/ShadecrystalBarrage.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; internal const float ShootSpeed = 2f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { @@ -56,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.CrystalStorm). - AddIngredient(6). + AddIngredient(12). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 883a3f8033..b831ec3578 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } - public override void SetDefaults() { Item.width = Item.height = 42; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 71f95c4283..01d41978b1 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.width = Item.height = 58; + Item.width = Item.height = 50; Item.damage = 81; Item.knockBack = 5f; Item.useAnimation = Item.useTime = 30; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.AncientCloth, 5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Magic/ShiftingSands.png b/Items/Weapons/Magic/ShiftingSands.png index 96b9e1287f..2c8eab3ee6 100644 Binary files a/Items/Weapons/Magic/ShiftingSands.png and b/Items/Weapons/Magic/ShiftingSands.png differ diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index 05e3a9466b..25947b658f 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -20,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 74; - Item.damage = 11; + Item.damage = 10; Item.DamageType = DamageClass.Magic; Item.mana = 9; Item.useAnimation = Item.useTime = 25; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index ac30f155d5..db54152152 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -1,5 +1,7 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; +using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class SlitheringEels : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 62f3485b23..4bef92114c 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Weapons.Magic public class SnowstormStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 93525a8476..9d4d4adf67 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -45,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } 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/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index d01f95d050..c2d623e371 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -41,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs index ec5fdb3816..1e03004da4 100644 --- a/Items/Weapons/Magic/Sylvestaff.cs +++ b/Items/Weapons/Magic/Sylvestaff.cs @@ -86,12 +86,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 13.5f; } - public override void ModifyManaCost(Player player, ref float reduce, ref float mult) - { - if (player.ownedProjectileCounts[Item.shoot] <= 0) - mult *= 0; - } - public override void AddRecipes() { CreateRecipe(). @@ -117,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/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index f6e98b2b9f..9fc9780f4c 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(5). + AddIngredient(10). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(5). + AddIngredient(10). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs index ac1a2b30c9..68a918686b 100644 --- a/Items/Weapons/Magic/Teslastaff.cs +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs index 7ba64395a2..cc53fb5d63 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Glow = ModContent.Request(Texture + "Glow"); } + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index ce8e78ee62..497941912c 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index b3329489f6..9ffee14e9a 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 66469c5d15..1958269759 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -18,13 +20,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { Item.width = 40; Item.height = 36; - Item.damage = 14; // same as 1.4 Wand of Sparking + Item.damage = 1; Item.mana = 200; Item.DamageType = DamageClass.Magic; Item.noMelee = true; @@ -35,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 0.5f; Item.UseSound = SoundID.Item102; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.value = Item.buyPrice(platinum: 15); // Sold by Shady Salesman Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.rare = ModContent.RarityType(); @@ -54,14 +57,5 @@ namespace CalamityMod.Items.Weapons.Magic if (Main.rand.NextBool(3)) Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Torch); } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.WandofSparking). - AddIngredient(8). - AddTile(). - Register(); - } } } diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 1b3f482bb5..f1a6e1a77e 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -30,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(10). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 3b0c0a2a62..24d5d80277 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -1,7 +1,9 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -59,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic } for (int i = 0; i < 3; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - /* - */ player.position.X), player.MountedCenter.Y + 600f); //- + realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y + 600f); //- realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-50, 51); //200 realPlayerPos.Y += (float)(100 * i); //-= mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; //+ - diff --git a/Items/Weapons/Magic/UnstableCastersGauntlet.cs b/Items/Weapons/Magic/UnstableCastersGauntlet.cs index f83fcc004f..e07644ade7 100644 --- a/Items/Weapons/Magic/UnstableCastersGauntlet.cs +++ b/Items/Weapons/Magic/UnstableCastersGauntlet.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.Calamity().donorItem = true; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 10aff81ac9..2984ac8b0f 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic // This math is handled in its holdout projectile, ValkyrieRayStaff. public const int ChargeFrames = 24; public const int CooldownFrames = 12; - public const float GemDistance = 18f; + public const float GemDistance = 27f; public static readonly Color LightColor = new Color(235, 40, 121); public override void SetStaticDefaults() @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.noUseGraphic = true; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; + Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ValkyrieRay.png b/Items/Weapons/Magic/ValkyrieRay.png index 18ec195aa0..26af6f70c6 100644 Binary files a/Items/Weapons/Magic/ValkyrieRay.png and b/Items/Weapons/Magic/ValkyrieRay.png differ diff --git a/Items/Weapons/Magic/VeeringWind.cs b/Items/Weapons/Magic/VeeringWind.cs index f3bba20cc4..76c3f9678a 100644 --- a/Items/Weapons/Magic/VeeringWind.cs +++ b/Items/Weapons/Magic/VeeringWind.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frozen]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 266081b80c..455b1b864c 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Systems.Collections; using CalamityMod.Rarities; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 6b9d38be46..1bf3fc164f 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 62; - Item.damage = 50; + Item.damage = 55; Item.mana = 8; Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 15; diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 82854d3c88..f87d31d310 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; } public const int BoomLifetime = 40; @@ -58,7 +61,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 00845c8521..16df593876 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class VitriolicViper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index f1d67cd0e7..142a0f0e20 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index e929c61010..f0f0df31f9 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 055cd4f965..ad873bcfdf 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index e212d83ebb..8ecc1dad85 100644 --- a/Items/Weapons/Magic/Volterion.cs +++ b/Items/Weapons/Magic/Volterion.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Volterion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 220; diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 83ca88ed9d..de14e5a660 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -1,7 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +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; @@ -11,35 +12,32 @@ namespace CalamityMod.Items.Weapons.Magic public class Waywasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public int shotCount = 0; + public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 38; + Item.damage = 16; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 14; - Item.useAnimation = 28; - Item.reuseDelay = 23; + Item.mana = 4; + Item.useTime = 15; + Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 12f; + Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; + Item.shootSpeed = 12f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity.RotatedBy(-0.3f * (shotCount % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, shotCount % 2 == 0 ? -1 : 1); - - SoundStyle WayWashed = new("CalamityMod/Sounds/Item/WaterSplash" + (shotCount % 2 == 0 ? "1" : "2")); - SoundEngine.PlaySound(WayWashed with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, position); - - shotCount++; + float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 6e35c1d79c..4afd9910d6 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class WintersFury : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 36; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index a60e099d50..776722be29 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index b49a1b5680..848642e13a 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class YharimsCrystal : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 4fac11427b..03b3479447 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +11,11 @@ namespace CalamityMod.Items.Weapons.Melee { public class AbsoluteZero : ModItem, ILocalizedModType { - public new string LocalizationCategory => "Items.Weapons.Melee"; + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 3261dd0d92..4d32b8058c 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 74; Item.height = 74; - Item.damage = 123; + Item.damage = 114; Item.knockBack = 7.5f; Item.useTime = 65; Item.useAnimation = 65; diff --git a/Items/Weapons/Melee/AcidwoodSword.cs b/Items/Weapons/Melee/AcidwoodSword.cs index f204f19fe8..9ae1d55e07 100644 --- a/Items/Weapons/Melee/AcidwoodSword.cs +++ b/Items/Weapons/Melee/AcidwoodSword.cs @@ -9,18 +9,12 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.damage = 11; + Item.CloneDefaults(ItemID.ShadewoodSword); // Ash Wood > Acidwood > Shadewood Item.width = 36; Item.height = 40; - Item.DamageType = DamageClass.Melee; + Item.damage = 12; Item.useAnimation = Item.useTime = 18; - Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = true; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; } public override void AddRecipes() { diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 3c03fb9b15..403f64caa5 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -49,8 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index f92771ee63..9624cbde95 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -1,53 +1,39 @@ -using CalamityMod.Items.BaseItems; -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class AmidiasTrident : CustomUseProjItem, ILocalizedModType + public class AmidiasTrident : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { - ItemID.Sets.Spears[Type] = true; + ItemID.Sets.Spears[Item.type] = true; } - /// - /// The damage multiplier for the primary use's long-range projectiles. - /// - public static readonly float BaseAttackProjectileMult = 0.5f; - /// - /// The damage multiplier for the secondary attack. - /// - public static readonly float SecondaryAttackMeleeMult = 1.25f; - /// - /// Secondary attack proc effect damage. Multiplied by the number of stacks of Sea King's Assurance the enemy taking damage has. - /// - public static readonly int SecondaryAttackBlastBaseDamage = 20; - public override void SetDefaults() { Item.width = 44; Item.height = 44; - Item.damage = 20; + Item.damage = 12; Item.DamageType = DamageClass.Melee; Item.noMelee = true; + Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 45; + Item.useAnimation = 17; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 45; + Item.useTime = 17; Item.knockBack = 4.5f; + Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6f; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 93f04e9e1d..9d17eef1ee 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -4,6 +4,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.NPCs; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee public class AnarchyBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 114; @@ -73,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.BreakerBlade). - AddIngredient(5). + AddIngredient(8). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index c119913376..f2f4c46f55 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -10,6 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,11 +23,6 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; - // Frame window for double right click to snip. - // The right click item activation takes 3 frames, so the frame window is frame 3 to frame 11. - public static int DoubleRightClickFrames = 11; - private int rmbFrames = 0; - public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap @@ -68,21 +64,25 @@ namespace CalamityMod.Items.Weapons.Melee var blastTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[BLAST]") && x.Mod == "Terraria"); if (blastTooltip != null) { - blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); + var key = Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode); + if (key.Count > 0) + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfoKeybind")); + else + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); blastTooltip.OverrideColor = Color.Lerp(Color.HotPink, Color.Crimson, 0.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.625f); } + tooltips.IntegrateDynamicHotkey(Item); } public override void SetDefaults() { Item.width = Item.height = 136; - Item.damage = 1800; + Item.damage = 1700; Item.DamageType = DamageClass.MeleeNoSpeed; Item.crit = 15; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; - Item.useTime = 15; + Item.useAnimation = Item.useTime = 15; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 9.5f; @@ -100,14 +100,30 @@ namespace CalamityMod.Items.Weapons.Melee { player.Calamity().mouseWorldListener = true; - if (rmbFrames > 0) - --rmbFrames; - if (CanUseItem(player) && Combo != 4) Item.channel = false; if (Combo == 4) Item.channel = true; + + if (Main.myPlayer == player.whoAmI && Item.CurrentlyPressingKeybind() && Charge > 0) + { + Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); + + if (blast == null) + { + float speed = Item.shootSpeed; + int dmg = (int)player.GetTotalDamage(Item.DamageType).ApplyTo(Item.damage); + Vector2 pos = player.Center; + int shoot = Item.shoot; + float kb = Item.knockBack; + var velocity = player.DirectionTo(Main.MouseWorld) * Item.shootSpeed; + PlayerLoader.ModifyShootStats(player, Item, ref pos, ref velocity, ref shoot, ref dmg, ref kb); + float angle = velocity.ToRotation(); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(dmg * BlastDamageMultiplier), 0, player.whoAmI, Charge); + Charge = 0; + } + } } public override bool CanUseItem(Player player) @@ -122,15 +138,16 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - // If it has been less than N frames since the last alt function use, this is a double right click. - bool rightMouseDoubleClick = rmbFrames > 0; // Check if a parry holdout or blast is already present. Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); - bool canExecuteBlast = rightMouseDoubleClick && Charge > 0 && blast is null; + bool canExecuteBlast = Charge > 0 && blast is null; bool canExecuteParry = parrier is null && !canExecuteBlast; + //Disable blast usage if hotkey is bound + if (Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count > 0) + canExecuteBlast = false; // The blast is checked first, so that it overrides the first right click triggering a parry. Blasts delete any active parry holdouts on use. if (canExecuteBlast) @@ -139,13 +156,6 @@ namespace CalamityMod.Items.Weapons.Melee float angle = velocity.ToRotation(); Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; - - // If the parry holdout has existed for very few frames, just delete it. - if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames) - { - parrier.active = false; - parrier.netUpdate = true; - } } // If the blast cannot be executed, then the parry is executed, assuming no existing holdout is present. @@ -162,9 +172,6 @@ namespace CalamityMod.Items.Weapons.Melee if (!anyArkParryExists) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); } - - // Regardless of what transpires from the right click, set the double right click frames appropriately. - rmbFrames = DoubleRightClickFrames; return false; } diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 4dc95aa92f..c3c661f5ec 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -49,18 +51,21 @@ namespace CalamityMod.Items.Weapons.Melee parryTooltip.OverrideColor = Color.Orange; } } + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 112; Item.height = 172; - Item.damage = 507; + Item.damage = 444; Item.DamageType = DamageClass.MeleeNoSpeed; Item.crit = 10; Item.noUseGraphic = true; Item.noMelee = true; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = Item.useTime = 20; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 8.5f; diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 68a9bd3f48..4114495689 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 912b7417a7..90ed8130eb 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -15,12 +15,11 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 60; - Item.damage = 120; + Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.useTurn = true; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.knockBack = 6f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; @@ -30,12 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 5f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI); - return false; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 300); diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index 49cf9686b6..7af3af3ddc 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -21,10 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 94; Item.height = 92; Item.DamageType = DamageClass.Melee; - Item.damage = 675; + Item.damage = 325; Item.knockBack = 2.5f; - Item.useAnimation = 10; - Item.useTime = 10; + Item.useAnimation = Item.useTime = 10; Item.autoReuse = true; Item.useTurn = true; @@ -47,12 +46,11 @@ namespace CalamityMod.Items.Weapons.Melee // Center projectile int centerID = ModContent.ProjectileType(); - int centerDamage = (damage / 2); - Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, centerID, damage, knockback, player.whoAmI); - // Side projectiles (these deal 75% damage) + // Side projectiles (these deal 50% damage) int sideID = ModContent.ProjectileType(); - int sideDamage = ((int)(0.75f * centerDamage) / 2); + int sideDamage = (int)(0.5f * damage); Vector2 originalVelocity = velocity; velocity.Normalize(); velocity *= 22f; diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index a132edf541..e06c27c50e 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Systems.Collections; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,11 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle BlowSound = new("CalamityMod/Sounds/Item/FuguBlow") { PitchVariance = 0.1f }; - public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + public override void SetStaticDefaults() + { + ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Poisoned]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 37450611ee..0cb494645a 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -1,7 +1,10 @@ -using CalamityMod.Items.BaseItems; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Basher : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 56; @@ -27,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; } public override bool MeleePrefix() => true; public override bool CanUseItem(Player player) => false; diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index ab15acffd1..1ef5c6040c 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 56; Item.height = 56; - Item.damage = 42; + Item.damage = 35; Item.knockBack = 3f; - Item.useTime = 53; - Item.useAnimation = 53; + Item.useAnimation = Item.useTime = 53; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index 978212c6eb..7a988b3e8e 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,12 +12,16 @@ namespace CalamityMod.Items.Weapons.Melee public class BlightedCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Venom]; + } public override void SetDefaults() { Item.width = 88; Item.height = 88; - Item.damage = 90; + Item.damage = 52; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; @@ -34,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float adjustedItemScale = player.GetAdjustedItemScale(Item); - Projectile.NewProjectile(source, player.MountedCenter, velocity, type, (int)(damage * 0.75), knockback * 0.5f, player.whoAmI, (float)player.direction * player.gravDir, 32f, adjustedItemScale); + Projectile.NewProjectile(source, player.MountedCenter, velocity, type, damage, knockback * 0.5f, player.whoAmI, (float)player.direction * player.gravDir, 32f, adjustedItemScale); NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); return false; } @@ -88,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(ItemID.ChlorophyteBar, 15). + AddIngredient(ItemID.ChlorophyteBar, 10). AddIngredient(ItemID.VialofVenom, 10). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index a84839d1e6..ab138d4ded 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -1,5 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +12,16 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public const int BaseDamage = 55; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), BuffID.Venom]; + } public override void SetDefaults() { Item.width = 32; Item.height = 32; Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = Item.useTime = 23; Item.damage = BaseDamage; Item.DamageType = DamageClass.MeleeNoSpeed; Item.knockBack = 7f; diff --git a/Items/Weapons/Melee/BotanicPiercer.cs b/Items/Weapons/Melee/BotanicPiercer.cs index 1d67b9f7ff..c97ee2bb6f 100644 --- a/Items/Weapons/Melee/BotanicPiercer.cs +++ b/Items/Weapons/Melee/BotanicPiercer.cs @@ -21,14 +21,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 112; Item.height = 112; - Item.damage = 110; + Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 17; + Item.useAnimation = Item.useTime = 17; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 17; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 39a841fea3..b5d2069700 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Brimlash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = Item.height = 72; @@ -50,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(4). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index 35e119edbf..0afbb31bc6 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index c4503e4546..2e91a5381e 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -34,16 +34,16 @@ namespace CalamityMod.Items.Weapons.Melee #region stats public static int BaseDamage = 38; - public static int DefaultAttunement_BaseDamage = 38; + public static int DefaultAttunement_BaseDamage = 34; - public static int EvilAttunement_BaseDamage = 50; + public static int EvilAttunement_BaseDamage = 45; public static int EvilAttunement_Lifesteal = 2; public static int EvilAttunement_BounceIFrames = 10; - public static int ColdAttunement_BaseDamage = 40; + public static int ColdAttunement_BaseDamage = 38; public static float ColdAttunement_ThirdSwingBoost = 1.15f; - public static int HotAttunement_BaseDamage = 42; + public static int HotAttunement_BaseDamage = 38; public static int HotAttunement_ShredPlayerIFrames = 6; public static int HotAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 public static float HotAttunement_ShredDecayRate = 1f; //How much charge is lost per frame. @@ -183,7 +183,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { - damage += (mainAttunement?.DamageMultiplier ?? 1f) - 1f; + damage *= (mainAttunement?.DamageMultiplier ?? 1f); } public void SafeCheckAttunements() diff --git a/Items/Weapons/Melee/BurningRevelation.cs b/Items/Weapons/Melee/BurningRevelation.cs index 2770675015..02713762c5 100644 --- a/Items/Weapons/Melee/BurningRevelation.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -23,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 97b34b6923..de9c9830d0 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Carnage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index 8a7863cb4e..7e4397dfc8 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class CelestialClaymore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2, BuffID.Ichor]; + } public override void SetDefaults() { Item.width = 80; diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 303ec17ba6..a92b7a305c 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 92; Item.height = 94; - Item.damage = 48; + Item.damage = 45; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 38; @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.MeteoriteBar, 20). AddIngredient(4). - AddIngredient(12). AddIngredient(ItemID.FallenStar, 5). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index b9a87ab485..6ed3d02f68 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class CosmicDischarge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 0c5bdfb0f6..fbb0ee09d2 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class CosmicShiv : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 44; @@ -37,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(8). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index f09743e25f..d028eca339 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -50,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.BlueMoon). AddIngredient(8). - AddIngredient(3). - AddIngredient(16). + AddIngredient(4). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 62b7bcfe59..a98384a00b 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,21 +16,21 @@ namespace CalamityMod.Items.Weapons.Melee internal const float ShootSpeed = 2f; - internal const float ProjectileDamageMultiplier = 0.8f; - - internal const float TrueMeleeSlashProjectileDamageMultiplier = 0.8f; - - internal const float SlashProjectileDamageMultiplier = 0.4125f; // Makes them do 33% damage since main projectile does 80% damage + internal const float SlashProjectileDamageMultiplier = 0.33f; internal const int SlashProjectileLimit = 4; internal const int SlashCreationRate = 18; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 92; Item.height = 100; - Item.damage = 75; + Item.damage = 60; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; @@ -53,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction velocity = (Main.MouseWorld - position).SafeNormalize(Vector2.UnitY) * ShootSpeed; type = Main.rand.NextBool() ? type : ModContent.ProjectileType(); - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * ProjectileDamageMultiplier), knockback * ProjectileDamageMultiplier, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index 8468e0ba75..d5286e12bf 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -14,16 +14,11 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public const int RiftLifeTime = 600; - - public const float OrbitalScytheDamageMult = 0.4f; - + public const float OrbitalScytheDamageMult = 0.3f; public const float RiftScytheDamageMult = 0.125f; - public const int RiftOrbitalAmount = 4; - public const int ScytheShotAmount = 4; - public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; @@ -33,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 70; Item.height = 70; - Item.damage = 700; + Item.damage = 500; Item.knockBack = 9f; Item.useAnimation = Item.useTime = 24; Item.DamageType = DamageClass.Melee; @@ -96,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = velocity.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.2f), knockback, player.whoAmI); } // Tell the rift(s) to shoot diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index 54b6418ceb..ae3aef26da 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -21,12 +22,16 @@ namespace CalamityMod.Items.Weapons.Melee public const float ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile = 8f; public const float ShootSpeed = 16f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Venom]; + } public override void SetDefaults() { Item.width = 102; Item.height = 102; - Item.damage = 119; + Item.damage = 111; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; @@ -132,8 +137,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(15). + AddIngredient(10). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/DepthCrusher.cs b/Items/Weapons/Melee/DepthCrusher.cs index fbae45ccaa..1b475aa4c1 100644 --- a/Items/Weapons/Melee/DepthCrusher.cs +++ b/Items/Weapons/Melee/DepthCrusher.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +10,10 @@ namespace CalamityMod.Items.Weapons.Melee public class DepthCrusher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 5dc6a6ce9f..117748c85f 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -1,9 +1,11 @@ -using CalamityMod.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +20,14 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public int throwCount = 0; + + public static int BigSlashDamageMult = 10; + public static float MarkDamageMult = 1.5f; // Multiplied on top of the big slash mult + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 118; @@ -75,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) { - Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 15, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 30x damage. + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * BigSlashDamageMult, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 30x damage. } } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index e9c89a9a0c..9862d325a9 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Crags; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class DevilsSunrise : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { @@ -48,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.Terragrim). - AddIngredient(25). + AddIngredient(50). AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index 844dcbba6a..035b9e70ee 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class DraconicDestruction : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), BuffID.Oiled, BuffID.Slimed]; + } public override void SetDefaults() { Item.width = 90; @@ -56,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/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index d1e27ec1d4..64adc9d3bc 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -24,10 +24,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 76; Item.height = 82; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 660; + Item.damage = 333; Item.knockBack = 9f; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = Item.useTime = 20; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/DriftwoodSword.cs b/Items/Weapons/Melee/DriftwoodSword.cs index ffda7cc8d6..62c8348e65 100644 --- a/Items/Weapons/Melee/DriftwoodSword.cs +++ b/Items/Weapons/Melee/DriftwoodSword.cs @@ -12,18 +12,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 14; + Item.CloneDefaults(ItemID.ShadewoodSword); // Driftwood (base) = Shadewood Item.width = 42; Item.height = 46; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 4f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = true; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -32,9 +23,9 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.MagnetSphere); } - public override float UseSpeedMultiplier(Player player) => player.Calamity().countsAsAnyWet ? 1.66f : 1f; + public override float UseSpeedMultiplier(Player player) => player.Calamity().countsAsAnyWet ? 1.25f : 1f; - public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += player.Calamity().countsAsAnyWet ? 1.5f : 0f; + public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback.Base += player.Calamity().countsAsAnyWet ? 1.25f : 0f; public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 24d310a7ab..58cd6afbea 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,6 +18,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Earth : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 186; @@ -70,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/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index 7db0bd93f5..a9438cd2bf 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 07a926f727..75543894b5 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -17,13 +17,12 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 18; Item.height = 20; - Item.damage = 130; + Item.damage = 110; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 7d6a21fa2c..a5d200ed3e 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee public class EssenceFlayer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 100; @@ -60,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 596829a8c7..75b084b8bc 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 64; Item.height = 66; Item.damage = 200; - Item.DamageType = AverageDamageClass.Instance; + Item.DamageType = AllClassDamageClass.Instance; //Allow it to proc all class on hit effects Item.useAnimation = Item.useTime = 120; Item.channel = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 7b24615dc9..7752464b70 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -1,8 +1,10 @@ -using CalamityMod.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -17,6 +19,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public int throwCount = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 88; @@ -90,7 +96,6 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(8). AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index eb971fdb5b..a37774f664 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -1,7 +1,9 @@ using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -51,6 +53,10 @@ namespace CalamityMod.Items.Weapons.Melee public static int BaseUseTime = 49; public static int BeamsPerSwing = 4; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/FallenPaladinsHammer.cs b/Items/Weapons/Melee/FallenPaladinsHammer.cs index 4f655380f6..3bdae47fdb 100644 --- a/Items/Weapons/Melee/FallenPaladinsHammer.cs +++ b/Items/Weapons/Melee/FallenPaladinsHammer.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +12,15 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static float Speed = 27f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() - { Item.width = 14; Item.height = 28; - Item.damage = 368; + Item.damage = 315; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; @@ -35,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.PaladinsHammer). AddIngredient(). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FaultLine.cs b/Items/Weapons/Melee/FaultLine.cs index 28a6fd39e3..1e66ee50af 100644 --- a/Items/Weapons/Melee/FaultLine.cs +++ b/Items/Weapons/Melee/FaultLine.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; } public override void SetDefaults() @@ -49,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 4822393f51..956a44edeb 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class FeralthornClaymore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom]; + } public override void SetDefaults() { Item.width = 68; @@ -54,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 05ef94c203..e84720bddb 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -10,10 +11,14 @@ namespace CalamityMod.Items.Weapons.Melee public class FlarefrostBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2]; + } public override void SetDefaults() { - Item.width = 64; - Item.height = 66; + Item.width = 82; + Item.height = 90; Item.damage = 125; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 29; @@ -62,9 +67,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.HellstoneBar, 8). - AddIngredient(ItemID.SoulofLight, 3). + AddIngredient(10). + AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.SoulofLight, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FlarefrostBlade.png b/Items/Weapons/Melee/FlarefrostBlade.png index dedd00ceb0..d9f2c33caf 100644 Binary files a/Items/Weapons/Melee/FlarefrostBlade.png and b/Items/Weapons/Melee/FlarefrostBlade.png differ diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 1f474602f8..b98dd6c086 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -1,8 +1,10 @@ -using CalamityMod.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,6 +18,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public int throwCount = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 74; @@ -89,7 +95,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(5). + AddIngredient(8). AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index bc4f7501e2..8c1b78c6dc 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 46; - Item.height = 56; + Item.width = 66; + Item.height = 74; Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 15; diff --git a/Items/Weapons/Melee/ForsakenSaber.png b/Items/Weapons/Melee/ForsakenSaber.png index 950f44264d..50b0db511a 100644 Binary files a/Items/Weapons/Melee/ForsakenSaber.png and b/Items/Weapons/Melee/ForsakenSaber.png differ diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index 681c4a05ce..f8b2d163c6 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -169,12 +169,14 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; - return true; + Projectile blade = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * mainAttunement.DamageMultiplier); + return false; } public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { - damage += (mainAttunement?.DamageMultiplier ?? 1f) - 1f; + damage *= (mainAttunement?.DamageMultiplier ?? 1f); } public void SafeCheckAttunements() diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index bf19a29e79..3527447583 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -140,13 +140,13 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.EnchantedSword). - AddIngredient(5). + AddIngredient(10). AddRecipeGroup("AnyCopperBar", 10). AddTile(TileID.Anvils). Register(); CreateRecipe(). AddIngredient(ItemID.Terragrim). - AddIngredient(5). + AddIngredient(10). AddRecipeGroup("AnyCopperBar", 10). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 71bccf18c8..4d37a1313d 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 623a1e3b37..34aa0cee4b 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -131,11 +131,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.StarWrath). + AddIngredient(5). AddIngredient(10). - AddIngredient(ItemID.FragmentSolar, 5). - AddIngredient(ItemID.FragmentVortex, 5). - AddIngredient(ItemID.FragmentNebula, 5). - AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/GalaxySmasher.cs b/Items/Weapons/Melee/GalaxySmasher.cs index ab92c89cd3..c2ffc4558f 100644 --- a/Items/Weapons/Melee/GalaxySmasher.cs +++ b/Items/Weapons/Melee/GalaxySmasher.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -15,6 +17,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static float Speed = 35f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/GalaxySmasher.png b/Items/Weapons/Melee/GalaxySmasher.png index 9b40695ec7..6f43040182 100644 Binary files a/Items/Weapons/Melee/GalaxySmasher.png and b/Items/Weapons/Melee/GalaxySmasher.png differ diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 0f9a59b975..465854b9ee 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -69,8 +69,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.Gladius). AddIngredient(8). - AddIngredient(5). - AddIngredient(15). + AddIngredient(4). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index 5747f80feb..8f1e8dfd36 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index 6014501a47..bd4e82ee73 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -1,4 +1,8 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Systems.Collections; using Terraria; @@ -13,6 +17,12 @@ namespace CalamityMod.Items.Weapons.Melee public override int ProjectileType => ModContent.ProjectileType(); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + base.SetStaticDefaults(); + CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + } public override bool SizeModifiers => false; public override void SetDefaults() { diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index cd2cf73cb4..7aa106132f 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -18,14 +18,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 54; Item.height = 54; - Item.damage = 31; + Item.damage = 26; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 25; Item.knockBack = 5.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -41,7 +40,6 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(10). - AddIngredient(ItemID.SunplateBlock, 4). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index 2adf365c8e..641d59cc06 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -29,15 +29,14 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 5777; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( + Item.damage = 5577; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = 77; - Item.useTime = 77; + Item.useAnimation = Item.useTime = 77; Item.useTurn = true; Item.knockBack = 77f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); Item.channel = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 34d63e2784..2cc6d412ee 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 78; Item.height = 78; - Item.damage = 280; + Item.damage = 225; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 20; @@ -164,8 +164,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.LunarBar, 7). + AddIngredient(ItemID.ShimmerBlock, 10). AddIngredient(). - AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 7311c1be59..61afff3b57 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -22,7 +24,10 @@ namespace CalamityMod.Items.Weapons.Melee internal const int TotalRows = 2; internal const int TotalTeeth = 3; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Wet, ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 62; diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index 089e30c529..d8026ed15f 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class HellfireFlamberge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 58; @@ -83,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 94a013896c..ea85b0c971 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,21 +12,20 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom]; ItemID.Sets.Spears[Type] = true; } - public override void SetDefaults() { Item.width = 64; Item.height = 64; - Item.damage = 85; + Item.damage = 100; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 20; Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 5cb216baa4..a27c40675f 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -25,14 +25,14 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 760; + Item.damage = 570; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 71; Item.useTurn = true; Item.knockBack = 13f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.channel = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 51133ffcf2..cc0d03f0e1 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.BaseItems; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,15 +17,18 @@ namespace CalamityMod.Items.Weapons.Melee public class HolyCollider : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 114; Item.height = 146; - Item.damage = 2900; + Item.damage = 2200; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = 45; + Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 45; Item.useTurn = true; Item.knockBack = 7.75f; Item.autoReuse = true; 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/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 8ccf621c19..f26a660a6f 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class InsidiousImpaler : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index e1007508fa..d0808f5ded 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -22,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -53,7 +56,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index ae3eeebd78..b1134b9e16 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Lightspeed.cs b/Items/Weapons/Melee/Lightspeed.cs index 28e525dd29..e43ef1598a 100644 --- a/Items/Weapons/Melee/Lightspeed.cs +++ b/Items/Weapons/Melee/Lightspeed.cs @@ -1,7 +1,9 @@ -using CalamityMod.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -16,11 +18,15 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public static int MaxEnergy = 100; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { - Item.width = 74; - Item.height = 94; + Item.width = 94; + Item.height = 92; Item.useStyle = ItemUseStyleID.Shoot; Item.damage = 200; Item.DamageType = TrueMeleeDamageClass.Instance; diff --git a/Items/Weapons/Melee/Lightspeed.png b/Items/Weapons/Melee/Lightspeed.png index 6fc05ab7e6..fef0720fcc 100644 Binary files a/Items/Weapons/Melee/Lightspeed.png and b/Items/Weapons/Melee/Lightspeed.png differ diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 0d1e6e1441..7e1889280e 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class LionHeart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index e2160af239..44b75f67cb 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 54; Item.height = 54; Item.useStyle = ItemUseStyleID.Shoot; - Item.damage = 132; + Item.damage = 124; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 34; Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 98046d1acc..c0fbf4639a 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 365; + Item.damage = 270; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = 50; - Item.useTime = 50; + Item.useAnimation = Item.useTime = 50; Item.useTurn = true; Item.knockBack = 12f; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index 74d26cb6f7..2aa0ee6693 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.BaseItems; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class MantisClaws : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Weapons/Melee/MawOfInfinity.cs b/Items/Weapons/Melee/MawOfInfinity.cs index 32073b2d56..5c68403adf 100644 --- a/Items/Weapons/Melee/MawOfInfinity.cs +++ b/Items/Weapons/Melee/MawOfInfinity.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,12 +20,13 @@ namespace CalamityMod.Items.Weapons.Melee public override int ProjectileType => ModContent.ProjectileType(); public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; base.SetStaticDefaults(); } public override void SetDefaults() { - Item.width = 78; - Item.height = 94; + Item.width = 74; + Item.height = 84; Item.damage = 2080; Item.DamageType = DamageClass.Melee; Item.useTime = Item.useAnimation = 33; diff --git a/Items/Weapons/Melee/MawOfInfinity.png b/Items/Weapons/Melee/MawOfInfinity.png index 077d762192..849fc2a04a 100644 Binary files a/Items/Weapons/Melee/MawOfInfinity.png and b/Items/Weapons/Melee/MawOfInfinity.png differ diff --git a/Items/Weapons/Melee/MawOfInfinityGlow.png b/Items/Weapons/Melee/MawOfInfinityGlow.png index 6525db49f3..0fa16f3476 100644 Binary files a/Items/Weapons/Melee/MawOfInfinityGlow.png and b/Items/Weapons/Melee/MawOfInfinityGlow.png differ diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 581bcc23f6..cf15358643 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,7 +1,10 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -28,6 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; base.SetStaticDefaults(); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/MonolithSword.cs b/Items/Weapons/Melee/MonolithSword.cs index a04e7b32fe..a4350a5406 100644 --- a/Items/Weapons/Melee/MonolithSword.cs +++ b/Items/Weapons/Melee/MonolithSword.cs @@ -18,18 +18,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 30; + Item.CloneDefaults(ItemID.PearlwoodSword); // Monolith >= Pearlwood Item.width = 40; Item.height = 46; - Item.DamageType = DamageClass.Melee; + Item.damage = 30; Item.useAnimation = Item.useTime = 7; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 4f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = true; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; Item.ArmorPenetration = ArmorPenetration; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 672286eabd..b1aa4ad348 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Mourningstar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index e8edf14bad..32254c62a1 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.Spears[Type] = true; } diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 4e680798df..b75794002b 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,14 +13,17 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 122; Item.height = 122; - Item.damage = 444; + Item.damage = 420; Item.knockBack = 9f; - Item.useTime = 65; - Item.useAnimation = 65; + Item.useAnimation = Item.useTime = 65; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 142c3e5f28..ca9d8bf80d 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,5 +1,8 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -11,15 +14,17 @@ 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() { ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -27,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; @@ -45,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/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 5afd75b448..64a581c198 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class OldLordClaymore : CustomUseProjItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index c41913c66d..df460ccd9b 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Weapons.Melee public bool OnHitProc = false; #region stats - public static int BaseDamage = 200; + public static int BaseDamage = 150; - public static int WhirlwindAttunement_BaseDamage = 120; + public static int WhirlwindAttunement_BaseDamage = 150; public static int WhirlwindAttunement_LocalIFrames = 20; //Remember its got one extra update public static float WhirlwindAttunement_EnergyDamageMult = 0.5f; public static float WhirlwindAttunement_BaseSwingDamageMult = 0.4f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int WhirlwindAttunement_PassiveBaseDamage = 80; - public static int SuperPogoAttunement_BaseDamage = 190; + public static int SuperPogoAttunement_BaseDamage = 200; public static int SuperPogoAttunement_PlayerShredIFrames = 8; public static int SuperPogoAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 public static float SuperPogoAttunement_ShotDamageMult = 2.5f; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Melee public static int SuperPogoAttunement_PassiveLifeSteal = 7; - public static int ShockwaveAttunement_BaseDamage = 550; + public static int ShockwaveAttunement_BaseDamage = 600; public static float ShockwaveAttunement_BeamDamageMult = 0.25f; public static int ShockwaveAttunement_DashHitIFrames = 20; public static float ShockwaveAttunement_FullChargeMult = 3.6f; @@ -245,7 +245,7 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null) return; - damage += (mainAttunement?.DamageMultiplier ?? 1f) - 1f; + damage *= (mainAttunement?.DamageMultiplier ?? 1f); } public void SafeCheckAttunements() @@ -315,8 +315,8 @@ namespace CalamityMod.Items.Weapons.Melee if (secondaryAttunement.id == AttunementID.FlailBlade && MeatHook == null) { - int damage = (int)player.GetTotalDamage().ApplyTo(FlailBladeAttunement_PassiveBaseDamage); - MeatHook = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ProjectileType(), damage, 0f, player.whoAmI); + MeatHook = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ProjectileType(), FlailBladeAttunement_PassiveBaseDamage, 0f, player.whoAmI); + MeatHook.originalDamage = FlailBladeAttunement_PassiveBaseDamage; } secondaryAttunement.PassiveEffect(player, source, ref UseTimer, ref OnHitProc, MeatHook); @@ -356,7 +356,9 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; - return true; + Projectile blade = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + blade.originalDamage = (int)MathF.Round(blade.originalDamage * mainAttunement.DamageMultiplier); + return false; } internal static ChargingEnergyParticleSet BiomeEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.White, Color.White, 0.04f, 20f); @@ -412,9 +414,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(3). - AddIngredient(3). - AddIngredient(). + AddIngredient(18). + AddIngredient(6). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 19639914f2..e293462460 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -1,5 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 99fbf3df9e..1d5ac85c5f 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,10 +34,14 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnTrueMeleeProj = true; public bool playSound = true; public float scaling = 1; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = Item.height = 112; - Item.damage = 800; + Item.damage = 700; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 1579b0affa..b0c7d81332 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,15 +11,18 @@ namespace CalamityMod.Items.Weapons.Melee public class PerfectDark : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; Item.height = 50; - Item.damage = 29; + Item.damage = 24; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 24; Item.useTurn = true; Item.knockBack = 4.25f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs index 85cfbce481..549a3ae63f 100644 --- a/Items/Weapons/Melee/PhosphorescentGauntlet.cs +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 40; - Item.damage = 2705; + Item.damage = 3200; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.crit = 10; Item.noMelee = true; diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index bf7fad3b44..be557346bb 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -1,8 +1,10 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 369c603161..e69e587111 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,7 +17,11 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetStaticDefaults() + { + Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index 0b0e47fa19..90ae943eee 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 66; - Item.damage = 150; + Item.damage = 140; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 4e6f6f1fcd..5cd02012b4 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; @@ -48,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index bf2b655d3a..b3df54f05a 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -15,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Melee public class RedSun : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 62; @@ -112,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/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 9be51a7c3a..2982d6c903 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,7 +15,11 @@ namespace CalamityMod.Items.Weapons.Melee public static int WitherDefenseReduction = 20; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(WitherDefenseReduction); - public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + } public override void SetDefaults() { Item.width = 44; diff --git a/Items/Weapons/Melee/Respiteblock.cs b/Items/Weapons/Melee/Respiteblock.cs index b7fff3656f..bff7e669c5 100644 --- a/Items/Weapons/Melee/Respiteblock.cs +++ b/Items/Weapons/Melee/Respiteblock.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Respiteblock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 108; diff --git a/Items/Weapons/Melee/Riptide.cs b/Items/Weapons/Melee/Riptide.cs index ddff94048a..0300a92ddd 100644 --- a/Items/Weapons/Melee/Riptide.cs +++ b/Items/Weapons/Melee/Riptide.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Melee.Yoyos; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.height = 48; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 14; + Item.damage = 12; Item.knockBack = 1f; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/Melee/SaharaSlicers.cs b/Items/Weapons/Melee/SaharaSlicers.cs index 415b9f6834..6cc1a949c4 100644 --- a/Items/Weapons/Melee/SaharaSlicers.cs +++ b/Items/Weapons/Melee/SaharaSlicers.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.damage = 23; + Item.damage = 20; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useTime = 12; - Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 12; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3.3f; Item.knockBack = 6f; @@ -49,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee if (player.Calamity().saharaSlicersBolts > 0) { SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce with { Pitch = 1.5f }, player.Center); - Projectile.NewProjectile(source, position, velocity * 2, ModContent.ProjectileType(), (int)(damage * 1.2), knockback * 1.2f, player.whoAmI, 1); + Projectile.NewProjectile(source, position, velocity * 2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); player.Calamity().saharaSlicersBolts--; } else diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index a68101c08b..2147e9fc62 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,20 +13,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { Item.width = 44; Item.height = 42; - Item.damage = 32; + Item.damage = 27; Item.DamageType = TrueMeleeDamageClass.Instance; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 20; Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs new file mode 100644 index 0000000000..ccce612bfc --- /dev/null +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SeashineSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetDefaults() + { + Item.CloneDefaults(ItemID.EnchantedSword); + Item.width = 40; + Item.height = 40; + Item.useTime = 40; + Item.damage = 22; + Item.DamageType = DamageClass.Melee; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.knockBack = 4f; + Item.shootSpeed = 12f; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(7). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/SeashineSword.png b/Items/Weapons/Melee/SeashineSword.png new file mode 100644 index 0000000000..ec74860678 Binary files /dev/null and b/Items/Weapons/Melee/SeashineSword.png differ diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 8fb360e91a..4878d64fc1 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +16,11 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle ThrowSound = new("CalamityMod/Sounds/Item/SwingMid") { Volume = 0.5f, Pitch = -0.35f, PitchVariance = 0.1f }; public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact") { Volume = 0.5f, Pitch = 0.2f, PitchVariance = 0.2f }; public static readonly SoundStyle ShatterSound = new("CalamityMod/Sounds/Item/BlazingCoreParry") { Volume = 0.4f, PitchVariance = 0.2f }; - public static readonly SoundStyle LightShatterSound = new("CalamityMod/Sounds/NPCKilled/CrownJewelShatter") { Pitch = 0.4f, PitchVariance = 0.3f }; + public static readonly SoundStyle LightShatterSound = new("CalamityMod/Sounds/NPCKilled/CrownJewelShatter") { Pitch = 0.4f, PitchVariance = 0.3f }; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index 464e024176..17f2385ac2 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; @@ -48,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/SkytideDragoon.cs b/Items/Weapons/Melee/SkytideDragoon.cs index fea9b76093..8815a58f7b 100644 --- a/Items/Weapons/Melee/SkytideDragoon.cs +++ b/Items/Weapons/Melee/SkytideDragoon.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SkytideDragoon : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 86; diff --git a/Items/Weapons/Melee/SolsticeClaymore.cs b/Items/Weapons/Melee/SolsticeClaymore.cs index 8435cf73c5..ccaf184cfd 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -15,11 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 86; - Item.damage = 300; + Item.damage = 235; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 16; Item.useTurn = true; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; @@ -76,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.BeamSword). - AddIngredient(20). + AddIngredient(18). AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.FragmentSolar, 5). AddIngredient(ItemID.FragmentStardust, 5). diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 5e96d09f84..6db0163d71 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,11 +14,15 @@ namespace CalamityMod.Items.Weapons.Melee public class SoulHarvester : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.CursedInferno, ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 62; Item.height = 64; - Item.damage = 85; + Item.damage = 77; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index f5c2304a8f..32b3d232f3 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SpineOfThanatos : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = Item.height = 28; diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index 8dc323f208..0ad67fd9a5 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; ItemID.Sets.Spears[Type] = true; } @@ -18,14 +20,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 72; Item.height = 72; - Item.damage = 110; + Item.damage = 80; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 23; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 23; Item.knockBack = 6; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index e272cb9e2a..6ff57decaf 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static float Speed = 30f; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 74; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 9445abfed3..8bcd9d1bc3 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.BaseItems; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,12 +10,15 @@ namespace CalamityMod.Items.Weapons.Melee public class StellarStriker : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 100; Item.height = 118; - Item.damage = 123; + Item.damage = 100; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 28; diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index 9bb6c6e6e5..9cb54e2412 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class StormRuler : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 80; diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 723257bc87..22daf62b0a 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,11 +12,15 @@ namespace CalamityMod.Items.Weapons.Melee public class StormSaber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; Item.height = 64; - Item.damage = 50; + Item.damage = 38; Item.DamageType = DamageClass.Melee; Item.useTime = Item.useAnimation = 23; Item.useTurn = true; diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 759d565a3d..3fe98fa071 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,7 +20,10 @@ namespace CalamityMod.Items.Weapons.Melee public const int SpearFireTime = 24; public const int PortalLifetime = 30; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 100; @@ -51,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index d2c61af5a5..11eb6c8190 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SubmarineShocker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index 91e8f8d9e9..300a79e127 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -15,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 56f33d455a..8ef0354eb1 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,15 +10,18 @@ namespace CalamityMod.Items.Weapons.Melee public class TeardropCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 54; Item.height = 76; - Item.damage = 38; + Item.damage = 33; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 24; Item.useTurn = true; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index 9721c5f584..cea7bfd71a 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index f2abc131a5..7cdd7b6db4 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -38,10 +38,9 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 60; Item.height = 66; - Item.damage = 145; + Item.damage = 120; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 21; - Item.useTime = 21; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 7f; @@ -60,8 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.TerraBlade). - AddIngredient(7). - AddIngredient(9). + AddIngredient(18). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Terratomere.png b/Items/Weapons/Melee/Terratomere.png index a7c34d324c..254ee9cc9d 100644 Binary files a/Items/Weapons/Melee/Terratomere.png and b/Items/Weapons/Melee/Terratomere.png differ diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 2a95e484ab..f9e148a210 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Slimed]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; @@ -48,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 615a5ccb20..740a392bdf 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -1,8 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee public class TheLastMourning : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 94; diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 3f71b02898..21a885b7e9 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,6 +20,10 @@ namespace CalamityMod.Items.Weapons.Melee public int DecayTimer = 0; public new string LocalizationCategory => "Items.Weapons.Melee"; public override int ProjectileType => ModContent.ProjectileType(); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 90; @@ -79,7 +85,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 3ade4726b1..6f22bde96d 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -1,8 +1,11 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -24,6 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; @@ -34,10 +38,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 42; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 400; + Item.damage = 370; Item.knockBack = 7.5f; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Melee/TheOracle.cs b/Items/Weapons/Melee/TheOracle.cs index ad16f5eeab..f56ce80071 100644 --- a/Items/Weapons/Melee/TheOracle.cs +++ b/Items/Weapons/Melee/TheOracle.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.Localization; @@ -21,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; diff --git a/Items/Weapons/Melee/TitanArm.cs b/Items/Weapons/Melee/TitanArm.cs index 425acf6f3a..9e3769350d 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 46; Item.height = 58; - Item.damage = 69; + Item.damage = 200; Item.crit = 100; Item.knockBack = 80f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. - Item.useAnimation = Item.useTime = 12; + Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.autoReuse = true; @@ -31,6 +31,13 @@ namespace CalamityMod.Items.Weapons.Melee YeetEnemies(player, target, hit.Crit); } + public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + float critDamage = player.GetTotalCritChance(Item.DamageType) * 0.02f; + modifiers.CritDamage += critDamage; + } + public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { target.AddBuff(ModContent.BuffType(), 300); 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/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 965503a687..0e6047b246 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 72; - Item.damage = 130; + Item.damage = 100; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 0082fe6841..3ed2204089 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -48,23 +48,23 @@ namespace CalamityMod.Items.Weapons.Melee public static float EvilAttunement_SlashDamageBoost = 3f; public static int EvilAttunement_SlashIFrames = 60; - public static int ColdAttunement_BaseDamage = 140; + public static int ColdAttunement_BaseDamage = 105; public static float ColdAttunement_ThirdSwingBoost = 1.25f; public static float ColdAttunement_MistDamageReduction = 0.11f; - public static int HotAttunement_BaseDamage = 115; + public static int HotAttunement_BaseDamage = 105; public static int HotAttunement_PlayerShredIFrames = 8; public static float HotAttunement_ShotDamageBoost = 4.5f; public static int HotAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 public static float HotAttunement_ShredDecayRate = 0.65f; //How much charge is lost per frame. - public static int TropicalAttunement_BaseDamage = 132; + public static int TropicalAttunement_BaseDamage = 115; public static float TropicalAttunement_ChainDamageReduction = 0.6f; public static float TropicalAttunement_VineDamageReduction = 0.3f; public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.5f; //It also crits, so be mindful of that public static int TropicalAttunement_LocalIFrames = 60; //Be warned its got 2 extra updates so all the iframes should be divided in 3 - public static int HolyAttunement_BaseDamage = 88; + public static int HolyAttunement_BaseDamage = 100; public static float HolyAttunement_BaseSwingDamageMult = 0.5f; public static float HolyAttunement_FullSwingDamageMult = 1f; public static float HolyAttunement_ThrowDamageBoost = 3f; @@ -207,7 +207,7 @@ namespace CalamityMod.Items.Weapons.Melee if (mainAttunement == null) return; - damage += (mainAttunement?.DamageMultiplier ?? 1f) - 1f; + damage *= (mainAttunement?.DamageMultiplier ?? 1f); } public void SafeCheckAttunements() diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index ec82471f8a..703a85dd56 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.Sunfury). - AddIngredient(ItemID.AncientCloth, 5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index cb45e00330..b328e8f134 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class TyphonsGreed : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 32c44c88ba..8c304f867a 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class UltimusCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 72; diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index b41bea3fbe..23fe817f40 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +13,11 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Melee/VanishingPoint.cs b/Items/Weapons/Melee/VanishingPoint.cs index 5b4f875482..f89ca11f3c 100644 --- a/Items/Weapons/Melee/VanishingPoint.cs +++ b/Items/Weapons/Melee/VanishingPoint.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/VanishingPoint.png b/Items/Weapons/Melee/VanishingPoint.png index bbf16bd646..0415214359 100644 Binary files a/Items/Weapons/Melee/VanishingPoint.png and b/Items/Weapons/Melee/VanishingPoint.png differ diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index 3da0ed1b9e..80b5b46c21 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,15 +11,18 @@ namespace CalamityMod.Items.Weapons.Melee public class VeinBurster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 52; Item.height = 50; - Item.damage = 45; + Item.damage = 38; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 41; + Item.useAnimation = Item.useTime = 41; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 41; Item.useTurn = true; Item.knockBack = 4.25f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/VulcaniteLance.cs b/Items/Weapons/Melee/VulcaniteLance.cs index b61b432b67..f92e908d6c 100644 --- a/Items/Weapons/Melee/VulcaniteLance.cs +++ b/Items/Weapons/Melee/VulcaniteLance.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; } public override void SetDefaults() diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 1be0c3f0b6..1bfa238653 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,15 +13,18 @@ namespace CalamityMod.Items.Weapons.Melee public class WindBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; Item.height = 58; - Item.damage = 38; + Item.damage = 30; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; + Item.useTime = Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.useTurn = true; Item.knockBack = 5f; Item.UseSound = SoundID.Item1; @@ -32,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage / 2, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage * 6 / 10, knockback, player.whoAmI); return false; } @@ -45,8 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index 9a88f1eec0..93be1a7e95 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Poisoned]; // Flail already does half damage. No tooltip mutliplier required. } diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index b3a233e150..4291fef569 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/AcidwoodBow.cs b/Items/Weapons/Ranged/AcidwoodBow.cs index f5e8ce8ea4..1298ddd35f 100644 --- a/Items/Weapons/Ranged/AcidwoodBow.cs +++ b/Items/Weapons/Ranged/AcidwoodBow.cs @@ -9,22 +9,11 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 8; - Item.DamageType = DamageClass.Ranged; + Item.CloneDefaults(ItemID.ShadewoodBow); // Ash Wood > Acidwood > Shadewood Item.width = 20; Item.height = 50; - Item.useTime = 27; - Item.useAnimation = 27; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.WoodenArrowFriendly; - Item.shootSpeed = 6.6f; - Item.useAmmo = AmmoID.Arrow; + Item.damage = 9; + Item.useAnimation = Item.useTime = 27; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 6defc4c398..4dc658ece9 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -67,15 +67,12 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 1.35f), knockback, player.whoAmI); + int proj = Projectile.NewProjectile(spawnSource, source + offset, velocity, newType, (int)(damage * 1.35f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].extraUpdates += 1; } else - { - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs new file mode 100644 index 0000000000..a8ee5c25f4 --- /dev/null +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AquashardShotgun : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.width = 62; + Item.height = 26; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.useAmmo = AmmoID.Bullet; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + for (int index = 0; index < 2; ++index) + { + float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; + + if (type == ProjectileID.Bullet) + { + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Main.projectile[projectile].timeLeft = 200; + } + else + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Boomstick). + AddIngredient(2). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/AquashardShotgun.png b/Items/Weapons/Ranged/AquashardShotgun.png new file mode 100644 index 0000000000..516b1fa7cc Binary files /dev/null and b/Items/Weapons/Ranged/AquashardShotgun.png differ diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index bacb49e7ed..8fc81ec21b 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -53,10 +53,9 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + Main.rand.Next(-spread, spread + 1) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-spread, spread + 1) * 0.05f; - int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockback * arrowScale, player.whoAmI); - Main.projectile[proj].scale = arrowScale; - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].noDropItem = true; + Projectile arrow = Projectile.NewProjectileDirect(source, position, new Vector2(SpeedX, SpeedY), type, (int)(damage * arrowScale), knockback * arrowScale, player.whoAmI); + arrow.scale = arrowScale; + arrow.extraUpdates += 1; } totalProjectiles++; diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 049bc504b1..492cb34a2b 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 33; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Wet, ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index aee4c0087e..e86945b1fe 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Ranged velocity = position.DirectionTo(Main.MouseWorld) * velocity.Length()*2; type = ModContent.ProjectileType(); Projectile shotArrow = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); - shotArrow.noDropItem = true; shotArrow.tileCollide = false; (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; shotArrow.Calamity().conditionalHomingRange = 175f; @@ -55,7 +54,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index eed33698bf..84af8eb4a7 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -15,11 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 24; - Item.damage = 120; + Item.damage = 150; Item.DamageType = DamageClass.Ranged; Item.crit = 25; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; @@ -47,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index fdc11428a1..c822108f08 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class AstrealDefeat : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 40; diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index f396e088ac..6af713f90c 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SniperRifle). - AddIngredient(5). + AddIngredient(10). AddIngredient(5). AddIngredient(50). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index 188376a253..5d35c3dcf0 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Barinautical : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 9264c360f9..998857649d 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index 0b06168605..bc278a0a96 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -120,8 +120,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + Main.rand.NextFloat(-3f, 3f); float SpeedY = velocity.Y + Main.rand.NextFloat(-3f, 3f); - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 arrowVel = velocity; @@ -170,7 +169,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 0e5d044d87..8ca3a3f0dc 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class BlissfulBombardier : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 88; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 35eabb4e58..160d988ff9 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -20,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; } public override void SetDefaults() @@ -62,7 +65,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index c4d586c689..c3445ed0cb 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class BrimstoneFury : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; @@ -40,12 +46,9 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - { - int proj = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + type = ModContent.ProjectileType(); + + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } @@ -53,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Buzzkill.cs b/Items/Weapons/Ranged/Buzzkill.cs index 0bf1b87ca8..604ab4aedb 100644 --- a/Items/Weapons/Ranged/Buzzkill.cs +++ b/Items/Weapons/Ranged/Buzzkill.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/ChromaticEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs index 8b5d134047..338835cb44 100644 --- a/Items/Weapons/Ranged/ChromaticEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,7 +20,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 50; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); - public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 83d1c7daac..26e1441a09 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -1,5 +1,8 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class ClamorRifle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 80a3ed689c..d29929e79c 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } 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/ContinentalGreatbow.cs b/Items/Weapons/Ranged/ContinentalGreatbow.cs index e82feae262..0a8e50ccf9 100644 --- a/Items/Weapons/Ranged/ContinentalGreatbow.cs +++ b/Items/Weapons/Ranged/ContinentalGreatbow.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,14 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public class ContinentalGreatbow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Ichor, BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 18; Item.height = 36; - Item.damage = 38; + Item.damage = 45; Item.DamageType = DamageClass.Ranged; - Item.useTime = 24; - Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; @@ -45,15 +49,12 @@ namespace CalamityMod.Items.Weapons.Ranged float offsetAmt = projIndex - (arrowAmt - 1f) / 2f; Vector2 offset = velocity.RotatedBy((double)(piOverTen * offsetAmt), default); if (!canHit) - { offset -= velocity; - } + if (CalamityUtils.CheckWoodenAmmo(type, player)) - { type = ProjectileID.FireArrow; - } - int baseArrow = Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); - Main.projectile[baseArrow].noDropItem = true; + + Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); } for (int i = 0; i < 2; i++) { @@ -64,10 +65,9 @@ namespace CalamityMod.Items.Weapons.Ranged ProjectileID.HellfireArrow, ProjectileID.IchorArrow }); - int index = Projectile.NewProjectile(spawnSource, position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; - Main.projectile[index].usesLocalNPCImmunity = true; - Main.projectile[index].localNPCHitCooldown = 10; + Projectile arrow = Projectile.NewProjectileDirect(spawnSource, position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockback, player.whoAmI); + arrow.usesLocalNPCImmunity = true; + arrow.localNPCHitCooldown = 10; } return false; } diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 8bc2e73088..a39022687c 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class CorrodedCaustibow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 7516999dd8..5804c8d40b 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -36,18 +36,17 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } - int projectile = Projectile.NewProjectile(source, position, velocity, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); - Main.projectile[projectile].penetrate = 3; + Projectile dart = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); + dart.penetrate = 3; return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index d5266a1a8c..32745f9693 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 142; Item.height = 64; - Item.damage = 41; + Item.damage = 45; Item.ArmorPenetration = 10; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/DriftwoodBow.cs b/Items/Weapons/Ranged/DriftwoodBow.cs index f25de79fa3..a8bfded9cc 100644 --- a/Items/Weapons/Ranged/DriftwoodBow.cs +++ b/Items/Weapons/Ranged/DriftwoodBow.cs @@ -12,29 +12,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 10; - Item.DamageType = DamageClass.Ranged; + Item.CloneDefaults(ItemID.ShadewoodBow); // Driftwood (base) = Shadewood Item.width = 22; Item.height = 42; - Item.useTime = 28; - Item.useAnimation = 28; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; - Item.rare = ItemRarityID.White; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.WoodenArrowFriendly; - Item.shootSpeed = 6.6f; - Item.useAmmo = AmmoID.Arrow; } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (player.Calamity().countsAsAnyWet) { - velocity *= 1.3f; + velocity *= 1.2f; knockback += 1f; for (int i = 0; i <= 18; i++) diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index 6fa526b7e7..bc251e3cad 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; } public override void SetDefaults() { @@ -38,9 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; - + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, player.whoAmI); return true; } } diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index d0b79472dc..c2ab5ea6c2 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Eviscerator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 6e437428fa..69acc217e6 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 66; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 76; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 76ccecc30f..23b247d1e1 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -34,7 +36,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int ClusterShrapnelAmount = 8; public static float ClusterShrapnelAngleOffset = MathHelper.PiOver2 + MathHelper.ToRadians(50f); #endregion - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 152; diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index 956f36a2e7..55e00acd97 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -27,6 +30,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int ClusterShrapnelAmount = 7; public static float ClusterShrapnelAngleOffset = 0.53f; #endregion + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index b5320a069d..79be3a1edd 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,14 +12,17 @@ namespace CalamityMod.Items.Weapons.Ranged public class FlarewingBow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 40; Item.height = 72; Item.damage = 31; Item.DamageType = DamageClass.Ranged; - Item.useTime = 41; - Item.useAnimation = 41; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -34,7 +38,6 @@ 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) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float tenthPi = 0.314159274f; Vector2 arrowVel = velocity; arrowVel.Normalize(); arrowVel *= 50f; @@ -42,21 +45,14 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 3; i++) { float piOffsetValue = (float)i - 1f; - Vector2 offsetSpawn = arrowVel.RotatedBy((double)(tenthPi * piOffsetValue), default); + Vector2 offsetSpawn = arrowVel.RotatedBy((double)(MathHelper.Pi * 0.1f * piOffsetValue), default); if (!arrowHitsTiles) - { offsetSpawn -= arrowVel; - } + if (CalamityUtils.CheckWoodenAmmo(type, player)) - { - int arrowSpawn = Projectile.NewProjectile(source, vector2.X + offsetSpawn.X, vector2.Y + offsetSpawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - Main.projectile[arrowSpawn].noDropItem = true; - } - else - { - int arrowSpawn = Projectile.NewProjectile(source, vector2.X + offsetSpawn.X, vector2.Y + offsetSpawn.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - Main.projectile[arrowSpawn].noDropItem = true; - } + type = ModContent.ProjectileType(); + + Projectile.NewProjectile(source, vector2 + offsetSpawn, velocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 3e1221e805..16a264daa9 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 50; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn, BuffID.Frozen]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs index e237779ec0..04fa82d119 100644 --- a/Items/Weapons/Ranged/FreedomStar.cs +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,16 +14,19 @@ namespace CalamityMod.Items.Weapons.Ranged public class FreedomStar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); Item.width = 54; Item.height = 28; - Item.damage = 100; + Item.damage = 120; Item.DamageType = DamageClass.Ranged; - Item.useTime = 10; - Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 9712968aa5..c9927ed0dd 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class FrostbiteBlaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index e6d5027ac3..90c21a16bf 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -44,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index b4ecc5f53c..6a2834a6b9 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Goobow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Slimed]; + } public override void SetDefaults() { Item.width = 32; @@ -58,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index 2db7216cbd..35a0e2ed99 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -50,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 791aaa307d..448ade2543 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -20,13 +21,13 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HalleysInfernoShoot") { Volume = 0.68f }; public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/HalleysInfernoHit") { Volume = 0.75f }; public static float MaxStarburstPerComet => 1; - public static float MaxStarburstPerStar => 0.5f; + public static float MaxStarburstPerStar => 0.25f; public static float LostAccuracyPerMiss => 4; public static float MaxAccuracy => 50; - public static float StarburstDmgMult => 2.5f; + public static float StarburstDmgMult => 2f; - public static float StarburstVelMult => 0.75f; + public static float StarburstVelMult => 1f; public override void SetDefaults() { Item.width = 84; @@ -59,6 +60,8 @@ namespace CalamityMod.Items.Weapons.Ranged ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); + public override void HoldItem(Player player) { if (player.mount.Type == MountID.Drill) @@ -84,9 +87,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.ElfMelter). - AddIngredient(6). + AddIngredient(8). AddIngredient(4). - AddIngredient(12). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index 18c4fd76dd..1fed8279be 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.RocketLauncher). AddRecipeGroup("IronBar", 50). AddIngredient(5). - AddIngredient(ItemID.TigerSkin). AddTile(TileID.MythrilAnvil). Register(); } 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/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 759c3af8c5..06b341f13b 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Helstorm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 50; @@ -60,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/HoarfrostBow.cs b/Items/Weapons/Ranged/HoarfrostBow.cs index 0fa9153c7b..1ae5c53d33 100644 --- a/Items/Weapons/Ranged/HoarfrostBow.cs +++ b/Items/Weapons/Ranged/HoarfrostBow.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class HoarfrostBow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 26; @@ -40,12 +46,9 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = velocity.Y + Main.rand.Next(-25, 26) * 0.05f; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - { - int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + type = ModContent.ProjectileType(); + + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 31f5298295..9d73cfc86c 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -1,6 +1,9 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -19,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index c4cbe5856e..e448a6163c 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -48,12 +48,9 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - { - int proj = Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + type = ModContent.ProjectileType(); + + Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 60283a1ddd..34bed5c572 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -39,12 +39,9 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - { - int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + type = ModContent.ProjectileType(); + + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 0dd35e7cab..d186f86242 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -44,14 +44,14 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedX = velocity.X + Main.rand.NextFloat(-0.5f, 0.5f); float SpeedY = velocity.Y + Main.rand.NextFloat(-0.5f, 0.5f); - int arrow = Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI); - Main.projectile[arrow].noDropItem = true; + Projectile arrow = Projectile.NewProjectileDirect(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI); + if (type == ProjectileID.JestersArrow) { - Main.projectile[arrow].localNPCHitCooldown = 12 * Main.projectile[arrow].MaxUpdates; - Main.projectile[arrow].usesLocalNPCImmunity = true; - Main.projectile[arrow].usesIDStaticNPCImmunity = false; - Main.projectile[arrow].tileCollide = false; + arrow.localNPCHitCooldown = 12 * arrow.MaxUpdates; + arrow.usesLocalNPCImmunity = true; + arrow.usesIDStaticNPCImmunity = false; + arrow.tileCollide = false; } return false; } @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Ectoplasm, 31). + AddIngredient(ItemID.Ectoplasm, 13). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index e2ef943057..e43b736e27 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,8 +1,9 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,7 +18,11 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public int sharkGunDamageScaling = 0; public static int AmmoSavedPercent = 50; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/MonolithBow.cs b/Items/Weapons/Ranged/MonolithBow.cs index be48baab00..88a67cf331 100644 --- a/Items/Weapons/Ranged/MonolithBow.cs +++ b/Items/Weapons/Ranged/MonolithBow.cs @@ -13,24 +13,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.damage = 19; - Item.DamageType = DamageClass.Ranged; + Item.CloneDefaults(ItemID.PearlwoodBow); // Monolith >= Pearlwood Item.width = 24; Item.height = 54; + Item.damage = 19; Item.useTime = 5; Item.useAnimation = 20; + Item.useLimitPerAnimation = 4; Item.reuseDelay = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.WoodenArrowFriendly; - Item.shootSpeed = 9f; - Item.useAmmo = AmmoID.Arrow; Item.consumeAmmoOnFirstShotOnly = true; + Item.shootSpeed = 9f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 519b914bea..ebe3e991a5 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -63,15 +63,12 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 1.1), knockback, player.whoAmI); + int proj = Projectile.NewProjectile(spawnSource, source + offset, velocity, newType, (int)(damage * 1.1), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].extraUpdates += 1; } else - { - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; - } + Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/NettlevineGreatbow.cs b/Items/Weapons/Ranged/NettlevineGreatbow.cs index 486f5f7cf7..29164dd3ae 100644 --- a/Items/Weapons/Ranged/NettlevineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlevineGreatbow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class NettlevineGreatbow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom]; + } public override void SetDefaults() { Item.width = 36; @@ -35,7 +40,6 @@ 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) { Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float tenthPi = 0.314159274f; Vector2 arrowVel = velocity; arrowVel.Normalize(); arrowVel *= 40f; @@ -43,13 +47,11 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 4; i++) { float piOffsetAmt = (float)i - 3f / 2f; - Vector2 offsetSpawn = arrowVel.RotatedBy((double)(tenthPi * piOffsetAmt), default); + Vector2 offsetSpawn = arrowVel.RotatedBy((double)(MathHelper.Pi * 0.1f * piOffsetAmt), default); if (!arrowHitsTiles) - { offsetSpawn -= arrowVel; - } - int arrowSpawn = Projectile.NewProjectile(source, vector2.X + offsetSpawn.X, vector2.Y + offsetSpawn.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - Main.projectile[arrowSpawn].noDropItem = true; + + Projectile.NewProjectile(source, vector2 + offsetSpawn, velocity, type, damage, knockback, player.whoAmI); } for (int i = 0; i < 2; i++) { @@ -66,8 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[index].noDropItem = true; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 5e1b8da3e9..32bb59d087 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType(), BuffID.Electrified]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/OmniGun.cs b/Items/Weapons/Ranged/OmniGun.cs index 8711433e00..4e626cac2d 100644 --- a/Items/Weapons/Ranged/OmniGun.cs +++ b/Items/Weapons/Ranged/OmniGun.cs @@ -1,10 +1,8 @@ using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged @@ -13,8 +11,6 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static int AmmoSavedPercent = 66; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); public override void SetDefaults() { Item.width = 118; @@ -33,11 +29,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.value = Item.buyPrice(platinum: 1); // Sold by Shady Salesman Item.rare = ItemRarityID.Yellow; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent; + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 2a68495738..46f4e9ad5d 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). + AddIngredient(ItemID.IllegalGunParts). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index 66e42a42cc..ef8f145ad3 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Systems.Collections; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -15,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 25; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Slimed]; + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 380832d89e..f8ee6256f7 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class PlanetaryAnnihilation : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; @@ -91,8 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float speedX4 = mouseXDist + Main.rand.Next(-120, 121) * 0.02f; float speedY5 = mouseYDist + Main.rand.Next(-120, 121) * 0.02f; - int num121 = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); - Main.projectile[num121].noDropItem = true; + Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); } } return false; diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index fa94b9ccb1..ba634aedc2 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.UseSound = null; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/ReedBlowgun.cs b/Items/Weapons/Ranged/ReedBlowgun.cs index 0a3672d8c9..31a1c71bed 100644 --- a/Items/Weapons/Ranged/ReedBlowgun.cs +++ b/Items/Weapons/Ranged/ReedBlowgun.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/Sandblaster.cs b/Items/Weapons/Ranged/Sandblaster.cs index b48742dd8c..3a011bec2d 100644 --- a/Items/Weapons/Ranged/Sandblaster.cs +++ b/Items/Weapons/Ranged/Sandblaster.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.Sandgun). - AddIngredient(ItemID.AncientCloth, 5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index eedf099b8c..1a318858b7 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +26,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int OriginalUseTime = 60; public static int TimeBetweenBursts = 10; public static int ProjectilesPerBurst = 4; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Oiled]; + } public override void SetDefaults() { Item.damage = 550; diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index c1b5fdcf3d..7531b70854 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,8 +1,10 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -18,6 +20,10 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public static int AmmoSavedPercent = 66; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index 11d8e3fa93..9ef2cbf177 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom, BuffID.Wet]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/Shardshocker.cs b/Items/Weapons/Ranged/Shardshocker.cs deleted file mode 100644 index c16a177347..0000000000 --- a/Items/Weapons/Ranged/Shardshocker.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class Shardshocker : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - public override void SetDefaults() - { - Item.width = 86; - Item.height = 44; - Item.damage = 115; - Item.DamageType = DamageClass.Ranged; - Item.crit = 6; - Item.useTime = 60; - Item.useAnimation = 60; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = null; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 50f; - } - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); - SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); - Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); - return false; - } - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(4, 1); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); - } - - // Recoil + Not having the gun aim downwards - public override void UseItemFrame(Player player) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - - float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; - float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.5) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - - - //Reloads the gun - if (animProgress > 0.5f) - { - float backArmRotation = rotation + 0.52f * player.direction; - - Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); - player.SetCompositeArmBack(true, stretch, backArmRotation); - } - - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(5). - AddIngredient(15). - AddIngredient(2). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/Shardshocker.png b/Items/Weapons/Ranged/Shardshocker.png deleted file mode 100644 index dc5fde0017..0000000000 Binary files a/Items/Weapons/Ranged/Shardshocker.png and /dev/null differ 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/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index fcb17bdbb2..1f33cb839c 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class SparkSpreader : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index d688e25497..cec54f549d 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -110,6 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.PainterPaintballGun). + AddIngredient(ItemID.IllegalGunParts). AddRecipeGroup("AnyMythrilBar", 5). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 739a788ce0..efae713b12 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(ItemID.Stynger). - AddIngredient(5). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index 9525263705..757de74974 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.useTime = 8; Item.useAnimation = 24; - Item.reuseDelay = 15; + Item.reuseDelay = Item.useTime; Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 0b06d218fa..dff15fdead 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -1,11 +1,13 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index e3e4ed312b..dcd630660f 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -1,10 +1,12 @@ -using CalamityMod.CalPlayer.Dashes; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -50,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 95bb662349..1d4b1b3fc4 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() 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/Ranged/TauCannon.cs b/Items/Weapons/Ranged/TauCannon.cs index 8b3fae30d1..c4c90395fd 100644 --- a/Items/Weapons/Ranged/TauCannon.cs +++ b/Items/Weapons/Ranged/TauCannon.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class TauCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 417ab80d6c..2ff0366f3e 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -22,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Main.RegisterItemAnimation(Type, new DrawAnimationVertical(3, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 17cf943732..9d2fa67877 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Marrow). AddIngredient(ItemID.AncientBattleArmorMaterial). - AddIngredient(ItemID.Ectoplasm, 10). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/TheBallista.png b/Items/Weapons/Ranged/TheBallista.png index 5ab9abf9ef..2857b1f82e 100644 Binary files a/Items/Weapons/Ranged/TheBallista.png and b/Items/Weapons/Ranged/TheBallista.png differ diff --git a/Items/Weapons/Ranged/TheBlunderbass.cs b/Items/Weapons/Ranged/TheBlunderbass.cs deleted file mode 100644 index dd5a0564ae..0000000000 --- a/Items/Weapons/Ranged/TheBlunderbass.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.FurnitureDriftwood; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - [LegacyName("AquashardShotgun")] - public class TheBlunderbass : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - public override void SetDefaults() - { - Item.width = 56; - Item.height = 26; - Item.damage = 35; - Item.DamageType = DamageClass.Ranged; - Item.crit = 6; - Item.useTime = 55; - Item.useAnimation = 55; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = null; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; - } - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); - SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); - Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); - return false; - } - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(4, 1); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); - } - - // Recoil + Not having the gun aim downwards - public override void UseItemFrame(Player player) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - - float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; - float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.5) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - - - //Reloads the gun - if (animProgress > 0.5f) - { - float backArmRotation = rotation + 0.52f * player.direction; - - Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); - player.SetCompositeArmBack(true, stretch, backArmRotation); - } - - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(15). - AddIngredient(3). - AddIngredient(7). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/TheBlunderbass.png b/Items/Weapons/Ranged/TheBlunderbass.png deleted file mode 100644 index 255af4609d..0000000000 Binary files a/Items/Weapons/Ranged/TheBlunderbass.png and /dev/null differ diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index 72066dce71..158da9bba6 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class TheMaelstrom : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index c3b443304c..f29cf548ed 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -19,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ItemID.Sets.AnimatesAsSoul[Type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 9)); + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; } public override void SetDefaults() { @@ -57,12 +59,11 @@ namespace CalamityMod.Items.Weapons.Ranged if (CalamityUtils.CheckWoodenAmmo(type, player)) { - Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, ModContent.ProjectileType(), (int)(damage * (i == 0 ? 1.5f : 1f)), knockback, -1, i == 0 ? 5 : 0); + Projectile.NewProjectile(source, arrowSpawnPos, arrowVel, ModContent.ProjectileType(), (int)(damage * (i == 0 ? 1.5f : 1f)), knockback, -1, i == 0 ? 5 : 0); } else { Projectile arrow1 = Projectile.NewProjectileDirect(source, arrowSpawnPos, arrowVel, i == 0 ? ModContent.ProjectileType() : type, damage, knockback); - arrow1.noDropItem = true; arrow1.tileCollide = false; } } diff --git a/Items/Weapons/Ranged/ThermoclineBlaster.cs b/Items/Weapons/Ranged/ThermoclineBlaster.cs index d13b3ae62f..bddee23c01 100644 --- a/Items/Weapons/Ranged/ThermoclineBlaster.cs +++ b/Items/Weapons/Ranged/ThermoclineBlaster.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; public bool swapType = false; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Ranged/ThreadOfEradication.cs b/Items/Weapons/Ranged/ThreadOfEradication.cs index fb9c7c7ffc..96597be9d2 100644 --- a/Items/Weapons/Ranged/ThreadOfEradication.cs +++ b/Items/Weapons/Ranged/ThreadOfEradication.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Magic; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Typeless; @@ -18,6 +19,11 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 40; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 82e09e2fc7..227ccc907e 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -20,6 +22,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); public const float FullChargeTime = 420f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 44; diff --git a/Items/Weapons/Ranged/VernalBolter.cs b/Items/Weapons/Ranged/VernalBolter.cs index f105614251..68d511017b 100644 --- a/Items/Weapons/Ranged/VernalBolter.cs +++ b/Items/Weapons/Ranged/VernalBolter.cs @@ -55,12 +55,13 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), (int)(damage * 1.2), knockback * 1.2f, player.whoAmI); - else { - int proj = Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); - Main.projectile[proj].noDropItem = true; + type = ModContent.ProjectileType(); + damage = (int)(damage * 1.2); + knockback *= 1.2f; } + + Projectile.NewProjectile(spawnSource, source + offset, velocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index b1594cb421..06d88ad8c8 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -1,6 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -19,7 +22,10 @@ namespace CalamityMod.Items.Weapons.Ranged public int sharkGunDamageScaling = 0; public static int AmmoSavedPercent = 66; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 96; diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 1fd2a9cfc4..62f3c256d5 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -1,6 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Apoctolith : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 38d580285a..8a0a47e69b 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice / 4; // This buy price is intentionally reduced due to how common this item is. + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Rogue/AshenStalactite.png b/Items/Weapons/Rogue/AshenStalactite.png index 7eda8b46b2..2ddb0b93b3 100644 Binary files a/Items/Weapons/Rogue/AshenStalactite.png and b/Items/Weapons/Rogue/AshenStalactite.png differ diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index 5eecae653c..e2d78a8a40 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class BlastBarrel : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 48; diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 10e95bab7c..30d2d10d08 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.shootSpeed = 13f; diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 6c1da5bf6e..0949dd04a3 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Ben || Termi { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 66; @@ -43,7 +49,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(12). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index a6cd12bcf6..7d2fe567fc 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Brimblade : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 26; @@ -54,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index cb42af2674..034cfbc95a 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CorpusAvertor : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 7e3bd1a7b3..db863c5e58 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,17 +14,23 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CosmicKunai : RogueWeapon { + private bool stealthSalvo = false; + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { 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; @@ -34,22 +42,30 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.5f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + Projectile kunai = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable()) { - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = 3; + stealthSalvo = true; + kunai.Calamity().stealthStrike = true; + kunai.penetrate = 5; + kunai.ai[2] = 1f; // Actually dictates the "travels farther" part SoundEngine.PlaySound(SoundID.Item73, player.Center); - for (float i = 0; i < 5; i++) + for (float i = 0; i < 9; i++) { - float angle = MathHelper.TwoPi / 5f * i; - Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 1.55f), knockback, player.whoAmI, angle, 0f); + float angle = MathHelper.TwoPi / 9f * i; + Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI, angle); } } + else if (stealthSalvo) + { + kunai.penetrate = 5; + kunai.ai[2] = 1f; + } + + if (player.ItemUsesThisAnimation == Item.useLimitPerAnimation) + stealthSalvo = false; return false; } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 7d61a447d9..5e6884dcf5 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class CraniumSmasher : RogueWeapon { private bool throwExplosive = false; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index a82b2e5f37..a969549eed 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -1,6 +1,7 @@ using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class CrushsawCrasher : RogueWeapon { bool HasHoveredOverNameInGFB = false; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 3a54076ed3..979ee8335c 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CrystalPiercer : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 62; @@ -51,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index d21034981c..67418ccae8 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue { private const float FlexMultMax = 5f; private float flexMult = 1f; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 7cbfc94525..dbb42e3a5f 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DeepWounder : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; diff --git a/Items/Weapons/Rogue/DimensionTearingDisk.cs b/Items/Weapons/Rogue/DimensionTearingDisk.cs index 1545a49316..79f0e88922 100644 --- a/Items/Weapons/Rogue/DimensionTearingDisk.cs +++ b/Items/Weapons/Rogue/DimensionTearingDisk.cs @@ -1,8 +1,7 @@ -using System.Collections.Generic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class DimensionTearingDisk : RogueWeapon { public static float Speed = 10.5f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 62; diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index 729455366d..e90b56df10 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -2,13 +2,19 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using CalamityMod.Systems.Collections; using Terraria.ID; +using CalamityMod.Buffs.DamageOverTime; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { public class DukesDecapitator : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index 772267450b..db7e555a0d 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 24; - Item.damage = 85; + Item.damage = 110; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.AncientCloth,5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/DuststormInABottle.png b/Items/Weapons/Rogue/DuststormInABottle.png index 1e049812e3..723d93ce24 100644 Binary files a/Items/Weapons/Rogue/DuststormInABottle.png and b/Items/Weapons/Rogue/DuststormInABottle.png differ diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 3e6437c8e5..e138faec61 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 82; Item.height = 88; - Item.damage = 1000; + Item.damage = 700; Item.knockBack = 3.5f; Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; @@ -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/ElephantKiller.cs b/Items/Weapons/Rogue/ElephantKiller.cs index efb7d64b46..e4cb6c8c26 100644 --- a/Items/Weapons/Rogue/ElephantKiller.cs +++ b/Items/Weapons/Rogue/ElephantKiller.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 46; Item.height = 58; - Item.damage = 120; + Item.damage = 135; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 38; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index a53b430182..0768922c81 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 72d6da8198..d77d5dda00 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ExecutionersBlade : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 64; @@ -52,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 8b7f5a9494..8d27d06a14 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index cbdba9dccb..950c0fe3bd 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -54,8 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 4). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index a43492d9e0..b04572e037 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class FrostcrushValari : RogueWeapon { public static float Speed = 16f; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2, BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 34; @@ -23,8 +27,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = Item.useAnimation = 19; Item.knockBack = 12; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -54,7 +58,6 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(6). - AddIngredient(40). AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index acf40a72cb..2878ec5abd 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FrostyFlare : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2, BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 10; diff --git a/Items/Weapons/Rogue/GacruxianMollusk.cs b/Items/Weapons/Rogue/GacruxianMollusk.cs index 8ea216e1a8..f7338b4049 100644 --- a/Items/Weapons/Rogue/GacruxianMollusk.cs +++ b/Items/Weapons/Rogue/GacruxianMollusk.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public static float Knockback = 5f; public static float Speed = 15f; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 24; diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index f3d4a13f8e..d64cca2580 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 02bd23baf5..dd6c45755b 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -12,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GodsParanoia : RogueWeapon { - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; @@ -54,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/GraveGrimreaver.cs b/Items/Weapons/Rogue/GraveGrimreaver.cs index a26773792a..ee6256a287 100644 --- a/Items/Weapons/Rogue/GraveGrimreaver.cs +++ b/Items/Weapons/Rogue/GraveGrimreaver.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GraveGrimreaver : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.CursedInferno, BuffID.Confused]; + } public override void SetDefaults() { Item.width = 80; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 10a951f840..c97ccfedf2 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +16,10 @@ namespace CalamityMod.Items.Weapons.Rogue { // For more consistent DPS, always alternates between throwing 1 and 2 instead of picking randomly private bool throwTwo = true; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 46; diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 8a6c367c30..f64290b17f 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class IceStar : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = Item.height = 66; diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 70313458d7..2cb4ff44fa 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Icebreaker : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2, BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index a253fb640c..cb7cded4f1 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class InfernalKris : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index b910cf3358..f698f93d0b 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -1,16 +1,23 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Items.Weapons.Rogue { public class JawsOfOblivion : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index bdb23f1f1c..b551f7a412 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class KelvinCatalyst : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index bbced63075..ff78f8a102 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LeviathanTeeth : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 36; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 829959a4cc..5e6a26657e 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LunarKunai : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index e67860842d..146e745126 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -18,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 2ffec7ef94..ea3b6e9366 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MangroveChakram : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Venom]; + } public override void SetDefaults() { Item.width = 38; @@ -43,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 514769e61b..e0f2b3a124 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MeteorFist : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 22; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 7b108c5096..cee79c4396 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,6 +1,8 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,8 +16,11 @@ namespace CalamityMod.Items.Weapons.Rogue public class MoltenAmputator : RogueWeapon { public float speed = 16; - public static int FlurryCount => 30; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 92; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 445b1f993e..9b5b83721f 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -33,13 +33,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) + Projectile root = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable()) { - Main.projectile[stealth].Calamity().stealthStrike = true; - for (int i = 0; i < 8; i++) + root.Calamity().stealthStrike = true; + for (int i = 0; i < 12; i++) { - int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f); + Projectile.NewProjectile(source, player.Center, spreadVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f, 1f); } foreach (Player other in Main.ActivePlayers) { diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 7c690b132a..9dabaa5cbc 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -52,8 +52,6 @@ namespace CalamityMod.Items.Weapons.Rogue public static float TesselationDamageRatio = 0.25f; public static float TesselationKnockback = 1.5f; - public override float StealthDamageMultiplier => 1.0f; - public override void SetDefaults() { Item.width = 78; @@ -176,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/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index bf62bd5875..9a8c6521f5 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class Penumbra : RogueWeapon { public static float ShootSpeed = 9f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 46; diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index 1132a4b5fe..66921cfda3 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; } public override float StealthDamageMultiplier => 1.2f; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 5ed879a35f..c5e0672f39 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Prismalline : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 54; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index ae93270b57..b3e28db10f 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public static int SpearBaseDamage => 125; public static int StarBaseDamage => 80; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 68; @@ -27,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 21; Item.useAnimation = 21; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index 3b22c78a60..0e75b055cc 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(10). - AddIngredient(15). + AddIngredient(12). AddIngredient(ItemID.FallenStar, 10). + AddIngredient(15). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/ReboundingRainbow.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs index eef227ac32..080025e3b5 100644 --- a/Items/Weapons/Rogue/ReboundingRainbow.cs +++ b/Items/Weapons/Rogue/ReboundingRainbow.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class ReboundingRainbow : RogueWeapon { public static int stealthTimeMult = 2; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 9ca38e95d4..5267d124a0 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RotBall : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 9cd76f632b..f873ac1eba 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,11 +14,12 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 28; - Item.damage = 20; + Item.damage = 26; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 28; + Item.useTime = 15; + Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.5f; Item.autoReuse = true; @@ -25,17 +27,34 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8f; + Item.shootSpeed = 14f; + } + + public override bool CanUseItem(Player player) + { + if (player.ownedProjectileCounts[Item.shoot] >= 2 && !player.Calamity().StealthStrikeAvailable()) + { + return false; + } + else + { + return true; + } } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - + int spread = 2; + for (int i = 0; i < 2; i++) + { + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); + int stealth = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + spread -= Main.rand.Next(1, 3); + } return false; } return true; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index e588335fb2..29021adc2b 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -48,10 +48,12 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(). AddIngredient(5). - AddIngredient(15). + AddIngredient(50). AddIngredient(ItemID.SoulofNight, 15). AddTile(). Register(); } + + public static Color RarityColor() => CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); } } diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 6f79585cf6..d5ee968079 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -12,51 +12,44 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SeafoamBomb : RogueWeapon { - public int throwCount = 0; // Gives bubbles an order to be fused in public override void SetDefaults() { Item.width = 38; Item.height = 42; - Item.damage = 35; + Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 40; + Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = 25; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7f; + Item.shootSpeed = 8f; Item.DamageType = RogueDamageClass.Instance; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) // Stealth strikes throw a cluster bomb, the throw count is increased to insure that bubble fusing works + if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, -5); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].localAI[0] = throwCount; - throwCount += 50; - + int stealth = Projectile.NewProjectile(source, position, new Vector2(velocity.X + velocity.X / 3, velocity.Y + velocity.Y / 3), type, damage, knockback, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } - else - { - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, -5); - Main.projectile[proj].localAI[0] = throwCount; - throwCount++; - } - return false; + return true; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.Bomb, 25). AddIngredient(10). - AddIngredient(2). - AddIngredient(15). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index ea40818dcf..c058053e3e 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Items.Weapons.Rogue /// /// Falloff per target hit simultaneously by the aura. Resets every hit interval /// - public static float FalloffPerTargetHitByAura => 0.5f; - public static float FallofPerTargetHitByBomb => 0.2f; + public static float FalloffPerTargetHitByAura => 0.2f; + public static float FallofPerTargetHitByBomb => 0.3f; public override void SetDefaults() { Item.width = 32; Item.height = 32; - Item.damage = 260; + Item.damage = 220; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.noMelee = true; diff --git a/Items/Weapons/Rogue/ShatteredDawn.cs b/Items/Weapons/Rogue/ShatteredDawn.cs index 7331b6f831..63499fe34c 100644 --- a/Items/Weapons/Rogue/ShatteredDawn.cs +++ b/Items/Weapons/Rogue/ShatteredDawn.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ShatteredDawn : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index 33d8971e0f..45851a02de 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SkyfinBombers : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Rogue/SlickCane.png b/Items/Weapons/Rogue/SlickCane.png deleted file mode 100644 index 1aadfccbb4..0000000000 Binary files a/Items/Weapons/Rogue/SlickCane.png and /dev/null differ diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index e90b104126..64460a10be 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SludgeSplotch : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Slimed]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index bad85a5962..84c5e953a7 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -1,7 +1,9 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -9,15 +11,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SpearofPaleolith : RogueWeapon { - public static int ShardBaseDamage => 40; + public static int ShardBaseDamage => 28; - public static int NormalShardCount => 3; + public static int NormalShardCount => 2; public static int ImpaledShardCount => 5; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.damage = 90; + Item.damage = 70; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 27; diff --git a/Items/Weapons/Rogue/SpearofPaleolith.png b/Items/Weapons/Rogue/SpearofPaleolith.png index a5d6a7b8cd..b292d5d958 100644 Binary files a/Items/Weapons/Rogue/SpearofPaleolith.png and b/Items/Weapons/Rogue/SpearofPaleolith.png differ diff --git a/Items/Weapons/Rogue/SporeKnife.cs b/Items/Weapons/Rogue/SporeKnife.cs index 9a5b9bf81e..724d3697ac 100644 --- a/Items/Weapons/Rogue/SporeKnife.cs +++ b/Items/Weapons/Rogue/SporeKnife.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle ImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeImpact") with { PitchVariance = 0.25f, MaxInstances = 10 }; public static readonly SoundStyle StealthImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeStealthImpact"); public static readonly SoundStyle ChompSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeChomp", 1, 3) with { PitchVariance = 0.25f, MaxInstances = 10 }; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Poisoned]; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index e80d3a6b99..1737f00384 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 438; + Item.damage = 400; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 90; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.3f; + public override float StealthDamageMultiplier => 0.25f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 1d4d1e40e5..1bcd4aa5c5 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; } diff --git a/Items/Weapons/Rogue/SubductionSlicer.cs b/Items/Weapons/Rogue/SubductionSlicer.cs index 12656fa1e0..a39e0a8309 100644 --- a/Items/Weapons/Rogue/SubductionSlicer.cs +++ b/Items/Weapons/Rogue/SubductionSlicer.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("FlameScythe")] public class SubductionSlicer : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 50; @@ -42,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index e85e7b59a3..456fca59b4 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class TheFinalDawn : RogueWeapon { public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 78; diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index 80c69b5fab..8dd741d826 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("TheReaper")] public class TheOldReaper : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 106; Item.height = 104; - Item.damage = 1520; + Item.damage = 1420; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 50; @@ -31,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 0.65f; + public override float StealthDamageMultiplier => 0.50f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index f5605f6e5f..70326e75de 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 24; Item.height = 46; - Item.damage = 432; + Item.damage = 303; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 20; @@ -25,15 +26,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.7f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); @@ -48,11 +47,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.FastClock). - AddIngredient(5). - AddIngredient(20). - AddTile(TileID.MythrilAnvil). + AddIngredient(). + AddIngredient(). + AddIngredient(ItemID.GoldWatch). + AddIngredient(8). + AddIngredient(20). + AddTile(). Register(); } } diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 633fb1f6cd..4445d95182 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToothBall : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index f606cd97b4..692f2d0996 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class TotalityBreakers : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index a4fa72738a..b09e00475e 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToxicantTwister : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index 7dcbb8d404..ed42fa8382 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Turbulance : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 14; @@ -45,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(7). - AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/TwistingThunder.cs b/Items/Weapons/Rogue/TwistingThunder.cs index 66aadf552c..ce3f7458bc 100644 --- a/Items/Weapons/Rogue/TwistingThunder.cs +++ b/Items/Weapons/Rogue/TwistingThunder.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("DeificThunderbolt")] public class TwistingThunder : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 01fe4cb223..ad23dc5a28 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class UrchinStinger : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 10; diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 90259f9cf0..712dc8eda4 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -1,5 +1,7 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class UtensilPoker : RogueWeapon { private int counter = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 44; diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index 41462166f4..e5cb7c318d 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Valediction : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 80; diff --git a/Items/Weapons/Rogue/Vega.cs b/Items/Weapons/Rogue/Vega.cs index c4943e230d..8625b8c2a5 100644 --- a/Items/Weapons/Rogue/Vega.cs +++ b/Items/Weapons/Rogue/Vega.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1f; public override void HoldItem(Player player) { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; @@ -91,9 +90,9 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(7). + AddIngredient(8). AddIngredient(4). - AddIngredient(12). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/WalkingCane.cs similarity index 67% rename from Items/Weapons/Rogue/SlickCane.cs rename to Items/Weapons/Rogue/WalkingCane.cs index 0331d03098..c2ec80ffb4 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/WalkingCane.cs @@ -3,17 +3,22 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class SlickCane : RogueWeapon + [LegacyName("SlickCane")] + public class WalkingCane : RogueWeapon { + public static float MoveSpeedBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { - Item.width = 42; - Item.height = 36; - Item.damage = 50; + Item.width = 48; + Item.height = 44; + Item.damage = 40; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; @@ -22,10 +27,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; Item.autoReuse = true; - Item.value = Item.buyPrice(gold: 35); // Sold by Bandit + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; } @@ -33,8 +38,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 1.5f * (float)player.direction; - int projectileIndex = Projectile.NewProjectile(source, position.X, position.Y+100, velocity.X*2f, velocity.Y*2f, type, damage, knockback, player.whoAmI, ai0, 0f); + float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 1.5f * player.direction; + int projectileIndex = Projectile.NewProjectile(source, position + Vector2.UnitY * 100f, velocity * 2f, type, damage, knockback, player.whoAmI, ai0); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/WalkingCane.png b/Items/Weapons/Rogue/WalkingCane.png new file mode 100644 index 0000000000..9bf218ea8f Binary files /dev/null and b/Items/Weapons/Rogue/WalkingCane.png differ diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index d64c3cd5e1..75d762aae0 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Summon { player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; + float damageMult = 0.8f + slimeSlots * 0.2f; var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, (int)(damage * damageMult), knockback, player.whoAmI); minion.originalDamage = (int)(Item.damage * damageMult); minion.minionSlots = slimeSlots; diff --git a/Items/Weapons/Summon/AmphibiansGuitar.cs b/Items/Weapons/Summon/AmphibiansGuitar.cs index 4f7e937905..2d8af9fcac 100644 --- a/Items/Weapons/Summon/AmphibiansGuitar.cs +++ b/Items/Weapons/Summon/AmphibiansGuitar.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(ItemID.TheAxe). AddIngredient(ItemID.Frog). - AddIngredient(3). AddIngredient(8). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 5cf2d78f05..bbad3587dc 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -28,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon { Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; } public override void SetDefaults() diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index dee0622c01..f96f0909cb 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Summon public const int PlasmaCannonShootRate = 30; - public const int TeslaCannonShootRate = 36; + public const int TeslaCannonShootRate = 42; - public const int LaserCannonNormalShootRate = 15; + public const int LaserCannonNormalShootRate = 12; public const int GaussNukeShootRate = 240; @@ -31,13 +31,13 @@ namespace CalamityMod.Items.Weapons.Summon public const float MinionSlotsPerCannon = 3f; - public const float PlasmaCannonBlastFactor = 0.9f; + public const float PlasmaCannonBlastFactor = 1f; // Multiple orbs can arc together when there are 2+ tesla cannons, resulting in a LOT of hits. // The local i-frames are also quite high to combat this problem. public const float TeslaOrbDamageFactor = 1f; - public const float LaserDamageFactor = 1.1f; + public const float LaserDamageFactor = 1f; public const float NukeDamageFactor = 1f; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = Item.height = 36; Item.mana = 80; - Item.damage = 625; + Item.damage = 550; Item.useStyle = ItemUseStyleID.HoldUp; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 24; diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 36d0e892f3..6e1f925e98 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -24,7 +25,10 @@ namespace CalamityMod.Items.Weapons.Summon public const float PetalGravityStrenght = 0.2f; #endregion - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Poisoned]; + } public override void SetDefaults() { Item.width = 40; diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/BlightedSlimeStaff.cs similarity index 82% rename from Items/Weapons/Summon/CorroslimeStaff.cs rename to Items/Weapons/Summon/BlightedSlimeStaff.cs index 4708a0d420..412247aad7 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/BlightedSlimeStaff.cs @@ -8,14 +8,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class CorroslimeStaff : ModItem, ILocalizedModType + [LegacyName("CorroslimeStaff", "CrimslimeStaff")] + public class BlightedSlimeStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() { Item.width = 52; Item.height = 54; - Item.damage = 24; + Item.damage = 18; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; @@ -25,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; - Item.buffType = ModContent.BuffType(); - Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } diff --git a/Items/Weapons/Summon/CorroslimeStaff.png b/Items/Weapons/Summon/BlightedSlimeStaff.png similarity index 100% rename from Items/Weapons/Summon/CorroslimeStaff.png rename to Items/Weapons/Summon/BlightedSlimeStaff.png diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 03a7bc9f9d..9467e9c66d 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CadaverousCarrion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 54; diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index f4b263ecf6..107a687826 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -35,13 +37,14 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { 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/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index a55ae33a05..ba992e96aa 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CausticCroakerStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 36; diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 6df9ef748e..b91456d5cc 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,12 +13,16 @@ namespace CalamityMod.Items.Weapons.Summon public class CausticStaff : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Venom, BuffID.Ichor, BuffID.CursedInferno, ModContent.BuffType()]; + } public override void SetDefaults() { 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/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index 4fdd3eb232..9d02222fcc 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CinderBlossomStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index ebaba97f0c..64d1039661 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -35,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 63c5df1b8e..ff4ee09fb9 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,7 +1,9 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CosmicViperEngine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 46; diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 2b2c829df1..e50b70b3cb 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -19,18 +19,11 @@ namespace CalamityMod.Items.Weapons.Summon public const float BeamHomeSpeed = 17f; - public const float LanternSummonCost = 2f; - - public override void SetStaticDefaults() - { - ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; - } - public override void SetDefaults() { Item.width = 42; Item.height = 60; - Item.damage = 127; + Item.damage = 95; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs deleted file mode 100644 index fcef51fb1b..0000000000 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Summon -{ - public class CrimslimeStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetDefaults() - { - Item.width = 52; - Item.height = 52; - Item.damage = 24; - Item.mana = 10; - Item.useAnimation = Item.useTime = 36; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.buffType = ModContent.BuffType(); - Item.shoot = ModContent.ProjectileType(); - Item.DamageType = DamageClass.Summon; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddBuff(Item.buffType, 2); - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - minion.originalDamage = Item.damage; - return false; - } - } -} diff --git a/Items/Weapons/Summon/CrimslimeStaff.png b/Items/Weapons/Summon/CrimslimeStaff.png deleted file mode 100644 index 3e40afc20b..0000000000 Binary files a/Items/Weapons/Summon/CrimslimeStaff.png and /dev/null differ diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 9f7e63c30d..ca9a7cf2ec 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CryogenicStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 82; diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 7204fd2c03..a85ea7dbc0 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class DaedalusGolemStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = Item.height = 32; diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 8629b2ab5b..9595289417 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public class DankStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 58; Item.height = 58; - Item.damage = 14; + Item.damage = 10; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 4ea967a21e..fc4a4f5556 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,19 +15,23 @@ namespace CalamityMod.Items.Weapons.Summon public class DazzlingStabberStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 56; Item.height = 60; + Item.damage = 69; + Item.useAnimation = Item.useTime = 24; + Item.mana = 10; + Item.knockBack = 2f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.DD2_DarkMageHealImpact; Item.DamageType = DamageClass.Summon; - Item.mana = 10; - Item.damage = 35; - Item.knockBack = 2f; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 24; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); @@ -45,21 +50,21 @@ namespace CalamityMod.Items.Weapons.Summon if (minions.owner == player.whoAmI) usedMinionSlots += minions.minionSlots; } - bool hasSlotsForSummon = true; - if (usedMinionSlots + 1 > player.maxMinions) - hasSlotsForSummon = false; + + int minionsSummoned = 0; + for (int i = 0; i < 3; i++) + { + if (usedMinionSlots + 1 + i > player.maxMinions) + break; + + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + minion.originalDamage = Item.damage; + minionsSummoned++; + } player.AddBuff(Item.buffType, 2); - int projCount = player.ownedProjectileCounts[type] + (hasSlotsForSummon ? 3 : 0); - if (hasSlotsForSummon) - { - for (int i = 0; i < 3; i++) - { - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); - minion.originalDamage = Item.damage; - } - } + int projCount = player.ownedProjectileCounts[type] + minionsSummoned; float angleMax = MathHelper.ToRadians(360f); if (projCount == 100) angleMax = 0f; diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 74ee7ec666..9ce13c4bf5 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { Item.width = Item.height = 44; - Item.damage = 40; + Item.damage = 32; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index c286cda0f7..e7e5a5cf31 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -14,13 +16,17 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 6f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + ItemID.Sets.StaffMinionSlotsRequired[Type] = 6f; + } public override void SetDefaults() { Item.width = 64; Item.height = 62; - Item.damage = 215; + Item.damage = 222; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; @@ -47,7 +53,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } 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 1e6da182f1..51a156fc22 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -6,6 +7,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +20,11 @@ namespace CalamityMod.Items.Weapons.Summon public static int AttackMode = 0; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 10f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 10f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frozen]; + } public override void SetDefaults() { @@ -95,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/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 1bbb84a7fc..66ddde39a1 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -18,13 +20,14 @@ namespace CalamityMod.Items.Weapons.Summon { Item.staff[Type] = true; ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { Item.width = 52; Item.height = 52; - Item.damage = 42; + Item.damage = 38; Item.DamageType = DamageClass.Summon; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); 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/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 75b31facef..3204722a8c 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 42; Item.height = 42; - Item.damage = 20; + Item.damage = 14; Item.DamageType = DamageClass.Summon; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index a1fcef6f85..3ac9033742 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,13 +15,17 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { 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/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 7165e12837..e00ef299cb 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,7 +1,10 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Buffs.StatDebuffs; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Summon public class ForgottenApexWand : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 44; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 6c3af92baa..38a48495d1 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,7 +16,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/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 5c3e05a492..5fd5e4f94c 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Summon public class FuelCellBundle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index 0c886411d4..4bb0d8a1f3 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class GlacialEmbrace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 52; diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 3b829ede05..9096dadb73 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -61,20 +62,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); - } - - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -140,8 +137,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(5). + AddIngredient(8). + AddIngredient(8). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index 1747ceda75..7c0d09b4d9 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,14 +17,18 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 44; Item.height = 62; Item.mana = 10; - Item.damage = 187; + Item.damage = 175; Item.useStyle = ItemUseStyleID.HoldUp; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index 2268696ea2..af662a6ce2 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -6,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using CalamityMod.Systems.Collections; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -14,11 +16,15 @@ namespace CalamityMod.Items.Weapons.Summon public class LegionofCelestia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { 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/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index c489968bf5..f921a65a0e 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() @@ -30,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 90479063db..25d217acc0 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; public const float MachineGunRate = 18f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { @@ -45,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(ItemID.XenoStaff). - AddIngredient(ItemID.MoonlordTurretStaff). AddIngredient(5). + AddIngredient(15). AddTile(). Register(); } diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index b79de9d2a3..12404e5013 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -96,14 +96,14 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(ItemID.MagicMirror). - AddIngredient(10). + AddIngredient(8). AddIngredient(10). AddCondition(Condition.NearShimmer). Register(); CreateRecipe(). AddIngredient(ItemID.IceMirror). - AddIngredient(10). + AddIngredient(8). AddIngredient(10). AddCondition(Condition.NearShimmer). Register(); diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index 31c577e525..bc9a605608 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -1,5 +1,6 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.Systems.Collections; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -34,6 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() 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/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 579885a228..ed7dba5116 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -12,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class ResurrectionButterfly : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + } public override void SetDefaults() { Item.width = 46; @@ -53,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(5). AddIngredient(ItemID.ButterflyDust, 2). AddIngredient(ItemID.Silk, 40). - AddIngredient(ItemID.Ectoplasm, 20). + AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.Loom). Register(); } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 884350d5e0..c93805c979 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 48; Item.height = 56; - Item.damage = 71; + Item.damage = 60; Item.knockBack = 2f; Item.mana = 10; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.AncientCloth, 5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); 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/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 539d0a401b..1f0fed5cdd 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 66; Item.height = 70; - Item.damage = 15; + Item.damage = 10; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs deleted file mode 100644 index 312100f28f..0000000000 --- a/Items/Weapons/Summon/SeashineHilt.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using CalamityMod.Buffs.Summon; -using CalamityMod.Dusts; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Summon -{ - [LegacyName("SeashineSword")] - public class SeashineHilt : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } - public override void SetDefaults() - { - Item.width = 32; - Item.height = 34; - Item.useTime = Item.useAnimation = 36; - Item.damage = 55; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.knockBack = 5f; - Item.shootSpeed = 12f; - Item.mana = 10; - Item.rare = ItemRarityID.Green; - Item.buffType = ModContent.BuffType(); - Item.shoot = ModContent.ProjectileType(); - } - public override bool AltFunctionUse(Player player) => true; - public override float UseSpeedMultiplier(Player player) - { - // There's a long cooldown on commanding blades - // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready - if (player.altFunctionUse == 2) - return 0.37f; - else - return 1f; - } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - float usedMinionSlots = 0; - foreach (var minions in Main.ActiveProjectiles) - { - if (minions.owner == player.whoAmI) - usedMinionSlots += minions.minionSlots; - } - bool hasSlotsForSummon = true; - if (usedMinionSlots + 1 > player.maxMinions) - hasSlotsForSummon = false; - - - // Call all active blades to attack if they are charged - // The check to see if a blade is charged is done in the blade itself - if (player.altFunctionUse == 2) - { - int blades = 0; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.type == Item.shoot && projectile.ai[0] < 5 && projectile.timeLeft < 90000 - 180) - { - projectile.ai[0] = 5; - blades++; - } - } - if (blades > 0) // If theres no blades, then don't do anything - { - for (int i = 0; i < 7; i++) - { - Dust dust = Dust.NewDustPerfect(player.Center, ModContent.DustType(), (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 10f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.95f, 1.7f); - dust.color = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; - dust.noLightEmittence = true; - - Particle fx = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 20f), "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(16, 26 + 1)), Main.rand.NextFloat(1.1f, 1.7f), Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: 0.2f); - GeneralParticleHandler.SpawnParticle(fx); - } - Particle e = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.15f, 0.25f) * 3, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); - GeneralParticleHandler.SpawnParticle(e); - SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); - } - } - else if (hasSlotsForSummon) // Toss out the summon - { - player.AddBuff(Item.buffType, 2); - SoundEngine.PlaySound(SoundID.Item1, player.Center); - - var minion = Projectile.NewProjectileDirect(source, player.Center, velocity, type, damage, knockback, player.whoAmI); - minion.originalDamage = Item.damage; - - float angleMax = MathHelper.ToRadians(360f); - if (CalamityUtils.CountProjectiles(type) == 1) - angleMax = 0f; - float index = 1f; - if (player.ownedProjectileCounts[Item.shoot] > 30) - { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); - } - angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == type && p.owner == player.whoAmI) - { - p.ai[2] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; - p.ai[1] = index; - p.netUpdate = true; - index++; - } - } - } - - - return false; - } - public override void UseItemFrame(Player player) // Player hand animation when you command the blades - { - if (player.altFunctionUse == 2) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - - float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; - float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.4f) - rotation += (-0.15f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; - - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); - } - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddIngredient(7). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Summon/SeashineHilt.png b/Items/Weapons/Summon/SeashineHilt.png deleted file mode 100644 index 7b2e0792bc..0000000000 Binary files a/Items/Weapons/Summon/SeashineHilt.png and /dev/null differ diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 9eb6828716..26db2bac93 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -65,9 +65,9 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(5). - AddIngredient(2). - AddIngredient(12). + AddIngredient(8). + AddIngredient(4). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 98dd09eb39..1823d77cd1 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using CalamityMod.Systems.Collections; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class SlimePuppetStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Slimed]; + } public override void SetDefaults() { Item.width = 32; @@ -47,8 +52,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). - AddIngredient(18). + AddIngredient(14). + AddIngredient(14). AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 2c927aab9a..9a82b885c4 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class SpikecragStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 46d99f5fd5..c53423819a 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 52; Item.height = 54; - Item.damage = 31; + Item.damage = 25; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; 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/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 118ad7d47d..84b7bd48d3 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Summon public class StormjawStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; 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 06b5521bd9..85ca83d42c 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,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 30044336d3..e0c75c272b 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -16,7 +17,11 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.BetsysCurse, BuffID.Ichor]; + } public override void SetDefaults() { @@ -60,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/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index c694415713..ac5c109042 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +12,11 @@ namespace CalamityMod.Items.Weapons.Summon public class TundraFlameBlossomsStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2]; + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 6eb2272ea5..6c0898a08f 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Pets; using CalamityMod.Items.SummonItems; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 14)); ItemID.Sets.AnimatesAsSoul[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; } public override void SetDefaults() diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index 14f973ea85..8fd4492b3e 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 72; Item.height = 72; - Item.damage = 35; + Item.damage = 38; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index b49cbc32e8..d362494342 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Summon public class Vigilance : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = Item.height = 32; diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 1bd661c128..a84b85e78f 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 40; Item.height = 36; - Item.damage = 15; + Item.damage = 10; Item.DamageType = DamageClass.Summon; Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 0fe8274228..dfd28bbb38 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 9cd7b0a4d1..9e8e2d62f3 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -40,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; @@ -77,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; @@ -92,21 +93,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } - - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { @@ -171,7 +168,7 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(15). + AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 433e5068c8..7ca32eca2f 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; @@ -12,7 +11,6 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; -using CalamityMod.Systems.Collections; using CalamityMod.Utilities.Daybreak; using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; @@ -30,16 +28,17 @@ namespace CalamityMod.Items.Weapons.Summon public class VoidConcentrationStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public static float SummonerTagEffectiveness => 1.67f; 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.3f, AllowsWhipStacking = true, TagOnHit = tagOnHit, TagModifyHitEffects = SummonTag.BlankTagModifyHit, AutoDrawTooltip = false }; - public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone) => npc.GetGlobalNPC().StoredDamage += (int)(damageDone); + public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone) => npc.GetGlobalNPC().StoredDamage += (int)(damageDone * (SummonerTagEffectiveness - 1)); public override void SetStaticDefaults() { ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; @@ -65,30 +64,28 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + foreach (var item in Main.ActiveProjectiles) { - foreach (var item in Main.ActiveProjectiles) - { - if (item.type == ModContent.ProjectileType()) - item.Kill(); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (item.type == ModContent.ProjectileType()) + item.Kill(); } - else + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + { + Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + player.ownedProjectileCounts[ModContent.ProjectileType()]++; //update it instantly so it's read properly later in the same update + } + } + if (player.altFunctionUse == 2) { player.MinionNPCTargetAim(true); if (player.MinionAttackTargetNPC >= 0) { var target = Main.npc[player.MinionAttackTargetNPC]; - foreach (var item in Main.ActiveProjectiles) - { - if (item.type == ModContent.ProjectileType()) - item.Kill(); - } Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, target.whoAmI); } } + return false; } public override bool AltFunctionUse(Player player) => true; @@ -157,11 +154,11 @@ namespace CalamityMod.Projectiles.Summon } public class VoidConcentrationDarkEnergy : ModProjectile, ILocalizedModType { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public new string LocalizationCategory => "Projectiles.Summon"; private double minDistance => 10; private double distance { get; set; } = 10; private double maxDistance => 400; + public override string GlowTexture => "CalamityMod/Projectiles/Summon/VoidConcentrationDarkEnergyGlow"; public override void SetStaticDefaults() { @@ -172,7 +169,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = 32; - Projectile.height = 32; + Projectile.height = 34; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -185,17 +182,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; } - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = TextureAssets.Projectile[Type].Value; - texture = TextureAssets.Npc[ModContent.NPCType()].Value; - var gt = DarkEnergy.GlowTexture.Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - var frame = texture.Frame(1, 8, 0, Projectile.frame); - Main.EntitySpriteDraw(texture, drawPos, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale * 0.5f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(gt, drawPos, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale * 0.5f, SpriteEffects.None, 0); - return false; - } public override void AI() { @@ -295,12 +281,12 @@ namespace CalamityMod.Projectiles.Summon public override bool? CanHitNPC(NPC target) => false; public override void AI() { - if (!Main.npc[(int)Projectile.ai[0]].active) + Player owner = Main.player[Projectile.owner]; + if (!Main.npc[(int)Projectile.ai[0]].active || owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { Projectile.Kill(); return; } - Player owner = Main.player[Projectile.owner]; Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; Main.npc[(int)Projectile.ai[0]].AddBuff(ModContent.BuffType(), 5); @@ -314,7 +300,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + 200 * v, v.RotatedBy(MathHelper.PiOver2) * 10, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner); - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + 200 * v, v.RotatedBy(-MathHelper.PiOver2) * 10, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner,1); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + 200 * v, v.RotatedBy(-MathHelper.PiOver2) * 10, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), Projectile.knockBack, Projectile.owner, 1); } } } @@ -515,7 +501,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.NewProjectile(npc.GetSource_OnHurt(null), npc.Center, Vector2.UnitX.RotatedBy(rot), ModContent.ProjectileType(), (int)Math.Max((dmg * VoidConcentrationStaff.summonTag.MultiplicativeTagDamage), 1), 0, -1, npc.whoAmI); } - } + } } base.PostAI(npc); } diff --git a/Items/Weapons/Summon/VoidEaterMarionette.cs b/Items/Weapons/Summon/VoidEaterMarionette.cs index cbcd6952e3..e3266817a6 100644 --- a/Items/Weapons/Summon/VoidEaterMarionette.cs +++ b/Items/Weapons/Summon/VoidEaterMarionette.cs @@ -1,10 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -19,6 +20,10 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public bool FocusFetch = false; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 68; @@ -38,22 +43,25 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.shootSpeed = 8; } - public override bool CanRightClick() + + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - if (player.ownedProjectileCounts[Item.shoot] > 0) + if (Main.myPlayer == player.whoAmI && player.ownedProjectileCounts[Item.shoot] > 0 && Item.JustPressedKeybind()) { var p = Main.projectile.First(x => x.active && x.type == Item.shoot && x.owner == player.whoAmI); - p.ModProjectile().FocusOnFetching = !p.ModProjectile().FocusOnFetching; - p.netUpdate = true; + if (p.ModProjectile is VoidEaterMarionetteProjectile vem) + { + + vem.FocusOnFetching = !vem.FocusOnFetching; + p.netUpdate = true; + if (vem.FocusOnFetching) + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchStart"),true); + else + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchEnd"), true); + } } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.ownedProjectileCounts[type] > 0) diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index 1adfc5491b..c185a70c12 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; @@ -56,9 +56,9 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(ItemID.GolemFist). - AddIngredient(10). - AddIngredient(5). - AddIngredient(5). + AddIngredient(8). + AddIngredient(4). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 6352a8efc2..7d88211ef5 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public static float PartialRegenBoostPerBuffDroid = 0.5f; - public static int DefenseBoostPerBuffDroid = 3; + public static int DefenseBoostPerBuffDroid = 2; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PartialRegenBoostPerBuffDroid.ToRegenPerSecond(), DefenseBoostPerBuffDroid); public override void SetDefaults() { Item.width = 28; Item.height = 20; - Item.damage = 16; + Item.damage = 19; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 33c5fc3603..97626b3618 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -1,8 +1,9 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index a7fa7ed44c..8a5e118585 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Typeless Item.width = 58; Item.height = 58; Item.DamageType = AverageDamageClass.Instance; - Item.damage = 8; - Item.useAnimation = 25; - Item.useTime = 25; + Item.damage = 11; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; Item.UseSound = SoundID.Item109; @@ -39,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Typeless public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 600); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 600); } public override void AddRecipes() diff --git a/Items/Weapons/Typeless/ClaretCannon.cs b/Items/Weapons/Typeless/ClaretCannon.cs index f3c630c63e..d5d7db3135 100644 --- a/Items/Weapons/Typeless/ClaretCannon.cs +++ b/Items/Weapons/Typeless/ClaretCannon.cs @@ -1,8 +1,10 @@ using System; using System.Reflection; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -34,6 +36,10 @@ namespace CalamityMod.Items.Weapons.Typeless public int CooldownMax => 600; public float baseUseDir = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.BetsysCurse]; + } public override void SetDefaults() { Item.width = 48; @@ -59,7 +65,8 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(25). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Typeless/StratusSphere.cs b/Items/Weapons/Typeless/StratusSphere.cs index 5f57fda8ce..0fc5bffb2c 100644 --- a/Items/Weapons/Typeless/StratusSphere.cs +++ b/Items/Weapons/Typeless/StratusSphere.cs @@ -55,9 +55,9 @@ namespace CalamityMod.Items.Weapons.Typeless { CreateRecipe(). AddIngredient(ItemID.NebulaArcanum). - AddIngredient(6). + AddIngredient(8). AddIngredient(4). - AddIngredient(12). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/LICENSE.md b/LICENSE.md index 14b42fd06e..6c0cf24bf8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,13 +1,18 @@ -**The Calamity Mod and all associated source code, visual assets and audio assets, is all rights reserved (ARR).** +The Calamity Mod and all associated source code, visual assets, audio assets, characters, names, logos, trademarks, branding, and related materials are proprietary to Azafure, LLC, a Virginia limited liability company (*"Azafure"*), and are protected by applicable intellectual property laws. All rights reserved. Except for the limited permission necessary to access and contribute to the repository in accordance with these terms, nothing in these terms grants any license, permission, or ownership interest in or to Azafure’s intellectual property. -The following stipulations apply to *contributing* to the Calamity Mod: -- Open source contributions to this repository are welcome. -- If you contribute to the Calamity Mod, you expressly give the Calamity Team permission to use and reproduce your code and/or assets. -- You certify that all code contributed to the Calamity Mod is your own work or appropriately licensed for inclusion. -- We will make good faith efforts to honor reasonable requests to remove contributions from the Calamity Mod. Requests for your work to be excluded are a *privilege*, not a *right*, and we will ignore requests we deem unreasonable. +Contributions (defined hereafter) to this repository for Calamity Mod (*"Project"*) are welcome. By submitting any original code, artwork, audio, documentation, suggestions, or other materials, including modifications or additions thereof, to the Calamity Mod repository (*"Contributions"*), you acknowledge and agree to the following: -The following stipulations apply to the Calamity Mod as a whole: -- You may use the source code of the Calamity Mod as a reference for building or developing Terraria mods or other software. -- Code lifted from the Calamity Mod repository must be credited to the Calamity Team. +1. **Assignment.** Upon submission, you assign to Azafure all right, title and interest in any copyright you have in the Contributions, and you waive any rights that may affect our ownership of the copyright in the Contributions. + +2. **License to Azafure.** If your assignment in Section 1 is ineffective for any reason, you grant to Azafure an exclusive, perpetual, worldwide, transferable, sublicensable, no-charge, royalty-free, and irrevocable license to use, reproduce, prepare derivative works of, publicly display, publicly perform, and distribute your Contributions and any derivative work created based on your Contributions. If your license grant is ineffective for any reason, you irrevocably waive and consent not to assert any claim you may have against Azafure, its successors in interest, or its licensees arising out of their use, reproduction, preparation of derivative works, public display, public performance, or distribution of your Contributions. You also agree that Azafure may, in its sole discretion, publicly use or display your name and, if applicable, the name of your organization, solely only to identify or acknowledge your Contributions to the Project, and not for advertising or marketing purposes. + +3. **Contributor Representations.** By submitting Contributions, you represent that: `(a)` you created the Contributions or otherwise have sufficient rights to submit it to the Project under this license; `(b)` to the best of your knowledge, the Contributions do not infringe any third party intellectual property rights; `(c)` you are not aware of any claim, suit, or proceeding alleging that the Contributions infringe any third party right; and `(d)` you will duly comply with the provisions set forth herein. + +4. **Indemnity.** You agree to indemnify and hold harmless Azafure from and against any claims, damages, losses, liabilities, costs, and expenses arising out of or related to your breach of the foregoing representations and warranties. + +5. **Miscellaneous.** +- Azafure will make good faith efforts to honor reasonable requests to remove Contributions from the Project. Requests for your Contributions to be excluded are a privilege, not a right, and Azafure may ignore requests it deems unreasonable. +- You may use the Project source code as a reference for building or developing Terraria mods or other software. +- If you lift any code from the Project repository you must credit such code to *"Azafure, LLC"* and provide a link to the Project repository or this `LICENSE` page. - The Calamity Mod cannot be redistributed in any form or in any location. The Steam Workshop is the only officially hosted download of the Calamity Mod. -- All music tracks are the property of their respective composers and are used by the Calamity Team with permission. \ No newline at end of file +- All music tracks remain the property of their respective composers, are not owned by Azafure, and are used by Azafure with permission. \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index d4dc4bfd67..21ff204899 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -76,9 +76,11 @@ GemCrawler: Relatives to the Ilmeran Sea's prismbacks. The aquatic lizards ended BlightSlime: Slimes that have absorbed some of the blighted godly essence. Riddled with impurity, they are now more putrid flesh than gelatin and, having taken in such an amount that they seem ready to burst. Yet unlike most slimes which have relatively basic minds, these seem to be collecting mass with a purpose. Cryon: Archmage Permafrost went through great pains to not take part in combat himself, instead molding cryons to act as his personal guardians. Noticing the spread of godly essence just as many other creatures have, they have come out of stasis to combat any signs of it so that they may defend their master. CryoSlime: Slimes enchanted by the Archmage, as a host to crystallize the frozen power of the tundra into a magical metal. He cast a spell to hide away most of his creations and research soon after leaving the Godseeker's side, well aware that Yharim may attempt to exploit his previous work. +DivineSwine: A pig ascended by divine blessing. It flies beautifully through the skies, having become a shining beacon to the sun's primordial light. Incredibly rare, legends say that they reward those who give them a bountiful offering of money. Eidolist: Once members of the dragon cult, they now beg the favor of a new master. They are able to live in the abyss indefinitely thanks to their wyrm-like form, allowing them to serve a new purpose. FearlessGoldfishWarrior: Though Goldfish thrive in their ponds and lakes, many take to land during storms to feed on the worms that have also surfaced. There are even accounts of aquatic warriors who carry daggers of shimmering gold, though most consider these tales far too fishy to be credible. Frogfish: Well-camouflaged and prepared to strike at any moment, Frogfish show that the ocean is rarely as serene as it seems. There are few places where one can find true peace here in the heart of what once was an empire unrivaled. +HorribleHog: A hog corrupted by divine blight. It waddles maliciously beneath the scarlet light of the Blood Moon, leading the horde with its hideous bellow. Thankfully, it is not lost, and can be returned to its swine pristinity with the right tools. EarthElemental: After the Brimstone Elemental became dormant, the forgemasters of Azafure used clockwork and crystal to bind the powers of an elemental to a mechanical body. While formidable, it seems the dream of creating a true replacement for an elemental died unfulfilled with Azafure itself. IceClasper: Though their exact origins are an enigma, what is known is that these ethereal beings seek to stamp out any and all sources of warmth that exist in their home. Due to this fact, and taking into account the fossil record, many speculate that ice claspers may have played a vital role in the tundra's creation. ImpiousImmolator: An idol carved in the image of Her, it is lit ablaze with the crafter's lifeforce. After all, what weight does one's life hold when one wishes to see the world wreathed in Her holy flames? @@ -86,7 +88,7 @@ MantisShrimp: Though a variety of answers are given when one asks adventurers ab OverloadedSoldier: A body given life again, overflowing with the souls of warriors that perished during the Crusade who were unable to find peace. Their ravenous hunger for battle has been reignited due to sensing godly essences in the land once more. PerennialSlime: These slimes have seized a small amount of the Goddess of Life's essence. Despite her reimprisonment in the deepest depths of the Abyss, the tendrils of her influence now stretch far into the world beyond. PhantomSpirit: The spirits within the Dungeon only vaguely recall their lives, and yet there is one thing each and all clearly remember, that drives them to chaos: the man responsible for locking them in these cursed walls, and his overwhelming power– power that they have been reminded of, due to one ever growing in strength roaming their halls. -Piggy: These little swines waddle their little legs across these lands with little purpose, but they are happy with just that. Yet, little is known about how their little stomach carries a not-so-little amount of fat and muscle. +Piggy: Little swines that waddle their little legs across these lands with little purpose. They are strangely reactive to their surroundings, particularly to divine influence. Little is known about why, but that has never stopped all kinds of people from keeping them as cute little pets. ProfanedEnergyBody: Those most devout to Her travel the world, being planted into societies and acting as spies and assassins. Among their duties is constructing shrines in Her honor infused with Her divine power, that She might bless pagans blinded by darkness with visions of Her new age of light. Rimehound: These hounds were bred and trained to survive in the tundra's hostile conditions by Yharim's forces, so that they may act as scouts. Most were simply abandoned by their masters out of either necessity or choice, and were resigned to roam forever without purpose. Rotdog: Fast and furious, these hounds prowl the night, hunting prey with their razor sharp teeth. They are similar in nature to the demon eyes, both being spawned from the same vile mire, yet these creatures are tailored made to end those who have proven themselves a threat to it. @@ -116,38 +118,18 @@ Sulflounder: A relative to certain hadopelagic creatures living in the depths, t Toxicatfish: Though these fish once threatened none other than their prey, the radiation from nuclear waste generated from Draedon's old experiments has rotted both their bodies and minds. Attacking anything that comes near, this once flourishing species is now on the verge of extinction. Trasher: Despite being equipped with a mouth large enough to swallow a child whole, these crocodiles simply act as scavengers, devouring scraps and bones left over from predators' meals. Needing to conserve energy due to eating relatively little, they rarely move at their full speed unless they feel threatened. //Sunken Sea Enemies -BabyGhostBell: Despite their decidedly lower size and development, infant Ghost Bells can deliver just as many volts to unsuspecting creatures. The Ilmerian army bred thousands of Ghost Bells to maintain the lethal electric field around the sea kingdom, but all their efforts were consumed by ash in a single burning moment. -CarrionSwallower: Of all the species of fish rendered extinct by the Great Incineration, few were lucky enough to even have their corpses remain in one piece. Those that did had their souls infused with trace amounts of brimstone, which they use to hunt any that dare trespass on the old sea. -Clam: Despite having the same filter feeder appetite of the common clam, the Ilmeran species adopted defensive mechanisms against macrofauna due to their forced relocation by the Incineration. Almost all of the remaining Clams have congregated in a small den at the bottom of the sea; what makes this place unique is unknown, as few divers can withstand the ferocity of the clams in their natural abode. -Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, Cnidrions fought valiantly alongside their masters during the Incineration. Though many perished unceremoniously with the warriors that commanded them, one managed to escape a fiery demise, continuing to defend what was once the heart of the sea kingdom with a fierce loyalty. -EutrophicRay: Living life as a filter feeder, the tranquil Eutrophic Ray is quick to flee from any dangers. They are aided by their commensalistic relationship with Ghost Bells, storing the latent voltage in a sac on their underbelly for electrical muscle stimulation, allowing for great bursts of speed. -GhostBell: Commonly encountered as large walls of electric power, these high-voltage jellyfish can incapacitate most with a single touch. Even when not delivering shocks to prey, they passively release a current into the surrounding water, which the old sea kingdom exploited to drive back Yharim's crusade for decades. -GiantClam: Pearls are formed from ambient mana combining with natural limestone deposits, and are claimed to be capable of storing thoughts and memories. Although most clams die and break down before their shells can act as sufficient conduits, the largest and strongest clams can gather enough mana in their pearls for direct use in feeding and defense. -GildedAxolotl: In Ilmeris, these gracious critters were worshipped as mythical paragons of healing and good fortune. Previously considered one of many species lost to the fiery onslaught, their resurgence in the Sunken Sea is a shining ray of hope for Ilmerian survivors. -HauntedChum: During the Witch's razing of Ilmeris' seas, many of the largest fish that had never known fear in their lives were foolish enough to fight back. Even in death they remain consumed by rage, attacking those who draw near, despite being as ruined as the sea itself. -Jellyghoul: The spirits of some Ilmerians were so consumed by grief and despair that, over time, their identity and memories faded away. These souls are now confined in the blank form of phantom jellyfishes, doomed to forever haunt the Timeless Shores. -KelpieSeadragon: Kelpie Seadragons enjoy hiding in the scarlet kelp fronds of the Polyp Forest, where they can observe their surroundings without being noticed. Don’t underestimate them, as their silly-looking faces can shoot highly poisonous pellets! -LazarusLampfish: No less than living fossils, Lazarus Lampfish were long thought to be extinct. Their species survived for millions of years in the secluded depths of the Ilmeran Sea, using bright flashes of light emitted from their “lamp” to great defensive effect. -Leerslug: Named for their unsightly snapping teeth, the Leerslug uses the rather cruel reproduction method of laying their eggs within the skin of Searslugs. Once their lethargic and shaky host is no longer needed, they violently erupt out and bite another Searslug, continuing the cycle. -LostShoal: Shoals of spectral fish swim through the damp air of the Sunken shoreline, fully ignorant of their ominous demeanor and the horrible fate that befell them. -Pearlpod: Residing in the utmost depths of the Sunken Sea, these docile crustaceans consume Lantern Kelp and organic remains to survive. When curled up, their nacreous hide makes them almost identical to pearls and impervious to attacks. -PodobooKoi: The basaltic canyons are constantly being scouted by these giant Koi, whose lateral plates mineralize into an impenetrable set of armor. Carnivorous and volatile, not even the tough magmatic rock will save prey from their insatiable hunger. -PolypPanasea: The vibrant Panaseas developed a natural coating which counters the toxins of polyps, and now frequently take shelter in their tentacles. Anything that chases the fish into their home swiftly learns about the other side of this partnership. -Polyperil: Comprising a large portion of the polyp that lends the Polyp Forest its name, these sea anemone capture small prey through the venomous toxins that coat their tentacles. They have developed a mutualistic relationship with the Panaseas that populate the Forest, providing protection in exchange for live meals that give chase to the Panasea, along with nutrients from its waste. -PrismBack: Far too slow and bulky to hunt normally, these turtles subsist on a diet of purely kelp. As a result of their slow and infrequent movement, large prisms are able to accumulate on their backs, providing natural protection against threats that would not risk swallowing a razor-sharp crystal. -PrismaticGuppy: Is it a crystal? Is it a candy? No, it's a little Guppy! Thanks to the unique prismatic sheen of their scales and their striking geometric shapes, these fish can camouflage as Sea Prisms to escape pursuing predators. -Probesnout: One of just a few known seahorse species who miraculously survived the Incineration. Its efficient snout allows it to streamline nutrients from the abundant sponge in the reefs that it lives in. -SandProwler: These colorful sea serpents prowl through the sand, looking for the gleam of an unsuspecting Guppy to snack on. Due to this creature’s habit of mistakenly capturing dropped coins, Ilmerians fond of avarice began to share the namesake. -Scavenger: This odd species of crab migrated to Ilmeris after its fateful incineration. Gifted with a remarkable sense of ownership and value, they hoard any scavenged treasures as a display of social status. Trade is not a foreign concept to their tribe, and they value Pearls above all else. -SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices to find kelp due to their thin bodies. These particular flatworms are incredibly skittish, and thus fled with plenty of time to be spared from the infernal carnage. -SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things one could witness during the days when Ilmeris was unsundered. Though the kingdom's grandeur has been lost like ashes in the wind, the tranquil fish continue to swim at peace, a breathtaking reminder that not all was lost. -Searslug: A distant cousin of the Slugbuns which can withstand the extreme heat of molten basalt. Their skin is scalding to the touch, a side effect of their adaptations to the many lava dips needed to squirm around the regions it lives in. -Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave. -Shoreskipper: This fish stands out among the coastal fauna, showing its peers a hostility unseen in its interactions with other creatures. Their outlandish behavior has fueled centuries of analogies for the folly of bipolar moral judgement. -Slugbun: The name of these cute sea dwellers is actually a misnomer given to them by outside visitors of the sea kingdom, who often sold them as exotic pets. In fact, their "bunny ear" appendages are actually their antennae taking on the appearance of the various sea prisms scattered throughout their home. -Steampod: These distant relatives of the Pearlpods possess a powerful environmental adaptation. Their ability to eject steam propels themselves through the air as a deadly pneumatic boulder that packs quite a punch. -Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. -StormlionSentry: Some Ilmeran survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. +BabyGhostBell: Ghost Bells were bred in large numbers during the Ilmeran war, due to the Ilmerian army needing a staggering amount of electricity to keep Yharim and his forces at bay. Alas, their efforts were for naught, and the kingdom collapsed after the Great Incineration. +BlindedAngler: Lacking most normal senses, these predators use a form of biological sonar to 'see' their surroundings. The glowing crystals on their backs draw in prey that use the sea's shimmering prisms as their guiding light, like a moth to the flame. +Clam: Clams once lived in the upper portion of the Ilmeran Sea before the Incineration, being forced to relocate after the battle. Though it was thanks in part to their adaptability and hardiness that their species survived, luck was also certainly on their side. +Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, cnidrions survived the Incineration due to their sheer might. They continue to defend what was once the heart of the sea kingdom from intruders, maintaining a fierce loyalty to their masters even after they have passed on. +EutrophicRay: Eutrophic Rays have formed a commensalistic relationship with Ghost Bells. The rays can store energy given by the Ghost Bells for electrical muscle stimulation, allowing for great bursts of speed. +GhostBell: These high-voltage jellyfish can incapacitate most with a single touch, and were a major factor in the Ilmerian army's strength. The sea kingdom used the electricity produced by Ghost Bells to drive back Yharim's forces, electrifying the waters so that none could cross their borders. +GiantClam: Clams slowly crystalise ambient magic around themselves into pearls, and as they grow larger, so too do their pearls. Upon growing to their full size, they are classified as Giant Clams, and gain the ability to use the magic stored in their pearls to some degree. +PrismBack: Due to the beautiful prisms and calm behavior, these animals have been taken in as pets by many over the course of centuries, even outside of Ilmeris. Though far too slow and bulky to hunt normally, the sea prisms on their back act as a lure for small fish. +SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices due to their thin bodies. These particular flatworms only ever inhabited the lower sea, and were left entirely unthreatened by the carnage that annihilated most species' homes. +SeaMinnow: Schools of sea minnows were one of the most beautiful things one could witness during the days when Ilmeris was unshattered. Those permitted into the kingdom would gather to see these fish swimming in the open sea… yet, this is but a distant past now, even for the minnows themselves. +SeaSerpent: Despite being one of the few carnivorous creatures to have ever existed in the Ilmeran Sea, even these serpents are unusually passive towards those they do not consider prey by the standards of elsewhere. The sea has only ever known one truly aggressive predator, and it abandoned a life of calming solitude years ago. +Stormlion: Some survivors of Ilmeris' downfall claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity from the battle remains buried in the sands, with several antlions having learned to both channel and harness the former kingdom's power. //Town NPCs AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to spread the Steampunker's solutions rather than clean dust and debris off of floors. They can be used to purify the world– or ruin it further, if one so desires. Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. @@ -155,6 +137,7 @@ Bandit: The bandit may have a bad habit of looting battlefields and taking what BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. TownPiggy: Waddles its little legs around with little purpose. Rumored to be a clever and obsessive hoarder. +ShadySalesman: A shady wandering merchant with even shadier products. The median buyer would question their quality, but their morbidly enticing allure is unquestionable. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance they bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index e0bdacb71f..d6072bc9bf 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -81,11 +81,6 @@ AstralCaveDesert: { TownNPCDialogueName: the Astral Cave Desert } -FloralParadiseBiome: { - DisplayName: Floral Paradise - TownNPCDialogueName: the Floral Paradise -} - BasaltGullyBiome: { DisplayName: Basalt Gully TownNPCDialogueName: the Basalt Gully diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 8654987ae4..e77cb7d5db 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -507,6 +507,11 @@ BearBuff: { Description: A guardian angel is following you } +BeldumBuff: { + DisplayName: Iron Ball + Description: Extra shiny! +} + BloodBound: { DisplayName: Blood Bound Description: You must be desperate for company @@ -821,7 +826,7 @@ AeolianEarthBuff: { You are strengthened by primordial powers Damage reduction increased by {0}%, damage increased by {1}%, and massively buffed mana regen ''' - ItemTooltipPlayer: Increases damage, damage reduction, and mana regeneration + ItemTooltipPlayer: Increases your damage reduction by 8%, damage by 15%, and massively buffs mana regen } Afflicted: { @@ -913,9 +918,15 @@ Encased: { Description: Increased defense by {0} and damage reduction by {1}%, but... } -FortunesFavor: { - DisplayName: Fortune's Favor - Description: How bold. Life regen increased by {0} HP/s +FulfilledContract: { + DisplayName: Fulfilled Contract + Description: A reward earned through blood and tears + ItemTooltipPlayer: + ''' + 25% reduced Healing Potion cooldown + 75% increased natural regeneration power + All attacks inflict Laceration + ''' } GraxBoost: { @@ -1027,7 +1038,7 @@ ReaverRage: { Rage of the earth Defense increased by {0} and damage increased by {1}% ''' - ItemTooltipPlayer: Increased defense and damage + ItemTooltipPlayer: Increases your defense by 5 and damage by 10% } SandsWindBuff: { @@ -1037,7 +1048,7 @@ SandsWindBuff: { You are strengthened by the powers of sand Defense increased by {0}, damage increased by {1}%, and greatly buffed mana regen ''' - ItemTooltipPlayer: Increases damage, defense, and mana regeneration + ItemTooltipPlayer: Increases your defense by 4, damage by 12%, and greatly buffs mana regen } SilvaRevival: { @@ -1235,7 +1246,7 @@ WitherDebuff: { Withered... Defense decreased by {0} ''' - ItemTooltipEnemy: Decreases defense + ItemTooltipEnemy: Decreases defense by 20 } // Summons @@ -1274,9 +1285,9 @@ BabyBloodCrawlerBuff: { Description: The baby blood crawler will protect you } -BabySlimeGodBuff: { - DisplayName: Baby Slime God - Description: The Slime God will protect you +BabyPaladinBuff: { + DisplayName: Baby Paladin + Description: The blighted paladin will protect you } BabyStormlionBuff: { @@ -1294,6 +1305,11 @@ BlackHawkBuff: { Description: The fighter jet will protect you } +BlightedSlime: { + DisplayName: Blighted Slime + Description: The blighted slime will protect you +} + BrimseekerBuff: { DisplayName: Brimseeker Description: Does it want something from you? @@ -1334,11 +1350,6 @@ CloudElemental: { Description: The Cloud Elemental will protect you } -Corroslime: { - DisplayName: Corroslime - Description: The corroslime will protect you -} - CorvidHarbringerBuff: { DisplayName: Raven Description: The powerful raven will protect you @@ -1359,11 +1370,6 @@ CosmilampBuff: { Description: The cosmilamp will protect you } -Crimslime: { - DisplayName: Crimslime - Description: The crimslime will protect you -} - DaedalusCrystalBuff: { DisplayName: Daedalus Crystal Description: The Daedalus crystal will protect you @@ -1630,11 +1636,6 @@ SarosPossessionBuff: { Description: A radiant aura protects you } -SeashineSwordBuff: { - DisplayName: Seashine Sword - Description: A beautiful dance of crystalline blades... -} - SeaSnailBuff: { DisplayName: Sea Snail Description: Meow? @@ -1776,7 +1777,7 @@ Daybroken: { Shadowflame: { DisplayName: Shadowflame ItemTooltipPlayer: Heat - 15 DPS - ItemTooltipEnemy: Heat - 30 DPS + ItemTooltipEnemy: Heat - 20 DPS } ForbiddenStealthSummonTagBuff: { @@ -1808,14 +1809,16 @@ SmashedEvil: { Description: Increased damage, movement speed, and regeneration ItemTooltipEnemy: ''' - All types - 20 DPS + All types - 80 DPS + Ignores enemy weaknesses and resistances +5 damage taken ''' ItemTooltipPlayer: ''' - Regen returns to full strength 200% faster - 10% increased damage - 20% increased movement speed + Natural regeneration is much stronger and returns much quicker + 20% increased damage + Increased acceleration and deceleration + 5mph increased top speed ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index 9868158c52..96b23c9436 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -24,6 +24,11 @@ AbyssBreathLevel2: Moderately reduces breath loss in the abyss AbyssBreathLevel3: Greatly reduces breath loss in the abyss AlcoholWarning: Drinking more than 3 different alcohols might not end well with your liver ArmorPenetration: Ignores {0} points of enemy Defense +SalesmanShrinePitch: + ''' + 'You know that neat treasure you found when I was definitely not following you?' + 'Turns out there was a whole pile of those trinkets, stashed conveniently close to the treasure chest! Finders keepers - or perhaps you wanna seal a deal?' + ''' AverageDamageInfo: This weapon scales with the average of all your damage stats CanMineUelibloom: Can mine Uelibloom Ore NotConsumable: Not consumable diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index b757a152d4..a9982d1452 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -33,15 +33,16 @@ Drops: { DownedExos: After defeating the Exo Mechs DownedSCal: After defeating Calamitas DownedAEW: After defeating the Primordial Wyrm + DownedHorribleHog: After defeating the Horrible Hog DownedClam: After defeating the Giant Clam DownedClamHM: After defeating the Giant Clam in Hardmode DownedGSS: After defeating the Great Sand Shark DownedBetsy: After defeating Betsy + DownedDreadnautilus: After defeating Dreadnautilus DownedT1AR: After defeating the first tier of Acid Rain 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 @@ -51,7 +52,6 @@ Drops: { // Other conditions HasFlareGun: While holding a Flare Gun upgrade -LacewingBestiary: When at least 40% of the Bestiary has been completed CrescentMoons: During a crescent moon GibbousMoons: During a gibbous moon HasRogueArmor: While wearing rogue armor @@ -62,3 +62,11 @@ InSulph: In the Sulphurous Sea InSunken: In the Sunken Sea InRev: In Revengeance Mode InRevOrMM: In Revengeance Mode or in Master Mode +HasFoundCorruptionEffigy: After obtaining Corruption Effigy +HasFoundCrimsonEffigy: After obtaining Crimson Effigy +HasFoundUnstableGraniteCore: After obtaining Unstable Granite Core +HasFoundGladiatorsLocket: After obtaining Gladiator's Locket +HasFoundFrozenCube: After obtaining Frozen Cube +HasFoundTrinketOfChi: After obtaining Trinket of Chi +HasFoundFungalSymbiote: After obtaining Fungal Symbiote +HasFoundLuxorsGift: After obtaining Luxor's Gift diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index d4d7fac81b..fdee9b12c9 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -6,7 +6,7 @@ CalamityClientConfig: { Graphics: Graphics Changes UI: UI Changes MeterPositions: Meter Positions - MusicToggles: Music Toggles + AudioToggles: Audio Toggles } AbyssLayer3Alt: { @@ -41,6 +41,15 @@ CalamityClientConfig: { ''' } + BoCSpriteChange: { + Label: "[i:BrainOfConfusion] Remove Potentially Disturbing Imagery" + Tooltip: + ''' + Replaces some boss sprites to remove potentially upsetting imagery that could trigger phobias. + Highly recommended if you are uncomfortable with body horror or have trypophobia. + ''' + } + BossHealthBarExtraInfo: { Label: "[i:CalamityMod/EncryptedSchematicPlanetoid] Boss Health Bar Extra Info" Tooltip: @@ -101,15 +110,6 @@ CalamityClientConfig: { ''' } - EnableVanillaTextureEdits: { - Label: "[i:Paintbrush] Enable Vanilla Texture Edits" - Tooltip: - ''' - Enables slight edits to vanilla boss textures to improve attack telegraphs. - Disable this for compatibility with texture packs. - ''' - } - EnergyShieldOpacity: { Label: "[i:CalamityMod/TheSponge] Energy Shield Opacity" Tooltip: @@ -187,6 +187,15 @@ CalamityClientConfig: { ''' } + MisophoniaSupport: { + Label: "[i:Megaphone] Disable Potentially Triggering Audio" + Tooltip: + ''' + Disables or alters multiple repetitive and potentially distressing sound effects. + Highly recommended for those with misophonia. + ''' + } + ParticleLimit: { Label: "[i:FragmentStardust] Max Particle Limit" Tooltip: @@ -208,15 +217,6 @@ CalamityClientConfig: { ''' } - BoCSpriteChange: { - Label: "[i:BrainOfConfusion] Remove Potentially Disturbing Imagery" - Tooltip: - ''' - Replaces some boss sprites to remove potentially upsetting imagery that could trigger phobias. - Highly recommended if you are uncomfortable with body horror or have trypophobia. - ''' - } - RageMeterPosX: { Label: "[i:LaserRuler] Rage Meter X Position" Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson index 4b00ee161b..e91a8731b3 100644 --- a/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson +++ b/Localization/en-US/Mods.CalamityMod.DamageClasses.hjson @@ -5,3 +5,4 @@ StealthDamageClass.DisplayName: stealth damage TrueMeleeDamageClass.DisplayName: true melee damage TrueMeleeNoSpeedDamageClass.DisplayName: true melee damage VoidTagDmgType.DisplayName: void tag damage +AllClassDamageClass.DisplayName: all-class damage diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 367ad5e519..b914d0c5d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -128,6 +128,16 @@ TarragonWings: { ''' } +TiredTail: { + DisplayName: Tired Tail + Tooltip: + ''' + {$CommonItemTooltip.FlightAndSlowfall} + {$CommonItemTooltip.PressDownToHover} + {$CommonItemTooltip.PressUpToBooster} + ''' +} + VoidStriders: { DisplayName: Void Striders TreadsName: Void Kicks diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 98e8cdbd16..576833de12 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -52,7 +52,7 @@ AeroStone: { DisplayName: Aero Stone Tooltip: ''' - Provides an additional {0} seconds of flight time + Grants {0} additional seconds of flight time You slowly recover flight time while in the air while not flying or gliding 'One of the ancient relics' ''' @@ -104,6 +104,11 @@ AmbrosialAmpoule: { ''' } +AmidiasPendant: { + DisplayName: Amidias' Pendant + Tooltip: Periodically rains down prism shards that can briefly stun enemies +} + AncientFossil: { DisplayName: Ancient Fossil Tooltip: @@ -221,9 +226,10 @@ AscendantInsignia: { DisplayName: Ascendant Insignia Tooltip: ''' - Increases wing flight time by {0}%, movement and jump speed by {1}%, and acceleration by {2}x - Pressing [KEY] grants you the power of ascension, providing infinite flight time for {3} seconds - Ascension has a {4} second cooldown + Grants {0} additional seconds of flight time + Increases movement speed by {1}%, jump speed by {2}%, and acceleration by {3}x + Pressing [KEY] fully restores flight time and prevents it from decreasing for {4} seconds + This ability has a {5} second cooldown ''' } @@ -233,7 +239,7 @@ AsgardianAegis: { ''' {$Common.KnockbackImmunity} Allows the ability to ram dash, empowered by a cosmic inferno - This dash can ram through enemies without taking damage, inflicting [cbuff:CalamityMod/GodSlayerInferno] + This dash can ram through enemies without taking damage ''' } @@ -247,15 +253,6 @@ AsgardsValor: { ''' } -FadedIdolatry: { - DisplayName: Faded Idolatry - Tooltip: - ''' - Summoned [i:CalamityMod/YharonsKindleStaff] Fiery Draconids cost one less minion slot - [c/ffe100:'Once everything has crumbled to dust, what will be left of the world you created?'] - ''' -} - BadgeofBravery: { DisplayName: Badge of Bravery Tooltip: @@ -296,20 +293,6 @@ BlackGlassBand: { ''' } -BlazingCore: { - DisplayName: Blazing Core - Tooltip: - ''' - {$Common.KnockbackImmunity} - The searing core of the Profaned Goddess - Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal - Being hit shortly after encasement will shatter the crystal - Upon shattering, holy stars spiral outwards and damage taken is negated - After shattering, this damage reduction effect goes on cooldown - Damage parried whilst on cooldown summons additional healing stars, and will not be reduced - ''' -} - BloodflareCore: { DisplayName: Bloodflare Core Tooltip: @@ -325,8 +308,8 @@ BloodPact: { Tooltip: ''' Increases max HP by 25% - Grants immunity to Bleeding, Burning Blood and Heavy Bleeding Healing Potions are 33% more effective + Grants immunity to [cbuffplr:Bleeding], [cbuffplr:CalamityMod/BurningBlood] and [cbuffplr:CalamityMod/HeavyBleeding] ''' } @@ -390,12 +373,12 @@ ChaliceOfTheBloodGod: { Tooltip: ''' Increases max HP by 25% - Grants immunity to Bleeding, Burning Blood, Heavy Bleeding and Laceration +2 HP/s life regen and reduces the cooldown of healing potions by 25% Taking more than 5 damage converts the hit into a damage over time bleed effect This bleeding does not interfere with life regeneration Drinking a healing potion removes some of the remaining bleed, up to 50% of its heal value Unequipping this accessory while bleeding inflicts the remaining damage instantly + Grants immunity to [cbuffplr:Bleeding], [cbuffplr:CalamityMod/BurningBlood], [cbuffplr:CalamityMod/HeavyBleeding], and [cbuffplr:CalamityMod/Laceration] 'All that for a drop of blood...' ''' } @@ -436,7 +419,7 @@ CorrosiveSpine: { Tooltip: ''' 5% increased movement speed - 25% increased Sickness and Water debuff damage + 50% increased Sickness and Water debuff damage All attacks inflict [cbuff:CalamityMod/Irradiated] and reduces the severity of the sulphuric waters You burst into radioactive clouds when struck ''' @@ -469,6 +452,15 @@ CrownJewel: { ''' } +CrushingEgo: { + DisplayName: Crushing Ego + Tooltip: + ''' + Multiplies all damage by 1.3x, but at the cost of taking 20% increased damage + [c/ff00ff:'Don the mask of arrogance, and dance by your lonesome. Once the ball has gone quiet, you'll be the last man standing.'] + ''' +} + CryoStone: { DisplayName: Cryo Stone Tooltip: @@ -588,12 +580,17 @@ DiamondOfTheDeep: { ''' } -CrushingEgo: { - DisplayName: Crushing Ego +DivineProvidence: { + DisplayName: Divine Providence Tooltip: ''' - Multiplies all damage by 1.3x, but at the cost of taking 20% increased damage - [c/ff00ff:'Don the mask of arrogance, and dance by your lonesome. Once the ball has gone quiet, you'll be the last man standing.'] + {$Common.KnockbackImmunity} + Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal + Being hit shortly after encasement will shatter the crystal + Upon shattering, holy stars spiral outwards and damage taken is negated + After shattering, this damage reduction effect goes on cooldown + Damage parried whilst on cooldown summons additional healing stars, and will not be reduced + [c/FF8C00:The searing core of the Profaned Goddess] ''' } @@ -658,20 +655,6 @@ EclipseMirror: { FlavorTooltip: "'Its reflection shows naught but darkness'" } -FragmentsOfAnotherWorld: { - DisplayName: Fragments of Another World - Tooltip: - ''' - Grants immunity to [cbuffplr:CalamityMod/WhisperingDeath] - {0}% increased melee speed - {1}x specialist ranged damage - {2}% reduced mana usage - +{3} maximum sentries - {4}% increased rogue attack speed - [c/ff0000:'Don't speak of your desires to the shadows, they listen.'] - ''' -} - ElectriciansGlove: { DisplayName: Electrician's Glove Tooltip: @@ -696,7 +679,11 @@ ElementalGauntlet: { ElementalinaBottle: { DisplayName: Elemental in a Bottle - Tooltip: Summons a sand elemental to fight for you + Tooltip: + ''' + Summons a sand elemental to fight for you + The elemental has reduced opacity if visibility is disabled + ''' } ElysianAegis: { @@ -705,7 +692,7 @@ ElysianAegis: { ''' {$Common.KnockbackImmunity} Allows the ability to dash, empowered by holy fire - This dash can ram through enemies without taking damage, inflicting [cbuff:CalamityMod/HolyFlames] + This dash can ram through enemies without taking damage 'Blessed by the Profaned Flame' ''' } @@ -753,7 +740,20 @@ EvasionScarf: { EyeoftheStorm: { DisplayName: Eye of the Storm - Tooltip: Summons a Cloud Elemental to fight for you + Tooltip: + ''' + Summons a Cloud Elemental to fight for you + The elemental has reduced opacity if visibility is disabled + ''' +} + +FadedIdolatry: { + DisplayName: Faded Idolatry + Tooltip: + ''' + Summoned [i:CalamityMod/YharonsKindleStaff] Fiery Draconids cost one less minion slot + [c/ffe100:'Once everything has crumbled to dust, what will be left of the world you created?'] + ''' } FeatherCrown: { @@ -764,7 +764,8 @@ FeatherCrown: { Each [c/81B7F7:Skyline Feather] increases magic damage by 2% and decreases mana cost by 1% With 5 feathers, increases magic critical strike chance by 5% and all magic attacks inflict [cbuff:CalamityMod/StaticDischarge] Running out of mana or drinking a mana potion sheds all feathers - Upon shedding a feather, no new feathers can be gained for 5 seconds + Upon shedding a feather, no new feathers can be gained for 5 seconds + Feathers are transparent and silent if visibility is disabled ''' HoldShiftTooltip: ''' @@ -794,12 +795,17 @@ FishStocks: { +10% critical strike chance +15% critical strike damage +10% damage reduction - +3HP/s life regeneration + +3 HP/s life regeneration +25% mining speed +50 fishing power +0.55 luck 1.5x coin drops ''' + SalesPitch: + ''' + 'Fishing is hard, but you know what's easy? Economy! With this little gadget made by my partner Hoggart, you can make the process just as easy!' + 'Pull the line when it's up, don't when it's down! It's as simple as that!' + ''' } FlameLickedShell: { @@ -824,7 +830,22 @@ FleshTotem: { Summons an effigy above your head that stores mana as you use it, up to 600 mana The effigy occasionally pulses, restoring 25 mana Pulses appear more frequently the more mana is stored - Upon being struck, the effigy unleashes all stored up mana as vengeful souls that chase your enemies + Upon being struck, the effigy unleashes half of all stored up mana as vengeful souls that chase your enemies + The effigy is transparent and silent if visibility is disabled + ''' +} + +FragmentsOfAnotherWorld: { + DisplayName: Fragments of Another World + Tooltip: + ''' + Grants immunity to [cbuffplr:CalamityMod/WhisperingDeath] + {0}% increased melee speed + {1}x specialist ranged damage + {2}% reduced mana usage + +{3} maximum sentries + {4}% increased rogue attack speed + [c/ff0000:'Don't speak of your desires to the shadows, they listen.'] ''' } @@ -833,7 +854,7 @@ FrostBarrier: { Tooltip: ''' You will freeze nearby enemies when you are struck - Grants immunity to Chilled and Frostburn + Grants immunity to [cbuffplr:Chilled] and [cbuffplr:Frostburn] ''' } @@ -842,13 +863,30 @@ FrostFlare: { Tooltip: ''' All attacks and projectiles inflict [cbuff:Frostburn2] - Grants immunity to Frostburn, Chilled and Frozen Being above {0}% life grants {1}% increased damage Being below {0}% life grants {2} defense and {3}% increased max movement speed and acceleration - Grants resistance against cold attacks + Grants resistance against cold attacks, [cbuffplr:Frostburn], [cbuffplr:Chilled] and [cbuffplr:Frozen] ''' } +FrozenCube: { + DisplayName: Frozen Cube + Tooltip: + ''' + A frozen block of ice with something inside + Summons an Elumphant to sit atop your head and protect you + The Elumphant will cycle between shooting cold air that inflicts [cbuff:CalamityMod/WindChilled], and headbutting enemies + Elumphant's headbutts only target enemies inflicted with [cbuff:CalamityMod/WindChilled] + Reduces your defense by 33%, but uses that defense to boost the Elumphant's power and your cold debuff damage + [DAMAGELINE] + [c/7497ED:'What I wanna know is, where's the mammoth?'] + ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" + EquippedDebuff: Current Cold Debuff boost: +{0}% + EquippedElumphant: Current Elumphant Power: {0}% + Unequipped: Equip this accessory to view its statistics +} + FungalClump: { DisplayName: Fungal Clump Tooltip: @@ -863,9 +901,10 @@ FungalSymbiote: { Tooltip: ''' You grow mushrooms on the grass beneath you - Consuming mushrooms provides [cbuffplr:CalamityMod/Mushy], granting 5 defense and +1 HP/s life regen + Consuming mushrooms provides [cbuffplr:CalamityMod/Mushy], granting 3 defense and +1 HP/s life regen 10% increased damage while you have [cbuffplr:CalamityMod/Mushy] ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } GiantPearl: { @@ -873,8 +912,7 @@ GiantPearl: { Tooltip: ''' You have a light aura around you - Enemies within the aura are afflicted with [cbuff:CalamityMod/PearlAura] and slowed down - Enemies that remain within the aura are bombarded by homing prism shards + Enemies within the aura are slowed down {$Common.AbyssGlow} ''' } @@ -905,6 +943,7 @@ GladiatorsLocket: { Enemies drop a healing orb on kill Gain an increase to your damage and movement speed the lower your health is, up to 20% at 50% life or below ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } GloveOfPrecision: { @@ -953,12 +992,17 @@ HallowedRune: { HarpyRing: { DisplayName: Harpy Ring - Tooltip: 10% increased movement speed and 20% increased flight time + Tooltip: 20% increased movement speed and flight time } HeartofDarkness: { DisplayName: Heart of Darkness Tooltip: You constantly gain rage over time, and rage does not fade away when out of combat + SalesPitch: + ''' + 'Some people enjoy simple truths in life: good and evil, health and sickness.' + 'I'm not sure how healthy they are, but these edgy gadgets are bound to get your blood pumping! Help me give them simple labels and I'll give you a heart-stopping discount!' + ''' } HeartoftheElements: { @@ -966,6 +1010,7 @@ HeartoftheElements: { Tooltip: ''' Summons all elementals to protect you + The elementals have reduced opacity if visibility is disabled 'The heart of the world' ''' } @@ -997,12 +1042,7 @@ HowlsHeart: { IlmerisSpark: { DisplayName: Ilmeris' Spark - Tooltip: - ''' - Attacks inflict [cbuff:CalamityMod/StaticDischarge] while underwater - Taking damage causes the enemy to be shocked - Shocked enemies constantly release sparks - ''' + Tooltip: Taking damage releases a blast of sparks } InfectedJewel: { @@ -1073,7 +1113,7 @@ JellyChargedBattery: { Tooltip: ''' Increases your max number of minions by 1, and summon damage by 7% - Minion attacks create orbs of [cbuff:CalamityMod/StaticDischarge] + Minion attacks create charged orbs ''' } @@ -1096,7 +1136,7 @@ LeviathanAmbergris: { Tooltip: ''' 100% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration - Your dashes are empowered by water, knocking back and damaging enemies with vicious currents that inflict [cbuff:CalamityMod/RiptideDebuff] + Your dashes are empowered by water, knocking back and damaging enemies with vicious currents Visual effects are reduced if visibility is disabled ''' } @@ -1124,6 +1164,7 @@ LuxorsGift: { Held item class is not updated when holding a tool When not in use, the scarab will condense itself into a small orb of light ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } ManaPolarizer: { @@ -1168,7 +1209,8 @@ MoonstoneCrown: { With 5 sigils, increases mana regeneration by +5 MP/s With 10 sigils, increases magic critical strike chance by 10% and all magic attacks inflict [cbuff:CalamityMod/Nightwither] Running out of mana or using a mana potion shatters all sigils - Upon shattering a sigil, no new sigils can appear for 5 seconds + Upon shattering a sigil, no new sigils can appear for 5 seconds + Sigils are transparent and silent if visibility is disabled ''' HoldShiftTooltip: ''' @@ -1193,10 +1235,10 @@ NebulousCore: { DisplayName: Nebulous Core Tooltip: ''' - 10% increased damage + {0}% increased damage Summons floating nebula stars to protect you - Taking a fatal hit revives you to 100 HP - This effect has a 90 second cooldown + Taking a fatal hit revives you to {1} HP + This effect has a {2} second cooldown ''' } @@ -1234,6 +1276,16 @@ Nucleogenesis: { ''' } +OasisElementalinaBottle: { + DisplayName: Oasis Elemental in a Bottle + Tooltip: + ''' + Summons an oasis elemental to assist you + The elemental fires healing orbs that restore 10 health while you are damaged + The elemental has reduced opacity if visibility is disabled + ''' +} + OccultSkullCrown: { DisplayName: Occult Skull Crown Tooltip: @@ -1296,7 +1348,7 @@ OrnateShield: { Tooltip: ''' Allows the ability to dash - This dash can ram through enemies without taking damage, inflicting [cbuff:Frostburn2] + This dash can ram through enemies without taking damage ''' } @@ -1306,6 +1358,7 @@ PearlofEnthrallment: { ''' Summons a water elemental to fight for you The elemental stays above you, shooting water spears, ice mist, and treble clefs at nearby enemies + The elemental has reduced opacity if visibility is disabled ''' } @@ -1343,7 +1396,7 @@ PlaguedFuelPack: { 8% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards diagonal dash - This dash leaves a trail of plagued clouds + The dash leaves a lingering trail of [cbuff:CalamityMod/Plague] clouds This effect has a 1 second cooldown before it can be used again ''' } @@ -1467,21 +1520,12 @@ RampartofDeities: { ToggleEffect: ", increases movement speed," } -OasisElementalinaBottle: { - DisplayName: Oasis Elemental in a Bottle - Tooltip: - ''' - Summons an oasis elemental to assist you - The elemental fires healing orbs that restore 10 health while you are damaged - ''' -} - ReaperToothNecklace: { DisplayName: Reaper Tooth Necklace Tooltip: ''' 20% increased damage - Increases armor penetration by 15 + Increases armor penetration by 30 'A grisly trophy from the ultimate predator' ''' } @@ -1505,7 +1549,11 @@ RogueEmblem: { RoseStone: { DisplayName: Rose Stone - Tooltip: Summons a Brimstone Elemental to fight for you + Tooltip: + ''' + Summons a Brimstone Elemental to fight for you + The elemental has reduced opacity if visibility is disabled + ''' } RottenBrain: { @@ -1646,12 +1694,8 @@ ShieldoftheOcean: { DisplayName: Shield of the Ocean Tooltip: ''' - Pressing [KEY] will activate a parry, encasing you in a bubble - Being hit shortly after encasement will pop the bubble, granting 60% DR for that hit - Upon popping, nearby enemies are violently launched away from you, and will be damaged if they collide with tiles - Enemies which cannot be launched instead directly take large damage - After popping, the damage reducing effect goes on a 20 second cooldown - Damage parried whilst on cooldown will not be reduced, and will not deal collision damage to launched enemies + Increased defense by 5 when submerged in liquid + 10% increased movement speed and +1 HP/s life regen while wearing Victide armor ''' } @@ -1725,7 +1769,7 @@ StarbusterCore: { Tooltip: ''' Increases your max number of minions by 1 - Summons release an [cbuff:CalamityMod/AstralInfectionDebuff] explosion on enemy hits + Summons release an astral explosion on enemy hits ''' } @@ -1870,6 +1914,11 @@ StressPills: { Adrenaline charges 20% faster Increases your max movement speed and acceleration by 5% ''' + SalesPitch: + ''' + 'Some people enjoy simple truths in life: good and evil, health and sickness.' + 'I'm not sure how healthy they are, but these edgy gadgets are bound to get your blood pumping! Help me give them simple labels and I'll give you a heart-stopping discount!' + ''' } SupremeBaitTackleBoxFishingStation: { @@ -1981,6 +2030,21 @@ TheFirstShadowflame: { ''' } +ThePact: { + DisplayName: The Pact + Tooltip: + ''' + Increases your max health by {0}x + Causes {1}% of hits you take to critically strike you + These crits deal {2}x damage and infict [cbuffplr:CalamityMod/FulfilledContract] + ''' + SalesPitch: + ''' + 'Money's a fickle thing, buddy. One slip, and next you know, you're livin' it up... in a dumpster!' + 'Gambling with life itself, that's where it's truly at. Just write my name in your will, would ya?' + ''' +} + ThePointer: { DisplayName: The Pointer Tooltip: @@ -2046,6 +2110,7 @@ TrinketofChi: { This buff expires on hit +{2} HP/s life regen for you and your teammates ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } UnholyTonic: { @@ -2064,6 +2129,7 @@ UnstableGraniteCore: { Gain an energy field that periodically zaps enemies with arcing energy The arcing energy ignores a substantial amount of enemy defense ''' + SalesPitch: "{$CommonItemTooltip.SalesmanShrinePitch}" } V8Engine: { @@ -2141,7 +2207,7 @@ WarbanneroftheRighteous: { Tooltip: ''' Multiplies all damage based on how close you are to enemies - Maximum damage boost is 15%, minimum damage boost is -15% + Maximum damage boost is 1.15x, minimum damage boost is 0.85x Emit a blazing aura that burns and repels nearby enemies with [cbuff:CalamityMod/HolyFlames] Enemies take increasing damage the closer they are to you and the longer they are near you Effects are transparent and silent if visibility is disabled @@ -2204,6 +2270,11 @@ GhostBracelet: { Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity } +GlimmeringRibbon: { + DisplayName: Glimmering Ribbon + Tooltip: "'We are born colorless. It's the people we meet who give us color.'" +} + HapuFruit: { DisplayName: Ha-pu Fruit Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'" @@ -2235,12 +2306,7 @@ Popo: { SharkyPlush: { DisplayName: Sharky Plush - Tooltip: "[c/696969:'Look out, for the force without form...']" -} - -GlimmeringRibbon: { - DisplayName: Glimmering Ribbon - Tooltip: "'We are born colorless. It's the people we meet who give us color.'" + Tooltip: "[c/696969:'Like lovers and heroes, and the restless part of everyone...']" } TheComb: { @@ -2280,20 +2346,3 @@ XyksBlessingOrange: { ArmorDisabled: "[c/D44748:DISABLED]" ArmorEnabled: "[c/58D447:ENABLED]" } - -FrozenCube: { - DisplayName: Frozen Cube - Tooltip: - ''' - A frozen block of ice with something inside - Summons an Elumphant to sit atop your head and protect you - The Elumphant will cycle between shooting cold air that inflicts [cbuff:CalamityMod/WindChilled], and headbutting enemies - Elumphant's headbutts only target enemies inflicted with [cbuff:CalamityMod/WindChilled] - Reduces your defense by 33%, but uses that defense to boost the Elumphant's power and your cold debuff damage - [DAMAGELINE] - [c/7497ED:'What I wanna know is, where's the mammoth?'] - ''' - EquippedDebuff: Current Cold Debuff boost: +{0}% - EquippedElumphant: Current Elumphant Power: +{0}% - Unequipped: Equip this accessory to view its statistics -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 26c714ad61..6bfea394d9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -12,7 +12,7 @@ BloodfireArrow: { Tooltip: ''' High-velocity arrows with a blood soaked tip - Firing these arrows will drain your health and boost the arrow damage by 30% + Firing these arrows will drain your health and boost the arrow damage by 20% Accelerates your natural life regen and heals you on hit ''' } @@ -59,7 +59,11 @@ DryadsTear: { ElysianArrow: { DisplayName: Elysian Arrow - Tooltip: On impact, summons purifying light from above and below at the nearest enemy + Tooltip: + ''' + On impact, summons purifying light from above and below at the nearest enemy + Purifying light ignores 15 points of enemy Defense + ''' } FlashRound: { @@ -85,7 +89,7 @@ HailstormBullet: { Tooltip: ''' Once shot, bullets rapidly decelerate - Critical hits cause a flash freeze, dealing additional damage and freezing non-boss enemies + Critical hits cause a flash freeze, dealing additional damage based on your crit chance and freezing enemies ''' } @@ -102,7 +106,7 @@ HolyFireBullet: { DisplayName: Holy Fire Bullet Tooltip: ''' - Profaned bullets that deal 1.15x damage and explode on impact, inflicting [cbuff:CalamityMod/HolyFlames] + Profaned bullets that deal 1.15x damage and explode on impact The explosion is larger and the bullet deals increased damage if impact occurs immediately after firing The extra damage bonus caps at 1.15x ''' @@ -171,7 +175,7 @@ VanquisherArrow: { DisplayName: Vanquisher Arrow Tooltip: ''' - Pierces through tiles and homes in on enemies, inflicting [cbuff:CalamityMod/GodSlayerInferno] + Pierces through tiles and homes in on enemies Tears a rift in space on enemy hits ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 7cd148e6f7..516919d0a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -306,7 +306,7 @@ LunicCorpsHelmet: { DisplayName: Lunic Corps Helmet Tooltip: ''' - Increases non-bow damage by {0}% + Increases non-bow ranged damage by {0}% Improves vision and shows the location of enemies ''' SetBonus: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index e7a6ec4fc8..366d580191 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -249,11 +249,7 @@ BloodflareHeadRogue: { {$Common.RogueStealth} {$BloodflareHeadRogue.SetBonusEffect@1} ''' - SetBonusEffect: - ''' - Grants {0} defense when above {1}% life - {$BloodflareBodyArmor.CommonSetBonus} - ''' + SetBonusEffect: "{$BloodflareBodyArmor.CommonSetBonus}" } BloodflareHeadSummon: { @@ -285,13 +281,17 @@ DemonshadeBreastplate: { {$CommonItemTooltip.PercentIncreasedDamageCritChance@1} {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} {$CommonItemTooltip.PercentChanceToSaveAmmo@3} - Standing still absorbs shadows to grant exponentially accelerating life regen + Standing still grants exponentially accelerating life regen ''' } DemonshadeGreaves: { DisplayName: Demonshade Greaves - Tooltip: Shadow speed + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedMovementSpeed} and {1}% increased acceleration + [c/aaaaaa:Shift- in your inventory to toggle the increased acceleration] + ''' } DemonshadeHelm: { @@ -705,7 +705,6 @@ TarragonHeadRogue: { ''' After every {0} rogue critical hits you will gain {1} seconds of damage immunity This effect has a cooldown of {2} seconds - While under the effects of a debuff you gain {3}% increased rogue damage {$TarragonBreastplate.CommonSetBonus} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index a3bcceedcc..d638e3f292 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -240,60 +240,68 @@ SulphurousLeggings: { VictideBreastplate: { DisplayName: Victide Breastplate - Tooltip: +{0} HP/s life regen + Tooltip: + ''' + 5% increased damage reduction and critical strike chance + +5 defense and 10% increased damage reduction while submerged in liquid + ''' + CommonSetBonus: + ''' + When using any weapon you have a 10% chance to throw a returning seashell projectile + This seashell does true damage and does not benefit from any damage class + Provides increased underwater mobility and slightly reduces breath loss in the abyss + ''' } VictideGreaves: { DisplayName: Victide Greaves - Tooltip: "{$CommonItemTooltip.PercentIncreasedMovementSpeed}" + Tooltip: + ''' + Movement speed increased by 8% + Movement speed increased by 30% while submerged in liquid + ''' } -VictideHeadBarrier: { +VictideHeadMagic: { DisplayName: Victide Hermit Helmet - Tooltip: - ''' - +{0} HP/s life regen - Increases movement acceleration and deceleration by {1}x - ''' + Tooltip: 5% increased magic damage + SetBonus: +1.5 HP/s life regen and 10% increased magic damage while submerged in liquid +} + +VictideHeadMelee: { + DisplayName: Victide Shellmet + Tooltip: 5% increased melee damage SetBonus: ''' - [c/{0}:Warding Wave - Forms a tidal barrier which can be exploded to launch you] - [c/A2D6FF:The barrier grants {1} defense and gradually heals back {2}% of taken damage] - [c/A2D6FF:{3} to disperse it for {4} {^4:second;seconds} and propel you in the direction of the cursor] - [c/A2D6FF:The resulting dash can slam through and damage enemies] + Enemies are more likely to target you + +1.5 HP/s life regen and 10% increased melee damage while submerged in liquid ''' } -VictideHeadBurrow: { +VictideHeadRanged: { + DisplayName: Victide Coral Turban + Tooltip: 5% increased ranged damage + SetBonus: +1.5 HP/s life regen and 10% increased ranged damage while submerged in liquid +} + +VictideHeadRogue: { DisplayName: Victide Headcrab - Tooltip: - ''' - {0}% increased movement speed and acceleration - Grants underwater breathing and slightly reduces breath loss in the abyss - ''' + Tooltip: 5% increased rogue damage SetBonus: ''' - Allows quick travel in water - [c/{0}:Bubbly Burrow - {1} to transform into an agile water spirit for a short time] - [c/A2D6FF:The spirit can be controlled through movement keys and can traverse through tiles] - [c/A2D6FF:While in spirit form, you are impervious to most damage but unable to use items] - [c/A2D6FF:This effect lasts {2} {^2:second;seconds} and has a cooldown of {3} {^3:second;seconds}] + +60 maximum stealth + +1.5 HP/s life regen and 10% increased rogue damage while submerged in liquid ''' } -VictideHeadSnail: { +VictideHeadSummon: { DisplayName: Victide Mask - Tooltip: - ''' - {$CommonItemTooltip.IncreasesFishingPowerBy} - {$Common.AggroReduction} - ''' + Tooltip: 10% increased summon damage SetBonus: ''' - Increases pickup range for items - [c/{0}:Helper Angler - Summons a sea snail to fish alongside you] - [c/A2D6FF:It automatically casts and reels as you are standing still and fishing] - [c/A2D6FF:Equipped fishing abilities and stats are inherited from its owner] + +1 max minion + Summons a sea snail to protect you + +1.5 HP/s life regen and 10% increased summon damage while submerged in liquid ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index 065210f35d..77b4512690 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -268,16 +268,6 @@ TheGrandGarment: { Tooltip: Part of The High-Flying Finery } -VictideCoralTurban: { - DisplayName: Victide Coral Turban - Tooltip: "" -} - -VictideShellmet: { - DisplayName: Victide Shellmet - Tooltip: "" -} - YharonMask: { DisplayName: Yharon Mask Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 13fdcb8767..54d12b191e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -168,6 +168,11 @@ PrismCrate: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } +PrismaticGuppy: { + DisplayName: Prismatic Guppy + Tooltip: Throwing these in an aquarium would be insanity +} + RustedJingleBell: { DisplayName: Rusted Jingle Bell Tooltip: @@ -190,31 +195,10 @@ Serpentuna: { SparklingEmpress: { DisplayName: Sparkling Empress - Tooltip: "[GFB]" - TooltipNormal: + Tooltip: ''' - Fires a stream of erratic magic - After firing for long enough, the fish will shine - Ceasing use of the fish while it shines will restore some of your mana - 'An beautiful fish that seems to feed on mana' - ''' - TooltipGFB: - ''' - Fires a stream of erratic magic - After firing for long enough, the fish will shine - Ceasing use of the fish while it shines will restore some of your mana - 'Hello there, you seem to be an unfamiliar face around here. - Perhaps you are surprised a fish like me is able to speak? - No need for worry, I have no intention of any foul play. - I only hope to find a delectable meal of pure mana on this fine day! - You have a supply of mana, yes? - Would you perchance be so kind as to share a bit with this small fish? - If it is not to your liking do not worry, for I have a compromise to make you. - It should be simple enough, you provide me, the fish, with your mana. - But, in turn I shall provide you plentiful offensive power through my art of fish magic. - Is this an applicable compromise? - Good! - Then let us set out and see the world beyond as I enjoy a fine feast!' + Fires a concentrated laser to annihilate your foes + Defeated enemies explode into prism shards ''' } @@ -277,6 +261,20 @@ HydrothermalCrate: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } +Spadefish: { + DisplayName: Spadefish + Tooltip: + ''' + Throws a spadefish at enemies + Stealth Strikes cause you to spin the spade before throwing, damaging nearby enemies + [c/aaaaaa:Shift- this item in your inventory to [TOGGLE] breaking tiles] + 'How can a fish be used to dig through the ground? + Some questions are best left unanswered...' + ''' + TextWhileEnabled: disable + TextWhileDisabled: enable +} + StuffedFish: { DisplayName: Stuffed Fish Tooltip: Press to extract [HERBS] herbs and [SEEDS] seeds @@ -365,10 +363,11 @@ TheDevourerofCods: { TrustyOldRod: { DisplayName: Trusty Old Rod - Tooltip: + Tooltip: Allows for especially..."exotic" hauls + SalesPitch: ''' - This ol' thing has never failed to pull in a big haul - Who knows what it will reel in next! + 'Me and Hoggart have worked together with the best fishermen in the world to bring you the most effective rod on the market!' + 'With state-of-the-art technology, you can fish anything! Don't let a single creature elude your hook anymore!' ''' } @@ -395,8 +394,13 @@ RageBait: { DisplayName: Rage Bait Tooltip: ''' - The absolute best bait on the market! And for so cheap too... - Even comes with free Sonar Potion effect! + Detects hooked fish + Profoundly unreliable + ''' + SalesPitch: + ''' + 'Do you want to know a secret? Fishing takes so long because the fish are dumb! They'll always swim right by your hook!' + 'But with this bait right here? No longer! It'll make your hook the only thing they can think of. You'll be swimming in fishes in the blink of an eye!' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 442de828f9..5ae7888174 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -58,11 +58,6 @@ Bloodstone: { Tooltip: "" } -BloodstoneCore: { - DisplayName: Bloodstone Core - Tooltip: "" -} - CoreofCalamity: { DisplayName: Core of Calamity Tooltip: "" @@ -218,7 +213,7 @@ PlagueCellCanister: { } PlasmaDriveCore: { - DisplayName: Prototype Plasma Drive Core + DisplayName: Prototype Plasma Drive Tooltip: Despite all the time it spent in storage, its furnace still burns strong } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index dd1317d330..c42e3caa72 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -128,6 +128,11 @@ PiggyItem: { Tooltip: "" } +PiggyGoldItem: { + DisplayName: "{$NPCs.PiggyGold.DisplayName}" + Tooltip: "" +} + PrismaticGuppyBlueItem: { DisplayName: Blue Prismatic Guppy Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson index 36ea72fa67..c774e5f087 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson @@ -106,6 +106,16 @@ HermitsBoxofOneHundredMedicines: { ''' } +IronBall: { + DisplayName: Iron Ball + Tooltip: + ''' + Summons a living iron ball + the pet to pet it + the pet to have it sit on your shoulder + ''' +} + JoyfulHeart: { DisplayName: Joyful Heart Tooltip: It's oddly warm. Attracts the forbidden one diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 0557e9a06b..e234ec701e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -19,6 +19,7 @@ BabyCannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerNa BabyFlakCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BabyGhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BelchingCoralBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BlindedAnglerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BloatfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BloomSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BobbitWormBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -26,7 +27,6 @@ BohldohrBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BoxJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CalamityEyeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -CarrionSwallowerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ChaoticPufferBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CladCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ClamBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -55,22 +55,15 @@ FusionFeederBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GammaSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GiantSquidBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -GildedAxolotlBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GnasherBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GulperEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HadarianBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -HauntedChumBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HeatSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IceClasperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ImpiousImmolatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" InfernalCongealmentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IrradiatedSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -JellyghoulBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -KelpieSeadragonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LaserfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LazarusLampfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LeerslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LostShoalBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LuminousCorvinaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisShrimpBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -82,7 +75,6 @@ NuclearToadBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OarfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OrthoceraBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OverloadedSoldierBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PearlpodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PerennialSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PestilentSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PhantomSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -90,11 +82,7 @@ PiggyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlaguebringerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueChargerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueshellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PodobooKoiBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PolyperilBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PrismBackBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PrismaticGuppyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ProbesnoutBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ProfanedEnergyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RadiatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ReaperSharkBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -103,28 +91,21 @@ RepairUnitBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RimehoundBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RotdogBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RubyCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SandProwlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SeaSerpentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SapphireCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ScavengerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScornEaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScryllarBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaFloatyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SearslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SharkoonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShockstormShuttleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ShoreskipperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShroombleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerColliderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerSpitterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SkyfinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SlabCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SlugbunBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SoulSlurperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SteampodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StellarCulexBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StormlionBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -StormlionSentryBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulflounderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulphurousSkaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SunskaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -696,6 +677,7 @@ CorruptionEffigy: { However, this comes at a cost of {1}% damage reduction This cannot be stacked with Crimson Effigy ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } AltarOfTheAccursedItem: { @@ -756,6 +738,7 @@ CrimsonEffigy: { However, this comes at a cost of {2}% maximum health This cannot be stacked with Corruption Effigy ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } EffigyOfDecay: { @@ -805,6 +788,11 @@ GluttonyBlender: { A strange industrial contraption which appears to process food Has the potential to turn food into something more nutritious... maybe ''' + SalesPitch: + ''' + 'A state of the art machine, created by my partner Hoggart! You can put anything in it, and it'll make a nutritious delicacy for you to snack on!' + 'I myself can attest for its quality, I use it to make my breakfast, lunch and dinner!' + ''' } LanternCenter: { @@ -847,16 +835,6 @@ ExoObelisk: { Tooltip: "'Energize the atmosphere with exo energy.'" } -ForgottenNobleStatue: { - DisplayName: Forgotten Noble Statue - Tooltip: "" -} - -ForgottenScholarStatue: { - DisplayName: Forgotten Scholar Statue - Tooltip: "" -} - FrigidMonolith: { DisplayName: Frigid Monolith Tooltip: "'Enchant the sky with frosty auroras.'" @@ -887,15 +865,6 @@ NavyPrismTorch: { Tooltip: Can be placed in water } -AmidiasPainting: { - DisplayName: Sea King's Release - Tooltip: - ''' - 'O. Rios' - 'September-October!' - ''' -} - CalamityCanvas2023: { DisplayName: Calamity Canvas 2023 Tooltip: @@ -942,6 +911,11 @@ PiggyCage: { Tooltip: "" } +PiggyCageGold: { + DisplayName: Gold Piggy Cage + Tooltip: "" +} + RefractivePrismTorch: { DisplayName: Refractive Prism Torch Tooltip: Can be placed in water @@ -994,11 +968,6 @@ SulphurousTorch: { Tooltip: Can be placed in water } -SunkenIdol: { - DisplayName: Sunken Idol - Tooltip: "" -} - ThaumaticChair: { DisplayName: Thaumatic Chair Tooltip: One of Chloe's finest creations @@ -1011,6 +980,11 @@ TheMonument: { A monument celebrating the accomplishments of capitalism Funded by the taxes of nearby Town NPCs, though they may not be too happy about that ''' + SalesPitch: + ''' + 'Don't you think your town is a bit too boring? Don't you wish you could get more money out of your troubles? Well, I've got you the perfect two-in-one deal!' + 'This statue I made myself is so marvelous that it'll singlehandedly raise the price of housing around here! Just sit back, and enjoy the sight and the money!' + ''' } ThermalTorch: { @@ -4722,4 +4696,21 @@ MossyStone: { GreedPot: { DisplayName: Urn of Avarice Tooltip: Offer your treasures to the Urn, and your avarice may at last be satiated + SalesPitch: + ''' + 'Say, you use all kinds of ores for your stuff, but finding precious minerals isn't easy, is it? Well, I got the solution for you!' + 'Just throw any ore you got in this urn and they'll turn into even rarer ones! No more looking for tungsten for hours on end!' + ''' +} + +HorribleHogBanner.DisplayName: Horrible Hog Banner + +EutrophicSandWall: { + DisplayName: Unsafe Eutrophic Sand Wall + Tooltip: "" +} + +EutrophicSandWallSafe: { + DisplayName: Eutrophic Sand Wall + Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 45672e252e..d82a2f9688 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -65,7 +65,8 @@ DeliciousMeat: { Tooltip: ''' {$CommonItemTooltip.MediumStats} - 'So very delicious' + {$Common.NotConsumable}, but takes {0} minutes to regenerate + 'A blessed strip of pork that never seems to be entirely consumed...' ''' } @@ -139,7 +140,7 @@ ShadowPotion: { SoaringPotion: { DisplayName: Soaring Potion - Tooltip: "{0}% increased flight time and horizontal flight speed" + Tooltip: "{0}% increased flight time" } SulphurskinPotion: { @@ -159,8 +160,17 @@ SupremeManaPotion: { TheConcoction: { DisplayName: The Concoction - EasterEggText: Removes 500 life - Tooltip: "" + EasterEggText: Removes 9999 life + Tooltip: + ''' + Restores 9999 life + Can even be used while you have [cbuffplr:PotionSickness] if Quick Heal is repeatedly pressed + ''' + SalesPitch: + ''' + 'Aren't you tired of how unreliable your healing potions are? What if you're in the middle of a zombie horde and sick to the core of those things?!' + 'With my concoction, you won't have to worry about that! Just a sip of this bad boy and you'll be good as new, ready to take on the world!' + ''' } ZenPotion: { @@ -187,6 +197,11 @@ BaconOil: { Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} When combined with drinking Bacon Oil straight, mobility becomes zanier ''' + SalesPitch: + ''' + 'Monks go on and on about forgoing attachment. I don't think this is what they meant. It's better!' + 'Don't mind the accident disclaimer: get yourself some of this slippery fat oil, and not a bit of this world will be able to hold you down!' + ''' } BloodyMary: { @@ -494,6 +509,11 @@ TheElixir: { Functions as a Potion of Return Occasionally sends you... [c/AA23C4:somewhere else] ''' + SalesPitch: + ''' + 'Return potions are nifty and all, but they taste like bogus! But with my special formula, it'll magically taste like your favorite food!' + 'Besides, you ain't finding them for much cheaper around these parts. Trust me, you're practically stealing me!' + ''' } Vodka: { @@ -614,4 +634,9 @@ TheSandwich: { Alcohol effects will not expire while under the effects of The Sandwich 'Might actually taste good if it was the only thing you'd ever eaten...' ''' + SalesPitch: + ''' + '...You want to buy my lunch?' + 'Well, no matter! But it won't be cheap! This sandwich is made with the best the market can offer, so ready your wallet!' + ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 3ec4c48e04..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: { @@ -292,6 +292,11 @@ Terminus: { TheHousingContract: { DisplayName: The Housing Contract Tooltip: Use to adopt a piggy for your town + SalesPitch: + ''' + 'Have you ever wanted to take care of a piggy? As part of our campaign to stop piggy abuse, you can get one here and now!' + 'Just sign here and we'll deliver you one posthaste!' + ''' } YharonEgg: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index c80e1430d7..a6ef244292 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -17,12 +17,17 @@ AggressiveVoucher: { DisplayName: Aggressive Voucher Tooltip: ''' - Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge - This effect only applies when reforging accessories + Favorite this item in your inventory to change the result of your next accessory reforge + This will always either give the targeted reforge or a unique reforge Targeted Reforge: {0} Selectable Reforges: {1} [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” + ''' } AntiCystOintment: { @@ -157,8 +162,13 @@ CombatVoucher: { DisplayName: Combat Voucher Tooltip: ''' - Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge - This effect only applies when reforging weapons + Favorite this item in your inventory to change the result of your next weapon reforge + This will always either give the best reforge based on class or a unique reforge + ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” ''' } @@ -187,7 +197,7 @@ DisgustingMeat: { Tooltip: ''' will remove health and mana upgrades, use with no Calamity upgrades to remove vanilla upgrades - will remove rage and adrenaline upgrades, plus other miscellaneous boosters + will remove Rage and Adrenaline upgrades, plus other miscellaneous boosters such as Demon Heart Removed boosters will be vomited out of you as items ''' } @@ -230,12 +240,17 @@ HurriedVoucher: { DisplayName: Hurried Voucher Tooltip: ''' - Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge - This effect only applies when reforging accessories + Favorite this item in your inventory to change the result of your next accessory reforge + This will always either give the targeted reforge or a unique reforge Targeted Reforge: {0} Selectable Reforges: {1} [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” + ''' } InfernaCutter: { @@ -305,12 +320,17 @@ OddVoucher: { DisplayName: Odd Voucher Tooltip: ''' - Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge - This effect only applies when reforging accessories + Favorite this item in your inventory to change the result of your next accessory reforge + This will always either give the targeted reforge or a unique reforge Targeted Reforge: {0} Selectable Reforges: {1} [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” + ''' } ReefclawHamaxe: { @@ -409,10 +429,14 @@ TheGift: { DisplayName: The Gift Tooltip: ''' - Drop this fine gift on one of your Town NPCs as a token of appreciation + Drop this gift on one of your Town NPCs as a token of appreciation May make them either love you or hate you, you'll never know until they open it! Effect will last for 24 hours - [c/F54278:'There's no return policy, better be responsible'] + ''' + SalesPitch: + ''' + 'Buying gifts for people is hard, and you gotta make sure your people are happy, so how about we kill two birds with one stone?' + 'Hand this nifty box to someone and it'll suddenly contain the perfect gift for the person you handed it to!' ''' } @@ -430,12 +454,17 @@ UnbreakableVoucher: { DisplayName: Unbreakable Voucher Tooltip: ''' - Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge - This effect only applies when reforging accessories + Favorite this item in your inventory to change the result of your next accessory reforge + This will always either give the targeted reforge or a unique reforge Targeted Reforge: {0} Selectable Reforges: {1} [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” + ''' } VoodooDemonVoodooDoll: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index c0dfbca3bc..495b98d77a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -10,7 +10,7 @@ AbyssShocker: { AcidGun: { DisplayName: Acid Gun - Tooltip: Releases three streams of acid + Tooltip: Releases three streams of irradiated acid } AetherfluxCannon: { @@ -20,16 +20,7 @@ AetherfluxCannon: { AethersWhisper: { DisplayName: Aether's Whisper - Tooltip: - ''' - Inflicts long-lasting [cbuff:CalamityMod/Shadowflame] and splits on tile hits - Projectiles gain damage as they travel - ''' -} - -AlulaAustralis: { - DisplayName: Alula Australis - Tooltip: Fires a beautiful aurora that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] trailed by a star shower + Tooltip: Fires void beams that gain damage as they travel and split on tile hits } AlphaDraconis: { @@ -45,6 +36,11 @@ AlphaDraconis: { ''' } +AlulaAustralis: { + DisplayName: Alula Australis + Tooltip: Fires a beautiful aurora that spreads the [cbuff:CalamityMod/AstralInfectionDebuff] and is trailed by a star shower +} + AnahitasArpeggio: { DisplayName: Anahita's Arpeggio Tooltip: "[GFB]" @@ -122,12 +118,12 @@ ArtAttack: { AstralachneaStaff: { DisplayName: Astralachnea Staff - Tooltip: Fires a spread of homing astral spider fangs that inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Fires a spread of homing astral spider fangs that spread the [cbuff:CalamityMod/AstralInfectionDebuff] } AstralStaff: { DisplayName: Astral Staff - Tooltip: Summons a large crystal from the sky that has a large area of effect on impact and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Summons a large crystal from the sky that has a large area of effect on impact and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] } Atlantis: { @@ -161,12 +157,12 @@ BlackAnurian: { BloodBath: { DisplayName: Blood Bath - Tooltip: Drenches your foes in blood that inflicts [cbuff:CalamityMod/BurningBlood] + Tooltip: Drenches your foes in blood } BrimroseStaff: { DisplayName: Brimrose Staff - Tooltip: Fires a spread of splitting beams of [cbuff:CalamityMod/BrimstoneFlames] + Tooltip: Fires a spread of splitting brimstone beams } BurningSea: { @@ -175,7 +171,7 @@ BurningSea: { ''' Conjures a massive fireball that hovers near you and incinerates foes with [cbuff:CalamityMod/BrimstoneFlames] Holding the fireball for too long causes it to burn out - This burns you with [cbuffplr:CalamityMod/BrimstoneFlames] and gives a long delay before another can be cast + This sets you alight with [cbuffplr:CalamityMod/BrimstoneFlames] and gives a long delay before another can be cast ''' } @@ -183,7 +179,7 @@ ChronomancersScythe: { DisplayName: Chronomancer's Scythe Tooltip: ''' - Rapidly fires icicles + Rapidly fires icicles that cause [cbuff:CalamityMod/TimeDistortion] on enemies Press to swing the scythe around you, creating a clock pattern of homing icicles Direct hits with the scythe have a chance to spawn clocks Collecting the clocks increases movement speed and acceleration by 5% for each clock collected @@ -240,7 +236,6 @@ DeathValleyDuster: { ''' Casts an enchanted blast of sand that passes through enemies and tiles Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the [cbuffplr:CalamityMod/SandsWindBuff] buff - [cbuffplr:CalamityMod/SandsWindBuff] increases your defense by {0}, damage by {1}%, and greatly buffs mana regen ''' } @@ -299,7 +294,7 @@ EventHorizon: { EvergladeSpray: { DisplayName: Everglade Spray - Tooltip: Fires a stream of [cbuff:CursedInferno] and [cbuff:Ichor] + Tooltip: Fires a stream of burning green ichor } FaceMelter: { @@ -412,6 +407,7 @@ HeliumFlash: { Tooltip: ''' Launches volatile star cores which erupt into colossal fusion blasts + Always critically strikes, with critical strike chance increasing critical strike damage 'The power of a galaxy, if only for mere moments' ''' } @@ -497,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...' ''' } @@ -621,7 +617,7 @@ Photosynthesis: { PlagueStaff: { DisplayName: Plague Staff - Tooltip: Fires a tight spread of 4 plague fangs that inflict [cbuff:CalamityMod/Plague] + Tooltip: Fires a tight spread of 4 [cbuff:CalamityMod/Plague] fangs } PlasmaRifle: { @@ -654,7 +650,6 @@ PrimordialAncient: { ''' Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the [cbuffplr:CalamityMod/AeolianEarthBuff] buff - [cbuffplr:CalamityMod/AeolianEarthBuff] increases your damage reduction by {0}%, damage by {1}%, and massively buffs mana regen ''' } @@ -664,7 +659,6 @@ PrimordialEarth: { ''' Casts two enchanted blasts of sand that converge with each other and explode Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the [cbuffplr:CalamityMod/SandsWindBuff] buff - [cbuffplr:CalamityMod/SandsWindBuff] increases your defense by {0}, damage by {1}%, and greatly buffs mana regen ''' } @@ -714,7 +708,7 @@ RelicofRuin: { RougeSlash: { DisplayName: Rouge Slash - Tooltip: Fires a wave of 3 rouge air slashes that inflict [cbuff:CalamityMod/VermillionFlux] + Tooltip: Fires a wave of 3 rouge air slashes } SandstreamScepter: { @@ -827,11 +821,7 @@ SnowstormStaff: { SoulPiercer: { DisplayName: Soul Piercer - Tooltip: - ''' - Casts a powerful ray that summons extra rays on its first hit - Inflicts [cbuff:CalamityMod/GodSlayerInferno] - ''' + Tooltip: Casts a powerful ray that summons extra rays on its first hit } StaffofBlushie: { @@ -841,7 +831,7 @@ StaffofBlushie: { StarShower: { DisplayName: Star Shower - Tooltip: Casts a spread of astral stars from the sky that converge at the cursor and inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Casts a spread of astral stars from the sky that converge at the cursor and spread the [cbuff:CalamityMod/AstralInfectionDebuff] } SubsumingVortex: { @@ -853,7 +843,7 @@ SubsumingVortex: { When enemies are near the vortex, it sends multiple fast-moving smaller vortices towards them Releasing fires the vortex towards the mouse if enough time has passed Damage scales based on how long the vortex was held out - Inflicts [cbuff:CalamityMod/MiracleBlight] + Struck enemies are completely consumed by [cbuff:CalamityMod/MiracleBlight] ''' } @@ -870,7 +860,7 @@ TacticiansTrumpCard: { DisplayName: Tactician's Trump Card Tooltip: ''' - Fires a sword beam that inflicts [cbuff:Electrified] on hit + Fires an [cbuff:Electrified] sword beam 'Faint memories of a Princess from the future cross your mind...' ''' } @@ -929,6 +919,11 @@ TheSwarmer: { TheWand: { DisplayName: The Wand Tooltip: The ultimate wand + SalesPitch: + ''' + 'Hey buddy. I know we've had our differences, but you've been a real pal to me. This is a special offer, just for you!' + 'Apparently this stick is from the Dragon Aerie, and I've heard that even the tiniest branches there have unfathomable power! This is literally a steal!' + ''' } ThornBlossom: { @@ -1000,7 +995,11 @@ Vehemence: { VenusianTrident: { DisplayName: Venusian Trident - Tooltip: Casts an infernal trident that erupts into a gigantic explosion of fire and magma shards + Tooltip: + ''' + Casts an infernal trident that erupts into a gigantic explosion of fire and magma shards + Always critically strikes, with critical strike chance increasing critical strike damage + ''' } Vesuvius: { @@ -1028,8 +1027,8 @@ VitriolicViper: { DisplayName: Vitriolic Viper Tooltip: ''' - Charges up and fires a slithering [cbuff:CalamityMod/Irradiated] beam - If fully charged, instead fires a huge spread of short range fangs which inflict [cbuff:CalamityMod/SulphuricPoisoning] + Charges up and fires a slithering beam of radiation + If fully charged, instead fires a huge spread of short range fangs ''' } @@ -1039,7 +1038,7 @@ VividClarity: { ''' Fires five randomized rays of exo-energy towards the cursor Enemy and tile hits either cause a big flash explosion, an additional laser from the sky, or split into energy orbs - Inflicts [cbuff:CalamityMod/MiracleBlight] + Struck enemies are liquified by [cbuff:CalamityMod/MiracleBlight] 'Its majesty inspires a stroke of unparalleled genius' ''' } @@ -1065,7 +1064,7 @@ Volterion: { Waywasher: { DisplayName: Waywasher - Tooltip: Casts two large swirling waves + Tooltip: Casts a deluge of inaccurate water bolts } Wingman: { @@ -1111,6 +1110,6 @@ YharimsCrystal: { DisplayName: Yharim's Crystal GFBName: yermes christal Tooltip: "[GFB]" - TooltipNormal: Fires draconic beams of total annihilation + TooltipNormal: Fires [cbuff:CalamityMod/Dragonfire] beams of total annihilation TooltipGFB: ...throughs a pice of dnimite } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index cebcaf521e..33a6e5a1a9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -42,12 +42,7 @@ AirSpinner: { AmidiasTrident: { DisplayName: Amidias' Trident - Tooltip: - ''' - [c/CCE9FF:Striking enemies inflicts] [c/28A3FF:Sea King's Assurance], [c/CCE9FF:which can stack up to eight] - Right click to spin the trident then thrust into the air, expending all nearby stacks of Sea King's Assurance - Secondary attack deals more damage for every stack applied - ''' + Tooltip: Shoots homing whirlpools } AnarchyBlade: { @@ -91,7 +86,8 @@ ArkoftheCosmos: { You can also parry projectiles to make them deal 120 less damage for a short period Parrying will empower the next 16 swings of the sword ''' - BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfo: with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfoKeybind: Press [KEY] with charges available to cause a Big Rip in spacetime and consume all charges } ArkoftheElements: { @@ -118,12 +114,12 @@ ArkoftheElements: { AstralPike: { DisplayName: Astral Pike - Tooltip: Summons astral star swarms on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Summons astral star swarms on hit that spread the [cbuff:CalamityMod/AstralInfectionDebuff] } AstralScythe: { DisplayName: Astral Scythe - Tooltip: Shoots a scythe ring that accelerates over time and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Shoots a scythe ring that accelerates over time and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] } Ataraxia: { @@ -166,7 +162,7 @@ BansheeHook: { Basher: { DisplayName: Basher - Tooltip: Swings a rotten club that inflicts [cbuff:CalamityMod/Irradiated] while knocking you back in the process + Tooltip: Swings a rotten club while knocking you back in the process } BladecrestOathsword: { @@ -186,7 +182,7 @@ BladecrestOathsword: { BlightedCleaver: { DisplayName: Blighted Cleaver - Tooltip: Fires homing blazing blades + Tooltip: Fires homing, blazing blades } Bonebreaker: { @@ -194,7 +190,7 @@ Bonebreaker: { Tooltip: ''' Fires javelins that stick to enemies before bursting into shrapnel - Javelins cause [cbuff:CalamityMod/HeavyBleeding], [cbuff:Venom], and [cbuff:CalamityMod/ArmorCrunch] + Stuck javelins inflict several debuffs ''' } @@ -205,7 +201,7 @@ BotanicPiercer: { Brimlance: { DisplayName: Brimlance - Tooltip: Creates brimstone explosions on enemy hits + Tooltip: Creates an explosion of [cbuff:CalamityMod/BrimstoneFlames] on enemy hits } Brimlash: { @@ -217,7 +213,7 @@ BrimstoneSword: { DisplayName: Brimstone Sword Tooltip: ''' - Summons brimstone geysers on hit + Summons geysers of [cbuff:CalamityMod/BrimstoneFlames] on hit Press to throw the sword like a javelin that explodes on hit ''' } @@ -270,14 +266,14 @@ Carnage: { CelestialClaymore: { DisplayName: Celestial Claymore - Tooltip: Spawns cosmic energy stars near the cursor that inflict [cbuff:Frostburn2], [cbuff:OnFire3], or [cbuff:Ichor] + Tooltip: Spawns cosmic energy stars near the cursor } ClamCrusher: { DisplayName: Clam Crusher Tooltip: ''' - Launches a huge clam that stuns enemies for a short amount of time + Launches a huge clam that inflicts [cbuff:CalamityMod/Eutrophication], stunning enemies for a short amount of time Starts being affected by gravity and does much more damage after being airborne for a while ''' } @@ -291,7 +287,7 @@ CosmicDischarge: { DisplayName: Cosmic Discharge Tooltip: ''' - Striking an enemy with the whip causes glacial explosions and grants the player the [cbuffplr:CalamityMod/CosmicFreeze] buff + Striking an enemy with the whip causes glacial explosions that grant the player the [cbuffplr:CalamityMod/CosmicFreeze] buff [cbuffplr:CalamityMod/CosmicFreeze] gives the player +2 HP/s life regen while standing still and freezes enemies near the player ''' } @@ -395,7 +391,7 @@ DragonPow: { DisplayName: Dragon Pow Tooltip: ''' - Fires a dragon head that releases draconic sparks + Fires a dragon head that releases [cbuff:CalamityMod/Dragonfire] sparks Summons a barrage of petals and waterfalls on enemy hits ''' } @@ -420,18 +416,14 @@ Earth: { ''' A beautiful prismatic blade with unrivaled close combat proficiency Heals you greatly on hit - Every other swing will summon three Gaia meteors to annihilate nearby enemies with [cbuff:CalamityMod/MiracleBlight] + Every other swing will summon three Gaia meteors to annihilate nearby enemies 'All Its spawn shall know the beauty and wrath of their creator' ''' } EarthenPike: { DisplayName: Earthen Pike - Tooltip: - ''' - Sprays fossil shards on swing - Inflicts [cbuff:CalamityMod/ArmorCrunch] - ''' + Tooltip: Sprays fossil shards on swing } EmpyreanKnives: { @@ -502,7 +494,7 @@ Exoblade: { Enemy hits from the blade during the dash result in massive damage and a rebound Press immediately after a rebound to perform a powerful slash Powerful slashes are larger, heal you, and create a large explosion - Inflicts [cbuff:CalamityMod/MiracleBlight] + Struck enemies are torn apart by [cbuff:CalamityMod/MiracleBlight] ''' } @@ -642,7 +634,7 @@ GalileoGladius: { GeliticBlade: { DisplayName: Gelitic Blade - Tooltip: Fires a fast gel wave that speeds up on enemy hits + Tooltip: Fires a fast gel wave that speeds up on enemy hits and covers them with [cbuff:Slimed] } GildedProboscis: { @@ -765,7 +757,7 @@ InsidiousImpaler: { DisplayName: Insidious Impaler Tooltip: ''' - Throws self-propelling radioactive harpoons which chase foes and cause [cbuff:CalamityMod/SulphuricPoisoning] + Throws self-propelling radioactive harpoons which chase foes Harpoons ricochet at close range for additional hits ''' } @@ -804,7 +796,7 @@ LionHeart: { DisplayName: Lion Heart Tooltip: ''' - Summons an energy explosion on enemy hits + Summons an energy explosion on hit Press to summon an energy shell for a few seconds that halves all damage sources This has a 45 second cooldown ''' @@ -904,14 +896,14 @@ Nadir: { DisplayName: Nadir Tooltip: ''' - Fires void essences which flay nearby enemies with [cbuff:CalamityMod/Voidfrost] tentacles + Fires void essences which flay nearby enemies with tentacles 'The abyss has stared back at you long enough. It now speaks, and it does not speak softly' ''' } Nebulash: { DisplayName: Nebulash - Tooltip: Fires a whip sword that emits particle explosions on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Fires a whip sword that emits particle explosions on hit and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] } NeptunesBounty: { @@ -927,14 +919,18 @@ 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 ''' } OldLordClaymore: { DisplayName: Old Lord Claymore - Tooltip: A slow but powerful blade that lights enemies with [cbuff:OnFire3] and has substantial knockback + Tooltip: A slow but powerful blade that sets enemies ablaze and has substantial knockback HoldShiftTooltip: ''' [c/df4420:A gift to outstanding Demons, a replica of the sword used by the greatest of all Demon Lords.] @@ -1017,7 +1013,7 @@ PhotonRipper: { DisplayName: Photon Ripper Tooltip: ''' - Projects a directed stream of hardlight teeth at ultra high velocity which cause [cbuff:CalamityMod/MiracleBlight] + Projects a directed stream of hardlight teeth at ultra high velocity This weapon and its projectiles function as a chainsaw Press to use without chopping down trees ''' @@ -1066,7 +1062,6 @@ RemsRevenge: { Tooltip: ''' Summons blood explosions and inflicts [cbuff:CalamityMod/WitherDebuff] on hit - [cbuff:CalamityMod/WitherDebuff] lowers enemy defense by {0} 'A deadly morning star befitting its demonic owner' ''' } @@ -1086,7 +1081,7 @@ Riptide: { Tooltip: ''' {$Common.YoyoStats} - Rapidly pulses riptide waves which get larger the more hits landed by the yoyo + Sprays a spiral of aqua streams ''' } @@ -1116,7 +1111,7 @@ SaharaSlicers: { SausageMaker: { DisplayName: Sausage Maker - Tooltip: Sprays homing blood and causes [cbuff:CalamityMod/BurningBlood] on hit + Tooltip: Sprays homing blood on hit } ScourgeoftheCosmos: { @@ -1124,6 +1119,11 @@ ScourgeoftheCosmos: { Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits } +SeashineSword: { + DisplayName: Seashine Sword + Tooltip: Shoots an aqua sword beam +} + SeekingScorcher: { DisplayName: Seeking Scorcher Tooltip: @@ -1178,7 +1178,7 @@ SoulHarvester: { Tooltip: ''' Shoots a soul scythe - Enemies explode when on low health, spreading the [cbuff:CalamityMod/Plague] + Enemies explode when on low health, spreading the plague ''' } @@ -1245,7 +1245,7 @@ StygianShield: { DisplayName: Stygian Shield Tooltip: ''' - Hold to charge an omni-directional dash which slams through enemies + Hold to charge an omni-directional dash which grants immunity to damage and can slam through enemies to throw a buckler which bounces towards a nearby foe upon collision Grants knockback immunity and {0} defense while held However, dashes are disabled until you stop holding this weapon for {1} seconds @@ -1283,7 +1283,7 @@ TaintedBlade: { TeardropCleaver: { DisplayName: Teardrop Cleaver - Tooltip: Gives your enemies [cbuff:CalamityMod/TemporalSadness] + Tooltip: Makes your enemies cry } TenebreusTides: { @@ -1291,7 +1291,7 @@ TenebreusTides: { Tooltip: ''' Shoots a water spear that pierces enemies and terrain - Striking enemies summon liquid blades and spears to assault the struck foe + Striking enemies summons liquid blades and spears to assault the struck foe 'Inundatio ex Laminis' ''' } @@ -1344,13 +1344,17 @@ TheGodsGambit: { Tooltip: ''' {$Common.YoyoStatsInfinite} - Fires a stream of slime when enemies are near + Fires a stream of damaging slime when enemies are near ''' } TheLastMourning: { DisplayName: The Last Mourning - Tooltip: Summons flaming pumpkins and mourning skulls that split into fire orbs on enemy hits + Tooltip: + ''' + Summons flaming pumpkins and mourning skulls + Pumpkins and skulls split into homing fire orbs on enemy hits + ''' } TheMicrowave: { @@ -1358,7 +1362,7 @@ TheMicrowave: { Tooltip: ''' {$Common.YoyoStatsInfinite} - Fries nearby enemies with radiation and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Fries nearby enemies with radiation and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] 'Cooking, Astral Infection style' ''' } @@ -1393,7 +1397,7 @@ TheOracle: { Tooltip: ''' {$Common.YoyoStatsInfinite} - Emits an aura of [cbuff:CalamityMod/AuricRebuke] lightning which charges up when hitting enemies + Emits an aura of auric lightning which charges up when hitting enemies Fires auric orbs when supercharged 'Gaze into the past, the present, the future... and the circumstances of your inevitable demise' ''' @@ -1403,7 +1407,7 @@ TitanArm: { DisplayName: Titan Arm Tooltip: ''' - Sends enemies straight to the stars at the speed of light and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Sends enemies straight to the stars at the speed of light Slap Hand but better ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index cc13c74109..0b3625e36e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -60,11 +60,16 @@ AntiMaterielRifle: { DisplayName: Anti-materiel Rifle Tooltip: ''' - Converts musket balls into .50 caliber sniper rounds that rip apart enemy defense and DR + Converts musket balls into .50 caliber sniper rounds that rip apart enemy defense and cause enemies to become [cbuff:CalamityMod/MarkedforDeath] Unleashes a second swarm of bullets on hit, with additional bullets on critical strikes ''' } +AquashardShotgun: { + DisplayName: Aquashard Shotgun + Tooltip: Converts musket balls into aquashards that split upon hitting an enemy +} + Arbalest: { DisplayName: Arbalest Tooltip: @@ -98,7 +103,7 @@ Arietes41: { DisplayName: Arietes 41 Tooltip: ''' - Alternates between firing bullets imbued with lifesteal and electricity + Alternates between firing bullets imbued with lifesteal and [cbuff:Electrified] Electric imbued bullets create a small shockblast on impact, dealing additional damage to the enemy they hit ''' } @@ -115,7 +120,7 @@ ArterialAssault: { AstralBlaster: { DisplayName: Astral Blaster - Tooltip: Converts musket balls into homing astral rounds that inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Converts musket balls into homing astral rounds that spread the [cbuff:CalamityMod/AstralInfectionDebuff] } AstrealDefeat: { @@ -127,7 +132,7 @@ Auralis: { DisplayName: Auralis Tooltip: ''' - Fires a high speed glowing bullet that inflicts [cbuff:CalamityMod/MarkedforDeath] + Fires a high speed glowing bullet that causes enemies to become [cbuff:CalamityMod/MarkedforDeath] Press to zoom out Standing still provides increasing damage bonuses up to 25% Standing still for 5 or more seconds while using the scope ability will summon an aurora @@ -140,7 +145,7 @@ AuroraBlazer: { DisplayName: Aurora Blazer Tooltip: ''' - Spews a nebula stream which forms a star shaped pattern and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Spews a nebula stream which forms a star shaped pattern and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] Uses gel for ammo ''' } @@ -182,7 +187,7 @@ BlissfulBombardier: { Tooltip: ''' Launches a crystalline missile high into the sky, raining holy fire on the cursor - The missile relentlessly seeks out a target before bursting into a massive [cbuff:CalamityMod/HolyFlames] explosion + The missile relentlessly seeks out a target before bursting into a massive explosion ''' } @@ -217,7 +222,7 @@ BlossomFlux: { BrimstoneFury: { DisplayName: Brimstone Fury - Tooltip: Converts wooden arrows into spreads of 3 brimstone bolts + Tooltip: Converts wooden arrows into a spread of 3 brimstone bolts } BulletFilledShotgun: { @@ -236,7 +241,7 @@ Buzzkill: { Tooltip: ''' Hold to rev up a buzzsaw that deals close-range damage - Release to fire the buzzsaw, which bounces off tiles and causes [cbuff:CalamityMod/HeavyBleeding] in foes + Release to fire the buzzsaw, which bounces off tiles and shreds foes Revving up the saws increases their damage and allows them to pierce more enemies 'Not to be confused with the Sawed-On Shotgun' ''' @@ -244,7 +249,7 @@ Buzzkill: { ChickenCannon: { DisplayName: Chicken Cannon - Tooltip: Fires chicken flares which create enormous incendiary explosions of [cbuff:CalamityMod/Dragonfire] + Tooltip: Fires chicken flares which create enormous [cbuff:CalamityMod/Dragonfire] explosions } ChromaticEruption: { @@ -259,14 +264,18 @@ ChromaticEruption: { ClamorRifle: { DisplayName: Clamor Rifle - Tooltip: Converts musket balls into homing energy bolts + Tooltip: + ''' + Converts musket balls into homing energy bolts + Energy bolts briefly stun enemies + ''' } CleansingBlaze: { DisplayName: Cleansing Blaze Tooltip: ''' - Unleashes a torrent of [cbuff:CalamityMod/GodSlayerInferno] flames which can pass through tiles + Unleashes a torrent of [cbuff:CalamityMod/GodSlayerInferno] which can pass through tiles Uses gel for ammo ''' } @@ -327,7 +336,7 @@ CorinthPrime: { CorrodedCaustibow: { DisplayName: Corroded Caustibow - Tooltip: Converts wooden arrows into slow, powerful shells that trail an [cbuff:CalamityMod/Irradiated] aura + Tooltip: Converts wooden arrows into slow, powerful shells that trail an irradiated aura } CrackshotColt: { @@ -383,9 +392,9 @@ DragonsBreath: { DisplayName: Dragon's Breath Tooltip: ''' - Fires [cbuff:CalamityMod/Dragonfire] fireballs at an accelerating pace + Fires intense blasts of [cbuff:CalamityMod/Dragonfire] at an accelerating pace Upon firing for long enough, you will begin using a cartridge of energy - While using a cartridge you will shoot a draconic beam of [cbuff:CalamityMod/Dragonfire] that doesn't consume ammo + While using a cartridge you will shoot a draconic beam of pure [cbuff:CalamityMod/Dragonfire] that doesn't consume ammo Once a cartridge has been ejected you will return to the original fire rate {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' @@ -395,7 +404,7 @@ Drataliornus: { DisplayName: Drataliornus Tooltip: ''' - Fires an escalating stream of fireballs + Fires an escalating stream of [cbuff:CalamityMod/Dragonfire] arrows Fireballs rain meteors, leave dragon dust trails, and launch additional bolts at max speed Taking damage while firing the stream will interrupt it and reduce your wing flight time Press to fire two devastating barrages of five empowered fireballs @@ -415,7 +424,7 @@ EternalBlizzard: { Eviscerator: { DisplayName: Eviscerator - Tooltip: Converts musket balls into fast-moving blood clots that cause [cbuff:CalamityMod/BurningBlood] + Tooltip: Converts musket balls into fast-moving blood clots } FetidEmesis: { @@ -434,7 +443,7 @@ FirestormCannon: { Tooltip: ''' Fires a rapid barrage of flares that builds up a searing heat in the weapon - Firing for too long overheats the weapon, leaving it unusable for a short period + Firing for too long overheats the weapon, leaving it unusable for a short period and setting you [cbuffplr:OnFire] Press to put away the weapon, which preserves its heat {$CommonItemTooltip.PercentChanceToSaveAmmo} 'What could go wrong?' @@ -516,7 +525,7 @@ GoldenEagle: { Goobow: { DisplayName: Goobow - Tooltip: Fires two streams of slime + Tooltip: Addtionally fires two streams of damaging slime } GunkShot: { @@ -538,6 +547,7 @@ HalleysInferno: { Fires a burst of intensely concentrated lunar fire jets to rapid-fire Starbursts that inflict [cbuff:CalamityMod/Voidfrost] Generates Starbursts when hitting enemies, depending on your accuracy + Press [KEY] to toggle long-range scope mode Uses gel for ammo 'Halley arrived sooner than expected' ''' @@ -561,9 +571,10 @@ HeavenlyGale: { DisplayName: Heavenly Gale Tooltip: ''' - Fires a rapid stream of supercharged exo-crystals that inflict [cbuff:CalamityMod/MiracleBlight] + Fires a rapid stream of supercharged exo-crystals Holding the bow and waiting for some time before firing causes the crystals to become more powerful If the crystals are sufficiently powerful enough they will summon torrents of exo-lightning above whatever target they hit + Enemies struck with Exo-lightning are atomized by [cbuff:CalamityMod/MiracleBlight] ''' } @@ -604,7 +615,7 @@ Hydra: { Fires a spread of 3 blood globs imbued with [cbuff:Venom] Grows a gun-head every 3 seconds, up to a maximum of 3 heads Press to command any existing heads to fire - Press to launch the heads for powerful explosive damage, briefly inflicting [cbuff:CalamityMod/GalvanicCorrosion] + Press to launch the heads for powerful explosive damage [c/9D80B0:Fusion of heavy machinery and Lernaean blood] ''' } @@ -642,7 +653,7 @@ Leviatitan: { Tooltip: ''' Fires high velocity aqua blasts - Releases homing aberrations that cause [cbuff:CalamityMod/ArmorCrunch] every six shots + Releases homing aberrations that shred enemy defense every six shots to vomit a meteor that explodes on hit 'The L in LMG stands for Leviathan' ''' @@ -769,7 +780,7 @@ Monsoon: { Needler: { DisplayName: Needler - Tooltip: Converts musket balls into needles that stick to enemies and explode + Tooltip: Converts musket balls into [cbuff:Venom] infused needles that stick to enemies and explode } NettlevineGreatbow: { @@ -809,6 +820,23 @@ NullificationPistol: { ''' } +OmniGun: { + DisplayName: The Omnigun + Tooltip: + ''' + A multipurpose weapon with several modes which are used in sequence + The first shot is a sniper round which gains damage over time and always critically strikes + The second shot is a burst of 10 standard bullets + The third shot is a devastating point blank spread + The fourth shot is a dangerous but powerful grenade which destroys everything, including you + ''' + SalesPitch: + ''' + 'Why carry four different guns when you can carry just one? That's what I used to ask myself!' + 'With this thing-a-beauty, even a bumbling moron can become invincible - and for the right price, it can be yours!' + ''' +} + OntologicalDespoiler: { DisplayName: Ontological Despoiler Tooltip: @@ -842,26 +870,12 @@ Onyxia: { ''' } -OmniGun: { - DisplayName: The Omnigun - Tooltip: - ''' - A multipurpose weapon with several modes which are used in sequence - The first shot is a sniper round which gains damage over time and always critically strikes - The second shot is a burst of 10 standard bullets - The third shot is a devastating point blank spread - The fourth shot is a dangerous but powerful grenade which destroys everything, including you - 'What kind of gun is it?' - 'Yes' - ''' -} - OpalStriker: { DisplayName: Opal Striker Tooltip: ''' Fires a chargeable heated energy bolt that pierces - Fully charged shots deal extra damage and move faster + Fully charged shots deal extra damage, move faster and inflict [cbuff:OnFire3] ''' } @@ -906,7 +920,7 @@ Photoviscerator: { DisplayName: Photoviscerator Tooltip: ''' - Emits a continuous beam of [cbuff:CalamityMod/MiracleBlight] radiation that disintegrates everything + Emits a continuous beam of [cbuff:CalamityMod/MiracleBlight] that disintegrates everything Press to fire homing exo flares which stick to and incinerate enemies Uses gel for ammo The beam has a {0}% chance to save ammo @@ -919,7 +933,7 @@ PlagueTaintedSMG: { ''' Shoots [cbuff:CalamityMod/Plague] bullets that spawn drones on critical hits Bullets deal more damage and knockback the closer the enemy is - Drones have a much higher crit chance upon hitting a plagued enemy + Drones have a much higher crit chance upon hitting an enemy inflicted with [cbuff:CalamityMod/Plague] Press to fire a drone swarm ''' } @@ -1112,18 +1126,6 @@ Shadethrower: { ''' } -Shardshocker: { - DisplayName: Shardshocker - Tooltip: - ''' - Fires an electrically charged crystal that travels a short distance before stopping - The crystal will hang in the air and occasionally give off damaging pulses of electricity - Hitting a stopped crystal with a moving one will detonate both in a massive explosion that lets off homing shards - Direct hits with the crystal will create a smaller explosion and stun enemies - 'Plasmaaaaaa!' - ''' -} - Shellshooter: { DisplayName: Shellshooter Tooltip: @@ -1152,14 +1154,14 @@ SlagfireDouser: { Tooltip: ''' Sprays bursts of molten pollen - Molten pollen ignores 10 points of enemy defense and inflicts [cbuff:CalamityMod/SearingLava] + Molten pollen ignores 10 points of enemy defense and covers your enemies in [cbuff:CalamityMod/SearingLava] [c/FF9900:Capable of dousing townsfolk in lava too...] ''' } SlagMagnum: { DisplayName: Slag Magnum - Tooltip: Converts musket balls into fossil shards that split into additional shards on impact + Tooltip: Converts musket balls into fossil shards that inflict [cbuff:CalamityMod/ArmorCrunch] and split into additional shards on impact } SomaPrime: { @@ -1189,9 +1191,9 @@ SpectralstormCannon: { DisplayName: Spectralstorm Cannon Tooltip: ''' - Fires a barrage of spectral flares that builds up a searing heat in the weapon + Fires a barrage of spectral [cbuff:CalamityMod/Nightwither] flares that builds up a searing heat in the weapon While cooling down, heat-seeking phantoms are continuously released - Firing for too long overheats the weapon, leaving it unusable for a short period + Firing for too long overheats the weapon, leaving it unusable for a short period and inflicting you with [cbuffplr:CalamityMod/Nightwither] However, triggering overheat releases a powerful burst of souls and resets heat Press to put away the weapon, which preserves its heat {$CommonItemTooltip.PercentChanceToSaveAmmo} @@ -1213,7 +1215,7 @@ SpeedBlaster: { Spyker: { DisplayName: Spyker - Tooltip: Converts musket balls into spikes that stick to enemies, tiles and explode into shrapnel + Tooltip: Converts musket balls into [cbuff:Venom] infused spikes that stick to enemies, tiles and explode into shrapnel } Starfleet: { @@ -1254,7 +1256,7 @@ StarSputter: { DisplayName: Star Sputter Tooltip: ''' - Fires a chain of comets that inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Fires a chain of comets that spread the [cbuff:CalamityMod/AstralInfectionDebuff] Fires a bigger, more powerful comet every four rounds 'Look to the stars for a galaxy far, far away' ''' @@ -1262,7 +1264,7 @@ StarSputter: { StellarCannon: { DisplayName: Stellar Cannon - Tooltip: Launches an explosive astral crystal that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Launches an explosive astral crystal that spreads the [cbuff:CalamityMod/AstralInfectionDebuff] } StormSurge: { @@ -1280,7 +1282,7 @@ SulphuricAcidCannon: { Tooltip: ''' Fires homing Acid Rockets - Acid Rockets stick to enemies and explode into [cbuff:CalamityMod/SulphuricPoisoning] mist after a short delay + Acid Rockets stick to enemies and explode into toxic mist after a short delay ''' } @@ -1296,7 +1298,6 @@ SuperradiantSlaughterer: { ''' Hold to rev up an elemental buzzsaw that deals close-range damage Release to fire the buzzsaw which bounces off tiles, releasing homing bolts when returning depending on hits - Buzzsaws inflict [cbuff:CalamityMod/ElementalMix] and [cbuff:CalamityMod/Laceration] Revving up the saw increases its damage and allows it to pierce more enemies ''' AltInfo: @@ -1335,7 +1336,6 @@ TauCannon: { Charge level one fires a burst of bolts Charge level two fires a beam of energy that quickly fizzles out Charge level three fires a massive laser and creates astral portals around you - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] 'This weapon is very ethically questionable' ''' } @@ -1355,20 +1355,11 @@ TheBallista: { Tooltip: Converts wooden arrows into greatarrows that cause [cbuff:CalamityMod/ArmorCrunch] and break into shards } -TheBlunderbass: { - DisplayName: The Blunderbass - Tooltip: - ''' - Fires a large crystal that travels a short distance before bursting into homing shards - Direct hits with the crystal stun enemies and increase the amount of shards created - ''' -} - TheHive: { DisplayName: The Hive Tooltip: ''' - Launches a wide spread of 4 [cbuff:CalamityMod/Plague] missiles that explode on contact with enemies and tiles + Launches a wide spread of 4 missiles that explode on contact with enemies and tiles Charging the launcher decreases the spread and increases the velocity of the missile barrage Fully charging the launcher will cause it to fire a [cbuff:CalamityMod/Plague] nuke to decimate a massive area on impact ''' @@ -1381,7 +1372,7 @@ TheJailor: { TheMaelstrom: { DisplayName: The Maelstrom - Tooltip: Fires charged Reaper Sharks that cause [cbuff:CalamityMod/HadopelagicPressure] water explosions + Tooltip: Fires charged Reaper Sharks that cause water explosions } ThePack: { @@ -1393,7 +1384,7 @@ ThermoclineBlaster: { DisplayName: Thermocline Blaster Tooltip: ''' - Alternates between firing bullets imbued with [cbuff:OnFire3] and [cbuff:Frostburn2] + Alternates between firing bullets imbued with fire and ice Any bullet type can be imbued when fired from this gun ''' } @@ -1415,7 +1406,7 @@ TheStorm: { Tooltip: ''' Fires a spread of homing lightning bolts and arrows from the sky - Converts wooden arrows into powerful electric beams + Converts wooden arrows into powerful lightning bolts ''' } @@ -1426,6 +1417,7 @@ ThreadOfEradication: { Charges up [ceffect/dog:God's Bane Doombeam] Channelling the weapon causes it to charge up [ceffect/dog:Hyperdeath Rift] instead While charging [ceffect/dog:Hyperdeath Rift], the bow's turning speed is slowed down + Always critically strikes, with critical strike chance increasing critical strike damage ''' } @@ -1449,7 +1441,7 @@ TyrannysEnd: { Tooltip: ''' Converts musket balls into .70 caliber sniper rounds that deal devastating damage - Inflicts [cbuff:CalamityMod/MarkedforDeath] on enemy hits and bypasses defense + Causes enemies to become [cbuff:CalamityMod/MarkedforDeath] and bypasses defense Critical hits summon a swarm of 6 additional bullets 'Pierce the heart of even the most heavily-armored foe' ''' @@ -1460,7 +1452,7 @@ Ultima: { Tooltip: ''' Casts a continuous stream of plasma bolts - Over time bolts power up into solid beams that inflict [cbuff:CalamityMod/ElementalMix] as you continue shooting + Over time bolts power up into solid beams as you continue shooting {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 57fd63cf5d..f1b19bcf75 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -39,7 +39,7 @@ AuroradicalThrow: { Launches a star that splits after a short period of time Split stars home in on nearby enemies after a few seconds Stealth strikes summon a meteor upon enemy impact - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Spreads the [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -47,7 +47,7 @@ BallisticPoisonBomb: { DisplayName: Ballistic Poison Bomb Tooltip: ''' - Throws a sticky bomb that explodes into spikes and [cbuff:Venom] clouds + Throws a sticky bomb that explodes into spikes and venomous clouds Stealth strikes erupt into more clouds with a longer lasting [cbuff:Venom] ''' } @@ -107,7 +107,7 @@ BurningStrife: { DisplayName: Burning Strife Tooltip: ''' - Throws a [cbuff:CalamityMod/Shadowflame] spiky ball that explodes into flames + Throws an enchanted spiky ball that explodes into [cbuff:CalamityMod/Shadowflame] Stealth strikes make the ball erupt into tentacles on hit 'Definitely not pocket safe' ''' @@ -129,6 +129,7 @@ Celestus: { ''' Throws a high-velocity scythe that splits into multiple phantom scythes on enemy hits Stealth strikes reverse direction and home in on enemies after returning to the player + Struck enemies are decimated by [cbuff:CalamityMod/MiracleBlight] ''' } @@ -179,7 +180,7 @@ CosmicKunai: { Tooltip: ''' Fires a rapid stream of short-range kunai - Stealth strikes make kunai pierce foes, travel farther, and spawn 5 homing scythes + Stealth strikes make kunai pierce foes, travel farther, and spawn 9 homing scythes ''' } @@ -259,7 +260,7 @@ CursedDagger: { DisplayName: Cursed Dagger Tooltip: ''' - Throws a fast cursed dagger and two inaccurate weaker daggers that inflict [cbuff:CursedInferno] + Throws a fast cursed dagger and two inaccurate weaker daggers Stealth strikes throw a single dagger that bursts into a [cbuff:CursedInferno] vortex ''' } @@ -278,7 +279,7 @@ DeepWounder: { DisplayName: Deep Wounder Tooltip: ''' - Throws an abyssal hatchet that inflicts [cbuff:CalamityMod/HeavyBleeding] and [cbuff:CalamityMod/CrushDepth] to the enemies it hits + Throws an abyssal hatchet Stealth strikes cause the hatchet to stick to struck enemies, releasing a barrage of water projectiles Water projectiles launch at the closest enemy after a brief delay ''' @@ -399,8 +400,8 @@ EpidemicShredder: { DisplayName: Epidemic Shredder Tooltip: ''' - Throws a [cbuff:CalamityMod/Plague] boomerang that releases plague seekers when it hits tiles or enemies - Stealth strikes cause the boomerang to release plague seekers constantly as it travels + Throws an infected boomerang that releases [cbuff:CalamityMod/Plague] seekers when it hits tiles or enemies + Stealth strikes cause the boomerang to release [cbuff:CalamityMod/Plague] seekers constantly as it travels Contrary to its name, it will probably cause an epidemic if used incorrectly ''' } @@ -419,7 +420,7 @@ ExecutionersBlade: { DisplayName: Executioner's Blade Tooltip: ''' - Throws a stream of homing blades that inflict [cbuff:CalamityMod/GodSlayerInferno] + Throws a stream of homing blades Stealth strikes summon a guillotine of blades on hit ''' } @@ -558,7 +559,6 @@ GraveGrimreaver: { Hurls a cursed scythe which homes in The scythe summons skulls as it flies and explodes into bats on hit Stealth strikes spawn a flood of bats and falling skulls when destroyed - Inflicts [cbuff:CursedInferno] and [cbuff:Confused] 'A dapper skeleton's weapon of choice' ''' } @@ -568,7 +568,7 @@ HardenedHoneycomb: { Tooltip: ''' Fires a honeycomb that shatters into fragments - Stealth strikes grant the honey buff on hit and spawn bees + Stealth strikes grant the [cbuffplr:Honey] buff on hit and spawn bees ''' } @@ -577,9 +577,8 @@ HeavenfallenStardisk: { Tooltip: ''' Throws a stardisk upwards which then launches itself towards your mouse cursor - Explodes into a star of astral bolts on hit + Explodes into a star of astral bolts which spread the [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes rain astral energy bolts from the sky - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -652,7 +651,7 @@ JawsOfOblivion: { ''' Throws a tight spread of six reaper teeth with [cbuff:Venom] that stick in enemies The [cbuff:Venom] can stack when more teeth are stuck in an enemy - Stealth strikes cause the teeth to emit a crushing [cbuff:CalamityMod/HadopelagicPressure] shockwave on impact + Stealth strikes cause the teeth to emit a crushing shockwave on impact 'You're gonna need a bigger boat' ''' } @@ -684,14 +683,26 @@ LeadTomahawk: { ''' } +LemonNade: { + DisplayName: Lemon 'nade + Tooltip: + ''' + Disables normal stealth generation + Hold to pull the pin and generate stealth, and release to throw + The longer it is held, the shorter the fuse once the 'nade is thrown + Will explode in your hand if the fuse is held too long + Stealth strikes explode into exploding lemon seeds + 'Burn their house down!' + ''' +} + LeonidProgenitor: { DisplayName: Leonid Progenitor Tooltip: ''' - Throws a bombshell that explodes, summoning a meteor to impact the site + Throws a bombshell that explodes, summoning a meteor to impact the site and spread the [cbuff:CalamityMod/AstralInfectionDebuff] Press to throw a spread of gravity affected comets that explode, leaving behind a star Stealth strikes lob a bombshell that additionally splits into comets on hit - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -719,7 +730,7 @@ LunarKunai: { DisplayName: Lunar Kunai Tooltip: ''' - Throws out a set of three kunai that ignore gravity and slightly home in on enemies, inflicting [cbuff:CalamityMod/Nightwither] + Throws out a set of three kunai that ignore gravity and slightly home in on enemies After traveling enough distance, the kunai supercharge with lunar energy, homing in far more aggressively and exploding on impact Stealth strikes instantly throw ten supercharged Kunai ''' @@ -729,7 +740,7 @@ Malachite: { DisplayName: Malachite Tooltip: ''' - Throws a stream of kunai that stick to enemies and explode into [cbuff:CalamityMod/Plague] + Throws a stream of kunai that stick to enemies and explode Press to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit Stealth strikes fire three kunai that home in, stick to enemies, and explode ''' @@ -889,7 +900,15 @@ ProfanedPartisan: { Throws a profaned spear that splits into miniature spears upon hitting an enemy Stealth strikes remain impaled in an enemy for 10 seconds While an enemy is impaled, all spears that strike them instead shatter into exploding stars - Inflicts [cbuff:CalamityMod/HolyFlames] + ''' +} + +Pumpkaboom: { + DisplayName: Pumpkaboom + Tooltip: + ''' + Throws a pumpkin which sticks to enemies and explodes after a delay + Stealth strikes throw larger pumpkins which pull enemies in before releasing a larger explosion ''' } @@ -897,7 +916,7 @@ RadiantStar: { DisplayName: Radiant Star Tooltip: ''' - Throws daggers that explode and split after a while and inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Throws daggers that explode and split after a while and spread the [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes split more with a devastating explosion that sucks enemies in ''' } @@ -934,7 +953,7 @@ RegulusRiot: { DisplayName: Regulus Riot Tooltip: ''' - Fires a swift homing disk that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Fires a swift homing disk that spreads the [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes explode into energy stars ''' } @@ -968,9 +987,8 @@ SandDollar: { DisplayName: Sand Dollar Tooltip: ''' - Throws gliding sand dollars which can pierce enemies or bounce off floors - After bouncing, sand dollars lose their pierce but split into damaging shards on impact - Stealth strikes linger in place after bouncing, creating a small sandstorm around them + Throws up to 2 returning sand dollars + Stealth strikes throw 2 long ranged sand dollars that explode into coral shards on enemy hits ''' } @@ -1007,10 +1025,8 @@ SeafoamBomb: { DisplayName: Seafoam Bomb Tooltip: ''' - Hurls a lightweight bomb which bursts into a foam bubble - Foam bubbles combine in pairs to form huge bubbles - Huge bubbles pop into small homing suds after a delay - Stealth strikes are cluster bombs that release eight normal bombs + Throws a bomb that explodes into a bubble which deals extra damage to enemies + Stealth strikes are faster and explode into 5 bubbles ''' } @@ -1075,17 +1091,6 @@ SkyfinBombers: { ''' } -SlickCane: { - DisplayName: Slick Cane - Tooltip: - ''' - Swipes a cane that steals money from enemies - Stealth strikes give a 1 in 20 chance for enemies to drop 1-2 gold coins when hit - Stealth strikes boost damage in proportion to money in the inventory, up to 1 Platinum - 'Economy at its finest' - ''' -} - SludgeSplotch: { DisplayName: Sludge Splotch Tooltip: Stealth strikes cause the main ball of sludge to split on hit, inflicting more damage @@ -1116,7 +1121,6 @@ SpearofPaleolith: { Throws an ancient spear that shatters into fossil shards upon hitting an enemy Stealth strikes remain impaled in the enemy for 10 seconds While an enemy is impaled, all spears that strike them erupt into even more fossil shards - Inflicts [cbuff:CalamityMod/ArmorCrunch] ''' } @@ -1135,7 +1139,7 @@ SporeKnife: { DisplayName: Spore Knife Tooltip: ''' - Throws an overgrown dagger that bursts into a cloud of [cbuff:Poisoned] spores + Throws an overgrown dagger that bursts into a cloud of poisonous spores Stealth strikes erupt into hungry homing buds that stick to enemies and gnaw them ''' } @@ -1155,7 +1159,7 @@ StellarKnife: { DisplayName: Stellar Knife Tooltip: ''' - Throws knives that stop midair and then home into enemies, inflicting [cbuff:CalamityMod/AstralInfectionDebuff] + Throws knives that stop midair and then home into enemies, spreading the [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes throw a volley of 10 knives in a spread 'ZA WARUDO' ''' @@ -1165,7 +1169,7 @@ StormfrontRazor: { DisplayName: Stormfront Razor Tooltip: ''' - Throws a knife that summons [cbuff:CalamityMod/StaticDischarge] lightning on hit + Throws a knife that summons lightning on hit Stealth strikes cause the knife to be faster and summon multiple lightning bolts on hit [c/24C7F0:'Strike and stem the flow'] ''' @@ -1236,10 +1240,10 @@ TheOldReaper: { DisplayName: The Old Reaper Tooltip: ''' - Throws a [cbuff:CalamityMod/SulphuricPoisoning] scythe that cuts through enemies + Throws a scythe that cuts through enemies Deposits unstable isotopes on hit, which create delayed nuclear explosions when they decay Stealth strikes are thrown into the sky and fall upon enemies a few seconds later - On hit, stealth strikes create a focused deluge of [cbuff:CalamityMod/SulphuricPoisoning] acid rain + On hit, stealth strikes create a focused deluge of acid rain ''' } @@ -1248,7 +1252,7 @@ TheSyringe: { Tooltip: ''' Throws a high velocity syringe that increases damage as it travels - Shatters into glass and [cbuff:CalamityMod/Plague] cinders on impact + Shatters into glass and cinders on impact Stealth strikes also shatter into [cbuff:CalamityMod/Plague] bees 'I'm pretty sure this isn't healthy' ''' @@ -1269,7 +1273,7 @@ TimeBolt: { ''' Throws a temporal knife that causes [cbuff:CalamityMod/TimeDistortion] around enemies Stealth strikes can hit more enemies and create a larger time field - 'There should be no boundary to human endeavor' + 'Every maid needs a knife, and every knife needs a cutting board' ''' } @@ -1288,7 +1292,7 @@ TotalityBreakers: { Tooltip: ''' Explodes into highly flammable black tar - Black tar makes enemies [cbuff:Oiled] and lights them with [cbuff:OnFire3] + Black tar makes enemies [cbuff:Oiled] and sets them alight Stealth strikes leak black tar as they fly 'I need a bigger breaker' ''' @@ -1298,8 +1302,8 @@ ToxicantTwister: { DisplayName: Toxicant Twister Tooltip: ''' - Throws a fan of four spinning disks that swirl around your cursor and inflict [cbuff:CalamityMod/SulphuricPoisoning] - Stealth strikes swirl in a wider range and create a vortex of [cbuff:CalamityMod/SulphuricPoisoning] raindrops that home in on enemies + Throws a fan of four spinning disks that swirl around your cursor + Stealth strikes swirl in a wider range and create a vortex of raindrops that home in on enemies ''' } @@ -1317,7 +1321,7 @@ TwistingThunder: { DisplayName: Twisting Thunder Tooltip: ''' - Fires an [cbuff:Electrified] lightning bolt to electrocute enemies + Fires a lightning bolt to electrocute enemies The lightning bolt travels faster while it is raining Summons lightning from the sky on impact Stealth strikes summon more lightning and travel faster @@ -1328,9 +1332,9 @@ UrchinStinger: { DisplayName: Urchin Stinger Tooltip: ''' - Sticks into enemies and injects an extremely potent [cbuff:Poisoned] effect + Sticks into enemies and injects an extremely potent poison Stealth strikes stick into and make enemies [cbuff:Poisoned] for longer - Sticking seven stingers in an enemy with a stealth strike stuck in it spawns an [cbuff:CalamityMod/Irradiated] blast + Sticking seven stingers in an enemy with a stealth strike stuck in it spawns an irradiated blast ''' } @@ -1338,8 +1342,8 @@ UtensilPoker: { DisplayName: Utensil Poker Tooltip: ''' - Fires utensils in bursts of three that cause [cbuff:CalamityMod/HeavyBleeding] - Stealth strikes replace any utensil with a powerful butcher knife that causes [cbuff:CalamityMod/Laceration] + Fires utensils in bursts of three + Stealth strikes replace any utensil with a powerful butcher knife 'Space chickens, that is all' ''' } @@ -1366,6 +1370,17 @@ Vega: { ''' } +WalkingCane: { + DisplayName: Walking Cane + Tooltip: + ''' + Swipes a pointed walking cane + Stealth strikes drain the sanity of foes, causing shadow hands to be summoned when attacked + While held, increases movement speed by {0}% + 'Is it walking me, or am I walking it?' + ''' +} + WaveSkipper: { DisplayName: Wave Skipper Tooltip: @@ -1400,7 +1415,7 @@ Wrathwing: { DisplayName: Wrathwing Tooltip: ''' - Throws an agile, homing winged spear of [cbuff:CalamityMod/Dragonfire] that constantly spits fire + Throws an agile, homing winged spear that constantly spits [cbuff:CalamityMod/Dragonfire] Stealth strikes create an eruption of cinders on hit ''' } @@ -1415,25 +1430,3 @@ WulfrumKnife: { Returning knives also temporarily allows using stealth strikes without rogue armor ''' } - -Pumpkaboom: { - DisplayName: Pumpkaboom - Tooltip: - ''' - Throws a pumpkin which sticks to enemies and explodes after a delay - Stealth strikes throw larger pumpkins which pull enemies in before releasing a larger explosion - ''' -} - -LemonNade: { - DisplayName: Lemon 'nade - Tooltip: - ''' - Disables normal stealth generation - Hold to pull the pin and generate stealth, and release to throw - The longer it is held, the shorter the fuse once the 'nade is thrown - Will explode in your hand if the fuse is held too long - Stealth strikes explode into exploding lemon seeds - 'Burn their house down!' - ''' -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 5da1beeaa2..edf3cfd303 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -2,7 +2,7 @@ AbandonedSlimeStaff: { DisplayName: Abandoned Slime Staff Tooltip: ''' - Summons an astral slime that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Summons an astral slime that spreads the [cbuff:CalamityMod/AstralInfectionDebuff] Consumes all of the remaining minion slots on use Must be used from the hotbar Increased power and size based on the number of minion slots used @@ -72,7 +72,7 @@ AtlasMunitionsBeacon: { BelladonnaSpiritStaff: { DisplayName: Belladonna Spirit Staff - Tooltip: Summons a cute forest spirit that flings magical [cbuff:Poisoned] petals + Tooltip: Summons a cute forest spirit that flings magical petals } BlackHawkRemote: { @@ -85,12 +85,17 @@ BlackHawkRemote: { ''' } +BlightedSlimeStaff: { + DisplayName: Blighted Slime Staff + Tooltip: Summons a blighted slime to fight for you +} + BorealisBomber: { DisplayName: Borealis Bomber Tooltip: ''' Summons aureus bombers to chase down your enemies - Aureus bombers explode violently on enemy impact, inflicting [cbuff:CalamityMod/AstralInfectionDebuff] + Aureus bombers explode violently on enemy impact, spreading the [cbuff:CalamityMod/AstralInfectionDebuff] Does not consume minion slots ''' } @@ -147,10 +152,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 ''' } @@ -191,11 +196,6 @@ Cnidarian: { ''' } -CorroslimeStaff: { - DisplayName: Corroslime Staff - Tooltip: Summons a corro slime to fight for you -} - CorvidHarbringerStaff: { DisplayName: Corvid Harbinger Staff Tooltip: @@ -210,7 +210,8 @@ CosmicImmaterializer: { Tooltip: ''' Summons a cosmic energy spiral to fight for you - The orb will fire swarms of homing energy bolts that cause [cbuff:CalamityMod/MiracleBlight] + The spiral will fire swarms of homing energy bolts when enemies are detected by it + Struck enemies are cleansed by [cbuff:CalamityMod/MiracleBlight] There can only be one energy spiral ''' } @@ -232,11 +233,6 @@ Cosmilamp: { Tooltip: Summons a cosmic lantern above your head to fight for you } -CrimslimeStaff: { - DisplayName: Crimslime Staff - Tooltip: Summons a crim slime to fight for you -} - CryogenicStaff: { DisplayName: Cryogenic Staff Tooltip: @@ -394,7 +390,7 @@ FleshOfInfidelity: { FlowersOfMortality: { DisplayName: Flowers of Mortality - Tooltip: Summons five rainbow flowers over your head that inflict [cbuff:CalamityMod/ElementalMix] + Tooltip: Summons five rainbow flowers over your head } ForgottenApexWand: { @@ -484,6 +480,7 @@ HivePod: { ''' {$CommonItemTooltip.Sentry} Summons an astraglomerate to spawn glomerings at your enemies + Glomerings spread the [cbuff:CalamityMod/AstralInfectionDebuff] on impact ''' } @@ -494,7 +491,7 @@ IgneousExaltation: { Summons an Igneous blade that orbits around you When your minion slots are full, again to launch all blades towards the cursor This ability has a two-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -679,17 +676,6 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } -SeashineHilt: { - DisplayName: Seashine Hilt - Tooltip: - ''' - Summons a brilliant sea prism blade to slice your enemies - Blades will charge up while you hold this item - Pressing will order all fully charged blades to swipe at your cursor - Each sword only consumes half a minion slot - ''' -} - ShellfishStaff: { DisplayName: Shellfish Staff Tooltip: Summons a shellfish to latch onto enemies and inflict [cbuff:CalamityMod/ShellfishClaps] @@ -745,16 +731,12 @@ SquirrelSquireStaff: { StaffOfNecrosteocytes: { DisplayName: Staff of Necrosteocytes - Tooltip: - ''' - Summons small skeletons to fight for you - The skeletons leave behind bone cells as they move - ''' + Tooltip: Summons small skeletons to fight for you } StarspawnHelixStaff: { DisplayName: Starspawn Helix Staff - Tooltip: Summons astral probes that inflict [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Summons astral probes that spread the [cbuff:CalamityMod/AstralInfectionDebuff] } StellarTorusStaff: { @@ -780,7 +762,7 @@ TacticalPlagueEngine: { DisplayName: Tactical Plague Engine Tooltip: ''' - Summons a plague jet to pummel your enemies into submission + Summons a [cbuff:CalamityMod/Plague] jet to pummel your enemies into submission Jets will fire bullets from your inventory Sometimes shoots a missile instead of a bullet 50% chance to save ammo @@ -865,7 +847,7 @@ ViridVanguard: { All weapons inflict [cbuff:CalamityMod/SagePoison], which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -873,7 +855,8 @@ VoidConcentrationStaff: { DisplayName: Void Concentration Staff Tooltip: ''' - Surrounds you with dark energy, which makes all attacks deal 15% less damage + Summons an endless darkness that surrounds you with orbiting dark energies + While the dark energies are orbiting you, you take 15% less damage from all attacks to condense the energy onto a target, focusing your minions on them and creating homing beams When the focused enemy takes damage from any source, they will be struck by additional dark energies These dark energy are twice as strong when the strike was from a minion or sentry @@ -889,8 +872,10 @@ VoidEaterMarionette: { Repeated summons increase the length and power of the Devourer The Devourer attacks with [ceffect/dog:Divinity Devourer], [ceffect/dog:Faith Incinerator] and [ceffect/dog:Ultracosmic Maelstrom] Can play fetch with dropped items - Shift- this item in your inventory when the Devourer has been spawned to prioritize fetching + Press [KEY] while holding this item when the Devourer has been spawned to prioritize fetching ''' + FetchStart: Go fetch! + FetchEnd: Get 'em! } WarloksMoonFist: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 6f25f07e11..4f65eb625d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -13,7 +13,7 @@ ClaretCannon: { ''' Fires a hypercondensed claret round The round explodes upon striking an enemy and releases blood orbs - The explosion shreds enemies, inflicting [cbuff:CalamityMod/Laceration] and dramatically reducing their defense + The explosion shreds enemies, dramatically reducing their defense Picking up the blood orbs will reduce [cbuffplr:PotionSickness] when possible If you do not have [cbuffplr:PotionSickness], your natural regeneration will be enhanced Can only fire once every 10 seconds @@ -31,7 +31,7 @@ EyeofMagnus: { Tooltip: ''' Fires seeking cosmic masses that restore health and mana on hit - Explodes into a nebula cloud which reduces enemy protection + Explodes into a nebula cloud that causes enemies to become [cbuff:CalamityMod/MarkedforDeath] {$Common.AverageDamageInfo} ''' } @@ -40,7 +40,7 @@ LunicEye: { DisplayName: Lunic Eye Tooltip: ''' - Fires seeking energy bolts that reduce enemy protection + Fires seeking energy bolts that cause enemies to become [cbuff:CalamityMod/MarkedforDeath] {$Common.AverageDamageInfo} ''' } @@ -49,14 +49,11 @@ RelicOfDeliverance: { DisplayName: Relic of Deliverance Tooltip: ''' - Using mounts you on the spear; holding revvs the spear, slowing you down - Release to launch yourself at high speeds, halved while a boss is alive - Losing too much speed while charging will bust the charge, resetting your speed - The dash allows you to ram through enemies and travel through tiles - Being inside tiles for too long will warp you back to where you entered + Hold to mount and charge the spear, dashing towards your mouse when the button is released + The speed of the dash depends on the charge amount, and is reduced while a boss is alive + The dash can ram through enemies and travel through tiles Press to dismount Holding out the spear heavily reduces the damage of all summons - {$Common.AverageDamageInfo} [c/FF8C00:Vengeance fueled me, I had no thought other than exactment.] [c/FF8C00:The dragon took everything from me, leaving my broken pieces strewn on the ground.] [c/FF8C00:But when I danced by Her side, I knew there was still something worth fighting for.] diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index b139893fdb..1d7f6b5baf 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -1,19 +1,17 @@ -ActivateAccessoryParry.DisplayName: Activate Accessory Parry AdrenalineMode.DisplayName: Adrenaline Mode -AmmoCycle.DisplayName: Ammo Cycle Hotkey -AngelicAllianceBlessing.DisplayName: Angelic Alliance Blessing ArmorSetBonus.DisplayName: Armor Set Bonus -AscendantInsigniaHotKey.DisplayName: Ascendant Insignia Flight -BoosterDash.DisplayName: Booster Dash DashDoubleTapOverride.DisplayName: Dash Double Tap Override ExoChairSlowDown.DisplayName: Exo Chair Slow Down GodSlayerDash.DisplayName: Dimensional Drive -GravistarSabatonHotkey.DisplayName: Interstellar Stompers Slam NormalityRelocator.DisplayName: Normality Relocator RageMode.DisplayName: Rage Mode -SpectralVeilTeleport.DisplayName: Spectral Veil Teleport -TransformerHotKey.DisplayName: Transformer Hot Key GravitySwapOverride.DisplayName: Gravity Swap Override ExpandDebuffInfo.DisplayName: See Debuff Information -ThePointerLock.DisplayName: The Pointer Lock On -SpringStoolJumpHotKey.DisplayName: Spring Stool Jump Hotkey +HeldItem.DisplayName: Held Item Ability +Accessory1.DisplayName: Accessory Ability 1 +Accessory2.DisplayName: Accessory Ability 2 +Accessory3.DisplayName: Accessory Ability 3 +Accessory4.DisplayName: Accessory Ability 4 +Accessory5.DisplayName: Accessory Ability 5 +Accessory6.DisplayName: Accessory Ability 6 +Accessory7.DisplayName: Accessory Ability 7 diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 873189767c..a7c5075c8c 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -128,3 +128,4 @@ GFBRougeUppercase: Rouge GFBRogueLowercase: rogue GFBRougeLowercase: rouge HotkeyNotBound: "[None]" +HotkeyNotEquipped: an Accessory Ability hotkey diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 0565c7d7ae..1f175c4976 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -1,5 +1,7 @@ BabyCannonballJellyfish.DisplayName: Baby Cannonball Jellyfish Bloatfish.DisplayName: Bloatfish +BrainIllusion.DisplayName: Brain Illusion +BloodBomb.DisplayName: Blood Bomb BobbitWormHead.DisplayName: Bobbit Worm BoxJellyfish.DisplayName: Box Jellyfish Burrower.DisplayName: Burrower @@ -11,7 +13,10 @@ TinySquid: Tiny Squid Cuttlefish.DisplayName: Cuttlefish DevilFish.DisplayName: Devil Fish DevilFishAlt.DisplayName: Devil Fish +DraconicSwarmer.DisplayName: Draconic Swarmer +Dragonfolly.DisplayName: Dragonfolly EidolonWyrmHead.DisplayName: Eidolon Wyrm +FalseBrain.DisplayName: False Brain GiantSquid.DisplayName: Giant Squid GulperEelHead.DisplayName: Gulper Eel Laserfish.DisplayName: Laserfish @@ -20,9 +25,11 @@ MirageJelly.DisplayName: Mirage Jelly MorayEel.DisplayName: Moray Eel OarfishHead.DisplayName: Oarfish ReaperShark.DisplayName: Reaper Shark +Shoreskipper.DisplayName: Shoreskipper SlabCrab.DisplayName: Slab Crab ToxicMinnow.DisplayName: Toxic Minnow Viperfish.DisplayName: Viperfish +WildBumblebirb.DisplayName: Draconic Swarmer AcidEel.DisplayName: Acid Eel BabyFlakCrab.DisplayName: Baby Flak Crab BloodwormNormal.DisplayName: Bloodworm @@ -165,6 +172,7 @@ CrawlerTopaz.DisplayName: Topaz Crawler CrimulanBlightSlime.DisplayName: Crimulan Blight Slime Cryon.DisplayName: Cryon CryoSlime.DisplayName: Cryo Slime +DivineSwine.DisplayName: Divine Swine EbonianBlightSlime.DisplayName: Ebonian Blight Slime Eidolist.DisplayName: Eidolist FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior @@ -179,6 +187,7 @@ OverloadedSoldier.DisplayName: Overloaded Soldier PerennialSlime.DisplayName: Perennial Slime PhantomSpirit.DisplayName: Phantom Spirit Piggy.DisplayName: Piggy +PiggyGold.DisplayName: Gold Piggy PlanterasFreeTentacle.DisplayName: Plantera's Tentacle ProfanedEnergyBody.DisplayName: Profaned Energy Rimehound.DisplayName: Rimehound @@ -187,10 +196,8 @@ ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble Stormlion.DisplayName: Stormlion -StormlionSentry.DisplayName: Stormlion Sentry Sunskater.DisplayName: Sunskater SuperDummyNPC.DisplayName: Super Dummy -WildBumblebirb.DisplayName: Draconic Swarmer WulfrumAmplifier.DisplayName: Wulfrum Amplifier WulfrumDrone.DisplayName: Wulfrum Drone WulfrumGyrator.DisplayName: Wulfrum Gyrator @@ -258,52 +265,18 @@ MicrobialCluster.DisplayName: Microbial Cluster Sulflounder.DisplayName: Sulflounder Toxicatfish.DisplayName: Toxicatfish Trasher.DisplayName: Trasher -AlphaSeaMinnow.DisplayName: Alpha Sea Minnow -AlphaSeaMinnowGold.DisplayName: Gold Alpha Sea Minnow -MinnowPrime: Minnow Prime BabyGhostBell.DisplayName: Baby Ghost Bell -CarrionSwallower.DisplayName: Carrion Swallower +BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray -FesteringRemains.DisplayName: Festering Remains GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas -GildedAxolotl.DisplayName: Gilded Axolotl -GoldBabyGhostBell: Gold Baby Ghost Bell -GoldPolypPanasea: Gold Polyp Panasea -GoldPrismaticGuppy: Gold Prismatic Guppy -HauntedChum.DisplayName: Haunted Chum -Jellyghoul.DisplayName: Jellyghoul -KelpieSeadragon.DisplayName: Kelpie Seadragon -LazarusLampfish.DisplayName: Lazarus Lampfish -Leerslug.DisplayName: Leerslug -LostShoal.DisplayName: Lost Shoal -PearlpodBlack.DisplayName: Pearlpod -PearlpodPink.DisplayName: Pearlpod -PearlpodWhite.DisplayName: Pearlpod -PodobooKoi.DisplayName: Podoboo Koi -PolypPanasea.DisplayName: Polyp Panasea -Polyperil.DisplayName: Polyperil PrismBack.DisplayName: Prism-Back -Probesnout.DisplayName: Probesnout -ProbesnoutGold.DisplayName: Gold Probesnout -PrismaticGuppy.DisplayName: Prismatic Guppy -RadiantBabyGhostBell: Radiant Baby Ghost Bell -RadiantPolypPanasea: Radiant Polyp Panasea -RadiantPrismaticGuppy: Radiant Prismatic Guppy -RadiantSlugbun: Radiant Slugbun -SandProwler.DisplayName: Sand Prowler -SandProwlerNested.DisplayName: Sand Prowler -Scavenger.DisplayName: Scavenger SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaMinnowGold.DisplayName: Gold Sea Minnow -Searslug.DisplayName: Searslug -Sharkoon.DisplayName: Sharkoon -Slugbun.DisplayName: Slugbun -Steampod.DisplayName: Steampod +SeaSerpent1.DisplayName: Sea Serpent BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker @@ -314,9 +287,9 @@ SupremeCatastrophe.DisplayName: Catastrophe VolatileSlime.DisplayName: Volatile Slime Yharon.DisplayName: Yharon, Dragon of Rebirth YharonPhase2: Yharon, Resplendent Phoenix -// Town NPCs, Pets, etc AndroombaFriendly.DisplayName: Androomba Pal +// Town NPCs, Pets, etc Archmage: { DisplayName: Archmage Census.SpawnCondition: Defeat Cryogen @@ -574,6 +547,34 @@ SeaKing: { } } +ShadySalesman: { + DisplayName: Shady Salesman + Census.SpawnCondition: Defeat a Horrible Hog + + Chat: { + Normal1: Have you ever wondered why coins are shiny? Simple! It's to match my partner's dazzling products! + Normal2: Have you ever had a dream? If you have the cash, I can sell you several! + Normal3: Whatever you are thinking, I have the perfect thing for you, at a genuinely excessive discount! + Normal4: Is your life rapidly shrinking? Want to know this world's marvels before your time comes? Are the local merchants only showing you worthless hogwash?! Worry not, Hoggart and I have just the solution! Hogwash sold separately. + Normal5: There's a saying that goes "the grass is greener on the other side." It's absolute balderdash!! For 5 platinum coins, you can buy our Greener Paint and make your life the greenest! + Normal6: They say keeping an Angel Statue nearby is more dangerous than a loaded gun. That's why I own multiple guns - in case some hooligan tries to sell me an Angel Statue! + TownPigPresent1: You're searching for the lil' Piggy? Don't worry, chum! Hoggart and I gave it a Camo-Projector 2000 so it could disappear into the night. This way, not a single rotbrain will lay their nasty half-fingers on it, huehe! + TownPigPresent2: Rumors are runnin' around that I'm inexplicably two Pigg'ins stacked on top of each other. What shameless slander! Don't they know that, if that were true, I'd charge twice the price? Hahaha! + TownPigPresent3: You better take real good care of that piglet. Your sight gotta be good for something other than eyeballing my discounts! Otherwise, who knows what will happen to the swine stock market... + TownPigPresent4: Where the Piggy went? Could've sworn I saw it chasing down a four-legged carrot. Now's your chance to chase Fortune and Glory, pal, by buying these MARVELOUS wares! + Rain: People always say "rain, rain, go away! Come back another day!", but everyone knows it would be better if it came back never! To solve this, I intend to invest in Hoggart's Dome Program, we just need 500 platinum coins to get it off the ground! + WindyDay: Aren't you tired of your house being blown away by any shoddy gust of wind? Well, I have the solution to your problem! With my state-of-the-art industrial super glue (for only 5 gold coins a pack), you too may survive the attack of invaders with outstanding lung capacity! + Desert: Exhausted from this oven-like heat? Yearning for something to help you cool down? Check out our revolutionary new product: water! It comes in all flavors of flavorless! Any bottle shape is available, from round to triangular! Feel the chill of molten ice as it enters your guts! It even has healing properties! Sip our free sample for the low price of 50 gold! + Tundra: Did you ever hear the tragedy of Kevin Bacon the Wise? I thought not, It's not a story the Elumphants would tell you. Kevin Bacon was a Ham Lord of the Hogs, so powerful and so wise he could use his Hogtusk to influence metal to create gold... Unfortunately, he taught his apprentice everything he knew, then his apprentice out-cashed and deposed him. Ironic. He could save others from debt, but not himself. + Graveyard: Does that zombie look like a happy customer? No!! It's full of maggots!! It has no life savings!! While you still do, hurry up and spend yours on a funky edition, happiness-smelling Maggot Repellent! + BloodMoon1: These shambling deadheads are the worst! How am I supposed to rip people off when they're all either dead, broke or fighting for their lives?! + BloodMoon2: Like my partner always says, price makes the prize! Hire our Moon Doom Cannon, and enjoy a whole year without the meatsack invasion! Fund the construction of the Eclipse variant and get a deluxe model with a neat robotic decal! All for 5000 platinum coins! + BloodMoon3: Violence is at every corner tonight, huh? Remember these words, buddy: make deals, not war! + Hardmode: Those pesky merchants still want to sell you full-price, low quality copper tools?! Bird droppings!! Barter with me, and you'll receive Palladium at HOG-WILD prizes! + MoonLordDefeated: I've been told this land is ruled by three gnomes in a suit of armor. That's impossible! Gnomes are the most deplorable customers I've dealt with. They can't handle a spoon without snapping it in half!! It's always the halflings... + } +} + TownPiggy: { DisplayName: Town Piggy Census.SpawnCondition: Use The Housing Contract @@ -598,6 +599,7 @@ TownPiggy: { Techno: Techno JohnPork: John Pork Piglet: Piglet + Poogie: Poogie } Chat: { @@ -607,9 +609,4 @@ TownPiggy: { } } -DraconicSwarmer.DisplayName: Draconic Swarmer -Dragonfolly.DisplayName: Dragonfolly -Shoreskipper.DisplayName: Shoreskipper -BrainIllusion.DisplayName: Brain Illusion -FalseBrain.DisplayName: False Brain -BloodBomb.DisplayName: Blood Bomb +HorribleHog.DisplayName: Horrible Hog diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 87c74c3ceb..86835a2723 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -48,7 +48,6 @@ CataclysmicFlame.DisplayName: Cataclysmic Flame CatastrophicCinder.DisplayName: Catastrophic Cinder CirclingBloodScythe.DisplayName: Circling Blood Scythe CrimsonEye.DisplayName: Crimson Eye -CrimulanSpike.DisplayName: Crimulan Spike CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 4f2e7b90d0..800b3e48a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -19,6 +19,14 @@ GammaAcid.DisplayName: Acid GammaBeam.DisplayName: Gamma Ray GammaRayBurst.DisplayName: G-FUEL BEAM GhostBellShock.DisplayName: Electrical Field +HorribleHogChargeHitbox.DisplayName: Horrible Hog +HorribleHogRubble.DisplayName: Rubble +HorribleHogShockwave.DisplayName: Sinister Swine Shockwave +HorribleHogShockwaveSpawner.DisplayName: Horrible Hog Shockwave Spawner +HorribleHogVomitBomb.DisplayName: Barf Bomb +HorribleHogVomitChunk.DisplayName: Horrible Hog's Leftovers +HorribleHogVomitEye.DisplayName: Regurgitated Demon Eye +HorribleHogZombieSpawner.DisplayName: Horrible Hog Zombie Spawner HorsPoisonBlast.DisplayName: Poisonous Spit HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 460f796ac8..a46f5fac1d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -43,7 +43,9 @@ BloodRay.DisplayName: Blood Ray BlueBubble.DisplayName: Bubble BlushieStaffProj.DisplayName: Staff of Blushie BrimroseBeam.DisplayName: Brimrose Beam -BrimstoneHellfireballFriendly.DisplayName: Hellfireball +CalamitousDartFriendly.DisplayName: Calamitous Dart Friendly +CalamitousExplosionFriendly.DisplayName: Calamitous Explosion Friendly +CalamitousFireballFriendly.DisplayName: Calamitous Fireball Friendly CauldronProj.DisplayName: Smauldron CauldronProjSmall.DisplayName: Smaullerdron ChronoIcicleLarge.DisplayName: Chrono Icicle @@ -77,6 +79,8 @@ ExoVortex2.DisplayName: Subsuming Vortex FatesRevealFlame.DisplayName: Fate's Reveal FireImplosion.DisplayName: Swirling Backdraft FlareBoltProjectile.DisplayName: Flare Bolt +FleshTotemMinion.DisplayName: Flesh Totem Minion +FleshTotemSoul.DisplayName: Flesh Totem Soul ForbiddenAxeBlade.DisplayName: Ruin Blade ForbiddenSunburst.DisplayName: Sunburst ForbiddenSunProjectile.DisplayName: Forbidden Sun @@ -96,7 +100,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 @@ -149,6 +152,7 @@ MelterNote2.DisplayName: Melter Song MeteorStar.DisplayName: Meteor Star MeteorStarExplosion.DisplayName: Explosion MiasmaGas.DisplayName: Miasma Gas +MoonSigil.DisplayName: Moon Sigil NanoPurgeLaser.DisplayName: Nano Beam NebulaCloud.DisplayName: Nebula Cloud NebulaCloudCore.DisplayName: Nebula Cloud Core @@ -186,7 +190,6 @@ PrinceFlameSmall.DisplayName: Holy Fire RainbowComet.DisplayName: Comet RainbowRocket.DisplayName: Rainbow Rocket RancorArm.DisplayName: Vengeful Arm -RancorFog.DisplayName: The Fog Is Coming RancorLargeCinder.DisplayName: Lava Cinder RancorLaserbeam.DisplayName: The Angy Beam RancorMagicCircle.DisplayName: Magic Circle @@ -228,6 +231,7 @@ SoulPiercerBeam.DisplayName: Soul Piercer SoulPiercerBolt.DisplayName: Soul Piercer SparkInfernal.DisplayName: Spark SparklingLaser.DisplayName: Sparkling Laser +SpectralFeather.DisplayName: Spectral Feather SpiritCongregation.DisplayName: Spirit Monster SpiritDust.DisplayName: Spirit Dust Starblast.DisplayName: Star @@ -277,7 +281,7 @@ WaterLeechProj.DisplayName: Water Leech WarpSigil.DisplayName: Warp Sigil WarpSigilShot.DisplayName: Warped Shot WarpSigilShotCreator.DisplayName: Warped Shot Creator -WaywasherProj.DisplayName: Waywasher Wave +WaywasherProj.DisplayName: Waywasher Blast WingmanGrenade.DisplayName: Mana Grenade WingmanShot.DisplayName: Mana Shot WulfrumBolt.DisplayName: Wulfrum Bolt @@ -288,7 +292,3 @@ WyvernFeatherPurple.DisplayName: Feather WyvernProjectile.DisplayName: Wyvern YharimsCrystalBeam.DisplayName: Yharim's Beam YharimsCrystalPrism.DisplayName: Yermes Christal -FleshTotemMinion.DisplayName: Flesh Totem Minion -FleshTotemSoul.DisplayName: Flesh Totem Soul -SpectralFeather.DisplayName: Spectral Feather -MoonSigil.DisplayName: Moon Sigil diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 7586da81d3..b3e4d3ef8c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -4,12 +4,12 @@ AegisBeam.DisplayName: Aegis Beam AegisBlast.DisplayName: Aegis Blast AegisBlast2.DisplayName: Aegis Blast AegisFlame.DisplayName: Aegis Flame -AmidiasTridentBoltProj.DisplayName: Trident Bolt AmidiasWhirlpool.DisplayName: Whirlpool AncientBeam.DisplayName: Ancient Beam AncientStar.DisplayName: Ancient Star AndromedasStride.DisplayName: Andromeda's Stride AndromedasStrideBoltSpawner.DisplayName: Andromeda Shock +AquaStream.DisplayName: Aqua Stream AridGrandeur.DisplayName: Arid Grandeur AriesWrath.DisplayName: Aries's Wrath AriesWrathConstellation.DisplayName: Constellation @@ -105,6 +105,7 @@ EmpyreanKnife.DisplayName: Empyrean Knife EntropicFlechette.DisplayName: Entropic Flechette EonBolt.DisplayName: Eon Bolt EssenceScythe.DisplayName: Essence Scythe +EvilSmasherProjectile.DisplayName: Evil Smasher ExaltedOathbladeThrownBlade.DisplayName: Exalted Oathblade Thrown Blade MawOfInfinityHoldout.DisplayName: Maw of Infinity MawOfInfinityJaws.DisplayName: Divinity Devourer @@ -186,6 +187,8 @@ NeptuneOrb.DisplayName: Neptune's Trident NeptunesBountyProjectile.DisplayName: Neptune's Bounty NeptunesBountySplitProjectile.DisplayName: Neptune's Bounty Jet OathswordFlame.DisplayName: Oathsword Flame +OblivionFire.DisplayName: Oblivion Fire +OblivionBolt.DisplayName: Oblivion Bolt Orbacle.DisplayName: Auric Orb OrderbringerBeam.DisplayName: Orderbringer Beam OrderbringerWaveProj.DisplayName: Order-bringing Wave @@ -217,7 +220,6 @@ RemsRevengeExplosion.DisplayName: Blood Explosion RendingNeedle.DisplayName: Rending Needle RespiteblockBlood.DisplayName: Respiteblock Blood RespiteblockHoldout.DisplayName: Respiteblock -RiptideWave.DisplayName: Wave Rox1.DisplayName: Rock RoxcaliburProj.DisplayName: Roxcalibur RSSolarFlare.DisplayName: Flare @@ -231,6 +233,7 @@ ScorcherExplosion.DisplayName: Scorching Crystal Blast ScorpiusConstellation.DisplayName: Scorpius Constellation ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge +SeashineSwordProj.DisplayName: Seashine Beam SeekingScorcherProj.DisplayName: Scorching Seeker SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam @@ -311,4 +314,3 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard -EvilSmasherProjectile.DisplayName: Evil Smasher diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson index 1add4e568b..fc30ef1be4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson @@ -2,6 +2,7 @@ Akato.DisplayName: Akato Astrophage.DisplayName: Astrophage BabyGhostBell.DisplayName: Baby Ghost Bell Bear.DisplayName: Bear +Beldum.DisplayName: Beldum BendyPet.DisplayName: Dreamfog Dragon BrimlingPet.DisplayName: Brimling ChibiiDoggo.DisplayName: Chibii Devourer diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index ff335e0aaa..aef3579da9 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -1,3 +1,4 @@ +AbyssalFire.DisplayName: Abyssal Fire AcidRocket.DisplayName: Acid Rocket AdamAcceleratorBeam.DisplayName: Adamantite Particle Beam AMR2.DisplayName: AMR @@ -6,7 +7,7 @@ AngelicBeam.DisplayName: Angelic Beam AnimosityBullet.DisplayName: Brimstone Round AquaBlast.DisplayName: Aqua Blast AquaBlastToxic.DisplayName: Aqua Blast Toxic -Aquashard.DisplayName: Aqua Crystal +Aquashard.DisplayName: Aquashard AquashardSplit.DisplayName: Aquashard ArcherfishRing.DisplayName: Archerfish Ring ArcherfishShot.DisplayName: Water Round @@ -19,7 +20,9 @@ AuralisBullet.DisplayName: Auralis Bullet AuricBullet.DisplayName: Auric Bullet AuroraFire.DisplayName: Aurora Blaze BallistaGreatArrow.DisplayName: Ballista Great Arrow +BallistaShard.DisplayName: Ballista Shard BarinadeArrow.DisplayName: Fin Arrow +BlahajBlast.DisplayName: Blahaj Blast BlightFlames.DisplayName: Blight Flames BlissfulBombardierSplitProjectile.DisplayName: Profaned Mini-Rocket BloodBoilerFire.DisplayName: Blood Fire @@ -130,6 +133,7 @@ MagnomalyExplosion.DisplayName: Explosion MagnomalyRocket.DisplayName: Nuke MarksmanShot.DisplayName: Marksman Shot MechanicalBarracuda.DisplayName: Barracuda +MegalodonRocket.DisplayName: Megalodon Rocket MegalodonShot.DisplayName: Megalodon Shot MeowCreature.DisplayName: the creature :3 MeowFire.DisplayName: Purr Fire @@ -148,6 +152,9 @@ NovaShot.DisplayName: Nova Bolt NukeOfBliss.DisplayName: Profaned Nuke NullFlash.DisplayName: Null Flash NullShot.DisplayName: Null +OmniSniperShot.DisplayName: Omni Sniper Shot +OmniGrenade.DisplayName: Omni Grenade +OmniShotgunShot.DisplayName: Omni Shotgun Shot OntologicalDespoilerBeam.DisplayName: Null-Annihilation Beam OntoligicalDespoilerBurst.DisplayName: Disruption Blast OntologicalDespoilerGrenade.DisplayName: Disruption Sphere @@ -201,7 +208,6 @@ SevensStrikerGrape.DisplayName: Grapes SevensStrikerOrange.DisplayName: Orange SevensStrikerPlatinumCoin.DisplayName: Platinum Coin ShadeFire.DisplayName: Shady Fire -ShardshockerCrystal.DisplayName: Charged Aqua Crystal Shell.DisplayName: Shell Shockblast.DisplayName: Blast ShockblastRound.DisplayName: Round @@ -260,14 +266,8 @@ VanquisherArrowMain.DisplayName: Vanquisher Arrow VanquisherArrowProj.DisplayName: Vanquisher Arrow Proj VeriumBoltProj.DisplayName: Verium Bolt VernalBolt.DisplayName: Vernal Bolt +VoidBlast.DisplayName: Void Blast WaterSpout.DisplayName: Spout WildfireBloomFire.DisplayName: Wildfire Fire WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap -AbyssalFire.DisplayName: Abyssal Fire -BlahajBlast.DisplayName: Blahaj Blast -MegalodonRocket.DisplayName: Megalodon Rocket -VoidBlast.DisplayName: Void Blast -OmniSniperShot.DisplayName: Omni Sniper Shot -OmniGrenade.DisplayName: Omni Grenade -OmniShotgunShot.DisplayName: Omni Shotgun Shot diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 228285a23b..9e6b2f9f51 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -159,6 +159,8 @@ Knife.DisplayName: Knife KylieBoomerang.DisplayName: Kylie LanceofDestiny.DisplayName: Holy Lance LeadTomahawkProj.DisplayName: Lead Tomahawk +LemonNadeHoldout.DisplayName: Lemon 'nade +LemonNadeProjectile.DisplayName: Lemon 'nade LeonidCometBig.DisplayName: Leonid Comet LeonidCometSmall.DisplayName: Leonid Comet LeonidProgenitorBombshell.DisplayName: Leonid Bombshell @@ -189,6 +191,7 @@ NanoblackLightspeedCarve: { Standard: Light-speed Carve } +NanoblackLightspeedCarveSlashVisual.DisplayName: Nanoblack Light-speed Carve Visuals NanoblackMain.DisplayName: Nanoblack Reaper NanoblackPiercingStrike.DisplayName: Zero-Point Energy Strike NanoblackStrike.DisplayName: Zero-Point Energy Strike @@ -196,6 +199,7 @@ NanoblackTesselation.DisplayName: Nanoblack Tesselation NastyChollaBol.DisplayName: Nasty Cholla NastyChollaNeedle.DisplayName: Cactus Needle OrichalcumSpikedGemstoneProjectile.DisplayName: Orichalcum Gemstone +PaleoShatterExplosion.DisplayName: Paleo Shatter Explosion PalladiumJavelinProjectile.DisplayName: Palladium Javelin PartisanExplosion.DisplayName: Profaned Explosion PenumbraBomb.DisplayName: Penumbra Bomb @@ -258,6 +262,7 @@ SeraphimAngelicLight2.DisplayName: Light Orb SeraphimBeamLarge.DisplayName: Holy Beam SeraphimDagger.DisplayName: Seraphim SeraphimProjectile.DisplayName: Seraphim +ShadySalesmanGunshot.DisplayName: Elephant-Killing Round ShatteredExplosion.DisplayName: Shattered Dawn Blast ShatteredDawnKnife.DisplayName: Shattered Dawn ShatteredDawnScorchedBlade.DisplayName: Scorched Blade @@ -271,13 +276,15 @@ SkyBomberGas.DisplayName: Irradiated Cloud SkyfinNuke.DisplayName: Skyfin Nuke SludgeSplotchProj1.DisplayName: Sludge Splotch SludgeSplotchProj2.DisplayName: Sludge Splotch +SmallCoral.DisplayName: Small Coral SnapClamProj.DisplayName: Snap Clam SnapClamStealth.DisplayName: Snap Clam +SpadefishHoldout.DisplayName: Spinfish +SpadefishThrown.DisplayName: Spadefish SpearofDestinyProjectile.DisplayName: Destiny Spear SpearofDestinyStealth.DisplayName: Empowered Holy Lance SpearofDestinyStealthExplosion.DisplayName: Strong Burst SpearofPaleolithProj.DisplayName: Paleolith Spear -PaleoShatterExplosion.DisplayName: Paleo Shatter Explosion SpentFuelContainerProjectile.DisplayName: Spent Fuel Container SphereBladed.DisplayName: Bladed Sphere SphereBlue.DisplayName: Blue Thruster Sphere @@ -341,6 +348,3 @@ WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife -NanoblackLightspeedCarveSlashVisual.DisplayName: Nanoblack Light-speed Carve Visuals -LemonNadeHoldout.DisplayName: Lemon 'nade -LemonNadeProjectile.DisplayName: Lemon 'nade diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index cb32d297b4..da54d5ac0c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -35,11 +35,10 @@ BlackDragonHead.DisplayName: Black Celestial Dragon BlackDragonTail.DisplayName: Black Celestial Dragon BlackHawkBullet.DisplayName: Black Hawk Bullet BlackHawkSummon.DisplayName: Black Hawk +BlightedSlimeMinion.DisplayName: Blighted Slime BloodBreath.DisplayName: Blood Dragon Fire BloodRain.DisplayName: Blood Rain BloodSpit.DisplayName: Blood Spit -BoneMatter.DisplayName: Bone Matter -BoneMatter2.DisplayName: Bone Matter BrimseekerAuraBall.DisplayName: Seeker BrimstoneDartMinion.DisplayName: Brimfire BrimstoneDartSummon.DisplayName: Brimstone Dart @@ -47,7 +46,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 @@ -64,8 +63,6 @@ CinderBlossom.DisplayName: Cinder Blossom CloudElementalMinion.DisplayName: Cloud Elemental CnidarianJellyfishOnTheString.DisplayName: Cnidarian CnidarianSpark.DisplayName: Cnidarian Spark -CorroslimeMinion.DisplayName: Corroslime -CorruptionSlimeGodMinion.DisplayName: Slime God CosmicBlast.DisplayName: Cosmic Blast CosmicBlastBig.DisplayName: Cosmic Blast CosmicEnergySpiral.DisplayName: Cosmic Energy @@ -76,8 +73,6 @@ CosmicViperSplittingRocket.DisplayName: Splitting Rocket CosmicViperSummon.DisplayName: Cosmic Viper CosmilampBeam.DisplayName: Cosmic Beam CosmilampMinion.DisplayName: Cosmilamp -CrimslimeMinion.DisplayName: Crimslime -CrimsonSlimeGodMinion.DisplayName: Slime God DaedalusCrystal.DisplayName: Daedalus Crystal DaedalusCrystalShot.DisplayName: Crystal Shot DaedalusGolem.DisplayName: Daedalus Golem @@ -284,6 +279,7 @@ SquirrelSquireAcorn.DisplayName: Squirrel Acorn SquirrelSquireMinion.DisplayName: Squirrel Squire Starforge.DisplayName: Starforge StarforgeBlast.DisplayName: Starforge Blast +StatigelBlightedSlime.DisplayName: Blighted Paladin StellarTorusBeam.DisplayName: Stellar Torus Beam StellarTorusSummon.DisplayName: Stellar Torus Summon StormjawBaby.DisplayName: Stormjaw Baby @@ -309,9 +305,11 @@ MagicUmbrella.DisplayName: Cyan Umbrella UniverseSplitterField.DisplayName: Field UniverseSplitterHugeBeam.DisplayName: Universe Splitter Ray UniverseSplitterSmallBeam.DisplayName: Universe Splitter Ray +UrchinSpike.DisplayName: Urchin Spike Valkyrie.DisplayName: Valkyrie VengefulSunBeam.DisplayName: Vengeful Sun Beam VengefulSunSpiritMinion.DisplayName: Vengeful Sun Spirit +VictideSeaSnail.DisplayName: Sea Snail VileFeederProjectile.DisplayName: Eater of Souls Mini VileFeederSummon.DisplayName: Baby Eater ViridVanguardBlade.DisplayName: Vanguard Blade diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index cbe6fca08b..dc6ed38dc6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -41,11 +41,13 @@ CursorProj.DisplayName: Aestheticus Crystal CursorProjSplit.DisplayName: Aestheticus Crystal CyanLabSeeker.DisplayName: Seeking Mechanism DarkIce.DisplayName: Dark Ice +DebuffSpreadEffect.DisplayName: Debuff Spread Effect DeepseaBlaze.DisplayName: Deepsea Blaze DevourerofCodsBobber.DisplayName: Devourer of Cods Bobber DiamondOfTheDeepProjectile.DisplayName: Abyss Spirit DirectStrike.DisplayName: Nondescript Damaging Entity DragonDust.DisplayName: Dust +DryadsTearBurst.DisplayName: Teardrop Ripple DunesandBallFalling.DisplayName: Dunesand Ball DuneSandBallGun.DisplayName: Dunesand Ball EarlyBloomBobber.DisplayName: Early Bloom Bobber @@ -145,6 +147,7 @@ StarStruckWaterBottle.DisplayName: Bottle StepStoolBonusFX.DisplayName: Step Stool Bonus StickyFeatherAero.DisplayName: Feather StomperSlam.DisplayName: Stomper Slam +StratusBlackHole.DisplayName: Stratus Singularity SuicideBomberDemon.DisplayName: Demon SulphuricAcidBubbleFriendly.DisplayName: Acid Bubble SulphurousSandBallGun.DisplayName: Sulphurous Sand Ball @@ -160,10 +163,6 @@ TrustyOldBobber.DisplayName: Trusty Old Bobber UrsaSlash.DisplayName: Ursa Slash V8000SoulVisual.DisplayName: V8000 Soul VerstaltiteBobber.DisplayName: Verstaltite Bobber -VictideBarrier.DisplayName: Tidal Barrier -VictideBobber.DisplayName: Snail Bobber -VictideSeaSnail.DisplayName: Sea Snail -VictideSpirit.DisplayName: Bubbly Spirit VoidFieldGenerator.DisplayName: Void Field Generator VolcanicSandBallFalling.DisplayName: Volcanic Sand Ball VolcanicSandBallGun.DisplayName: Volcanic Sand Ball @@ -178,5 +177,3 @@ WulfrumLureSignal.DisplayName: Signal YellowLabSeeker.DisplayName: Seeking Mechanism XykDeathAnim.DisplayName: Xyk Death Animation XykWings.DisplayName: Xyk Wings -StratusBlackHole.DisplayName: Stratus Singularity -DebuffSpreadEffect.DisplayName: Debuff Spread Effect diff --git a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson index e9a1183133..72771697c9 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson @@ -120,7 +120,7 @@ SCalDesparationText4Rematch: I can't imagine what your future holds now. PermafrostSummonText: Are you prepared for a task most Sisyphean? PermafrostBirbSwarmText: Those hearts were a bit too brutal for my taste. How about some lovely birds instead? PermafrostBH2Text: Getting tired from the battle, adventurer? Hungry? How does some Delicious Meat sound? -PermafrostBH3Text: Suprised at how I am holding my own again you? I did train Calamitas, after all! +PermafrostBH3Text: Surprised at how I am holding my own again you? I did train Calamitas, after all! PermafrostDoGText: The serpent!? How!? What is HE doing here!? Is he here to torment me further!? Kill it, adventurer! PermafrostPhase2Text: Ha! I suppose I can no longer be "chill" about this duel! Get it? PermafrostBH4Text: Need a break? Can you not even keep up with an old man? diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index ba47bbc760..4f5acca788 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -87,6 +87,9 @@ HolyInferno: "{0} was incinerated by the profaned backdraft." Laceration1: "{0} was indecently smeared all over the walls." Laceration2: "{0} was turned into a fine red mist." Laceration3: "{0} was pulped, ribbons and rivulets of spent life spattering freely." +Lemonnade1: "{0} had their budget cut." +Lemonnade2: "{0} was sent to the vitrified sector." +Lemonnade3: "{0} suffered from self-inflicted domestic arson." ManaBurn: "{0}'s life was completely converted into mana." ManaConversionEnchant: "{0}'s life was fully tapped by dark magics." MiracleBlight1: "{0} was blown away by miraculous technological advancements." diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index a88b068345..db6bd40940 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -6,6 +6,7 @@ Ribs: Ribs Stalagmite: Stalagmite Stalactite: Stalactite PirateCrate: Abandoned Crate +IronBall: Iron Ball // Basic Calamity Furniture Basin: Basin LavaFountain: Lava Fountain diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 92531f5615..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 @@ -664,6 +665,7 @@ Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock AuricLandMines: Setting god killing traps +IronBall: Adding a bit more iron // Hold Shift tooltip default HoldShiftTooltipExtensionIndicator: Hold Shift for more HoldShiftTooltipReplacementIndicator: Hold Shift for details diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index bcc871f221..7992346408 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -16,7 +16,7 @@ SetBonus: { {0}% increased max speed and acceleration You gain a damage and critical strike chance boost relative to your current movement speed, up to {0}% ''' - Melee: 10% increased melee damage + Melee: 10% increased melee speed } Copper: Increases all damage by {0} @@ -28,7 +28,7 @@ SetBonus: { ''' Eskimo: ''' - 25% increased Cold debuff damage + 50% increased Cold debuff damage Provides immunity to the Chilled, Frozen, and Frostburn debuffs ''' Rain: @@ -48,11 +48,7 @@ SetBonus: { {0}% increased damage which scales based on how far the target is from you Closer range grants melee damage, while farther range grants ranged damage ''' - Gladiator: - ''' - +60 maximum stealth - 5% increased rogue damage and 10% increased velocity - ''' + Gladiator: +{0} maximum stealth Gold: ''' All enemies have a {0}% chance to drop 1 extra gold diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 0fe39ada77..5298cbc8cb 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -128,11 +128,7 @@ EditedTooltip: { */ Campfires: Life regen is increased by 0.5 HP/s when near a campfire HeartLantern: Grants +1 HP/s life regeneration when placed nearby - BottledHoney: - ''' - Grants +1 HP/s life regen for a short time - Grants an additional +1 HP/s life regen while inflicted with a damaging debuff - ''' + BottledHoney: Grants the [cbuffplr:Honey] buff for 15 seconds ShinyStone: Grants +2 HP/s life regen and accelerates natural life regen when not moving BandofRegeneration: Grants +1 HP/s life regeneration CharmofMyths: Grants +1 HP/s life regeneration and reduces the cooldown of healing potions by 25% @@ -183,13 +179,13 @@ EditedTooltip: { ''' FrogLeg: Increases jump speed by {0}% and allows auto-jump // Soaring Insignia - EmpressFlightBooster1: Increases wing flight time by 33% + EmpressFlightBooster1: Grants 2.5 additional seconds of flight time EmpressFlightBooster2: Increases movement speed by 7.5%, jump speed by 10%, and acceleration by 1.25x GravityGlobe: ''' - Provides 32% increased jump speed and increased fall speed + Provides 40% increased jump speed and increased fall speed Provides a gravitational boost jump, which recharges whenever gravity is flipped - Slightly improves wingless air movement speed + Improves wingless air movement speed Press {$Key.UP} to change gravity Press {$Key.DOWN} to fall faster ''' @@ -406,7 +402,7 @@ TavernkeepChat.FullMoon: Care for a little Moonshine? TaxCollectorChat: { DoGDefeated: Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by! PreBrimmy: So those punks on Azafure think they can live for free on my lands? Tell you what, do my job there and I might give you a bonus. - HasSlickCane: Goodness! That cane has swagger! + HasWalkingCane: Goodness! That cane has swagger! Has100Plat: BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again! Has500Plat: Where and how are you getting all of this money?! Scram, you have no need for me! } @@ -529,7 +525,7 @@ TownNPCMood: { PartyGirl: { Monument: Yeeesh, we're gonna have an ugly statue of big money around? That like, totally kills the party mood around here. GiftPositive: PARTY GIFTS? FOR ME? Oh just you wait, I'm gonna throw the BIGGEST party this town has ever seen, forever and always! - GiftNegative: I knew you were trouble when you walked in that suspicious looking box! It's too late now to say sorry! + GiftNegative: I knew you were trouble when you walked in with that suspicious looking box! It's too late now to say sorry! } Pirate: { diff --git a/MainMenu/CalamityMainMenu_Sunken.cs b/MainMenu/CalamityMainMenu_Sunken.cs deleted file mode 100644 index 661e9c03f8..0000000000 --- a/MainMenu/CalamityMainMenu_Sunken.cs +++ /dev/null @@ -1,426 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using CalamityMod.Effects; -using CalamityMod.Systems; -using CalamityMod.Utilities.Daybreak.Buffers; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.MainMenu.SunkenFishBoid; - -namespace CalamityMod.MainMenu -{ - public class CalamityMainMenu_Sunken : ModMenu - { - public class Bubble - { - public int Time; - public int Lifetime; - public int IdentityIndex; - public float Scale; - public float StoredScale; - public float Rotation; - public float RotationSpeed; - public float Depth; - public Color DrawColor; - public Vector2 Velocity; - public Vector2 Center; - - public Asset BubbleTexture; - - public Bubble(int lifetime, int identity, float depth, float storedScale, Color color, Vector2 startingPosition, Vector2 startingVelocity) - { - Lifetime = lifetime; - IdentityIndex = identity; - Depth = depth; - StoredScale = storedScale; - DrawColor = color; - Center = startingPosition; - Velocity = startingVelocity; - - Rotation = Main.rand.NextFloat(MathF.Tau); - RotationSpeed = Main.rand.NextFloat(0.01f, 0.04f) * Main.rand.NextBool().ToDirectionInt(); - BubbleTexture = ModContent.Request("CalamityMod/Particles/Bubble"); - } - - public void Update() - { - // Sway from side to side. - Velocity.X = MathHelper.Lerp(-1f, 1f, CalamityUtils.SineBumpEasing((Time / 60f), 1)); - Scale = MathHelper.Lerp(StoredScale, 0f, Time / (float)Lifetime); - - // Rotate. - Rotation += RotationSpeed * MathHelper.TwoPi * 0.1f; - - Time++; - Center += Velocity; - } - - public void Draw(SpriteBatch spriteBatch) - { - Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); - Vector2 parallaxedPosition = Center * depthFactor; - var scaleByDepth = Scale * Utils.Remap(Depth, 1, 5, 1f, 0.4f, true); - spriteBatch.Draw(BubbleTexture.Value, parallaxedPosition, null, DrawColor, Rotation, BubbleTexture.Value.Size() * 0.5f, scaleByDepth, 0, 0f); - } - } - - public static List Bubbles { get; private set; } = []; - - public static List Fishes { get; private set; } = []; - - public static Asset LogoWater => ModContent.Request("CalamityMod/MainMenu/LogoSunken_Water"); - - public static Asset LogoWaterFill => ModContent.Request("CalamityMod/MainMenu/LogoSunken_Water_Fill"); - - public static Asset Perlin => ModContent.Request("CalamityMod/MainMenu/Perlin"); - - public static Asset WorleyInverted => ModContent.Request("CalamityMod/MainMenu/WorleyInverted"); - - private static RenderTarget2D logoWaterFillTarget; - private static RenderTarget2D logoTarget; - - public int MaxBoids = 120; - - public float remixLogoRotation = 0f; - - /// - /// The global save data key which dictates whether or not the player is opening the Sunken Sea Overhaul update for the first time. - /// - public const string FirstTimeOpeningSunkenSeaOverhaulKey = "HasOpenedTheSunkenSeaOverhaulForTheFirstTime"; - - public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenuSunken"); - - public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/LogoSunken"); - - public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); - - public override Asset MoonTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); - - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; - - public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - - if (!Main.dedServ) - { - LogoWaterFill.Wait(); - Logo.Wait(); - - Main.QueueMainThreadAction(() => - { - logoWaterFillTarget = new RenderTarget2D(Main.instance.GraphicsDevice, LogoWaterFill.Width(), LogoWaterFill.Height()); - logoTarget = new RenderTarget2D(Main.instance.GraphicsDevice, Logo.Width(), Logo.Height()); - }); - } - } - - public static void ForceMenuStyle() - { - // Forcefully open this ModMenu if it's the player's first time opening the Sunken Sea Overhaul update. - if (GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) - return; - - List modMenus = MenuLoader.menus; - - var sunkenMenu = ModContent.GetInstance(); - if (modMenus.Contains(sunkenMenu)) - { - int sunkenSeaMenuIndex = modMenus.IndexOf(sunkenMenu); - MenuLoader.LastSelectedModMenu = modMenus[sunkenSeaMenuIndex].FullName; - } - } - - public override void Update(bool isOnTitleScreen) - { - if (!GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) - GlobalSaveDataSystem.SaveKey(FirstTimeOpeningSunkenSeaOverhaulKey); - } - - public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) - { - DrawLogoWaterShader(spriteBatch); - - // Draw the main background for the menu. - DrawMenuBackground(spriteBatch); - - // Draw the fish boids passively swimming around the menu. - DrawFishes(spriteBatch); - - // Draw the bubbles rising from the bottom of the screen. - DrawBubbles(spriteBatch); - - // Draw the light rays at the top of the screen. - DrawLightRays(spriteBatch); - - // Draw the logo. - DrawLogo(spriteBatch, ref logoDrawCenter, ref logoRotation, ref logoScale, ref drawColor); - - return false; - } - - private static void DrawLogoWaterShader(SpriteBatch sb) - { - sb.End(); - - using (logoWaterFillTarget.Scope(clearColor: Color.Transparent)) - { - sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Matrix.Identity); - - var fillShader = CalamityShaders.SunkenSeaMenuLogoWater.Value; - fillShader.Parameters["uImageSize"]?.SetValue(LogoWaterFill.Size()); - fillShader.Parameters["uTexture0"]?.SetValue(WorleyInverted.Value); - fillShader.Parameters["uBubbleTexture"]?.SetValue(Perlin.Value); - //fillShader.Parameters["uFillAmount"]?.SetValue(0.75f + (MathF.Sin(Main.GlobalTimeWrappedHourly) / 2f) * 0.25f); - fillShader.Parameters["uFillAmount"]?.SetValue(0.75f); - fillShader.Parameters["uWaveStrength"]?.SetValue(2.5f); - fillShader.Parameters["uWaveOffset"]?.SetValue(0.6f); - fillShader.Parameters["uSubtract"]?.SetValue(0.4f); - fillShader.Parameters["uTime"]?.SetValue(Main.GlobalTimeWrappedHourly); - fillShader.Parameters["uFillColor"]?.SetValue(new Color(67, 187, 204, 255 / 2).ToVector4() * 0.7f); - fillShader.Parameters["uEdgeColor"]?.SetValue(new Color(16, 99, 112, 255 / 2).ToVector4() * 0.7f); - fillShader.Parameters["uLineColor"]?.SetValue(new Color(179, 255, 255, 255 / 2).ToVector4() * 0.7f); - fillShader.CurrentTechnique.Passes[0].Apply(); - - sb.Draw(LogoWaterFill.Value, Vector2.Zero, Color.White); - - sb.End(); - } - - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - - using (logoTarget.Scope(clearColor: Color.Transparent)) - { - sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Matrix.Identity); - sb.Draw(logoWaterFillTarget, new Vector2(406, 48), Color.White); - sb.End(); - } - - sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix); - } - - private void DrawMenuBackground(SpriteBatch spriteBatch) - { - Texture2D backgroundTexture = ModContent.Request("CalamityMod/MainMenu/SunkenMenuBackground").Value; - - // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor - Vector2 drawOffset = Vector2.Zero; - float xScale = (float)Main.screenWidth / backgroundTexture.Width; - float yScale = (float)Main.screenHeight / backgroundTexture.Height; - float scale = xScale; - - // if someone's monitor isn't in wacky dimensions, no calculations need to be performed at all - if (xScale != yScale) - { - // If someone's monitor is tall, it needs to be shifted to the left so that it's still centered on screen - // Additionally the Y scale is used so that it still covers the entire screen - if (yScale > xScale) - { - scale = yScale; - drawOffset.X -= (backgroundTexture.Width * scale - Main.screenWidth) * 0.5f; - } - else - // The opposite is true if someone's monitor is widescreen - drawOffset.Y -= (backgroundTexture.Height * scale - Main.screenHeight) * 0.5f; - } - - // Distort the background slightly to make it appear as if it's properly underwater. - MiscShaderData distortionShader = GameShaders.Misc["CalamityMod:BasicTextureDistortion"]; - Asset distortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Swirls"); - - spriteBatch.End(); // BLESS THIS. - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - - const float distortionXSpeed = -0.012f; - const float distortionYSpeed = 0.015f; - const float noiseScale = 0.75f; - const float noiseStrength = 0.02f; - Vector2 timeOffset = new Vector2(distortionXSpeed, distortionYSpeed) * Main.GlobalTimeWrappedHourly * noiseScale; - Vector2 noiseScaleStrength = new Vector2(noiseScale, noiseStrength); - distortionShader.Shader.Parameters["timeOffset"].SetValue(timeOffset); - distortionShader.Shader.Parameters["noiseScaleStrength"].SetValue(noiseScaleStrength); - distortionShader.SetShaderTexture(distortionTexture); - distortionShader.Apply(); - - spriteBatch.Draw(backgroundTexture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - } - - private void DrawLightRays(SpriteBatch spriteBatch) - { - // Draw rays shining down from the top of the screen. - MiscShaderData underwaterRaysShader = GameShaders.Misc["CalamityMod:UnderwaterRays"]; - Asset underwaterRayTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Pebbles"); - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - - underwaterRaysShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); - underwaterRaysShader.Shader.Parameters["fadeOutMargin"].SetValue(0.58f); - underwaterRaysShader.Shader.Parameters["overallOpacity"].SetValue(1f); - underwaterRaysShader.Shader.Parameters["pixelationAmount"].SetValue(Main.screenWidth * 0.5f); - underwaterRaysShader.Shader.Parameters["scrollSpeedX"].SetValue(0.013f); - underwaterRaysShader.Shader.Parameters["scrollSpeedY"].SetValue(0.006f); - underwaterRaysShader.Shader.Parameters["noiseScale"].SetValue(new Vector2(1.25f, 0.25f)); - underwaterRaysShader.Shader.Parameters["rayColor"].SetValue(Color.LightSkyBlue.ToVector3()); - underwaterRaysShader.Apply(); - - spriteBatch.Draw(underwaterRayTexture.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - } - - private void DrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) - { - // Set the logo draw color to be white and the time to be noon - // This is because there is not a day/night cycle in this menu, and changing colors would look bad - drawColor = Color.White; - Main.time = 27000; - Main.dayTime = true; - - // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two - // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing - // Remix makes it flip upside down, and in GFB it will spin forever - if (WorldGen.remixWorldGen) - { - remixLogoRotation += MathHelper.Pi / 50f; - if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) - remixLogoRotation = MathHelper.Pi; - } - else - remixLogoRotation = 0f; - float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; - - // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow - Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - spriteBatch.Draw(logoTarget, drawPos, null, drawColor, rotationSecretSeedAdjusted, logoTarget.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); - spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); - spriteBatch.Draw(LogoWater.Value, drawPos, null, new Color(255, 255, 255, 0.5f) * 0.7f, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); - } - - private void DrawBubbles(SpriteBatch spriteBatch) - { - // Randomly add bubbles. - for (int i = 0; i < 3; i++) - { - if (Main.rand.NextBool(4)) - { - int lifetime = Main.rand.NextBool(5) ? Main.rand.Next(400, 500) : Main.rand.Next(200, 250); - float depth = Main.rand.NextFloat(1f, 5f); - float scale = Main.rand.NextFloat(0.2f, 0.8f); - Vector2 startingPosition = new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f) * depth; - Vector2 startingVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.4f, 0.4f)) * 6f; - Color bubbleColor = Color.Lerp(SelectBubbleColor(), Color.White, 0.6f); - - Bubbles.Add(new Bubble(lifetime, Bubbles.Count, depth, scale, bubbleColor, startingPosition, startingVelocity)); - } - } - - // Update all bubbles. - for (int i = 0; i < Bubbles.Count; i++) - { - Bubbles[i].Update(); - - Bubbles[i].DrawColor.A = 180; - if (Bubbles[i].IdentityIndex % 13 == 12) - Bubbles[i].Scale *= 0.5f; - } - - // Clear away all dead bubbles. - Bubbles.RemoveAll(c => c.Time >= c.Lifetime); - - // Draw bubbles. - var bubblesByDepth = Bubbles.OrderByDescending(b => b.Depth).ToList(); - foreach (Bubble bubble in bubblesByDepth) - bubble.Draw(spriteBatch); - } - - /// - /// Selects a random color for the bubbles which rise from the bottom of the screen. - /// - private static Color SelectBubbleColor() - => Color.Lerp(Color.Lerp(Color.MediumSlateBlue, Color.DarkBlue, 0.3f), Color.Lerp(Color.MediumTurquoise, Color.PaleTurquoise, Main.rand.NextFloat()), Main.rand.NextFloat()); - - private void DrawFishes(SpriteBatch spriteBatch) - { - // Generate random fishes. - if (Main.rand.NextBool(14) && Fishes.Count < MaxBoids) - { - int schoolCount = Main.rand.Next(2, 9); - for (int i = 0; i < schoolCount; i++) - { - int depth = Main.rand.Next(1, 4); - int lifetime = Main.rand.Next(1200, 1800); - float scale = Main.rand.NextFloat(0.8f, 1.2f); - Vector2 spawnPosition = new(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f) * depth, Main.screenHeight * Main.rand.NextFloat(-0.1f, 1.1f) * depth); - SunkenFishBoid fish = new(spawnPosition, scale, depth); - Fishes.Add(fish); - } - } - - // Remove fish when they are offscreen. - Rectangle outOfBoundsRectangle = new(-50, -50, Main.screenWidth + 100, Main.screenHeight + 100); - Fishes.RemoveAll(f => - { - Vector2 depthFactor = new(1f / f.Depth, 1.1f / f.Depth); - Vector2 parallaxedPosition = f.Position * depthFactor; - return !outOfBoundsRectangle.Contains((int)parallaxedPosition.X, (int)parallaxedPosition.Y); - }); - - // Update all fish. - for (int i = 0; i < Fishes.Count; i++) - { - // Alpha Sea Minnows and Prismatic Guppies can spawn in schools. - bool canSpawnSchool = Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow || Fishes[i].IsAPrismaticGuppy; - if (canSpawnSchool && !Fishes[i].HasSpawnedSchool) - { - int fishCount = Main.rand.Next(3, 8); - for (int fishes = 0; fishes < fishCount; fishes++) - { - Vector2 spawnPosition = Fishes[i].Position + Main.rand.NextVector2Circular(50f, 50f) * Fishes[i].Depth; - float scale = Main.rand.NextFloat(0.8f, 1.2f); - FishType typeToSpawn = Fishes[i].IsAPrismaticGuppy ? (FishType)Main.rand.Next(3, 6) : FishType.SeaMinnow; - - SunkenFishBoid schoolingFish = new(spawnPosition, scale, Fishes[i].Depth, typeToSpawn) - { - HasSpawnedSchool = true - }; - - if (Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow) - { - Fishes[i].SeaMinnowSchoolMembers.Add(schoolingFish); - schoolingFish.SeaMinnowSchoolMembers.Add(schoolingFish); - schoolingFish.SeaMinnowSchoolMembers.Add(Fishes[i]); - } - - Fishes.Add(schoolingFish); - } - - Fishes[i].HasSpawnedSchool = true; - } - - Fishes[i].Update(); - } - - // Draw all fish in an order based on their depth. - var fishesByDepth = Fishes.OrderByDescending(f => f.Depth).ToList(); - foreach (SunkenFishBoid fish in fishesByDepth) - fish.Draw(spriteBatch); - } - } -} diff --git a/MainMenu/LogoSunken.png b/MainMenu/LogoSunken.png deleted file mode 100644 index 29f8b05cc2..0000000000 Binary files a/MainMenu/LogoSunken.png and /dev/null differ diff --git a/MainMenu/LogoSunken_Water.png b/MainMenu/LogoSunken_Water.png deleted file mode 100644 index 12c60ac53f..0000000000 Binary files a/MainMenu/LogoSunken_Water.png and /dev/null differ diff --git a/MainMenu/LogoSunken_Water_Fill.png b/MainMenu/LogoSunken_Water_Fill.png deleted file mode 100644 index e3a57cf193..0000000000 Binary files a/MainMenu/LogoSunken_Water_Fill.png and /dev/null differ diff --git a/MainMenu/Perlin.png b/MainMenu/Perlin.png deleted file mode 100644 index 45b02c6b29..0000000000 Binary files a/MainMenu/Perlin.png and /dev/null differ diff --git a/MainMenu/SunkenFishBoid.cs b/MainMenu/SunkenFishBoid.cs deleted file mode 100644 index 1dd3cfa715..0000000000 --- a/MainMenu/SunkenFishBoid.cs +++ /dev/null @@ -1,349 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ModLoader; -using Terraria.Utilities; - -namespace CalamityMod.MainMenu -{ - public class SunkenFishBoid - { - // -- GENERAL VARIABLES FOR DEFINING GENERAL BEHAVIOR AND FUNCTIONALITY FOR THE FISH ENTITIES -- - - public enum FishType - { - SeaMinnow, - AlphaSeaMinnow, - PolypPanasea, - PrismaticGuppy1, - PrismaticGuppy2, - PrismaticGuppy3, - } - - public string[] SeaMinnowTextureNames = - [ - "SeaMinnow", - "AlphaSeaMinnow", - ]; - - public string[] PolypPanaseaTextureNames = - [ - "PolypPanasea", - "PolypPanaseaGreen", - "PolypPanaseaPurple", - "PolypPanaseaRadiant", - "PolypPanaseaTurquoise", - "PolypPanaseaGreenCoated", - "PolypPanaseaPurpleCoated", - "PolypPanaseaRadiantCoated", - "PolypPanaseaRedCoated", - "PolypPanaseaTurquoiseCoated", - ]; - - public string[] PrismaticGuppyTextureNames_1 = - [ - "PrismaticGuppy", - "PrismaticGuppyGreen", - "PrismaticGuppyPink", - "PrismaticGuppyRadiant", - ]; - - public string[] PrismaticGuppyTextureNames_2 = - [ - "PrismaticGuppy2", - "PrismaticGuppyGreen2", - "PrismaticGuppyPink2", - "PrismaticGuppyRadiant2", - ]; - - public string[] PrismaticGuppyTextureNames_3 = - [ - "PrismaticGuppy3", - "PrismaticGuppyGreen3", - "PrismaticGuppyPink3", - "PrismaticGuppyRadiant3", - ]; - - public int Time; - - public int Depth; - - public int CurrentFrame; - - public int MaxFrames; - - public int FrameSpeed; - - public Vector2 Position; - - public Vector2 Velocity; - - public Vector2 StretchFactor; - - public float Scale; - - public float StoredScale; - - public float Rotation; - - public float Opacity; - - public float PassiveMovementTimer; - - public Vector2 PassiveMovementVector; - - public float PassiveMovementSpeed; - - public float MaxSpeed_Default = 3f; - - public float MaxSpeed_SwimAwayFromCursor = 4.25f; - - public FishType SelectedFishType; - - public FishType? FishTypeOverride; - - public WeightedRandom RandomFishType = new(); - - public int FishTextureIndex = -1; - - public bool Initialized = false; - - public bool HasSpawnedSchool = false; - - public List SeaMinnowSchoolMembers = []; - - public Asset FishTexture; - - // -- BOID ALOGORITHM SPECIFIC VARIABLES -- - - // 19MAY2025: fryzahh: - // Coefficients to control how strongly each of the Boid Algos affect the movement of each boid. - // Higher values will lead to sharper flocking AI, but movement might be a little choppier. - // Please beware of this if you ever change these values. - public float CohesionCoefficient = 0.075f; - - public float AlignmentCoefficient = 0.12f; - - public float SeparationCoefficient = 0.03f; - - public float MaxRadiusFromOtherFish = 125f; - - public float MaxDetectionRadius = 200f; - - /// - /// Whether or not this fish boid is any of the Prismatic Guppy variants. Used for allowing Prismatic Guppies to school with each other. - /// - public bool IsAPrismaticGuppy => SelectedFishType == FishType.PrismaticGuppy1 || SelectedFishType == FishType.PrismaticGuppy2 || SelectedFishType == FishType.PrismaticGuppy3; - - /// - /// Whether or not this fish boid is any one of the Sea Minnow variants. Used for allowing Sea Minnows to school with Alphas properly. - /// - public bool IsASeaMinnow => SelectedFishType == FishType.SeaMinnow || SelectedFishType == FishType.AlphaSeaMinnow; - - public SunkenFishBoid(Vector2 position, float scale, int depth, FishType? fishTypeOverride = null) - { - Position = position; - StoredScale = scale; - Depth = depth; - FishTypeOverride = fishTypeOverride; - - FrameSpeed = Main.rand.Next(6, 11); - StretchFactor = Vector2.One; - RandomFishType.Add(FishType.AlphaSeaMinnow, 0.7f); - RandomFishType.Add(FishType.PolypPanasea, 0.6f); - RandomFishType.Add(FishType.PrismaticGuppy1, 0.1f); - RandomFishType.Add(FishType.PrismaticGuppy2, 0.1f); - RandomFishType.Add(FishType.PrismaticGuppy3, 0.1f); - } - - public void Update() - { - if (!Initialized) - { - // Select the appropriate fish type. - SelectedFishType = FishTypeOverride ?? RandomFishType; - - // Select the correct texture index for the different types of fish textures. - if (SelectedFishType == FishType.SeaMinnow) - FishTextureIndex = 0; - if (SelectedFishType == FishType.AlphaSeaMinnow) - FishTextureIndex = 1; - if (SelectedFishType == FishType.PolypPanasea) - FishTextureIndex = Main.rand.Next(PolypPanaseaTextureNames.Length); - if (IsAPrismaticGuppy) - FishTextureIndex = Main.rand.Next(PrismaticGuppyTextureNames_1.Length); - - // Select the correct amount of animation frames each texture has based on the fish type. - if (IsASeaMinnow) - MaxFrames = 8; - if (SelectedFishType == FishType.PolypPanasea) - MaxFrames = 6; - if (SelectedFishType == FishType.PrismaticGuppy1) - MaxFrames = 6; - if (SelectedFishType == FishType.PrismaticGuppy2) - MaxFrames = 4; - if (SelectedFishType == FishType.PrismaticGuppy3) - MaxFrames = 5; - - CurrentFrame = Main.rand.Next(MaxFrames); - FishTexture = GetCorrectFishTexture(); - Initialized = true; - } - - if (!Initialized) - return; - - if (Scale < StoredScale) - { - Scale = MathHelper.Clamp(Scale + 0.05f, 0f, StoredScale); - Opacity = MathHelper.Clamp(Opacity + 0.05f, 0f, 1f); - } - - // Perform all Boids Behavior. - DoBoidsBehavior(); - - // Move and swim around idly. - PassiveMovementTimer--; - if (PassiveMovementTimer <= 0f) - { - PassiveMovementSpeed = Main.rand.NextFloat(0.25f, MaxSpeed_Default); - PassiveMovementVector.X = Main.rand.NextFloat(-100f, 101f); - PassiveMovementVector.Y = Main.rand.NextFloat(-100f, 101f); - PassiveMovementTimer = Main.rand.Next(120, 180); - } - - var moveSpeed = PassiveMovementSpeed / PassiveMovementVector.Length(); - Velocity = Vector2.Lerp(Velocity, PassiveMovementVector * moveSpeed, 0.01f); - - // Make fishes closest to the screen swim away from the mouse cursor if it's nearby. - var distanceFromCursor = Vector2.Distance(Position, Main.MouseScreen); - var shouldSwimAway = distanceFromCursor < 100f && Depth <= 1; - if (shouldSwimAway) - { - var distanceInterpolant = Utils.GetLerpValue(175f, 0f, distanceFromCursor, true); - Velocity += Position.DirectionTo(Main.MouseScreen).SafeNormalize(Vector2.UnitY) * distanceInterpolant * -0.46f; - - // Stretch a little while swimming away from danger for additional silliness :D - float stretch = MathHelper.Clamp(Velocity.Length() / MaxSpeed_SwimAwayFromCursor * 0.1f, 1f, 1.65f); - Vector2 stretchedVector = new(Scale * stretch, Scale - Scale * stretch * 0.3f); - StretchFactor = Vector2.Lerp(StretchFactor, stretchedVector, 0.15f); - } - else - { - if (Velocity.Length() > MaxSpeed_Default) - Velocity *= 0.7f; - StretchFactor = Vector2.Lerp(StretchFactor, Vector2.One, 0.15f); - } - - Velocity = Velocity.ClampMagnitude(0.25f, MaxSpeed_SwimAwayFromCursor); - Position += Velocity; - - Rotation = Velocity.ToRotation(); - if (Time % FrameSpeed == 0) - CurrentFrame = (CurrentFrame + 1) % MaxFrames; - - Time++; - } - - public void DoBoidsBehavior() - { - // Polyp Panaseas do not travel in schools. - if (SelectedFishType == FishType.PolypPanasea) - return; - - var cohesion = Vector2.Zero; - var alignment = Vector2.Zero; - var separation = Vector2.Zero; - var totalSchoolMembers = 0; - - var detetctionRadiusSquared = MathF.Pow(MaxDetectionRadius, 2f); - var separationDistanceSquared = MathF.Pow(MaxRadiusFromOtherFish, 2f); - var allOtherFishes = CalamityMainMenu_Sunken.Fishes; - - // Alpha Sea Minnows spawn a school of Sea Minnows manually and stick with it. - if (IsASeaMinnow && SeaMinnowSchoolMembers.Count > 0) - { - foreach (var minnow in SeaMinnowSchoolMembers) - { - var distance = Vector2.DistanceSquared(Position, minnow.Position); - var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); - separation += (Position - minnow.Position) * separationFactor * 0.7f; - - cohesion += minnow.Position; - alignment += minnow.Velocity; - totalSchoolMembers++; - } - } - else - { - foreach (var other in allOtherFishes) - { - // Only school with other fishes that are nearby, of the same type and within the same depth. - var isPrismaticGuppy = IsAPrismaticGuppy && other.IsAPrismaticGuppy; - var schoolByFishType = isPrismaticGuppy || SelectedFishType == other.SelectedFishType; - - var distance = Vector2.DistanceSquared(Position, other.Position); - if (distance < detetctionRadiusSquared && other != this && schoolByFishType && other.Depth == Depth) - { - var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); - separation += (Position - other.Position) * separationFactor * 0.7f; - - cohesion += other.Position; - alignment += other.Velocity; - totalSchoolMembers++; - } - } - } - - if (totalSchoolMembers == 0) - return; - - // Add all boids algorithm factors into the velocity. - cohesion /= totalSchoolMembers; - var schoolCenterInterpolant = Utils.GetLerpValue(0f, 80f, Position.Distance(cohesion), true); - Velocity += (cohesion - Position).SafeNormalize(-Vector2.UnitY) * schoolCenterInterpolant * CohesionCoefficient; - - alignment /= totalSchoolMembers; - Velocity += Velocity.ToRotation().AngleLerp(alignment.ToRotation(), 0.06f).ToRotationVector2() * Velocity.Length() * AlignmentCoefficient; - - separation /= totalSchoolMembers; - Velocity += separation.SafeNormalize(-Vector2.UnitY) * SeparationCoefficient; - } - - public void Draw(SpriteBatch spriteBatch) - { - if (!Initialized) - return; - - Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); - Vector2 parallaxedPosition = Position * depthFactor; - - var frame = FishTexture.Frame(1, MaxFrames, 0, CurrentFrame); - var origin = frame.Size() * 0.5f; - - var scaleByDepth = Scale / Depth; - var drawRotaton = Rotation + MathHelper.Pi; - var colorByDepth = Color.Lerp(Color.White, Color.Black, Utils.Remap(Depth, 1, 4, 0f, 0.8f, true)); - - var effects = Velocity.X > 0f ? SpriteEffects.FlipVertically : SpriteEffects.None; - spriteBatch.Draw(FishTexture.Value, parallaxedPosition, frame, colorByDepth * Opacity, drawRotaton, origin, StretchFactor * scaleByDepth, effects, 0f); - } - - private Asset GetCorrectFishTexture() - { - var sunkenSeaPath = "CalamityMod/NPCs/SunkenSea/"; - var returnTexture = SelectedFishType switch - { - FishType.PolypPanasea => ModContent.Request(sunkenSeaPath + PolypPanaseaTextureNames[FishTextureIndex]), - FishType.PrismaticGuppy1 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_1[FishTextureIndex]), - FishType.PrismaticGuppy2 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_2[FishTextureIndex]), - FishType.PrismaticGuppy3 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_3[FishTextureIndex]), - _ => ModContent.Request(sunkenSeaPath + SeaMinnowTextureNames[FishTextureIndex]), - }; - return returnTexture; - } - } -} diff --git a/MainMenu/SunkenMenuBackground.png b/MainMenu/SunkenMenuBackground.png deleted file mode 100644 index 6df4caab99..0000000000 Binary files a/MainMenu/SunkenMenuBackground.png and /dev/null differ diff --git a/MainMenu/WorleyInverted.png b/MainMenu/WorleyInverted.png deleted file mode 100644 index 48b63f46aa..0000000000 Binary files a/MainMenu/WorleyInverted.png and /dev/null differ diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index d38e623dd8..237ee67bae 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.TownNPCs; @@ -49,6 +50,12 @@ namespace CalamityMod case "desert scourge": return DownedBossSystem.downedDesertScourge; + case "horriblehog": + case "horrible hog": + case "thehorriblehog": + case "the horrible hog": + return DownedBossSystem.downedHorribleHog; + case "clam": case "giantclam": case "giant clam": @@ -870,90 +877,6 @@ namespace CalamityMod public static bool DisableAllDodges(bool disable) => Main.LocalPlayer.Calamity().disableAllDodges = disable; #endregion - #region Amalgam Potion Buff List - public static bool SetAmalgamBuffList(int type, bool shouldBeListed) - { - if (shouldBeListed && !CalamityBuffSets.BuffedByAmalgam[type]) - { - CalamityBuffSets.BuffedByAmalgam[type] = true; - return true; - } - else if (!shouldBeListed) - { - CalamityBuffSets.BuffedByAmalgam[type] = false; - return false; - } - - return false; - } - public static bool SetPersistentBuffList(int type, bool isPersistent) - { - if (isPersistent && !CalamityBuffSets.IsPersistentBuff[type]) - { - CalamityBuffSets.IsPersistentBuff[type] = true; - return true; - } - else if (!isPersistent) - { - CalamityBuffSets.IsPersistentBuff[type] = false; - return false; - } - - return false; - } - - public static bool IsOnAmalgamBuffList(int type) => CalamityBuffSets.BuffedByAmalgam[type]; - public static bool IsOnPersistentBuffList(int type) => CalamityBuffSets.IsPersistentBuff[type]; - #endregion - - #region Venerated Locket Bans - public static bool AddToVeneratedLocketBanlist(int type) - { - if (!CalamityItemSets.DisablesVeneratedLocketEffect[type]) - { - CalamityItemSets.DisablesVeneratedLocketEffect[type] = true; - return true; - } - return false; - } - #endregion - - #region Summoner Cross Class Nerf Disabling - public static bool SetSummonerNerfDisabledByMinion(int type, bool disableNerf) - { - if (disableNerf && !CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type]) - { - CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type] = true; - return true; - } - else if (!disableNerf) - { - CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type] = false; - return false; - } - - return false; - } - public static bool SetSummonerNerfDisabledByItem(int type, bool disableNerf) - { - if (disableNerf && !CalamityItemSets.ItemWhichDisablesSummonerNerf[type]) - { - CalamityItemSets.ItemWhichDisablesSummonerNerf[type] = true; - return true; - } - else if (!disableNerf) - { - CalamityItemSets.ItemWhichDisablesSummonerNerf[type] = false; - return false; - } - - return false; - } - - public static bool GetSummonerNerfDisabledByMinion(int type) => CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type]; - public static bool GetSummonerNerfDisabledByItem(int type) => CalamityItemSets.ItemWhichDisablesSummonerNerf[type]; - #endregion - #region Debuff Display support public static void RegisterDebuff(string texturePath, Predicate debuffCheck) { @@ -1031,19 +954,6 @@ namespace CalamityMod } #endregion - #region Adding minions to boss hp scaling config - //This is to add minions to the hp scaling config - public static bool AddToHPScaling(int type) - { - if (!CalamityNPCSets.ScalesHealthLikeBoss[type]) - { - CalamityNPCSets.ScalesHealthLikeBoss[type] = true; - return true; - } - return false; - } - #endregion - #region Call public static object Call(params object[] args) @@ -2068,55 +1978,6 @@ namespace CalamityMod CalamityMod.Log.Warn("This mod call is deprecated. Calamity automatically registers cooldowns."); return null; - case "GetSummonerNerfDisabledByItem": - if (args.Length != 2 || !isValidItemArg(args[1])) - return new ArgumentException("ERROR: Must specify a valid item to check status of."); - return GetSummonerNerfDisabledByItem(castItem(args[1]).type); - - case "GetSummonerNerfDisabledByMinion": - if (args.Length != 2 || !isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: Must specify a valid projectile to check status of."); - return GetSummonerNerfDisabledByMinion(castProjectile(args[1]).type); - - case "SetSummonerNerfDisabledByItem": - if (args.Length < 2 || !isValidItemArg(args[1])) - return new ArgumentException("ERROR: Must specify a valid item to set the status of."); - if (args.Length != 3 || args[2] is not bool disableNerf) - return new ArgumentException("ERROR: Must specify a bool that determines whether the summoner nerf is disabled."); - return SetSummonerNerfDisabledByItem(castItem(args[1]).type, disableNerf); - - case "SetSummonerNerfDisabledByMinion": - if (args.Length < 2 || !isValidItemArg(args[1])) - return new ArgumentException("ERROR: Must specify a valid projectile to set the status of."); - if (args.Length != 3 || args[2] is not bool disableNerf2) - return new ArgumentException("ERROR: Must specify a bool that determines whether the summoner nerf is disabled."); - return SetSummonerNerfDisabledByItem(castItem(args[1]).type, disableNerf2); - - case "IsOnAmalgamBuffList": - if (args.Length != 2 || !castID(args[1], out int buffType)) - return new ArgumentException("ERROR: Must specify a valid buff ID to check status of."); - return IsOnAmalgamBuffList(buffType); - - case "IsOnPersistentBuffList": - case "IsPersistentBuff": - if (args.Length != 2 || !castID(args[1], out int buffType2)) - return new ArgumentException("ERROR: Must specify a valid buff ID to check status of."); - return IsOnPersistentBuffList(buffType2); - - case "SetAmalgamBuffList": - if (args.Length < 2 || !castID(args[1], out int buffType3)) - return new ArgumentException("ERROR: Must specify a valid buff ID to set the status of."); - if (args.Length != 3 || args[2] is not bool shouldBeListed) - return new ArgumentException("ERROR: Must specify a bool that determines whether the amalgam should enable extend the duration of this buff."); - return SetAmalgamBuffList(buffType3, shouldBeListed); - - case "SetPersistentBuffList": - if (args.Length < 2 || !castID(args[1], out int buffType4)) - return new ArgumentException("ERROR: Must specify a valid buff ID to set the status of."); - if (args.Length != 3 || args[2] is not bool isPersistent) - return new ArgumentException("ERROR: Must specify a bool that determines whether the buff is persistent after death for the Amalgam to properly reset."); - return SetPersistentBuffList(buffType4, isPersistent); - case "CreateCodebreakerDialogOption": // NOTE: This is a legacy variant of this call. The variant with three arguments is the standard. if (args.Length == 4) @@ -2136,13 +1997,6 @@ namespace CalamityMod return null; - case "AddToVeneratedLocketBanlist": - if (args.Length < 2) - return new ArgumentException("ERROR: Not enough arguments!"); - if (args[1] is not int itemType) - return new ArgumentException("ERROR: Must specify a valid item type as an int index of the item."); - return AddToVeneratedLocketBanlist(itemType); - case "RegisterDebuff": case "AddToDebuffDisplay": case "AddDebuffDisplay": @@ -2240,18 +2094,21 @@ namespace CalamityMod AndroombaFriendly.customConversionTypes.Add((itemID, texturePath, NPCaction)); return null; } - case "AddMinibossToHPScalingConfig": - case "AddMinionToHPScalingConfig": - case "AddToBossHPScalingConfig": + case "GetDebuffDamage": { if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify an NPC id/type as an int or short ID. Example: NPCType()"); - if (!castID(args[1], out int npcType6)) - return new ArgumentException("ERROR: The first argument to \"AddToBossHPScalingConfig\" must be an int or short ID."); - return AddToHPScaling(npcType6); + return new ArgumentNullException("ERROR: Must specify an NPC and a buff type int"); + if (args[1] is not NPC npc || args[2] is not int type) + return new ArgumentException("ERROR: The first argument to \"GetDebuffDamage\" must be an NPC, and the second must be an int."); + return DebuffData.GetDebuffRegenValue(npc, type); } + case "GetDebuffDamageFunction": //This exists because Calamity's Mod Call lookup is slow due to this string switch, and this method may be called hundreds of times per frame by some addons. + return (object)DebuffData.GetDebuffRegenValue; default: - return new ArgumentException("ERROR: Invalid method name."); + { + CalamityMod.Log.Warn($"{methodName} is an invalid method name for Calamity Mod. Are you calling a method which no longer exists?"); + return null; + } } } #endregion diff --git a/ModSupport/TestingEfficiency.cs b/ModSupport/TestingEfficiency.cs new file mode 100644 index 0000000000..b769d14c30 --- /dev/null +++ b/ModSupport/TestingEfficiency.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.ModSupport +{ + //This uses its own class so the entire class can simply not load when TE is not enabled. + public class TestingEfficiencySupport : ModSystem + { + + internal static Mod testingEfficiency = null; + public override bool IsLoadingEnabled(Mod mod) + { + testingEfficiency = null; + return ModLoader.TryGetMod("TestingEfficiency", out testingEfficiency); + } + + List<(string name, float tier, Func getter, Action setter, Func> texture)> BossTogles = new() + { + ("Desert Scourge", 1.5f, + () => DownedBossSystem.downedDesertScourge, + x => DownedBossSystem.downedDesertScourge = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Crabulon", 2.5f, + () => DownedBossSystem.downedCrabulon, + x => DownedBossSystem.downedCrabulon = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Hive Mind / Perforators", 3.5f, + () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator, + x => DownedBossSystem.downedHiveMind = DownedBossSystem.downedPerforator = x, + () => WorldGen.crimson + ? TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]] + : TextureAssets.NpcHeadBoss[HiveMind.phase2IconIndex]), + + ("Slime God", 6.5f, + () => DownedBossSystem.downedSlimeGod, + x => DownedBossSystem.downedSlimeGod = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Cryogen", 8.5f, + () => DownedBossSystem.downedCryogen, + x => DownedBossSystem.downedCryogen = x, + () => TextureAssets.NpcHeadBoss[Cryogen.cryoIconIndex]), + + ("Aquatic Scourge", 9.25f, + () => DownedBossSystem.downedAquaticScourge, + x => DownedBossSystem.downedAquaticScourge = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Brimstone Elemental", 10.25f, + () => DownedBossSystem.downedBrimstoneElemental, + x => DownedBossSystem.downedBrimstoneElemental = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Calamitas Clone", 11.5f, + () => DownedBossSystem.downedCalamitasClone, + x => DownedBossSystem.downedCalamitasClone = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Leviathan & Anahita", 12.25f, + () => DownedBossSystem.downedLeviathan, + x => DownedBossSystem.downedLeviathan = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Astrum Aureus", 12.5f, + () => DownedBossSystem.downedAstrumAureus, + x => DownedBossSystem.downedAstrumAureus = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Plaguebringer Goliath", 14.25f, + () => DownedBossSystem.downedPlaguebringer, + x => DownedBossSystem.downedPlaguebringer = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Ravager", 15.25f, + () => DownedBossSystem.downedRavager, + x => DownedBossSystem.downedRavager = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Astrum Deus", 16.5f, + () => DownedBossSystem.downedAstrumDeus, + x => DownedBossSystem.downedAstrumDeus = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Dragonfolly", 17.25f, + () => DownedBossSystem.downedDragonfolly, + x => DownedBossSystem.downedDragonfolly = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Profaned Guardians", 17.5f, + () => DownedBossSystem.downedGuardians, + x => DownedBossSystem.downedGuardians = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Providence", 18f, + () => DownedBossSystem.downedProvidence, + x => DownedBossSystem.downedProvidence = x, + () => TextureAssets.Item[ModContent.ItemType()]), + + ("Ceaseless Void", 18.25f, + () => DownedBossSystem.downedCeaselessVoid, + x => DownedBossSystem.downedCeaselessVoid = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Storm Weaver", 18.5f, + () => DownedBossSystem.downedStormWeaver, + x => DownedBossSystem.downedStormWeaver = x, + () => TextureAssets.NpcHeadBoss[StormWeaverHead.normalIconIndex]), + + ("Signus", 18.75f, + () => DownedBossSystem.downedSignus, + x => DownedBossSystem.downedSignus = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Polterghast", 19f, + () => DownedBossSystem.downedPolterghast, + x => DownedBossSystem.downedPolterghast = x, + () => TextureAssets.NpcHeadBoss[Polterghast.phase1IconIndex]), + + ("Old Duke", 19.5f, + () => DownedBossSystem.downedBoomerDuke, + x => DownedBossSystem.downedBoomerDuke = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Devourer of Gods", 20f, + () => DownedBossSystem.downedDoG, + x => DownedBossSystem.downedDoG = x, + () => TextureAssets.NpcHeadBoss[DevourerofGodsHead.phase1IconIndex]), + + ("Yharon", 21f, + () => DownedBossSystem.downedYharon, + x => DownedBossSystem.downedYharon = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Exo Mechs", 22f, + () => DownedBossSystem.downedExoMechs, + x => DownedBossSystem.downedExoMechs = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]), + + ("Supreme Calamitas", 23f, + () => DownedBossSystem.downedCalamitas, + x => DownedBossSystem.downedCalamitas = x, + () => TextureAssets.NpcHeadBoss[SupremeCalamitas.hoodedHeadIconIndex]), + + ("Primordial Wyrm", 23.5f, + () => DownedBossSystem.downedPrimordialWyrm, + x => DownedBossSystem.downedPrimordialWyrm = x, + () => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]]) + }; + + public override void PostSetupContent() + { + foreach (var item in BossTogles) + { + testingEfficiency.Call("RegisterBoss", item.name, item.tier, item.getter, item.setter, item.texture); + } + } + } + + [ReinitializeDuringResizeArrays] + public class TestingEfficiencyIdSets + { + //These being set by Calamity is important so that boss reworks can update these on Cal's end in development + //Otherwise, reworks to bosses would often require their own build, similar to issues CalTestHelpers had before. + //Because these are ID sets, other mods that may be interested in similar info can also use them regardless of if TE is loaded + + internal static int[] NpcToCountAs = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/NpcToCountAs") + .RegisterIntSet(-1, + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType() , + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() + ); + + + public static bool[] ShouldMergeInstances = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldMergeInstances") + .RegisterBoolSet( + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + ); + + public static bool[] ShouldBlacklist = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldBlacklist") + .RegisterBoolSet(ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + ); + + public static bool[] ShouldTrackAsABoss = NPCID.Sets.Factory.CreateNamedSet("TestingEfficiency/ShouldTrackAsABoss") + .Description("NPC types that should be whitelisted to count as a boss") + .RegisterBoolSet( + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + ); + } +} diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 8a5b7692f8..deff3f2114 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -70,6 +70,7 @@ namespace CalamityMod internal class Downed { public static readonly Func DownedDesertScourge = () => DownedBossSystem.downedDesertScourge; + public static readonly Func DownedHorribleHog = () => DownedBossSystem.downedHorribleHog; public static readonly Func DownedGiantClam = () => DownedBossSystem.downedCLAM; public static readonly Func DownedCrabulon = () => DownedBossSystem.downedCrabulon; public static readonly Func DownedHiveMind = () => DownedBossSystem.downedHiveMind; @@ -1172,8 +1173,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index 5fc75e32ee..58a3eca580 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.AcidRain public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !DownedBossSystem.downedAquaticScourge) + if (spawnInfo.PlayerSafe || !spawnInfo.Player.Calamity().ZoneSulphur) { return 0f; } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 13eaba493e..c674e58cd9 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -7,6 +7,7 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; @@ -208,7 +209,8 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().newAI[0]++; if (NPC.Calamity().newAI[0] % 5 == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + RancorFog fog = new(NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); RancorLavaMetaball.SpawnParticle(NPC.Bottom + Main.rand.NextVector2Circular(10f, 10f), 135f); } if (NPC.Calamity().newAI[0] % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 6204ae467e..06cb703727 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -105,8 +105,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.timeLeft *= 20; NPC.npcSlots = 16f; NPC.damage = NPC.defDamage; - CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type]; calamityGlobalNPC.newAI[0] = 1f; nonHostile = false; NPC.chaseable = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index cec29d817c..cfdf30ce32 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -101,8 +101,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.timeLeft *= 20; NPC.npcSlots = 16f; NPC.damage = NPC.defDamage; - CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type]; calamityGlobalNPC.newAI[0] = 1f; nonHostile = false; NPC.chaseable = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 9b0e5564aa..5749fdaf52 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -146,8 +146,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.timeLeft *= 20; NPC.npcSlots = 16f; NPC.damage = NPC.defDamage; - CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type]; calamityGlobalNPC.newAI[0] = 1f; nonHostile = false; NPC.boss = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 66538d7824..fcb8ec54a1 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -100,8 +100,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.timeLeft *= 20; NPC.npcSlots = 16f; NPC.damage = NPC.defDamage; - CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.KillTime = CalamityNPCSets.BossKillTimes[NPC.type]; calamityGlobalNPC.newAI[0] = 1f; nonHostile = false; NPC.chaseable = true; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index e9e311449f..74038b2772 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -126,7 +126,6 @@ namespace CalamityMod.NPCs.AstrumAureus { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstrumAureus") }); } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index cb1e741b72..460085a200 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -122,7 +122,6 @@ namespace CalamityMod.NPCs.AstrumDeus { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AstrumDeus") }); } 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/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 7f96e910bc..fafbb4534a 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -153,8 +153,8 @@ namespace CalamityMod.NPCs.CalClone { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Calamitas") }); } diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index 031a656f20..433529f909 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -83,8 +83,8 @@ namespace CalamityMod.NPCs.CalClone bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cataclysm") }); } diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index a4695e2630..7488d17dd0 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -78,8 +78,8 @@ namespace CalamityMod.NPCs.CalClone bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Catastrophe") }); } diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index c224c25225..edc1bb8f68 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -61,8 +61,8 @@ namespace CalamityMod.NPCs.CalClone bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), // Gives black background new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SoulSeeker") }); } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 96cb4275d7..732b8af651 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -93,9 +93,6 @@ namespace CalamityMod.NPCs { #region Variables - /// Data structure used for storing Calamity's intended boss kill times. - public static SortedDictionary BossKillTimes; - /// Data structure used for storing the damage reduction values of NPCs. public static SortedDictionary DRValues { get; set; } @@ -270,16 +267,6 @@ namespace CalamityMod.NPCs public float manaBurn = 0f; public float manaBurnPeak = 0f; public float playerManaBurnIntensity = 0f; - /// - /// Counter variable that increments while the NPC is inflicted with Pearl Aura.
- /// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC. - ///
- public int pearlAuraCounter = 0; - /// - /// When an NPC is inflicted with Pearl Aura, this variable is set to index of the player who inflicted it.
- /// Used for properly counting pearl shard amount and for giving pearl shards an owner. - ///
- public int pearlAuraOwner = -1; public bool burningBlood = false; public bool brainRot = false; public bool heavyBleeding = false; @@ -301,6 +288,7 @@ namespace CalamityMod.NPCs public bool crumble = false; public int antlionCloudDebuffTimer = 0; + public int caneInsanityTimer = 0; public bool scionsCurioEffected = false; public bool abaddonEffected = false; public bool apollyonEffected = false; @@ -401,8 +389,6 @@ namespace CalamityMod.NPCs public int ashesOnDeath = 0; #endregion - public bool fortunesFavor = false; // Buff which grants positive life regen. Given when near Gilded Axolotls. - // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; public static int hiveMind = -1; @@ -563,7 +549,6 @@ namespace CalamityMod.NPCs myClone.webbed = webbed; myClone.electrified = electrified; myClone.pearlAura = pearlAura; - myClone.pearlAuraCounter = pearlAuraCounter; myClone.burningBlood = burningBlood; myClone.brainRot = brainRot; myClone.heavyBleeding = heavyBleeding; @@ -585,6 +570,7 @@ namespace CalamityMod.NPCs myClone.crumble = crumble; myClone.antlionCloudDebuffTimer = antlionCloudDebuffTimer; + myClone.caneInsanityTimer = caneInsanityTimer; myClone.scionsCurioEffected = scionsCurioEffected; myClone.abaddonEffected = abaddonEffected; myClone.apollyonEffected = apollyonEffected; @@ -647,8 +633,6 @@ namespace CalamityMod.NPCs myClone.windChilled = windChilled; myClone.ashesOnDeath = ashesOnDeath; - myClone.fortunesFavor = fortunesFavor; - // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; myClone.ManaBurnFireDrawer = null; @@ -815,10 +799,10 @@ namespace CalamityMod.NPCs if (ashesOnDeath > 0) ashesOnDeath--; - fortunesFavor = false; - if (antlionCloudDebuffTimer > 0) antlionCloudDebuffTimer--; + if (caneInsanityTimer > 0) + caneInsanityTimer--; if (cursorFocus > 0 && cursorFocus < cursorFocusMax) cursorFocus--; relicOfResilienceWeakness = false; @@ -946,11 +930,6 @@ namespace CalamityMod.NPCs } #endregion - if (fortunesFavor) - { - npc.lifeRegen += 4; // 2 HP/s at base - } - //Apply DoT Debuffs for (var index = 0; index < npc.buffType.Length; index++) { @@ -1077,120 +1056,18 @@ namespace CalamityMod.NPCs { NPCID.WallofFlesh, 0.15f }, }; #endregion - - // Somehow the SetStatic is called few times before SetStaticDefaults - // So We Initialize the Dictionary first. And Push Data later (At SetStaticDefaults) - BossKillTimes = []; } public override void Unload() { DRValues?.Clear(); DRValues = null; - - BossKillTimes?.Clear(); - BossKillTimes = null; } #endregion #region Set Defaults public override void SetStaticDefaults() { - #region Add Entries to BossKillTimes - BossKillTimes.AddRange(new Dictionary(){ - - // - // VANILLA BOSSES - // - { NPCID.KingSlime, 5400 }, // 1:30 (90 seconds) - { NPCID.EyeofCthulhu, 5400 }, // 1:30 (90 seconds) - { NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds) - { NPCID.EaterofWorldsBody, 7200 }, - { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 7200 }, // 2:00 (120 seconds, total length of fight including Creepers phase) - { NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase) - { NPCID.Deerclops, 5400 }, // 1:30 (90 seconds) - { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) - { NPCID.SkeletronHead, 7200 }, // 2:00 (120 seconds) - { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) - { NPCID.WallofFleshEye, 7200 }, - { NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds) - { NPCID.Spazmatism, 10800 }, // 3:00 (180 seconds) - { NPCID.Retinazer, 10800 }, - { NPCID.TheDestroyer, 10800 }, // 3:00 (180 seconds) - { NPCID.TheDestroyerBody, 10800 }, - { NPCID.TheDestroyerTail, 10800 }, - { NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds) - { NPCID.Plantera, 10800 }, // 3:00 (180 seconds) - { NPCID.Golem, 9000 }, // 2:30 (150 seconds) - { NPCID.GolemHead, 3600 }, // 1:00 (60 seconds) - { NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds) - { NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds) - { NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds) - { NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds) - { NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds) - { NPCID.MoonLordHead, 7200 }, // 2:00 (120 seconds) - - // - // CALAMITY BOSSES - // - { NPCType(), 5400 }, // 1:30 (90 seconds) - { NPCType(), 5400 }, - { NPCType(), 5400 }, - { NPCType(), 5400 }, // 1:30 (90 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) - { NPCType(), 9000 }, // 2:30 (150 seconds) -- total length of Slime God fight - { NPCType(), 4500 }, // 1:15 (75 seconds) - { NPCType(), 4500 }, // 1:15 (75 seconds) - { NPCType(), 4500 }, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30 - { NPCType(), 4500 }, // 1:15 (75 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 9000 }, // 2:30 (150 seconds) - { NPCType(), 9000 }, - { NPCType(), 9000 }, - { NPCType(), 9000 }, - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 10800 }, - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) -- first phase is 1:00 - { NPCType(), 7200 }, - { NPCType(), 7200 }, - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) - { NPCType(), 14400 }, // 4:00 (240 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 1200 }, // 0:20 (20 seconds) - { NPCType(), 8100 }, // 2:15 (135 seconds) - { NPCType(), 8100 }, - { NPCType(), 8100 }, - { NPCType(), 7200 }, // 2:00 (120 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 14400 }, // 4:00 (240 seconds) - { NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 - { NPCType(), 14400 }, - { NPCType(), 14400 }, // 4:00 (240 seconds) - { NPCType(), 21600 }, // 6:00 (360 seconds) - { NPCType(), 21600 }, - { NPCType(), 21600 }, // 6:00 (360 seconds) - { NPCType(), 21600 }, - { NPCType(), 21600 }, - { NPCType(), 21600 }, - { NPCType(), 21600 }, - { NPCType(), 21600 }, // 6:00 (360 seconds) - { NPCType(), 21600 }, - { NPCType(), 21600 }, - { NPCType(), 21600 }, - { NPCType(), 18000 }, // 5:00 (300 seconds) - { NPCType(), 18000 } // 5:00 (300 seconds) - }); - #endregion - // Set Plantera to be able to update oldPos[x] // This is only used for her Rev+ AI charge attacks NPCID.Sets.TrailingMode[NPCID.Plantera] = 1; @@ -1217,8 +1094,8 @@ namespace CalamityMod.NPCs } // Aquatic Scourge sets kill time in AI, not here. - if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !CalamityNPCTypeSets.AquaticScourge.Contains(npc.type)) - KillTime = revKillTime; + if (!CalamityNPCTypeSets.AquaticScourge.Contains(npc.type)) + KillTime = CalamityNPCSets.BossKillTimes[npc.type]; // Fixing more red mistakes if (npc.type == NPCID.WallofFleshEye) @@ -3331,36 +3208,6 @@ namespace CalamityMod.NPCs laserBurnDamage = 0; } - // Pearl Aura shard spawning - // Slowing is handled in the general slowing code below - if (pearlAura) - { - pearlAuraCounter++; - if (pearlAuraCounter >= 45) - { - pearlAuraCounter = 0; - SoundEngine.PlaySound(SoundID.Item49, npc.Center); - - // Prevent things from getting too crazy - // CIT 8MAR2025: It is assumed that pearlAuraOwner is always set to something other than -1 when this code is run. - if (Main.player[pearlAuraOwner].ownedProjectileCounts[ProjectileType()] <= 3) - { - for (int i = 0; i < 3; i++) - { - Vector2 shardPos = npc.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-500f, -650f)); - Vector2 shardVel = Vector2.Normalize(npc.Center - shardPos).RotatedByRandom(MathHelper.Pi / 55f) * 20f; - int damage = 20; - Projectile.NewProjectile(npc.GetSource_FromThis(), shardPos, shardVel, ProjectileType(), damage, 5f, pearlAuraOwner); - } - } - } - } - else - { - pearlAuraCounter = 0; - pearlAuraOwner = -1; - } - if (demonSwordImpales > 0 && npc.CanBeMoved()) { npc.velocity *= Utils.Remap(demonSwordImpales, 1, 5, 0.95f, 0.3f, true); @@ -3522,9 +3369,6 @@ namespace CalamityMod.NPCs if (target.Calamity().sulphurSet) npc.AddBuff(BuffID.Poisoned, 60); - if (target.Calamity().ilSpark) - shocked = 120; - if (target.Transformation().Type == ItemType()) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) @@ -3710,7 +3554,7 @@ namespace CalamityMod.NPCs modifiers.HideCombatText(); // Block natural falling stars from killing boss spawners randomly - if (projectile.type == ProjectileID.FallingStar && projectile.damage >= 1000 && (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType())) + if (projectile.type == ProjectileID.FallingStar && projectile.damage >= 1000 && CalamityNPCSets.ProtectedHostileNPC[npc.type]) modifiers.SourceDamage *= 0f; // Supercrits @@ -3941,19 +3785,6 @@ namespace CalamityMod.NPCs } } - //For the vanilla Monk/Shinobi armor critting with Lightning Auras. In vanilla it doesn't stack additively but frankly I do not care. It's not like aura is that good anyway. - if (proj.type == ProjectileID.DD2LightningAuraT1 || proj.type == ProjectileID.DD2LightningAuraT2 || proj.type == ProjectileID.DD2LightningAuraT3) - { - if (player.setMonkT3) - { - critChance += 0.25f; // 1/4 chance to crit with Shinobi - } - else if (player.setMonkT2) - { - critChance += 0.166f; // 1/6 chance to crit with Monk - } - } - // Used to convert all multiplicative tag into crit chance and vice-versa. If both force tag crit and multiplicative are applied, chooses one at random. if (modPlayer.forceSummonTagCrit && !(modPlayer.forceSummonTagMultiplicative && Main.rand.NextBool())) { @@ -3970,8 +3801,6 @@ namespace CalamityMod.NPCs // Currently doesn't support more than 100% crit chance, todo if something does more than +100% tag damage if (Main.rand.NextFloat() < critChance) modifiers.SetCrit(); - else - modifiers.DisableCrit(); // This is to prevent Morning Star and Kalei from critting with their vanilla tag effect. If you want a minion/sentry to crit, you *must* make sure to change critChance in this function. } // This is for whip tag effects that run on hit and don't modify the damage of the hit. @@ -4382,7 +4211,7 @@ namespace CalamityMod.NPCs } } - public static void AttemptToSpawnLavaNPCs(Player player) + /*public static void AttemptToSpawnLavaNPCs(Player player) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -4414,7 +4243,6 @@ namespace CalamityMod.NPCs WeightedRandom pool = new WeightedRandom(); pool.Add(NPCID.None, 1f); - pool.Add(NPCType(), 0.05f); int typeToSpawn = pool.Get(); if (typeToSpawn != NPCID.None) @@ -4428,7 +4256,7 @@ namespace CalamityMod.NPCs } } } - } + }*/ public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { @@ -4682,8 +4510,10 @@ namespace CalamityMod.NPCs if (ashesOnDeath > 0) { if (Main.rand.NextBool(4)) - Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0.475f); - + { + RancorFog fog = new(npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), 180, Main.rand.NextFloat(0.45f, 0.75f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); + } if (Main.rand.NextBool(6)) { Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f)); @@ -4736,9 +4566,6 @@ namespace CalamityMod.NPCs if (eutrophication || temporalSadness) Eutrophication.DrawEffects(npc, ref drawColor); - if (fortunesFavor) - FortunesFavor.DrawEffects(npc, ref drawColor); - if (godSlayerInferno) GodSlayerInferno.DrawEffects(npc, ref drawColor); @@ -4955,7 +4782,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) return new Color(150, 200, 0, npc.alpha); - if (npc.type == NPCID.AncientDoom || npc.type == NPCID.QueenSlimeMinionBlue || npc.type == NPCID.QueenSlimeMinionPink || npc.type == NPCID.QueenSlimeMinionPurple) + if (npc.type == NPCID.QueenSlimeMinionBlue || npc.type == NPCID.QueenSlimeMinionPink || npc.type == NPCID.QueenSlimeMinionPurple) return new Color(255, 255, 255, npc.alpha); return null; @@ -5044,6 +4871,29 @@ namespace CalamityMod.NPCs return DrawVanillaBestiaryWorms(spriteBatch, npc, drawColor); } } + + if (caneInsanityTimer > 0) + { + Texture2D tex = TextureAssets.Npc[npc.type].Value; + Rectangle frame = npc.frame; + float fadeInAmt = caneInsanityTimer > 570 ? Utils.GetLerpValue(600, 570, caneInsanityTimer) : caneInsanityTimer < 30 ? Utils.GetLerpValue(0, 30, caneInsanityTimer) : 1f; + Vector2 origin = new Vector2(tex.Width / 2, tex.Height / Main.npcFrameCount[npc.type] / 2); + SpriteEffects sp = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector3 colorHSL = Main.rgbToHsl(Color.Violet); + + CalamityUtils.EnterShaderRegion(spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(fadeInAmt * 0.35f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1f - colorHSL.X, colorHSL.Y, colorHSL.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + for (int i = 0; i < 4; i++) + { + Vector2 offset = Vector2.UnitX.RotatedBy(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi * 2f + (MathHelper.TwoPi * i / 4f)) * 6f * fadeInAmt; + Main.EntitySpriteDraw(tex, npc.Center - screenPos - Vector2.UnitY * (npc.gfxOffY) + offset, frame, Color.Violet, npc.rotation, origin, npc.scale, sp); + } + CalamityUtils.ExitShaderRegion(spriteBatch); + } + if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityNPCSets.ForceDrawDebuffDisplay[npc.type])) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index fc2a6c5711..a826f0b013 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -104,10 +104,10 @@ namespace CalamityMod.NPCs #region Sky / Space // Harpy - // Sky Glaze @ 3.33% IF Eye of Cthulhu dead + // Sky Glaze @ 3.33% // Essence of Sunlight @ 50% IF Hardmode and not statue spawned case NPCID.Harpy: - postEoC.Add(ModContent.ItemType(), 30); + npcLoot.Add(ModContent.ItemType(), 30); hardmode.AddIf(() => !npc.SpawnedFromStatue, ModContent.ItemType(), 2); break; @@ -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 @@ -538,8 +538,6 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 15, 10)); break; - // The ectoplasm extra drops got moved to the list section; just like moss hornets - // Hardmode Dungeon Melee Skeletons // Wisp in a Bottle @ 0.5% INSTEAD OF 0.25% case NPCID.RustyArmoredBonesAxe: @@ -604,10 +602,10 @@ namespace CalamityMod.NPCs break; // Fire Imp - // Ashen Stalactite @ 4%, 14.28% after defeating EoW/BoC + // Ashen Stalactite @ 4%, 8.33% after defeating EoW/BoC case NPCID.FireImp: npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 25); - npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 7); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 12); break; // Demon, Voodoo Demon @@ -621,10 +619,10 @@ namespace CalamityMod.NPCs break; // Bone Serpent - // Old Lord Oathsword @ 4% Normal, 14.29% after defeating EoW/BoC + // Old Lord Oathsword @ 4% Normal, 12.5% after defeating EoW/BoC case NPCID.BoneSerpentHead: npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 25); - npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 4); + npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 8); break; // Red Devil @@ -1196,7 +1194,8 @@ namespace CalamityMod.NPCs ItemID.LucyTheAxe, ItemID.PewMaticHorn, ItemID.WeatherPain, - ItemID.HoundiusShootius + ItemID.HoundiusShootius, + ModContent.ItemType() }; LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, deerWeapons)); } @@ -1832,11 +1831,6 @@ DukeEditFailed: // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ if (CalamityNPCTypeSets.Skeleton[npc.type]) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); - - // All Hardmode Dungeon Enemies - // Ectoplasm @ 20% - if (CalamityNPCSets.IsBuffedDungeonEnemy[npc.type]) - npcLoot.Add(ItemID.Ectoplasm, 5); #endregion } #endregion diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ebc347aeeb..18ca4435e9 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; @@ -27,11 +28,13 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; @@ -106,6 +109,22 @@ namespace CalamityMod.NPCs return myClone; } + // TODO: [The Gift] Move out of this godforsaken class + public override void SendExtraAI(NPC npc, BitWriter bitWriter, BinaryWriter binaryWriter) + { + bitWriter.WriteBit(TheGiftStatus.HasValue); + if (TheGiftStatus.HasValue) + bitWriter.WriteBit(TheGiftStatus.Value); + + binaryWriter.Write(TheGiftReset); + } + + public override void ReceiveExtraAI(NPC npc, BitReader bitReader, BinaryReader binaryReader) + { + TheGiftStatus = bitReader.ReadBit() ? bitReader.ReadBit() : null; + TheGiftReset = binaryReader.ReadDouble(); + } + #region Town NPC Patreon Name Sets private static readonly string[] AnglerNames = [ @@ -113,6 +132,7 @@ namespace CalamityMod.NPCs "Johnny Test", // <@!589966747977777197> (konorango) "Bling Bling Boy", // <@!522970788203069442> (phallguy) "RICE", // <@!400107830889152524> (rice_xd.) + "Quest Boy", // <@!770103186093637663> (justanothersoldiermain) ]; private static readonly string[] ArmsDealerNames = [ @@ -132,13 +152,14 @@ namespace CalamityMod.NPCs "Storm Havik", // <@!1013452363178197072> (fishnotduck) "Magorfis Splunt the Greater Finklejim", // <@!147490809334333440> (eidolbyssus) "Perrin", // <@!253764551139393537> (easyperrin) - "Dorkyy", // <@!427765391662514185> (dorkblaze01) + "Spud McGee", // <@!727111000658018326> (starchman) ]; private static readonly string[] CyborgNames = [ "Sylux", // <@!331812782183809025> (gonkachino) "Nemesis", // <@!1104036024063107082> (yashimayamanata) "Univerze", // <@!1256376346536448150> (unizumi02) + "Hunk", // <@!447597886260248578> (bagel_san) ]; private static readonly string[] DemolitionistNames = [ @@ -172,6 +193,8 @@ namespace CalamityMod.NPCs "Bars Boldia", // <@!332989575708540939> (careless_imp) "Basel Raiden John Clive Fantasy 16", // <@!529392083136413696> (raiden_ii) "Gobby, Destroyer of Wallets", // <@!429024941296582658> (bwlstorm) + "Potential Man", // <@!320787277007552512> (veruze) + "Donny G", // <@!308736236523225088> (donnyg66) ]; private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = @@ -195,6 +218,7 @@ namespace CalamityMod.NPCs "Wamy", // Fab added this name with no Discord ID. May be a donor who has no Discord account. "Baggute", // <@!535140564174110720> (thebaggutegamer) "Jacob Bryson", // <@!879794107218817026> (.melongun) + "ImaShoe", // <@!926957605056819261> (imashoe.) ]; private static readonly string[] MechanicNames = [ @@ -210,6 +234,7 @@ namespace CalamityMod.NPCs [ "Morshu", // <@!194931581826236416> (uberransy) "Spamton G. Spamton", // <@!497146350438318101> (j.u.n.e.s) + "Goldluna", // <@!442449102857568257> (goldluna) ]; private static readonly string[] NurseNames = [ @@ -217,6 +242,8 @@ namespace CalamityMod.NPCs "Fanny", // <@!799749125720637460> (zombiewolf511) "Mausi", // <@!194156349347594241> (sadouken) "Fiona", // <@!475216964168450048> (thatgayguy69) + "Tikoh", // <@!618149904224616458> (r.fractal) + "Vivienne", // <@!1043188879185952848> (thanat.oshi) ]; private static readonly string[] PainterNames = [ @@ -228,6 +255,7 @@ namespace CalamityMod.NPCs "Arin", // <@!268169458302976012> (kiyotu) "Typhäne", // <@!222064016107896832> (typhane.) "Charlotte Linlin", // <@!563406464522125323> (vixcalibur) + "Shmizzle Dizzle", // <@!1070551501283528724> (shmizzledizzle) ]; private static readonly string[] PirateNames = [ @@ -264,6 +292,9 @@ namespace CalamityMod.NPCs "Papyrus Undertale", // <@!262663471189983242> (nycro) "Mr. Bones", // <@!359215912856977408> (jaybones.) "Freakbob", // <@!377863128140087296> (jevilamv) + "Bone Cold Steve Austin", // <@!282704860992897024> (raendrag_of_rovan) + "Them Bones", // <@!322208584534589450> (dogvtf) + "Deep-Vein Thrombonesis", // <@!557473830457704458> (thessyll) ]; private static readonly string[] SteampunkerNames = [ @@ -275,6 +306,7 @@ namespace CalamityMod.NPCs "Kreutz", // <@!553445849149997056> (red_r_kreutz) "Cathlyn", // <@!156672312425316352> (xaqult) "Eunice", // <@!358376627400605699> (srmg267) + "Zera", // <@!543914166969172106> (zer0_0_0_0) ]; private static readonly string[] StylistNames = [ @@ -282,9 +314,9 @@ namespace CalamityMod.NPCs "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) "Lain", // <@!655201622863118337> (literallyadeerfr) - "Hamis", // <@!608455754093035521> (haefer) "Brio Scarlet", // <@!358576903701004289> (brio_scarlet) "Vanessa", // <@!638901548591611945> (mediocreking) + "Melanie", // <@!356115964800139267> (schwarzerhumor) ]; private static readonly string[] TavernkeepNames = [ @@ -298,6 +330,8 @@ namespace CalamityMod.NPCs "Emmett", "Bagman", // <@!701831892990820383> (supportcrispy) "Old Man Scrooge", // <@!1392141158255427655> (vortexgaming18) + "Jerry Atric", // <@!181545975901454337> (halleyvetica) + "22 Platinum Coin Guy", // <@!921440724766040064> (tsukarin_) ]; private static readonly string[] TravelingMerchantNames = [ @@ -307,13 +341,14 @@ namespace CalamityMod.NPCs "Postman Hiss", // <@!454638106122125312> (karinthefairy) "Cosmoec", // <@!793660591449309204> (cosmoecark) "Junorism", // <@!740625002596008036> (hewhoshallnotbebaned) + "Koral", // <@!1354908256681590845> (koral12244_) + "Phantom", // <@!1360706992506667241> (phantomz980) ]; private static readonly string[] TruffleNames = [ "Aldrimil", // <@!413719640238194689> (Thorioum#2475) "Wonton", // <@!1198092982923043040> (imonthatgudkush) "Mad Lad", // <@!215269032360804352> (crimsoncb) - "Nokko", // <@!706732954079985745> (violet.prime) ]; private static readonly string[] WitchDoctorNames = [ @@ -323,6 +358,7 @@ namespace CalamityMod.NPCs "Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard) "Tequila", // <@!889175547744239677> (thecrispistofnuggets) "Bee Movie Script", // <@!407949998173454341> (literally_jesuschrist) + "Which Doctor", // <@!746103484017016832> (sepulchre0001) ]; private static readonly string[] WizardNames = [ @@ -337,6 +373,7 @@ namespace CalamityMod.NPCs "Mike Cyclops", // <@!702327497475227741> (seichoseicho) "Derin", // <@!466703979695308820> (god_15) "Umbara", // <@!450062421294579712> (umbaraeclipse) + "Reyloth Grey", // <@!255043013116428298> (pantyslack) ]; private static readonly string[] ZoologistNames = [ @@ -347,11 +384,16 @@ namespace CalamityMod.NPCs "Gwenhwyvar", // <@!291342874497515531> (diamondnife) "Daxie", // <@!465438861103988737> (daxie626) "Zora", // <@!752687500656640030> (oxytoxy365) + "Summer", // <@!608455754093035521> (haefer) + "Foxy", // <@!602954046332207164> (squid_san) ]; // Town Slimes private static readonly string[] ClumsySlimeNames = null; private static readonly string[] CoolSlimeNames = null; - private static readonly string[] DivaSlimeNames = null; + private static readonly string[] DivaSlimeNames = + [ + "Rise Kujikawa", // <@!630100236689342475> (roald27) + ]; private static readonly string[] ElderSlimeNames = null; private static readonly string[] MysticSlimeNames = null; private static readonly string[] NerdySlimeNames = @@ -377,6 +419,7 @@ namespace CalamityMod.NPCs "Ozymandias", // <@!146333264871686145> (ozzatron) "Miss Throws a Lot", // <@!799345607847182400> (oakhamsam) "Brikwilla", // <@!543803736909414438> (lavendercobra) + "Melody", // <@!1030635650963214446> (weisslerren) ]; private static readonly string[] TownDogLabradorNames = [ @@ -387,6 +430,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogPitBullNames = [ "Splinter", // <@!320320801213775873> (kaimonick) + "Mack", // <@!427765391662514185> (dorkblaze01) ]; private static readonly string[] TownDogBeagleNames = [ @@ -401,6 +445,7 @@ namespace CalamityMod.NPCs [ "Yoshi", // <@!541127291426832384> (gregthespinarak) "Franklin", // <@!338315261352476682> (tyeski) + "Rocco", // <@!682411821067796480> (little_one777) ]; private const int TownCatSiameseVanillaNames = 12; @@ -417,6 +462,8 @@ namespace CalamityMod.NPCs "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) "Octo", // <@!796112889353994281> (octolinggrimm) + "Kreska", // <@!130037366852157440> (nuclearnecro) + "Meokei", // <@!230839680076218378> (azurlia) ]; private static readonly string[] TownCatSiameseNames = [ @@ -434,6 +481,7 @@ namespace CalamityMod.NPCs "Saffie", // <@!319753595161411584> (CDMusic) "Willow", // <@!319753595161411584> (CDMusic) "Maine", // <@!731141759484297226> (trianglepixel) + "Pluey", // <@!706732954079985745> (violet.prime) ]; private static readonly string[] TownCatOrangeTabbyNames = [ @@ -464,7 +512,10 @@ namespace CalamityMod.NPCs ]; private static readonly string[] TownBunnyWhiteNames = null; private static readonly string[] TownBunnyAngoraNames = null; - private static readonly string[] TownBunnyDutchNames = null; + private static readonly string[] TownBunnyDutchNames = + [ + "windy", // lower case intended ~ <@!498414879502368768> (altixal) + ]; private static readonly string[] TownBunnyFlemishNames = null; private static readonly string[] TownBunnyLopNames = null; private static readonly string[] TownBunnySilverNames = null; @@ -845,27 +896,13 @@ namespace CalamityMod.NPCs { Point tileCenter = npc.Center.ToTileCoordinates(); Rectangle searchArea = new((int)(tileCenter.X - Main.buffScanAreaWidth / 2), (int)(tileCenter.Y - Main.buffScanAreaHeight / 2), Main.buffScanAreaWidth, Main.buffScanAreaHeight); - searchArea = WorldUtils.ClampToWorld(searchArea); - for (int i = searchArea.Left; i < searchArea.Right; i++) + + if (TheMonumentTileEntity.IsInArea(searchArea)) { - for (int j = searchArea.Top; j < searchArea.Bottom; j++) - { - if (!searchArea.Contains(i, j)) - continue; - - Tile tile = Main.tile[i, j]; - if (tile == null) - continue; - if (!tile.HasTile) - continue; - - if (tile.TileType == TileType()) - { - AffectedByTheMonument = true; - return true; - } - } + AffectedByTheMonument = true; + return true; } + return false; } #endregion @@ -1197,8 +1234,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.DoGDefeated"); else if (Main.rand.NextBool(5) && !DownedBossSystem.downedBrimstoneElemental) chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.PreBrimmy"); - else if (Main.rand.NextBool(10) && CalamityUtils.InventoryHas(Main.LocalPlayer, ItemType())) - chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.HasSlickCane"); + else if (Main.rand.NextBool(10) && CalamityUtils.InventoryHas(Main.LocalPlayer, ItemType())) + chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.HasWalkingCane"); else if (Main.rand.NextBool(5) && platinumCoins >= 500) chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.Has500Plat"); else if (Main.rand.NextBool(5) && platinumCoins >= 100) @@ -1278,14 +1315,6 @@ namespace CalamityMod.NPCs defense += 20; } } - - public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) - { - // Not an axe but close enough - if (npc.type == NPCID.TaxCollector && projectile.type == ProjectileType()) - return true; - return base.CanBeHitByProjectile(npc, projectile); - } #endregion #region Shop Stuff @@ -1295,14 +1324,12 @@ namespace CalamityMod.NPCs Condition spelunkerGlowCondition = new(Language.GetText("Conditions.NightDayFullMoon"), () => !Main.dayTime || Main.GetMoonPhase() == MoonPhase.Full); // Identical to the one in NPCShopDatabase Condition hasFlareGunUpgrade = new(CalamityUtils.GetText("Condition.HasFlareGun"), () => (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); - Condition bestiaryProgressLacewing = new(CalamityUtils.GetText("Condition.LacewingBestiary"), () => Main.GetBestiaryProgressReport().CompletionPercent >= 0.4f); Condition crescentMoons = new(CalamityUtils.GetText("Condition.CrescentMoons"), () => Main.GetMoonPhase() == MoonPhase.QuarterAtLeft || Main.GetMoonPhase() == MoonPhase.QuarterAtRight); // for Craw Carapace Condition gibbousMoons = new(CalamityUtils.GetText("Condition.GibbousMoons"), () => Main.GetMoonPhase() == MoonPhase.ThreeQuartersAtLeft || Main.GetMoonPhase() == MoonPhase.ThreeQuartersAtRight); // for Giant Shell if (type == NPCID.Merchant) { - shop.InsertBefore(ItemID.LesserHealingPotion, ItemID.Bottle) - .InsertAfter(ItemID.ManaPotion, ItemID.WormholePotion, Condition.HappyEnoughToSellPylons) + shop.InsertAfter(ItemID.ManaPotion, ItemID.WormholePotion, Condition.HappyEnoughToSellPylons) .InsertAfter(ItemID.Safe, ItemID.MusicBox) .InsertAfter(ItemID.Flare, ItemID.Flare, hasFlareGunUpgrade) .InsertAfter(ItemID.BlueFlare, ItemID.BlueFlare, hasFlareGunUpgrade) @@ -1324,7 +1351,7 @@ namespace CalamityMod.NPCs { shop.Add(Condition.DownedSkeletron) .Add(Condition.Hardmode) - .AddWithCustomValue(ItemID.Boomstick, Item.buyPrice(gold: 25), Condition.DownedQueenBee) + .AddWithCustomValue(ItemID.Revolver, Item.buyPrice(gold: 35), Condition.Hardmode) .AddWithCustomValue(ItemID.Uzi, Item.buyPrice(gold: 50), Condition.DownedPlantera); } @@ -1384,8 +1411,7 @@ namespace CalamityMod.NPCs { shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)) .Add(ItemType()) - .Add(ItemType()) - .Add(ItemType(), CalamityConditions.InSunken, Condition.NpcIsPresent(NPCType())); + .Add(ItemType()); } if (type == NPCID.Steampunker) @@ -1443,7 +1469,6 @@ namespace CalamityMod.NPCs if (type == NPCID.SkeletonMerchant) { shop.InsertAfter(ItemID.HealingPotion, ItemType(), Condition.MoonPhasesHalf0) - .InsertAfter(ItemID.HealingPotion, ItemID.MilkCarton, Condition.MoonPhasesHalf1) .InsertAfter(ItemID.SpelunkerFlare, ItemID.SpelunkerFlare, spelunkerGlowCondition, hasFlareGunUpgrade) .AddWithCustomValue(ItemID.Marrow, Item.buyPrice(gold: 25), Condition.Hardmode, Condition.MoonPhases26) // 26 = half moons .AddWithCustomValue(Item.buyPrice(gold: 15), gibbousMoons) @@ -1452,7 +1477,7 @@ namespace CalamityMod.NPCs if (type == NPCID.BestiaryGirl) { - shop.Add(ItemID.EmpressButterfly, bestiaryProgressLacewing); + shop.Add(ItemID.EmpressButterfly, Condition.BestiaryFilledPercent(40)); } if (type == NPCID.Truffle) diff --git a/NPCs/CalamityVanillaAIOverrideNPC.Global.cs b/NPCs/CalamityVanillaAIOverrideNPC.Global.cs index 33061a02d0..fd02cb8124 100644 --- a/NPCs/CalamityVanillaAIOverrideNPC.Global.cs +++ b/NPCs/CalamityVanillaAIOverrideNPC.Global.cs @@ -230,8 +230,8 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC // Light colors int alpha = 192; - Color groundColor = new Color(150, 0, 0, alpha); - Color flightColor = revenge ? new Color(0, 0, 150, alpha) : groundColor; + Color groundColor = new Color(255, 125, 125, alpha); + Color flightColor = revenge ? new Color(125, 0, 255, alpha) : groundColor; Color segmentColor = Color.Lerp(groundColor, flightColor, phaseTransitionColorAmount); Color telegraphColor_Red = new Color(255, 125, 125, alpha); Color telegraphColor_Green = new Color(125, 255, 125, alpha); @@ -261,23 +261,17 @@ public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC telegraphProgress = MathHelper.Clamp((calNPC.newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } + Color finalColor = Color.Lerp(segmentColor, telegraphColor, telegraphProgress); + Vector3 teleHsl = Main.rgbToHsl(finalColor); - Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value; - switch (npc.type) - { - default: - case NPCID.TheDestroyer: - break; - case NPCID.TheDestroyerBody: - glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerBodyGlowmask.Value : TextureAssets.Dest[1].Value; - break; - case NPCID.TheDestroyerTail: - glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerTailGlowmask.Value : TextureAssets.Dest[2].Value; - break; - } + Texture2D glowTexture = TextureAssets.Dest[npc.type - 134].Value; - float alphaMultiplier = 1f - npc.alpha / 255f; - spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, Color.Lerp(segmentColor, telegraphColor, telegraphProgress) * alphaMultiplier, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + CalamityUtils.EnterShaderRegion(spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1f - teleHsl.X, teleHsl.Y, teleHsl.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + spriteBatch.Draw(glowTexture, npc.Center - screenPos + Vector2.UnitY * npc.gfxOffY, npc.frame, Color.White * npc.Opacity, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + CalamityUtils.ExitShaderRegion(spriteBatch); } return false; } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 3ecd980cd7..b921f02609 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -178,40 +178,6 @@ namespace CalamityMod.NPCs.Crabulon else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - if (NPC.ai[0] < 2f) - { - int mushBombAmt = phase4 ? 6 : phase3 ? 3 : phase2 ? 2 : 1; - float fireRate = phase4 ? 6f : phase3 ? 3f : phase2 ? 2f : 1f; - NPC.localAI[3] += fireRate; - if (NPC.ai[3] == 0f) - { - float shootMushroomsGateValue = revenge ? 120f : expertMode ? 200f : 300f; - if (NPC.localAI[3] > shootMushroomsGateValue) - { - NPC.ai[3] = 1f; - NPC.localAI[3] = 0f; - } - } - else if (NPC.localAI[3] > 30f) - { - NPC.localAI[3] = 0f; - NPC.ai[3] += 1f; - if (NPC.ai[3] >= mushBombAmt) - NPC.ai[3] = 0f; - - float mushBombSpeed = phase4 ? 16f : phase3 ? 14f : phase2 ? 12f : 10f; - int type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item42, NPC.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float yVelocity = death ? 1f : expertMode ? 2.5f : 4f; - Vector2 projectileVelocity = (Vector2.Normalize(player.Center - NPC.Center) * mushBombSpeed) - Vector2.UnitY * yVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); - } - } - } - if (NPC.ai[0] == 0f) { // Avoid cheap bullshit @@ -245,7 +211,40 @@ namespace CalamityMod.NPCs.Crabulon // Avoid cheap bullshit NPC.damage = 0; - float walkingVelocity = death ? (5f + 1f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f; + // Fire mushroom projectiles at the player + int mushBombAmt = phase4 ? 6 : phase3 ? 3 : phase2 ? 2 : 1; + float fireRate = phase4 ? 6f : phase3 ? 3f : phase2 ? 2f : 1f; + NPC.localAI[3] += fireRate; + if (NPC.ai[3] == 0f) + { + float shootMushroomsGateValue = revenge ? 120f : expertMode ? 200f : 300f; + if (NPC.localAI[3] > shootMushroomsGateValue) + { + NPC.ai[3] = 1f; + NPC.localAI[3] = 0f; + } + } + else if (NPC.localAI[3] > 30f) + { + NPC.localAI[3] = 0f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= mushBombAmt) + NPC.ai[3] = 0f; + + float mushBombSpeed = phase4 ? 16f : phase3 ? 14f : phase2 ? 12f : 10f; + int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float yVelocity = death ? 1f : expertMode ? 2.5f : 4f; + Vector2 projectileVelocity = (Vector2.Normalize(player.Center - NPC.Center) * mushBombSpeed) - Vector2.UnitY * yVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + + // Walking + float walkingVelocity = expertMode ? 4.5f : 3.5f; if (phase2) walkingVelocity += 0.5f; if (phase3) @@ -330,6 +329,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.noTileCollide = false; NPC.ai[0] = (Main.rand.NextBool() && revenge && phase2) ? 4f : 2f; NPC.ai[1] = 0f; + NPC.ai[3] = 0f; NPC.ForceNetUpdate(); } @@ -485,7 +485,7 @@ namespace CalamityMod.NPCs.Crabulon int type = ModContent.ProjectileType(); - if ((NPC.ai[2] % 2f == 0f || death) && ((phase2 && revenge) || (phase3 && expertMode))) + if (NPC.ai[2] % 2f == 0f && ((phase2 && revenge) || (phase3 && expertMode))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -495,8 +495,7 @@ namespace CalamityMod.NPCs.Crabulon destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - int numProj = phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; + int numProj = phase4 ? 14 : CalamityWorld.death ? 16 : 12; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -520,8 +519,7 @@ namespace CalamityMod.NPCs.Crabulon destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - int numProj = phase4 ? 8 : (phase3 && death) ? 6 : 8; + int numProj = 8; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -621,42 +619,19 @@ namespace CalamityMod.NPCs.Crabulon if (revenge) { float velocityXAdjustment = maxVelocityX; - - if (lifeRatio < 0.5f && death) + switch ((int)NPC.ai[3]) { - // Mega velocity - switch ((int)NPC.ai[3]) - { - case 0: // Normal - case 1: // High - case 2: // Low - maxVelocityX += velocityXAdjustment * 0.5f; - break; + case 0: // Normal + case 1: // High + case 2: // Low + break; - case 3: // Long and low - maxVelocityX += velocityXAdjustment * 1.5f; - break; + case 3: // Long and low + maxVelocityX += velocityXAdjustment * (lifeRatio < 0.5f && death ? 1.5f : 1f); + break; - default: - break; - } - } - else - { - switch ((int)NPC.ai[3]) - { - case 0: // Normal - case 1: // High - case 2: // Low - break; - - case 3: // Long and low - maxVelocityX += velocityXAdjustment; - break; - - default: - break; - } + default: + break; } } @@ -728,31 +703,30 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.velocity.Y >= 0f && NPC.Bottom.Y >= NPC.ai[3] - NPC.height) NPC.noTileCollide = false; - // Impact and create lines of mushrooms that spread out along the ground (similar to an old Providence attack) if (NPC.Bottom.Y >= NPC.ai[3] || NPC.velocity.Y == 0f) { SoundEngine.PlaySound(SlamSound, NPC.Center); + NPC.velocity.X *= 0.5f; NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; NPC.netUpdate = true; - int type = ModContent.ProjectileType(); - - if (Main.netMode != NetmodeID.MultiplayerClient) + // Create lines of mushrooms that spread out along the ground in Death Mode + if (death && Main.netMode != NetmodeID.MultiplayerClient) { - float xVelocity = death ? 2f : 1f; - int numProj = death ? 5 : 3; - Vector2 initialVelocity = Vector2.UnitX * xVelocity; + int numProj = 3; + int type = ModContent.ProjectileType(); + Vector2 initialVelocity = Vector2.UnitX; Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); - for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity - (i / (float)numProj * initialVelocity), type, MushroomShotDamage, 0f, Main.myPlayer); + for (int i = 1; i <= numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity * (i / (float)numProj), type, MushroomShotDamage, 0f, Main.myPlayer); - for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(-81, 0), Main.rand.Next(-20, 1)), -(initialVelocity - (i / (float)numProj * initialVelocity)), type, MushroomShotDamage, 0f, Main.myPlayer); + for (int i = 1; i <= numProj; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(-81, 0), Main.rand.Next(-20, 1)), -(initialVelocity * (i / (float)numProj)), type, MushroomShotDamage, 0f, Main.myPlayer); } for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) @@ -949,7 +923,7 @@ namespace CalamityMod.NPCs.Crabulon if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; - int crabShroomAmt = death ? 4 : expertMode ? 3 : 2; + int crabShroomAmt = expertMode ? 3 : 2; for (int mush = 0; mush < crabShroomAmt; mush++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index edea410818..1db1adb2cb 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -307,24 +307,24 @@ namespace CalamityMod.NPCs.Cryogen float chargeSlownDownPhaseGateValue = chargeGateValue + chargeSlowDownTime; bool chargePhase = NPC.ai[1] >= chargePhaseGateValue; + float iceBombDelay = phase5 ? 180f : 720f; + if (Main.getGoodWorld) + iceBombDelay *= 0.5f; if (expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase) { calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 900f) + if (calamityGlobalNPC.newAI[3] >= iceBombDelay) { calamityGlobalNPC.newAI[3] = 0f; SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = 3; + int totalProjectiles = phase5 ? 2 : 3; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBomb; float velocity = 2f + NPC.ai[0]; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + Vector2 spinningPoint = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * -velocity; for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); @@ -1064,7 +1064,7 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[2] -= 1f; float chargeStartDistance = 300f; - float chargeCooldown = 30f; + float chargeCooldown = 25f; if (playerDistance < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) { diff --git a/NPCs/Deconstructors/Burrower.cs b/NPCs/Deconstructors/Burrower.cs index 17fc2c7c3c..9e83c3b69c 100644 --- a/NPCs/Deconstructors/Burrower.cs +++ b/NPCs/Deconstructors/Burrower.cs @@ -110,8 +110,6 @@ namespace CalamityMod.NPCs.Deconstructors } public override void SetDefaults() { - - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 0; NPC.width = 38; NPC.height = 38; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 2d45fb0d1d..ce811e5e71 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()); } @@ -637,12 +640,6 @@ namespace CalamityMod.NPCs.DevourerofGods string key = "Mods.CalamityMod.Status.Boss.DoGPhase2"; Color messageColor = Color.Cyan; CalamityUtils.BroadcastLocalizedText(key, messageColor); - /* - var ctid = CombatText.NewText(NPC.Hitbox, messageColor, Language.GetTextValue(key), true); - if (ctid < Main.maxCombatText) - player.Calamity().subtitletext = Main.combatText[ctid]; - player.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia }; - */ DialogueDisplaySystem.StartDialogue("Mods.CalamityMod.DevourerOfGods.Phases", NPC, 2, 120, false, new BossText()); } } @@ -1474,13 +1471,6 @@ namespace CalamityMod.NPCs.DevourerofGods string key = "Mods.CalamityMod.Status.Boss.DoGSubphase1"; Color messageColor = Color.Cyan; CalamityUtils.BroadcastLocalizedText(key, messageColor); - - /* - int ctid = CombatText.NewText(NPC.Hitbox, messageColor, Language.GetTextValue(key), true); - if (ctid < Main.maxCombatText) - player.Calamity().subtitletext = Main.combatText[ctid]; - player.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia }; - */ DialogueDisplaySystem.StartDialogue("Mods.CalamityMod.DevourerOfGods.Phases", NPC, 1, 120, false, new BossText()); } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 76374999e1..6da831b412 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -82,10 +82,10 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.dontCountMe = true; if (Main.zenithWorld) + { NPC.scale *= 1.5f; - - if (Main.getGoodWorld) NPC.takenDamageMultiplier = 2; + } } public override void BossHeadSlot(ref int index) diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index 09230077a7..90182bcdaa 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -196,7 +196,7 @@ namespace CalamityMod.NPCs.DraedonLabThings NPC.frame.Y = 1; } } - // Suprise! + // Surprise! else if (NPC.ai[0] == 1) { if (NPC.frame.Y < frameHeight * 5) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index a254f33078..724c6f8fa0 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -504,14 +504,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares draedonAlive = true; } - // Prevent mechs from being respawned - // CIT 08JUN2025: This code is pointless and makes me unable to work swapping the laser arm position. Commenting it out. - /*if (otherExoMechWasFirst) - { - if (NPC.ai[3] < 1f) - NPC.ai[3] = 1f; - }*/ - // Phases bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 761fcac44b..87faabc3e7 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -12,6 +12,10 @@ namespace CalamityMod.NPCs.HiveMind { public class DankCreeper : ModNPC { + public override void SetStaticDefaults() + { + NPCID.Sets.BossBestiaryPriority.Add(Type); + } public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; @@ -43,6 +47,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { + bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[ModContent.NPCType()], quickUnlock: true); bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 7c8ef8e53e..31e1e3d78f 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -44,6 +44,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { + bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[ModContent.NPCType()], quickUnlock: true); bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index f9467741d4..8948213a85 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -19,7 +19,11 @@ namespace CalamityMod.NPCs.HiveMind private const float TelegraphDuration = 120f; private bool FastVariant => NPC.ai[2] > 0f; - public override void SetStaticDefaults() => NPCID.Sets.NeedsExpertScaling[Type] = true; + public override void SetStaticDefaults() + { + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.BossBestiaryPriority.Add(Type); + } public static int VileClotDamage = 8; // 32 @@ -54,6 +58,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { + bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[ModContent.NPCType()], quickUnlock: true); bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption, diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 78c8cc13cd..70b3769909 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.GameContent.Bestiary; @@ -76,6 +77,12 @@ namespace CalamityMod.NPCs.NormalNPCs } } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 120, true); + } + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 10, 26); public override void ModifyTypeName(ref string typeName) diff --git a/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs index edb77ef352..f900b7189e 100644 --- a/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs +++ b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs @@ -663,7 +663,7 @@ namespace CalamityMod.NPCs.NormalNPCs } // Sea Minnows face away from the player - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) npc.direction *= -1; } else diff --git a/NPCs/NormalNPCs/CloudElemental.cs b/NPCs/NormalNPCs/CloudElemental.cs index 59bdafb7f8..752bb20f18 100644 --- a/NPCs/NormalNPCs/CloudElemental.cs +++ b/NPCs/NormalNPCs/CloudElemental.cs @@ -459,7 +459,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/DivineSwine.cs b/NPCs/NormalNPCs/DivineSwine.cs new file mode 100644 index 0000000000..ee698f3b0b --- /dev/null +++ b/NPCs/NormalNPCs/DivineSwine.cs @@ -0,0 +1,1011 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Effects; +using CalamityMod.Enums; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Items.Ammo; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions.Food; +using CalamityMod.Packets; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameInput; +using Terraria.ID; +using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class DivineSwine : ModNPC + { + public enum BehaviorState + { + PiggyTransformation = -1, + IdleAndFly, + OfferingAccepted, + OfferingFailed + } + + private static Asset BloomCircle; + private static Asset BloomFlare; + private static Asset ShineFlare; + private static Asset MagicStarCircle; + private static Asset FadedStarRing; + private static Asset DistortionTexture; + private static Asset DeliciousMeatTexture; + + private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineIdle", 4); + private static SoundStyle CoinFailSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineCoinFail", 3); + private static SoundStyle CoinPassSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineCoinPass", 2); + private static SoundStyle SwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0, + }; + private static SoundStyle MisophoniaSwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0, + }; + + public int FrameY; + + public bool ShouldTurnAway; + + public Vector2 SquashVector; + + public Vector2 IdleMovementVector; + + public SlotId SwineSpeakSoundSlot; + + public static float MaxSpeed => 0.38f; + public static float MaxAcceleration => 0.06f; + + public static Color DivineBlue => new(166, 238, 247); + public static Color DivineYellow => new(247, 242, 166); + + public ref float Timer => ref NPC.ai[0]; + + public ref float AIState => ref NPC.ai[1]; + + public ref float LocalAIState => ref NPC.ai[2]; + + public ref float IdleMovementTimer => ref NPC.ai[3]; + + public ref float AdditionalBrightness => ref NPC.localAI[0]; + + public ref float GlowingVisualScale => ref NPC.localAI[1]; + + public ref float DivineSwineTintStrength => ref NPC.localAI[2]; + + public override void Load() + { + On_Main.HoverOverNPCs += DivineSwineRightClickInteraction; + On_Main.DrawInfoAccs_AdjustInfoTextColorsForNPC += AdjustLifeformAnalyzerTextColor; + + if (!Main.dedServ) + { + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + BloomFlare = ModContent.Request("CalamityMod/ExtraTextures/BloomFlare"); + ShineFlare = ModContent.Request("CalamityMod/ExtraTextures/ShineFlare"); + MagicStarCircle = ModContent.Request("CalamityMod/ExtraTextures/MagicStarCircle"); + FadedStarRing = ModContent.Request("CalamityMod/ExtraTextures/FadedStarRing"); + DistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Smudges"); + DeliciousMeatTexture = ModContent.Request("CalamityMod/Items/Potions/Food/DeliciousMeat"); + } + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 14; + NPCID.Sets.CountsAsCritter[Type] = true; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + 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() + { + NPC.damage = 0; + NPC.width = 32; + NPC.height = 34; + NPC.lifeMax = 5; + NPC.defense = 99999999; + NPC.rarity = 5; + NPC.aiStyle = -1; + NPC.knockBackResist = 0.1f; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.immortal = true; + NPC.noGravity = 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) + { + SquashVector = Vector2.One; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.DivineSwine") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(FrameY); + writer.Write(ShouldTurnAway); + writer.WriteVector2(SquashVector); + writer.WriteVector2(IdleMovementVector); + + for (int i = 0; i < 3; i++) + writer.Write(NPC.localAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + FrameY = reader.ReadInt32(); + ShouldTurnAway = reader.ReadBoolean(); + SquashVector = reader.ReadVector2(); + IdleMovementVector = reader.ReadVector2(); + + for (int i = 0; i < 3; i++) + NPC.localAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + switch ((BehaviorState)AIState) + { + case BehaviorState.PiggyTransformation: + MainBehavior_PiggyTransformation(); + break; + + case BehaviorState.IdleAndFly: + MainBehavior_IdleAndFly(); + break; + + case BehaviorState.OfferingAccepted: + MainBehavior_OfferingAccepted(); + break; + + case BehaviorState.OfferingFailed: + MainBehavior_OfferingFailed(); + break; + } + + SoundEffects(); + AmbientParticles(); + AnimateSprite(); + + Lighting.AddLight(NPC.Center, DivineYellow.ToVector3() * NPC.scale * 0.825f); + + if (AIState != (int)BehaviorState.PiggyTransformation && AIState != (int)BehaviorState.OfferingAccepted && AIState != (int)BehaviorState.OfferingFailed) + { + AdditionalBrightness = MathHelper.Lerp(AdditionalBrightness, 0f, 0.05f); + GlowingVisualScale = MathHelper.Lerp(GlowingVisualScale, 1f, 0.05f); + } + + SquashVector = Vector2.Lerp(SquashVector, Vector2.One, 0.05f); + ShouldTurnAway = NPC.ArcCollisionCheck(-0.3f, 0.3f, 0.05f, optionalCollisionCheckOverride: (arcBasePoint, arcPoint) => + { + return !Collision.CanHitLine(arcBasePoint, 1, 1, arcPoint, 1, 1) || Collision.WetCollision(arcPoint, 1, 1); + }); + + NPC.rotation = NPC.velocity.X * 0.12f; + Timer++; + } + + public void MainBehavior_PiggyTransformation() + { + NPC.velocity *= 0f; + NPC.ShowNameOnHover = false; + NPC.dontTakeDamage = true; + + // Shrink the sigil and start tinting white. + float dissolveStrength = CalamityUtils.SineInOutEasing(Utils.GetLerpValue(0f, 240f, Timer, true), 1); + DivineSwineTintStrength = dissolveStrength; + GlowingVisualScale = 1f - dissolveStrength; + AdditionalBrightness = MathHelper.Lerp(0f, 50f, dissolveStrength); + + // Shake the screen slightly while the player is near Divine Swine. + float distanceFromSwine = Main.LocalPlayer.Distance(NPC.Center); + if (distanceFromSwine < 400f) + { + float shakeStrength = Utils.Remap(distanceFromSwine, 400f, 100f, 0f, 3f, true) * Utils.GetLerpValue(0f, 180f, Timer, true); + Main.LocalPlayer.SetScreenshake(shakeStrength); + } + + // Typical glowy particle VFX. + float particleStrengthInterpolant = Utils.GetLerpValue(0f, 180f, Timer, true); + int lightSpawnRate = (int)MathHelper.Lerp(8, 1, particleStrengthInterpolant); + if (Main.rand.NextBool(lightSpawnRate)) + { + int lightAmt = (int)MathHelper.Lerp(1, 6, particleStrengthInterpolant); + for (int i = 0; i < Main.rand.Next(1, lightAmt + 1); i++) + { + float lightSpeed = MathHelper.Lerp(6f, 12f, particleStrengthInterpolant); + float lightScale = MathHelper.Lerp(0.5f, 0.8f, particleStrengthInterpolant) * Main.rand.NextFloat(0.5f, 1f); + + SquishyLightParticle transformLight = new(NPC.Center, Main.rand.NextVector2Circular(lightSpeed, lightSpeed), lightScale, Color.White, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(transformLight, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + } + + if (Main.rand.NextBool(lightSpawnRate + 2)) + { + int sparkleAmt = (int)MathHelper.Lerp(1, 5, particleStrengthInterpolant); + for (int i = 0; i < Main.rand.Next(1, sparkleAmt + 1); i++) + { + float sparkleSpeed = MathHelper.Lerp(8f, 18f, particleStrengthInterpolant); + float sparkleScale = MathHelper.Lerp(0.2f, 0.5f, particleStrengthInterpolant) * Main.rand.NextFloat(0.5f, 1f); + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + + QuickSparkleParticle transformSparkle = new(NPC.Center, Main.rand.NextVector2Circular(sparkleSpeed, sparkleSpeed), sparkleColor, sparkleScale, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(transformSparkle, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + } + + if (Timer >= 180f && Timer % 15f == 0f) + { + float glowRingScale = Utils.Remap(Timer, 180f, 240f, 1.6f, 2.2f, true); + CustomPulse transformRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, glowRingScale, 45); + GeneralParticleHandler.SpawnParticle(transformRing, false, Enums.GeneralDrawLayer.AfterNPCs); + } + + if (Timer >= 240f) + { + CustomPulse glowRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 3f, 75); + GeneralParticleHandler.SpawnParticle(glowRing, false, Enums.GeneralDrawLayer.AfterNPCs); + + BloomParticle bloom = new(NPC.Center, Vector2.Zero, Color.White, 0f, 2f, 125); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(bloom, false, Enums.GeneralDrawLayer.AfterNPCs); + + for (int i = 0; i < 25; i++) + { + QuickSparkleParticle sparkle = new(NPC.Center, Main.rand.NextVector2Circular(20f, 20f), Color.White, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(45, 60)); + SquishyLightParticle light = new(NPC.Center, Main.rand.NextVector2Circular(10f, 10f), Main.rand.NextFloat(0.6f, 0.8f), Color.White, Main.rand.Next(45, 60)); + GeneralParticleHandler.SpawnParticle(Main.rand.NextBool() ? sparkle : light, true, Enums.GeneralDrawLayer.AfterNPCs); + } + + SoundEngine.PlaySound(SoundID.Item29 with { Volume = 0.1f }, NPC.Center); + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(IdleSound, NPC.Center); + + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out ActiveSound swineSpeakInstance)) + swineSpeakInstance.Stop(); + + NPC.Transform(ModContent.NPCType()); + } + } + + public void MainBehavior_IdleAndFly() + { + // Flying around. + if (LocalAIState == 0f) + { + if (Timer > 0f && Timer % 120f == 0f && Main.rand.NextBool(6)) + { + Timer = 0f; + LocalAIState = 1f; + NPC.netUpdate = true; + } + + Point tileAhead = (NPC.Center + NPC.velocity * 16f).ToTileCoordinates(); + bool leavingWorldTop = tileAhead.Y <= 40; + bool leavingWorldBottom = tileAhead.Y >= Main.maxTilesY - 40; + bool leavingWorldLeft = tileAhead.X <= 40; + bool leavingWorldRight = tileAhead.X >= Main.maxTilesX - 40; + if (ShouldTurnAway || leavingWorldTop || leavingWorldBottom || leavingWorldLeft || leavingWorldRight) + { + AvoidTileCollision(MaxSpeed + 0.6f, ref leavingWorldTop, ref leavingWorldBottom, ref leavingWorldLeft, ref leavingWorldRight); + IdleMovementTimer = 150f; + } + else + { + if (IdleMovementTimer == 0f) + { + IdleMovementVector = new Vector2(Main.rand.NextFloat(-100f, 101f)); + IdleMovementTimer = Main.rand.Next(240, 360); + NPC.netUpdate = true; + } + + float idealSpeed = MaxSpeed / IdleMovementVector.Length(); + NPC.velocity = Vector2.Lerp(NPC.velocity, IdleMovementVector * idealSpeed, MaxAcceleration); + IdleMovementTimer--; + + if (NPC.velocity.Y < 2.2f) + NPC.velocity.Y += 0.022f; + } + + NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); + } + + // Stop and occasionally switch directions. + if (LocalAIState == 1f) + { + if (Timer > 0f && Timer % 120f == 0f && Main.rand.NextBool(6)) + { + Timer = 0f; + LocalAIState = 0f; + NPC.netUpdate = true; + } + + NPC.velocity *= 0.9f; + if (Timer > 0f && Timer % 75f == 0f && Main.rand.NextBool(4)) + NPC.spriteDirection *= -1; + } + } + + public void MainBehavior_OfferingAccepted() + { + // Spawn particles and do a lil animation and whateva + if (Timer <= 210f) + { + float lightSpawnDistance = MathHelper.Lerp(52f, 84f, Timer / 210f); + float glowRingScale = MathHelper.Lerp(0.3f, 0.9f, Timer / 210f); + + int lightAmt = Main.rand.Next(1, 2); + for (int i = 0; i < lightAmt; i++) + { + Vector2 lightSpawnPosition = NPC.Center + Main.rand.NextVector2Unit() * lightSpawnDistance * Main.rand.NextFloat(0.7f, 1f); + Vector2 lightVelocity = (NPC.Center - lightSpawnPosition).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(3f, 4f); + float lightScale = Utils.Remap(Timer, 0f, 180f, 0.3f, 0.9f, true); + Color lightColor = Color.Lerp(DivineBlue, DivineYellow, Main.rand.NextFloat()); + + SquishyLightParticle meatLight = new(lightSpawnPosition, lightVelocity, lightScale, lightColor, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(meatLight, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + + int sparkleSpawnRate = (int)Utils.Remap(Timer, 0f, 180f, 45, 5, true); + if (Main.rand.NextBool(sparkleSpawnRate)) + { + int sparkleAmt = Main.rand.Next(1, 3); + for (int i = 0; i < sparkleAmt; i++) + { + Vector2 spawnPosition = NPC.Center + Main.rand.NextVector2Unit() * lightSpawnDistance * Main.rand.NextFloat(0.8f, 1.2f); + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + float sparkleScale = Utils.Remap(Timer, 0f, 180f, 0.2f, 0.8f, true); + + QuickSparkleParticle sparkle = new(spawnPosition, Vector2.Zero, sparkleColor, sparkleScale * Main.rand.NextFloat(0.5f, 1f), Main.rand.Next(20, 30)); + GeneralParticleHandler.SpawnParticle(sparkle, true); + } + } + + if (Timer % 15f == 0f) + { + CustomPulse meatLightRing = new(NPC.Center, Vector2.Zero, DivineBlue, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, glowRingScale, 0f, 25); + GeneralParticleHandler.SpawnParticle(meatLightRing, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + } + + // Divine meat granted + if (Timer == 210f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int meat = Item.NewItem(NPC.GetSource_GiftOrReward(), NPC.Center, ModContent.ItemType()); + Main.item[meat].velocity = Vector2.UnitY * -3f; + } + + CustomPulse meatLightRing = new(NPC.Center, Vector2.Zero, DivineBlue, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 3f, 75); + GeneralParticleHandler.SpawnParticle(meatLightRing, false, Enums.GeneralDrawLayer.AfterNPCs); + + BloomParticle meatBloom = new(NPC.Center, Vector2.Zero, Color.White, 0f, 3f, 125); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(meatBloom, false, Enums.GeneralDrawLayer.AfterNPCs); + + for (int i = 0; i < 25; i++) + { + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + QuickSparkleParticle meatSparkle = new(NPC.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(13f, 15f), sparkleColor, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(45, 60)); + + Color lightColor = Color.Lerp(DivineBlue, DivineYellow, Main.rand.NextFloat()); + SquishyLightParticle meatLight = new(NPC.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(3f, 5f), Main.rand.NextFloat(1.4f, 1.8f), lightColor, Main.rand.Next(45, 60)); + + 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; + } + + GlowingVisualScale = Utils.Remap(Timer, 0f, 210f, 1f, 0f, true); + AdditionalBrightness = Utils.Remap(Timer, 0f, 45f, 1f, 0f, true); + NPC.scale *= 0.96f; + NPC.velocity *= 0.9f; + NPC.ShowNameOnHover = false; + } + + public void MainBehavior_OfferingFailed() + { + if (Timer >= 75f) + { + CustomPulse meatLightRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2f, 75); + GeneralParticleHandler.SpawnParticle(meatLightRing, false, Enums.GeneralDrawLayer.AfterNPCs); + + BloomParticle meatBloom = new(NPC.Center, Vector2.Zero, Color.White, 0f, 2f, 125); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(meatBloom, false, Enums.GeneralDrawLayer.AfterNPCs); + + for (int i = 0; i < 25; i++) + { + QuickSparkleParticle meatSparkle = new(NPC.Center, Main.rand.NextVector2Circular(15f, 15f), Color.White, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(45, 60)); + SquishyLightParticle meatLight = new(NPC.Center, Main.rand.NextVector2Circular(5f, 5f), Main.rand.NextFloat(0.6f, 0.8f), Color.White, Main.rand.Next(45, 60)); + + GeneralParticleHandler.SpawnParticle(Main.rand.NextBool() ? meatSparkle : meatLight, true, Enums.GeneralDrawLayer.AfterNPCs); + } + + SoundEngine.PlaySound(SoundID.Item29 with { Volume = 0.1f }, NPC.Center); + + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(IdleSound, NPC.Center); + + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out ActiveSound swineSpeakInstance)) + swineSpeakInstance.Stop(); + + NPC.checkDead(); + NPC.active = false; + return; + } + + if (Timer <= 45f) + { + DivineSwineTintStrength = MathHelper.Lerp(0f, 1f, CalamityUtils.PolyInOutEasing(Timer / 45f, 2)); + GlowingVisualScale = MathHelper.Lerp(1f, 0f, CalamityUtils.PolyInOutEasing(Timer / 45f, 2)); + } + + int lightAmt = Main.rand.Next(2, 3); + for (int i = 0; i < lightAmt; i++) + { + float lightScale = Main.rand.NextFloat(0.15f, 0.3f); + SquishyLightParticle meatLight = new(NPC.Center, Main.rand.NextVector2Circular(2f, 2f), lightScale, Color.White, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(meatLight, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + + NPC.velocity *= 0.9f; + NPC.ShowNameOnHover = false; + } + + public void TransformIntoPiggy() + { + AIState = (int)BehaviorState.PiggyTransformation; + LocalAIState = 0f; + Timer = 0f; + NPC.netUpdate = true; + } + + public bool TryTransformingIntoPiggy() + { + if (AIState == (int)BehaviorState.PiggyTransformation) + return false; + return true; + } + + public void AvoidTileCollision(float maxSpeed, ref bool leavingWorldTop, ref bool leavingWorldBottom, ref bool leavingWorldLeft, ref bool leavingWorldRight, float turnAwayStrength = 0.125f) + { + float distanceToCollisionLeft = CalamityUtils.DistanceToTileCollisionHit(NPC.Center, NPC.velocity.RotatedBy(MathHelper.PiOver2), 32, ShouldAvoidTile) ?? 10000f; + float distanceToCollisionRight = CalamityUtils.DistanceToTileCollisionHit(NPC.Center, NPC.velocity.RotatedBy(-MathHelper.PiOver2), 32, ShouldAvoidTile) ?? 10000f; + int directionToMove = (distanceToCollisionLeft > distanceToCollisionRight).ToDirectionInt(); + + Vector2 idealVelocity = NPC.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * directionToMove) * (maxSpeed - NPC.velocity.Length()); + if (leavingWorldTop) + idealVelocity = Vector2.UnitY * 2f; + if (leavingWorldBottom) + idealVelocity = Vector2.UnitY * -2f; + if (leavingWorldLeft) + idealVelocity = Vector2.UnitX * 2f; + if (leavingWorldRight) + idealVelocity = Vector2.UnitX * -2f; + + IdleMovementVector = idealVelocity; + NPC.velocity = Vector2.Lerp(NPC.velocity, idealVelocity, turnAwayStrength); + } + + public void AmbientParticles() + { + if (AIState != (int)BehaviorState.IdleAndFly) + return; + + // Feathers, both falling and non falling ones. + if (Main.rand.NextBool(70)) + { + int featherAmt = Main.rand.Next(1, 3); + for (int i = 0; i < featherAmt; i++) + { + Vector2 spawnPosition = NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.height); + Vector2 velocity = Vector2.UnitY * Main.rand.NextFloat(0.25f, 0.75f); + Color featherColor = Color.Lerp(Color.Lerp(new Color(27, 103, 155), new Color(83, 184, 255), Main.rand.NextFloat()), new Color(221, 253, 255), Main.rand.NextFloat(0.4f)); + float scale = Main.rand.NextFloat(0.8f, 1f); + FeatherParticle feather = new(spawnPosition, velocity, featherColor, scale, Main.rand.Next(360, 480), null, 0.8f, true, false, true); + + GeneralDrawLayer featherLayer = Utils.SelectRandom(Main.rand, GeneralDrawLayer.BeforeNPCs, GeneralDrawLayer.AfterNPCs); + GeneralParticleHandler.SpawnParticle(feather, manualDrawLayerOverride: featherLayer); + } + } + + // Small sparkles. + if (Main.rand.NextBool(45)) + { + int sparkleAmt = Main.rand.Next(1, 3); + for (int i = 0; i < sparkleAmt; i++) + { + Vector2 spawnPosition = NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(80f, 160f); + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + + QuickSparkleParticle sparkle = new(spawnPosition, Vector2.Zero, sparkleColor, Main.rand.NextFloat(0.2f, 0.3f), Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(sparkle, true); + } + } + } + + public void AnimateSprite() + { + if (Timer % 5 == 0f) + { + FrameY++; + if (FrameY >= Main.npcFrameCount[Type] - 1) + FrameY = 0; + + if (FrameY == 5) + NPC.velocity.Y -= (NPC.velocity.X != 0f) ? 2.2f : 0.46f; + } + } + + public void SoundEffects() + { + if (NPC.soundDelay == 0 && Main.rand.NextBool(200) && AIState == (int)BehaviorState.IdleAndFly) + { + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(IdleSound, NPC.Center); + + SquashVector = Utils.SelectRandom(Main.rand, new Vector2(1.4f, 0.7f), new Vector2(0.7f, 1.4f)); + AdditionalBrightness = Main.rand.NextFloat(0.3f, 0.4f); + NPC.soundDelay = Main.rand.Next(60, 120); + NPC.netUpdate = true; + } + + if (!SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out _)) + { + if (!CalamityClientConfig.Instance.MisophoniaSupport) + { + SwineSpeakSoundSlot = SoundEngine.PlaySound(SwineSpeakLoopingSound, NPC.Center, SoundCallbackMethod); + } + else + SwineSpeakSoundSlot = SoundEngine.PlaySound(MisophoniaSwineSpeakLoopingSound, NPC.Center, SoundCallbackMethod); + } + + // Fade the music depending on the distance between the player and Divine Swine. + float musicVolumeInterpolant = Utils.Remap(NPC.Distance(Main.LocalPlayer.Center), 600f, 100f, 1f, 0.2f, true); + Main.musicFade[Main.curMusic] = musicVolumeInterpolant; + } + + private bool SoundCallbackMethod(ActiveSound soundInstance) + { + soundInstance.Position = NPC.Center; + + float idealPitch = 0f; + bool raisePitchDuringBehavior = AIState == (int)BehaviorState.OfferingAccepted || AIState == (int)BehaviorState.PiggyTransformation; + if (raisePitchDuringBehavior) + idealPitch = 0.4f; + + float volumeInterpolant = Utils.Remap(NPC.Distance(Main.LocalPlayer.Center), 600f, 100f, 0.1f, 0.7f, true) * GlowingVisualScale; + soundInstance.Volume = volumeInterpolant; + soundInstance.Pitch = MathHelper.Lerp(soundInstance.Pitch, idealPitch, 0.075f); + return NPC.active; + } + + public void AcceptOffering(bool accepted) + { + SoundStyle offeringSound = accepted ? CoinPassSound : CoinFailSound; + SoundEngine.PlaySound(offeringSound, NPC.Center); + if (accepted) + SoundEngine.PlaySound(SoundID.Coins, NPC.Center); + + AIState = accepted ? (int)BehaviorState.OfferingAccepted : (int)BehaviorState.OfferingFailed; + Timer = 0f; + LocalAIState = 0f; + NPC.netUpdate = true; + NetMessage.SendData(MessageID.WorldData); + } + + private bool ShouldAvoidTile(Tile tile) => WorldGen.SolidTile(tile) || (tile.HasUnactuatedTile && Main.tileSolidTop[tile.TileType]) || tile.LiquidAmount >= 255; + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Sky && NPC.CountNPCS(Type) < 1) + return 0.001f; + return 0f; + } + + private static void DivineSwineRightClickInteraction(On_Main.orig_HoverOverNPCs orig, Main self, Rectangle mouseRectangle) + { + orig(self, mouseRectangle); + + Player player = Main.LocalPlayer; + foreach (NPC npc in Main.ActiveNPCs) + { + if (npc.type != ModContent.NPCType()) + continue; + + if ((!npc.ShowNameOnHover || !(npc.active & (npc.shimmerTransparency == 0f || npc.CanApplyHunterPotionEffects())))) + continue; + + Main.instance.LoadNPC(npc.whoAmI); + + Rectangle npcRectangle = new((int)(npc.Bottom.X - npc.frame.Width * 0.5f), (int)(npc.Bottom.Y - npc.frame.Height), npc.frame.Width, npc.frame.Height); + NPCLoader.ModifyHoverBoundingBox(npc, ref npcRectangle); + + bool hoveringOverHitbox = mouseRectangle.Intersects(npcRectangle); + bool canBeInteractedWith = hoveringOverHitbox || (Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == npc.whoAmI); + if (canBeInteractedWith && npc.ai[1] != 1) + { + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ItemID.PlatinumCoin; + player.cursorItemIconText = ""; + player.noThrow = 2; + + PlayerInput.SetZoom_MouseInWorld(); + if (Main.mouseRight && Main.npcChatRelease) + { + Main.npcChatRelease = false; + if (PlayerInput.UsingGamepad) + player.releaseInventory = false; + + if (player.talkNPC != npc.whoAmI && !player.tileInteractionHappened) + { + bool offeringState = TryOfferingPlatinumToSwine(); + npc.ModNPC().AcceptOffering(offeringState); + if (Main.netMode == NetmodeID.MultiplayerClient) + DivineSwineOfferingPacket.Send(npc.ModNPC(), offeringState); + } + } + } + + // Change the mouse display to just show the name and not the HP number. + if (hoveringOverHitbox && !player.mouseInterface) + { + self.MouseTextHackZoom(npc.GivenOrTypeName); + Main.mouseText = true; + } + } + } + + private static bool TryOfferingPlatinumToSwine() + { + Player player = Main.LocalPlayer; + bool inPiggyBank = false; + + int inventoryIndexSlot = player.FindItem(ItemID.PlatinumCoin); + int piggyBankIndexSlot = player.FindItem(ItemID.PlatinumCoin, player.bank.item); + if (piggyBankIndexSlot != -1) + inPiggyBank = true; + + if (inventoryIndexSlot == -1 && piggyBankIndexSlot == -1) + return false; + + Item foundItem = inPiggyBank ? player.bank.item[piggyBankIndexSlot] : player.inventory[inventoryIndexSlot]; + if (--foundItem.stack <= 0) + foundItem.TurnToAir(); + + Recipe.FindRecipes(); + return true; + } + + private static void AdjustLifeformAnalyzerTextColor(On_Main.orig_DrawInfoAccs_AdjustInfoTextColorsForNPC orig, Main self, NPC npc, ref Color infoTextColor, ref Color infoTextShadowColor) + { + orig(self, npc, ref infoTextColor, ref infoTextShadowColor); + if (npc.type == ModContent.NPCType()) + { + infoTextColor = Color.Lerp(DivineBlue, DivineYellow, MathF.Sin((float)Main.timeForVisualEffects / 45f) * 0.5f + 0.5f); + infoTextShadowColor = infoTextColor * 0.1f; + infoTextColor.A = Main.mouseTextColor; + infoTextShadowColor.A = Main.mouseTextColor; + } + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + + public override void FindFrame(int frameHeight) + { + if (NPC.IsABestiaryIconDummy) + { + NPC.frameCounter += 1; + if (NPC.frameCounter >= 5) + { + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) + NPC.frame.Y = 0; + else + NPC.frame.Y += frameHeight; + + NPC.frameCounter = 0; + } + + Timer++; + if (Timer >= 3600) + Timer = 0f; + + return; + } + + NPC.frame.Y = frameHeight * FrameY; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Draw_BestiaryPortrait(spriteBatch); + return false; + } + + spriteBatch.End(out var snapshot); + + Texture2D baseTexture = TextureAssets.Npc[Type].Value; + Vector2 drawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; + SpriteEffects spriteEffects = NPC.spriteDirection < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + // Draw the cool glowing sigil behind the Divine Swine. + Draw_DivineSigiliGlowyBullshit(spriteBatch, drawPosition); + + // Subtractive backing images. + spriteBatch.SetBlendState(CalamityUtils.SubtractiveBlending); + + int backShadowCount = 3; + for (int i = 0; i < backShadowCount; i++) + { + float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.08f) + NPC.whoAmI; + Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount + rotation) * 6f; + spriteBatch.Draw(baseTexture, backglowDrawPosition, NPC.frame, NPC.GetAlpha(Color.White) * 0.9f, NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale * GlowingVisualScale, spriteEffects, 0f); + } + + int backShadowCount2 = 6; + for (int i = 0; i < backShadowCount2; i++) + { + float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.06f) + NPC.whoAmI; + Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount2 + rotation) * 12f; + spriteBatch.Draw(baseTexture, backglowDrawPosition, NPC.frame, NPC.GetAlpha(Color.White) * 0.7f, NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale * GlowingVisualScale, spriteEffects, 0f); + } + + // Actual Divine Swine. + Effect tintShader = CalamityShaders.BasicTintShader.Value; + tintShader.Parameters["uColor"].SetValue(Color.White.ToVector3()); + tintShader.Parameters["uOpacity"].SetValue(DivineSwineTintStrength); + + spriteBatch.EnterShaderRegion(effect: tintShader); + spriteBatch.Draw(baseTexture, drawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, NPC.frame.Size() * 0.5f, SquashVector * NPC.scale, spriteEffects, 0f); + + spriteBatch.End(); + + // Offering accept visual of the reward item being conjured. + Draw_OfferingAcceptedVisual(spriteBatch, drawPosition); + + spriteBatch.Begin(snapshot); + return false; + } + + public void Draw_DivineSigiliGlowyBullshit(SpriteBatch spriteBatch, Vector2 drawPosition) + { + using var glowingBullshitLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth, Main.screenHeight, RenderTargetDescriptor.Default); + using var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + + // Buncha yellow-colored bloom stuff to look like a glowing sun. + using (spriteBatch.Scope()) + { + using (glowingBullshitLease.Scope(clearColor: Color.Transparent)) + { + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + + float bloomFlareScale = MathHelper.Lerp(0.4f, 0.7f, MathF.Sin((float)Main.timeForVisualEffects / 60f) * 0.5f + 0.5f) * GlowingVisualScale; + spriteBatch.Draw(BloomFlare.Value, drawPosition, null, NPC.GetAlpha(DivineYellow with { A = 0 }) * (0.8f + AdditionalBrightness), MathHelper.PiOver4, BloomFlare.Size() * 0.5f, bloomFlareScale, 0, 0f); + + spriteBatch.Draw(ShineFlare.Value, drawPosition, null, NPC.GetAlpha(DivineYellow with { A = 0 }) * (1f + AdditionalBrightness), 0f, MagicStarCircle.Size() * 0.5f, bloomFlareScale, 0, 0f); + spriteBatch.Draw(MagicStarCircle.Value, drawPosition, null, NPC.GetAlpha(DivineYellow with { A = 0 }) * (0.8f + AdditionalBrightness), 0f, MagicStarCircle.Size() * 0.5f, 0.5f * GlowingVisualScale, 0, 0f); + + spriteBatch.End(); + + Effect chromaAbberShader = CalamityShaders.ChromaticAbberationShader.Value; + chromaAbberShader.Parameters["abberationStrength"].SetValue(10f); + chromaAbberShader.Parameters["impactPosition"].SetValue(drawPosition); + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, chromaAbberShader, Matrix.Identity); + + float starRingScale = MathHelper.Lerp(0.7f, 1f, MathF.Sin((float)Main.timeForVisualEffects / 180f) * 0.5f + 0.5f) * GlowingVisualScale; + spriteBatch.Draw(FadedStarRing.Value, drawPosition, null, NPC.GetAlpha(DivineBlue with { A = 0 }) * (0.7f + AdditionalBrightness), (float)(Main.timeForVisualEffects / 720f) + NPC.whoAmI, FadedStarRing.Size() * 0.5f, starRingScale, 0, 0f); + + spriteBatch.End(); + } + } + + float distortionStrength = 0.034f; + using (spriteBatch.Scope()) + { + using (pixelationLease.Scope(clearColor: Color.Transparent)) + { + Effect distortionShader = CalamityShaders.BasicTextureDistortionShader.Value; + distortionShader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + distortionShader.Parameters["noiseScale"].SetValue(1.3f); + distortionShader.Parameters["distortionStrength"].SetValue(distortionStrength); + distortionShader.Parameters["timeOffset"].SetValue(new Vector2(-0.02f, 0.01f)); + + Main.graphics.GraphicsDevice.Textures[1] = DistortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, distortionShader, PixelationManager.PixelationMatrix); + spriteBatch.Draw(glowingBullshitLease.Target, Vector2.Zero, Color.White); + spriteBatch.End(); + } + } + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Vector2 targetDrawPosition = Main.ScreenSize.ToVector2() * 0.5f * distortionStrength; + spriteBatch.Draw(pixelationLease.Target, targetDrawPosition, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + } + + public void Draw_OfferingAcceptedVisual(SpriteBatch spriteBatch, Vector2 drawPosition) + { + if (AIState != (int)BehaviorState.OfferingAccepted) + return; + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + float bloomRotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.03f) + NPC.whoAmI; + float bloomMultiplier = CalamityUtils.PolyOutEasing(Utils.Remap(Timer, 0f, 30f, 0f, 1f, true), 2); + spriteBatch.Draw(BloomFlare.Value, drawPosition, null, NPC.GetAlpha(Color.White with { A = 0 }) * bloomMultiplier, bloomRotation, BloomFlare.Size() * 0.5f, 0.2f * bloomMultiplier, SpriteEffects.None, 0f); + spriteBatch.Draw(BloomFlare.Value, drawPosition, null, NPC.GetAlpha(Color.White with { A = 0 }) * 0.8f * bloomMultiplier, -bloomRotation * 0.5f, BloomFlare.Size() * 0.5f, 0.3f * bloomMultiplier, SpriteEffects.FlipVertically, 0f); + + spriteBatch.SetBlendState(CalamityUtils.SubtractiveBlending); + + int backShadowCount = 6; + float backShadowInterpolant = Utils.GetLerpValue(0f, 150f, Timer, true); + float backShadowDistance = MathHelper.Lerp(36f, 4f, backShadowInterpolant); + for (int i = 0; i < backShadowCount; i++) + { + float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.08f) + NPC.whoAmI; + Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount + rotation) * backShadowDistance; + spriteBatch.Draw(DeliciousMeatTexture.Value, backglowDrawPosition, DeliciousMeatTexture.Value.Frame(1, 3), NPC.GetAlpha(Color.White) * backShadowInterpolant, NPC.rotation, DeliciousMeatTexture.Value.Frame(1, 3).Size() * 0.5f, 1f, 0, 0f); + } + + spriteBatch.SetBlendState(BlendState.AlphaBlend); + + float shineInterpolant = Utils.GetLerpValue(150f, 210f, Timer, true); + float shineScale = CalamityUtils.SineOutEasing(0.8f * shineInterpolant, 0); + spriteBatch.Draw(BloomCircle.Value, drawPosition, null, NPC.GetAlpha(Color.White with { A = 0 }), NPC.rotation, BloomCircle.Size() * 0.5f, shineScale, 0, 0f); + spriteBatch.Draw(ShineFlare.Value, drawPosition, null, NPC.GetAlpha(Color.White with { A = 0 }), NPC.rotation, ShineFlare.Size() * 0.5f, shineScale - 0.4f, 0, 0f); + + spriteBatch.End(); + } + + public void Draw_BestiaryPortrait(SpriteBatch spriteBatch) + { + Texture2D baseTexture = TextureAssets.Npc[Type].Value; + float floatHeight = MathHelper.Lerp(-8f, 8f, MathF.Sin((float)Timer / 150f) * 0.5f + 0.5f); + Vector2 drawPosition = NPC.Center + Vector2.UnitY * floatHeight; + Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f); + + RasterizerState previousRasterizerState = spriteBatch.GraphicsDevice.RasterizerState; + Rectangle previousScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle; + using (spriteBatch.Scope()) + { + var device = Main.graphics.GraphicsDevice; + using var glowingBullshitLease = RenderTargetPool.Shared.Rent(device, Main.screenWidth, Main.screenHeight, RenderTargetDescriptor.Default); + using var pixelationLease = RenderTargetPool.Shared.Rent(device, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + using (glowingBullshitLease.Scope(clearColor: Color.Transparent)) + { + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + + float bloomFlareScale = MathHelper.Lerp(0.15f, 0.3f, MathF.Sin((float)Main.timeForVisualEffects / 60f) * 0.5f + 0.5f); + spriteBatch.Draw(BloomFlare.Value, drawPosition, null, NPC.GetAlpha(DivineYellow) with { A = 0 } * 0.4f, MathHelper.PiOver4, BloomFlare.Size() * 0.5f, bloomFlareScale, 0, 0f); + + spriteBatch.Draw(ShineFlare.Value, drawPosition, null, NPC.GetAlpha(DivineYellow) with { A = 0 } * 0.7f, 0f, MagicStarCircle.Size() * 0.5f, bloomFlareScale, 0, 0f); + spriteBatch.Draw(MagicStarCircle.Value, drawPosition, null, NPC.GetAlpha(DivineYellow) with { A = 0 } * 0.5f, 0f, MagicStarCircle.Size() * 0.5f, 0.25f, 0, 0f); + + Effect chromaAbberShader = CalamityShaders.ChromaticAbberationShader.Value; + chromaAbberShader.Parameters["abberationStrength"].SetValue(10f); + chromaAbberShader.Parameters["impactPosition"].SetValue(drawPosition); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, chromaAbberShader, Matrix.Identity); + + float starRingScale = MathHelper.Lerp(0.2f, 0.4f, MathF.Sin((float)Main.timeForVisualEffects / 180f) * 0.5f + 0.5f); + spriteBatch.Draw(FadedStarRing.Value, drawPosition, null, NPC.GetAlpha(DivineBlue) with { A = 0 } * 0.8f, (float)(Main.timeForVisualEffects / 720f) + NPC.whoAmI, FadedStarRing.Size() * 0.5f, starRingScale, 0, 0f); + + spriteBatch.End(); + } + + using (pixelationLease.Scope(clearColor: Color.Transparent)) + { + float distortionStrength = 0.0212f; + Effect distortionShader = CalamityShaders.BasicTextureDistortionShader.Value; + distortionShader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + distortionShader.Parameters["noiseScale"].SetValue(2.3f); + distortionShader.Parameters["distortionStrength"].SetValue(distortionStrength); + distortionShader.Parameters["timeOffset"].SetValue(new Vector2(-0.02f, 0.01f)); + + Main.graphics.GraphicsDevice.Textures[1] = DistortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap; + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, distortionShader, pixelationMatrix); + + Vector2 targetDrawPosition = Main.ScreenSize.ToVector2() * 0.5f * distortionStrength; + spriteBatch.Draw(glowingBullshitLease.Target, targetDrawPosition, Color.White with { A = 0 }); + + spriteBatch.End(); + } + + spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState; + spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle; + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, previousRasterizerState, null, Main.UIScaleMatrix); + + spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, CalamityUtils.SubtractiveBlending, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + + int backShadowCount = 3; + for (int i = 0; i < backShadowCount; i++) + { + float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.08f) + NPC.whoAmI; + Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount + rotation) * 6f; + spriteBatch.Draw(baseTexture, backglowDrawPosition, NPC.frame, NPC.GetAlpha(Color.White) * 0.9f, NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0f); + } + + int backShadowCount2 = 6; + for (int i = 0; i < backShadowCount2; i++) + { + float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.06f) + NPC.whoAmI; + Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount2 + rotation) * 12f; + spriteBatch.Draw(baseTexture, backglowDrawPosition, NPC.frame, NPC.GetAlpha(Color.White) * 0.7f, NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0f); + } + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(baseTexture, drawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0f); + + spriteBatch.End(); + } + } + } +} diff --git a/NPCs/NormalNPCs/DivineSwine.png b/NPCs/NormalNPCs/DivineSwine.png new file mode 100644 index 0000000000..102ea49286 Binary files /dev/null and b/NPCs/NormalNPCs/DivineSwine.png differ diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Attacks.cs b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Attacks.cs new file mode 100644 index 0000000000..831c92d378 --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Attacks.cs @@ -0,0 +1,901 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs.HorribleHog +{ + public partial class HorribleHog + { + #region Static Behavior Properties + public static int Damage_HogCharge => 14; + public static int Damage_ShockwaveProjectile => 13; + public static int Damage_ShockwaveRubbleProjectile => 12; + public static int Damage_VomitChunkProjectile => 13; + public static int Damage_VomitBombProjectile => 16; + public static int Damage_VomitEyeProjectile => 13; + + public static int ChaseTime => 180; + public static float ChasePlayer_MaxSpeed => 5f; + public static float ChasePlayer_MaxAcceleration => 0.3f; + + public static int HogCharge_PreChargeTime => 75; + public static int HogCharge_ChargingTime => 240; + public static int HogCharge_ChargeCooldownTime => CalamityWorld.revenge ? -20 : Main.expertMode ? -30 : -45; + public static int HogCharge_PreDashTime => 45; + public static int HogCharge_DashTime => 20; + public static int HogCharge_MaxCharges => CalamityWorld.revenge ? 4 : Main.expertMode ? 3 : 2; + public static float HogCharge_MaxSpeed => CalamityWorld.revenge ? 18f : Main.expertMode ? 15f : 12f; + public static float HogCharge_MaxAcceleration => CalamityWorld.revenge ? 0.425f : Main.expertMode ? 0.4f : 0.375f; + public static float HogCharge_MaxSlowdownDistance => CalamityWorld.revenge ? 64f : Main.expertMode ? 96f : 128f; + + public static int JumpAndDash_PreJumpTime => 75; + public static int JumpAndDash_JumpPreDashTime => 45; + public static int JumpAndDash_DashTime => 20; + public static int JumpAndDash_CooldownTime => 60; + public static int JumpAndDash_PreVomitTime => 60; + public static int JumpAndDash_PreGroundPoundTime => 45; + public static int JumpAndDash_MaxVomitChunks => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3; + public static int JumpAndDash_VomitTimeInterval => CalamityWorld.revenge ? 10 : 15; + public static int JumpAndDash_MaxBounces => Main.expertMode ? 3 : 2; + public static float JumpAndDash_MaxJumpHeight => 14f; + public static float JumpAndDash_MaxDashSpeed => 20f; + public static float JumpAndDash_MaxBounceSpeed => CalamityWorld.revenge ? 16f : Main.expertMode ? 14f : 12f; + + public static int HorribleHoller_RoarTime => 75; + public static int HorribleHoller_PostRoarCooldownTime => 30; + public static int HorribleHoller_MaxZombies => 3; + + public static int VomitBarrage_PreJumpTime => 75; + public static int VomitBarrage_VomitTime => 25; + public static int VomitBarrage_PostVomitCooldown => 100; + public static int VomitBarrage_MaxVomitChunks => CalamityWorld.revenge ? 10 : Main.expertMode ? 8 : 6; + public static int VomitBarrage_MinVomitBombs => CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 0; + public static int VomitBarrage_MaxVomitBombs => CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 3 : 4; + public static float VomitBarrage_MaxSpeed => 8f; + public static float VomitBarrage_MaxAcceleration => 0.45f; + #endregion + + public void MainBehavior_ChasePlayer(Player target) + { + // Whenever the player is able to be hit, don't modify velocity mid-air. + // Otherwise, move as any grounded NPC would in order to get back towards the player. + bool canHitPlayer = NPC.velocity.Y == 0f && Collision.CanHit(NPC, target); + if (canHitPlayer || !Collision.CanHit(NPC, target)) + { + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + GroundedMovement(target.Center, ChasePlayer_MaxSpeed, ChasePlayer_MaxAcceleration); + } + + bool jumpUpToPlayer = Main.expertMode && NPC.Center.Y - target.Center.Y >= 64f; + bool closeToPlayer = MathHelper.Distance(NPC.Center.X, target.Center.X) < 112f; + if (NPC.velocity.Y == 0f && jumpUpToPlayer && closeToPlayer) + { + NPC.velocity.Y -= 8f; + SoundEngine.PlaySound(JumpSound, NPC.Center); + } + + bool closeEnoughToAttack = MathHelper.Distance(NPC.Center.X, target.Center.X) <= 64f; + if (Timer >= ChaseTime || (closeEnoughToAttack && Timer >= 120f && NPC.velocity.Y == 0f)) + { + List possibleAttacks = [BehaviorState.JumpAndDash]; + if (NPC.Center.Y - target.Center.Y < 128) + possibleAttacks.Add(BehaviorState.HogCharge); + SwitchBehavior(BehaviorState.ChasePlayer, null, [.. possibleAttacks]); + } + + float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f; + NPC.rotation = idealRotation; + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, ChasePlayer_MaxSpeed, 9, 3, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + } + + public void MainBehavior_HogCharge(Player target) + { + if (LocalAIState == 0f) + { + if (Timer <= HogCharge_PreChargeTime) + { + float backupSpeed = MathHelper.Lerp(0.08f, 0.16f, Timer / HogCharge_PreChargeTime); + if (NPC.velocity.Y == 0f) + { + if (MathF.Abs(NPC.velocity.X) > 0.4f) + NPC.velocity.X *= 0.9f; + else + NPC.velocity.X -= backupSpeed * NPC.direction; + } + + Animate(MinFrame_Walking, MaxFrame_Walking, 7, true, dynamicChanges: true); + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + } + + if (Timer >= HogCharge_PreChargeTime) + { + Timer = 0f; + LocalAIState = 1f; + SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center); + NPC.netUpdate = true; + } + + NPC.rotation = 0f; + if (Timer % 15f == 0f && NPC.velocity.Y == 0f) + SoundEngine.PlaySound(SoundID.Run with { Pitch = -0.8f, Identifier = "Horrible Hog Run" }, NPC.Center); + } + + if (LocalAIState == 1f) + { + bool finishedWithCharges = Timer >= HogCharge_ChargingTime || MiscAttackCounter >= HogCharge_MaxCharges; + if (Timer <= 0f) + { + // Kill the hitbox when slowing down. + KillChargeHitboxProjectile(); + + if (NPC.velocity.Y == 0f) + NPC.velocity.X *= 0.93f; + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + NPC.rotation = 0f; + + Vector2 dustPosition = new(NPC.Bottom.X + Main.rand.NextFloat(-NPC.width * 0.5f, NPC.width * 0.5f), NPC.Bottom.Y); + Dust.NewDustPerfect(dustPosition, DustID.Cloud, new Vector2(NPC.velocity.X * 0.4f, Main.rand.NextFloat(-0.38f, 0.38f)), 120, Color.LightGray, Main.rand.NextFloat(1f, 1.2f)); + + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + if (Timer == -10 && !finishedWithCharges) + DoEyeGlintEffect(0.4f); + + FrameY = 20; + } + else + { + // Spawn an artificial hitbox that can knockback and hit both hostile and friendly enemies alongside the player. + if (!CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) && Main.netMode != NetmodeID.MultiplayerClient) + { + float knockback = 20f; + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), Damage_HogCharge, knockback, ai0: NPC.whoAmI); + } + + float maxSpeed = MathHelper.Lerp(HogCharge_MaxSpeed, HogCharge_MaxSpeed + 3.5f, MiscAttackCounter / HogCharge_MaxCharges); + float maxAcceleration = MathHelper.Lerp(HogCharge_MaxAcceleration, HogCharge_MaxAcceleration + 0.35f, MiscAttackCounter / HogCharge_MaxCharges); + if (MathF.Abs(NPC.velocity.X) < maxSpeed) + NPC.velocity.X += maxAcceleration * NPC.direction; + + // Turn around if the player jumps over to the other side of it. + bool turnLeft = NPC.direction == 1 && (NPC.Center.X - target.Center.X) > HogCharge_MaxSlowdownDistance; + bool turnRight = NPC.direction == -1 && (NPC.Center.X - target.Center.X) < -HogCharge_MaxSlowdownDistance; + bool hitAWall = NPC.collideX && MathF.Abs(NPC.velocity.X) >= maxSpeed * 0.8f; + if (((turnLeft || turnRight) && Timer > 30f) || finishedWithCharges || hitAWall) + { + if (hitAWall) + { + NPC.velocity.X = NPC.oldVelocity.X * -0.64f; + NPC.velocity.Y -= 5f; + } + + Timer = HogCharge_ChargeCooldownTime; + MiscAttackCounter++; + if (finishedWithCharges && PhaseTwo) + AltAttackVariant = Main.rand.Next(2); + + NPC.netUpdate = true; + } + + Vector2 dustPosition = new(NPC.Bottom.X + Main.rand.NextFloat(-NPC.width * 0.5f, NPC.width * 0.5f), NPC.Bottom.Y); + Dust.NewDustPerfect(dustPosition, DustID.Cloud, new Vector2(NPC.velocity.X * 0.2f, Main.rand.NextFloat(-0.3f, 0.3f)), 120, Color.LightGray, Main.rand.NextFloat(1f, 1.2f)); + if (Timer % 7 == 0f && NPC.velocity.Y == 0f) + SoundEngine.PlaySound(SoundID.Run with { Pitch = -0.4f, Identifier = "Horrible Hog Run" }, NPC.Center); + + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 1f, 0.15f); + + if (MiscAttackCounter >= HogCharge_MaxCharges + 1) + { + KillChargeHitboxProjectile(); + if (PhaseTwo && AltAttackVariant == 1f) + { + LocalAIState = 2f; + Timer = 0f; + NPC.netUpdate = true; + } + else + { + List possibleAttacks = [BehaviorState.HorribleHoller, BehaviorState.JumpAndDash, BehaviorState.VomitBarrage]; + SwitchBehavior(BehaviorState.HogCharge, null, [.. possibleAttacks]); + } + } + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, maxSpeed, 6, 2, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + + NPC.damage = 0; + NPC.rotation = 0f; + } + } + + // Alt attack in phase two. + // Same jump and dash but with a smaller shockwave. + if (LocalAIState == 2f) + AltBehavior_HogCharge_JumpAndDash(target); + + // Rebounding, land and switch attacks. + if (LocalAIState == 3f) + { + if (NPC.velocity.Y == 0f && Timer > 2f) + { + List possibleAttacks = [BehaviorState.HorribleHoller, BehaviorState.JumpAndDash, BehaviorState.VomitBarrage]; + SwitchBehavior(BehaviorState.HogCharge, null, [.. possibleAttacks]); + } + + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.075f); + SpriteRotation = SpriteRotation.AngleLerp(0f, 0.075f); + } + } + + public void AltBehavior_HogCharge_JumpAndDash(Player target) + { + if (Timer == 0f) + { + NPC.velocity.Y = -JumpAndDash_MaxJumpHeight * 1.2f; + NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.4f * NPC.direction; + DoJumpEffects(); + UseBalledSprite = true; + } + + if (Timer <= HogCharge_PreDashTime) + { + NPC.velocity.Y *= 0.98f; + NPC.velocity.X *= 0.96f; + + SetSquashVectors(new Vector2(1.06f, 0.94f)); + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction; + + if (Timer <= HogCharge_PreDashTime - 10) + { + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + LastPlayerPosition = target.Center; + if (Timer == HogCharge_PreDashTime - 10) + DoEyeGlintEffect(0.6f); + } + } + + if (Timer == HogCharge_PreDashTime) + { + NPC.noGravity = true; + NPC.velocity = NPC.SafeDirectionTo(LastPlayerPosition) * JumpAndDash_MaxDashSpeed; + + UseBalledSprite = false; + FrameY = JumpFrame; + SetSquashVectors(new Vector2(1.12f, 0.96f)); + SpriteRotation = 0f; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center); + } + + if (Timer >= HogCharge_PreDashTime && Timer <= HogCharge_PreDashTime + HogCharge_DashTime) + { + if (NPC.collideX || NPC.collideY || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + // Spawn shockwave on tile impact. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 2; i++) + SpawnShockwave(2, 6, (i > 0).ToDirectionInt(), 1f, 2f); + } + + CalamityUtils.AddScreenshakeAt(NPC.Center, 6f); + Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height); + SoundEngine.PlaySound(GroundImpactSound, NPC.Center); + + UseBalledSprite = true; + NPC.velocity.X = NPC.DirectionFrom(target.Center).SafeNormalize(Vector2.UnitX).X * 3f; + NPC.velocity.Y = -10f; + LocalAIState = 3f; + Timer = 0f; + NPC.netUpdate = true; + } + + NPC.noGravity = true; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + FrameY = JumpFrame; + } + + if (Timer >= HogCharge_PreDashTime + HogCharge_DashTime) + { + if (NPC.velocity.Y == 0f) + { + UseBalledSprite = false; + FrameY = IdleFrame; + SetSquashVectors(); + LocalAIState = 3f; + Timer = 0f; + NPC.netUpdate = true; + } + + NPC.GravityMultiplier *= 3f; + NPC.velocity.X *= 0.95f; + SpriteRotation = 0f; + UseBalledSprite = true; + } + + SetSquashVectors(VelocityBasedSquashNStretch); + } + + public void MainBehavior_JumpAndDash(Player target) + { + // Stop, jump and dash towards the target. + if (LocalAIState == 0f) + { + if (Timer <= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime) + { + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + if (Timer < JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime - 15) + LastPlayerPosition = target.Center; + } + + if (Timer <= JumpAndDash_PreJumpTime) + { + GroundedMovement(target.Center, ChasePlayer_MaxSpeed, ChasePlayer_MaxAcceleration, slowdownDistance: 160f); + float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.175f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f; + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.075f); + + int preJumpVisualsTime = JumpAndDash_PreJumpTime - 30; + if (Timer >= preJumpVisualsTime) + { + NPC.velocity.X *= 0.96f; + float interpolant = Utils.GetLerpValue(preJumpVisualsTime, VomitBarrage_PreJumpTime, Timer, true); + HorizontalShakeStrength = MathHelper.Lerp(0f, 6f, interpolant); + SetSquashVectors(new Vector2(1.24f, 0.84f)); + FrameY = BalledUpFrame; + } + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, ChasePlayer_MaxSpeed, 8, 2, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + } + + if (Timer == JumpAndDash_PreJumpTime) + { + NPC.velocity.Y = -JumpAndDash_MaxJumpHeight; + NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.2f * NPC.direction; + + DoJumpEffects(); + UseBalledSprite = true; + SetSquashVectors(new Vector2(0.84f, 1.14f)); + HorizontalShakeStrength = 0f; + } + + if (Timer >= JumpAndDash_PreJumpTime && Timer <= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime) + { + NPC.velocity.Y *= 0.98f; + NPC.velocity.X *= 0.96f; + + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction; + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 1f, 0.15f); + if (Timer == JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime - 10) + DoEyeGlintEffect(0.4f); + } + + if (Timer == JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime) + { + NPC.noGravity = true; + NPC.velocity = NPC.SafeDirectionTo(LastPlayerPosition) * JumpAndDash_MaxDashSpeed; + + UseBalledSprite = false; + SpriteRotation = 0f; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center); + } + + if (Timer >= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime && Timer <= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime + JumpAndDash_DashTime) + { + if (NPC.collideX || NPC.collideY || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + // Spawn shockwave on tile impact. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 2; i++) + { + int shockwaveAmt = PhaseTwo ? 14 : 8; + SpawnShockwave(2, shockwaveAmt, (i > 0).ToDirectionInt(), 1f, 3f); + } + } + + NPC.velocity.X = NPC.DirectionFrom(target.Center).SafeNormalize(Vector2.UnitX).X * 5f; + NPC.velocity.Y = PhaseTwo ? -16f : -12f; + LocalAIState = 1f; + Timer = 0f; + AltAttackVariant = Main.rand.Next(2); + + UseBalledSprite = true; + CalamityUtils.AddScreenshakeAt(NPC.Center, 6f); + Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height); + SoundEngine.PlaySound(GroundImpactSound, NPC.Center); + + NPC.netUpdate = true; + } + + NPC.noGravity = true; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + FrameY = JumpFrame; + } + + if (Timer >= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime + JumpAndDash_DashTime) + { + if (NPC.velocity.Y == 0f) + { + UseBalledSprite = false; + FrameY = IdleFrame; + LocalAIState = 2f; + Timer = 0f; + NPC.netUpdate = true; + } + + NPC.GravityMultiplier *= 3f; + NPC.velocity.X *= 0.95f; + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + } + + if (Timer > JumpAndDash_PreJumpTime) + SetSquashVectors(VelocityBasedSquashNStretch); + } + + // Rebounding after ground collision. + if (LocalAIState == 1f) + { + // Randomly perform two smaller attacks right after the main dash in Phase two. + if (PhaseTwo) + { + // Alt attck #1: + // Shoot vomit chunks at the player. + // Shoot more in higher difficulties. + // + // Alt attack #2: + // Bounce on the ground near the player predictively. + // In Death Mode and above, perform a large ground pound after the last bounce. + + if (AltAttackVariant == 0f) + AltBehavior_JumpAndDash_VomitChunks(target); + else if (AltAttackVariant == 1f) + AltBehavior_JumpAndDash_GroundPound(target); + } + else + { + if (NPC.collideY && Timer > 2f) + { + LocalAIState = 2f; + Timer = 0f; + NPC.netUpdate = true; + } + + SetSquashVectors(); + SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + } + } + + // Landed back on the ground. + if (LocalAIState == 2f) + { + NPC.velocity.X *= 0.94f; + if (NPC.velocity.Y == 0f) + { + UseBalledSprite = false; + NPC.rotation = 0f; + SpriteRotation = 0f; + } + + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.075f); + SpriteRotation = SpriteRotation.AngleLerp(0f, 0.075f); + SetSquashVectors(); + FrameY = IdleFrame; + + if (Timer >= JumpAndDash_CooldownTime && NPC.velocity.Y == 0f) + { + List possibleAttacks = [BehaviorState.VomitBarrage, BehaviorState.HorribleHoller]; + if (NPC.Center.Y - target.Center.Y < 128) + possibleAttacks.Add(BehaviorState.HogCharge); + + SwitchBehavior(BehaviorState.JumpAndDash, null, [.. possibleAttacks]); + } + } + } + + public void AltBehavior_JumpAndDash_VomitChunks(Player target) + { + if (Timer <= JumpAndDash_PreVomitTime) + { + NPC.velocity *= 0.98f; + NPC.GravityMultiplier *= 0.84f; + if (Timer == JumpAndDash_PreVomitTime - 10) + DoEyeGlintEffect(0.6f); + } + + if (Timer >= JumpAndDash_PreVomitTime) + { + if (Timer % JumpAndDash_VomitTimeInterval == 0f && MiscAttackCounter < JumpAndDash_MaxVomitChunks) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxVomitPerShot = 2; + for (int i = 0; i < maxVomitPerShot; i++) + { + Vector2 chunkVelocity = NPC.SafeDirectionTo(target.Center).RotatedBy(MathHelper.ToRadians(MathHelper.Lerp(-22f, 22f, i / (maxVomitPerShot - 1)))) * 14f; + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, chunkVelocity, ModContent.ProjectileType(), Damage_VomitChunkProjectile, 0f); + } + } + + Vector2 knockbackVelocity = NPC.DirectionFrom(target.Center).SafeNormalize(-Vector2.UnitY); + NPC.velocity = knockbackVelocity * new Vector2(3f, 5f); + + FrameY = VomitFrame; + SoundEngine.PlaySound(SoundID.DD2_OgreSpit, NPC.Center); + MiscAttackCounter++; + NPC.netUpdate = true; + } + + if (MiscAttackCounter >= JumpAndDash_MaxVomitChunks && NPC.velocity.Y == 0f) + { + FrameY = JumpFrame; + LocalAIState = 2f; + Timer = 0f; + NPC.netUpdate = true; + } + + FrameY = JumpFrame; + } + + SetSquashVectors(); + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + NPC.rotation = NPC.rotation.AngleLerp(NPC.AngleTo(target.Center) + (NPC.direction > 0 ? 0f : -MathHelper.Pi), 0.15f); + SpriteRotation = 0f; + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + } + + public void AltBehavior_JumpAndDash_GroundPound(Player target) + { + // Using plus 1 here cause the first bounce is coming off of the rebound. + if (MiscAttackCounter <= JumpAndDash_MaxBounces) + { + if (NPC.velocity.Y == 0f) + { + if (MiscAttackCounter == JumpAndDash_MaxBounces) + { + if (!CalamityWorld.death) + { + LocalAIState = 2f; + } + else + { + // Try to bounce in front of the player for the ground pound. + Vector2 bounceVelocity = (target.Center.X > NPC.Center.X) ? new Vector2(18f, -20f) : new Vector2(-18f, -20f); + NPC.velocity = bounceVelocity; + } + + Timer = 0f; + } + else + { + float speedByDistance = Utils.Remap(MathHelper.Distance(target.Center.X, NPC.Center.X), 60f, 600f, 4f, 10f, true); + float xVelocity = speedByDistance * (target.Center.X > NPC.Center.X).ToDirectionInt(); + NPC.velocity = new Vector2(xVelocity, -11.25f); + } + + if (Main.netMode != NetmodeID.MultiplayerClient && MiscAttackCounter > 0f) + { + for (int i = 0; i < 2; i++) + SpawnShockwave(2, 4, (i > 0).ToDirectionInt(), 1f, 2f); + + for (int i = 0; i < MiscAttackCounter; i++) + { + Vector2 rubbleVelocityRight = new Vector2(2f + i * 3f, -8f - i * 1.25f); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Bottom, rubbleVelocityRight, ModContent.ProjectileType(), Damage_ShockwaveProjectile, 1f); + Vector2 rubbleVelocityLeft = new Vector2(-2f - i * 3f, -8f - i * 1.25f); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Bottom, rubbleVelocityLeft, ModContent.ProjectileType(), Damage_ShockwaveProjectile, 1f); + } + } + + CalamityUtils.AddScreenshakeAt(NPC.Center, 4f); + SoundEngine.PlaySound(HitSound with { Pitch = -0.4f }, NPC.Center); + MiscAttackCounter++; + NPC.netUpdate = true; + } + + if (NPC.velocity.Y > 1f && NPC.velocity.Y < 24f && MiscAttackCounter > 0f) + { + NPC.velocity.Y *= 1.12f; + NPC.velocity.X *= 0.96f; + NPC.noGravity = true; + } + } + + // Ground pound attack in Death Mode. + if (CalamityWorld.death && MiscAttackCounter >= JumpAndDash_MaxBounces + 1) + { + if (Timer < JumpAndDash_PreGroundPoundTime) + { + NPC.velocity *= 0.96f; + NPC.GravityMultiplier *= 0.4f; + if (Timer == JumpAndDash_PreGroundPoundTime - 10) + DoEyeGlintEffect(0.6f); + } + else + { + NPC.noGravity = true; + } + + if (Timer == JumpAndDash_PreGroundPoundTime) + { + NPC.velocity.Y = 30f; + NPC.velocity.X *= 0f; + } + + if (Timer > JumpAndDash_PreGroundPoundTime && NPC.velocity.Y == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + SpawnShockwave(2, 20, (target.Center.X > NPC.Center.X).ToDirectionInt(), 1f, 8f); + + NPC.velocity.X = NPC.DirectionFrom(target.Center).SafeNormalize(Vector2.UnitX).X * 4f; + NPC.velocity.Y = -12f; + LocalAIState = 2f; + Timer = 0f; + + CalamityUtils.AddScreenshakeAt(NPC.Center, 8f); + Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height); + SoundEngine.PlaySound(GroundImpactSound, NPC.Center); + + NPC.netUpdate = true; + } + } + + NPC.damage = 0; + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction; + SetSquashVectors(VelocityBasedSquashNStretch); + UseBalledSprite = true; + } + + public void MainBehavior_HorribleHoller(Player target) + { + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + if (NPC.velocity.Y == 0f) + NPC.velocity.X *= 0.9f; + + if (Timer <= HorribleHoller_RoarTime) + { + if (Timer == HorribleHoller_RoarTime - 30) + { + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + CalamityUtils.AddScreenshakeAt(NPC.Center, 6f); + NPC.velocity.Y -= 6f; + } + + // Spawn the Zombie Spawner projectiles on top of tiles. + if (Timer == HorribleHoller_RoarTime) + { + for (int i = 0; i < HorribleHoller_MaxZombies; i++) + { + int maxTileRange = 12; + Vector2 zombieSpawnPosition = NPC.Center + new Vector2(Main.rand.Next(-maxTileRange * 16, (maxTileRange + 1) * 16), 0f); + Vector2 actualSpawnPosition = FindSuitableGround(zombieSpawnPosition.ToTileCoordinates()).ToWorldCoordinates() + Vector2.UnitY * 16f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTime = 150 + Main.rand.Next(31); + Projectile.NewProjectile(NPC.GetSource_FromThis(), actualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, maxTime); + } + } + } + + if (Timer >= HorribleHoller_RoarTime - 30) + Animate(MinFrame_Roar, MaxFrame_Roar, HorribleHoller_RoarTime / (MaxFrame_Roar + 1), true, MaxFrame_Roar - 1); + } + + if (Timer >= HorribleHoller_RoarTime) + Animate(MinFrame_RoarFinish, MaxFrame_RoarFinish, 4, false); + + float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.125f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f; + if (Timer >= HorribleHoller_RoarTime - 30 && Timer <= HorribleHoller_RoarTime) + targetAngle = (NPC.velocity.Y != 0f) ? (NPC.direction < 0 ? MathHelper.ToRadians(50f) : MathHelper.ToRadians(-50f)) : 0f; + + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.125f); + + if (Timer >= HorribleHoller_RoarTime + HorribleHoller_PostRoarCooldownTime) + { + List possibleAttacks = [BehaviorState.ChasePlayer, BehaviorState.VomitBarrage]; + SwitchBehavior(BehaviorState.HorribleHoller, null, [.. possibleAttacks]); + } + } + + public void MainBehavior_VomitBarrage(Player target) + { + if (LocalAIState == 0f) + { + if (Timer == 1f) + { + SoundEngine.PlaySound(VomitChargeUpSound, NPC.Center); + if (PhaseTwo && CalamityWorld.revenge) + { + AltAttackVariant = Main.rand.Next(2); + NPC.netUpdate = true; + } + } + + // Move away from the player. + if (Timer <= VomitBarrage_PreJumpTime) + { + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + GroundedMovement(target.Center, VomitBarrage_MaxSpeed, ChasePlayer_MaxAcceleration, slowdownDistance: 200f); + + float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.135f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f; + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.125f); + + int preJumpVisualsTime = VomitBarrage_PreJumpTime - 30; + if (Timer >= preJumpVisualsTime) + { + NPC.velocity.X *= 0.96f; + float interpolant = Utils.GetLerpValue(preJumpVisualsTime, VomitBarrage_PreJumpTime, Timer, true); + HorizontalShakeStrength = MathHelper.Lerp(0f, 6f, interpolant); + SetSquashVectors(new Vector2(1.24f, 0.84f)); + } + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 9, 3, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + } + + // Jump and shoot a bunch of vomit projectiles shortly afterwards. + if (Timer == VomitBarrage_PreJumpTime) + { + NPC.velocity.Y = -JumpAndDash_MaxJumpHeight; + NPC.velocity.X = -12f * NPC.direction; + + HorizontalShakeStrength = 0f; + DoJumpEffects(6, 9); + SetSquashVectors(squashVector: new Vector2(0.84f, 1.14f)); + } + + if (Timer >= VomitBarrage_PreJumpTime && Timer <= VomitBarrage_PreJumpTime + VomitBarrage_VomitTime) + { + NPC.velocity.Y *= 0.98f; + NPC.velocity.X *= 0.96f; + + float targetAngle = NPC.direction < 0 ? MathHelper.ToRadians(50f) : MathHelper.ToRadians(-50f); + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.075f); + } + + if (Timer == JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime) + { + bool spawnEyeballs = PhaseTwo && CalamityWorld.revenge && AltAttackVariant == 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < VomitBarrage_MaxVomitChunks; i++) + { + int projectileType = ModContent.ProjectileType(); + int damage = Damage_VomitChunkProjectile; + + // Randomly replace chunks with bombs in Expert and above. + bool vomitBombFloorNotReached = MiscAttackCounter < VomitBarrage_MinVomitBombs; + bool vomitBombCeilingNotReached = Main.rand.NextBool(4) && MiscAttackCounter >= VomitBarrage_MinVomitBombs && MiscAttackCounter < VomitBarrage_MaxVomitBombs; + if (Main.expertMode && (vomitBombFloorNotReached || vomitBombCeilingNotReached)) + { + projectileType = ModContent.ProjectileType(); + damage = Damage_VomitBombProjectile; + MiscAttackCounter++; + } + + // Replace chunks with homing Demon Eyes in Rev+ during phase two when the alt attack is picked. + if (spawnEyeballs) + { + projectileType = ModContent.ProjectileType(); + damage = Damage_VomitEyeProjectile; + } + + Vector2 vomitVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, target.Center + new Vector2(Main.rand.NextFloat(-16f, 16f), 0f), 0.125f, Main.rand.NextFloat(5f, 8f)); + vomitVelocity.X *= Main.rand.NextFloat(0.25f, 2.25f); + int vomit = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, vomitVelocity, projectileType, damage, 0f); + if (spawnEyeballs) + Main.projectile[vomit].ai[0] = Main.rand.Next(45, 75); + if (projectileType == ModContent.ProjectileType()) + Main.projectile[vomit].ai[1] = NPC.whoAmI; + } + } + + int vomitAmt = Main.rand.Next(12, 19); + for (int i = 0; i < vomitAmt; i++) + { + Vector2 velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, target.Center + new Vector2(Main.rand.NextFloat(-16f, 16f), 0f), 0.125f, Main.rand.NextFloat(5f, 8f)); + velocity.X *= Main.rand.NextFloat(1f, 2f); + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + + Dust.NewDust(NPC.Center, 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1.8f, 2.4f)); + } + + FrameY = VomitFrame; + SoundEngine.PlaySound(VomitSound with { Volume = 1.3f }, NPC.Center); + NPC.velocity.X = 6f * -NPC.direction; + NPC.velocity.Y += 2f; + } + + if (Timer > JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime && NPC.velocity.Y == 0f) + { + FrameY = IdleFrame; + LocalAIState = 1f; + Timer = 0f; + NPC.netUpdate = true; + } + } + + if (LocalAIState == 1f) + { + if (Timer >= VomitBarrage_PostVomitCooldown) + { + List possibleAttacks = [BehaviorState.HorribleHoller, BehaviorState.JumpAndDash]; + if (NPC.Center.Y - target.Center.Y < 128) + possibleAttacks.Add(BehaviorState.HogCharge); + SwitchBehavior(BehaviorState.VomitBarrage, null, [.. possibleAttacks]); + } + + // Do a small hiccup/burp after the attack. + int burpTime = VomitBarrage_PostVomitCooldown / 2; + if (Timer == burpTime) + { + SoundEngine.PlaySound(HiccupSound with { Volume = 1.25f }, NPC.Center); + SetSquashVectors(squashVector: new Vector2(0.84f, 1.14f)); + NPC.velocity.Y = -4.25f; + + int burpDustAmt = Main.rand.Next(6, 10); + for (int i = 0; i < burpDustAmt; i++) + { + Vector2 spawnPosition = NPC.Center + new Vector2(8f * NPC.direction, -8f); + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + NPC.rotation) * Main.rand.NextFloat(3f, 5f) * NPC.direction; + Dust.NewDust(spawnPosition, 1, 1, DustID.FartInAJar, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + } + + if (NPC.velocity.Y == 0f) + NPC.velocity.X *= 0.9f; + + float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.135f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f; + if (Timer >= burpTime && Timer <= VomitBarrage_PostVomitCooldown) + targetAngle = (NPC.velocity.Y != 0f) ? (NPC.direction < 0 ? MathHelper.ToRadians(30f) : MathHelper.ToRadians(-30f)) : 0f; + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.125f); + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 9, 3, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + } + } + + private void SpawnShockwave(int spawnImterval, int maxShockwaves, int direction, float minHeightMultiplier, float maxHeightMultiplier) + { + int spawnerIndex = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Bottom, Vector2.Zero, ModContent.ProjectileType(), Damage_ShockwaveProjectile, 0f); + Main.projectile[spawnerIndex].ModProjectile().OwnerIndex = NPC.whoAmI; + Main.projectile[spawnerIndex].ai[0] = spawnImterval; + Main.projectile[spawnerIndex].ai[1] = maxShockwaves; + Main.projectile[spawnerIndex].ai[2] = direction; + Main.projectile[spawnerIndex].localAI[0] = minHeightMultiplier; + Main.projectile[spawnerIndex].localAI[1] = maxHeightMultiplier; + Main.projectile[spawnerIndex].netUpdate = true; + } + + private void KillChargeHitboxProjectile() + { + if (CalamityUtils.AnyProjectiles(ModContent.ProjectileType())) + { + int hitboxIndex = CalamityUtils.FindFirstProjectile(ModContent.ProjectileType()); + if (Main.projectile.IndexInRange(hitboxIndex) && Main.projectile[hitboxIndex].ai[0] == NPC.whoAmI) + { + Main.projectile[hitboxIndex].Kill(); + Main.projectile[hitboxIndex].netUpdate = true; + } + } + } + } +} diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs new file mode 100644 index 0000000000..b32b03a445 --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs @@ -0,0 +1,549 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs.HorribleHog +{ + public partial class HorribleHog + { + #region Static Behavior Properties + public static float EngageDistance => 300f; + public static float Idle_MaxSpeed => 2f; + public static float Idle_MaxAcceleration => 0.125f; + + public static int DigTowardsTarget_PreJumpTime => 30; + public static int DigTowardsTarget_FindSuitablePositionTime => 120; + public static int DigTowardsTraget_MaxDiggingTime => 180; + #endregion + + public void MainBehavior_PiggyTransformation() + { + NPC.ShowNameOnHover = false; + NPC.dontTakeDamage = true; + NPC.damage = 0; + NPC.velocity.X *= 0.9f; + NPC.rotation *= 0.9f; + SpriteRotation *= 0.9f; + + float volumeMultiplier = Utils.GetLerpValue(0f, 45f, Timer, true) * Utils.GetLerpValue(240f, 190f, Timer, true); + DevilsTongueVolumeMultiplier = volumeMultiplier; + + float tintStrength = Utils.GetLerpValue(0f, 45f, Timer, true); + TintStrength = tintStrength; + TintColorTarget = Color.White; + + float shakeStrength = Utils.Remap(Timer, 0f, 180f, 0f, 5f, true); + HorizontalShakeStrength = shakeStrength; + + float distanceFromHog = Main.LocalPlayer.Distance(NPC.Center); + if (distanceFromHog < 400f) + { + float screenshakeStrength = Utils.Remap(distanceFromHog, 400f, 100f, 0f, 3f, true) * Utils.GetLerpValue(0f, 180f, Timer, true); + Main.LocalPlayer.SetScreenshake(screenshakeStrength); + } + + if (Timer >= 45f) + { + float smokeOpacity = 1.2f * Utils.GetLerpValue(45f, 75f, Timer, true); + int smokeAmt = Main.rand.Next(2, 5); + for (int i = 0; i < smokeAmt; i++) + { + Color color = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.NextBool(3) ? Main.rand.NextFloat(0.2f, 0.8f) : Main.rand.Next(2)); + int lifetime = Main.rand.Next(30, 45); + float scale = Main.rand.NextFloat(1.4f, 1.6f); + + HeavySmokeParticle circlingSmoke = new(NPC.Center, Main.rand.NextVector2Circular(16f, 16f), color, lifetime, scale, smokeOpacity, 0.01f, affectedByLight: true); + GeneralParticleHandler.SpawnParticle(circlingSmoke, true, Enums.GeneralDrawLayer.BeforeNPCs); + } + + float particleStrengthInterpolant = Utils.GetLerpValue(0f, 180f, Timer, true); + int lightSpawnRate = (int)MathHelper.Lerp(8, 1, particleStrengthInterpolant); + if (Main.rand.NextBool(lightSpawnRate)) + { + int lightAmt = (int)MathHelper.Lerp(1, 6, particleStrengthInterpolant); + for (int i = 0; i < Main.rand.Next(1, lightAmt + 1); i++) + { + float lightSpeed = MathHelper.Lerp(2f, 4f, particleStrengthInterpolant) * tintStrength; + float lightScale = MathHelper.Lerp(0.5f, 0.8f, particleStrengthInterpolant) * Main.rand.NextFloat(0.5f, 1f) * tintStrength; + + SquishyLightParticle transformLight = new(NPC.Center, Main.rand.NextVector2Circular(lightSpeed, lightSpeed), lightScale, Color.White, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(transformLight, true, Enums.GeneralDrawLayer.AfterNPCs); + } + } + } + + if (Timer % 30 == 0f) + { + float glowRingScale = Utils.Remap(Timer, 0f, 240f, 0.6f, 1.8f, true); + Color glowRingColor = Color.Lerp(Color.Crimson, Color.White, Utils.GetLerpValue(0f, 240f, Timer, true)); + CustomPulse transformRing = new(NPC.Center, Vector2.Zero, glowRingColor, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, glowRingScale, 45); + GeneralParticleHandler.SpawnParticle(transformRing, false); + } + + if (Timer >= 240f) + { + BloomParticle bloom = new(NPC.Center, Vector2.Zero, Color.White, 0f, 2.4f, 125); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(bloom, false, Enums.GeneralDrawLayer.AfterNPCs); + + CustomPulse glowRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 3f, 75); + GeneralParticleHandler.SpawnParticle(glowRing, false, Enums.GeneralDrawLayer.AfterNPCs); + + for (int i = 0; i < 25; i++) + { + QuickSparkleParticle sparkle = new(NPC.Center, Main.rand.NextVector2Circular(16f, 16f), Color.White, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(45, 60)); + SquishyLightParticle light = new(NPC.Center, Main.rand.NextVector2Circular(8f, 8f), Main.rand.NextFloat(0.6f, 0.8f), Color.White, Main.rand.Next(45, 60)); + GeneralParticleHandler.SpawnParticle(Main.rand.NextBool() ? sparkle : light, true, Enums.GeneralDrawLayer.AfterNPCs); + } + + SoundEngine.PlaySound(SoundID.Item29 with { Pitch = 0.25f, Volume = 0.25f }, NPC.Center); + if (SoundEngine.TryGetActiveSound(DevilsTongueSlot, out var activeSound)) + activeSound.Stop(); + + NPC.Transform(ModContent.NPCType()); + } + + Animate(IdleFrame, IdleFrame, 0, false, dynamicChanges: true); + } + + public void MainBehavior_EngageAnimation(Player target) + { + if (Timer >= 45f) + { + if (Timer == 45f) + { + FrameY = 0; + NPC.frameCounter = 0; + SoundEngine.PlaySound(SoundID.ForceRoarPitched, NPC.Center); + } + + if (Timer % 10f == 0f) + { + PulseRing hogRoar = new(NPC.Center, Vector2.Zero, Color.Red, 0f, 1.2f, 20); + GeneralParticleHandler.SpawnParticle(hogRoar, true); + } + + NPC.frameCounter++; + if (NPC.frameCounter >= 5 && FrameY < MaxFrame_RoarFinish) + { + FrameY++; + NPC.frameCounter = 0; + } + } + + if (Timer >= 120f) + SwitchBehavior(specificAttack: BehaviorState.ChasePlayer); + + NPC.velocity.X *= 0.9f; + NPC.spriteDirection = (target.Center.X > NPC.Center.X).ToDirectionInt(); + } + + public void MainBehavior_LaughAtDeadPlayer() + { + if (NPC.velocity.Y == 0f) + { + // LMFAOOOOOOOOOOOOOOOOOOOOOOOO + if (!SoundEngine.TryGetActiveSound(DeathLaughSoundSlot, out var _)) + { + DeathLaughSoundSlot = SoundEngine.PlaySound(CackleSound, NPC.Center, (activeSound) => + { + activeSound.Position = NPC.Center; + return AIState == (int)BehaviorState.LaughAtDeadPlayer; + }); + } + + NPC.direction *= -1; + NPC.velocity.Y -= 4f; + } + + SearchForTargetEveryFrame = true; + NPC.defense = 60; + NPC.damage = 0; + NPC.velocity.X *= 0.92f; + + float targetAngle = NPC.direction < 0 ? MathHelper.ToRadians(50f) : MathHelper.ToRadians(-50f); + NPC.rotation = (NPC.velocity.Y != 0f) ? NPC.rotation.AngleLerp(targetAngle, 0.075f) : 0f; + + Animate(MinFrame_Laughing, MaxFrame_Laughing); + + if (Timer >= 130f) + { + BehaviorState nextAttack = NPC.HasValidTarget ? BehaviorState.ChasePlayer : BehaviorState.Idle; + SwitchBehavior(specificAttack: nextAttack); + } + } + + public void MainBehavior_DespawnAnimation() + { + NPC.damage = 0; + + // Wait until Hog hits the ground before running the actual animation. + if (LocalAIState == 0f) + { + if (NPC.velocity.Y == 0f && Timer > 3f) + { + LocalAIState = 1f; + Timer = 0f; + NPC.netUpdate = true; + } + + NPC.GravityMultiplier *= 2f; + } + + if (LocalAIState == 1f) + { + // Jump into the ground and dig away. + if (Timer < DigTowardsTarget_PreJumpTime) + { + NPC.velocity.X *= 0.8f; + HorizontalShakeStrength = Utils.Remap(Timer, 0, DigTowardsTarget_PreJumpTime - 5, 0f, 6f, true); + SetSquashVectors(new Vector2(1.24f, 0.84f)); + } + + if (Timer == DigTowardsTarget_PreJumpTime) + { + NPC.velocity.Y -= 6f; + NPC.velocity.X += 4f * NPC.direction; + HorizontalShakeStrength = 0f; + SetSquashVectors(); + } + + if (Timer > DigTowardsTarget_PreJumpTime) + { + if (NPC.velocity.Y == 0f) + { + int dustAmt = Main.rand.Next(10, 15); + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, -2f)); + Dust.NewDust(dustPosition, 1, 1, DustID.Dirt, dustVelocity.X, dustVelocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + + int dustCloudAmt = Main.rand.Next(9, 13); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2f, -1f)); + Color color = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(1.2f, 1.4f), 1f, Main.rand.Next(45, 55), rotationSpeed); + GeneralParticleHandler.SpawnParticle(dustCloud, true); + } + + CalamityUtils.AddScreenshakeAt(NPC.Center, 5f); + SoundEngine.PlaySound(SoundID.Item70, NPC.Center); + + NPC.active = false; + NPC.netUpdate = true; + } + } + } + + float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f; + NPC.rotation = idealRotation; + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 120, 8, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + } + + public void MainBehavior_DeathAnimation() + { + SetSquashVectors(VelocityBasedSquashNStretch); + NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi); + SpriteRotation -= (MathHelper.TwoPi / 15f) * NPC.direction; + TintColor = Color.Red; + + if (Timer > 2 && (NPC.collideX || NPC.collideY || Collision.SolidCollision(NPC.position, NPC.width, NPC.height))) + { + if (MiscAttackCounter >= 3) + { + // Create smoke and throw up a big green "5000" on death just like the pigs in Angry Birds + for (int i = 0; i < 17; i++) + { + int goreType = Main.rand.Next(GoreID.Smoke1, GoreID.Smoke3 + 1); + Gore.NewGorePerfect(NPC.position, Main.rand.NextVector2Circular(2f, 2f), goreType); + } + + CombatText.NewText(NPC.Hitbox, Color.LawnGreen, 5000); + SoundEngine.PlaySound(NPC.DeathSound, NPC.Center); + Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height); + + NPC.life = 0; + NPC.checkDead(); + NPC.HitEffect(); + NPC.netUpdate = true; + } + else + { + SoundEngine.PlaySound(NPC.HitSound, NPC.Center); + TintStrength = 0.75f; + + MiscAttackCounter++; + NPC.velocity.X = NPC.oldVelocity.X * 0.6f; + NPC.velocity.Y = -10f; + + NPC.netUpdate = true; + } + + CalamityUtils.AddScreenshakeAt(NPC.Center, 4f); + } + + UseBalledSprite = true; + NPC.damage = 0; + NPC.GravityMultiplier *= 1.28f; + NPC.dontTakeDamage = true; + } + + public void MainBehavior_Idle(Player target) + { + bool targetIsVisible = target.Distance(NPC.Center) <= EngageDistance && Collision.CanHit(NPC, target); + bool wasHitByNearestTarget = NPC.HasValidTarget && NPC.justHit; + if (targetIsVisible || wasHitByNearestTarget) + { + SwitchBehavior(specificAttack: BehaviorState.EngageAnimation); + DoEyeGlintEffect(0.4f); + } + + // Standing still, occasionally switch directions. + if (LocalAIState == 0f) + { + if (Timer > 0f && Timer % 45f == 0f && Main.rand.NextBool(12)) + { + Timer = 0f; + LocalAIState = 1f; + NPC.netUpdate = true; + } + + if (NPC.velocity.Y == 0f) + NPC.velocity.X *= 0.8f; + + if (Timer % 45f == 0f && Main.rand.NextBool(4)) + NPC.direction *= -1; + } + + // Walking around aimlessly. + if (LocalAIState == 1f) + { + if (Timer > 0f && Timer % 45f == 0f && Main.rand.NextBool(6)) + { + Timer = 0f; + LocalAIState = 0f; + NPC.netUpdate = true; + } + + if (MathF.Abs(NPC.velocity.X) < Idle_MaxSpeed) + NPC.velocity.X += Idle_MaxAcceleration * NPC.direction; + + bool shouldJump = NPC.collideX || IsNPCApproachingHole(); + if (NPC.velocity.Y == 0f && shouldJump) + NPC.velocity.Y -= 6f; + } + + // Animation. + Animate(MinFrame_Walking, MaxFrame_Walking, 5, true, dynamicChanges: true); + NPC.rotation = 0f; + + // Idle sounds. + if (NPC.soundDelay == 0f && Main.rand.NextBool(250)) + { + SetSquashVectors(squashVector: new Vector2(1.24f, 0.84f)); + + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(IdleSound, NPC.Center); + + NPC.soundDelay = Main.rand.Next(30, 45); + } + + // Spawn ambient mist around itself while it idles. + Rectangle tileWorkSpace = GetTileWorkSpaceForMist(); + int tileWorkSpaceWithWidth = tileWorkSpace.X + tileWorkSpace.Width; + int tileWorkSpaceWithHeight = tileWorkSpace.Y + tileWorkSpace.Height; + for (int x = tileWorkSpace.X; x < tileWorkSpaceWithWidth; x++) + { + for (int y = tileWorkSpace.Y; y < tileWorkSpaceWithHeight; y++) + { + TrySpawningMist(x, y); + } + } + + // Tint slightly black. + TintColor = Color.Black; + TintStrength = 0.6f; + + NPC.chaseable = false; + SearchForTargetEveryFrame = true; + HorizontalShakeStrength = 0f; + } + + public void MainBehavior_DigTowardsTarget(Player target) + { + // Initial animation. + if (LocalAIState == 0f) + { + if (Timer < DigTowardsTarget_PreJumpTime) + { + NPC.velocity.X *= 0.8f; + HorizontalShakeStrength = Utils.Remap(Timer, 0, DigTowardsTarget_PreJumpTime - 5, 0f, 6f, true); + SetSquashVectors(new Vector2(1.24f, 0.84f)); + } + + if (Timer == DigTowardsTarget_PreJumpTime) + { + NPC.velocity.Y -= 6f; + HorizontalShakeStrength = 0f; + SetSquashVectors(squashVector: new Vector2(0.84f, 1.24f)); + SoundEngine.PlaySound(JumpSound, NPC.Center); + } + + if (Timer > DigTowardsTarget_PreJumpTime) + { + if (NPC.velocity.Y == 0f) + { + int dustAmt = Main.rand.Next(10, 15); + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, -2f)); + Dust.NewDust(dustPosition, 1, 1, DustID.Dirt, dustVelocity.X, dustVelocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + + int dustCloudAmt = Main.rand.Next(9, 13); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2f, -1f)); + Color color = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(1.2f, 1.4f), 1f, Main.rand.Next(45, 55), rotationSpeed); + GeneralParticleHandler.SpawnParticle(dustCloud, true); + } + + NPC.rotation = 0f; + SoundEngine.PlaySound(SoundID.Item70, NPC.Center); + LocalAIState = 1f; + Timer = 0f; + SetSquashVectors(); + NPC.netUpdate = true; + } + + NPC.rotation = MathHelper.Lerp(NPC.rotation, -MathHelper.PiOver2, 0.175f); + } + } + + // Search for a position around the player to emerge. + if (LocalAIState == 1f) + { + NPC.damage = 0; + NPC.dontTakeDamage = true; + NPC.Opacity = 0f; + + // Find closest spot around player. + if (Timer <= DigTowardsTarget_FindSuitablePositionTime) + { + DiggingEmergeSpot = FindSuitableGround(target.Bottom.ToTileCoordinates()).ToWorldCoordinates(); + } + else + { + float distanceInterpolant = Utils.GetLerpValue(800f, 200f, target.Distance(DiggingEmergeSpot), true); + float screenshake = Utils.Remap(Timer, DigTowardsTarget_FindSuitablePositionTime, DigTowardsTraget_MaxDiggingTime, 1f, 4f, true) * distanceInterpolant; + target.SetScreenshake(screenshake); + } + + if (Main.rand.NextBool(3)) + { + int dustAmt = Main.rand.Next(1, 3); + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustPosition = DiggingEmergeSpot + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-5f, -3f)); + Dust.NewDust(dustPosition, 1, 1, DustID.Dirt, dustVelocity.X, dustVelocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + } + + int dustCloudAmt = Main.rand.Next(1, 3); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = DiggingEmergeSpot + Main.rand.NextVector2Circular(NPC.width, 0f); + Vector2 velocity = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-5f, -3f)); + Color color = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(0.6f, 0.8f), 1f, Main.rand.Next(25, 45), rotationSpeed); + GeneralParticleHandler.SpawnParticle(dustCloud, true, Enums.GeneralDrawLayer.BeforeSolidTiles); + } + + // Play digging sounds. + if (Timer <= DigTowardsTarget_FindSuitablePositionTime) + { + if (!SoundEngine.TryGetActiveSound(DiggingSoundSlot, out _)) + { + DiggingSoundSlot = SoundEngine.PlaySound(DiggingSlowSound, NPC.Center, (activeSound) => + { + activeSound.Position = DiggingEmergeSpot; + return AIState == (int)BehaviorState.DigTowardsTarget && Timer <= 120; + }); + } + } + else + { + if (!SoundEngine.TryGetActiveSound(DiggingSoundSlot, out _)) + { + DiggingSoundSlot = SoundEngine.PlaySound(DiggingFastSound, NPC.Center, (activeSound) => + { + activeSound.Position = DiggingEmergeSpot; + activeSound.Volume = 1.5f; + return AIState == (int)BehaviorState.DigTowardsTarget && Timer >= 120 && Timer <= 180; + }); + } + } + + // Jump out. + if (Timer >= DigTowardsTraget_MaxDiggingTime) + { + CalamityUtils.AddScreenshakeAt(DiggingEmergeSpot, 4f); + SoundEngine.PlaySound(SoundID.Item70, DiggingEmergeSpot); + + NPC.Center = DiggingEmergeSpot; + NPC.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, target.Center, NPC.gravity, 7f) * new Vector2(1f, 1.45f); + DoJumpEffects(); + + LocalAIState = 2f; + Timer = 0f; + NPC.netUpdate = true; + } + + AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f); + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.075f); + SpriteRotation = SpriteRotation.AngleLerp(0f, 0.075f); + } + + // Land after jumping and go back to attacking. + if (LocalAIState == 2f) + { + NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 1f, 0.085f); + if (NPC.velocity.Y == 0f && Timer > 2f) + { + DoEyeGlintEffect(0.4f); + SwitchBehavior(specificAttack: BehaviorState.ChasePlayer); + } + + float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f; + NPC.rotation = idealRotation; + NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt(); + } + + int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 120, 8, true); + Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true); + + DigTimer = 0f; + SearchForTargetEveryFrame = true; + } + } +} diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.Drawing.cs b/NPCs/NormalNPCs/HorribleHog/HorribleHog.Drawing.cs new file mode 100644 index 0000000000..5235c05262 --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.Drawing.cs @@ -0,0 +1,271 @@ +using System; +using CalamityMod.Effects; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.NPCs.NormalNPCs.HorribleHog +{ + public partial class HorribleHog + { + public static float MinScaryAuraOpacityDistance => 400f; + public static float MaxScaryAuraOpacityDistance => 800f; + + public override void FindFrame(int frameHeight) + { + if (NPC.IsABestiaryIconDummy) + { + if (FrameY < IdleFrame) + FrameY = IdleFrame; + + NPC.frameCounter++; + if (NPC.frameCounter >= 5) + { + FrameY++; + if (FrameY > MaxFrame_Walking) + FrameY = MinFrame_Walking; + NPC.frameCounter = 0; + } + } + + NPC.frame.Y = FrameY * frameHeight; + } + + public void Animate(int startingFrame, int endingFrame, int frameSpeed = 6, bool loop = true, int? loopStartingFrame = null, bool dynamicChanges = false) + { + bool jumping = dynamicChanges && NPC.velocity.Y != 0f; + bool idling = dynamicChanges && MathF.Abs(NPC.velocity.X) < 0.06f && NPC.velocity.Y == 0f; + if (jumping) + { + FrameY = JumpFrame; + } + else if (idling) + { + FrameY = IdleFrame; + } + else + { + if (FrameY < startingFrame) + FrameY = startingFrame; + + if (NPC.frameCounter % frameSpeed == 0) + { + FrameY++; + if (FrameY > endingFrame) + { + if (loop) + { + if (loopStartingFrame.HasValue) + FrameY = loopStartingFrame.Value; + else + FrameY = startingFrame; + } + else + { + FrameY = endingFrame; + } + } + } + + NPC.frameCounter += 1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Draw_ScaryEvilFuckedUpAura(spriteBatch, screenPos, true); + return true; + } + + Texture2D baseTexture = TextureAssets.Npc[Type].Value; + Texture2D balledTexture = HorribleHog_BalledUp.Value; + SpriteEffects effects = NPC.spriteDirection > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 scale = NPC.scale * SquashVector; + + float textureHeight = baseTexture.Height / Main.npcFrameCount[Type]; + float yOffset = scale.Y * textureHeight * 0.05f; + Vector2 drawPosition = NPC.Center + new Vector2(0f, NPC.gfxOffY - yOffset) - screenPos; + + // Background effect when Horrible Hog is idling and its nearby loop is playing. + if (DevilsTongueVolumeMultiplier > 0.05f && AIState != (int)BehaviorState.PiggyTransformation) + Draw_ScaryEvilFuckedUpAura(spriteBatch, screenPos); + + // Horrible Hog and its afterimage trail. + using (spriteBatch.Scope()) + { + using var lease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth, Main.screenHeight, RenderTargetDescriptor.Default); + using (lease.Scope(clearColor: Color.Transparent)) + { + if (UseBalledSprite) + { + Rectangle frameRec = balledTexture.Frame(); + Effect rotateSpriteShader = CalamityShaders.RotateSprite.Value; + rotateSpriteShader.Parameters["rotation"].SetValue(SpriteRotation); + rotateSpriteShader.Parameters["spriteDimensions"].SetValue(balledTexture.Size()); + rotateSpriteShader.Parameters["spriteRectangle"].SetValue(new Vector4(frameRec.X, frameRec.Y, frameRec.Width, frameRec.Height)); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, rotateSpriteShader, Matrix.Identity); + + if (CalamityClientConfig.Instance.Afterimages && AfterimageTrailOpacity > 0.05f) + { + for (int i = 0; i < NPC.oldPos.Length; i++) + { + Color afterimageColor = Color.Red * AfterimageTrailOpacity * 0.76f; + afterimageColor *= (float)(NPC.oldPos.Length - i) / (float)NPC.oldPos.Length; + Vector2 afterimageDrawPosition = NPC.oldPos[i] - Vector2.UnitY * yOffset + NPC.Size * 0.5f - screenPos; + spriteBatch.Draw(balledTexture, afterimageDrawPosition, null, NPC.GetAlpha(afterimageColor), NPC.rotation, balledTexture.Size() * 0.5f, scale, effects, 0f); + } + } + + spriteBatch.Draw(balledTexture, drawPosition + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f), frameRec, NPC.GetAlpha(drawColor), NPC.rotation, balledTexture.Size() * 0.5f, scale, effects, 0f); + spriteBatch.End(); + } + else + { + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + + if (CalamityClientConfig.Instance.Afterimages && AfterimageTrailOpacity > 0.05f) + { + for (int i = 0; i < NPC.oldPos.Length; i++) + { + Color afterimageColor = Color.Red * AfterimageTrailOpacity * 0.76f; + afterimageColor *= (float)(NPC.oldPos.Length - i) / (float)NPC.oldPos.Length; + Vector2 afterimageDrawPosition = NPC.oldPos[i] - Vector2.UnitY * yOffset + NPC.Size * 0.5f - screenPos; + spriteBatch.Draw(baseTexture, afterimageDrawPosition, NPC.frame, NPC.GetAlpha(afterimageColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f); + } + } + + spriteBatch.Draw(baseTexture, drawPosition + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f); + spriteBatch.End(); + } + } + + Effect tintShader = CalamityShaders.BasicTintShader.Value; + tintShader.Parameters["uColor"].SetValue(TintColor.ToVector3()); + tintShader.Parameters["uOpacity"].SetValue(TintStrength); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, tintShader, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Draw(lease.Target, Vector2.Zero, Color.White); + spriteBatch.End(); + } + + // Eye glint. + if (EyeGlintScale > 0.05f) + { + Vector2 eyeGlintDrawPosition = drawPosition + new Vector2(18f * NPC.spriteDirection, -2f).RotatedBy(NPC.rotation) + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f); + + spriteBatch.SetBlendState(CalamityUtils.SubtractiveBlending); + for (int i = 0; i < 2; i++) + spriteBatch.Draw(ShineFlare.Value, eyeGlintDrawPosition, null, NPC.GetAlpha(Color.White) * 0.7f, NPC.rotation, ShineFlare.Size() * 0.5f, EyeGlintScale, 0, 0f); + spriteBatch.SetBlendState(BlendState.AlphaBlend); + + spriteBatch.Draw(ShineFlare.Value, eyeGlintDrawPosition, null, NPC.GetAlpha(Color.Red) with { A = 0 }, NPC.rotation, ShineFlare.Size() * 0.5f, EyeGlintScale * 0.8f, 0, 0f); + spriteBatch.Draw(ShineFlare.Value, eyeGlintDrawPosition, null, NPC.GetAlpha(Color.White) with { A = 0 }, NPC.rotation, ShineFlare.Size() * 0.5f, EyeGlintScale * 0.4f, 0, 0f); + } + + return false; + } + + private void Draw_ScaryEvilFuckedUpAura(SpriteBatch spriteBatch, Vector2 screenPos, bool bestiary = false) + { + RasterizerState previousRasterizerState = spriteBatch.GraphicsDevice.RasterizerState; + Rectangle previousScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle; + + using (spriteBatch.Scope()) + { + Vector2 drawPosition = NPC.Center - screenPos; + float radiusBasedOpacity = Utils.Remap(Main.LocalPlayer.Distance(NPC.Center), MinScaryAuraOpacityDistance, MaxScaryAuraOpacityDistance, 1f, 0.15f, true); + float generalEffectOpacity = bestiary ? MathHelper.Lerp(0.5f, 1f, MathF.Sin((float)Main.timeForVisualEffects / 75f) * 0.5f + 0.5f) : radiusBasedOpacity * DevilsTongueVolumeMultiplier; + float generalEffectScale = bestiary ? 0.5f : 1f; + Matrix transformatiomMatrix = bestiary ? Main.UIScaleMatrix : Main.GameViewMatrix.TransformationMatrix; + + Effect auraShader = CalamityShaders.HorribleHogAuraShader.Value; + auraShader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + auraShader.Parameters["colorPaletteLimit"].SetValue(16f); + auraShader.Parameters["spiralArms"].SetValue(5f); + auraShader.Parameters["spiralAdditionalAngle"].SetValue(6f); + auraShader.Parameters["minPixelFadeDistance"].SetValue(0.145f); + auraShader.Parameters["maxPixelFadeDistance"].SetValue(0.485f); + auraShader.Parameters["pixelationFactor"].SetValue(Main.ScreenSize.ToVector2() * 0.25f); + auraShader.Parameters["spiralTimeOffset"].SetValue(new Vector2(-0.08f, -0.05f)); + auraShader.Parameters["vortexDarkColor"].SetValue(new Color(8, 8, 8).ToVector3()); + auraShader.Parameters["vortexBrightColor"].SetValue(Color.Crimson.ToVector3()); + + Main.graphics.GraphicsDevice.Textures[1] = VortexTextureSecondary.Value; + Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap; + + Main.graphics.GraphicsDevice.Textures[2] = VortexDistortionTexture.Value; + Main.graphics.GraphicsDevice.SamplerStates[2] = SamplerState.PointWrap; + + // More accurate pixelation for the bestiary. + if (bestiary) + { + auraShader.Parameters["pixelationFactor"].SetValue(Main.ScreenSize.ToVector2()); + Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f); + using var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + using (pixelationLease.Scope(clearColor: Color.Transparent)) + { + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, auraShader, pixelationMatrix); + + spriteBatch.Draw(VortexTexture.Value, drawPosition, null, Color.White * generalEffectOpacity, 0f, VortexTexture.Size() * 0.5f, 1f * generalEffectScale, 0, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix); + + float bloomCircleOpacity = MathHelper.Lerp(0.6f, 0.9f, MathF.Sin((float)Main.timeForVisualEffects / 75f + NPC.whoAmI) * 0.5f + 0.5f) * generalEffectOpacity; + spriteBatch.Draw(BloomCircle.Value, drawPosition, null, Color.Crimson with { A = 0 } * bloomCircleOpacity, 0f, BloomCircle.Size() * 0.5f, 1.2f * generalEffectScale, 0, 0f); + + spriteBatch.End(); + } + + spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState; + spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle; + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, previousRasterizerState, null, transformatiomMatrix); + + spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + + spriteBatch.End(); + } + else + { + spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState; + spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle; + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, previousRasterizerState, auraShader, transformatiomMatrix); + + spriteBatch.Draw(VortexTexture.Value, drawPosition, null, Color.White * generalEffectOpacity, 0f, VortexTexture.Size() * 0.5f, 1f * generalEffectScale, 0, 0f); + + spriteBatch.End(); + + spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState; + spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle; + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, previousRasterizerState, null, transformatiomMatrix); + + float bloomCircleOpacity = MathHelper.Lerp(0.6f, 0.9f, MathF.Sin((float)Main.timeForVisualEffects / 75f + NPC.whoAmI) * 0.5f + 0.5f) * generalEffectOpacity; + spriteBatch.Draw(BloomCircle.Value, drawPosition, null, Color.Crimson with { A = 0 } * bloomCircleOpacity, 0f, BloomCircle.Size() * 0.5f, 1.2f * generalEffectScale, 0, 0f); + + spriteBatch.End(); + } + } + } + + private void SetSquashVectors(Vector2? squashVectorTarget = null, Vector2? squashVector = null) + { + SquashVectorTarget = squashVectorTarget ?? Vector2.One; + if (squashVector.HasValue) + SquashVector = squashVector.Value; + } + + private void DoEyeGlintEffect(float scale) + { + EyeGlintScale = scale; + float pitch = Utils.Remap(scale, 0.4f, 1f, 0.7f, 0.9f, true); + float volume = Utils.Remap(scale, 0.4f, 1f, 1.3f, 1.6f, true); + SoundEngine.PlaySound(SoundID.Item4 with { Volume = volume, Pitch = pitch }, NPC.Center); + } + } +} diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.cs b/NPCs/NormalNPCs/HorribleHog/HorribleHog.cs new file mode 100644 index 0000000000..b04feae8ff --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.cs @@ -0,0 +1,859 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Tools; +using CalamityMod.Particles; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using Terraria.ModLoader.Utilities; +using Terraria.Utilities; + +namespace CalamityMod.NPCs.NormalNPCs.HorribleHog +{ + public partial class HorribleHog : ModNPC + { + public enum BehaviorState + { + // Transitional behaviors. + PiggyTransformation = -5, + EngageAnimation = -4, + LaughAtDeadPlayer = -3, + DespawnAnimation = -2, + DeathAnimation = -1, + Idle, + DigTowardsTarget, + + // Attacks. + ChasePlayer, + HogCharge, + JumpAndDash, + HorribleHoller, + VomitBarrage, + } + + private static Asset HorribleHog_BalledUp; + private static Asset BloomCircle; + private static Asset ShineFlare; + private static Asset VortexTexture; + private static Asset VortexTextureSecondary; + private static Asset VortexDistortionTexture; + + private static SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/HorribleHogHit", 3); + private static SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/HorribleHogDeath"); + private static SoundStyle CackleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogCackle"); + private static SoundStyle HiccupSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogHiccup", 2); + private static SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogJump", 2); + private static SoundStyle GroundImpactSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogGroundImpact", 2); + private static SoundStyle VomitChargeUpSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp", 2); + private static SoundStyle VomitSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogVomit", 2); + private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogIdle", 2) + { + PitchVariance = 0.25f, + }; + private static SoundStyle DiggingSlowSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogDiggingSlow") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + private static SoundStyle DiggingFastSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogDiggingFast") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + private static SoundStyle DevilsTongueLoopingSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogNearbyLoop") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + private static SoundStyle MisophoniaDevilsTongueLoopingSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + + public Dictionary PreviousAttackCounters = []; + + public Dictionary AttackWeights = []; + + public bool SearchForTargetEveryFrame; + + public bool HasPlayedEngageAnimation; + + public bool HasPlayedDeathAnimation; + + public bool ReadyToPlayLaughingAnimation; + + public bool UseBalledSprite; + + public int FrameY; + + public float EyeGlintScale; + + public float AfterimageTrailOpacity; + + public float HorizontalShakeStrength; + + public float DevilsTongueVolumeMultiplier; + + public float TintStrength; + + public float SpriteRotation; + + public Vector2 LastPlayerPosition; + + public Vector2 DiggingEmergeSpot; + + public Vector2 SquashVector; + + public Vector2 SquashVectorTarget; + + public Color TintColor; + + public Color TintColorTarget; + + public SlotId DeathLaughSoundSlot; + + public SlotId DiggingSoundSlot; + + public SlotId DevilsTongueSlot; + + #region Static Behavior Properties + public static int MaxAttacks_ChasePlayer => 2; + public static int MaxAttacks_HogCharge => Main.expertMode ? 2 : 1; + public static int MaxAttacks_HorribleHoller => 1; + public static int MaxAttacks_JumpAndDash => Main.expertMode ? 3 : 2; + public static int MaxAttacks_VomitBarrage => Main.expertMode ? 2 : 1; + public static int MaxAttacksPerCycle => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3; + + public static int MaxTimeToStartDigging => 300; + + public static int MinFrame_Roar => 0; + public static int MaxFrame_Roar => 9; + public static int MinFrame_RoarFinish => 10; + public static int MaxFrame_RoarFinish => 13; + public static int MinFrame_Laughing => 8; + public static int MaxFrame_Laughing => 9; + public static int MinFrame_Walking => 15; + public static int MaxFrame_Walking => 23; + public static int JumpFrame => 24; + public static int IdleFrame => 14; + public static int BalledUpFrame => 19; + public static int VomitFrame => 2; + #endregion + + public ref float Timer => ref NPC.ai[0]; + + public ref float AIState => ref NPC.ai[1]; + + public ref float LocalAIState => ref NPC.ai[2]; + + public ref float MainAttackCounter => ref NPC.ai[3]; + + public ref float MiscAttackCounter => ref NPC.localAI[0]; + + public ref float AltAttackVariant => ref NPC.localAI[1]; + + public ref float DigTimer => ref NPC.localAI[2]; + + public Vector2 VelocityBasedSquashNStretch + { + get + { + float stretch = Utils.Remap(NPC.velocity.Length(), 0f, 20f, 1f, 1.08f); + Vector2 stretchedVector = new(1f * stretch, 1f - 1f * stretch * 0.3f); + return stretchedVector; + } + } + + public bool PhaseTwo + { + get + { + if (CalamityWorld.death || Main.getGoodWorld) + return NPC.life <= NPC.lifeMax * 0.7f; + + if (CalamityWorld.revenge) + return NPC.life <= NPC.lifeMax * 0.6f; + + return Main.expertMode && NPC.life <= NPC.lifeMax * 0.5f; + } + } + + public override void Load() + { + if (!Main.dedServ) + { + HorribleHog_BalledUp = ModContent.Request("CalamityMod/NPCs/NormalNPCs/HorribleHog/HorribleHog_BalledUp"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + ShineFlare = ModContent.Request("CalamityMod/ExtraTextures/ShineFlare"); + VortexTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); + VortexTextureSecondary = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak"); + VortexDistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Perlin"); + } + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 25; + NPCID.Sets.TrailCacheLength[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 0; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new(); + drawModifiers.Position.X += 12f; + drawModifiers.PortraitPositionXOverride = 14f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = drawModifiers; + } + + public override void SetDefaults() + { + NPC.width = 40; + NPC.height = 28; + NPC.damage = 20; + NPC.defense = 14; + NPC.lifeMax = 700; + NPC.knockBackResist = 0f; + NPC.npcSlots = 5f; + NPC.rarity = 4; + NPC.value = Item.buyPrice(0, 3, 0, 0); + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.dontTakeDamage = false; + + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + + SquashVector = Vector2.One; + SquashVectorTarget = Vector2.One; + ResetAttackWeights(); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.BloodMoon, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HorribleHog") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write((byte)PreviousAttackCounters.Count); + foreach (var pair in PreviousAttackCounters) + { + writer.Write((byte)pair.Key); + writer.Write((byte)pair.Value); + } + + writer.Write((byte)AttackWeights.Count); + foreach (var pair in AttackWeights) + { + writer.Write((byte)pair.Key); + writer.Write((byte)pair.Value); + } + + writer.WriteFlags(SearchForTargetEveryFrame, HasPlayedEngageAnimation, HasPlayedDeathAnimation, ReadyToPlayLaughingAnimation); + writer.WritePackedWorldPosition(LastPlayerPosition); + writer.WritePackedWorldPosition(DiggingEmergeSpot); + + for (int i = 0; i < 3; i++) + writer.Write(NPC.localAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + int attackCountersLength = reader.ReadByte(); + for (int i = 0; i < attackCountersLength; i++) + PreviousAttackCounters[(BehaviorState)reader.ReadByte()] = (int)reader.ReadByte(); + + int attackWeightsLength = reader.ReadByte(); + for (int i = 0; i < attackWeightsLength; i++) + AttackWeights[(BehaviorState)reader.ReadByte()] = (float)reader.ReadByte(); + + reader.ReadFlags(out SearchForTargetEveryFrame, out HasPlayedEngageAnimation, out HasPlayedDeathAnimation, out ReadyToPlayLaughingAnimation); + LastPlayerPosition = reader.ReadPackedWorldPosition(); + DiggingEmergeSpot = reader.ReadPackedWorldPosition(); + + for (int i = 0; i < 3; i++) + NPC.localAI[i] = reader.ReadSingle(); + } + + public override bool CheckDead() + { + if (!HasPlayedDeathAnimation) + { + NPC.velocity.X = 6f * -NPC.oldVelocity.X.DirectionalSign(); + NPC.velocity.Y = -10f; + NPC.life = NPC.lifeMax; + HasPlayedDeathAnimation = true; + SwitchBehavior(specificAttack: BehaviorState.DeathAnimation); + return false; + } + + return true; + } + + public override bool? CanFallThroughPlatforms() + { + // If Hog is not in any of the transitional behavior states, don't fall through platforms. + bool inTransitionalBehaviorState = AIState <= (int)BehaviorState.Idle; + if (inTransitionalBehaviorState) + return false; + + if (NPC.HasValidTarget) + { + Player target = Main.player[NPC.target]; + return target.Center.Y - 8 > NPC.Center.Y; + } + + return base.CanFallThroughPlatforms(); + } + + public override void AI() + { + if (!NPC.HasValidTarget || SearchForTargetEveryFrame) + NPC.TargetClosest(false); + + if (NPC.direction == 0) + NPC.direction = Main.rand.NextBool().ToDirectionInt(); + + // Due to how much Death Mode increases Blood Moon spawn rates, this is kinda required in order for the fight to not be super overwhelming. + if (CalamityWorld.death) + NPC.npcSlots = 40f; + + Player target = Main.player[NPC.target]; + NPC.damage = NPC.defDamage; + NPC.defense = NPC.defDefense; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.dontTakeDamage = false; + NPC.chaseable = true; + NPC.spriteDirection = NPC.direction; + + // Despawn immediately if it's morning. + if (Main.dayTime && AIState != (int)BehaviorState.DespawnAnimation && AIState != (int)BehaviorState.DeathAnimation) + SwitchBehavior(specificAttack: BehaviorState.DespawnAnimation); + + // If the current target dies, laugh at them. + if (target.dead && ReadyToPlayLaughingAnimation && NPC.velocity.Y == 0f) + { + ReadyToPlayLaughingAnimation = false; + SwitchBehavior(specificAttack: BehaviorState.LaughAtDeadPlayer); + } + + // If the target is unable to be reached, count up to 5 seconds before switching behavior states and digging towards them. + int tileRange = 64; + Vector2 npcCanHitPosition = NPC.position - new Vector2(tileRange, tileRange); + Vector2 targetCanHitPosition = target.position - new Vector2(tileRange, tileRange); + bool currentlyDoingAnAttack = AIState > (int)BehaviorState.DigTowardsTarget; + bool targetTooHigh = (NPC.Center.Y - target.Center.Y >= 160f && target.velocity.Y == 0f) || NPC.Center.Y - target.Center.Y >= 320f; + bool targetTooFar = NPC.Distance(target.Center) >= 1280f; + bool cantHitTarget = !Collision.CanHit(npcCanHitPosition, NPC.width + tileRange, NPC.height + tileRange, targetCanHitPosition, target.width + tileRange, target.height + tileRange); + if (NPC.HasValidTarget && currentlyDoingAnAttack && (targetTooHigh || targetTooFar || cantHitTarget)) + { + DigTimer++; + if (DigTimer >= 300f && NPC.velocity.Y == 0f) + SwitchBehavior(specificAttack: BehaviorState.DigTowardsTarget); + } + else + { + if (DigTimer > 0f) + DigTimer--; + } + + // Adjust volume correctly depending on the behavior state and play the nearby loop sound. + float volumeTarget = AIState == (int)BehaviorState.Idle ? 1f : 0f; + DevilsTongueVolumeMultiplier = MathHelper.Lerp(DevilsTongueVolumeMultiplier, volumeTarget, 0.075f); + PlayNearbyLoopingSound(); + + switch ((BehaviorState)AIState) + { + case BehaviorState.PiggyTransformation: + MainBehavior_PiggyTransformation(); + break; + + case BehaviorState.EngageAnimation: + MainBehavior_EngageAnimation(target); + break; + + case BehaviorState.LaughAtDeadPlayer: + MainBehavior_LaughAtDeadPlayer(); + break; + + case BehaviorState.DespawnAnimation: + MainBehavior_DespawnAnimation(); + break; + + case BehaviorState.DeathAnimation: + MainBehavior_DeathAnimation(); + break; + + case BehaviorState.Idle: + MainBehavior_Idle(target); + break; + + case BehaviorState.DigTowardsTarget: + MainBehavior_DigTowardsTarget(target); + break; + + case BehaviorState.ChasePlayer: + MainBehavior_ChasePlayer(target); + break; + + case BehaviorState.HogCharge: + MainBehavior_HogCharge(target); + break; + + case BehaviorState.JumpAndDash: + MainBehavior_JumpAndDash(target); + break; + + case BehaviorState.HorribleHoller: + MainBehavior_HorribleHoller(target); + break; + + case BehaviorState.VomitBarrage: + MainBehavior_VomitBarrage(target); + break; + } + + SquashVector = Vector2.Lerp(SquashVector, SquashVectorTarget, 0.125f); + EyeGlintScale = MathHelper.Lerp(EyeGlintScale, 0f, 0.125f); + TintColor = Color.Lerp(TintColor, TintColorTarget, 0.125f); + TintStrength = MathHelper.Lerp(TintStrength, 0, 0.125f); + NPC.StepUpBlocks(); + Timer++; + } + + public void SwitchBehavior(BehaviorState? attackToRecord = null, BehaviorState? specificAttack = null, params BehaviorState[] attacksToChooseFrom) + { + // Reset all the previous attack counters and weights in order to start a new cycle once the maximum amount of attacks overall has been reached. + if (MainAttackCounter >= MaxAttacksPerCycle) + { + // Also search for the nearest target again once the attack cycle resets. + NPC.TargetClosest(false); + + foreach (BehaviorState attack in PreviousAttackCounters.Keys) + PreviousAttackCounters[attack] = 0; + ResetAttackWeights(); + MainAttackCounter = 0f; + } + + if (attackToRecord.HasValue) + { + // Record the last attack to a dictionary and increment how many times it has been performed. + if (!PreviousAttackCounters.ContainsKey(attackToRecord.Value)) + PreviousAttackCounters[attackToRecord.Value] = 0; + PreviousAttackCounters[attackToRecord.Value]++; + + // Increase the weight of other attacks and lower this one. + AttackWeights[attackToRecord.Value] -= 0.33f; + foreach (BehaviorState attack in AttackWeights.Keys) + AttackWeights[attack] += 0.33f; + + MainAttackCounter++; + } + + // Default to returning to idling in the event there are no nearby targets after performing an attack. + BehaviorState nextAttack = BehaviorState.Idle; + + // Switch to a specific behavior state if one is specified. + // Otherwise, pick from the random attack array. + if (specificAttack.HasValue) + { + nextAttack = specificAttack.Value; + } + else if (NPC.HasValidTarget && attacksToChooseFrom.Length > 0) + { + WeightedRandom possibleAttacks = new(); + for (int i = 0; i < attacksToChooseFrom.Length; i++) + { + // Don't add attacks to the attack pool if they've been performed their maximum amount of times. + if (PreviousAttackCounters.TryGetValue(attacksToChooseFrom[i], out var timesPerformed) && timesPerformed >= GetMaxAttackValue(attacksToChooseFrom[i])) + continue; + + possibleAttacks.Add(attacksToChooseFrom[i], AttackWeights[attacksToChooseFrom[i]]); + } + + // Pick a random attack. + nextAttack = possibleAttacks; + } + + // Reset so this once Hog has another player to target so it doesn't loop. + if (NPC.HasValidTarget) + ReadyToPlayLaughingAnimation = true; + + // Switch and reset certain fields. + AIState = (int)nextAttack; + LocalAIState = 0f; + Timer = 0f; + MiscAttackCounter = 0f; + AltAttackVariant = 0f; + SpriteRotation = 0f; + AfterimageTrailOpacity = 0f; + SearchForTargetEveryFrame = false; + UseBalledSprite = false; + + SetSquashVectors(); + KillChargeHitboxProjectile(); + + NPC.netUpdate = true; + } + + public void TransformIntoPiggy() => SwitchBehavior(specificAttack: BehaviorState.PiggyTransformation); + + public bool TryTransformingIntoPiggy() + { + if (AIState == (int)BehaviorState.PiggyTransformation || AIState == (int)BehaviorState.DespawnAnimation || AIState == (int)BehaviorState.DeathAnimation) + return false; + return true; + } + + private int GetMaxAttackValue(BehaviorState attack) + { + int maxValue = attack switch + { + BehaviorState.ChasePlayer => MaxAttacks_ChasePlayer, + BehaviorState.HogCharge => MaxAttacks_HogCharge, + BehaviorState.JumpAndDash => MaxAttacks_JumpAndDash, + BehaviorState.HorribleHoller => MaxAttacks_HorribleHoller, + BehaviorState.VomitBarrage => MaxAttacks_VomitBarrage, + _ => 1 + }; + + // Every attack can be used one more time in phase two. + if (PhaseTwo) + maxValue += 1; + + return maxValue; + } + + private void ResetAttackWeights() + { + AttackWeights[BehaviorState.ChasePlayer] = 1f; + AttackWeights[BehaviorState.HogCharge] = 0.33f; + AttackWeights[BehaviorState.JumpAndDash] = 1f; + AttackWeights[BehaviorState.HorribleHoller] = 0.33f; + AttackWeights[BehaviorState.VomitBarrage] = 0.66f; + } + + private void GroundedMovement(Vector2 targetPosition, float maxSpeed, float maxAcceleration, float jumpHeight = 10f, float? slowdownDistance = null) + { + float distanceToPlayer = MathF.Abs(NPC.Center.X - targetPosition.X); + if (targetPosition.X > NPC.Center.X) + { + if (slowdownDistance.HasValue) + { + if (distanceToPlayer > slowdownDistance.Value) + NPC.velocity.X += maxAcceleration; + else + NPC.velocity.X -= maxAcceleration; + } + else + { + NPC.velocity.X += maxAcceleration; + } + + } + else if (targetPosition.X < NPC.Center.X) + { + if (slowdownDistance.HasValue) + { + if (distanceToPlayer > slowdownDistance.Value) + NPC.velocity.X -= maxAcceleration; + else + NPC.velocity.X += maxAcceleration; + } + else + { + NPC.velocity.X -= maxAcceleration; + } + } + + if (NPC.velocity.Y == 0f) + { + if (NPC.collideX || IsNPCApproachingHole()) + NPC.velocity.Y -= jumpHeight; + } + + NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -maxSpeed, maxSpeed); + } + + private bool IsNPCApproachingHole() + { + int npcWidthInTiles = NPC.width / 16; + int tileX = (int)(NPC.Center.X / 16f) - npcWidthInTiles; + if (NPC.velocity.X > 0) + tileX += npcWidthInTiles; + + int tileY = (int)((NPC.position.Y + NPC.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + npcWidthInTiles; x++) + { + if (Main.tile[x, y].HasTile) + { + return false; + } + } + } + return true; + } + + private Point FindSuitableGround(Point basePoint) + { + if (WorldGen.InWorld(basePoint.X, basePoint.Y)) + { + // Tile is solid. Check to ensure the tile above is also isn't solid and move up if it is. + if (WorldGen.ActiveAndWalkableTile(basePoint.X, basePoint.Y)) + { + while (WorldGen.ActiveAndWalkableTile(basePoint.X, basePoint.Y - 1) && basePoint.Y >= 1) + basePoint.Y--; + } + // Tile isn't solid. Check to ensure the tile under it is solid and move down if it isn't. + else + { + while (!WorldGen.ActiveAndWalkableTile(basePoint.X, basePoint.Y + 1) && basePoint.Y < Main.maxTilesY) + basePoint.Y++; + } + } + + return basePoint; + } + + private void PlayNearbyLoopingSound() + { + if (DevilsTongueVolumeMultiplier < 0.05f) + { + if (SoundEngine.TryGetActiveSound(DevilsTongueSlot, out ActiveSound sound)) + sound.Stop(); + return; + } + + // "Devil's Tongue" looping sound. + // Similar to Divine Swine; gets louder and lowers music volume based on proximity. + + if (!SoundEngine.TryGetActiveSound(DevilsTongueSlot, out _)) + { + if (!CalamityClientConfig.Instance.MisophoniaSupport) + { + DevilsTongueSlot = SoundEngine.PlaySound(DevilsTongueLoopingSound, NPC.Center, DevilsTongueLoopCallback); + } + else + DevilsTongueSlot = SoundEngine.PlaySound(MisophoniaDevilsTongueLoopingSound, NPC.Center, DevilsTongueLoopCallback); + } + + float idealVolume = Utils.Remap(NPC.Distance(Main.LocalPlayer.Center), 800f, 400f, 1f, 0.05f, true); + Main.musicFade[Main.curMusic] = MathHelper.Lerp(1f, idealVolume, DevilsTongueVolumeMultiplier); + } + + private bool DevilsTongueLoopCallback(ActiveSound soundInstance) + { + soundInstance.Position = NPC.Center; + float idealVolume = Utils.Remap(NPC.Distance(Main.LocalPlayer.Center), 800f, 400f, 0.1f, 0.7f, true) * DevilsTongueVolumeMultiplier; + soundInstance.Volume = idealVolume; + return NPC.active && DevilsTongueVolumeMultiplier >= 0.05f; + } + + private void DoJumpEffects(int dustCloudMin = 10, int dustCloudMax = 14, int dirtDustMin = 14, int dirtDustMax = 18) + { + // Do fart in a jar visuals when Hog does a jump mid-air. + float tileCollisionDistance = CalamityUtils.DistanceToTileCollisionHit(NPC.Bottom, Vector2.UnitY, 10) ?? 9999f; + if (tileCollisionDistance > 18f) + { + int fartCloudAmt = Main.rand.Next(dustCloudMin, dustCloudMax + 1); + for (int i = 0; i < fartCloudAmt; i++) + { + Vector2 spawnPosition = NPC.Bottom + Main.rand.NextVector2Circular(32f, 0f); + Vector2 velocity = Main.rand.NextVector2Circular(2f, 2f); + int goreType = Main.rand.Next(GoreID.FartCloud1, GoreID.FartCloud3 + 1); + Gore.NewGore(spawnPosition, velocity, goreType); + } + + int fartDustAmt = Main.rand.Next(dirtDustMin, dirtDustMax + 1); + for (int i = 0; i < fartDustAmt; i++) + { + Vector2 velocity = Main.rand.NextVector2Circular(2f, 2f); + Dust.NewDust(NPC.Bottom, 0, 0, DustID.FartInAJar, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + + SoundEngine.PlaySound(SoundID.Item16, NPC.Center); + } + else + { + int dustCloudAmt = Main.rand.Next(dustCloudMin, dustCloudMax + 1); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = FindSuitableGround((NPC.Bottom + Main.rand.NextVector2Circular(32f, 0f)).ToTileCoordinates()).ToWorldCoordinates(); + Vector2 velocity = NPC.velocity * (Main.rand.NextFloat(0.1f, 0.2f) + i * 0.1f); + Color color = Color.Lerp(Color.SaddleBrown, Color.SandyBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle launchCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(0.4f, 0.6f), Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(30, 45), rotationSpeed); + GeneralParticleHandler.SpawnParticle(launchCloud, true, Enums.GeneralDrawLayer.BeforeSolidTiles); + } + + int dustAmt = Main.rand.Next(dirtDustMin, dirtDustMax + 1); + for (int i = 0; i < dustAmt; i++) + { + Vector2 velocity = NPC.velocity * (Main.rand.NextFloat(0.1f, 0.2f) + i * 0.025f); + Dust.NewDust(NPC.Bottom, 0, 0, DustID.Dirt, velocity.X, velocity.Y); + } + + SoundEngine.PlaySound(JumpSound, NPC.Bottom); + } + } + + private void TrySpawningMist(int x, int y) + { + if (!WorldGen.InWorld(x, y, 10) || Main.tile[x, y] == null) + return; + + Tile tile = Main.tile[x, y]; + if (!tile.HasTile || tile.Slope > 0 || tile.IsHalfBlock || !Main.tileSolid[Main.tile[x, y].TileType]) + return; + + tile = Main.tile[x, y - 1]; + if (tile.LiquidAmount > 0 && tile.Slope <= 0) + { + for (int i = tile.Y() - 1; i > tile.Y() - 50; i--) + { + Tile liquidTile = Main.tile[x, i]; + Tile liquidTileUnderOne = Main.tile[x, i + 1]; + Tile liquidTileUnderTwo = Main.tile[x, i + 2]; + if (liquidTile.LiquidAmount == 0 && !WorldGen.SolidTile(liquidTile) && !WorldGen.SolidTile(liquidTileUnderOne) && !WorldGen.SolidTile(liquidTileUnderTwo)) + { + if (Main.rand.NextBool(240)) + { + SpawnFloorMist(x, i + 1); + if (Main.rand.NextBool(3)) + SpawnFloorMist(x, i + 2); + } + break; + } + } + } + else + { + if (!WorldGen.SolidTile(tile) && Main.rand.NextBool(240)) + { + SpawnFloorMist(x, y + 1); + if (Main.rand.NextBool(3)) + SpawnFloorMist(x, y); + } + } + + } + + private Rectangle GetTileWorkSpaceForMist() + { + Point point = NPC.Center.ToTileCoordinates(); + int width = 30; + int height = 10; + return new Rectangle(point.X - width / 2, point.Y - height / 2, width, height); + } + + private void SpawnFloorMist(int x, int y) + { + //the particles are all just visual + //also, calling lighting check on a server breaks + if (Main.netMode == NetmodeID.Server) + return; + + int textureIndex = Main.rand.Next(GoreID.AmbientFloorCloud1, GoreID.AmbientFloorCloud4 + 1); + + Vector2 position = new Point(x, y - 1).ToWorldCoordinates(); + Vector2 velocity = Vector2.UnitX * Main.rand.NextFloat(0.2f, 0.4f) * Main.WindForVisuals; + Color mistColor = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.NextBool(3) ? Main.rand.NextFloat(0.2f, 0.8f) : Main.rand.Next(2)); + var point = new Point(x, y); + Color color = Color.Lerp(Lighting.GetColor(new Point(x, y)), mistColor, 0.5f); + + float yOffset = 16f * Main.rand.NextFloat(); + position.Y -= yOffset; + if (yOffset > 4f) + textureIndex = GoreID.AmbientFloorCloud4; + + float scale = Main.rand.NextFloat(0.8f, 1.6f) + Main.rand.NextFloat() * 0.2f; + float baseOpacity = Main.rand.NextFloat(0.8f, 1.2f) * Utils.Remap(Main.LocalPlayer.Distance(NPC.Center), 1200f, 600f, 0.3f, 1f, true); + int lifetime = Main.rand.Next(480, 720); + + GraveyardMistParticle floorMist = new(position, velocity, color, scale, baseOpacity, lifetime, textureIndex); + GeneralParticleHandler.SpawnParticle(floorMist); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.bloodMoon && NPC.downedBoss1 && NPC.CountNPCS(Type) < 1) + { + float spawnChanceMultiplier = CalamityWorld.death ? 0.0075f : 0.025f; + return SpawnCondition.OverworldNightMonster.Chance * spawnChanceMultiplier; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + // Death effects spawned in MainBehavior_DeathAnimation. + if (NPC.life <= 0) + return; + + int dustAmt = Main.rand.Next(3, 7); + if (hit.Crit) + dustAmt += Main.rand.Next(2, 5); + + for (int i = 0; i < dustAmt; i++) + { + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + Vector2 velocity = new Vector2(hit.HitDirection * Main.rand.NextFloat(1f, 2f), Main.rand.NextFloat(-2f, 2f)); + float scale = Main.rand.NextFloat(0.8f, 1.2f); + if (hit.Crit) + { + velocity *= Main.rand.NextFloat(1.25f, 1.75f); + scale += Main.rand.NextFloat(0.25f, 0.5f); + } + + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, velocity.X, velocity.Y, Scale: scale); + } + } + + public override void OnKill() + { + // Mark Horrible Hog as dead + DownedBossSystem.downedHorribleHog = true; + CalamityNetcode.SyncWorld(); + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + //Always drops Disgusting Meat, 50% chance to drop Money Trough, 25%/33% chance to drop Laudanum, 10% chance to drop Bloody Tear + npcLoot.Add(ModContent.ItemType()); + npcLoot.Add(ModContent.ItemType(), Main.expertMode ? 3 : 4); + npcLoot.Add(ItemID.MoneyTrough, 2); + npcLoot.Add(ItemID.BloodMoonStarter, 10); + + // 10-12 Blood Orbs Post-EoC to match Wandering Eye Fish and Zombie Merman as Blood Moon's faux minibosses. + LeadingConditionRule postEoC = npcLoot.DefineConditionalDropSet(DropHelper.PostEoC()); + postEoC.Add(ModContent.ItemType(), 1, 10, 12); + } + } +} diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog.png b/NPCs/NormalNPCs/HorribleHog/HorribleHog.png new file mode 100644 index 0000000000..5a53ef3357 Binary files /dev/null and b/NPCs/NormalNPCs/HorribleHog/HorribleHog.png differ diff --git a/NPCs/NormalNPCs/HorribleHog/HorribleHog_BalledUp.png b/NPCs/NormalNPCs/HorribleHog/HorribleHog_BalledUp.png new file mode 100644 index 0000000000..32f1ccc66a Binary files /dev/null and b/NPCs/NormalNPCs/HorribleHog/HorribleHog_BalledUp.png differ diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index eb0e0d1005..a75873716b 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -321,7 +321,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 5); - npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 5); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index d0df599e78..825c692c0c 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -1,56 +1,137 @@ using System; +using System.Security.Policy; +using CalamityMod.Effects; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.NormalNPCs.HorribleHog; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class Piggy : ModNPC { + public enum BehaviorState + { + DivineSwineTransformation = -2, + HorribleHogTransformation = -1, + IdleAndWalk, + Running, + } + + private static Asset SpotlightTexture; + private static Asset BloomCircle; + private static Asset BloomFlare; + private static Asset ShineFlare; + + private static SoundStyle IdleSound_Grunt = new("CalamityMod/Sounds/Custom/Piggy/PiggyIdle_Grunt", 3); + private static SoundStyle IdleSound_SnortYip = new("CalamityMod/Sounds/Custom/Piggy/PiggyIdle_SnortYip", 3); + private static SoundStyle IdleSound_Yip = new("CalamityMod/Sounds/Custom/Piggy/PiggyIdle_Yip", 2); + private static SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PiggyDeath", 2); + + private static SoundStyle DivineSwine_CoinFailSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineCoinFail", 3); + private static SoundStyle DivineSwine_SwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0, + }; + + private static SoundStyle DivineSwine_MisophoniaSwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0, + }; + + private static SoundStyle HorribleHog_CackleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogCackle"); + private static SoundStyle HorribleHog_IdleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogIdle", 2) + { + PitchVariance = 0.25f, + }; + private static SoundStyle HorribleHog_DevilsTongueLoopingSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogNearbyLoop") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + + private static SoundStyle HorribleHog_MisophoniaDevilsTongueLoopingSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone") + { + IsLooped = true, + PauseBehavior = PauseBehavior.PauseWithGame, + MaxInstances = 0 + }; + + public Vector2 SquashVector; + + public SlotId NearbySoundSlot; + + public static float MaxAcceleration_Walking => 0.035f; + public static float MaxAcceleration_Running => 0.085f; + public static float MaxSpeed_Walking => 1.2f; + public static float MaxSpeed_Running => 3.6f; + + public ref float Timer => ref NPC.ai[0]; + + public ref float AIState => ref NPC.ai[1]; + + public ref float LocalAIState => ref NPC.ai[2]; + + public override void Load() + { + if (Main.dedServ) + return; + + SpotlightTexture = ModContent.Request("Terraria/Images/Extra_60"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + BloomFlare = ModContent.Request("CalamityMod/ExtraTextures/BloomFlare"); + ShineFlare = ModContent.Request("CalamityMod/ExtraTextures/ShineFlare"); + } + public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[Type] = 8; Main.npcCatchable[Type] = true; NPCID.Sets.CountsAsCritter[Type] = true; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - SpriteDirection = 1 - }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.CantTakeLunchMoney[Type] = true; - NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); + NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[Type] = true; + NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(NPCID.GoldBunny) + 1, Type); } public override void SetDefaults() { - NPC.chaseable = false; NPC.damage = 0; - NPC.width = 26; - NPC.height = 26; - NPC.lifeMax = 2000; - NPC.aiStyle = NPCAIStyleID.Passive; - AIType = NPCID.Squirrel; - NPC.knockBackResist = 0.99f; + NPC.width = 42; + NPC.height = 28; + NPC.lifeMax = 300; + NPC.aiStyle = -1; + NPC.knockBackResist = 1.15f; NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; + NPC.DeathSound = DeathSound; + NPC.catchItem = (short)ModContent.ItemType(); Banner = NPC.type; BannerItem = ModContent.ItemType(); - NPC.catchItem = (short)ModContent.ItemType(); + NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - } - public override void AI() - { - // Force bestiary unlock - if (Main.netMode != NetmodeID.MultiplayerClient && Main.BestiaryTracker.Kills.GetKillCount(NPC) <= 0) - { - Main.BestiaryTracker.Kills.RegisterKill(NPC); - } + SquashVector = Vector2.One; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -63,13 +144,398 @@ namespace CalamityMod.NPCs.NormalNPCs }); } + public override void AI() + { + // Force bestiary cause this doesn't count as Vanilla's definition of a critter for the Bestiary. + if (Main.netMode != NetmodeID.MultiplayerClient && Main.BestiaryTracker.Kills.GetKillCount(NPC) <= 0) + Main.BestiaryTracker.Kills.SetKillCountDirectly(NPC.GetBestiaryCreditId(), 100); + + if (NPC.direction == 0) + NPC.direction = Utils.SelectRandom(Main.rand, -1, 1); + + switch ((BehaviorState)AIState) + { + case BehaviorState.DivineSwineTransformation: + MainBehavior_DivineSwineTransformation(); + break; + + case BehaviorState.HorribleHogTransformation: + MainBehavior_HorribleHogTransformation(); + break; + + case BehaviorState.IdleAndWalk: + MainBehavior_IdleAndWalk(); + break; + + case BehaviorState.Running: + MainBehavior_Running(); + break; + } + + NPC.StepUpBlocks(); + + SquashVector = Vector2.Lerp(SquashVector, Vector2.One, 0.125f); + Timer++; + } + + public void MainBehavior_DivineSwineTransformation() + { + NPC.velocity.X *= 0.9f; + NPC.rotation = 0f; + + + if (Timer < 2 && !SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + { + if (!CalamityClientConfig.Instance.MisophoniaSupport) + { + NearbySoundSlot = SoundEngine.PlaySound(DivineSwine_SwineSpeakLoopingSound, NPC.Center, NearbySoundCallbackMethod); + } + else + NearbySoundSlot = SoundEngine.PlaySound(DivineSwine_MisophoniaSwineSpeakLoopingSound, NPC.Center, NearbySoundCallbackMethod); + } + + float lightSpawnDistance = MathHelper.Lerp(52f, 84f, Timer / 180f); + int lightAmt = Main.rand.Next(1, 2); + for (int i = 0; i < lightAmt; i++) + { + Vector2 lightSpawnPosition = NPC.Center + Main.rand.NextVector2Unit() * lightSpawnDistance * Main.rand.NextFloat(0.7f, 1f); + Vector2 lightVelocity = (NPC.Center - lightSpawnPosition).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(3f, 4f); + float lightScale = Utils.Remap(Timer, 0f, 180f, 0.3f, 0.9f, true); + + SquishyLightParticle meatLight = new(lightSpawnPosition, lightVelocity, lightScale, Color.White, Main.rand.Next(30, 45)); + GeneralParticleHandler.SpawnParticle(meatLight, true); + } + + int sparkleSpawnRate = (int)Utils.Remap(Timer, 0f, 180f, 45, 5, true); + if (Main.rand.NextBool(sparkleSpawnRate)) + { + int sparkleAmt = Main.rand.Next(1, 3); + for (int i = 0; i < sparkleAmt; i++) + { + Vector2 spawnPosition = NPC.Center + Main.rand.NextVector2Unit() * lightSpawnDistance * Main.rand.NextFloat(0.8f, 1.2f); + Color drawColorBlue = Color.Lerp(new Color(44, 166, 247), new Color(123, 197, 247), Main.rand.NextFloat()); + Color drawColorYellow = Color.Lerp(new Color(249, 197, 42), new Color(249, 221, 142), Main.rand.NextFloat()); + Color sparkleColor = Utils.SelectRandom(Main.rand, drawColorBlue, drawColorYellow); + float sparkleScale = Utils.Remap(Timer, 0f, 180f, 0.2f, 0.8f, true); + + QuickSparkleParticle sparkle = new(spawnPosition, Vector2.Zero, sparkleColor, sparkleScale * Main.rand.NextFloat(0.5f, 1f), Main.rand.Next(20, 30)); + GeneralParticleHandler.SpawnParticle(sparkle, true); + } + } + + if (Timer >= 30f && Main.rand.NextBool(10)) + { + Vector2 spawnPosition = NPC.Center + new Vector2(Main.rand.NextFloat(-16f, 16f), Main.rand.NextFloat(-144f, -134f)); + Vector2 velocity = Vector2.UnitY * Main.rand.NextFloat(0.25f, 0.75f); + Color featherColor = Color.Lerp(Color.Lerp(new Color(27, 103, 155), new Color(83, 184, 255), Main.rand.NextFloat()), new Color(221, 253, 255), Main.rand.NextFloat(0.4f)); + float scale = Main.rand.NextFloat(0.8f, 1f); + + FeatherParticle feather = new(spawnPosition, velocity, featherColor, scale, Main.rand.Next(75, 90), null, 0.9f, false, false, true); + GeneralParticleHandler.SpawnParticle(feather, manualDrawLayerOverride: Enums.GeneralDrawLayer.BeforeNPCs); + } + + if (Timer >= 180f) + { + CustomPulse lightRing = new(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2f, 75); + GeneralParticleHandler.SpawnParticle(lightRing); + + BloomParticle bloom = new(NPC.Center, Vector2.Zero, Color.White, 0f, 2f, 125); + for (int i = 0; i < 3; i++) + GeneralParticleHandler.SpawnParticle(bloom); + + for (int i = 0; i < 25; i++) + { + QuickSparkleParticle sparkle = new(NPC.Center, Main.rand.NextVector2Circular(15f, 15f), Color.White, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.Next(45, 60)); + SquishyLightParticle light = new(NPC.Center, Main.rand.NextVector2Circular(5f, 5f), Main.rand.NextFloat(0.6f, 0.8f), Color.White, Main.rand.Next(45, 60)); + GeneralParticleHandler.SpawnParticle(Main.rand.NextBool() ? sparkle : light, true); + } + + SoundEngine.PlaySound(DivineSwine_CoinFailSound, NPC.Center); + if (SoundEngine.TryGetActiveSound(NearbySoundSlot, out var activeSound)) + activeSound.Stop(); + + NPC.Transform(ModContent.NPCType()); + } + } + + public void MainBehavior_HorribleHogTransformation() + { + NPC.velocity.X *= 0.9f; + NPC.rotation = 0f; + + if (Timer < 2 && !SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + { + if (!CalamityClientConfig.Instance.MisophoniaSupport) + { + NearbySoundSlot = SoundEngine.PlaySound(HorribleHog_DevilsTongueLoopingSound, NPC.Center, NearbySoundCallbackMethod); + } + else + NearbySoundSlot = SoundEngine.PlaySound(HorribleHog_MisophoniaDevilsTongueLoopingSound, NPC.Center, NearbySoundCallbackMethod); + } + + float smokeOpacity = Utils.GetLerpValue(0f, 45f, Timer, true); + int circlingSmokeAmount = Main.rand.Next(2, 5); + for (int i = 0; i < circlingSmokeAmount; i++) + { + Vector2 spawnDistanceVariance = Main.rand.NextVector2Circular(50f, 50f); + Vector2 spawnPosition = NPC.Center + spawnDistanceVariance; + Vector2 velocity = spawnDistanceVariance.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(2f, 5f); + Color color = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.Next(2)); + int lifetime = Main.rand.Next(30, 45); + float scale = Main.rand.NextFloat(1f, 1.2f); + + HeavySmokeParticle circlingSmoke = new(spawnPosition, velocity, color, lifetime, scale, smokeOpacity, 0.01f, affectedByLight: true); + GeneralParticleHandler.SpawnParticle(circlingSmoke, true); + } + + if (Timer >= 180f) + { + SoundEngine.PlaySound(HorribleHog_CackleSound, NPC.Center); + if (SoundEngine.TryGetActiveSound(NearbySoundSlot, out var activeSound)) + activeSound.Stop(); + + NPC.Transform(ModContent.NPCType()); + } + } + + public void MainBehavior_IdleAndWalk() + { + // Idling. + if (LocalAIState == 0f) + { + if (Timer > 0f) + { + if (Timer % 60f == 0f && Main.rand.NextBool(6)) + { + Timer = 0f; + LocalAIState = 1f; + NPC.netUpdate = true; + } + + if (Timer % 60f == 0f && Main.rand.NextBool(12)) + { + AIState = (int)BehaviorState.Running; + Timer = 0f; + LocalAIState = 0f; + NPC.netUpdate = true; + } + } + + // Stop moving and occasionally switch directions. + if (NPC.velocity.Y == 0f) + { + NPC.velocity.X *= 0.8f; + if (Timer % 15f == 0f && Main.rand.NextBool(12)) + NPC.direction *= -1; + } + } + + // Walking. + if (LocalAIState == 1f) + { + if (Timer > 120f && Timer % 60f == 0f && Main.rand.NextBool(5)) + { + Timer = 0f; + LocalAIState = 0f; + NPC.netUpdate = true; + } + + if (MathF.Abs(NPC.velocity.X) < MaxSpeed_Walking) + NPC.velocity.X += MaxAcceleration_Walking * NPC.direction; + + if (NPC.collideX && NPC.velocity.Y == 0f) + NPC.velocity.Y -= 6f; + } + + // Sound effects. + if (NPC.soundDelay == 0 && Main.rand.NextBool(200)) + { + // Small chance to do a cute lil hop as well. + if (Main.rand.NextBool(5)) + { + NPC.velocity.Y -= Main.rand.NextFloat(2f, 4f); + SquashVector = new Vector2(0.7f, 1.3f); + NPC.netUpdate = true; + } + + if (!CalamityClientConfig.Instance.MisophoniaSupport) + { + var chosenSoundStyle = Utils.SelectRandom(Main.rand, IdleSound_Grunt, IdleSound_SnortYip, IdleSound_Yip); + SoundEngine.PlaySound(chosenSoundStyle, NPC.Center); + } + NPC.soundDelay = Main.rand.Next(60, 120); + } + + NPC.spriteDirection = NPC.direction; + float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.085f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f; + NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.075f); + } + + public void MainBehavior_Running() + { + // Run in a random direction until collision with a wall is made. + if (LocalAIState == 0f) + { + if (MathF.Abs(NPC.velocity.X) < MaxSpeed_Running) + NPC.velocity.X += MaxAcceleration_Running * NPC.direction; + NPC.spriteDirection = NPC.direction; + + // Spawn particles when running at max speed. + if (NPC.velocity.Y == 0f && MathF.Abs(NPC.velocity.X) >= MaxSpeed_Running) + { + int dustType = NPC.type == ModContent.NPCType() ? DustID.Enchanted_Gold : DustID.Cloud; + Vector2 dustPosition = new(NPC.Bottom.X + Main.rand.NextFloat(-NPC.width * 0.5f, NPC.width * 0.5f), NPC.Bottom.Y); + Dust.NewDustPerfect(dustPosition, dustType, new Vector2(NPC.velocity.X * 0.2f, Main.rand.NextFloat(-0.3f, 0.3f)), 0, default, Main.rand.NextFloat(1f, 1.2f)); + if (Timer % 7 == 0f) + SoundEngine.PlaySound(SoundID.Run with { Pitch = 0.3f, Volume = 0.7f, Identifier = "Piggy Run" }, NPC.Center); + } + + if (HoleBelow() && NPC.velocity.Y == 0f) + NPC.velocity.Y -= 6f; + + if (NPC.collideX) + { + SoundEngine.PlaySound(SoundID.Dig with { Volume = 0.7f }, NPC.Center); + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(IdleSound_Grunt with { Volume = 1.2f }, NPC.Center); + + SquashVector = new Vector2(0.6f, 1f); + + NPC.velocity.X = NPC.oldVelocity.X * -0.86f; + NPC.velocity.Y -= 3f; + Timer = 0f; + LocalAIState = 1f; + NPC.netUpdate = true; + } + // Stop running and go back to idling if 5 seconds has passed without collision. + else if (Timer >= 300f) + { + AIState = (int)BehaviorState.IdleAndWalk; + LocalAIState = Main.rand.Next(1); + Timer = 0f; + NPC.netUpdate = true; + } + + float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f; + NPC.rotation = idealRotation; + } + + if (LocalAIState == 1f) + { + if (NPC.velocity.Y == 0f) + { + NPC.velocity.X *= 0.9f; + if (MathF.Abs(NPC.velocity.X) >= 0.08f && MathF.Abs(NPC.velocity.X) < 0.09f) + { + NPC.velocity.Y = -4f; + var soundStyle = Utils.SelectRandom(Main.rand, IdleSound_SnortYip, IdleSound_Yip); + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(soundStyle.WithPitchOffset(0.35f), NPC.Center); + } + } + + if (MathF.Abs(NPC.velocity.X) > 0.09f) + NPC.rotation += NPC.velocity.X * 0.075f; + else + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.125f); + + if (Timer >= 120f) + { + AIState = (int)BehaviorState.IdleAndWalk; + LocalAIState = Main.rand.Next(1); + Timer = 0f; + NPC.netUpdate = true; + } + } + } + + public void TransformIntoVariant(int type) + { + if (type == ModContent.NPCType()) + AIState = (int)BehaviorState.DivineSwineTransformation; + else if (type == ModContent.NPCType()) + AIState = (int)BehaviorState.HorribleHogTransformation; + else + AIState = (int)BehaviorState.IdleAndWalk; + + LocalAIState = 0f; + Timer = 0f; + NPC.netUpdate = true; + } + + public bool TryTransformingIntoVariant() + { + if (AIState == (int)BehaviorState.DivineSwineTransformation || AIState == (int)BehaviorState.HorribleHogTransformation) + return false; + return true; + } + + private bool HoleBelow() + { + int npcWidthInTiles = NPC.width / 16; + int tileX = (int)(NPC.Center.X / 16f) - npcWidthInTiles; + if (NPC.velocity.X > 0) + tileX += npcWidthInTiles; + + int tileY = (int)((NPC.position.Y + NPC.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + npcWidthInTiles; x++) + { + if (Main.tile[x, y].HasTile) + { + return false; + } + } + } + return true; + } + + private bool NearbySoundCallbackMethod(ActiveSound soundInstance) + { + float interpolant = Utils.GetLerpValue(0f, 75f, Timer, true) * Utils.GetLerpValue(180f, 130f, Timer, true); + soundInstance.Position = NPC.Center; + soundInstance.Volume = interpolant; + return NPC.active; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea) + float goldMultiplier = NPC.type == ModContent.NPCType() ? 0.0025f : 1f; + bool inAtTown = spawnInfo.Player.townNPCs > 2f && (Main.remixWorld ? spawnInfo.Player.ZoneNormalCaverns : spawnInfo.Player.ZoneForest); + if (inAtTown) + return SpawnCondition.TownCritter.Chance * 0.1f * goldMultiplier; + else if (spawnInfo.Player.ZonePurity) + return (Main.remixWorld ? SpawnCondition.Cavern.Chance * 0.005f : SpawnCondition.OverworldDayGrassCritter.Chance * 0.005f) * goldMultiplier; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Bacon, 10); + + public override void HitEffect(NPC.HitInfo hit) + { + int dustType = Type == ModContent.NPCType() ? DustID.GoldCritter : DustID.Blood; + for (int k = 0; k < 5; k++) { - return 0f; + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); } - return SpawnCondition.TownCritter.Chance * 0.005f; + + if (NPC.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); + } + + if (!Main.dedServ && Type != ModContent.NPCType()) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Piggy").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Piggy2").Type, 1f); + } + } + + NPC.direction = hit.HitDirection; } public override void FindFrame(int frameHeight) @@ -78,15 +544,6 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!NPC.IsABestiaryIconDummy) { - if (NPC.direction == 1) - { - NPC.spriteDirection = -1; - } - if (NPC.direction == -1) - { - NPC.spriteDirection = 1; - } - if (NPC.velocity.X == 0f) { NPC.frame.Y = 0; @@ -94,13 +551,15 @@ namespace CalamityMod.NPCs.NormalNPCs return; } } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.25f; NPC.frameCounter += 1.0; - if (NPC.frameCounter > 12.0) + if (NPC.frameCounter > 7.0) { NPC.frame.Y = NPC.frame.Y + frameHeight; NPC.frameCounter = 0.0; } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) { NPC.frame.Y = frameHeight; @@ -113,21 +572,61 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Bacon); - - public override void HitEffect(NPC.HitInfo hit) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - for (int k = 0; k < 5; k++) + if (NPC.IsABestiaryIconDummy) + return true; + + Texture2D baseTexture = TextureAssets.Npc[Type].Value; + Vector2 scale = SquashVector * NPC.scale; + SpriteEffects spriteEffects = NPC.spriteDirection < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(baseTexture, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, spriteEffects, 0f); + + spriteBatch.End(out var snapshot); + + // Draw the transformation visuals when needed. + if (AIState == (int)BehaviorState.DivineSwineTransformation) + Draw_DivineSwineTransformationVisuals(spriteBatch, screenPos); + + spriteBatch.Begin(snapshot); + return false; + } + + private void Draw_DivineSwineTransformationVisuals(SpriteBatch spriteBatch, Vector2 screenPos) + { + Vector2 baseDrawPosition = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; + float interpolant = CalamityUtils.SineOutEasing(Utils.GetLerpValue(0f, 120f, Timer, true), 1); + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + // Spotlight from heaven. + float spotlightOpacity = CalamityUtils.SineInOutEasing(Utils.GetLerpValue(0f, 30f, Timer, true) * Utils.GetLerpValue(180f, 150f, Timer, true), 1); + Vector2 spotlightDrawPosition = baseDrawPosition + Vector2.UnitY * -16f; + Vector2 spotlightScale = new Vector2(1.3f * interpolant, 1.6f); + Vector2 spotlightOrigin = new Vector2(SpotlightTexture.Width() * 0.5f, SpotlightTexture.Height()); + spriteBatch.Draw(SpotlightTexture.Value, spotlightDrawPosition, null, Color.White with { A = 0 } * spotlightOpacity, 0f, spotlightOrigin, spotlightScale, SpriteEffects.FlipVertically, 0f); + + spriteBatch.End(); + + var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default); + using (pixelationLease.Scope(clearColor: Color.Transparent)) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, PixelationManager.PixelationMatrix); + + // Typical bloom effects. + float flareRotation = (float)(Main.timeForVisualEffects / 150f) + NPC.whoAmI; + spriteBatch.Draw(BloomFlare.Value, baseDrawPosition, null, Color.White with { A = 0 } * interpolant * 0.5f, flareRotation, BloomFlare.Size() * 0.5f, 0.2f * interpolant, 0, 0f); + spriteBatch.Draw(BloomFlare.Value, baseDrawPosition, null, Color.White with { A = 0 } * interpolant, flareRotation * -0.6f, BloomFlare.Size() * 0.5f, 0.15f * interpolant, 0, 0f); + + spriteBatch.Draw(BloomCircle.Value, baseDrawPosition, null, Color.White with { A = 0 } * interpolant, 0f, BloomCircle.Size() * 0.5f, 0.2f * interpolant, 0, 0f); + spriteBatch.Draw(ShineFlare.Value, baseDrawPosition, null, Color.White with { A = 0 } * interpolant, 0f, ShineFlare.Size() * 0.5f, 0.1f * interpolant, 0, 0f); + + spriteBatch.End(); } + + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + spriteBatch.End(); } } } diff --git a/NPCs/NormalNPCs/Piggy.png b/NPCs/NormalNPCs/Piggy.png index dff2a9af97..7255ad1ca4 100644 Binary files a/NPCs/NormalNPCs/Piggy.png and b/NPCs/NormalNPCs/Piggy.png differ diff --git a/NPCs/NormalNPCs/PiggyGold.cs b/NPCs/NormalNPCs/PiggyGold.cs new file mode 100644 index 0000000000..c8729e2514 --- /dev/null +++ b/NPCs/NormalNPCs/PiggyGold.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +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; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PiggyGold : Piggy + { + 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(ModContent.NPCType()) + 1, Type); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.rarity = 3; + NPC.catchItem = (short)ModContent.ItemType(); + Banner = 0; + BannerItem = 0; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + // All gold critters have the same Bestiary entry. + var flavorText = database.FindEntryByNPCID(NPCID.GoldBunny).Info.Where(info => info is FlavorTextBestiaryInfoElement).FirstOrDefault(); + bestiaryEntry.AddTags( + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + flavorText); + } + + public override void AI() + { + base.AI(); + NPC.ProduceGoldCritterDust(); + } + } +} diff --git a/NPCs/NormalNPCs/PiggyGold.png b/NPCs/NormalNPCs/PiggyGold.png new file mode 100644 index 0000000000..351dae2e17 Binary files /dev/null and b/NPCs/NormalNPCs/PiggyGold.png differ diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 592183f14f..3d2a46c076 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -194,21 +194,6 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Supercharged) { - //old - /* - Texture2D shieldTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield").Value; - Rectangle frame = shieldTexture.Frame(1, 11, 0, (int)(Main.GlobalTimeWrappedHourly * 8) % 11); - spriteBatch.Draw(shieldTexture, - NPC.Center - screenPos + Vector2.UnitY * (NPC.gfxOffY + 6f), - frame, - Color.White * 0.625f, - NPC.rotation, - shieldTexture.Size() * 0.5f / new Vector2(1f, 11f), - NPC.scale + (float)Math.Cos(Main.GlobalTimeWrappedHourly) * 0.1f, - SpriteEffects.None, - 0f); - */ - //0.6 : The noise upscale //0.15 the scale its drawn at usually, 0.2 on Zenith float scale = (Main.zenithWorld ? 0.2f : 0.15f) + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + NPC.whoAmI * 0.2f)); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 6ed76faa1a..2fba4d1161 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -1405,26 +1405,25 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.ai[2] >= idlePhaseTimer) { int phase3AttackPicker = 0; - switch ((int)NPC.ai[3]) + switch ((int)NPC.ai[3] % 11) { case 0: case 2: case 3: - case 5: case 6: case 7: + case 8: phase3AttackPicker = 1; break; case 1: - case 8: + case 5: + case 10: phase3AttackPicker = 2; break; case 4: - NPC.ai[3] = 1f; phase3AttackPicker = 3; break; case 9: - NPC.ai[3] = 6f; phase3AttackPicker = 4; break; } @@ -1549,7 +1548,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.ai[0] = 10f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] += 2f; + NPC.ai[3]++; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1611,11 +1610,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.ai[0] = 10f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - - NPC.ai[3] += 2f; - if (NPC.ai[3] >= 9f) - NPC.ai[3] = 0f; - + NPC.ai[3]++; NPC.netUpdate = true; } } @@ -1682,6 +1677,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.ai[0] = 10f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; + NPC.ai[3]++; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1762,6 +1758,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.ai[0] = 10f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; + NPC.ai[3]++; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1860,6 +1857,12 @@ namespace CalamityMod.NPCs.OldDuke public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + { + NPC.alpha = 0; + return true; + } + Color finalDrawColor = Color.Lerp(drawColor, Color.White, NuclearOverlayVisual); Color overlayDrawColor = Color.Lerp(Color.Transparent, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); finalDrawColor = Color.Lerp(finalDrawColor, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 3db309786d..57b1ff8105 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -584,7 +584,6 @@ namespace CalamityMod.NPCs.Other { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 39a7dc5f10..8d238e2028 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); @@ -810,11 +795,8 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; - // Providence fires predictive holy/molten blasts if she is ahead of her target's movement - bool predictiveShots = false; - // 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) @@ -834,22 +816,16 @@ namespace CalamityMod.NPCs.Providence if (NPC.Center.X < player.Center.X) { flightPath = 1; - calamityGlobalNPC.newAI[0] = 0f; NPC.netUpdate = true; } else { flightPath = -1; - calamityGlobalNPC.newAI[0] = 0f; NPC.netUpdate = true; } } } - // Increase speed over time if flying in same direction for too long - if (revenge) - calamityGlobalNPC.newAI[0] += 1f; - // Distance needed from target to change direction float changeDirectionThreshold = 800f; @@ -874,14 +850,8 @@ namespace CalamityMod.NPCs.Providence } } - - // Predictive shot checks - if ((NPC.velocity.X > 0f && (NPC.Center.X - player.Center.X) > 0f && player.velocity.X > 0f) || (NPC.velocity.X < 0f && (NPC.Center.X - player.Center.X) < 0f && player.velocity.X < 0f)) - predictiveShots = true; - // Velocity and acceleration float speedIncreaseTimer = fullPowerAI ? 75f : death ? 120f : 150f; - bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; @@ -893,20 +863,8 @@ namespace CalamityMod.NPCs.Providence } if (laserPhaseSlow) { - acceleration *= getFuckedAI ? 0.6f : 0.4f; - velocity *= getFuckedAI ? 0.6f : 0.4f; - } - else if (increaseSpeed) - { - velocity += (calamityGlobalNPC.newAI[0] - speedIncreaseTimer) * 0.04f; - if (velocity > 30f) - velocity = 30f; - } - - 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) @@ -919,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) @@ -1142,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; } @@ -1192,10 +1125,8 @@ namespace CalamityMod.NPCs.Providence Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; - Vector2 predictionAmount = player.velocity * 100f; - Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; - Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), HolyBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); + Vector2 projectileVelocity = (player.Center - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), HolyBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -1261,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; @@ -1467,10 +1398,8 @@ namespace CalamityMod.NPCs.Providence Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; - Vector2 predictionAmount = player.velocity * 100f; - Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; - Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), MoltenBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); + Vector2 projectileVelocity = (player.Center - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), MoltenBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -1534,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; @@ -1579,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); } } @@ -1606,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); } } @@ -1626,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; @@ -1698,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); } } @@ -1950,7 +1873,7 @@ namespace CalamityMod.NPCs.Providence Projectile projectile = Main.projectile[x]; if (projectile.active) { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) projectile.Kill(); else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) projectile.active = false; @@ -2054,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(); @@ -2085,7 +2002,7 @@ namespace CalamityMod.NPCs.Providence // Equipment // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss - // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials normalOnly.Add(ModContent.ItemType(), 1, 50, 60); @@ -2119,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; @@ -2758,7 +2675,7 @@ namespace CalamityMod.NPCs.Providence // Equipment ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), // Vanity @@ -2886,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/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 8a7abc4e6c..08c606929d 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -238,7 +238,7 @@ namespace CalamityMod.NPCs.Ravager public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) { var item = Main.player[projectile.owner].HeldItem; - if (item.pick > 0 && projectile.CountsAsClass()) + if (item.pick > 0 && !projectile.CountsAsClass()) { modifiers.FlatBonusDamage += -10000; modifiers.FinalDamage.Flat += item.pick-1; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index ad80d16cc6..4edcd8d1f8 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.Ravager public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) { var item = Main.player[projectile.owner].HeldItem; - if (item.pick > 0 && projectile.CountsAsClass()) + if (item.pick > 0 && !projectile.CountsAsClass()) { modifiers.FlatBonusDamage += -10000; modifiers.FinalDamage.Flat += item.pick - 1; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 1051c9a07e..6e09725452 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; @@ -33,6 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 180; NPC.knockBackResist = 0.7f; AnimationType = NPCID.Slimer; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -55,12 +57,6 @@ namespace CalamityMod.NPCs.SlimeGod }); } - public override void AI() - { - Vector3 light = new Vector3(0.5f, 0.1f, 0.5f); - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - } - public override void HitEffect(NPC.HitInfo hit) { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0) @@ -71,9 +67,8 @@ namespace CalamityMod.NPCs.SlimeGod Color dustColor = Color.Lavender; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } public override void OnKill() { diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 97b149f3cd..da8367096d 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,6 +30,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : 90; NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -40,9 +42,6 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.5f); - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; } @@ -50,14 +49,16 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Lavender; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 3d701b8d58..e35ceef1c5 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; @@ -28,6 +29,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 110; NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -52,9 +54,6 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.1f); - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; } @@ -62,14 +61,16 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 4666fb6d5e..2997857cf6 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -2,6 +2,7 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent; @@ -15,15 +16,12 @@ namespace CalamityMod.NPCs.SlimeGod public class CrimsonSlimeSpawn2 : ModNPC { public float spikeTimer = 60f; - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CrimsonSlimeSpawn.DisplayName"); - public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 5; NPCID.Sets.BossBestiaryPriority.Add(Type); } - public static int SmallSpikeDamage = 11; // 44 public override void SetDefaults() @@ -36,6 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = 6; NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : 130; NPC.knockBackResist = 0.7f; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -60,18 +59,13 @@ namespace CalamityMod.NPCs.SlimeGod public override void FindFrame(int frameHeight) { - Vector3 light = new Vector3(0.5f, 0.1f, 0.1f); - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - int frameY = 1; if (!Main.dedServ) { if (TextureAssets.Npc[Type].Value is null) return; - frameY = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; } - int aiState = 0; if (NPC.aiAction == 0) aiState = NPC.velocity.Y >= 0f ? (NPC.velocity.Y <= 0f ? (NPC.velocity.X == 0f ? 0 : 1) : 3) : 2; @@ -83,7 +77,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.frameCounter++; if (aiState == 4) NPC.frameCounter++; - if (NPC.frameCounter >= 8f) { NPC.frame.Y += frameY; @@ -101,8 +94,9 @@ namespace CalamityMod.NPCs.SlimeGod int type = ModContent.ProjectileType(); int damage = SmallSpikeDamage; if (Main.zenithWorld) + { type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - + } if (!NPC.wet) { Vector2 faceDirection = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); @@ -113,8 +107,9 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) + { NPC.velocity.X = NPC.velocity.X * 0.9f; - + } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { int projcount = Main.zenithWorld ? 12 : 5; @@ -134,8 +129,9 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) + { NPC.velocity.X = NPC.velocity.X * 0.9f; - + } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { targetY = Main.player[NPC.target].position.Y - faceDirection.Y - (float)Main.rand.Next(0, 200); @@ -154,14 +150,16 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } } } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index aee29b0cb9..d5366d3688 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -1,13 +1,12 @@ using System; +using System.Collections.Generic; using System.IO; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -17,29 +16,28 @@ namespace CalamityMod.NPCs.SlimeGod public class CrimulanPaladin : ModNPC { private float bossLife; - private float addedStretch = 0f; - private float landingRecoil = 0f; - private const int Width = 206; - private const int Height = 156; public override void SetStaticDefaults() { this.HideFromBestiary(); + Main.npcFrameCount[Type] = 6; } - - public static int BigSpikeDamage = 15; // 60 + public static int GlobDamage = 15; // 60 public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 42; // 84 - NPC.width = Width; - NPC.height = Height; + NPC.width = 150; + NPC.height = 92; + NPC.scale = 1.1f; NPC.defense = 12; NPC.LifeMaxNERB(7500, 9000, 160000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.knockBackResist = 0f; - NPC.Opacity = 1f; + AnimationType = NPCID.KingSlime; + NPC.value = 0f; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -73,50 +71,26 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(1f, 0.2f, 0.2f) * NPC.scale; - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Reset defense and damage NPC.defense = NPC.defDefense; int setDamage = NPC.defDamage; - - // Boost defense and damage while buffed by the Slime God if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 24; - setDamage += SlimeGodCore.PossessionDamageBoost; + setDamage += 25; } - // Used for landing squash and stretch - if (landingRecoil > 0f) - { - landingRecoil *= 0.965f; - landingRecoil -= 0.01f; - } - else - landingRecoil = 0f; - - addedStretch = -landingRecoil; - - // Used for teleporting - float scale = Main.getGoodWorld ? 0.8f : 1f; - - // How fast the slime slams down - float slamVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - - // Used for how fast the slime animates + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; - - // Reset tile collide and gravity NPC.noTileCollide = false; NPC.noGravity = false; @@ -124,9 +98,12 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; - // Despawn if (NPC.ai[0] != 3f) { if (player.dead || !player.active) @@ -147,10 +124,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.timeLeft = 1800; } - // Split into smaller slimes and fire spikes at half HP if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - // Spread of random globs in meme mode if (Main.zenithWorld) { int type = ModContent.ProjectileType(); @@ -158,70 +133,13 @@ namespace CalamityMod.NPCs.SlimeGod Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)Main.rand.Next(-1499, 1500) * 0.01f, (float)Main.rand.Next(-1499, 1500) * 0.01f, type, 35, 0f); } - // Spawn split slimes SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 0f); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 45f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); + if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // Split into 3 slimes if the other large slime hasn't split yet + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 30, ModContent.NPCType()); - // Split into 3 additional slimes if the other large slime hasn't split yet - if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 80, ModContent.NPCType(), 0, 0f, 0f, 90f); - - // Calculate stretch here so that the spike spread looks more natural - float stretch = NPC.velocity.Y * 0.03f; - stretch = Math.Abs(stretch) + addedStretch; - - // Stretch rapidly if about to jump or teleport, stretch normally while idle - if (NPC.velocity.Y == 0f) - stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - - // Spread of spikes - float projectileVelocity = 2f; - int type2 = ModContent.ProjectileType(); - Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); - destination *= projectileVelocity; - int numProj = 9; - float rotation = MathHelper.ToRadians(100); - float maxVelocity = death ? 18f : revenge ? 16f : 14f; - float acceleration = death ? 1.03f : revenge ? 1.025f : 1.02f; - int spikeType = 0; - int dustType = DustID.TintableDust; - Color dustColor = Color.Crimson; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(40f, 40f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; - for (int i = 0; i < numProj; i++) - { - spikeType = numProj - 1 - i; - - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Vector2 projectileLocation = spawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 70f * scaleStretch; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 32; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, BigSpikeDamage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); - } - - // Die NPC.life = 0; NPC.HitEffect(); NPC.active = false; @@ -242,17 +160,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = NPC.defDefense * 2; } - // Slow down dramatically while teleporting - if (NPC.ai[0] == 4f || NPC.ai[0] == 5f) - { - if (Math.Abs(NPC.velocity.X) > 0.1f) - { - NPC.velocity.X *= 0.8f; - if (Math.Abs(NPC.velocity.X) <= 0.1f) - NPC.velocity.X = 0f; - } - } - // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -260,7 +167,10 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[0] = 4f; + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -314,123 +224,115 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport + // Get ready to teleport by increasing ai[3] if (calamityGlobalNPC.newAI[0] < teleportGateValue) { - // Teleport very soon if too far away - float catchUpDistance = 1500f; - bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; - if (fastTeleport) - { - calamityGlobalNPC.newAI[0] += 10f; - } + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + calamityGlobalNPC.newAI[0] += death ? 3f : 2f; else - { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - calamityGlobalNPC.newAI[0] += death ? 3f : 2f; - else - calamityGlobalNPC.newAI[0] += 1f; - } + calamityGlobalNPC.newAI[0] += 1f; } - float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * 0.005f; if (NPC.ai[0] == 0f) { + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + else if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += 1f; + + float jumpGateValue = 50f; + float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + if (revenge) + { + float moveBoost = death ? 45f * (1f - lifeRatio) : 30f * (1f - lifeRatio); + float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; + } + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 4f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 2f; + + if (NPC.ai[1] > jumpGateValue) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) + { + NPC.ai[3] = 0f; + velocityX *= 1.25f; + } + + NPC.ai[1] = 0f; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpGateValue - 30f) + NPC.aiAction = 1; + } + else + { + // Set damage + NPC.damage = setDamage; + + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } + } + + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - - NPC.TargetClosest(); - NPC.velocity.X *= 0.8f; - } - - float landingSquashTime = 10f; - float telegraphTime = 20f; - float phaseSwitchGateValue = 240f; - float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; - if (NPC.ai[2] < jumpTelegraphGateValue) - { - if (NPC.velocity.Y == 0f) - { - // Squash when landing - if (NPC.ai[1] < 0f) - landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; - - NPC.ai[1] += 1f; - - float jumpGateValue = 50f; - float velocityX = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; - if (revenge) - { - float moveBoost = death ? 22f * (1f - lifeRatio) : 14f * (1f - lifeRatio); - float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; - } - - float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 6f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; - if (NPC.ai[1] >= jumpGateValue) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[3] += 1f; - if (NPC.ai[3] >= 2f) - { - NPC.ai[3] = 0f; - velocityX *= 1.25f; - } - - NPC.ai[1] = -landingSquashTime; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpTelegraphGateValue2) - landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; - } - else - { - // Set damage - NPC.damage = setDamage; - - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; - - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; - } - } - } - - if (NPC.velocity.Y == 0f) - { + float phaseSwitchGateValue = 360f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -438,16 +340,15 @@ namespace CalamityMod.NPCs.SlimeGod { switch ((int)NPC.localAI[2]) { - // Jump combo default: case 1: NPC.ai[0] = 2f; break; - // Slam case 2: NPC.ai[0] = 1f; break; + } if (NPC.ai[0] == 1f) @@ -456,7 +357,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; + NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; } NPC.ai[1] = 0f; @@ -465,12 +366,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[2] >= jumpTelegraphGateValue) - landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; + else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) + NPC.aiAction = 1; } } - - // Jump above for slam attack else if (NPC.ai[0] == 1f) { // Avoid cheap bullshit @@ -479,55 +378,53 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + NPC.spriteDirection = NPC.direction; - NPC.TargetClosest(); - - float distanceAboveTarget = 350f; - Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - float moveSpeed = slamVelocity - 6f; - float inertia = 5f; - velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; - - float delayBeforeSlamming = 12f; - if (NPC.ai[1] > delayBeforeSlamming) + if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = velocity; + NPC.velocity = targetDist; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; - float inertia = 6f; - velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + targetDist.Normalize(); + targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } - - // Slam down else if (NPC.ai[0] == 1.1f) { // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -545,57 +442,38 @@ namespace CalamityMod.NPCs.SlimeGod SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - // Calculate stretch here so that the spike spread looks more natural - float stretch = NPC.velocity.Y * 0.03f; - stretch = Math.Abs(stretch) + addedStretch; - - // Stretch rapidly if about to jump or teleport, stretch normally while idle - if (NPC.velocity.Y == 0f) - stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - - // Spread of spikes - float projectileVelocity = 2f; - int type2 = ModContent.ProjectileType(); - Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); + // Eruption of slime balls that fall down + float projectileVelocity = 8f; + int type = ModContent.ProjectileType(); + int damage = GlobDamage; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); destination *= projectileVelocity; - int numProj = 9; - float rotation = MathHelper.ToRadians(100); - float maxVelocity = death ? 18f : revenge ? 16f : 14f; - float acceleration = death ? 1.03f : revenge ? 1.025f : 1.02f; - int spikeType = 0; - int dustType = DustID.TintableDust; - Color dustColor = Color.Crimson; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(40f, 40f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; + int numProj = 5; + float rotation = MathHelper.ToRadians(45); for (int i = 0; i < numProj; i++) { - spikeType = numProj - 1 - i; - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Vector2 projectileLocation = spawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 70f * scaleStretch; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); + } - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 32; j++) + // Fire slime balls directly at players with a max of 2 + if (enraged && expertMode) + { + List targets = new List(); + foreach (Player plr in Main.ActivePlayers) { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } + if (!plr.dead) + targets.Add(plr.whoAmI); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, BigSpikeDamage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); + if (targets.Count > 1) + break; + } + foreach (int t in targets) + { + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); + } } } @@ -606,8 +484,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[3] = 0f; NPC.netUpdate = true; } - else - landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; @@ -615,11 +491,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - if (NPC.velocity.Y > slamVelocity) - NPC.velocity.Y = slamVelocity; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; } - - // Jump in quick succession else if (NPC.ai[0] == 2f) { if (NPC.velocity.Y == 0f) @@ -631,25 +506,34 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - float jumpGateValue = 15f; - if (NPC.ai[1] > jumpGateValue) + if (NPC.ai[1] > 15f) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - float jumpSpeedX = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 10f) + distanceSpeedBoost) * NPC.direction; - float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); - if (jumpSpeedY < -16f) - jumpSpeedY = -16f; - - NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); + NPC.velocity.Y -= 3f; + if (player.position.Y + player.height < NPC.Center.Y) + NPC.velocity.Y -= 1.25f; + if (player.position.Y + player.height < NPC.Center.Y - 40f) + NPC.velocity.Y -= 1.5f; + if (player.position.Y + player.height < NPC.Center.Y - 80f) + NPC.velocity.Y -= 1.75f; + if (player.position.Y + player.height < NPC.Center.Y - 120f) + NPC.velocity.Y -= 2f; + if (player.position.Y + player.height < NPC.Center.Y - 160f) + NPC.velocity.Y -= 2.25f; + if (player.position.Y + player.height < NPC.Center.Y - 200f) + NPC.velocity.Y -= 2.5f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + NPC.velocity.Y -= 2f; + NPC.velocity.X = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 11f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else - landingRecoil += NPC.ai[1] / 10f; + NPC.aiAction = 1; } else { @@ -657,7 +541,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); + float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -669,18 +553,12 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (NPC.ai[2] >= 23f) - { - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - else - landingRecoil += (NPC.ai[2] - 3f) / 10f; + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } } @@ -702,8 +580,44 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Teleport shit else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = setDamage; + + if (NPC.velocity.X > 0f) + NPC.direction = 1; + else + NPC.direction = -1; + + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; + distanceFromTarget.Y -= 16f; + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && + Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + if (distanceFromTarget.Length() > 12f) + { + distanceFromTarget.Normalize(); + distanceFromTarget *= 12f; + } + + NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + } + else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit NPC.damage = 0; @@ -716,14 +630,14 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 5f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 5f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; } @@ -732,12 +646,12 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 5f) + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -749,7 +663,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -757,7 +671,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.TargetClosest(); } @@ -766,17 +680,12 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } } - // Limit the landing recoil - if (landingRecoil > 0.36f) - landingRecoil = 0.36f; - - // Slime spawning and scale logic if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -788,11 +697,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.Center.X; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(Width * NPC.scale); - NPC.height = (int)(Height * NPC.scale); + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -803,11 +712,12 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); + int slimeType = ModContent.NPCType(); + if (Main.rand.NextBool(3)) + slimeType = ModContent.NPCType(); - int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); - int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; @@ -815,32 +725,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - - float minDist = hitboxTopLeft; - if (hitboxTopRight < minDist) - minDist = hitboxTopRight; - if (hitboxBotLeft < minDist) - minDist = hitboxBotLeft; - if (hitboxBotRight < minDist) - minDist = hitboxBotRight; - - return minDist <= 75f * NPC.scale; - } + public override bool CheckActive() => false; public override Color? GetAlpha(Color drawColor) { @@ -849,68 +740,12 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = TextureAssets.Npc[Type].Value; - Color drawColorAlpha = NPC.GetAlpha(drawColor); - - // Stretch based on Y velocity. - float stretch = NPC.velocity.Y * 0.03f; - stretch = Math.Abs(stretch) + addedStretch; - - // Stretch rapidly if about to jump or teleport, stretch normally while idle. - if (NPC.velocity.Y == 0f) - stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - float yOffset = stretch * 0.5f * NPC.height; - - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); - - return false; - } - - public static float SlimeRotationFactor(NPC npc) => MathHelper.ToRadians(npc.velocity.X * (-npc.velocity.Y * 0.1f)); - public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Crimson; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - - if (NPC.life <= 0) - { - NPC.position = NPC.Center; - NPC.width = NPC.height = (int)(160f * NPC.scale); - NPC.position.X = NPC.position.X - (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - - for (int i = 0; i < 40; i++) - { - int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[crimDust].scale = 0.5f; - Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - - for (int j = 0; j < 80; j++) - { - int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); - Main.dust[crimDust2].noGravity = true; - Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust2].velocity *= 2f; - } - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) diff --git a/NPCs/SlimeGod/CrimulanPaladin.png b/NPCs/SlimeGod/CrimulanPaladin.png index dce53c4106..4496f5c719 100644 Binary files a/NPCs/SlimeGod/CrimulanPaladin.png and b/NPCs/SlimeGod/CrimulanPaladin.png differ diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index d49b41c6cf..de407fbfe7 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -5,11 +5,8 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -19,37 +16,31 @@ namespace CalamityMod.NPCs.SlimeGod public class EbonianPaladin : ModNPC { private float bossLife; - private float addedStretch = 0f; - private int wingFrameDrawn = 0; - private const int TotalWingFrames = 8; - private const int Width = 134; - private const int Height = 150; - - public static Asset WingTexture; public override void SetStaticDefaults() { this.HideFromBestiary(); - - if (!Main.dedServ) - WingTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings", AssetRequestMode.AsyncLoad); + Main.npcFrameCount[Type] = 6; } + public static int GlobDamage = 15; // 60 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 40; // 80 - NPC.width = Width; - NPC.height = Height; + NPC.width = 150; + NPC.height = 92; + NPC.scale = 1.1f; NPC.defense = 10; NPC.LifeMaxNERB(8000, 9600, 220000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.noTileCollide = true; - NPC.noGravity = true; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.Opacity = 1f; + AnimationType = NPCID.KingSlime; + NPC.value = 0f; + NPC.Opacity = 0.8f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; @@ -58,6 +49,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SendExtraAI(BinaryWriter writer) { + writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); @@ -67,6 +59,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void ReceiveExtraAI(BinaryReader reader) { + NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); @@ -76,15 +69,13 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(1f, 0.2f, 1f) * NPC.scale; - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -93,16 +84,22 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - setDamage += SlimeGodCore.PossessionDamageBoost; + setDamage += 22; } - float scale = Main.getGoodWorld ? 0.8f : 1f; + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; + NPC.noTileCollide = false; + NPC.noGravity = false; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; if (NPC.ai[0] != 4f) @@ -117,6 +114,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; NPC.netUpdate = true; } } @@ -135,10 +133,10 @@ namespace CalamityMod.NPCs.SlimeGod SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 0f); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 60f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // Split into 3 slimes if the other large slime hasn't split yet - NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 80, ModContent.NPCType(), 0, 0f, 0f, 120f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 30, ModContent.NPCType()); NPC.life = 0; NPC.HitEffect(); @@ -155,36 +153,26 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - // For animating the wings - NPC.localAI[0] += 1f; - - // Slow down dramatically while teleporting - if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) - { - if (NPC.velocity.Length() > 0.1f) - { - NPC.velocity *= 0.8f; - if (NPC.velocity.Length() <= 0.1f) - NPC.velocity = Vector2.Zero; - } - } - // Teleport - float teleportGateValue = 1080f; - if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[1] >= teleportGateValue && NPC.ai[0] == 0f) + float teleportGateValue = 720f; + if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[0] = 5f; + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 6f; NPC.ai[1] = 0f; + NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.netUpdate = true; NPC.TargetClosest(false); player = Main.player[NPC.target]; - float distanceAhead = 960f; + float distanceAhead = 800f; Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); @@ -206,9 +194,9 @@ namespace CalamityMod.NPCs.SlimeGod if (canTeleportToTile) { - calamityGlobalNPC.newAI[2] = teleportTileX * 16 + 8; - calamityGlobalNPC.newAI[3] = teleportTileY * 16 + 16; - calamityGlobalNPC.newAI[1] = 0f; + NPC.localAI[0] = teleportTileX * 16 + 8; + NPC.localAI[3] = teleportTileY * 16 + 16; + calamityGlobalNPC.newAI[0] = 0f; break; } else @@ -222,393 +210,398 @@ namespace CalamityMod.NPCs.SlimeGod if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; - calamityGlobalNPC.newAI[2] = bottom.X; - calamityGlobalNPC.newAI[3] = bottom.Y; - calamityGlobalNPC.newAI[1] = 0f; + NPC.localAI[0] = bottom.X; + NPC.localAI[3] = bottom.Y; + calamityGlobalNPC.newAI[0] = 0f; } } } - // Get ready to teleport - if (calamityGlobalNPC.newAI[1] < teleportGateValue) + // Get ready to teleport by increasing ai[3] + if (calamityGlobalNPC.newAI[0] < teleportGateValue) { - // Teleport very soon if too far away - float catchUpDistance = 1500f; - bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; - if (fastTeleport) - { - calamityGlobalNPC.newAI[1] += 10f; - } + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + calamityGlobalNPC.newAI[0] += death ? 3f : 2f; else - { - float teleportFasterDistance = 1000f; - if (NPC.Distance(player.Center) > teleportFasterDistance) - calamityGlobalNPC.newAI[1] += death ? 3f : 2f; - else - calamityGlobalNPC.newAI[1] += 1f; - } + calamityGlobalNPC.newAI[0] += 1f; } + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * 0.005f; + if (NPC.ai[0] == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.TargetClosest(); - - FlyMovement(NPC); - - if (NPC.timeLeft > 10) + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { - NPC.ai[1] += 1f; - int idleTime = death ? 75 : revenge ? 90 : 120; - if (NPC.ai[1] >= idleTime) - { - NPC.ai[1] = 0f; - switch ((int)NPC.Calamity().newAI[0]) - { - default: - NPC.ai[0] = Main.rand.NextBool() ? 1f : 2f; - break; - case 1: - NPC.ai[0] = Main.rand.NextBool() ? 2f : 3f; - break; - case 2: - NPC.ai[0] = Main.rand.NextBool() ? 3f : 1f; - break; - } + // Set damage + NPC.damage = setDamage; - // Pick directional movements for slime bombardment - if (NPC.ai[0] == 2f) - NPC.ai[2] = NPC.Center.X - player.Center.X > 0f ? 1f : -1f; - - NPC.netUpdate = true; - } - } - } - - // Spread of slime projectiles - else if (NPC.ai[0] == 1f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.rotation *= 0.9f; - - if (NPC.ai[2] == 1f) - { - // Set animation timer to one in order to prevent weird quick animation here - NPC.localAI[0] = 1f; - - NPC.ai[1] += 1f; - if (NPC.ai[1] >= 10f) - { - float minFiringDistance = 160f; // 10 tile distance - if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int numProjectiles = Main.getGoodWorld ? 12 : death ? 6 : 4; - float projectileVelocity = death ? 8f : 6f; - int type = ModContent.ProjectileType(); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); - destination *= projectileVelocity; - float rotation = MathHelper.ToRadians(80); - int dustType = DustID.TintableDust; - Color dustColor = Color.Lavender; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(30f, 30f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; - for (int i = 0; i < numProjectiles; i++) - { - if (Main.getGoodWorld) - destination *= Main.rand.NextFloat() + 0.5f; - - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProjectiles - 1))); - Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); - } - - // Fire slime balls directly at players with a max of 2 - if (enraged && expertMode) - { - List targets = new List(); - foreach (Player plr in Main.ActivePlayers) - { - if (!plr.dead) - targets.Add(plr.whoAmI); - - if (targets.Count > 1) - break; - } - foreach (int t in targets) - { - Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); - } - } - } - - SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); - } - - NPC.Calamity().newAI[0] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[1] == 0f) - { - NPC.TargetClosest(); - NPC.netUpdate = true; - } - - NPC.ai[1] += 1f; - if (NPC.ai[1] >= 50f) - { - NPC.ai[1] = 50f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.ai[1] = 0f; - NPC.ai[2] = 1f; - NPC.netUpdate = true; - } - } - - FlyMovement(NPC); - } - - // Fly overhead in a horizontal line and drop slime - else if (NPC.ai[0] == 2f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - FlyMovement(NPC, true); - - // Drop slime while flying horizontally - if (NPC.ai[1] == 1f) - { - NPC.ai[3] += 1f; - float slimeDropGateValue = death ? 20f : revenge ? 25f : expertMode ? 30f : 40f; - if (NPC.ai[3] % slimeDropGateValue == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileVelocity = 3f; - int type = ModContent.ProjectileType(); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); - destination *= projectileVelocity; - int dustType = DustID.TintableDust; - Color dustColor = Color.Lavender; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(30f, 30f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; - Vector2 projectileLocation = NPC.Center + destination.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(destination.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, destination, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 1f); - } - - SoundEngine.PlaySound(SlimeGodCore.ShotSound, NPC.Center); - } - - NPC.aiAction = 1; - } - - if (NPC.ai[1] == 2f) - { - NPC.Calamity().newAI[0] = NPC.ai[0]; - NPC.ai[0] = 0f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; NPC.netUpdate = true; } - } - // Charge by swooping down - else if (NPC.ai[0] == 3f) - { - // Distance required to charge - float minChargeSafeDistance = 650f; - - // Duration for slow down after charging - float slowDownDurationAfterCharge = revenge ? 90f : 120f; - - // Charge variables - float chargeVelocityMult = 0.1f; - float maxChargeVelocity = enraged ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; - if (Main.getGoodWorld) - maxChargeVelocity *= 2f; - - float inertia = death ? 110f : revenge ? 114f : expertMode ? 120f : 130f; - if (lifeRatio < 0.75f) - inertia *= 0.8f; - if (Main.getGoodWorld) - inertia *= 0.8f; - - // Start charge - if (NPC.ai[1] == 0f) - { - Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; - if (NPC.Distance(player.Center) < minChargeSafeDistance) - { - // Avoid cheap bullshit - NPC.damage = 0; - - // Move away if too close - NPC.SimpleFlyMovement(velocity * -1f, 0.25f); - } - else - { - // Set initial charge velocity - NPC.velocity = velocity * chargeVelocityMult; - - // Set damage - NPC.damage = setDamage; - - NPC.ai[1] = 1f; - NPC.netUpdate = true; - - SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); - - NPC.aiAction = 1; - } - } - else if (NPC.ai[1] == 1f) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[2] += 1f; - float phaseGateValue = enraged ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; - if (NPC.ai[2] >= phaseGateValue) - { - NPC.ai[1] = 2f; - NPC.ai[2] = slowDownDurationAfterCharge; - NPC.localAI[2] = 0f; - NPC.velocity *= 0.5f; - NPC.netUpdate = true; - } - else - { - Vector2 targetVector = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)); - - if (NPC.localAI[2] == 0f) - { - // Accelerate - if (NPC.velocity.Length() < maxChargeVelocity) - { - float velocityMult = enraged ? 1.15f : death ? 1.13f : revenge ? 1.12f : expertMode ? 1.11f : 1.1f; - NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); - if (NPC.velocity.Length() > maxChargeVelocity) - { - NPC.localAI[2] = 1f; - NPC.velocity = NPC.velocity.SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; - } - } - } - else if (NPC.localAI[2] == 1f) - { - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; - - // Stop charging towards the player when within a certain distance - if (NPC.Distance(player.Center) < 130f * NPC.scale) - NPC.localAI[2] = 2f; - } - else - { - // Slow down - if (NPC.Distance(player.Center) >= 210f * NPC.scale || NPC.localAI[2] == 3f) - { - if (NPC.localAI[2] != 3f) - NPC.localAI[2] = 3f; - - NPC.velocity *= 0.97f; - } - } - } - - NPC.aiAction = 1; - } - else + if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - // Fly to a location that the player can hit - bool flyToHittableLocation = NPC.ai[2] == slowDownDurationAfterCharge && !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); - if (flyToHittableLocation) + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + NPC.ai[1] += hyperMode ? 2f : 1f; + + float jumpGateValue = 60f; + float velocityX = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; + if (revenge) { - Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; - NPC.SimpleFlyMovement(velocity, 0.25f); - } - else - { - NPC.velocity *= 0.95f; - NPC.ai[2] -= 1f; + float moveBoost = death ? 60f * (1f - lifeRatio) : 40f * (1f - lifeRatio); + float speedBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; } - if (NPC.ai[2] <= 0f) + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 5f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 2f; + + if (NPC.ai[1] > jumpGateValue) { - NPC.Calamity().newAI[0] = NPC.ai[0]; + // Set damage + NPC.damage = setDamage; + + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 2f) + { + NPC.ai[3] = 0f; + velocityY *= 1.25f; + } + + NPC.ai[1] = 0f; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpGateValue - 30f) + NPC.aiAction = 1; + } + else + { + // Set damage + NPC.damage = setDamage; + + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; + } + } + + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + float phaseSwitchGateValue = 420f; + bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; + if (switchPhase) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + switch ((int)NPC.localAI[2]) + { + default: + case 1: + NPC.ai[0] = Main.rand.NextBool() ? 2f : 3f; + break; + + case 2: + NPC.ai[0] = Main.rand.NextBool() ? 3f : (hyperMode ? 2f : 1f); + break; + + case 3: + NPC.ai[0] = Main.rand.NextBool() ? (hyperMode ? 3f : 1f) : 2f; + break; + } + + if (NPC.ai[0] == 2f) + { + // Set damage + NPC.damage = setDamage; + + NPC.noTileCollide = true; + NPC.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; + } + + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + } + else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) + NPC.aiAction = 1; + } + } + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.velocity.X *= 0.85f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 30f) + { + if (revenge) + { + float slimeShotVelocity = 6f; + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; + float minFiringDistance = 160f; // 10 tile distance + if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + { + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = GlobDamage; + int numProj = death ? 6 : 4; + int spread = death ? 15 : 10; + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + } + else if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.noTileCollide = true; + NPC.noGravity = true; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; + + if (NPC.ai[2] == 1f) + { + NPC.ai[1] += 1f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; + + if (NPC.ai[1] > 12f) + { + NPC.ai[1] = 0f; + NPC.ai[0] = 2.1f; + NPC.ai[2] = 0f; + NPC.velocity = targetDist; + } + } + else + { + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 1f; + return; + } + + targetDist.Normalize(); + targetDist *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + } + } + else if (NPC.ai[0] == 2.1f) + { + // Set damage + NPC.damage = setDamage; + + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[2] = 1f; + NPC.netUpdate = true; + } + + if (atTargetPosition || NPC.velocity.Y <= 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) + { + SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Eruption of slime balls + float projectileVelocity = 4f; + int type = ModContent.ProjectileType(); + int damage = GlobDamage; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = 11; + float rotation = MathHelper.ToRadians(90); + for (int i = 0; i < numProj; i++) + { + // Spawn projectiles 0, 1, 2, 3, 7, 8, 9 and 10 + if (i < 4 || i > 6) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + + // Fire slime balls directly at players with a max of 2 + if (enraged && expertMode) + { + List targets = new List(); + foreach (Player plr in Main.ActivePlayers) + { + if (!plr.dead) + targets.Add(plr.whoAmI); + + if (targets.Count > 1) + break; + } + foreach (int t in targets) + { + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); + } + } + } + + NPC.localAI[2] = NPC.ai[0] - 0.1f; NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.localAI[2] = 0f; - - NPC.TargetClosest(); + NPC.ai[3] = 0f; NPC.netUpdate = true; } } + else if (NPC.ai[2] == 0f) + NPC.noTileCollide = true; + + NPC.noGravity = true; + + NPC.velocity.Y += 0.5f; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; + } + else if (NPC.ai[0] == 3f) + { + if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(); + NPC.velocity.X *= 0.8f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 15f) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[1] = 0f; + + NPC.velocity.Y -= 6f; + if (player.position.Y + player.height < NPC.Center.Y) + NPC.velocity.Y -= 1.2f; + if (player.position.Y + player.height < NPC.Center.Y - 40f) + NPC.velocity.Y -= 1.4f; + if (player.position.Y + player.height < NPC.Center.Y - 80f) + NPC.velocity.Y -= 1.7f; + if (player.position.Y + player.height < NPC.Center.Y - 120f) + NPC.velocity.Y -= 2f; + if (player.position.Y + player.height < NPC.Center.Y - 160f) + NPC.velocity.Y -= 2.2f; + if (player.position.Y + player.height < NPC.Center.Y - 200f) + NPC.velocity.Y -= 2.4f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + NPC.velocity.Y -= 2f; + + NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; + NPC.ai[2] += 1f; + } + else + NPC.aiAction = 1; + } + else + { + // Set damage + NPC.damage = setDamage; + + NPC.velocity.X *= 0.98f; + float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); + if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) + NPC.velocity.X = -velocityLimit; + if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) + NPC.velocity.X = velocityLimit; + } + + if (NPC.ai[2] >= 2f && NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } } // Despawn @@ -617,6 +610,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; + NPC.noTileCollide = true; NPC.Opacity -= 0.03f; if (NPC.timeLeft > 10) @@ -628,8 +622,44 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Teleport shit else if (NPC.ai[0] == 5f) + { + // Set damage + NPC.damage = setDamage; + + if (NPC.velocity.X > 0f) + NPC.direction = 1; + else + NPC.direction = -1; + + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; + distanceFromTarget.Y -= 16f; + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && + Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + if (distanceFromTarget.Length() > 12f) + { + distanceFromTarget.Normalize(); + distanceFromTarget *= 12f; + } + + NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + } + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -641,29 +671,29 @@ namespace CalamityMod.NPCs.SlimeGod scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.Bottom = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - NPC.ai[0] = 6f; + NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); + NPC.ai[0] = 7f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 6f; + NPC.ai[0] = 7f; NPC.ai[1] = 0f; } // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 6f) + else if (NPC.ai[0] == 7f) { // Avoid cheap bullshit NPC.damage = 0; @@ -675,7 +705,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -683,16 +713,16 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.TargetClosest(); } // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -709,11 +739,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.Center.X; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(Width * NPC.scale); - NPC.height = (int)(Height * NPC.scale); + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -727,9 +757,8 @@ namespace CalamityMod.NPCs.SlimeGod int randSlimeAmt = Main.rand.Next(1, 3); for (int j = 0; j < randSlimeAmt; j++) { - int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); @@ -738,126 +767,14 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } } - public static void FlyMovement(NPC npc, bool slimeBombardment = false) - { - // Difficulty bools - bool death = CalamityWorld.death; - bool revenge = CalamityWorld.revenge; - bool ableToDropSlime = npc.ai[1] == 1f; - - float flyVelocity = death ? 15f : revenge ? 12.5f : 10f; - float flyAcceleration = death ? 0.18f : revenge ? 0.15f : 0.12f; - - if (slimeBombardment) - { - // Increase max velocity while attempting to line up the bombardment - if (!ableToDropSlime) - flyVelocity *= 1.5f; - - // Keep acceleration high to maintain the bombardment path - flyAcceleration *= 2f; - } - - float slimeBombardmentDistance = 720f; - float flyDistanceY = slimeBombardment ? -450f : death ? -360f : -405f; - float flyDistanceX = slimeBombardment ? (ableToDropSlime ? (slimeBombardmentDistance * -npc.ai[2]) : (slimeBombardmentDistance * npc.ai[2])) : 0f; - Vector2 destination = Main.player[npc.target].Center + new Vector2(flyDistanceX, flyDistanceY); - - if (slimeBombardment) - { - if (!ableToDropSlime) - { - if (npc.Distance(destination) < 80f) - npc.ai[1] = 1f; - } - else - { - if (npc.ai[3] >= 180f || npc.Distance(destination) < 80f) - npc.ai[1] = 2f; - } - } - - Vector2 desiredVelocity = npc.Center; - - if (npc.timeLeft > 10) - { - if (!Collision.CanHit(npc, Main.player[npc.target]) && !slimeBombardment) - { - bool flyToSolidTilesAboveTarget = false; - Vector2 center = Main.player[npc.target].Center; - for (int i = 0; i < 16; i++) - { - float tileDistanceAboveTarget = 16 * i; - Point point = (center + new Vector2(0f, -tileDistanceAboveTarget)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) - { - desiredVelocity = center + new Vector2(0f, -tileDistanceAboveTarget + 16f) - npc.Center; - flyToSolidTilesAboveTarget = true; - break; - } - } - - if (!flyToSolidTilesAboveTarget) - desiredVelocity = center - npc.Center; - } - else - desiredVelocity = destination - npc.Center; - } - else - desiredVelocity = npc.Center + new Vector2(500f * npc.direction, flyDistanceY) - npc.Center; - - float distanceFromFlightTarget = desiredVelocity.Length(); - if (Math.Abs(desiredVelocity.X) < 40f) - desiredVelocity.X = npc.velocity.X; - - if (distanceFromFlightTarget > 100f && ((npc.velocity.X < -12f && desiredVelocity.X > 0f) || (npc.velocity.X > 12f && desiredVelocity.X < 0f))) - flyAcceleration *= 1.5f; - - if (distanceFromFlightTarget < 40f) - { - desiredVelocity = npc.velocity; - } - else if (distanceFromFlightTarget < 80f) - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= flyVelocity * 0.65f; - } - else - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= flyVelocity; - } - - npc.SimpleFlyMovement(desiredVelocity, flyAcceleration); - } - - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - - float minDist = hitboxTopLeft; - if (hitboxTopRight < minDist) - minDist = hitboxTopRight; - if (hitboxBotLeft < minDist) - minDist = hitboxBotLeft; - if (hitboxBotRight < minDist) - minDist = hitboxBotRight; - - return minDist <= 55f * NPC.scale; - } + public override bool CheckActive() => false; public override Color? GetAlpha(Color drawColor) { @@ -866,111 +783,13 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = TextureAssets.Npc[Type].Value; - Texture2D wingTexture = WingTexture.Value; - Color drawColorAlpha = NPC.GetAlpha(drawColor); - - // Stretch based on Y velocity. - float vel = NPC.velocity.Length(); - - float stretch = addedStretch; - - float rot = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(NPC.velocity) + MathHelper.ToRadians(90f)), Math.Clamp(vel / 30f, 0f, 1f)); - - NPC.rotation = MathHelper.Lerp(NPC.rotation, rot, 0.1f); - - // Stretch rapidly if about to jump or teleport. - if (NPC.aiAction == 1) - stretch += MathHelper.Lerp(-0.24f, 0.24f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f) / 2f + 0.5f) * (vel / 30); - - // Stretch while idle. - else - stretch += MathHelper.Lerp(-0.1f, 0.1f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) / 2f + 0.5f) * (vel / 30); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - - // Used for animating the wings. - bool blobSpreadPhase = NPC.ai[0] == 1f; - bool useFurledWingFrame = blobSpreadPhase && NPC.ai[1] >= 20f; - bool useSpreadWingFrame = blobSpreadPhase && NPC.ai[2] == 1f; - bool slimeBombardmentPhase = NPC.ai[0] == 2f; - bool slightlyIncreaseWingAnimationSpeed = slimeBombardmentPhase && NPC.ai[1] == 1f; - bool swoopingPhase = NPC.ai[0] == 3f; - bool increaseWingAnimationSpeed = swoopingPhase && NPC.ai[1] < 2f; - bool decreaseWingAnimationSpeed = swoopingPhase && NPC.ai[1] == 2f; - if (useFurledWingFrame) - { - wingFrameDrawn = 4; - } - else if (useSpreadWingFrame) - { - wingFrameDrawn = 0; - } - else if (NPC.localAI[0] % (decreaseWingAnimationSpeed ? 9f : increaseWingAnimationSpeed ? 4f : slightlyIncreaseWingAnimationSpeed ? 5f : 6f) == 0f) - { - wingFrameDrawn++; - if (wingFrameDrawn >= TotalWingFrames) - wingFrameDrawn = 0; - } - Rectangle wingFrame1 = new Rectangle(0, wingTexture.Height / TotalWingFrames * wingFrameDrawn, wingTexture.Width / 2, wingTexture.Height / TotalWingFrames); - Rectangle wingFrame2 = new Rectangle(wingTexture.Width / 2, wingTexture.Height / TotalWingFrames * wingFrameDrawn, wingTexture.Width / 2, wingTexture.Height / TotalWingFrames); - - Vector2 wingOrigin1 = new Vector2(wingTexture.Width, wingTexture.Height / TotalWingFrames) * 0.5f; - Vector2 wingOrigin2 = new Vector2(0, wingTexture.Height / TotalWingFrames) * 0.5f; - - Vector2 wingOffset1 = Vector2.Zero; - Vector2 wingOffset2 = Vector2.Zero; - - // Draw the wings. - spriteBatch.Draw(wingTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + wingOffset1, wingFrame1, drawColorAlpha, 0f, wingOrigin1, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(wingTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + wingOffset2, wingFrame2, drawColorAlpha, 0f, wingOrigin2, NPC.scale, spriteEffects, 0f); - - // Draw the actual paladin. - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY) + new Vector2(0, 16), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f + new Vector2(0, 8), scaleStretch, spriteEffects, 0f); - - return false; - } - public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Lavender; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - - if (NPC.life <= 0) { - NPC.position = NPC.Center; - NPC.width = NPC.height = (int)(160f * NPC.scale); - NPC.position.X = NPC.position.X - (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - - for (int i = 0; i < 40; i++) - { - int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[crimDust].scale = 0.5f; - Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - - for (int j = 0; j < 80; j++) - { - int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); - Main.dust[crimDust2].noGravity = true; - Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust2].velocity *= 2f; - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); } } diff --git a/NPCs/SlimeGod/EbonianPaladin.png b/NPCs/SlimeGod/EbonianPaladin.png index ac53c2dc32..11d5836fe5 100644 Binary files a/NPCs/SlimeGod/EbonianPaladin.png and b/NPCs/SlimeGod/EbonianPaladin.png differ diff --git a/NPCs/SlimeGod/EbonianPaladinGlob.png b/NPCs/SlimeGod/EbonianPaladinGlob.png deleted file mode 100644 index d62b3450bc..0000000000 Binary files a/NPCs/SlimeGod/EbonianPaladinGlob.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png b/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png deleted file mode 100644 index e77523d257..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/EbonianPaladinWings.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png b/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png deleted file mode 100644 index 274f324303..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/QueenSlimeGodCore.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png deleted file mode 100644 index 6e925fbe03..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png deleted file mode 100644 index a93444db0d..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEyeGlow.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png deleted file mode 100644 index 13ec3b7498..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay.png and /dev/null differ diff --git a/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png b/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png deleted file mode 100644 index cd8a5d67a3..0000000000 Binary files a/NPCs/SlimeGod/ExtraTextures/SlimeGodCorePossession.png and /dev/null differ diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index eaa14ff1bb..2674daac13 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,15 +1,22 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Paintings; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; @@ -29,22 +36,6 @@ namespace CalamityMod.NPCs.SlimeGod [AutoloadBossHead] public class SlimeGodCore : ModNPC { - private enum PaladinSlimeTypes - { - None, - Ebonian, - Crimulan - } - - private enum AggressionLevel - { - Neutral, - FireProjectiles, - ChargeAbovePlayer, - ChargeAtPlayer, - DoEverythingMoreOften - } - private bool slimesSpawned = false; private int buffedSlime = 0; @@ -54,43 +45,34 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); public static Asset EyeTexture; - public static Asset OverlayTexture; - - private int eyeFrameDrawn = 0; - private int eyeFrameX = 0; - private const int TotalXEyeFrames = 2; - private const int TotalEyeFrames = 25; - private const int TotalEyeFrames_FirstColumn = 19; public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.MPAllowedEnemies[Type] = true; - + NPCID.Sets.NeedsExpertScaling[Type] = true; + NPCID.Sets.TrailCacheLength[Type] = 8; + NPCID.Sets.TrailingMode[Type] = 1; if (!Main.dedServ) { - EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye", AssetRequestMode.AsyncLoad); - OverlayTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay", AssetRequestMode.AsyncLoad); + EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); } } public static int GlobDamage = 15; // 60 - public static int PossessionDamageBoost = 10; // +20 flat contact damage public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 40; // 80 + NPC.damage = 0; NPC.npcSlots = 10f; - NPC.width = 96; - NPC.height = 98; + NPC.width = 44; + NPC.height = 44; if (Main.getGoodWorld) NPC.scale = 2f; NPC.defense = 6; NPC.LifeMaxNERB(420); - NPCID.Sets.TrailCacheLength[Type] = 8; - NPCID.Sets.TrailingMode[Type] = 1; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -117,57 +99,6 @@ namespace CalamityMod.NPCs.SlimeGod }); } - public static bool ShouldDespawn(NPC npc) - { - return (!EbonianPaladinAlive(npc) && !CrimulanPaladinAlive(npc)) || npc.Calamity().newAI[3] == 1f || npc.ai[3] == 1f; - } - - public static bool EbonianPaladinAlive(NPC npc) - { - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - if ((npc.ModNPC as SlimeGodCore).buffedSlime == (int)PaladinSlimeTypes.Ebonian) - Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 1f; - else - Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; - - npc.Calamity().newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; - npc.Calamity().newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; - - // Despawn check - npc.Calamity().newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodPurple].ai[0] == 4f ? 1f : 0f; - - return true; - } - } - return false; - } - - public static bool CrimulanPaladinAlive(NPC npc) - { - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - if ((npc.ModNPC as SlimeGodCore).buffedSlime == (int)PaladinSlimeTypes.Crimulan) - Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 1f; - else - Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; - - npc.ai[1] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; - npc.ai[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; - - // Despawn check - npc.Calamity().newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].ai[0] == 3f ? 1f : 0f; - - return true; - } - } - return false; - } - public override void SendExtraAI(BinaryWriter writer) { writer.Write(slimesSpawned); @@ -188,23 +119,23 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(0.5f, 0.5f, 0.5f) * NPC.Opacity; - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.slimeGod = NPC.whoAmI; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // For animating the eye - NPC.localAI[0] += 1f; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; if (!slimesSpawned) @@ -217,46 +148,65 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Used to gauge how aggressive the core is, based on Paladins alive - // Stay near the Paladins and do nothing else at level 0 - // Fire projectiles at level 1 - // Charge at level 2 - // Follow the player around instead of the Paladins at level 3 - // Buff a Paladin far sooner, fire more projectiles, and charge faster at level 4 - int aggressionLevel = (int)AggressionLevel.Neutral; - if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) + // Enrage based on large slimes + bool purpleSlimeAlive = false; + bool redSlimeAlive = false; + + if (CalamityGlobalNPC.slimeGodPurple != -1) { - aggressionLevel = (int)AggressionLevel.FireProjectiles; - int splitPaladinCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - if (splitPaladinCount < 2) - aggressionLevel = (int)AggressionLevel.DoEverythingMoreOften; - else if (splitPaladinCount < 3) - aggressionLevel = (int)AggressionLevel.ChargeAtPlayer; - else if (splitPaladinCount < 4) - aggressionLevel = (int)AggressionLevel.ChargeAbovePlayer; + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + if (buffedSlime == 1) + Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 1f; + else + Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; + + calamityGlobalNPC.newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; + calamityGlobalNPC.newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; + + // Despawn check + calamityGlobalNPC.newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodPurple].ai[0] == 4f ? 1f : 0f; + + purpleSlimeAlive = true; + } } - // Enrage based on large slimes - bool purpleSlimeAlive = EbonianPaladinAlive(NPC); - bool redSlimeAlive = CrimulanPaladinAlive(NPC); + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + if (buffedSlime == 2) + Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 1f; + else + Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; + + NPC.ai[1] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.X; + NPC.ai[2] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; + + // Despawn check + calamityGlobalNPC.newAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].ai[0] == 3f ? 1f : 0f; + + redSlimeAlive = true; + } + } // Start shooting blobs more often, move faster and buff large slimes more often if one type of large slime is dead bool phase2 = !purpleSlimeAlive || !redSlimeAlive; // Vanish phase - if (ShouldDespawn(NPC)) + if ((!purpleSlimeAlive && !redSlimeAlive) || calamityGlobalNPC.newAI[3] == 1f || NPC.ai[3] == 1f) { - // Avoid cheap bullshit - NPC.damage = 0; - // 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 @@ -355,11 +305,11 @@ namespace CalamityMod.NPCs.SlimeGod } // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) { if (NPC.velocity.Y < -3f) NPC.velocity.Y = -3f; @@ -367,7 +317,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y > 16f) NPC.velocity.Y = 16f; - if (NPC.position.Y > Main.worldSurface * 16D) + if (NPC.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < Main.maxNPCs; x++) { @@ -396,42 +346,37 @@ namespace CalamityMod.NPCs.SlimeGod NPC.timeLeft = 1800; // Hide inside large slime - float hideInsideLargeSlimePhaseGateValue = aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften ? 120f : phase2 ? 300f : 900f; + float hideInsideLargeSlimePhaseGateValue = phase2 ? 300f : 900f; float hideInsideLargeSlimePhaseDuration = 600f; float exitLargeSlimeGateValue = hideInsideLargeSlimePhaseGateValue + hideInsideLargeSlimePhaseDuration; calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= hideInsideLargeSlimePhaseGateValue) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.rotation += NPC.direction * 0.3f; - if (buffedSlime == (int)PaladinSlimeTypes.None) + if (buffedSlime == 0) { SoundEngine.PlaySound(PossessionSound, NPC.Center); if (purpleSlimeAlive && redSlimeAlive) buffedSlime = Main.rand.Next(2) + 1; else if (purpleSlimeAlive) - buffedSlime = (int)PaladinSlimeTypes.Ebonian; + buffedSlime = 1; else if (redSlimeAlive) - buffedSlime = (int)PaladinSlimeTypes.Crimulan; + buffedSlime = 2; } Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); Vector2 redSlimeVector = new Vector2(NPC.ai[1], NPC.ai[2]); - Vector2 goToVector = buffedSlime == (int)PaladinSlimeTypes.Ebonian ? purpleSlimeVector : redSlimeVector; + Vector2 goToVector = buffedSlime == 1 ? purpleSlimeVector : redSlimeVector; Vector2 goToPosition = goToVector - NPC.Center; - NPC.velocity = goToPosition.SafeNormalize(Vector2.UnitY) * 24f; + NPC.velocity = Vector2.Normalize(goToPosition) * 24f; // Reduce velocity to 0 to avoid spastic movement when inside big slime. - float stickPositionAdjustment = buffedSlime == (int)PaladinSlimeTypes.Ebonian ? 16f : 32f; - if (Vector2.Distance(NPC.Center, goToVector) < 80f + stickPositionAdjustment) + if (Vector2.Distance(NPC.Center, goToVector) < 24f) { NPC.velocity = Vector2.Zero; - NPC.Center = goToVector + Vector2.UnitY * stickPositionAdjustment; NPC.Opacity -= 0.2f; if (NPC.Opacity < 0f) @@ -477,15 +422,11 @@ namespace CalamityMod.NPCs.SlimeGod return; } - // Avoid cheap bullshit - NPC.damage = 0; - - if (expertMode && aggressionLevel >= (int)AggressionLevel.FireProjectiles) + if (expertMode) { - float divisor = death ? 90f : revenge ? 120f : 150f; - divisor -= (aggressionLevel - 1) * 10f; - if (aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften) - divisor *= 0.5f; + float divisor = death ? 180f : revenge ? 240f : 300f; + if (phase2) + divisor /= 2; if (calamityGlobalNPC.newAI[2] % divisor == 0f) { @@ -494,17 +435,19 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.rand.NextBool()) { - float projectileVelocity = 4f + (aggressionLevel - 1) * 2f; + float projectileVelocity = 4f; int type = ModContent.ProjectileType(); - Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, GlobDamage, 0f, Main.myPlayer); + int damage = GlobDamage; + Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } else { - float projectileVelocity = 8f + (aggressionLevel - 1) * 2f; + float projectileVelocity = 8f; int type = ModContent.ProjectileType(); - Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, GlobDamage, 0f, Main.myPlayer); + int damage = GlobDamage; + Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } } } @@ -514,190 +457,158 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.Opacity > 0.8f) NPC.Opacity = 0.8f; - buffedSlime = (int)PaladinSlimeTypes.None; + buffedSlime = 0; float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; - flySpeed += aggressionLevel; - if (aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften) - flySpeed += 3f; if (phase2) - flySpeed *= 1.1f; + flySpeed *= 1.25f; if (Main.getGoodWorld) - flySpeed *= 1.3f; + flySpeed *= 1.25f; - Vector2 flyDestination = aggressionLevel >= (int)AggressionLevel.ChargeAtPlayer ? player.Center : player.Center - Vector2.UnitY * 320f; - Vector2 idealVelocity = (flyDestination - NPC.Center).SafeNormalize(Vector2.UnitY) * flySpeed; + Vector2 flyDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); + Vector2 flyDestination = GetFlyDestination(player); + Vector2 idealVelocity = (flyDestination - flyDirection).SafeNormalize(Vector2.UnitY) * flySpeed; float distanceFromFlyDestination = NPC.Distance(flyDestination); - if (aggressionLevel >= (int)AggressionLevel.ChargeAbovePlayer) + NPC.ai[0] -= 1f; + if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) { - NPC.ai[0] -= 1f; - float chargeGateDistance = aggressionLevel >= (int)AggressionLevel.ChargeAtPlayer ? 160f : 80f; - float chargeCooldown = 20f; - if (distanceFromFlyDestination < chargeGateDistance || NPC.ai[0] > 0f) - { - // Set damage - NPC.damage = NPC.defDamage; + if (distanceFromFlyDestination < 200f) + NPC.ai[0] = 20f; - if (distanceFromFlyDestination < chargeGateDistance) - NPC.ai[0] = chargeCooldown; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.rotation += NPC.direction * 0.3f; + NPC.rotation += NPC.direction * 0.3f; - return; - } + return; } - float slowDownDistance = 160f; - if (distanceFromFlyDestination < slowDownDistance && aggressionLevel < (int)AggressionLevel.ChargeAbovePlayer) - { - if (NPC.velocity.Length() > flySpeed * 0.1f) - NPC.velocity *= 0.9f; - } - else - { - float minInertia = 6f; - float minInertiaDistance = 200f; - float maxInertia = 50f - aggressionLevel * 3f; - float maxInertiaDistance = 600f; - float totalInertiaAdjustmentDistance = maxInertiaDistance - minInertiaDistance; - float distanceFromInertiaAdjustmentCutoff = distanceFromFlyDestination - minInertiaDistance; - if (Main.getGoodWorld) - maxInertia *= 0.8f; + float inertia = 50f; + if (Main.getGoodWorld) + inertia *= 0.8f; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + inertia -= Main.rand.Next(31); - float inertia = distanceFromFlyDestination >= maxInertiaDistance ? maxInertia : - distanceFromFlyDestination <= minInertiaDistance ? minInertia : - MathHelper.Lerp(minInertia, maxInertia, 1f - (totalInertiaAdjustmentDistance - distanceFromInertiaAdjustmentCutoff) / totalInertiaAdjustmentDistance); + NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); + if (distanceFromFlyDestination < 350f) + NPC.velocity = (NPC.velocity * 10f + idealVelocity) / 11f; + if (distanceFromFlyDestination < 300f) + NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f; - NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); + NPC.rotation = NPC.velocity.X * 0.1f; + } + + public Vector2 GetFlyDestination(Player target) + { + // Find all large slimes in the world. + // If multiple slimes are present, and they are all relatively close together, try to stay in their general area. + // If they are far apart, try to stay towards the closest slime. + // If no slimes exist, or they are all extremely far away, try to stay near the target player instead. + + int largeCrimulanPaladin = ModContent.NPCType(); + int splitCrimulanPaladin = ModContent.NPCType(); + int largeEbonianPaladin = ModContent.NPCType(); + int splitEbonianPaladin = ModContent.NPCType(); + List largeSlimes = new(); + + float ignoreGeneralAreaDistanceThreshold = 750f; + float ignoreAllSlimesDistanceThreshold = 3200f; + + // Find all slimes within a generous area. + foreach (NPC n in Main.ActiveNPCs) + { + int npcType = n.type; + if (npcType != largeCrimulanPaladin && npcType != splitCrimulanPaladin && npcType != largeEbonianPaladin && npcType != splitEbonianPaladin) + continue; + + if (!NPC.WithinRange(n.Center, ignoreAllSlimesDistanceThreshold)) + continue; + + largeSlimes.Add(n); } - NPC.rotation = NPC.velocity.X * 0.05f; + // If no slimes were found, don't bother doing any more calculations. Just use the player's center. + if (largeSlimes.Count <= 0) + return target.Center; + + // Find the closest slime. + NPC closestSlime = largeSlimes.OrderBy(n => n.Distance(NPC.Center)).First(); + + // Get the general area of all the slimes by averaging together their positions. + Vector2 generalSlimeArea = Vector2.Zero; + for (int i = 0; i < largeSlimes.Count; i++) + generalSlimeArea += largeSlimes[i].Center; + generalSlimeArea /= largeSlimes.Count; + + // Determine the average deviation of all slimes from the general area. + // This provides a general idea of how far apart all the slimes are from each-other. + float averageGeneralAreaDistanceDeviation = largeSlimes.Average(s => s.Distance(generalSlimeArea)); + + // The slimes are too far apart. Simply go with the closest slime. + if (averageGeneralAreaDistanceDeviation > ignoreGeneralAreaDistanceThreshold) + return closestSlime.Center; + + // Otherwise, use the average general position as a place to hover. + return generalSlimeArea; } public override Color? GetAlpha(Color drawColor) { - Color newColor = new Color(255, 255, 255, 255); + Color newColor = buffedSlime == 0 ? new Color(255, 255, 255, drawColor.A) : drawColor; return newColor * NPC.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - float sc = 1f; - if (!ShouldDespawn(NPC)) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) { - if (buffedSlime != (int)PaladinSlimeTypes.None) - { - NPC.scale = MathHelper.Lerp(NPC.scale, 0f, 0.2f); - NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0.7f, 0.4f); - } - else - { - NPC.scale = MathHelper.Lerp(NPC.scale, sc, 0.2f); - NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 1f, 0.4f); - } + spriteEffects = SpriteEffects.FlipHorizontally; } - - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Color drawColorAlpha = (buffedSlime != (int)PaladinSlimeTypes.None && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); - Vector2 origin = NPC.frame.Size() * 0.5f; - Vector2 halfSize = NPC.Size * 0.5f; - - Texture2D texture = TextureAssets.Npc[Type].Value; - Texture2D eyeTexture = EyeTexture.Value; - Texture2D overlayTexture = OverlayTexture.Value; - - // Used for animating the eye - if (NPC.localAI[0] % 6f == 0f && !NPC.IsABestiaryIconDummy) + Color drawColorAlpha = NPC.GetAlpha(drawColor); + Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0)); + Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; + Texture2D pog = EyeTexture.Value; + int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; + int y3 = frameTexture * (int)NPC.frameCounter; + Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture); + Vector2 halfRect = rectangle.Size() / 2f; + int twoConst = 2; + int coreID = 1; + spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); + if (Main.zenithWorld) { - eyeFrameDrawn++; - if (eyeFrameX == 0) - { - if (eyeFrameDrawn >= TotalEyeFrames_FirstColumn) - { - eyeFrameDrawn = 0; - eyeFrameX = 1; - } - } - else - { - if (eyeFrameDrawn >= TotalEyeFrames) - { - eyeFrameDrawn = 0; - eyeFrameX = 0; - } - } + spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); } - Rectangle eyeFrame = new Rectangle(eyeTexture.Width / TotalXEyeFrames * eyeFrameX, eyeTexture.Height / TotalEyeFrames * eyeFrameDrawn, eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames); - Vector2 eyeOrigin = new Vector2(eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames) * 0.5f; - if (!Main.zenithWorld) - { - Vector2 drawPositionAdjustment = halfSize - screenPos + new Vector2(0f, NPC.gfxOffY); - float colorAlphaDivisor = NPCID.Sets.TrailCacheLength[Type] * 1.5f; - int twoConst = 2; - int coreID = 1; - while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityClientConfig.Instance.Afterimages) { + Color colorLightingAlpha = NPC.GetAlpha(colorLightingArea); + { + goto IL_6899; + } +IL_6881: + coreID += twoConst; + continue; +IL_6899: float trailLengthMult = (float)(8 - coreID); if (twoConst < 0) + { trailLengthMult = (float)(1 - coreID); - - drawColorAlpha *= trailLengthMult / colorAlphaDivisor; - Vector2 drawPosition = NPC.oldPos[coreID] + drawPositionAdjustment; - - // Draw the base texture afterimages - spriteBatch.Draw(texture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - // Draw the eye texture afterimages - spriteBatch.Draw(eyeTexture, drawPosition, eyeFrame, drawColorAlpha, 0f, eyeOrigin, 1f, spriteEffects, 0f); - - // Draw the overlay texture afterimages - spriteBatch.Draw(overlayTexture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - coreID += twoConst; + } + colorLightingAlpha *= trailLengthMult / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + Vector2 drawPosition = NPC.oldPos[coreID]; + float coreRotate = NPC.rotation; + Main.spriteBatch.Draw(texture2D3, drawPosition + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorLightingAlpha, coreRotate + NPC.rotation * 0f * (float)(coreID - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, NPC.scale, spriteEffects, 0f); + goto IL_6881; } - } - - // Reset the color - drawColorAlpha = (buffedSlime != (int)PaladinSlimeTypes.None && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); - - // Draw the base texture - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - // Draw the eye - spriteBatch.Draw(eyeTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), eyeFrame, drawColorAlpha, 0f, eyeOrigin, 1f, spriteEffects, 0f); - - // Draw the overlay - spriteBatch.Draw(overlayTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - return false; } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - - float minDist = hitboxTopLeft; - if (hitboxTopRight < minDist) - minDist = hitboxTopRight; - if (hitboxBotLeft < minDist) - minDist = hitboxBotLeft; - if (hitboxBotRight < minDist) - minDist = hitboxBotRight; - - return minDist <= 40f * NPC.scale; - } - public override void BossLoot(ref int potionType) { potionType = ItemID.HealingPotion; @@ -733,8 +644,7 @@ namespace CalamityMod.NPCs.SlimeGod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); diff --git a/NPCs/SlimeGod/SlimeGodCore.png b/NPCs/SlimeGod/SlimeGodCore.png index be6295b7cf..64d666f45d 100644 Binary files a/NPCs/SlimeGod/SlimeGodCore.png and b/NPCs/SlimeGod/SlimeGodCore.png differ diff --git a/NPCs/SlimeGod/SlimeGodEyes.png b/NPCs/SlimeGod/SlimeGodEyes.png new file mode 100644 index 0000000000..dda0f23656 Binary files /dev/null and b/NPCs/SlimeGod/SlimeGodEyes.png differ diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 60b03274f5..af132c16ec 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -5,10 +5,8 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -19,13 +17,10 @@ namespace CalamityMod.NPCs.SlimeGod public class SplitCrimulanPaladin : ModNPC { private float bossLife; - private float addedStretch = 0f; - private float landingRecoil = 0f; - private const int Width = 166; - private const int Height = 114; public override void SetStaticDefaults() { + Main.npcFrameCount[Type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -37,17 +32,21 @@ namespace CalamityMod.NPCs.SlimeGod NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } + public static int GlobDamage = 15; // 60 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 36; // 72 NPC.LifeMaxNERB(1875, 2250, 80000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.width = Width; - NPC.height = Height; + NPC.damage = 36; // 72 + NPC.width = 150; + NPC.height = 92; + NPC.scale = 0.8f; NPC.defense = 10; NPC.knockBackResist = 0f; - NPC.Opacity = 1f; + AnimationType = NPCID.KingSlime; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -87,50 +86,26 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(0.75f, 0.15f, 0.15f) * NPC.scale; - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Reset defense and damage NPC.defense = NPC.defDefense; int setDamage = NPC.defDamage; - - // Boost defense and damage while buffed by the Slime God if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - setDamage += SlimeGodCore.PossessionDamageBoost; + setDamage += 22; } - // Used for landing squash and stretch - if (landingRecoil > 0f) - { - landingRecoil *= 0.965f; - landingRecoil -= 0.01f; - } - else - landingRecoil = 0f; - - addedStretch = -landingRecoil; - - // Used for teleporting - float scale = Main.getGoodWorld ? 0.8f : 1f; - - // How fast the slime slams down - float slamVelocity = death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f; - - // Used for how fast the slime animates + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; - - // Reset tile collide and gravity NPC.noTileCollide = false; NPC.noGravity = false; @@ -138,9 +113,12 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; - // Despawn if (NPC.ai[0] != 3f) { if (player.dead || !player.active) @@ -173,17 +151,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = NPC.defDefense * 2; } - // Slow down dramatically while teleporting - if (NPC.ai[0] == 4f || NPC.ai[0] == 5f) - { - if (Math.Abs(NPC.velocity.X) > 0.1f) - { - NPC.velocity.X *= 0.8f; - if (Math.Abs(NPC.velocity.X) <= 0.1f) - NPC.velocity.X = 0f; - } - } - // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -191,7 +158,10 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[0] = 4f; + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -245,118 +215,110 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport + // Get ready to teleport by increasing ai[3] // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - // Teleport very soon if too far away - float catchUpDistance = 1500f; - bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; - if (fastTeleport) - { - NPC.ai[3] += 10f; - } + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + NPC.ai[3] += death ? 3f : 2f; else - { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; - else - NPC.ai[3] += 1f; - } + NPC.ai[3] += 1f; } - float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * 0.005f; if (NPC.ai[0] == 0f) { + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); - NPC.TargetClosest(); NPC.velocity.X *= 0.8f; - } + NPC.ai[1] += 1f; - float landingSquashTime = 10f; - float telegraphTime = 20f; - float phaseSwitchGateValue = 120f; - float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; - if (NPC.ai[2] < jumpTelegraphGateValue) - { - if (NPC.velocity.Y == 0f) + float jumpGateValue = 35f; + float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f; + if (revenge) { - // Squash when landing - if (NPC.ai[1] < 0f) - landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; - - NPC.ai[1] += 1f; - - float jumpGateValue = 40f; - float velocityX = death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f; - if (revenge) - { - float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio); - float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; - } - - float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 6f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; - if (NPC.ai[1] >= jumpGateValue) - { - // Set damage - NPC.damage = setDamage; - - velocityX *= 1.25f; - NPC.ai[1] = -landingSquashTime; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpTelegraphGateValue2) - landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; + float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio); + float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; } - else + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 4f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 2f; + + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; + velocityX *= 1.25f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpGateValue - 30f) + NPC.aiAction = 1; + } + else + { + // Set damage + NPC.damage = setDamage; - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; - } + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; } } + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); + if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + + float phaseSwitchGateValue = 180f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -364,13 +326,11 @@ namespace CalamityMod.NPCs.SlimeGod { switch ((int)NPC.localAI[2]) { - // Jump combo default: case 1: NPC.ai[0] = 2f; break; - // Slam case 2: NPC.ai[0] = 1f; break; @@ -382,7 +342,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; + NPC.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; } NPC.ai[1] = 0f; @@ -390,12 +350,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[2] >= jumpTelegraphGateValue) - landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; + else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) + NPC.aiAction = 1; } } - - // Jump above for slam attack else if (NPC.ai[0] == 1f) { // Avoid cheap bullshit @@ -404,55 +362,53 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + NPC.spriteDirection = NPC.direction; - NPC.TargetClosest(); - - float distanceAboveTarget = 300f; - Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - float moveSpeed = slamVelocity - 6f; - float inertia = 5f; - velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; - - float delayBeforeSlamming = 12f; - if (NPC.ai[1] > delayBeforeSlamming) + if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = velocity; + NPC.velocity = targetDist; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - float moveSpeed = (death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f) + distanceSpeedBoost; - float inertia = 6f; - velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + targetDist.Normalize(); + targetDist *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } - - // Slam down else if (NPC.ai[0] == 1.1f) { // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -473,35 +429,16 @@ namespace CalamityMod.NPCs.SlimeGod // Eruption of slime balls that fall down float projectileVelocity = 8f; int type = ModContent.ProjectileType(); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); + int damage = GlobDamage; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); destination *= projectileVelocity; int numProj = 3; float rotation = MathHelper.ToRadians(45); - int dustType = DustID.TintableDust; - Color dustColor = Color.Crimson; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(30f, 30f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed * 1.5f, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); } // Fire slime balls directly at players with a max of 2 @@ -518,24 +455,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 projFireDirection = (Main.player[t].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -546,20 +467,17 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] = 0f; NPC.netUpdate = true; } - else - landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; NPC.noGravity = true; - NPC.velocity.Y += 0.55f; - if (NPC.velocity.Y > slamVelocity) - NPC.velocity.Y = slamVelocity; + NPC.velocity.Y += 0.5f; + float velocityLimit = death ? 16f : revenge ? 15f : expertMode ? 14f : 13f; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; } - - // Jump in quick succession else if (NPC.ai[0] == 2f) { if (NPC.velocity.Y == 0f) @@ -571,25 +489,34 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - float jumpGateValue = 15f; - if (NPC.ai[1] > jumpGateValue) + if (NPC.ai[1] > 15f) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - float jumpSpeedX = ((death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f) + distanceSpeedBoost) * NPC.direction; - float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); - if (jumpSpeedY < -16f) - jumpSpeedY = -16f; - - NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); + NPC.velocity.Y -= 3f; + if (player.position.Y + player.height < NPC.Center.Y) + NPC.velocity.Y -= 1.25f; + if (player.position.Y + player.height < NPC.Center.Y - 40f) + NPC.velocity.Y -= 1.5f; + if (player.position.Y + player.height < NPC.Center.Y - 80f) + NPC.velocity.Y -= 1.75f; + if (player.position.Y + player.height < NPC.Center.Y - 120f) + NPC.velocity.Y -= 2f; + if (player.position.Y + player.height < NPC.Center.Y - 160f) + NPC.velocity.Y -= 2.25f; + if (player.position.Y + player.height < NPC.Center.Y - 200f) + NPC.velocity.Y -= 2.5f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + NPC.velocity.Y -= 2f; + NPC.velocity.X = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 11f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else - landingRecoil += NPC.ai[1] / 10f; + NPC.aiAction = 1; } else { @@ -597,7 +524,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); + float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -609,17 +536,11 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (NPC.ai[2] >= 23f) - { - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - else - landingRecoil += (NPC.ai[2] - 3f) / 10f; + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } } @@ -641,8 +562,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Teleport shit else if (NPC.ai[0] == 4f) + { + // Set damage + NPC.damage = setDamage; + + if (NPC.velocity.X > 0f) + NPC.direction = 1; + else + NPC.direction = -1; + + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; + distanceFromTarget.Y -= 16f; + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && + Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + + if (distanceFromTarget.Length() > 12f) + { + distanceFromTarget.Normalize(); + distanceFromTarget *= 12f; + } + + NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + } + else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit NPC.damage = 0; @@ -655,28 +611,28 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 5f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 5f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; } // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 5f) + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -688,7 +644,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -696,26 +652,21 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.TargetClosest(); } // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } } - // Limit the landing recoil - if (landingRecoil > 0.36f) - landingRecoil = 0.36f; - - // Slime spawning and scale logic if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -727,11 +678,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.Center.X; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(Width * NPC.scale); - NPC.height = (int)(Height * NPC.scale); + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -742,11 +693,12 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); + int slimeType = ModContent.NPCType(); + if (Main.rand.NextBool(3)) + slimeType = ModContent.NPCType(); - int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); - int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; @@ -754,32 +706,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - - float minDist = hitboxTopLeft; - if (hitboxTopRight < minDist) - minDist = hitboxTopRight; - if (hitboxBotLeft < minDist) - minDist = hitboxBotLeft; - if (hitboxBotRight < minDist) - minDist = hitboxBotRight; - - return minDist <= 55f * NPC.scale; - } + public override bool CheckActive() => false; public override Color? GetAlpha(Color drawColor) { @@ -788,31 +721,6 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = TextureAssets.Npc[Type].Value; - Color drawColorAlpha = NPC.GetAlpha(drawColor); - - // Stretch based on Y velocity. - float stretch = NPC.velocity.Y * 0.03f; - stretch = Math.Abs(stretch) + addedStretch; - - // Stretch rapidly if about to jump or teleport, stretch normally while idle. - if (NPC.velocity.Y == 0f) - stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - float yOffset = stretch * 0.5f * NPC.height; - - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + CrimulanPaladin.SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); - - return false; - } - public override void OnKill() { int heartAmt = Main.rand.Next(3) + 3; @@ -830,20 +738,21 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } if (NPC.life <= 0) { - NPC.position = NPC.Center; - NPC.width = NPC.height = (int)(80f * NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - - for (int i = 0; i < 20; i++) + for (int i = 0; i < 40; i++) { - int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[crimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -851,13 +760,12 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - - for (int j = 0; j < 40; j++) + for (int j = 0; j < 70; j++) { - int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); Main.dust[crimDust2].noGravity = true; Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); Main.dust[crimDust2].velocity *= 2f; } } diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.png b/NPCs/SlimeGod/SplitCrimulanPaladin.png index bddad0012c..4496f5c719 100644 Binary files a/NPCs/SlimeGod/SplitCrimulanPaladin.png and b/NPCs/SlimeGod/SplitCrimulanPaladin.png differ diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index d33fbeb648..880c170ceb 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -5,10 +5,8 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -19,13 +17,10 @@ namespace CalamityMod.NPCs.SlimeGod public class SplitEbonianPaladin : ModNPC { private float bossLife; - private float addedStretch = 0f; - private float landingRecoil = 0f; - private const int Width = 166; - private const int Height = 114; public override void SetStaticDefaults() { + Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { @@ -37,19 +32,23 @@ namespace CalamityMod.NPCs.SlimeGod NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } + public static int GlobDamage = 15; // 60 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 36; // 72 NPC.LifeMaxNERB(2000, 2400, 110000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.width = Width; - NPC.height = Height; + NPC.damage = 36; // 72 + NPC.width = 150; + NPC.height = 92; + NPC.scale = 0.8f; NPC.defense = 8; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.Opacity = 1f; + AnimationType = NPCID.KingSlime; + NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -87,15 +86,13 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - Vector3 light = new Vector3(0.75f, 0.15f, 0.75f) * NPC.scale; - Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); - if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -104,25 +101,10 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 16; - setDamage += SlimeGodCore.PossessionDamageBoost; + setDamage += 20; } - // Used for landing squash and stretch - if (landingRecoil > 0f) - { - landingRecoil *= 0.965f; - landingRecoil -= 0.01f; - } - else - landingRecoil = 0f; - - addedStretch = -landingRecoil; - - float scale = Main.getGoodWorld ? 0.8f : 1f; - - // How fast the slime slams down - float slamVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - + float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -131,6 +113,10 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + Player player = Main.player[NPC.target]; if (NPC.ai[0] != 4f) @@ -160,17 +146,6 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - // Slow down dramatically while teleporting - if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) - { - if (Math.Abs(NPC.velocity.X) > 0.1f) - { - NPC.velocity.X *= 0.8f; - if (Math.Abs(NPC.velocity.X) <= 0.1f) - NPC.velocity.X = 0f; - } - } - // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -178,7 +153,10 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[0] = 5f; + // Slow down dramatically + NPC.velocity.X *= 0.5f; + + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -232,118 +210,110 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport + // Get ready to teleport by increasing ai[3] // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - // Teleport very soon if too far away - float catchUpDistance = 1500f; - bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; - if (fastTeleport) - { - NPC.ai[3] += 10f; - } + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + NPC.ai[3] += death ? 3f : 2f; else - { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; - else - NPC.ai[3] += 1f; - } + NPC.ai[3] += 1f; } - float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * 0.005f; if (NPC.ai[0] == 0f) { + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (revenge) - NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); - NPC.TargetClosest(); NPC.velocity.X *= 0.8f; - } + NPC.ai[1] += hyperMode ? 2f : 1f; - float landingSquashTime = 10f; - float telegraphTime = 20f; - float phaseSwitchGateValue = 150f; - float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime; - if (NPC.ai[2] < jumpTelegraphGateValue) - { - if (NPC.velocity.Y == 0f) + float jumpGateValue = 40f; + float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + if (revenge) { - // Squash when landing - if (NPC.ai[1] < 0f) - landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime; - - NPC.ai[1] += hyperMode ? 2f : 1f; - - float jumpGateValue = 45f; - float velocityX = death ? 13f : revenge ? 12f : expertMode ? 11f : 9f; - if (revenge) - { - float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); - float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - jumpGateValue -= moveBoost; - velocityX += speedBoost; - } - - float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); - float speedMult = 1f; - if (distanceBelowTarget > 0f) - speedMult += distanceBelowTarget * 0.002f; - - if (speedMult > 2f) - speedMult = 2f; - - float velocityY = 10f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; - if (NPC.ai[1] > jumpGateValue) - { - // Set damage - NPC.damage = setDamage; - - velocityY *= 1.25f; - NPC.ai[1] = -landingSquashTime; - NPC.velocity.Y -= velocityY * speedMult; - NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; - NPC.noTileCollide = true; - NPC.netUpdate = true; - } - else if (NPC.ai[1] >= jumpTelegraphGateValue2) - landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime; + float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); + float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + jumpGateValue -= moveBoost; + velocityX += speedBoost; } - else + + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float speedMult = 1f; + if (distanceBelowTarget > 0f) + speedMult += distanceBelowTarget * 0.002f; + + if (speedMult > 2f) + speedMult = 2f; + + float velocityY = 5f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + velocityY += 2f; + + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; - NPC.velocity.X *= 0.99f; - if (NPC.direction < 0 && NPC.velocity.X > -1f) - NPC.velocity.X = -1f; - if (NPC.direction > 0 && NPC.velocity.X < 1f) - NPC.velocity.X = 1f; + velocityY *= 1.25f; + NPC.ai[1] = 0f; + NPC.velocity.Y -= velocityY * speedMult; + NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction; + NPC.noTileCollide = true; + NPC.netUpdate = true; + } + else if (NPC.ai[1] >= jumpGateValue - 30f) + NPC.aiAction = 1; + } + else + { + // Set damage + NPC.damage = setDamage; - if (!player.dead) - { - if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) - NPC.noTileCollide = false; - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - NPC.noTileCollide = false; - else - NPC.noTileCollide = true; - } + NPC.velocity.X *= 0.99f; + if (NPC.direction < 0 && NPC.velocity.X > -1f) + NPC.velocity.X = -1f; + if (NPC.direction > 0 && NPC.velocity.X < 1f) + NPC.velocity.X = 1f; + + if (!player.dead) + { + if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y) + NPC.noTileCollide = false; + else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.noTileCollide = false; + else + NPC.noTileCollide = true; } } + NPC.ai[2] += 1f; + if (revenge) + NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio); + if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + + float phaseSwitchGateValue = 210f; bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue; if (switchPhase) { @@ -371,7 +341,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; + NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; } NPC.ai[1] = 0f; @@ -379,8 +349,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } } - else if (NPC.ai[2] >= jumpTelegraphGateValue) - landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; + else if (NPC.ai[1] >= phaseSwitchGateValue - 30f) + NPC.aiAction = 1; } } else if (NPC.ai[0] == 1f) @@ -398,12 +368,13 @@ namespace CalamityMod.NPCs.SlimeGod float slimeShotVelocity = 6f; Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; float minFiringDistance = 160f; // 10 tile distance - if (NPC.Distance(player.Center) > minFiringDistance) + if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) { SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); + int damage = GlobDamage; int numProj = death ? 5 : 3; int spread = death ? 12 : 8; float rotation = MathHelper.ToRadians(spread); @@ -411,7 +382,7 @@ namespace CalamityMod.NPCs.SlimeGod { Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 45f * NPC.scale, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } } @@ -431,44 +402,45 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + NPC.spriteDirection = NPC.direction; - NPC.TargetClosest(); - - float distanceAboveTarget = 350f; - Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; + Vector2 targetCenter = player.Center; + targetCenter.Y -= 350f; + Vector2 targetDist = targetCenter - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - float moveSpeed = slamVelocity - 6f; - float inertia = 5f; - velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + targetDist = player.Center - NPC.Center; + targetDist.Normalize(); + targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; + NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - float delayBeforeSlamming = 12f; - if (NPC.ai[1] > delayBeforeSlamming) + if (NPC.ai[1] > 12f) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = velocity; + NPC.velocity = targetDist; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; - float inertia = 6f; - velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; - NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + targetDist.Normalize(); + targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; + NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } } else if (NPC.ai[0] == 2.1f) @@ -476,7 +448,7 @@ namespace CalamityMod.NPCs.SlimeGod // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; + bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -497,38 +469,19 @@ namespace CalamityMod.NPCs.SlimeGod // Eruption of slime balls float projectileVelocity = 4f; int type = ModContent.ProjectileType(); - Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); + int damage = GlobDamage; + Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; + destination.Normalize(); destination *= projectileVelocity; int numProj = 9; float rotation = MathHelper.ToRadians(90); - int dustType = DustID.TintableDust; - Color dustColor = Color.Lavender; - dustColor.A = 150; - Vector2 dustSpawnBox = new Vector2(30f, 30f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { // Spawn projectiles 0, 1, 2, 6, 7 and 8 if (i < 3 || i > 5) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } @@ -546,24 +499,8 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 projFireDirection = (Main.player[t].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; - - float dustSpeed = Main.rand.NextFloat(2f, 4f); - float angleRandom = 0.1f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - - for (int j = 0; j < 24; j++) - { - int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); - Main.dust[slimeDust].velocity = dustVelocity; - Main.dust[slimeDust].color = dustColor; - Main.dust[slimeDust].noGravity = true; - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -574,8 +511,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[2] = 0f; NPC.netUpdate = true; } - else - landingRecoil += NPC.ai[1] / 10f; } else if (NPC.ai[2] == 0f) NPC.noTileCollide = true; @@ -583,8 +518,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - if (NPC.velocity.Y > slamVelocity) - NPC.velocity.Y = slamVelocity; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; + if (NPC.velocity.Y > velocityLimit) + NPC.velocity.Y = velocityLimit; } else if (NPC.ai[0] == 3f) { @@ -597,25 +533,34 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - float jumpGateValue = 15f; - if (NPC.ai[1] > jumpGateValue) + if (NPC.ai[1] > 15f) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - float jumpSpeedX = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 8f) + distanceSpeedBoost) * NPC.direction; - float jumpSpeedY = -6f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); - if (jumpSpeedY < -18f) - jumpSpeedY = -18f; - - NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); + NPC.velocity.Y -= 6f; + if (player.position.Y + player.height < NPC.Center.Y) + NPC.velocity.Y -= 1.2f; + if (player.position.Y + player.height < NPC.Center.Y - 40f) + NPC.velocity.Y -= 1.4f; + if (player.position.Y + player.height < NPC.Center.Y - 80f) + NPC.velocity.Y -= 1.7f; + if (player.position.Y + player.height < NPC.Center.Y - 120f) + NPC.velocity.Y -= 2f; + if (player.position.Y + player.height < NPC.Center.Y - 160f) + NPC.velocity.Y -= 2.2f; + if (player.position.Y + player.height < NPC.Center.Y - 200f) + NPC.velocity.Y -= 2.4f; + if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) + NPC.velocity.Y -= 2f; + NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else - landingRecoil += NPC.ai[1] / 10f; + NPC.aiAction = 1; } else { @@ -623,7 +568,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); + float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -635,17 +580,11 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] += 1f; - if (NPC.ai[2] >= 22f) - { - NPC.localAI[2] = NPC.ai[0]; - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - else - landingRecoil += (NPC.ai[2] - 2f) / 10f; + NPC.localAI[2] = NPC.ai[0]; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; } } @@ -667,8 +606,43 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Teleport shit else if (NPC.ai[0] == 5f) + { + // Set damage + NPC.damage = setDamage; + + if (NPC.velocity.X > 0f) + NPC.direction = 1; + else + NPC.direction = -1; + + NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; + distanceFromTarget.Y -= 16f; + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && + Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + + if (distanceFromTarget.Length() > 12f) + { + distanceFromTarget.Normalize(); + distanceFromTarget *= 12f; + } + + NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + } + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -681,28 +655,28 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 6f; + NPC.ai[0] = 7f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 6f; + NPC.ai[0] = 7f; NPC.ai[1] = 0f; } // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 6f) + else if (NPC.ai[0] == 7f) { // Avoid cheap bullshit NPC.damage = 0; @@ -714,7 +688,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.netUpdate = true; NPC.TargetClosest(); } @@ -722,25 +696,21 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) { NPC.ai[0] = 0f; - NPC.ai[1] = -10f; + NPC.ai[1] = 0f; NPC.TargetClosest(); } // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } } - // Limit the landing recoil - if (landingRecoil > 0.36f) - landingRecoil = 0.36f; - if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -752,11 +722,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.Center.X; + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(Width * NPC.scale); - NPC.height = (int)(Height * NPC.scale); + NPC.width = (int)(150f * NPC.scale); + NPC.height = (int)(92f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -767,10 +737,8 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; - - int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); + int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); @@ -779,32 +747,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } } } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); - float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); - float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); - float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - - float minDist = hitboxTopLeft; - if (hitboxTopRight < minDist) - minDist = hitboxTopRight; - if (hitboxBotLeft < minDist) - minDist = hitboxBotLeft; - if (hitboxBotRight < minDist) - minDist = hitboxBotRight; - - return minDist <= 55f * NPC.scale; - } + public override bool CheckActive() => false; public override Color? GetAlpha(Color drawColor) { @@ -813,31 +762,6 @@ namespace CalamityMod.NPCs.SlimeGod return newColor * NPC.Opacity; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = TextureAssets.Npc[Type].Value; - Color drawColorAlpha = NPC.GetAlpha(drawColor); - - // Stretch based on Y velocity. - float stretch = NPC.velocity.Y * 0.03f; - stretch = Math.Abs(stretch) + addedStretch; - - // Stretch rapidly if about to jump or teleport, stretch normally while idle. - if (NPC.velocity.Y == 0f) - stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); - - if (stretch > 0.5f) - stretch = 0.5f; - - Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - float yOffset = stretch * 0.5f * NPC.height; - - spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation + CrimulanPaladin.SlimeRotationFactor(NPC), NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); - - return false; - } - public override void OnKill() { int heartAmt = Main.rand.Next(3) + 3; @@ -855,35 +779,35 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Lavender; dustColor.A = 150; - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); - + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + } if (NPC.life <= 0) { - NPC.position = NPC.Center; - NPC.width = NPC.height = (int)(80f * NPC.scale); + NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); + NPC.width = 50; + NPC.height = 50; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - - for (int i = 0; i < 20; i++) + for (int i = 0; i < 40; i++) { - int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust].velocity *= 3f; + int corruptionDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[corruptionDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[crimDust].scale = 0.5f; - Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[corruptionDust].scale = 0.5f; + Main.dust[corruptionDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - - for (int j = 0; j < 40; j++) + for (int j = 0; j < 70; j++) { - int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); - Main.dust[crimDust2].noGravity = true; - Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); - Main.dust[crimDust2].velocity *= 2f; + int corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); + Main.dust[corruptionDust2].noGravity = true; + Main.dust[corruptionDust2].velocity *= 5f; + corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); + Main.dust[corruptionDust2].velocity *= 2f; } } } diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.png b/NPCs/SlimeGod/SplitEbonianPaladin.png index 2c59858364..11d5836fe5 100644 Binary files a/NPCs/SlimeGod/SplitEbonianPaladin.png and b/NPCs/SlimeGod/SplitEbonianPaladin.png differ diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs deleted file mode 100644 index a427360771..0000000000 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class AlphaSeaMinnow : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Flee = 1 - } - - public ref float CurrentBehavior => ref NPC.ai[1]; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 100; - public static int IdleMaxPathDistance = 1200; - - public static int FleeTileAnticipationDistance = 64; - - public Vector2 randomPathPoint; - - public bool instantiated = false; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 8; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0.5f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 40; - NPC.height = 32; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AlphaSeaMinnow") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Alphas released by the player do not spawn a shoal of minnows - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - NPC.TargetClosest(false); - // Spawn a shoal of minnows - int fishCount = Main.rand.Next(2, 7); - // More spawn in the Radiant Reefs - if (NPC.HasPlayerTarget) - { - if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - fishCount += 3; - } - for (int i = 0; i < fishCount; i++) - { - int goldchance = NPC.type == ModContent.NPCType() ? 20 : 50; - int minnowtype = Main.rand.NextBool(goldchance) ? ModContent.NPCType() : ModContent.NPCType(); - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); - Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha - } - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.6f; - MaxSpeed = 4f; - } - if (NPC.wet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - if (NPC.type == ModContent.NPCType()) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4f; - return; - } - - MaxSpeed = 8f; - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - Point lookAheadPosition = (NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates(); - if (!CalamityUtils.ParanoidTileRetrieval(lookAheadPosition.X, lookAheadPosition.Y).IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.ai[0] = 1f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (int)PhaseType.Flee; - } - - public override void ModifyTypeName(ref string typeName) - { - // Holy mackerel is that an Ultrakill reference!?!? - // (I have barely played the game as of writing this _ YuH) - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.MinnowPrime"); - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "AlphaSeaMinnow", 2); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - } - public class AlphaSeaMinnowGold : AlphaSeaMinnow - { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - base.SetStaticDefaults(); - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.rarity = 3; - NPC.catchItem = ModContent.ItemType(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - - } - return 0f; - } - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - } -} diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.png b/NPCs/SunkenSea/AlphaSeaMinnow.png deleted file mode 100644 index 46d9558e2f..0000000000 Binary files a/NPCs/SunkenSea/AlphaSeaMinnow.png and /dev/null differ diff --git a/NPCs/SunkenSea/AlphaSeaMinnowGold.png b/NPCs/SunkenSea/AlphaSeaMinnowGold.png deleted file mode 100644 index 97bcba564f..0000000000 Binary files a/NPCs/SunkenSea/AlphaSeaMinnowGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 8d45a19a5f..a2c9132f7a 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,73 +1,34 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; - namespace CalamityMod.NPCs.SunkenSea { - public class BabyGhostBell : SunkenSeaNPC + public class BabyGhostBell : ModNPC { public bool hasBeenHit = false; - public static Asset RadiantTexture; - public static Asset VoltaicTexture; - public static Asset PinkTexture; - public static Asset GreenTexture; - public static Asset GoldTexture; - public ref float Variant => ref NPC.ai[1]; - public enum JellyColor - { - Blue = 0, - Green = 1, - Pink = 2, - Radiant = 3, - Voltaic = 4, - Gold = 5 - } - /// - /// The squish of this NPC while drawing. - /// - private Vector2 ScaleSquish = Vector2.One; - - // keeps track of the number of hops between a flip - public int flipCounter; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows; - - public override void Load() - { - RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRadiant"); - VoltaicTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellVoltaic"); - GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGreen"); - PinkTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellPink"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGold"); - } + public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -75,7 +36,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.chaseable = false; - NPC.dontTakeDamageFromHostiles = true; NPC.aiStyle = -1; AIType = -1; NPC.damage = 0; @@ -84,12 +44,13 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 0; NPC.lifeMax = 5; NPC.knockBackResist = 1f; - NPC.alpha = 75; + NPC.alpha = 100; NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -112,58 +73,6 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - // Bells released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - Variant = Main.rand.Next(0, 3); - if (Main.rand.NextBool(30)) - { - Variant = (int)JellyColor.Radiant; - } - if (Main.rand.NextBool(15)) - { - Variant = (int)JellyColor.Voltaic; - } - if (Main.rand.NextBool(50)) - { - Variant = (int)JellyColor.Gold; - } - switch (Variant) - { - case (int)JellyColor.Blue: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Pink: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Radiant: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - case (int)JellyColor.Gold: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - case (int)JellyColor.Voltaic: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - } - } - public override void AI() { if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -187,113 +96,22 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - - // Reset any squish that is done to the Ghost Bells, and clamps its upper limit to prevent it from becoming too tall - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - - // Quick lil hops in semi-random directions for movement. its thursday + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); if (NPC.wet) { - NPC.height = (int)(36 * NPC.scale); - if (NPC.velocity.Length() < 0.5f) + NPC.noGravity = true; + if (NPC.velocity.Y < 0f) { - // stretch a bit for ~ effect ~ - ScaleSquish.Y += 0.4f; - - // get a semi-random float that is equivalent to +- X (normalised) degrees around the current rotation - float semiRandomAngle = Main.rand.NextFloat(-0.7f, 0.7f); - // multiply velocity by a random amount to break up cycles and appear more natural - NPC.velocity *= Main.rand.NextFloat(12f, 15f); - // check if the velocity lands itself into a tile - bool bonk = CalamityUtils.DistanceToTileCollisionHit(NPC.position, NPC.velocity, 9) != null; - - // random chance if the last direction flip was 3+ hops ago OR if the ghost bell is about to bonk a tile - if ((flipCounter >= 3 && Main.rand.NextBool(6)) || bonk) - { - // send it in the opposite direction - NPC.velocity *= -1; - NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); - flipCounter = 0; // reset the counter - //Main.NewText("flip! " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); - } - else - { - // send it in a random direction - NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); - ++flipCounter; // add to the counter - //Main.NewText("swim, " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); - } + NPC.velocity.Y += 0.1f; } - NPC.velocity *= 0.95f; - NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); - - if (NPC.velocity == Vector2.Zero) + if (NPC.velocity.Y > 0f) { - // failsafe. turns out they love getting themselves stuck in walls, so this is necessary to prevent that - NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); + NPC.velocity.Y = 0f; } } else { - // wouldnt want it flipping back into the air immediately, would we? - flipCounter = 0; - // Height is changed so that the jelly looks like it's actually laying on the ground when rotated - NPC.height = (int)(24 * NPC.scale); - // Gravy - if (NPC.velocity.Y < 10) - { - NPC.velocity.Y += 0.5f; - } - // Once it has hit the ground, fall over - if (Math.Abs(NPC.velocity.Y) < 1 && NPC.collideY) - { - // Splat - if (NPC.ai[2] == 0) - { - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, NPC.Center); - NPC.ai[2] = 1; - } - NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.7f); - } - // Reset the splat sound - else - { - NPC.ai[2] = 0; - } - } - // Lite - Color lightColor = Color.LightBlue; // Voltaic uses the same light blue - switch (Variant) - { - case (int)JellyColor.Pink: - lightColor = Color.Pink; - break; - case (int)JellyColor.Green: - lightColor = Color.LightGreen; - break; - case (int)JellyColor.Radiant: - lightColor = Color.LightBlue * 1.1f; // Radiant glows brighter - break; - } - Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); - - if (Variant == (int)JellyColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (Variant == (int)JellyColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantBabyGhostBell"); - } - if (Variant == (int)JellyColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldBabyGhostBell"); + NPC.noGravity = false; } } @@ -309,79 +127,50 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 1.5f; } return 0f; } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + public override void HitEffect(NPC.HitInfo hit) { - int dustType = DustID.BlueCrystalShard; - switch (Variant) - { - case (int)JellyColor.Pink: - dustType = DustID.PinkTorch; - break; - case (int)JellyColor.Green: - dustType = DustID.GemEmerald; - break; - case (int)JellyColor.Gold: - dustType = DustID.GoldCritter; - break; - } for (int k = 0; k < 2; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)JellyColor.Pink: - texture = PinkTexture.Value; - break; - case (int)JellyColor.Green: - texture = GreenTexture.Value; - break; - case (int)JellyColor.Radiant: - texture = RadiantTexture.Value; - break; - case (int)JellyColor.Voltaic: - texture = VoltaicTexture.Value; - break; - case (int)JellyColor.Gold: - texture = GoldTexture.Value; - break; - } - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[Type] / 2); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, ScaleSquish, spriteEffects, 0f); - - return false; - } } } diff --git a/NPCs/SunkenSea/BabyGhostBell.png b/NPCs/SunkenSea/BabyGhostBell.png index 798cf525ee..ee927c6bed 100644 Binary files a/NPCs/SunkenSea/BabyGhostBell.png and b/NPCs/SunkenSea/BabyGhostBell.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGlow.png b/NPCs/SunkenSea/BabyGhostBellGlow.png new file mode 100644 index 0000000000..ee927c6bed Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGlow.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGold.png b/NPCs/SunkenSea/BabyGhostBellGold.png deleted file mode 100644 index 198d7a739d..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellGreen.png b/NPCs/SunkenSea/BabyGhostBellGreen.png deleted file mode 100644 index aa7ee07608..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellPink.png b/NPCs/SunkenSea/BabyGhostBellPink.png deleted file mode 100644 index 46093d1e35..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellRadiant.png b/NPCs/SunkenSea/BabyGhostBellRadiant.png deleted file mode 100644 index 701a3c69bc..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellVoltaic.png b/NPCs/SunkenSea/BabyGhostBellVoltaic.png deleted file mode 100644 index a0d92340e2..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellVoltaic.png and /dev/null differ diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs new file mode 100644 index 0000000000..7d43671bd6 --- /dev/null +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -0,0 +1,150 @@ +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class BlindedAngler : ModNPC + { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 56; + NPC.height = 44; + NPC.defense = 30; + NPC.lifeMax = 750; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlindedAngler") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + { + return NPC.chaseable; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 5, 9); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/BlindedAngler.png b/NPCs/SunkenSea/BlindedAngler.png new file mode 100644 index 0000000000..afdae09734 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAngler.png differ diff --git a/NPCs/SunkenSea/BlindedAnglerGlow.png b/NPCs/SunkenSea/BlindedAnglerGlow.png new file mode 100644 index 0000000000..c38e496699 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAnglerGlow.png differ diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs deleted file mode 100644 index 73c9da2325..0000000000 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Dusts; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class CarrionSwallower : ModNPC - { - public ref float Timer => ref NPC.ai[0]; - public ref float AttackState => ref NPC.ai[1]; - public ref float ExtraTimer => ref NPC.ai[2]; - public ref float PusAmount => ref NPC.ai[3]; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 20f }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.width = 50; - NPC.height = 42; - NPC.lifeMax = 65; - NPC.damage = 25; - NPC.defense = 0; - NPC.knockBackResist = 0f; - NPC.HitSound = SoundID.DD2_SkeletonHurt; - NPC.DeathSound = SoundID.DD2_SkeletonDeath; - NPC.noGravity = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange( - [ - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CarrionSwallower") - ]); - } - - public override void AI() - { - NPC.TargetClosest(false); - Player target = Main.player[NPC.target]; - NPC.spriteDirection = NPC.direction; - - // Passive when first spawned - if (NPC.localAI[0] == 0f) - { - NPC.damage = 0; - PusAmount = 3; - NPC.velocity.X = 5f * NPC.direction; - if (NPC.velocity.X == 0f) - NPC.direction = -NPC.direction; - - // Attack if get too close - if (target.Distance(NPC.Center) < 320f) - { - NPC.localAI[0] = 1f; - NPC.netUpdate = true; - } - } - // Attacking - else - { - NPC.direction = (NPC.velocity.X > 0f).ToDirectionInt(); - Timer++; - // Sac full - if (AttackState == 0f) - { - NPC.damage = 0; - if (Timer < 180f || (target.Distance(NPC.Center) > 400f && ExtraTimer == 0f)) - { - Vector2 targetDirection = Utils.DirectionTo(NPC.Center, target.Center); - NPC.velocity = (NPC.velocity * 55f + targetDirection * 7f) / 56f; - } - else - { - ExtraTimer++; - NPC.velocity *= 0.975f; - // Fire pus at the player - if (ExtraTimer == 40f) - { - SoundEngine.PlaySound(SoundID.NPCHit10, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 spawn = NPC.Center + Vector2.UnitX * 13f * NPC.spriteDirection; - Projectile.NewProjectile(NPC.GetSource_FromThis(), spawn, Utils.DirectionTo(spawn, target.Center) * 10f, ModContent.ProjectileType(), 12, 0f, Main.myPlayer); - } - - Timer = 0f; - ExtraTimer = 0f; - // Starts with 3 shots, after firing them all the sac empties and it switches to charge mode - PusAmount--; - if (PusAmount == 0) - AttackState = 1f; - } - else // Dust telegraph - { - Vector2 dustSpawn = NPC.Center + Vector2.UnitX * 20f * NPC.direction * NPC.scale; - Vector2 dustVel = (Vector2.UnitX * 3f).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextBool().ToDirectionInt(); - Dust dust = Dust.NewDustPerfect(dustSpawn, ModContent.DustType(), dustVel, 100, Main.rand.NextBool() ? Color.Yellow : Color.DarkRed, 0.6f); - dust.noLightEmittence = true; - } - } - } - // Sac empty - else - { - if (Timer < 180f || (target.Distance(NPC.Center) > 320f && ExtraTimer == 0f)) - { - Vector2 targetDirection = Utils.DirectionTo(NPC.Center, target.Center); - NPC.velocity = (NPC.velocity * 40f + targetDirection * 10f) / 41f; - } - else - { - ExtraTimer++; - // Charge - if (ExtraTimer == 40f) - { - SoundEngine.PlaySound(SoundID.NPCHit6, NPC.Center); - NPC.damage = NPC.defDamage; - NPC.velocity = Utils.DirectionTo(NPC.Center, target.Center) * 13.5f; - - CustomPulse woosh = new(NPC.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0.1f, 0.6f, 15); - GeneralParticleHandler.SpawnParticle(woosh); - } - else if (ExtraTimer < 40f) - { - Vector2 dustSpawn = NPC.Center + Main.rand.NextVector2CircularEdge(35f, 35f); - Vector2 dustVel = Utils.DirectionTo(dustSpawn, NPC.Center) * 4f + NPC.velocity * 0.75f; - Dust dust = Dust.NewDustPerfect(dustSpawn, ModContent.DustType(), dustVel, 100, Color.DarkRed, 0.6f); - dust.noLightEmittence = true; - } - - NPC.velocity *= ExtraTimer > 60f ? 0.96f : ExtraTimer < 40f ? 0.98f : 1f; - - // Reset - if (ExtraTimer == 70f) - { - NPC.damage = 0; - Timer = 0f; - ExtraTimer = 0f; - if (NPC.localAI[1] == 1f) - { - NPC.localAI[1] = 0f; - AttackState = 0f; - PusAmount = 3; - } - } - } - } - - if (NPC.velocity.X == 0f) - NPC.velocity.X = -NPC.oldVelocity.X * 0.7f; - if (NPC.velocity.Y == 0f) - NPC.velocity.Y = -NPC.oldVelocity.Y * 0.7f; - } - } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // This code has to be run in ModifyHitPlayer because otherwise shields prevent it from working - // We don't have to check the AttackState because it only deals contact damage while ramming - // localAI[1] is used a temp set for filling with pus so that the current charge can finish before starting pus shooting mode - NPC.localAI[1] = 1f; - NPC.ForceNetUpdate(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - } - - /*public override void FindFrame(int frameHeight) - { - base.FindFrame(frameHeight); - }*/ - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - // If in the bestiary or is buffering the pus fill from hitting a charge, draw the sac; otherwise it's based on AttackState - Rectangle frame = tex.Frame(2, 1, NPC.IsABestiaryIconDummy || NPC.localAI[1] == 1f ? 0 : (int)AttackState, NPC.frame.Y); - - spriteBatch.Draw(tex, NPC.Center - screenPos, frame, drawColor, NPC.rotation, frame.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - return false; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); - } - - public override void HitEffect(NPC.HitInfo hit) - { - CalamityUtils.SpawnGores(NPC, "CarrionSwallower", 2); - } - } -} diff --git a/NPCs/SunkenSea/CarrionSwallower.png b/NPCs/SunkenSea/CarrionSwallower.png deleted file mode 100644 index da8e034106..0000000000 Binary files a/NPCs/SunkenSea/CarrionSwallower.png and /dev/null differ diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index d282fb35f8..11e0c19ab5 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -1,17 +1,9 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; +using CalamityMod.Items.Placeables.Banners; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -20,61 +12,13 @@ namespace CalamityMod.NPCs.SunkenSea { public class Clam : ModNPC { - public enum PersonalityTypes - { - Reefs = 0, - Burrows = 1, - Den = 2 - } - - public enum PhaseType - { - Idle = 0, - Attacking = 1, - Squirt = 2, - Pod = 3 - } - - public Player Target => Main.player[NPC.target]; - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public ref float Personality => ref NPC.ai[3]; - - public ref float ShellRotation => ref NPC.localAI[0]; - - public int originalDamage; - - #region Textures - - public static Asset bottomJawTex; - - public static Asset bottomJawTexAlgae; - - public static Asset bottomJawTexCoral; - - public static Asset algaeTex; - - public static Asset coralTex; - - public static Asset backTex; - #endregion - - public override void Load() - { - backTex = ModContent.Request(Texture + "Back"); - bottomJawTex = ModContent.Request(Texture + "Bottom"); - bottomJawTexAlgae = ModContent.Request(Texture + "BottomAlgae"); - bottomJawTexCoral = ModContent.Request(Texture + "BottomCoral"); - algaeTex = ModContent.Request(Texture + "Algae"); - coralTex = ModContent.Request(Texture + "Coral"); - } + private int hitAmount = 0; + private bool hasBeenHit = false; + private bool statChange = false; public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -84,9 +28,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - originalDamage = NPC.damage = Main.hardMode ? 60 : 30; - NPC.width = 50; - NPC.height = 30; + NPC.damage = Main.hardMode ? 60 : 30; + NPC.width = 56; + NPC.height = 38; NPC.defense = 9999; NPC.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) @@ -95,17 +39,16 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(silver: 5) : Item.buyPrice(silver: 1); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit4; - NPC.knockBackResist = 0; + NPC.knockBackResist = 0.05f; Banner = NPC.type; BannerItem = ModContent.ItemType(); - NPC.GravityIgnoresLiquid = true; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -118,272 +61,122 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); + writer.Write(hitAmount); + writer.Write(NPC.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); } public override void ReceiveExtraAI(BinaryReader reader) { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.TargetClosest(); - - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - NPC.localAI[1] = Main.rand.Next(0, 4); - - if (Target.Calamity().ZoneClamDen) - Personality = (int)PersonalityTypes.Den; - else if (Target.Calamity().ZoneGleamingBurrows) - Personality = (int)PersonalityTypes.Burrows; - else - Personality = (int)PersonalityTypes.Reefs; + hitAmount = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); } public override void AI() { - // Rotation at its peak - float maxRotation = MathHelper.ToRadians(60); - NPC.TargetClosest(false); - // Always be mad during Clamity + NPC.TargetClosest(true); if (Main.player[NPC.target].Calamity().clamity) { - Personality = (int)PersonalityTypes.Burrows; + hitAmount = 3; + hasBeenHit = true; } - switch (CurrentPhase) + if (NPC.justHit && hitAmount < 3) { - case (int)PhaseType.Idle: - { - NPC.damage = 0; - NPC.chaseable = false; - NPC.velocity.X *= 0.9f; - if (ShellRotation > 0) - { - ShellRotation -= 0.2f; - if (ShellRotation < 0) - ShellRotation = 0; - } - else if (ShellRotation < 0) - { - ShellRotation += 0.03f; - if (ShellRotation > 0) - { - ShellRotation = 0; - } - } - switch (Personality) - { - // Aggro immediately - case (int)PersonalityTypes.Den: - { - ChangePhase((int)PhaseType.Attacking); - } - break; - // Aggro if the player is near - case (int)PersonalityTypes.Burrows: - { - if (Target.Distance(NPC.Center) < 600 && NPC.HasSight(Target.Center)) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - // Aggro if hurt - default: - { - if (NPC.life < (NPC.lifeMax - 2)) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - } - } - break; - case (int)PhaseType.Attacking: - { - NPC.damage = 0; - NPC.knockBackResist = 0.05f; - NPC.defense = Main.hardMode ? 15 : 6; - NPC.chaseable = true; - Timer++; - if (NPC.velocity.Y == 0) - { - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - NPC.velocity.X = 0; - NPC.ai[2]++; - if (NPC.ai[2] > Main.rand.Next(30, 60)) - { - NPC.velocity.Y = -4; - NPC.velocity.X = NPC.direction * 6; - NPC.ai[2] = 0; - } - } - else - { - NPC.damage = originalDamage; - - if (NPC.velocity.Y < 0) - { - ShellRotation += 0.065f; - if (ShellRotation > maxRotation) - ShellRotation = maxRotation; - } - NPC.velocity.X *= 0.99f; - } - - if (NPC.position.Distance(NPC.oldPosition) < 8 && NPC.velocity.Y >= 0) - { - ShellRotation -= 0.065f; - if (ShellRotation < 0) - ShellRotation = 0; - } - - // Squirt - if (Timer > Main.rand.Next(220, 260) && NPC.HasSight(Target.Center) && ShellRotation == 0) - { - ChangePhase((int)PhaseType.Squirt); - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - } - NPC.StepUpBlocks(); - } - break; - case (int)PhaseType.Squirt: - { - NPC.damage = 0; - NPC.chaseable = true; - // Slow down. Once the clam is rested, start incrementing Timer - if (NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.8f; - // Set ai[2] to 1 - NPC.ai[2] = 1; - } - - // Increment Timer is ai[2] is 1 - if (NPC.ai[2] == 1) - { - Timer++; - } - - // When to start opening - float startOpen = 30; - // When to end opening - float endOpen = startOpen + 30; - // When to start closing - float startClose = endOpen + 20; - // When to stop closing - float endClose = startClose + 5; - // When to go to the next attack - float reset = endClose + 60; - - // Direction the player is relative to the clam - int playerPosition = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - // Shell animation - if (Timer >= startOpen && Timer <= endOpen) - { - ShellRotation = (float)Utils.AngleLerp(0, maxRotation, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startOpen, endOpen, Timer, true), 0)); - } - else if (Timer >= startClose && Timer <= endClose) - { - ShellRotation = (float)Utils.AngleLerp(maxRotation, 0, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startClose, endClose, Timer, true), 0)); - } - - // Fire the projectile - if (Timer == (endClose - 5)) - { - NPC.damage = originalDamage; - Vector2 velocity = NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * 5; - - // If the player is on the other side of the clam, flip the jet so that it doesn't fire backwards - if (playerPosition != NPC.direction) - velocity.X *= -1; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), Main.hardMode ? 30 : 15, 1); - } - for (int i = 0; i < 9; i++) - { - GenericBubbleParticle waterFlavored = new GenericBubbleParticle(NPC.Center, Main.rand.NextFloat(16, 22) * velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(-4, 4), 5); - waterFlavored.AffectedByLight = true; - GeneralParticleHandler.SpawnParticle(waterFlavored); - } - - SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), NPC.Center); - SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), NPC.Center); - } - - // Go back to melee - if (Timer >= reset) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - case (int)PhaseType.Pod: - { - NPC.damage = 0; - - NPC.chaseable = true; - NPC pod = Main.npc[(int)NPC.localAI[2] - 1]; - // If the Pearlpod is invalid, go back to idling - if (pod == null || !pod.active || pod.life < 0 || pod.ModNPC == null || pod.ModNPC is not Pearlpod) - { - NPC.localAI[2] = 0; - ChangePhase((int)PhaseType.Idle); - } - else - { - // Face towards the Pearlpod while it's still out - if (pod.Opacity == 1) - NPC.direction = NPC.DirectionTo(pod.Center).X.DirectionalSign(); - // Start closing when the Pearlpod is nearby - if (pod.Distance(NPC.Center) > 30) - { - ShellRotation += 0.05f; - if (ShellRotation > maxRotation) - ShellRotation = maxRotation; - } - // Otherwise open up! - else - { - ShellRotation -= 0.2f; - if (ShellRotation < -0.2f) - ShellRotation = -0.2f; - } - } - } - break; + ++hitAmount; + hasBeenHit = true; } - NPC.spriteDirection = NPC.direction; - } - - public void ChangePhase(int phaseNum, bool resetai2 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - NPC.netUpdate = true; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return CurrentPhase > 0; + NPC.chaseable = hasBeenHit; + if (hitAmount == 3) + { + if (!statChange) + { + NPC.defense = Main.hardMode ? 15 : 6; + NPC.damage = NPC.defDamage; + statChange = true; + } + if (NPC.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9) + { + NPC.ai[0] = 1f; + NPC.netUpdate = true; + return; + } + NPC.ai[0] = 1f; + NPC.netUpdate = true; + return; + } + } + else if (NPC.velocity.Y == 0f) + { + NPC.ai[2] += 1f; + int decelerationTimer = 20; + if (NPC.ai[1] == 0f) + { + decelerationTimer = 12; + } + if (NPC.ai[2] < (float)decelerationTimer) + { + NPC.velocity.X *= 0.9f; + return; + } + NPC.ai[2] = 0f; + NPC.TargetClosest(true); + if (NPC.direction == 0) + { + NPC.direction = -1; + } + NPC.spriteDirection = -NPC.direction; + NPC.ai[1] += 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 4f) + { + NPC.ai[3] = 0f; + if (NPC.ai[1] == 2f) + { + float multiplierX = (float)Main.rand.Next(3, 7); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -8f; + NPC.ai[1] = 0f; + } + else + { + float multiplierX = (float)Main.rand.Next(5, 9); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -4f; + } + } + NPC.netUpdate = true; + return; + } + else + { + if (NPC.direction == 1 && NPC.velocity.X < 1f) + { + NPC.velocity.X = NPC.velocity.X + 0.1f; + return; + } + if (NPC.direction == -1 && NPC.velocity.X > -1f) + { + NPC.velocity.X = NPC.velocity.X - 0.1f; + return; + } + } + } + else + NPC.damage = 0; } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return CurrentPhase > 0; + return hasBeenHit; } return null; } @@ -396,7 +189,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (CurrentPhase == 0) + if (hitAmount < 3) { NPC.frame.Y = frameHeight * 4; } @@ -411,16 +204,9 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Water) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.8f; - - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 1f; - - if (spawnInfo.Player.Calamity().ZoneClamDen) - return SpawnCondition.CaveJellyfish.Chance * 1.2f; + return SpawnCondition.CaveJellyfish.Chance * 1.2f; } return 0f; } @@ -437,14 +223,12 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - string name = NPC.localAI[1] switch + if (Main.netMode != NetmodeID.Server) { - 1 => "ClamAlgae", - 2 => "ClamCoral", - _ => "Clam" - }; - - CalamityUtils.SpawnGores(NPC, name, 2); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam3").Type, 1f); + } } } @@ -456,42 +240,5 @@ namespace CalamityMod.NPCs.SunkenSea npcLoot.Add(ItemID.PinkPearl, 40); npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Texture2D jaw = bottomJawTex.Value; - - switch (NPC.localAI[1]) - { - case 1: - { - tex = algaeTex.Value; - jaw = bottomJawTexAlgae.Value; - } - break; - case 2: - { - tex = coralTex.Value; - jaw = bottomJawTexCoral.Value; - } - break; - } - - Vector2 drawOffset = Vector2.UnitY * 8; - Vector2 topDrawOffset = drawOffset + new Vector2(NPC.spriteDirection * -22, -3); - bool facingRight = NPC.spriteDirection == 1; - if (facingRight) - { - topDrawOffset.X += 6; - } - Vector2 backOffset = topDrawOffset; - float trueShellRotation = ShellRotation * -NPC.spriteDirection; - if (ShellRotation == 0) - spriteBatch.Draw(backTex.Value, NPC.Center - screenPos + backOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(tex, NPC.Center - screenPos + topDrawOffset, null, NPC.GetAlpha(drawColor), trueShellRotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(jaw, NPC.Center - screenPos + drawOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - return false; - } } } diff --git a/NPCs/SunkenSea/Clam.png b/NPCs/SunkenSea/Clam.png index acb6f0dd51..f7eb5f074a 100644 Binary files a/NPCs/SunkenSea/Clam.png and b/NPCs/SunkenSea/Clam.png differ diff --git a/NPCs/SunkenSea/ClamAlgae.png b/NPCs/SunkenSea/ClamAlgae.png deleted file mode 100644 index e695d282f8..0000000000 Binary files a/NPCs/SunkenSea/ClamAlgae.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBack.png b/NPCs/SunkenSea/ClamBack.png deleted file mode 100644 index 7eec13a3b9..0000000000 Binary files a/NPCs/SunkenSea/ClamBack.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottom.png b/NPCs/SunkenSea/ClamBottom.png deleted file mode 100644 index 3d9a5ddeeb..0000000000 Binary files a/NPCs/SunkenSea/ClamBottom.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottomAlgae.png b/NPCs/SunkenSea/ClamBottomAlgae.png deleted file mode 100644 index c3f133e6c0..0000000000 Binary files a/NPCs/SunkenSea/ClamBottomAlgae.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottomCoral.png b/NPCs/SunkenSea/ClamBottomCoral.png deleted file mode 100644 index 103aaa2e63..0000000000 Binary files a/NPCs/SunkenSea/ClamBottomCoral.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamCoral.png b/NPCs/SunkenSea/ClamCoral.png deleted file mode 100644 index aad2819891..0000000000 Binary files a/NPCs/SunkenSea/ClamCoral.png and /dev/null differ diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index ec0d742125..75655f8fca 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -1,95 +1,56 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; - namespace CalamityMod.NPCs.SunkenSea { - public class EutrophicRay : SunkenSeaNPC + public class EutrophicRay : ModNPC { + public bool hasBeenHit = false; + public static Asset GlowTexture; - public static Asset TailTexture; - public static Asset TailGlowTexture; - #region Fields - protected override List PreyIDs => []; - protected override List PredatorIDs => - [ - ModContent.NPCType(), - ModContent.NPCType(), - //ModContent.NPCType(), - //ModContent.NPCType() - ]; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - private bool hasBeenHit = false; - private bool shouldAttack => NPC.life < (int)(NPC.lifeMax * 0.6f); - private Entity AttackingEntity; - private Entity AvoidedEntity; - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - if (value != _currentBehavior) - OnBehaviorChange(value); - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - private Action _previousBehavior; - #endregion - - public override void Load() - { - GlowTexture = ModContent.Request(Texture + "Glow"); - TailTexture = ModContent.Request(Texture + "Tail"); - TailGlowTexture = ModContent.Request(Texture + "TailGlow"); - } public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 7; - NPCID.Sets.TrailingMode[Type] = 3; - NPCID.Sets.TrailCacheLength[Type] = 15; - base.SetStaticDefaults(); + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); + value.Position.X += 24f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); - NPC.width = 54; - NPC.height = 68; - NPC.damage = 20; - NPC.defense = 5; - NPC.lifeMax = 200; - NPC.scale = 0.85f; - - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.value = Item.buyPrice(silver: 1); + NPC.damage = Main.hardMode ? 50 : 20; + NPC.width = 116; + NPC.height = 36; + NPC.defense = Main.hardMode ? 15 : 5; + NPC.lifeMax = Main.hardMode ? 500 : 200; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; NPC.knockBackResist = 0.5f; - Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -105,295 +66,171 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } + public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - MaxSpeed = 4.85f; - Acceleration = 0.5f; - CurrentBehavior = IdleBehavior; - } - - #region AI Functions public override void AI() { - if (pathfinding == null) + NPC.TargetClosest(true); + if (NPC.velocity.X > 0.25f) { - pathfinding = new PathfindingManager(this); - MaxSpeed = 4.85f; - Acceleration = 0.5f; + NPC.spriteDirection = 1; + } + else if (NPC.velocity.X < 0.25f) + { + NPC.spriteDirection = -1; } - CurrentBehavior?.Invoke(); - - // If out of water, act like you're out of water. - if ((NPC.noTileCollide ? !(Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : !NPC.wet) && CurrentBehavior != OutOfWaterBehavior) - CurrentBehavior = OutOfWaterBehavior; - - // Used for determining if it should run from players. if (NPC.justHit && !hasBeenHit) + { hasBeenHit = true; - NPC.chaseable = hasBeenHit; - - float curRot = NPC.rotation; - float newRot = NPC.velocity.ToRotation() + MathHelper.Pi; - if (Math.Abs(MathHelper.WrapAngle(curRot) - MathHelper.WrapAngle(newRot)) > MathHelper.PiOver4) - { - NPC.rotation = Utils.AngleLerp(curRot, newRot, 0.1f); - } - else - { - NPC.rotation = newRot; - } - } - private void OnBehaviorChange(Action newBehavior) - { - if (newBehavior == OutOfWaterBehavior) - NPC.noGravity = false; - - MaxSpeed = newBehavior == FleeBehavior ? 6.5f : 5f; - } - - private void IdleBehavior() - { - // Don't deal damage while idling. - NPC.damage = 0; - // If inside solid tiles, attempt to get out of them by occasionally bursting in a random direction. - if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - { - if (Main.rand.NextBool(150)) - NPC.velocity = Main.rand.NextVector2CircularEdge(7.5f, 7.5f); - - NPC.velocity *= 0.98f; - } - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f), SunkenSeaTileValidity)); - } - private void AttackBehavior() - { - // Check what specifically the hunted entity is. If there is none, go back to idling. - AttackingEntity = AttackingEntity is NPC ? CurrentPrey : CurrentPlayer; - if (AttackingEntity == null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // Set damage while attacking. Clear idle behavior pathfinding to prevent it continuously trying to return to that path when attacking. - NPC.damage = NPC.defDamage; - pathfinding.ClearResults(); - NPC.noTileCollide = true; - - float maxSpeedX = 8.2f; - float maxSpeedY = 3.2f; - float accelX = 0.25f; - float accelY = 0.3f; - int directionX = (NPC.Center.X < AttackingEntity.Center.X).ToDirectionInt(); - int directionY = (NPC.Center.Y < AttackingEntity.Center.Y).ToDirectionInt(); - - NPC.velocity.X += accelX * directionX; - if (NPC.velocity.X > maxSpeedX) - NPC.velocity.X = maxSpeedX; - if (NPC.velocity.X < -maxSpeedX) - NPC.velocity.X = -maxSpeedX; - - NPC.velocity.Y += accelY * directionY; - if (NPC.velocity.Y > maxSpeedY) - NPC.velocity.Y = maxSpeedY; - if (NPC.velocity.Y < -maxSpeedY) - NPC.velocity.Y = -maxSpeedY; - } - private void FleeBehavior() - { - // Check what specifically the predator is. If there is none, go back to idling. - AvoidedEntity = AvoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - if (AvoidedEntity == null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // If you reach the attack threshold, start attacking. - if (shouldAttack && AvoidedEntity is Player) - { - CurrentBehavior = AttackBehavior; - AttackingEntity = AvoidedEntity; - AvoidedEntity = null; - return; - } - - // Don't deal damage while fleeing. - NPC.damage = 0; - NPC.noTileCollide = true; - - // Flee in a straight line if possible, otherwise pathfind away from the attacker. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(AvoidedEntity.Center) * 64f).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(AvoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, AvoidedEntity.Center); - Vector2 pathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, pathPoint, SunkenSeaTileValidity)); - } - } - private void OutOfWaterBehavior() - { - NPC.damage = 0; - NPC.velocity.X *= 0.985f; - if (NPC.noTileCollide ? (Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - #endregion - - #region Creature Detection and Hit Logic - protected override bool PlayerSearchFilter(Player p) => (Vector2.DistanceSquared(NPC.Center, p.Center) < 262144f && hasBeenHit) || shouldAttack; - protected override bool NPCSearchFilter(NPC n) => Vector2.DistanceSquared(NPC.Center, n.Center) < 102400f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - protected override void OnPreyDetection(NPC prey) - { - if (CurrentPredator is not null) - { - CurrentBehavior = AttackBehavior; + NPC.damage = NPC.defDamage; NPC.noTileCollide = true; - AttackingEntity = prey; + NPC.noGravity = true; + if (NPC.Center.X < Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 1f; + } + else + { + NPC.ai[0] = 2f; + } } - } - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = FleeBehavior; - NPC.noTileCollide = false; - AvoidedEntity = predator; - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - protected override void OnPlayerDetection(Player player) - { - if (CurrentPredator is not null && !hasBeenHit) - return; + NPC.chaseable = hasBeenHit; + if (hasBeenHit) + { + float AccelerationY = Main.hardMode ? 0.4f : 0.2f; + float MaxSpeedY = Main.hardMode ? 4f : 2.5f; + float Rotation = 0; + if ((NPC.Center.Y + 0.4f) > Main.player[NPC.target].Center.Y) + { + NPC.velocity.Y -= AccelerationY; + if (NPC.velocity.Y < -MaxSpeedY) + { + NPC.velocity.Y = -MaxSpeedY; + } + } + else if ((NPC.Center.Y - 0.4f) < Main.player[NPC.target].Center.Y) + { + NPC.velocity.Y += AccelerationY; + if (NPC.velocity.Y > MaxSpeedY) + { + NPC.velocity.Y = MaxSpeedY; + } + } + float AccelerationX = Main.hardMode ? 0.4f : 0.25f; + float MaxSpeedX = Main.hardMode ? 6f : 4f; - if (shouldAttack) - { - CurrentBehavior = AttackBehavior; - AttackingEntity = player; + if (NPC.ai[0] == 1f) + { + Rotation = -0.05f; + NPC.velocity.X -= AccelerationX; + if (NPC.velocity.X < -MaxSpeedX) + { + NPC.velocity.X = -MaxSpeedX; + } + + if ((NPC.Center.X + 300f) < Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 2f; + } + } + else if (NPC.ai[0] == 2f) + { + Rotation = 0.05f; + NPC.velocity.X += AccelerationX; + if (NPC.velocity.X > MaxSpeedX) + { + NPC.velocity.X = MaxSpeedX; + } + + if ((NPC.Center.X - 300f) > Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 1f; + } + } + + NPC.rotation = NPC.velocity.Y * Rotation; + if (NPC.rotation < -0.1f) + { + NPC.rotation = -0.1f; + } + if (NPC.rotation > 0.1f) + { + NPC.rotation = 0.1f; + return; + } } - else if (hasBeenHit) - { - CurrentBehavior = FleeBehavior; - AvoidedEntity = player; - } - NPC.noTileCollide = shouldAttack; + else + NPC.damage = 0; } - #endregion public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter += (hasBeenHit || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[Type]); - Vector2 vector = NPC.Center - screenPos; - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0); - spriteBatch.Draw(tex, vector, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); - spriteBatch.Draw(GlowTexture.Value, vector, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); - - // Position where the tail starts - Vector2 tailOffset = Vector2.UnitX.RotatedBy(NPC.rotation) * (tex.Width / 2 - 4); - - if (NPC.IsABestiaryIconDummy) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) { - for (int i = 0; i < NPC.oldRot.Length; i++) - { - NPC.oldRot[i] = 0; - } - for (int i = 0; i < NPC.oldPos.Length; i++) - { - NPC.oldPos[i] = Vector2.UnitX.RotatedBy(NPC.rotation) * ((tex.Width / 2 - 4) + i * 8); - } + spriteEffects = SpriteEffects.FlipHorizontally; } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } - float currentSegmentRotation = NPC.rotation; - List tailDrawPositions = new List(); - int segAmt = 7; - int tailLength = 40; - for (int i = 0; i < segAmt; i++) + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - float tailCompletionRatio = i / (float)segAmt; - float wrappedAngularOffset = MathHelper.WrapAngle(NPC.oldRot[i + 1] - currentSegmentRotation) * 0.6f; - float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.24f, 0.24f); - - Vector2 Offset = Vector2.UnitX.RotatedBy(NPC.rotation); - Vector2 tailSegmentOffset = Vector2.UnitX.RotatedBy(currentSegmentRotation) * tailCompletionRatio * tailLength + Offset; - tailDrawPositions.Add(NPC.Center + tailSegmentOffset + tailOffset); - - currentSegmentRotation += segmentRotationOffset; + return hasBeenHit; } - for (int i = 0; i < tailDrawPositions.Count; i++) - { - Vector2 pos = tailDrawPositions[i]; - float rot = pos.DirectionTo(NPC.Center + Vector2.UnitX.RotatedBy(NPC.rotation)).ToRotation(); - if (i > 0) - { - Vector2 oldPos = tailDrawPositions[i - 1]; - rot = pos.DirectionTo(oldPos).ToRotation(); - } - int frame = i switch - { - 1 => 10, - 5 => 20, - 6 => 32, - _ => 0 - }; - int height = 8; - if (i == 6) - height = 10; - rot += MathHelper.PiOver2; - - spriteBatch.Draw(TailTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), NPC.GetAlpha(drawColor), rot, new Vector2(6, 4), NPC.scale, 0, 0f); - spriteBatch.Draw(TailGlowTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), color, rot, new Vector2(6, 4), NPC.scale, 0, 0f); - } - - return false; + return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + return SpawnCondition.CaveJellyfish.Chance * 0.6f; } return 0f; } public override void HitEffect(NPC.HitInfo hit) { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } if (NPC.life <= 0) { - for (int k = 0; k < 15; k++) + for (int k = 0; k < 25; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore4").Type, 1f); + } } - CalamityUtils.SpawnGores(NPC, "EutrophicRay", 2); } } } diff --git a/NPCs/SunkenSea/EutrophicRay.png b/NPCs/SunkenSea/EutrophicRay.png index 76f3c10590..f005213289 100644 Binary files a/NPCs/SunkenSea/EutrophicRay.png and b/NPCs/SunkenSea/EutrophicRay.png differ diff --git a/NPCs/SunkenSea/EutrophicRayGlow.png b/NPCs/SunkenSea/EutrophicRayGlow.png index 805039ba34..585d222148 100644 Binary files a/NPCs/SunkenSea/EutrophicRayGlow.png and b/NPCs/SunkenSea/EutrophicRayGlow.png differ diff --git a/NPCs/SunkenSea/EutrophicRayTail.png b/NPCs/SunkenSea/EutrophicRayTail.png deleted file mode 100644 index f15d72f500..0000000000 Binary files a/NPCs/SunkenSea/EutrophicRayTail.png and /dev/null differ diff --git a/NPCs/SunkenSea/EutrophicRayTailGlow.png b/NPCs/SunkenSea/EutrophicRayTailGlow.png deleted file mode 100644 index 3c7ef2ce64..0000000000 Binary files a/NPCs/SunkenSea/EutrophicRayTailGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs deleted file mode 100644 index 68c0df7862..0000000000 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ /dev/null @@ -1,188 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using System.IO; -using CalamityMod.Items.Materials; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class FesteringRemains : ModNPC - { - public List bones = new List(); - public override void SetDefaults() - { - NPC.width = 52; - NPC.height = 36; - NPC.defense = 0; - NPC.lifeMax = 200; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0f; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HauntedChum") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - // Spawn some bones around the remains - if (NPC.localAI[0] == 0) - { - int boneCount = Main.rand.Next(5, 8); - for (int i = 0; i < boneCount; i++) - { - int extraDistX = 120; - int extraDistY = 40; - Vector2 bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); - // If the bone spawns inside a tile, try to make it not spawn in a tile - for (int j = 0; j < 50; j++) - { - Tile tilePos = CalamityUtils.ParanoidTileRetrieval((int)bonePos.X / 16, (int)bonePos.Y / 16); - if (tilePos.HasTile) - { - bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); - } - } - Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool()); - GeneralParticleHandler.SpawnParticle(bone); - // Add to a list of bones - bones.Add(bone); - } - NPC.TargetClosest(); - NPC.localAI[0] = 1; - } - - // Enables expert scaling - NPC.damage = 0; - NPC.TargetClosest(); - int aggroRange = 80; - int spawnTime = 60; - Player target = Main.player[NPC.target]; - if (NPC.ai[1] == 0) - { - if (target != null && target.active && target.Distance(NPC.Center) < aggroRange) - { - NPC.ai[0]++; - if (NPC.ai[0] > spawnTime) - { - int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); - NPC.ai[1] = 1; - NPC.ai[2] = head; - SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); - Main.npc[head].localAI[0] = -MathHelper.PiOver4; - } - } - else - { - if (NPC.ai[0] > 0) - { - NPC.ai[0]--; - } - } - } - NPC spawnedHead = Main.npc[(int)NPC.ai[2]]; - // If the head has already been spawned but there is no more head (no head?) start a countdown, once the countdown reaches full, the head respawns - if (NPC.ai[1] == 1) - { - if (spawnedHead == null || !spawnedHead.active || spawnedHead.type != ModContent.NPCType()) - { - if (NPC.ai[3] == 180) - { - // Spawn the head and reset ai3 back to 0 - int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); - NPC.ai[2] = head; - NPC.ai[3] = 0; - SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); - Main.npc[head].localAI[0] = -MathHelper.PiOver4; - } - NPC.ai[3]++; - } - if (NPC.ai[0] > 0) - { - NPC.ai[0]--; - } - } - // Keep the bones alive - for (int i = 0; i < bones.Count; i++) - { - bones[i].Time = 2; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt with { Volume = 0.8f, Pitch = 1.2f }, NPC.position); - } - CalamityUtils.SpawnGores(NPC, "FesteringRemains", 1); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - // Spooky glowey aura effect - if (NPC.ai[0] > 0) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color glowColor = Color.Red; - int xOffset = NPC.spriteDirection == 1 ? 16 : 22; - spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * (NPC.ai[0] / 120), 0f, bloom.Size() / 2f, 1f, SpriteEffects.None, 0); - foreach (ChumBone bone in bones) - { - spriteBatch.Draw(bloom, bone.Position - Main.screenPosition, null, glowColor * (NPC.ai[0] / 210), 0f, bloom.Size() / 2f, 0.4f * bone.Scale, SpriteEffects.None, 0); - } - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } - return true; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); - } - } -} diff --git a/NPCs/SunkenSea/FesteringRemains.png b/NPCs/SunkenSea/FesteringRemains.png deleted file mode 100644 index 75b78502a4..0000000000 Binary files a/NPCs/SunkenSea/FesteringRemains.png and /dev/null differ diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 501570c573..0b69067b9f 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -1,18 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.DataStructures; -using CalamityMod.Enums; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -22,77 +15,34 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class GhostBell : SunkenSeaNPC + public class GhostBell : ModNPC { - public static Asset PinkTexture; - public static Asset GreenTexture; + public bool hasBeenHit = false; - public static int ElectrifyingPhaseDuration => 180; - public static int ElectrifyingPhaseDischarge => 60; - public static int ElectrifyingPhaseCooldown => 120; - - public ref float Phase => ref NPC.ai[0]; - - public ref float Variant => ref NPC.ai[1]; - - public ref float Timer => ref NPC.ai[3]; - - public enum PhaseType - { - Idle = 0, - Angry = 1, - Electrifying = 2 - } - - public enum JellyColor - { - Blue = 0, - Green = 1, - Pink = 2 - } - - public List> tentacles = []; - - protected override List PreyIDs => - [ - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ]; - - protected override List PredatorIDs => []; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - GreenTexture = ModContent.Request(Texture + "Green"); - PinkTexture = ModContent.Request(Texture + "Pink"); - } + public static Asset GlowTexture; public override void SetStaticDefaults() { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 1; + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); NPC.noGravity = true; NPC.aiStyle = -1; AIType = -1; - NPC.damage = 25; - NPC.width = 74; - NPC.height = 58; - NPC.defense = 0; - NPC.lifeMax = 120; + NPC.damage = Main.hardMode ? 75 : 25; + NPC.width = 54; + NPC.height = 76; + NPC.defense = Main.hardMode ? 10 : 0; + NPC.lifeMax = Main.hardMode ? 400 : 120; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Item.buyPrice(silver: 1); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -101,6 +51,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -114,390 +65,112 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.chaseable); + writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.TargetClosest(); - Variant = Main.rand.Next(0, 3); - if (Phase == (int)PhaseType.Idle) - { - // 1-3 in the Polyp Forest, 3-4 in the burrows - int jellyAmt = Main.player[NPC.target].Calamity().ZonePolypForest ? Main.rand.Next(2, 4) : Main.rand.Next(3, 5); - // A swarm of babies spawns if the jelly is in the Polyp Forest - if (Main.player[NPC.target].Calamity().ZonePolypForest) - { - for (int i = 0; i < jellyAmt; i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int bebe = NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), ModContent.NPCType(), ai0: -1); - Main.npc[bebe].rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); - } - } - } - // Spawn more adults - for (int i = 0; i < jellyAmt; i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), Type, ai0: -1, ai2: Main.rand.Next(0, 60)); - } - } - } + hasBeenHit = reader.ReadBoolean(); } public override void AI() { - if (pathfinding == null) + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1.5f / 255f, (255 - NPC.alpha) * 1.5f / 255f); + if (NPC.justHit) { - pathfinding = new PathfindingManager(this); - Acceleration = 0.1f; - MaxSpeed = 1f; + hasBeenHit = true; } - CreateTentacles(); - NPC.ai[2]++; - - // Lite - var lightColor = Variant switch + NPC.chaseable = hasBeenHit; + if (NPC.localAI[0] == 0f) { - (int)JellyColor.Pink => Color.LightPink, - (int)JellyColor.Green => Color.MediumSpringGreen, - _ => Color.LightBlue, - }; - Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); - - NPC.chaseable = Phase > 0; - NPC.noGravity = NPC.wet; - - NPC.netUpdate = true; - NPC.netSpam = 0; - - Entity target = CurrentPrey; - if (NPC.target > -1 && (int)Phase >= (int)PhaseType.Angry) - { - target = Main.player[NPC.target]; - } - - // Ghost Bells are usually in groups, so make them not overlap - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || otherFish.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width * 2f) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - - if (Phase <= (int)PhaseType.Idle) - { - NPC.velocity *= 0.8f; - } - - if (target == null || !target.active || target.Distance(NPC.Center) > 1000) - { - Timer = 0; - Phase = (int)PhaseType.Idle; - NPC.netUpdate = true; - return; - } - - // Create an electrifying aura - if (Phase == (int)PhaseType.Electrifying) - { - // Slow down - NPC.velocity *= 0.9f; - pathfinding.ClearResults(); - Timer++; - // Create the aura - if (NPC.ai[3] == 1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 12, 0, ai1: NPC.whoAmI + 1); - } - } - // Reset - if (Timer >= ElectrifyingPhaseDuration) - { - Timer = -ElectrifyingPhaseCooldown; - Phase = (int)PhaseType.Angry; - NPC.netUpdate = true; - } - } - // Move towards target - else if (target != null) - { - pathfinding.DoPathfinding(new PathfindingParameters(this, NPC.Center, target.Center, SunkenSeaTileValiditySizeless)); - if (pathfinding.Path.Count > 0) - if (pathfinding.Path[^1].Distance(target.Center) > 300) - { - pathfinding.ClearResults(); - } - if (Phase == (int)PhaseType.Angry) - { - if (target is Player && NPC.Distance(target.Center) < 300) - { - Timer++; - } - if (Timer > 120) - { - Timer = 0; - Phase = (int)PhaseType.Electrifying; - NPC.netUpdate = true; - } - } - } - } - - public void CreateTentacles() - { - if (tentacles == null || tentacles.Count < 6) - { - // switches between tentacle indexes to determine how many segments should be on each - // aims for a more squid-like distribution, i dont know if it applies to jellyfish too - - // an embarrassing amount of time was spent figuring out these numbers - // i forgot they start at 0.. - int segmentCount = tentacles.Count switch - { - 0 or 5 => 9, - 1 or 4 => 12, - _ => 8 - }; - List segments = new List(segmentCount); - for (int i = 0; i < segmentCount; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(NPC.Center - Vector2.UnitY * i * 5); - segments.Add(segment); - } - segments[0].locked = true; - tentacles.Add(segments); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - GetPissed(player.whoAmI); - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - if (projectile.friendly && projectile.owner > -1) - { - GetPissed(projectile.owner); - } - } - - public void GetPissed(int player) - { - if (Phase <= (int)PhaseType.Idle) - { - Phase = (int)PhaseType.Angry; + NPC.localAI[0] = 1f; + NPC.velocity.Y = -6f; NPC.netUpdate = true; } - NPC.target = player; - - foreach (NPC n in Main.ActiveNPCs) + if (NPC.wet) { - if (n.type != Type) - continue; - if (n.Distance(NPC.Center) > 400) - continue; - if (n.ModNPC().Phase <= (int)PhaseType.Idle) - n.ModNPC().GetPissed(player); + NPC.noGravity = true; + if (NPC.localAI[2] > 0f) + { + NPC.localAI[2] -= 1f; + } + if (NPC.localAI[2] <= 0f) + { + if (NPC.velocity.Y == 0f) + { + NPC.localAI[1] += 1f; + } + else + { + NPC.localAI[1] = 0f; + } + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 3f || NPC.localAI[1] >= 6f) + { + NPC.velocity.Y = -3f; + } + } } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + else { - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.5f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - + NPC.noGravity = false; + NPC.velocity.Y = 2f; + NPC.localAI[2] = 75f; + NPC.netUpdate = true; } - return 0f; } public override void FindFrame(int frameHeight) { - // For bestiary animation - if (NPC.IsABestiaryIconDummy) - { - NPC.ai[2]++; - } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override float SpawnChance(NPCSpawnInfo spawnInfo) { - // Underlying tentacle colour based on parent colour - Color baseCol = Variant switch - { // all of these colours are from the sprites but slightly darkened and desaturated - (int)JellyColor.Green => new Color(29, 54, 39), // 27, 61, 40 - (int)JellyColor.Pink => new Color(79, 39, 53), // 97, 38, 60 - _ => new Color(34, 50, 89) // 36, 55, 114 - }; - // Accent color is also based on parent color - Color col = Variant switch - { // these are also directly from the sprites, with no modifications; similar in luminance for visual consistency - (int)JellyColor.Green => new Color(59, 215, 194), - (int)JellyColor.Pink => new Color(255, 145, 238), - _ => new Color(84, 215, 254) - }; - - Vector2 drawOffset = Vector2.Zero; // An added offset that gives the jellyfish a visual bobbing movement - - int fullTime = 180; // How long the bob animation lasts - int localTimer = (int)(NPC.ai[2] % fullTime); - float goUp = (int)(fullTime * 0.4f); // When should the jellyfish jet upwards - int height = 30; // The vertical range the jellyfish moves - - int endElectricity = 60; - - Vector2 squash = new Vector2(1.1f, 0.9f); - Vector2 stretch = new Vector2(0.8f, 1.2f); - Vector2 finalScale; - - // Move up and down while squashing and stretching - if (localTimer < goUp) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - drawOffset.Y += MathHelper.Lerp(height, 0, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); - finalScale = Vector2.Lerp(stretch, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); + return SpawnCondition.CaveJellyfish.Chance * 0.9f; } - else + return 0f; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) { - drawOffset.Y += MathHelper.Lerp(0, height, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); - finalScale = Vector2.Lerp(squash, stretch, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); + spriteEffects = SpriteEffects.FlipHorizontally; } - // Use different squash n stretch when electrifying - if (Phase == (int)PhaseType.Electrifying) - { - squash = new Vector2(1.4f, 0.8f); - if (Timer < (ElectrifyingPhaseDuration - 80)) - finalScale = Vector2.Lerp(Vector2.One, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, ElectrifyingPhaseDischarge, Timer, true), 1)); - else - finalScale = Vector2.Lerp(squash, Vector2.One, CalamityUtils.SineInEasing(Utils.GetLerpValue(endElectricity, ElectrifyingPhaseDuration, Timer, true), 1)); - } - // Keeps the hitbox centered - drawOffset.Y -= height / 2; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } - if (NPC.IsABestiaryIconDummy) - { - drawOffset.Y -= 20; - } + // Can only hit the target if they're touching the tentacles + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Vector2 npcCenter = NPC.Center; + Rectangle tentacleHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)npcCenter.Y, NPC.width / 2, NPC.height / 2); - CreateTentacles(); + Rectangle targetHitbox = target.Hitbox; + bool insideTentacleHitbox = targetHitbox.Intersects(tentacleHitbox); - // Update the chains - for (int i = 0; i < tentacles.Count; i++) - { - List segments = tentacles[i]; - - segments[0].oldPosition = segments[0].position; - segments[0].position = NPC.Center + new Vector2(MathHelper.Lerp(-20, 20, (i + 1) / (float)tentacles.Count), 10) + drawOffset; - - // While electrifying, flail tentacles around frantically - if (Phase == (int)PhaseType.Electrifying && Timer % 5 == 0 && Timer < endElectricity) - { - for (int j = 0; j < segments.Count; j++) - { - int randomness = (int)MathHelper.Lerp(6, 18, (1 + j) / segments.Count); - segments[j].oldPosition = segments[j].position; - segments[j].position += Main.rand.NextVector2Circular(randomness, randomness); - } - } - tentacles[i] = VerletSimulatedSegment.SimpleSimulation(segments, 5, loops: 1, gravity: 0.6f); - } - - // Draw tentacle chains - for (int t = 0; t < tentacles.Count; t++) - { - List segments = tentacles[t]; - for (int i = 0; i < segments.Count - 1; i++) - { - VerletSimulatedSegment seg = segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 4; - if (i == segments.Count - 1) - { - dist = Vector2.Distance(seg.position, NPC.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(segments[i - 1].position).ToRotation(); - - // slight gradient to a lighter colour the higher the segment index - Color finalColor = baseCol; - finalColor *= 1 + (i * 0.15f); - - // Last few segments are way brighter - if (i > segments.Count - 3) - { - finalColor = col * (0.05f + segments.Count * 0.1f); - } - - // Color eases in and out while angry - if (Phase == (int)PhaseType.Angry || NPC.IsABestiaryIconDummy) - { - float mod = NPC.ai[2] % 30; - if (mod <= 10) - finalColor = Color.Lerp(finalColor, finalColor * 2, Utils.GetLerpValue(0, 10, mod, true)); - else if (mod >= 20) - finalColor = Color.Lerp(finalColor * 2, finalColor, Utils.GetLerpValue(20, 30, mod, true)); - else - finalColor *= 2; - } - // Color is at full brightness while electrifying - else if (Phase == (int)PhaseType.Electrifying) - finalColor *= 2; - // give the segments variable width (and an offset equal to half of the variance) to create more visual interest - // a side effect of this makes it look wiggly like some jellyfish tentacles are - SpriteEffects dir = NPC.Center.X > NPC.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2(seg.position.X - i * 0.1f, seg.position.Y) - screenPos, new Rectangle(0, 0, (int)(3 + i * 0.2), 8), finalColor, rot + MathHelper.PiOver2, new Vector2(4, 4), new Vector2(1, dist / 8), dir, 0); - } - } - - Texture2D tex = Variant switch - { - (int)JellyColor.Pink => PinkTexture.Value, - (int)JellyColor.Green => GreenTexture.Value, - _ => TextureAssets.Npc[Type].Value - }; - - Main.EntitySpriteDraw(tex, NPC.Center - screenPos + drawOffset, null, Color.White, NPC.rotation, tex.Size() / 2, finalScale * NPC.scale, 0); - return false; + return insideTentacleHitbox; } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Electrified, 120, true); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SunkenSea/GhostBell.png b/NPCs/SunkenSea/GhostBell.png index 8af8c6e258..0a9a975802 100644 Binary files a/NPCs/SunkenSea/GhostBell.png and b/NPCs/SunkenSea/GhostBell.png differ diff --git a/NPCs/SunkenSea/GhostBellGlow.png b/NPCs/SunkenSea/GhostBellGlow.png new file mode 100644 index 0000000000..0a9a975802 Binary files /dev/null and b/NPCs/SunkenSea/GhostBellGlow.png differ diff --git a/NPCs/SunkenSea/GhostBellGreen.png b/NPCs/SunkenSea/GhostBellGreen.png deleted file mode 100644 index 025fed69f0..0000000000 Binary files a/NPCs/SunkenSea/GhostBellGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/GhostBellPink.png b/NPCs/SunkenSea/GhostBellPink.png deleted file mode 100644 index 063a71e0d1..0000000000 Binary files a/NPCs/SunkenSea/GhostBellPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index d22a59ec8c..1578efa56c 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -559,6 +559,7 @@ namespace CalamityMod.NPCs.SunkenSea // Equipment npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 3); // Trophy npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SunkenSea/GildedAxolotl.cs b/NPCs/SunkenSea/GildedAxolotl.cs deleted file mode 100644 index 1808f03f64..0000000000 --- a/NPCs/SunkenSea/GildedAxolotl.cs +++ /dev/null @@ -1,589 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Dusts; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class GildedAxolotl : SunkenSeaNPC - { - private enum AnimationState { Water, Land } - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - NPC.ai[1] = (float)value; - } - } - - private enum PhaseType { Idle = 0, Flee = 1, Hunt = 2 } - public ref float CurrentBehavior => ref NPC.ai[0]; - public ref float GroundMovementTimer => ref NPC.ai[2]; - - public Vector2 targetPoint; - - public int IdleMinPathDistance = 400; - public int IdleMaxPathDistance = 1800; - public float FleeMaxSpeed = 8; - public float HuntMaxSpeed = 6; - public float IdleMaxSpeed = 3.2f; - - // Delays for effects triggering again after being executed - private int FleeFXCooldown = 300; - public int FleeTimer = 0; - private int PassiveSoundCooldown = 240; - public int PassiveSoundTimer = 0; - private int NoticeHeldItemSoundCooldown = 180; - public int NoticeHeldItemSoundTimer = 0; - - public bool PathfindToPlayer = false; - - public float auraFade = 0; - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - - public static readonly SoundStyle noticedBaitSound = new("CalamityMod/Sounds/Custom/GildedAxolotlNeuronActivation"); - public static readonly SoundStyle ambientNoise = new("CalamityMod/Sounds/Custom/GildedAxolotlVocalStim", 2); - public static readonly SoundStyle alert = new("CalamityMod/Sounds/Custom/GildedAxolotlAlert"); - - #region SunkenSea Fields - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - protected override List PreyIDs => new() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PredatorIDs => new() - { - ModContent.NPCType(), - ModContent.NPCType(), - // ModContent.NPCType(), - // ModContent.NPCType() - }; - - #endregion - - protected List ItemsOfInterest => new() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 7; - NPCID.Sets.CountsAsCritter[Type] = true; - Main.npcCatchable[Type] = true; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.aiStyle = -1; - NPC.width = 84; - NPC.height = 42; - - NPC.damage = 7; - NPC.defense = 7; - NPC.lifeMax = 77; - NPC.knockBackResist = 0f; - NPC.lavaImmune = true; - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath9; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.catchItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = false; - NPC.Calamity().VulnerableToWater = false; - NPC.Calamity().VulnerableToCold = true; - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - #region Syncing - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.ai[0] = reader.ReadSingle(); // CurrentBehavior - NPC.ai[1] = reader.ReadSingle(); // Anim state - NPC.ai[2] = reader.ReadSingle(); // Ground movement timer - targetPoint = reader.ReadVector2(); // For pathfinding points - auraFade = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.ai[0]); // CurrentBehavior - writer.Write(NPC.ai[1]); // Anim state - writer.Write(NPC.ai[2]); // Ground movement timer - writer.WriteVector2(targetPoint); // For pathfinding points - writer.Write(auraFade); - } - - #endregion - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GildedAxolotl") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = IdleMaxSpeed; - MinimumPointDistance = 60f; - } - - // Find nearby players - NPC.TargetClosest(false); - Player nearestPlayer = null; - float nearestPlayerDistance = 10000f; - - float detectionRange = 700f; - float buffRange = 290f; - - Player nearestPlayerForVisuals = null; - float nearestPlayerDistanceForVisuals = 10000f; - - // Handle aura buff for any nearby player - for (int i = 0; i < Main.maxPlayers; i++) - { - Player p = Main.player[i]; - if (!p.active || p.dead) - continue; - - float distance = Vector2.Distance(NPC.Center, p.Center); - - if (distance < buffRange && distance < nearestPlayerDistanceForVisuals) - { - nearestPlayerForVisuals = p; - nearestPlayerDistanceForVisuals = distance; - } - - if (distance < buffRange) - { - p.AddBuff(ModContent.BuffType(), 60, true); - } - - // Track the nearest player holding a target item - if (distance < detectionRange && ItemsOfInterest.Contains(p.HeldItem.type)) - { - if (distance < nearestPlayerDistance) - { - nearestPlayer = p; - nearestPlayerDistance = distance; - } - } - } - - // Handle aura vfx - float distanceForVisual = nearestPlayerForVisuals != null ? nearestPlayerDistanceForVisuals : buffRange; - float maxDistance = buffRange * 1.5f; - float minDistance = 120f; - auraFade = Utils.GetLerpValue(maxDistance, minDistance, distanceForVisual, clamped: true); - - // Allow NPCs to be buffed while in the aura, including this npc. - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC targetNPC = Main.npc[i]; - if (!targetNPC.active) - continue; - - float distance = Vector2.Distance(NPC.Center, targetNPC.Center); - - if (distance < buffRange) - { - targetNPC.AddBuff(ModContent.BuffType(), 60, true); - } - } - - // Handle dust which dynamically changes alpha based on distance and time - if (auraFade > 0f) - { - float pulse = 0.6f + 0.25f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2.5f); - int baseAlpha = (int)(255f * (1f - auraFade * 0.5f * pulse)); - if (baseAlpha < 0) baseAlpha = 0; - if (baseAlpha > 255) baseAlpha = 255; - - - int innerDustCount = Main.rand.Next(0, 2); - - for (int i = 0; i < innerDustCount; i++) - { - float areaSize = 255f; - Vector2 spawnSpot = NPC.Center + Main.rand.NextVector2Circular(areaSize, areaSize); - - Dust dust = Dust.NewDustPerfect(spawnSpot, ModContent.DustType()); - dust.scale = Main.rand.NextFloat(0.6f, 1.1f); - dust.noGravity = true; - dust.alpha = baseAlpha; - dust.color = (Main.rand.NextBool(2) ? Color.Silver : Color.Gold) * 2f; - dust.noLight = true; - dust.noLightEmittence = true; - dust.velocity *= 0.05f; - } - } - - // When detecting a player holding of one of the Axolotl's prey - if (nearestPlayer != null) - { - if (CurrentBehavior == (float)PhaseType.Idle) - { - if (NoticeHeldItemSoundTimer <= 0) - { - SoundEngine.PlaySound(noticedBaitSound with { Volume = 0.7f, Pitch = 0.1f, PitchVariance = 0.1f }, NPC.Center); - NoticeHeldItemSoundTimer = NoticeHeldItemSoundCooldown; - } - - CurrentBehavior = (float)PhaseType.Hunt; - PathfindToPlayer = true; - NPC.netUpdate = true; - pathfinding.ClearResults(); - } - } - - else - { - if (CurrentBehavior == (float)PhaseType.Hunt && PathfindToPlayer) - CurrentBehavior = CurrentPrey != null ? (float)PhaseType.Hunt : (float)PhaseType.Idle; - - PathfindToPlayer = false; - } - - Lighting.AddLight(NPC.Center, Color.Gold.ToVector3() * (auraFade * 0.8f)); // Passively emit light based on auraFade - - if (NPC.wet) - { - NPC.noGravity = true; - Animation = AnimationState.Water; - - switch ((PhaseType)CurrentBehavior) - { - case PhaseType.Idle: - IdleBehavior(); - break; - case PhaseType.Flee: - FleeBehavior(); - break; - case PhaseType.Hunt: - HuntBehavior(); - break; - } - - if (NPC.velocity != Vector2.Zero) - { - int dir = NPC.velocity.X.DirectionalSign(); - if (dir != 0) - NPC.spriteDirection = NPC.direction = dir; - - float targetRotation = NPC.velocity.ToRotation(); - if (NPC.spriteDirection == -1) - targetRotation = MathHelper.WrapAngle(targetRotation - MathHelper.Pi); - - NPC.rotation = MathHelper.Clamp(targetRotation, -MathHelper.PiOver2, MathHelper.PiOver2); - } - else - NPC.rotation = 0f; - } - - else // Refer to BeachedBehavior for grounded movement - { - Animation = AnimationState.Land; - BeachedBehavior(); - pathfinding.ClearResults(); - } - - // Timers - if (FleeTimer > 0) - FleeTimer--; - if (PassiveSoundTimer > 0) - PassiveSoundTimer--; - if (NoticeHeldItemSoundTimer > 0) - NoticeHeldItemSoundTimer--; - } - - public void IdleBehavior() - { - MaxSpeed = IdleMaxSpeed; - - // Always pathfind to a random point when idling -            pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - - if (Main.rand.NextBool(300) && PassiveSoundTimer <= 0) // Randomly emit a noise - { - SoundEngine.PlaySound(ambientNoise with { Volume = 0.66f, Pitch = 0.1f, PitchVariance = 0.15f }, NPC.Center); - PassiveSoundTimer = PassiveSoundCooldown; - } - } - - public void HuntBehavior() - { - MaxSpeed = HuntMaxSpeed; - - if (PathfindToPlayer) // Player is holding an item of interest -            { - Player target = Main.player[NPC.target]; - targetPoint = target.Center; - } - else - { -                // If prey is gone, go back to idling -                if (CurrentPrey == null) - { - CurrentBehavior = (float)PhaseType.Idle; - return; - } - targetPoint = CurrentPrey.Center; - } - - pathfinding.DoPathfinding(new(this, NPC.Center, targetPoint, tileValidity: SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - if (CurrentPredator == null) - { - CurrentBehavior = CurrentPrey != null ? (float)PhaseType.Hunt : (float)PhaseType.Idle; - FleeTimer = 0; - return; - } - - if (FleeTimer <= 0) // Specifically for VFX and SFX when fleeing - { - SoundEngine.PlaySound(alert with { Volume = 0.9f, PitchVariance = 0.1f }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - GeneralParticleHandler.SpawnParticle(new EmoteExpressionParticle(NPC.Center + emoteDirection * 2f, emoteDirection, 2.2f, Color.Yellow, Main.rand.Next(30, 46), EmoteExpressionParticle.EmoteType.Exclamation)); - } - - FleeTimer = FleeFXCooldown; - } - - MaxSpeed = FleeMaxSpeed; - - // Try to find a safe point from predator - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - Vector2 runDirection = NPC.DirectionFrom(CurrentPredator.Center); - targetPoint = NPC.Center + runDirection * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - - pathfinding.DoPathfinding(new(this, NPC.Center, targetPoint, SunkenSeaTileValidity)); - NPC.netUpdate = true; - } - - public void BeachedBehavior() - { - NPC.noGravity = false; // Gravity on while not swimming - if (NPC.collideY) - { - if (GroundMovementTimer <= 0) - { - NPC.velocity.X *= 0.94f; // Slow down -                    if (Math.Abs(NPC.velocity.X) < 0.2f) - NPC.velocity.X = 0f; - - if (Main.rand.NextBool(80)) - { - if (Main.rand.NextBool()) - NPC.direction = -1; - else - NPC.direction = 1; - - NPC.spriteDirection = NPC.direction; - GroundMovementTimer = Main.rand.Next(30, 70); - NPC.velocity.X = 1.2f * NPC.direction; - NPC.netUpdate = true; - } - } - - else - GroundMovementTimer--; - } - - if (Math.Abs(NPC.velocity.X) > 0.01f) // Face chosen direction while moving - { - int dir = NPC.velocity.X.DirectionalSign(); - if (dir != 0) - NPC.spriteDirection = NPC.direction = dir; - } - - if (Main.rand.NextBool(300) && PassiveSoundTimer <= 0) // Randomly emit a noise - { - SoundEngine.PlaySound(ambientNoise with { Volume = 0.66f, Pitch = 0.1f, PitchVariance = 0.15f }, NPC.Center); - PassiveSoundTimer = PassiveSoundCooldown; - } - - NPC.rotation = 0f; // Rotation not needed when not in water - } - - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (float)PhaseType.Flee; // Hit the bricks regardless of what the current action is - NPC.netUpdate = true; - } - - protected override void OnPreyDetection(NPC prey) - { - // Only start hunting if not fleeing from a pred - if ((PhaseType)CurrentBehavior != PhaseType.Flee) - { - CurrentBehavior = (float)PhaseType.Hunt; - NPC.netUpdate = true; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - int frameGate; - - if (Animation == AnimationState.Water) - { - frameGate = (NPC.velocity.Length() > 3.5f ? 5 : 7); // Flap limbs faster when going fast - } - - else // Land - { - if (Math.Abs(NPC.velocity.X) > 0.1f) - { - frameGate = 6; - } - else - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - return; - } - } - - if (NPC.frameCounter > frameGate) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; // Loop anim - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.1777f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 7; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCoin, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "GildedAxolotl", 3); - } - - public override void OnKill() - { - for (int k = 0; k < 7; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), Main.rand.NextFloat(0, MathHelper.TwoPi), Main.rand.NextFloat(-1f, 3f), 0, default, 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - - // Draw aura circle behind the axolotl - float auraOpacity = auraFade * 0.4f; - if (auraOpacity > 0f) - { - Texture2D auraTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Main.EntitySpriteDraw(auraTexture, NPC.Center - screenPos, null, (Color.Gold * auraOpacity) with { A = 0 }, NPC.rotation, auraTexture.Size() * 0.5f, 7.77f, SpriteEffects.None, 0); - } - - // Main NPC drawing - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2(tex.Width / 4, tex.Height / (Main.npcFrameCount[Type] * 2)); - - float yOffset = Animation == AnimationState.Land ? 2f : 0f; // Draws 2 pixels down out of water. The way it's sheeted makes it best to handle it this way as to not edit the hitbox. - Vector2 drawPos = NPC.Center - screenPos + Vector2.UnitY * (NPC.gfxOffY + yOffset); - - Rectangle frame = tex.Frame(2, Main.npcFrameCount[Type], (int)Animation, NPC.frame.Y / NPC.height); - - // Draw backglow that scales with auraFade - if (auraFade > 0f) - { - float glowScale = NPC.scale * (1f + (0.0777f * auraFade)); - float pulse = 0.8f + 0.15f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f); - Color glowColor = (Color.Gold * auraFade * pulse) with { A = 0 }; - - spriteBatch.Draw(tex, drawPos, frame, glowColor, NPC.rotation, origin, glowScale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - } - - spriteBatch.Draw(tex, drawPos, frame, NPC.GetAlpha(drawColor * (1f + auraFade * 3)), NPC.rotation, origin, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/GildedAxolotl.png b/NPCs/SunkenSea/GildedAxolotl.png deleted file mode 100644 index e9c69adfb6..0000000000 Binary files a/NPCs/SunkenSea/GildedAxolotl.png and /dev/null differ diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs deleted file mode 100644 index 28b16dbe2c..0000000000 --- a/NPCs/SunkenSea/HauntedChum.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.BiomeManagers; -using CalamityMod.DataStructures; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class HauntedChum : ModNPC - { - public static Asset jawTexture; - public List Segments; - - public override void Load() - { - jawTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/HauntedChumMouth"); - } - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - public override void SetDefaults() - { - NPC.width = 36; - NPC.height = 50; - NPC.defense = 5; - NPC.lifeMax = 60; - NPC.damage = 20; - NPC.aiStyle = -1; - NPC.alpha = 255; - AIType = -1; - NPC.HitSound = SoundID.DD2_SkeletonHurt; - NPC.DeathSound = SoundID.DD2_SkeletonDeath; - NPC.noGravity = true; - NPC.noTileCollide = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void AI() - { - int aggroRange = 600; - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - NPC body = Main.npc[(int)NPC.ai[3]]; - // Create a chain - if (Segments == null || Segments.Count < 10) - { - Segments = new List(10); - for (int i = 0; i < 10; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(body.Center + Vector2.UnitY * i * 10); - Segments.Add(segment); - } - - Segments[0].locked = true; - Segments[Segments.Count - 1].locked = true; - } - if (body == null || !body.active || body.type != ModContent.NPCType()) - { - NPC.StrikeInstantKill(); - } - switch (NPC.ai[0]) - { - case 0: - NPC.velocity.Y = -1; - NPC.ai[1]++; - if (NPC.alpha > 0) - { - NPC.alpha -= 25; - } - if (NPC.ai[1] > 30) - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - } - break; - case 1: - if (target != null && target.active && target.Distance(body.Center) < aggroRange) - { - NPC.ai[0] = 2; - NPC.ai[1] = 0; - NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Zombie7, NPC.Center); - } - NPC.TargetClosest(); - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.05f); - if (NPC.velocity.Length() < 0.25f) - { - if (NPC.Distance(body.Center) > 320) - { - Vector2 direction = NPC.DirectionTo(body.Center); - direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 4; - } - else - { - Vector2 direction = Main.rand.NextVector2Circular(30, 30); - direction = direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 4; - } - } - // Lose brightness - if (NPC.ai[1] < 30) - { - NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.01f, 0); - } - NPC.velocity *= 0.98f; - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - break; - case 2: - if (target == null || !target.active || target.Distance(body.Center) >= aggroRange) - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - } - else - { - NPC.ai[1]++; - float dist = target.Distance(NPC.Center); - if (dist < 32 || NPC.ai[1] > 50) - { - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.3f); - } - else - { - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], 0, 0.1f); - } - // Lose brightness - if (NPC.ai[1] < 30) - { - NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.02f, 0); - } - // Gain brightness - else if (NPC.ai[1] > 60) - { - NPC.localAI[1] = MathHelper.Min(NPC.localAI[1] + 0.06f, 0.6f); - } - if (NPC.ai[1] > 70) - { - NPC.TargetClosest(); - Vector2 direction = NPC.DirectionTo(target.Center); - direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 7; - SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot with { Pitch = 0.8f, Volume = 0.8f }, NPC.Center); - NPC.ai[1] = 0; - } - else - { - NPC.velocity.X *= 0.99f; - NPC.velocity.Y *= 0.999f; - } - } - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - break; - } - NPC.spriteDirection = NPC.direction; - if (NPC.localAI[1] > 0) - { - Lighting.AddLight(NPC.Center, 1 * NPC.localAI[1], 0, 0); - } - for (int i = 0; i < 2; i++) - { - int dustPos = NPC.spriteDirection == 1 ? -10 : 0; - if (ChildSafety.Disabled) - { - Dust.NewDust(new Vector2(NPC.Center.X + dustPos, NPC.position.Y + NPC.height / 4), 0, NPC.height / 2, DustID.Blood, -NPC.spriteDirection * Main.rand.NextFloat(4f, 5f), Main.rand.NextFloat(-3, 3), Scale: Main.rand.NextFloat(0.6f, 1f)); - } - } - - // Update the chain - Segments[0].oldPosition = Segments[0].position; - Segments[0].position = body.Center + new Vector2(body.spriteDirection * 20, 8); - - Segments[Segments.Count - 1].oldPosition = Segments[Segments.Count - 1].position; - Segments[Segments.Count - 1].position = body.active ? NPC.Center : body.Center; - - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 1, gravity: 0.3f); - - NPC.ForceNetUpdate(); - } - - internal float WidthFunction(float completionRatio, Vector2 vertexPos) - { - return MathHelper.Clamp(((float)Math.Cos(completionRatio * 60)) + 2, 1, 2) / 2; - } - - internal Color ColorFunction(float completionRatio, Vector2 vertexPos) - { - return (int)(completionRatio * 100) % 2 == 0 ? new Color(69, 52, 0) : new Color(); - } - - internal float BackgroundWidthFunction(float completionRatio, Vector2 vertexPos) => WidthFunction(completionRatio, vertexPos) * 3f; - - internal Color BackgroundColorFunction(float completionRatio, Vector2 vertexPos) - { - return Color.Black; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandnado, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - // Drop a bone gore for each bone - if (Segments != null && Segments.Count > 0) - { - for (int i = 0; i < Segments.Count; i++) - { - VerletSimulatedSegment v = Segments[i]; - int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; - if (!Main.dedServ) - { - Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); - } - } - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); - } - } - } - - public override bool CheckActive() - { - return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - List points = new List(); - if (Segments != null && Segments.Count > 0) - { - for (int i = 0; i < Segments.Count; i++) - { - points.Add(Segments[i].position); - } - } - - PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction), 75); - PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction), 75); - - NPC body = Main.npc[(int)NPC.ai[3]]; - // Draw a chain of bones - if (body != null && body.active && body.type == ModContent.NPCType()) - { - if (Segments == null || Segments.Count <= 0) - { - return true; - } - for (int i = 0; i < Segments.Count - 1; i++) - { - VerletSimulatedSegment seg = Segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 2; - if (i == Segments.Count - 1) - { - dist = Vector2.Distance(seg.position, body.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); - SpriteEffects dir = NPC.Center.X > body.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - Texture2D bone = i < Segments.Count / 2 ? ModContent.Request(ChumBone.Texture2).Value : ModContent.Request("CalamityMod/Particles/ChumBone1").Value; - spriteBatch.Draw(bone, seg.position - Main.screenPosition, null, Lighting.GetColor((int)(seg.position.X / 16), (int)(seg.position.Y / 16)) * NPC.Opacity, rot, bone.Size() / 2, 1f, dir, 0); - } - } - - // Spooky glowey aura effect - if (NPC.ai[0] == 2 && NPC.ai[1] < 50) - { - spriteBatch.EnterShaderRegion(BlendState.Additive); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color glowColor = Color.Red; - int xOffset = NPC.spriteDirection == 1 ? 16 : 22; - spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * NPC.localAI[1], 0f, bloom.Size() / 2f, 0.8f, SpriteEffects.None, 0); - spriteBatch.ExitShaderRegion(); - } - - // Draw the chum itself and its jaw, rotated by localai[0] - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 jawOrigin = new Vector2(NPC.spriteDirection == 1 ? jawTexture.Value.Width - 22 : 22, 4); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(jawTexture.Value, npcOffset + new Vector2(16 * -NPC.spriteDirection, 4), null, NPC.GetAlpha(drawColor), NPC.localAI[0] * NPC.spriteDirection, jawOrigin, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture, npcOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/HauntedChum.png b/NPCs/SunkenSea/HauntedChum.png deleted file mode 100644 index 11b9e1f220..0000000000 Binary files a/NPCs/SunkenSea/HauntedChum.png and /dev/null differ diff --git a/NPCs/SunkenSea/HauntedChumMouth.png b/NPCs/SunkenSea/HauntedChumMouth.png deleted file mode 100644 index 6fa25c049e..0000000000 Binary files a/NPCs/SunkenSea/HauntedChumMouth.png and /dev/null differ diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs deleted file mode 100644 index e1912c55a2..0000000000 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ /dev/null @@ -1,327 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.BiomeManagers; -using CalamityMod.DataStructures; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Jellyghoul : ModNPC - { - public static Color lesserRed = new Color(255, 100, 100); - public static Color startColor = new Color(111, 115, 122); - public static Color endColor = new Color(87, 103, 113); - - // Cycle between two gray colors by default - public Color DefaultColor => Color.Lerp(startColor, endColor, NPC.localAI[1] * 0.25f + MathF.Sin(Main.GlobalTimeWrappedHourly)); - - // Turn red when enraged, otherwise just continue using DefaultColor - public Color FinalColor => NPC.ai[2] > 0 ? Color.Lerp(DefaultColor, lesserRed, NPC.ai[2]) : DefaultColor; - - - public static SoundStyle JellyGhoulScream = SoundID.NPCDeath51 with { Pitch = -1, Volume = 0.2f, MaxInstances = 0 }; - - public static Asset tentacleTexture; - - public override void Load() - { - tentacleTexture = ModContent.Request(Texture + "Tentacle"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 1; - } - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.noGravity = true; - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 0; - NPC.width = 28; - NPC.height = 36; - NPC.defense = 0; - NPC.lifeMax = 1; - NPC.knockBackResist = 0f; - NPC.alpha = 100; - NPC.HitSound = null; // instantly dies - NPC.DeathSound = SoundID.NPCDeath3; - NPC.chaseable = false; - NPC.noTileCollide = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Jellyghoul") - }); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.position -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); - } - public override void AI() - { - // LocalAI controls variance between jellies. Randomize it on spawn to desync them - if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] = 1f; - NPC.localAI[1] = Main.rand.NextFloat(0, 4f); - NPC.netUpdate = true; - } - - Lighting.AddLight(NPC.Center, FinalColor.R * 0.002f, FinalColor.G * 0.002f, FinalColor.B * 0.002f); - - NPC.ai[0]++; - // Play a scream randomly with a 5 second cooldown - // Chance decreases with amount of jellies active for sanity - if (NPC.ai[0] > 300 && Main.rand.NextBool(300 * NPC.CountNPCS(Type)) && NPC.ai[1] == 0) - { - SoundEngine.PlaySound(JellyGhoulScream, NPC.Center); - NPC.ai[1] = 1; - } - // While screaming, shake the screen - if (NPC.ai[1] > 0) - { - NPC.ai[1]++; - - float screenShakePower = 2 * Utils.GetLerpValue(500f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); - Main.LocalPlayer.SetScreenshake(screenShakePower); - - // After 1 second, stop shaking and set the scream on cooldown - if (NPC.ai[1] > 60) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - } - } - // Controls enrage coloring - if (NPC.ai[2] > 0) - { - NPC.ai[2] += 0.01f; - if (NPC.ai[2] > 1f) - { - NPC.ai[2] = 1f; - } - } - if (NPC.ai[2] >= 1) - { - NPC.chaseable = true; - NPC.TargetClosest(false); - NPC.ai[3]++; - if (NPC.ai[3] >= 120 + (NPC.localAI[1] * 10)) - { - int damage = Main.masterMode ? 4 : Main.expertMode ? 6 : 8; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound with { Pitch = 1f }); - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.SafeDirectionTo(Main.player[NPC.target].Center) * 16, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); - } - NPC.ai[3] = 0; - } - } - if (Main.rand.NextBool(80)) - { - Particle ash = new SquareAshParticle(Main.rand.NextVector2FromRectangle(NPC.getRect()), new Vector2(0, 2), Main.rand.Next(100, 200), Main.rand.NextFloat(0.8f, 1.2f), new Color(50, 50, 50)); - GeneralParticleHandler.SpawnParticle(ash); - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.9f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "Jellyghoul", 2); - } - - public override void OnKill() - { - bool soundPlayed = false; - // Cause nearby ghouls to become angry on death - foreach (NPC n in Main.ActiveNPCs) - { - if (n.life < 0) - continue; - if (n.type != Type) - continue; - if (n.Distance(NPC.Center) > 1000) - continue; - // If the jelly isn't enraged yet, enrage it - if (n.ai[2] == 0) - { - n.ai[2] = 0.01f; - // Play a sound if at least one jelly successfully enraged - if (!soundPlayed) - { - SoundEngine.PlaySound(SoundID.Zombie83 with { Pitch = -0.5f, Volume = 1.6f }, NPC.Center); - soundPlayed = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - float afterimageRotationSpeed = 1; - float afterimageDistance = 2; - float rotationMultiplier = 0.15f; - // Make the jelly visually move in circles - Vector2 afterimageOffset = new Vector2((float)Math.Cos(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1], (float)Math.Sin(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1]) * afterimageDistance; - - // Spooky glowey aura effect - if (!NPC.IsABestiaryIconDummy) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - - spriteBatch.Draw(bloom, NPC.Center - screenPos + afterimageOffset, null, FinalColor * 0.45f, 0f, bloom.Size() / 2f, 0.6f, SpriteEffects.None, 0); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } - - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - - // Rotate back and forth like a bell - float rotation = NPC.rotation + MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * rotationMultiplier; - - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - - // Tentacles - Texture2D tentacle = tentacleTexture.Value; - for (int i = 0; i < 4; i++) - { - // Is the tentacle on the outside? - bool outerTentacle = i == 0 || i == 3; - // Is the tentacle one of the left ones? - int leftTentacle = i < 2 ? -1 : 1; - // Start position x offset - int xOffset = outerTentacle ? 4 : 2; - // How much the end position is rotated by - int endDeg = outerTentacle ? 20 : 5; - // Length of each tentacle - int tentacleLength = outerTentacle ? 60 : 50; - // A psuedo randomness value between tentacles and the NPC's index used to desync tentacles from each other - int randomness = i % 2 + NPC.whoAmI; - // Start position of the tentacle - Vector2 anchor = npcOffset + afterimageOffset + new Vector2(leftTentacle * xOffset, 10); - // End position of the tentacle - Vector2 end = npcOffset + afterimageOffset + Vector2.UnitY.RotatedBy(MathHelper.ToRadians(endDeg * -leftTentacle)).RotatedBy(MathHelper.ToRadians(MathF.Sin(Main.GlobalTimeWrappedHourly * 4) * 5 * -leftTentacle)) * tentacleLength; - - // Store the previous tentacle's location - Vector2 prevTentacle = npcOffset + afterimageOffset; - int segmentCount = 10; - Vector2 direction = anchor.DirectionTo(end).RotatedBy(MathHelper.PiOver2); - BezierCurve curve = new BezierCurve(anchor, anchor + (end - anchor) * 0.33f + direction * MathF.Sin(Main.GlobalTimeWrappedHourly * 4 + randomness) * 8, anchor + (end - anchor) * 0.66f + direction * MathF.Cos(Main.GlobalTimeWrappedHourly * 4 + randomness) * 16, end); - List points = curve.GetPoints(segmentCount); - for (int j = 0; j < segmentCount; j++) - { - // Which texture variant the tentacle uses is based on the horizontal position on its sheet - int texX = i == 0 ? 0 : i == (segmentCount - 1) ? 16 : 8; - // Which segment type. - // The first segment (0 is invisible) uses the first frame - // The final segment uses the last frame - // The rest alternate between frames 2 and 3 - int texY = j % 2 == 0 ? 16 : 8; - if (j == 1) - texY = 0; - else if (j == segmentCount - 1) - texY = 24; - - int segHeight = (j == segmentCount - 1) ? 8 : 6; - - if (j != 0) - spriteBatch.Draw(tentacle, points[j], new Rectangle(texX, texY, 6, segHeight), FinalColor * NPC.Opacity, points[j].DirectionTo(prevTentacle).ToRotation() + MathHelper.PiOver2, new Vector2(2), NPC.scale, spriteEffects, 0); - prevTentacle = points[j]; - } - } - - // Draws transparent clones around itself to look woozy - int cloneAmt = 4; - for (int i = 0; i < cloneAmt; i++) - { - spriteBatch.Draw(texture, npcOffset + afterimageOffset + Vector2.One.RotatedBy((i + 1) * (MathHelper.TwoPi / cloneAmt) + Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * cloneAmt * MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]), NPC.frame, FinalColor * NPC.Opacity * 0.2f, rotation, origin, NPC.scale, spriteEffects, 0f); - } - spriteBatch.Draw(texture, npcOffset + afterimageOffset, NPC.frame, FinalColor * NPC.Opacity, rotation, origin, NPC.scale, spriteEffects, 0f); - - if (!NPC.HasValidTarget) - return false; - - // Telegraph - float shotGate = 30 + (NPC.localAI[1] * 10); - float shotCompletion = (NPC.ai[3] - 90) / shotGate; - - Effect effect = Terraria.Graphics.Effects.Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; - effect.Parameters["centerOpacity"].SetValue(MathHelper.Lerp(0, 0.7f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); - effect.Parameters["mainOpacity"].SetValue(MathHelper.Lerp(0, 1f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); - effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.Lerp(0, MathHelper.PiOver4 * 0.33f, shotCompletion)); - effect.Parameters["edgeColor"].SetValue(Color.DarkRed.ToVector3()); - effect.Parameters["centerColor"].SetValue(Color.Red.ToVector3()); - effect.Parameters["edgeBlendLength"].SetValue(0.07f); - effect.Parameters["edgeBlendStrength"].SetValue(4f); - - Main.spriteBatch.EnterShaderRegion(BlendState.Additive, effect); - - Texture2D invis = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - - Main.EntitySpriteDraw(invis, npcOffset + afterimageOffset, null, Color.White, NPC.DirectionTo(Main.player[NPC.target].Center).ToRotation(), new Vector2(invis.Width / 2f, invis.Height / 2f), 500f, 0, 0); - - Main.spriteBatch.ExitShaderRegion(); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Jellyghoul.png b/NPCs/SunkenSea/Jellyghoul.png deleted file mode 100644 index 4ca9f182b3..0000000000 Binary files a/NPCs/SunkenSea/Jellyghoul.png and /dev/null differ diff --git a/NPCs/SunkenSea/JellyghoulTentacle.png b/NPCs/SunkenSea/JellyghoulTentacle.png deleted file mode 100644 index 573995d970..0000000000 Binary files a/NPCs/SunkenSea/JellyghoulTentacle.png and /dev/null differ diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs deleted file mode 100644 index 122f8e3d03..0000000000 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ /dev/null @@ -1,390 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class KelpieSeadragon : SunkenSeaNPC - { - public ref float SquishX => ref NPC.localAI[0]; - public ref float SquishY => ref NPC.localAI[1]; - - public Vector2 randomPathPoint; - - public Entity currentTarget; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 400; - public static int IdleMaxPathDistance = 800; - - public static int FleeTileAnticipationDistance = 64; - - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - //ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 13; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 10; - NPC.width = 20; - NPC.height = 58; - NPC.defense = 5; - NPC.lifeMax = 150; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 5); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.15f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.KelpieSeadragon") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 3f; - } - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - // Fall and be useless if out of water - if (!NPC.wet) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - NPC.velocity.X *= 0.98f; - NPC.noGravity = false; - NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.1f); - NPC.gfxOffY += 5; - return; - } - NPC.noGravity = true; - switch (NPC.ai[0]) - { - // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. - case 0: - NPC.chaseable = false; - if (NPC.velocity.Length() < 0.1f) - { - NPC.ai[1]++; - // Randomly switch direction - if (Main.rand.NextBool(120)) - { - NPC.direction *= -1; - } - // Move in a random direction towards the direction the horse is facing - if (NPC.ai[1] > 120 || Main.rand.NextBool(90)) - { - Vector2 direction = new Vector2(NPC.direction * 30, Main.rand.Next(-30, 30)); - direction = direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 2; - NPC.ai[1] = 0; - } - } - // Reset any rotation from aggressive AI - NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); - NPC.velocity *= 0.99f; - break; - case 1: - currentTarget = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - if (currentTarget == null) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - SquishX = 0; - SquishY = 0; - break; - } - if (currentTarget is Player) - NPC.chaseable = true; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1); - // If the target is too far from its shooting range or a tile is in the way, move closer - if ((currentTarget.Distance(NPC.Center) > 300 || !hasSight) || currentTarget is NPC) - { - NPC.ai[1] = 0; - - bool huntReady = NPC.ai[2] == 0; - if (huntReady) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, currentTarget.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - - NPC.ai[2]--; - - NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.direction * MathHelper.PiOver4 / 2, 0.05f); - } - else - { - // Otherwise sit at a distance and fire projectiles - NPC.velocity *= 0.9f; - NPC.ai[1]++; - int fireRate = 30; // Do not change this without adjusting the frame rate as well - float currentTime = NPC.ai[1] % 36; - if (currentTime == fireRate) - { - SoundEngine.PlaySound(Sounds.CommonCalamitySounds.ExoPlasmaShootSound with { Volume = 0.2f, Pitch = 1.8f }, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 spawnPos = new Vector2(NPC.Center.X + NPC.direction * 18, NPC.position.Y + 22); - Vector2 projSpeed = spawnPos.DirectionTo(currentTarget.Center).SafeNormalize(Vector2.Zero) * 6; - Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), 10, 0f); - } - } - // Squash and stretch - int shotTime = 24; // When to squash - if (currentTime < 24) - { - SquishX = MathHelper.Lerp(SquishX, 0.9f, currentTime / shotTime); - SquishY = MathHelper.Lerp(SquishY, 1.05f, currentTime / shotTime); - } - else - { - SquishX = MathHelper.Lerp(SquishX, 1.35f, (currentTime - shotTime) / (fireRate - shotTime)); - SquishY = MathHelper.Lerp(SquishY, 0.85f, (currentTime - shotTime) / (fireRate - shotTime)); - } - - NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); - } - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > currentTarget.Center.X ? -1 : 1; - } - break; - case 2: - { - // If the avoided entity is gone, go back to idling. - if (CurrentPredator == null) - { - NPC.ai[0] = 0; - break; - } - - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > CurrentPredator.Center.X ? -1 : 1; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - break; - } - } - NPC.spriteDirection = NPC.direction; - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - return; - NPC.frameCounter++; - if (NPC.frameCounter > 5) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - // Anger - if (NPC.ai[0] == 1 && NPC.ai[1] > 0) - { - if (NPC.frame.Y > 12 * frameHeight || NPC.frame.Y < frameHeight * 7) - { - NPC.frame.Y = frameHeight * 7; - } - } - // Idle - else - { - if (NPC.frame.Y > 6 * frameHeight) - { - NPC.frame.Y = 0; - } - } - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentPrey is null && CurrentPredator is null) - { - EnterAttackMode(); - currentTarget = player; - } - } - - protected override void OnPredatorDetection(NPC predator) - { - NPC.ai[0] = 2; - NPC.ai[1] = 0; - currentTarget = null; - } - - protected override void OnPreyDetection(NPC prey) - { - if (CurrentPredator == null) - { - EnterAttackMode(); - currentTarget = prey; - } - } - - public void EnterAttackMode() - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - SquishX = 0.9f; - SquishY = 1.05f; - } - - public override void AwaitingPathBehavior() - { - Player target = Main.player[NPC.target]; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1); - if (NPC.ai[0] == 1f && (currentTarget.Distance(NPC.Center) > 300 || !hasSight || currentTarget is NPC)) - { - if (currentTarget != null) - { - NPC.velocity += NPC.DirectionTo(currentTarget.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPredator || n == CurrentPrey) && Vector2.DistanceSquared(NPC.Center, n.Center) < 900f * 900f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type) || attacker.type == ModContent.NPCType(); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.7f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Asset tex = TextureAssets.Npc[Type]; - SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 stretch = NPC.ai[0] == 1 && NPC.ai[1] > 0 ? new Vector2(SquishX, SquishY) : Vector2.One; - spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColor, NPC.rotation, new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]), NPC.scale * stretch, fx, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/KelpieSeadragon.png b/NPCs/SunkenSea/KelpieSeadragon.png deleted file mode 100644 index c42bfe0083..0000000000 Binary files a/NPCs/SunkenSea/KelpieSeadragon.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfish.cs b/NPCs/SunkenSea/LazarusLampfish.cs deleted file mode 100644 index 62e5b3a275..0000000000 --- a/NPCs/SunkenSea/LazarusLampfish.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class LazarusLampfish : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Attacking = 1, - Fleeing = 2 - } - - public static Asset cooldownTexture; - public static Asset attackTexture; - - public Vector2 randomPathPoint; - - public Entity currentTarget; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 100; - public static int IdleMaxPathDistance = 800; - - public static int FleeTileAnticipationDistance = 64; - - public ref float CurrentPhase => ref NPC.ai[0]; - public ref float Timer => ref NPC.ai[1]; - - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - public static List PredatorList => new List() - { - ModContent.NPCType(), - }; - - protected override List PredatorIDs => PredatorList; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public override void Load() - { - cooldownTexture = ModContent.Request(Texture + "Cooldown"); - attackTexture = ModContent.Request(Texture + "Attack"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 40; - NPC.width = 50; - NPC.height = 30; - NPC.defense = 12; - NPC.lifeMax = 400; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 10); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.1f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LazarusLampfish") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.2f; - MaxSpeed = 3f; - } - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - // Fall and be useless if out of water - if (!NPC.wet) - { - CurrentPhase = (int)PhaseType.Idle; - Timer = 0; - NPC.velocity.X *= 0.98f; - NPC.noGravity = false; - return; - } - NPC.noGravity = true; - switch (CurrentPhase) - { - // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. - case (int)PhaseType.Idle: - NPC.chaseable = false; - NPC.ai[2]--; - if (CurrentPredator != null || CurrentPlayer != null) - { - EnterAttackMode(); - } - if (CurrentPrey != null) - { - bool huntReady = NPC.ai[2] == 0; - if (huntReady) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - break; - case (int)PhaseType.Attacking: - currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; - if (currentTarget == null) - { - CurrentPhase = (int)PhaseType.Idle; - Timer = 0; - NPC.ai[2] = 0; - MaxSpeed = 3; - Acceleration = 0.2f; - break; - } - MaxSpeed = 8; - Acceleration = 0.3f; - NPC.chaseable = true; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, currentTarget.Center, 1, 1); - // If the target is too far from its shooting range or a tile is in the way, move closer - if (currentTarget.Distance(NPC.Center) > 200 || !hasSight) - { - bool restart = NPC.ai[2] == 0; - if (restart) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, currentTarget.Center, SunkenSeaTileValidity), forceNewTask: restart); - - NPC.ai[2]--; - } - // If close enough, start the timer for the flash - else if (Timer == 0) - { - Timer = 1; - } - // Flash! - if (Timer >= 1) - { - NPC.velocity *= 0.92f; - Timer++; - if (Timer == 60) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center + (NPC.rotation - (NPC.spriteDirection == 1 ? 0 : MathHelper.Pi)).ToRotationVector2() * 40, Vector2.Zero, ModContent.ProjectileType(), 20, 1); - } - SoundEngine.PlaySound(SoundID.NPCDeath7 with { Pitch = 0.4f }, NPC.Center); - } - if (Timer >= 120) - { - Timer = 0; - NPC.ai[2] = 0; - CurrentPhase = (int)PhaseType.Fleeing; - } - } - break; - case (int)PhaseType.Fleeing: - { - // If the avoided entity is gone, go back to idling. - currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; - if (currentTarget == null || Timer > 300) - { - CurrentPhase = currentTarget != null ? (int)PhaseType.Attacking : (int)PhaseType.Idle; - Timer = 0; - MaxSpeed = 3; - Acceleration = 0.2f; - NPC.ai[2] = currentTarget != null ? 0 : 120; - break; - } - if (Timer == 0) - { - NPC.spriteDirection = NPC.direction *= -1; - } - Timer++; - MaxSpeed = 8; - Acceleration = 0.4f; - - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > currentTarget.Center.X ? -1 : 1; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(currentTarget.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(currentTarget.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, currentTarget.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - break; - } - } - if (!(Timer >= 1 && CurrentPhase == (int)PhaseType.Attacking) && !(Timer < 3 && CurrentPhase == (int)PhaseType.Fleeing)) - { - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - return; - NPC.frameCounter++; - if (NPC.frameCounter > 5) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) - { - NPC.frame.Y = 0; - } - } - - protected override void OnPlayerDetection(Player player) - { - EnterAttackMode(); - } - - protected override void OnPredatorDetection(NPC predator) - { - EnterAttackMode(); - } - - public void EnterAttackMode() - { - CurrentPhase = (int)PhaseType.Attacking; - Timer = 0; - NPC.ai[2] = 0; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPredator || n == CurrentPrey) && Vector2.DistanceSquared(NPC.Center, n.Center) < 700f * 700f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || (p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void AwaitingPathBehavior() - { - bool hasSight = false; - if (currentTarget != null) - hasSight = Collision.CanHitLine(NPC.Center, 1, 1, currentTarget.Center, 1, 1); - if (CurrentPhase == (int)PhaseType.Idle && CurrentPrey != null || CurrentPhase == (int)PhaseType.Attacking && currentTarget.Distance(NPC.Center) > 200 || !hasSight) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if ((spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "LazarusLampfish", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Asset tex = TextureAssets.Npc[Type]; - Rectangle frame = NPC.frame; - Vector2 origin = new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]); - - if (CurrentPhase == (int)PhaseType.Attacking && Timer > 0) - { - tex = attackTexture; - frame = tex.Frame(1, 11, 0, (int)MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, 120, Timer, true))); - origin = new Vector2(tex.Width() / 2, tex.Height() / 22); - } - if (CurrentPhase == (int)PhaseType.Fleeing) - { - tex = cooldownTexture; - frame = tex.Frame(1, 4, 0, (int)MathHelper.Lerp(0, 3, Utils.GetLerpValue(0, 24, Timer % 24, true))); - origin = new Vector2(tex.Width() / 2, tex.Height() / 8); - } - SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), frame, drawColor, NPC.rotation, origin, NPC.scale, fx, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/LazarusLampfish.png b/NPCs/SunkenSea/LazarusLampfish.png deleted file mode 100644 index 8d06df2008..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfish.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfishAttack.png b/NPCs/SunkenSea/LazarusLampfishAttack.png deleted file mode 100644 index d143d51cbb..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfishAttack.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfishCooldown.png b/NPCs/SunkenSea/LazarusLampfishCooldown.png deleted file mode 100644 index 48eba44b4d..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfishCooldown.png and /dev/null differ diff --git a/NPCs/SunkenSea/Leerslug.cs b/NPCs/SunkenSea/Leerslug.cs deleted file mode 100644 index ef53844377..0000000000 --- a/NPCs/SunkenSea/Leerslug.cs +++ /dev/null @@ -1,311 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Particles; -using System; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Leerslug : ModNPC - { - public enum PhaseType - { - Idle = 0, - Rawr = 1, - Jumps = 2, - Dash = 3 - } - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - /// - /// Handles the visual scale for the slug - /// - public Vector2 squish = new Vector2(); - public Player Target => Main.player[NPC.target]; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - } - public override void SetDefaults() - { - NPC.aiStyle = -1; - NPC.damage = 30; - NPC.width = 56; - NPC.height = 30; - NPC.defense = 3; - NPC.lifeMax = 200; - NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(silver: 1); - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit50; - NPC.DeathSound = SoundID.NPCDeath53; - NPC.GravityIgnoresLiquid = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - squish = reader.ReadVector2(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(squish); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Leerslug") - }); - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; - NPC.TargetClosest(false); - Lighting.AddLight(NPC.Center, 0.5f, 0.2f, 0); - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - squish = Vector2.One; - } - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - // Flip direction and slow down if it's still moving from a previous cycle - if (Timer == 0 && Main.rand.NextBool()) - { - NPC.direction *= -1; - NPC.velocity.X *= 0.9f; - } - // Move horizontally in short bursts - else if (Timer >= Main.rand.Next(30, 90) && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0) - { - NPC.ai[2] = 1; - NPC.velocity.X = Main.rand.NextFloat(2, 4) * Main.rand.NextBool().ToDirectionInt(); - } - - // Increment the timer before the burst ends - if (NPC.ai[2] == 1) - { - NPC.ai[3]++; - } - // Slowdown after a burst - else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.9f; - NPC.ai[3]++; - } - - // Handle movement states - if (NPC.ai[3] > Main.rand.Next(20, 40)) - { - // If the slug is moving, enter slowdown - if (NPC.ai[2] == 1) - NPC.ai[2] = 2; - // If the slug is in slowdown, reset - else if (NPC.ai[2] == 2) - ChangePhase((int)PhaseType.Idle); - NPC.ai[3] = 0; - } - - NPC.direction = NPC.velocity.X.DirectionalSign(); - - // Aggro - if (Target.active && Target.Distance(NPC.Center) < 400 && NPC.HasSight(Target.Center)) - { - ChangePhase((int)PhaseType.Rawr); - } - } - break; - case (int)PhaseType.Rawr: - { - int roar = 40; - int startAI = 70; - NPC.velocity.X *= 0.9f; - // Roar in place with a lil jump - if (Timer == roar) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -3; - } - } - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - if (Timer > startAI) - ChangePhase(Main.rand.NextBool() ? (int)PhaseType.Jumps : (int)PhaseType.Dash); - } - break; - case (int)PhaseType.Jumps: - { - // Do a few hops towards the player - int maxJumps = 3; - int jumpHeight = Target.Bottom.Y < NPC.Top.Y ? 8 : 5; - if (NPC.ai[2] >= maxJumps - 1 && NPC.velocity.Y == 0) - { - ChangePhase((int)PhaseType.Dash); - } - // Jump - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -jumpHeight; - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - NPC.ai[2]++; - } - // Move towards the player if it fell in lava - else if (NPC.lavaWet) - { - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - } - } - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - break; - case (int)PhaseType.Dash: - { - // Squash and stretch to telegraph the dash - int squash = 30; - int stretch = 10; - Vector2 squashAmt = new Vector2(0.6f, 1.5f); - RawrAnimation(squash, stretch, squashAmt); - // Slow down before dashing - if (Timer < squash + 10) - { - NPC.velocity.X *= 0.95f; - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - } - // Dash - else if (Timer == squash + 10) - { - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 6; - SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, NPC.Center); - } - // Leave behind some hot mist particles - else - { - if (NPC.velocity.X == 0) - { - ChangePhase((int)PhaseType.Jumps); - break; - } - if (Timer < squash + 60) - { - if (Timer % 2 == 0) - { - MediumMistParticle particle = new MediumMistParticle(NPC.Center, -NPC.velocity, Color.Red, Color.Orange, Main.rand.NextFloat(0.8f, 1.2f), 255f, 0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } - } - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - if (Timer > 120 && NPC.velocity.Y == 0) - ChangePhase((int)PhaseType.Jumps); - } - break; - } - NPC.StepUpBlocks(); - NPC.spriteDirection = NPC.direction; - // Bounce on lava - if (NPC.lavaWet) - { - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - } - Timer++; - } - - public void RawrAnimation(int squashDuration, int stretchDuration, Vector2 squashAmt) - { - int squash = squashDuration; - int stretch = squash + stretchDuration; - // rawrxd - if (Timer == squash) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - } - // Squash - if (Timer < squash) - { - squish.X = MathHelper.Lerp(1, squashAmt.X, Utils.GetLerpValue(0, squash, Timer, true)); - squish.Y = MathHelper.Lerp(1, squashAmt.Y, Utils.GetLerpValue(0, squash, Timer, true)); - } - // Stretch - else if (Timer >= squash && Timer < stretch) - { - squish.X = MathHelper.Lerp(squashAmt.X, 1, Utils.GetLerpValue(squash, stretch, Timer, true)); - squish.Y = MathHelper.Lerp(squashAmt.Y, 1, Utils.GetLerpValue(squash, stretch, Timer, true)); - } - } - - public void ChangePhase(int phaseNum, bool resetai2 = true, bool resetai3 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - if (resetai3) - NPC.ai[3] = 0; - NPC.netUpdate = true; - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LavaMoss, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Leerslug", 2); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; - - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale * squish, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Leerslug.png b/NPCs/SunkenSea/Leerslug.png deleted file mode 100644 index 69dba75efd..0000000000 Binary files a/NPCs/SunkenSea/Leerslug.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs deleted file mode 100644 index b337deb76b..0000000000 --- a/NPCs/SunkenSea/LostShoal.cs +++ /dev/null @@ -1,442 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.DataStructures; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class LostShoal : ModNPC - { - public static Asset RedTexture; - public static Asset BlueTexture; - public static Asset GoldTexture; - - public float RandomOpacityOffset; - public ref float Variant => ref NPC.ai[1]; - public ref float Leader => ref NPC.ai[2]; - public ref float Role => ref NPC.ai[3]; - - public enum ShoalColor - { - Red = 0, - Blue = 1, - Green = 2, - Gold = 3 - } - - public override void Load() - { - RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalRed"); - BlueTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalBlue"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalGold"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 8; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CountsAsCritter[Type] = true; - } - - public override void SetDefaults() - { - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; - NPC.defense = 0; - NPC.lifeMax = 1; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = null; - NPC.DeathSound = SoundID.NPCDeath6; - NPC.noTileCollide = true; - NPC.alpha = 120; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = ItemID.AshBlock; // yeah this is intentional - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LostShoal") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Randomize the color of the fish - Variant = Main.rand.Next(0, 3); - if (Main.rand.NextBool(50)) - { - Variant = (int)ShoalColor.Gold; - NPC.catchItem = ItemID.GoldCoin; - } - - RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); - NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - } - - public override void AI() - { - // swim normally if the fish is the leader of the shoal - if (Role != 1) - { - LeaderMovement(); - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool(2) ? 1 : -1; - } - if (Main.rand.NextBool(1200)) - { - NPC.direction *= -1; - } - } - else - { - NPC owner = Main.npc[(int)Leader]; - // if the owner of the shoal isn't a lost shoal or is dead, find a new shoal to attach to - if (!owner.active || owner.type != ModContent.NPCType()) - { - bool anyShoals = false; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC n = Main.npc[k]; - if (!n.active) - continue; - if (owner.type == ModContent.NPCType()) - { - // if a nearby shoal leader is found, go follow it - if (Role != 1 && n.Distance(NPC.position) < 1200) - { - anyShoals = true; - Leader = n.whoAmI; - } - } - } - // if no leaders are found nearby, a new leader is picked - if (!anyShoals) - { - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC n = Main.npc[k]; - if (!n.active) - continue; - if (owner.type == ModContent.NPCType()) - { - if (n.Distance(NPC.position) < 1200) - { - // the found fish becomes the new leader, and this fish becomes a member of its school - n.ai[3] = 2; - Leader = n.whoAmI; - } - } - } - } - } - NPC.velocity = owner.velocity; - NPC.direction = owner.direction; - NPC.spriteDirection = owner.spriteDirection; - // gather behind the leader - // basically a pet - // if we want to make the fish scared of players or other predators, then set enemyClose to true. For now this is commented out. - //NPC.TargetClosest(false); - //bool enemyClose = Main.player[NPC.target] != null && Main.player[NPC.target].active && Main.player[NPC.target].Distance(NPC.position) < 128; - bool enemyClose = false; - float SAImovement = enemyClose ? 0.02f : 0.1f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || owner.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - } - NPC.noGravity = true; - // leaders will naturally spawn a school of followers upon spawning - if (Role == 0) - { - // the amount of fish to spawn - int fishCount = Main.rand.Next(3, 6); - for (int i = 0; i < fishCount; i++) - { - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - Main.npc[n].ai[3] = 1; // the 1 means that the spawned fish will not be a leader, and will not spawn even more fish - Main.npc[n].ai[2] = NPC.whoAmI; // marks this fish as the owner of the spawned fish - } - Role = 2; // don't spawn any more fish - } - // leaders are a tiny bit more brighter - float intensity = Role == 1 ? 0.002f : 0.004f; - Color glowColor = new(0.983f, 1f, 0.78f); - switch (Variant) - { - case (int)ShoalColor.Blue: - glowColor = new(0.78f, 0.77f, 0.988f); - break; - case (int)ShoalColor.Red: - glowColor = new(1f, 0.83f, 0.819f); - break; - case (int)ShoalColor.Gold: - glowColor = new(1f, 1f, 0.678f); - break; - } - Lighting.AddLight(NPC.Center, glowColor.R * intensity, glowColor.G * intensity, glowColor.B * intensity); - // Formerly, sprinkle down ash particles - // Now they trail glowing dust as they move - // Keeping it as reference in case i want to use it somewhere else (i will) - if (Main.rand.NextBool(120)) - { - //Color ashColor = new(40, 48, 41); - int dustid = DustID.CoralTorch; - switch (Variant) - { - case (int)ShoalColor.Blue: - //ashColor = new(44, 63, 66); - dustid = DustID.BoneTorch; - break; - case (int)ShoalColor.Red: - //ashColor = new(79, 41, 42); - dustid = DustID.CrimsonTorch; - break; - case (int)ShoalColor.Gold: - //ashColor = Color.Yellow; - dustid = DustID.IchorTorch; - break; - } - //Particle ash = new SquareAshParticle(NPC.Center, new Vector2(0, 4), 150, Main.rand.NextFloat(0.85f, 1f), ashColor); - //GeneralParticleHandler.SpawnParticle(ash); - - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); - dust.velocity = Vector2.Zero; - } - if (Variant == (int)ShoalColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void LeaderMovement() - { - // This is just usual swimmer ai with some modifications - NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; - - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.06f; - NPC.noGravity = true; - if (NPC.collideX) - { - NPC.velocity.X = NPC.velocity.X * -1f; - NPC.direction *= -1; - NPC.netUpdate = true; - } - if (NPC.collideY) - { - NPC.netUpdate = true; - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; - NPC.directionY = -1; - NPC.ai[0] = -1f; - } - else if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y); - NPC.directionY = 1; - NPC.ai[0] = 1f; - } - } - if (NPC.Calamity().newAI[0] <= 0 && NPC.Distance(Main.player[NPC.target].Center) > (45 * 16)) - { - //NPC.velocity.X *= -1; - NPC.direction *= -1; - NPC.Calamity().newAI[0] = 300; - } - NPC.Calamity().newAI[0] -= 1; - // No target behavior - NPC.velocity.X += (float)NPC.direction * 0.02f; - if (NPC.velocity.X < -1.5f || NPC.velocity.X > 1.5f) - { - NPC.velocity.X *= 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y -= 0.01f; - if (NPC.velocity.Y < -0.3f) - { - NPC.ai[0] = 1f; - } - } - else - { - NPC.velocity.Y += 0.01f; - if (NPC.velocity.Y > 0.3f) - { - NPC.ai[0] = -1f; - } - } - int NPCTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; - int NPCTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; - if (Main.tile[NPCTileX, NPCTileY - 1].LiquidAmount > 128) - { - if (Main.tile[NPCTileX, NPCTileY + 1].HasTile) - { - NPC.ai[0] = -1f; - } - else if (Main.tile[NPCTileX, NPCTileY + 2].HasTile) - { - NPC.ai[0] = -1f; - } - } - if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) - { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += 0.2f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Player.Calamity().clamity && !NPC.AnyNPCs(Type)) - { - return 0.125f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - int goreType = Main.rand.Next(11, 14); - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-10, 11) * 0.2f, Main.rand.Next(-10, 11) * 0.2f), goreType, 0.2f); - } - } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - // Gold shoals drop Gold Coins instead of ash when caught - // The shoal drops 1 coin by default while the extra coins are spawned here in a spread - if (!failed) - { - if (Variant == (int)ShoalColor.Gold) - { - for (int i = 0; i < Main.rand.Next(0, 5); i++) - { - Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - // Spooky glowey aura effect - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Color glowColor = Color.SeaGreen; - switch (Variant) - { - case (int)ShoalColor.Blue: - glowColor = Color.Cyan; - break; - case (int)ShoalColor.Red: - glowColor = Color.Pink; - break; - case (int)ShoalColor.Gold: - glowColor = Color.Yellow; - break; - } - - spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition, null, glowColor * 0.45f, 0f, bloom.Size() / 2f, 0.3f, SpriteEffects.None, 0); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - // Regular stuff for drawing the actual fish and its afterimages - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)ShoalColor.Blue: - texture = BlueTexture.Value; - break; - case (int)ShoalColor.Red: - texture = RedTexture.Value; - break; - case (int)ShoalColor.Gold: - texture = GoldTexture.Value; - break; - } - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - Color white = Color.White; - float colorLerpAmt = 0.5f; - int afterimageAmt = 7; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (float)(afterimageAmt - i) / 15f; - Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - } - } - - float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3f + RandomOpacityOffset) / 2f + 0.5f; - - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, NPC.frame, drawColor * MathHelper.Lerp(0.4f, 0.8f, sine), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/LostShoal.png b/NPCs/SunkenSea/LostShoal.png deleted file mode 100644 index 00bfd5303b..0000000000 Binary files a/NPCs/SunkenSea/LostShoal.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalBlue.png b/NPCs/SunkenSea/LostShoalBlue.png deleted file mode 100644 index 8d9eaecff9..0000000000 Binary files a/NPCs/SunkenSea/LostShoalBlue.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalGold.png b/NPCs/SunkenSea/LostShoalGold.png deleted file mode 100644 index e868c21047..0000000000 Binary files a/NPCs/SunkenSea/LostShoalGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalRed.png b/NPCs/SunkenSea/LostShoalRed.png deleted file mode 100644 index 9a759540c3..0000000000 Binary files a/NPCs/SunkenSea/LostShoalRed.png and /dev/null differ diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs deleted file mode 100644 index 2c05c81d00..0000000000 --- a/NPCs/SunkenSea/Pearlpod.cs +++ /dev/null @@ -1,422 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Enums; -using System.Collections.Generic; -using System; - -namespace CalamityMod.NPCs.SunkenSea -{ - public abstract class Pearlpod : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Eating = 1, - Fleeing = 2, - Hiding = 3 - } - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public abstract float SpawnRate { get; } - public abstract int ItemType { get; } - - public abstract string GoreName { get; } - - public ref float CurrentPhase => ref NPC.Calamity().newAI[0]; - - public ref float BiteCount => ref NPC.Calamity().newAI[1]; - - public NPC clam => NPC.Calamity().newAI[2] == 0 ? null : Main.npc[(int)NPC.Calamity().newAI[2] - 1]; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 30; - NPC.height = 30; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = false; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.catchItem = ItemType; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Pearlpod") - }); - } - - public override void AI() - { - bool predatorAvailable = CurrentPredator != null || CurrentPlayer != null; - Tile vine = CalamityUtils.ParanoidTileRetrieval((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - if (CurrentPhase < 2) - { - // Set newAI[0] to 1 if the Pearlpod is inside of a vine - if (vine.TileType == ModContent.TileType() && !NPC.justHit) - { - CurrentPhase = (int)PhaseType.Eating; - } - // Otherwise reset eating-related variables - else - { - BiteCount = 0; - CurrentPhase = (int)PhaseType.Idle; - } - } - - switch (CurrentPhase) - { - // :literallynothing: - case (int)PhaseType.Idle: - { - } - break; - // Eat kelp if found - case (int)PhaseType.Eating: - { - NPC.velocity.X *= 0.1f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - BiteCount++; - } - // After munching 10 times, the vine is broken and the Pearlpod continues about its day - if (BiteCount == 10) - { - if (vine.TileType == ModContent.TileType()) - { - WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - } - } - } - break; - // Run into a clam - case (int)PhaseType.Fleeing: - { - BiteCount = 0; - bool clamValid = IsClamValid(); - // Stop running if the threat is gone - if (!predatorAvailable) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - break; - } - // Look for a clam if the current clam is no longer valid - if (!clamValid) - { - LookForClam(); - } - else - { - // Run boy run! - NPC.velocity.X = NPC.DirectionTo(clam.Center).X.DirectionalSign() * 3; - NPC.direction = NPC.velocity.X.DirectionalSign(); - NPC.StepUpBlocks(); - - // Minimum distances on both axes. Y is higher in case there's a ledge - Vector2 dif = NPC.Center - clam.Center; - bool xClose = Math.Abs(dif.X) < 20; - bool yClose = Math.Abs(dif.Y) < 60; - - // Enter the clam if close enough - if (xClose && yClose) - { - CurrentPhase = (int)PhaseType.Hiding; - } - // If close enough horizontally, but not vertically, jump - else if (xClose && !yClose && NPC.Center.Y < clam.Center.Y && NPC.velocity.Y == 0) - { - NPC.velocity.Y -= 4; - } - } - } - break; - // Hide inside a clam - case (int)PhaseType.Hiding: - { - BiteCount = 0; - bool clamValid = IsClamValid(); - // Exit the clam if the threat is gone - if (!predatorAvailable) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - break; - } - // If the clam is gone, exit the dead clam - if (!clamValid) - { - LookForClam(); - if (!IsClamValid()) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - } - } - // True hiding behaviour - else - { - // Become invisible - if (NPC.Opacity > 0) - NPC.Opacity -= 0.2f; - // When fully invisible lock into the clam's position - if (NPC.Opacity <= 0) - NPC.Center = clam.Center; - NPC.dontTakeDamage = true; - NPC.ShowNameOnHover = false; - } - } - break; - } - // Reset hiding stuff when not in danger - if (CurrentPhase < 2) - { - if (predatorAvailable && !IsClamValid()) - LookForClam(); - } - if (CurrentPhase != (int)PhaseType.Hiding) - { - if (NPC.Opacity < 1) - { - NPC.Opacity += 0.3f; - if (NPC.Opacity > 1) - NPC.Opacity = 1; - } - NPC.dontTakeDamage = false; - } - } - - /// - /// Puts the clam back into idle state - /// - public void ResetClam() - { - if (IsClamValid()) - { - clam.localAI[2] = 0; - Clam clamMod = clam.ModNPC(); - clamMod.ChangePhase((int)Clam.PhaseType.Idle); - clamMod.ShellRotation = MathHelper.ToRadians(60); - NPC.netUpdate = true; - clam.netUpdate = true; - } - } - - /// - /// Check if a clam is valid to hide in - /// - /// - public bool IsClamValid() - { - if (clam == null || !clam.active || clam.life < 0 || clam.type != ModContent.NPCType() || clam.localAI[2] <= 0 || (clam.ai[0] > 0 && clam.ai[0] < 3)) - { - return false; - } - return true; - } - - /// - /// Look for a clam - /// - public void LookForClam() - { - // Don't bother running the searches if no clams exist - if (NPC.AnyNPCs(ModContent.NPCType())) - { - NPC nearestClam = null; - foreach (NPC n in Main.ActiveNPCs) - { - float dist = Vector2.Distance(NPC.Center, n.Center); - // Find the nearest clam in a 200px radius which the pearlpod is able to see and doesn't already have a pearlpod going after it - if (dist < 200f && NPC.HasSight(n.Center) && n.type == ModContent.NPCType() && n.localAI[2] <= 0 && n.ai[0] == 0) - { - // if no clam has been attached yet and this is the nearest clam, mark it as a candidate - if (nearestClam == null || NPC.Distance(nearestClam.Center) < dist) - { - nearestClam = n; - } - } - } - // if a clam was found, update both NPCs' variables to have them cooperate - if (nearestClam != null) - { - nearestClam.localAI[2] = NPC.whoAmI + 1; - nearestClam.ai[0] = (int)Clam.PhaseType.Pod; - NPC.Calamity().newAI[2] = nearestClam.whoAmI + 1; - nearestClam.netUpdate = true; - NPC.netUpdate = true; - } - } - if (clam != null) - { - clam.localAI[2] = NPC.whoAmI + 1; - } - } - - protected override void OnPlayerDetection(Player player) - { - CurrentPhase = (int)PhaseType.Fleeing; - LookForClam(); - } - - protected override void OnPreyDetection(NPC prey) - { - CurrentPhase = (int)PhaseType.Fleeing; - LookForClam(); - } - - protected override bool NPCSearchFilter(NPC n) - { - return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 900f * 900f); - } - - protected override bool PlayerSearchFilter(Player p) - { - return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 3) - { - NPC.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * SpawnRate; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, GoreName, 3); - } - } - - public class PearlpodWhite : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.6f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodWhite"; - } - public class PearlpodPink : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.05f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodPink"; - } - public class PearlpodBlack : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.2f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodBlack"; - } -} diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png deleted file mode 100644 index 405f8278dd..0000000000 Binary files a/NPCs/SunkenSea/PearlpodBlack.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png deleted file mode 100644 index 65ffef0598..0000000000 Binary files a/NPCs/SunkenSea/PearlpodPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png deleted file mode 100644 index b23e06f817..0000000000 Binary files a/NPCs/SunkenSea/PearlpodWhite.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs deleted file mode 100644 index 0278a4280a..0000000000 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ /dev/null @@ -1,558 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PodobooKoi : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Flee = 1, - Hunt = 2, - Hostile = 3 - } - public enum VariantType - { - Normal = 0, - Comet = 1, - BubbleEye = 2, - Oranda = 3 - } - - public ref float CurrentVariant => ref NPC.ai[0]; - - public ref float CurrentBehavior => ref NPC.ai[1]; - - public ref float ShootTimer => ref NPC.ai[2]; - - public static int IdleMinPathDistance = 50; - public static int IdleMaxPathDistance = 600; - - public static int FleeTileAnticipationDistance = 28; - - public Vector2 randomPathPoint; - public Vector2 lavaLine = Vector2.Zero; - - public static Asset cometTex; - public static Asset bubbleEyedTex; - public static Asset orandaTex; - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() - { - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - public override void Load() - { - cometTex = ModContent.Request(Texture + "Comet"); - bubbleEyedTex = ModContent.Request(Texture + "BubbleEyed"); - orandaTex = ModContent.Request(Texture + "Oranda"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 15; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 30; - NPC.width = 32; - NPC.height = 32; - NPC.defense = 10; - NPC.lifeMax = 1000; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.lavaImmune = true; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PodobooKoi") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // 50% chance to be one of 3 variants - if (Main.rand.NextBool()) - { - CurrentVariant = Main.rand.Next(1, 4); - } - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - if (NPC.ai[3] <= 0) - { - lavaLine = FindLavaLine(); - NPC.ai[3] = 180; - } - NPC.ai[3]--; - NPC.chaseable = false; - if (NPC.lavaWet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - case (int)PhaseType.Hunt: - HuntBehavior(); - break; - case (int)PhaseType.Hostile: - HostileBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - if (CurrentBehavior != (int)PhaseType.Hostile) - { - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValidityLenient)); - } - - /// - /// Same as LavaTileValidity but without the requirement for a full tile of lava - /// - /// - /// - public bool LavaTileValidityLenient(Point point) - { - Point actualFuckingPoint = new Point(point.X * 16, point.Y * 16); - - return NPC.Hitbox.Contains(actualFuckingPoint) - || !NPC.GetIntersectingHitboxPoints( - actualFuckingPoint, 10, 10).Any(a => Main.tile[a].IsTileSolidGround() || Main.tile[a].LiquidAmount < 25 || Main.tile[a].LiquidType != LiquidID.Lava); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4; - return; - } - - MaxSpeed = 8; - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, LavaTileValidityLenient)); - } - } - - public void HuntBehavior() - { - if (CurrentPrey == null) - { - MaxSpeed = 4; - CurrentBehavior = (int)PhaseType.Idle; - pathfinding.ClearResults(); - return; - } - MaxSpeed = 8; - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, LavaTileValidityLenient)); - } - - public void HostileBehavior() - { - // Reset - if (CurrentPlayer == null || !NPC.HasSight(CurrentPlayer.Center)) - { - MaxSpeed = 4; - CurrentBehavior = (int)PhaseType.Idle; - NPC.ai[2] = 0; - pathfinding.ClearResults(); - // Sometimes the fish gets stuck in air, so make it dive down when losing interest - NPC.velocity.Y = 4; - return; - } - - NPC.chaseable = true; - bool noLava = lavaLine == Vector2.Zero; - // If this is true, use its lava behavior - bool useLavaAI = CurrentPlayer.lavaWet && NPC.Distance(CurrentPlayer.Center) < 500; - // If this is true, but the above is not use its "air" behavior. This is set to true provided the fish is close enough to the lava line - bool useAirAI = false; - - // If the player is not in lava - if (lavaLine != Vector2.Zero && !CurrentPlayer.lavaWet) - { - // Use air AI if the fish is close enough to the lava line - useAirAI = NPC.Distance(lavaLine) < 80; - - // If the player is too far from the lava swim towards the player - bool farFromLava = CurrentPlayer.Distance(lavaLine) > 300; - // Distance from the destination the fish needs to be - float distNeeded = farFromLava ? 300 : 40; - - Vector2 destination = farFromLava ? new Vector2(CurrentPlayer.Center.X, lavaLine.Y) : lavaLine; - - // If it's still trying to chase the player, clear the pathfinding results - if (NPC.Calamity().newAI[0] == 1) - { - pathfinding.ClearResults(); - NPC.Calamity().newAI[0] = 0; - } - - // Go to the location if not close enough, otherwise slow down - if (NPC.Distance(destination) > distNeeded) - { - pathfinding.DoPathfinding(new(this, NPC.Center, destination)); - } - else - { - NPC.velocity *= 0.9f; - pathfinding.ClearResults(); - } - } - // If the player is in lava but far from the fish just swim to them - else if (NPC.Distance(CurrentPlayer.Center) > 150) - { - if (NPC.position == NPC.oldPosition) - { - NPC.velocity.Y = 4; - } - MaxSpeed = 6; - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPlayer.Center, LavaTileValidityLenient)); - // Mark the fish as currently trying to chase the player - NPC.Calamity().newAI[0] = 1; - } - // If the player is in lava and close to the fish just kinda float about - else - { - NPC.SimpleFlyMovement(Main.rand.NextVector2Circular(11, 11), 0.01f); - pathfinding.ClearResults(); - } - - // Normal variants fire basic projectiles - // Orandas fire a projectile that splits into 2 bouncing projectiles - // Bubble Eyes fire a projectile with some quirky homing - // Comet fires a very fast projectile - - int projType = CurrentVariant switch - { - (int)VariantType.Comet => ModContent.ProjectileType(), - (int)VariantType.Oranda => ModContent.ProjectileType(), - (int)VariantType.BubbleEye => ModContent.ProjectileType(), - _ => ModContent.ProjectileType() - }; - - int speed = CurrentVariant switch - { - (int)VariantType.Comet => 18, - (int)VariantType.Oranda => 8, - (int)VariantType.BubbleEye => 8, - _ => 10 - }; - - int fireRate = CurrentVariant switch - { - (int)VariantType.Comet => Main.rand.Next(90, 110), - (int)VariantType.Oranda => Main.rand.Next(70, 100), - (int)VariantType.BubbleEye => Main.rand.Next(80, 120), - _ => Main.rand.Next(50, 80) - }; - - float shotCompletion = Utils.GetLerpValue(0, -30, ShootTimer, true); - int soundFreq = (int)MathHelper.Lerp(10, 5, shotCompletion); - float pitch = MathHelper.Lerp(0, 0.6f, shotCompletion); - // Play bubbly sounds at increasing frequency and pitch - if (ShootTimer < 0 && ShootTimer % soundFreq == 0) - { - SoundEngine.PlaySound(SoundID.Item111 with { Pitch = pitch, MaxInstances = 0 }, NPC.Center); - // Star! - if (CurrentVariant == (int)VariantType.Comet) - { - SoundEngine.PlaySound(SoundID.Item9 with { Pitch = pitch * 0.5f + 0.2f, MaxInstances = 0, Volume = 0.4f }, NPC.Center); - } - } - - // Lava attack, directly shoot at the player - if (useLavaAI) - { - ShootTimer--; - if (ShootTimer < -30) - { - ShootTimer = fireRate; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.SafeDirectionTo(CurrentPlayer.Center, Vector2.UnitY) * speed, projType, NPC.damage, 0); - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - } - } - } - // Air attack, shoot projectiles at the player in arches - else if (useAirAI) - { - MaxSpeed = 4; - ShootTimer--; - - if (ShootTimer <= -40) - { - ShootTimer = fireRate; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.DirectionTo(CurrentPlayer.Center) * speed, projType, NPC.damage, 0, ai0: CurrentPlayer.whoAmI); - } - - for (int i = 0; i < 30; i++) - { - int d = Dust.NewDust(NPC.Center + NPC.DirectionTo(CurrentPlayer.Center) * NPC.width / 2, 10, 10, DustID.InfernoFork, Scale: Main.rand.NextFloat(0.8f, 1.4f)); - Main.dust[d].velocity = (NPC.DirectionTo(CurrentPlayer.Center) * Main.rand.Next(4, 10)).RotatedByRandom(Main.rand.NextFloat(-0.6f, 0.6f)); - Main.dust[d].noGravity = true; - } - - NPC.velocity.X = -NPC.DirectionTo(CurrentPlayer.Center).X * 4; - } - } - else - { - ShootTimer = 0; - } - int dir = NPC.DirectionTo(CurrentPlayer.Center).X.DirectionalSign(); - NPC.rotation = NPC.DirectionTo(CurrentPlayer.Center).ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - - public Vector2 FindLavaLine() - { - Vector2? tileFoundPosition = null; - Point npcPoint = NPC.Center.ToTileCoordinates(); - for (int i = npcPoint.Y; i > npcPoint.Y - 60; i--) - { - if (!Main.tile[npcPoint.X, i].HasTile && Main.tile[npcPoint.X, i].LiquidAmount < 255) - { - tileFoundPosition = new Point(npcPoint.X, i).ToWorldCoordinates() - Vector2.UnitY * 8; - break; - } - } - - if (tileFoundPosition.HasValue) - return tileFoundPosition.Value; - - return Vector2.Zero; - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.rotation = 0; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - bool lavaFilter = p.lavaWet && Vector2.DistanceSquared(NPC.Center, p.Center) < 300f * 300f; - bool airFilter = false; - bool alreadyVisible = p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f; - if (lavaLine != Vector2.Zero) - { - Vector2 lavaDist = lavaLine - p.Center; - airFilter = !p.lavaWet && p.Center.Y <= lavaLine.Y && MathF.Abs(lavaDist.Y) < 300 && MathF.Abs(lavaDist.X) < 1000; - } - return NPC.HasSight(p.Center) && (lavaFilter || airFilter || alreadyVisible); - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentBehavior == (int)PhaseType.Idle) - { - CurrentBehavior = (int)PhaseType.Hostile; - lavaLine = FindLavaLine(); - } - } - - protected override void OnPreyDetection(NPC prey) - { - if (CurrentBehavior != (int)PhaseType.Flee) - CurrentBehavior = (int)PhaseType.Hunt; - } - - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (int)PhaseType.Flee; - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - NPC.frame.Y = 0; - return; - } - bool shooting = ShootTimer <= -1; - int interval = shooting ? 12 : 6; - NPC.frameCounter++; - if (NPC.frameCounter > interval) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - if (shooting) - { - if (NPC.frame.Y < 9) - { - NPC.frame.Y = 9; - } - if (NPC.frame.Y > 14) - { - NPC.frame.Y = 14; - } - } - else - { - if (NPC.frame.Y >= 9) - { - NPC.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - switch (CurrentVariant) - { - case (int)VariantType.Comet: - tex = cometTex.Value; - break; - case (int)VariantType.Oranda: - tex = orandaTex.Value; - break; - case (int)VariantType.BubbleEye: - tex = bubbleEyedTex.Value; - break; - } - float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -40, ShootTimer, true)); - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.05f; - spriteBatch.Draw(tex, NPC.Center - screenPos, tex.Frame(1, 15, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 30), scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Lava, hit.HitDirection, -1f, 0, default, 1f); - } - string goreName = (VariantType)CurrentVariant switch - { - VariantType.Comet => "PodobooKoiComet", - VariantType.Oranda => "PodobooKoiOranda", - VariantType.BubbleEye => "PodobooKoiBubbleEyed", - _ => "PodobooKoi" - }; - CalamityUtils.SpawnGores(NPC, goreName, 2); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.WriteVector2(lavaLine); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - lavaLine = reader.ReadVector2(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - } -} diff --git a/NPCs/SunkenSea/PodobooKoi.png b/NPCs/SunkenSea/PodobooKoi.png deleted file mode 100644 index a917e63dc3..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoi.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png deleted file mode 100644 index ca341e7ea7..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiComet.png b/NPCs/SunkenSea/PodobooKoiComet.png deleted file mode 100644 index 85350e418e..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiComet.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiOranda.png b/NPCs/SunkenSea/PodobooKoiOranda.png deleted file mode 100644 index 1f11720fca..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiOranda.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs deleted file mode 100644 index 9827331ce7..0000000000 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ /dev/null @@ -1,507 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Potions; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PolypPanasea : SunkenSeaNPC - { - public enum FishColor - { - Red = 0, - Turquoise = 1, - Green = 2, - Purple = 3, - Gold = 4, - Radiant = 5 - } - public enum PhaseType - { - Idle = 0, - Flee = 1, - Hiding = 2 - } - public ref float CurrentBehavior => ref NPC.ai[0]; - public ref float Variant => ref NPC.ai[1]; - public ref float PanaceaTimer => ref NPC.ai[2]; - - #region Textures - // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works - public static Asset RadiantTexture; - public static Asset GreenTexture; - public static Asset PurpleTexture; - public static Asset TurquoiseTexture; - public static Asset GoldTexture; - public static Asset TextureCoated; - public static Asset RadiantTextureCoated; - public static Asset GreenTextureCoated; - public static Asset PurpleTextureCoated; - public static Asset TurquoiseTextureCoated; - public static Asset GoldTextureCoated; - #endregion - - public int PolypIndex = -1; - - public Vector2 randomPathPoint; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; - public static int IdleMaxPathDistance = 1200; - - public static int FleeTileAnticipationDistance = 64; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiant"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGold"); - GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreen"); - PurpleTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurple"); - TurquoiseTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoise"); - TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRedCoated"); - RadiantTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiantCoated"); - GoldTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGoldCoated"); - GreenTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreenCoated"); - PurpleTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurpleCoated"); - TurquoiseTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated"); - base.Load(); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void OnSpawn(IEntitySource source) - { - // Panaseas released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - // Randomize the color of the fish - Variant = Main.rand.Next(0, 4); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - Variant = Main.rand.Next(4, 6); - } - // 1 in 5 chance for a Panasea to be coated - if (Main.rand.NextBool(5)) - { - PanaceaTimer = 61; - } - switch (Variant) - { - case (int)FishColor.Purple: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Turquoise: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Gold: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - if (Variant == (int)FishColor.Gold || Variant == (int)FishColor.Radiant) - { - NPC.rarity = 3; - } - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PolypPanasea") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - // Reset polyp index in case the polyp dies - if (PolypIndex > -1) - { - if (Main.npc[PolypIndex].type != ModContent.NPCType() || !Main.npc[PolypIndex].active || Main.npc[PolypIndex].life <= 0 || Main.npc[PolypIndex].Distance(NPC.Center) > 1000) - { - PolypIndex = -1; - } - } - if (NPC.wet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - case (int)PhaseType.Hiding: - HideBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - - int dir = NPC.velocity.X.DirectionalSign(); - if (CurrentBehavior != (int)PhaseType.Hiding) - { - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - } - else - { - NPC.rotation = 0; - } - NPC.spriteDirection = NPC.direction = dir; - // Assure it cant be caught when collecting panacea - if (PanaceaTimer <= 60 && PanaceaTimer > 0) - { - PanaceaTimer--; - } - if (Variant == (int)FishColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(100, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - public void HideBehavior() - { - // Once the threat is gone or if the polyp is destroyed, go out of hiding - if (PolypIndex <= -1 || (CurrentPredator == null && Main.rand.NextBool(120))) - { - NPC.dontTakeDamage = false; - CurrentBehavior = (int)PhaseType.Idle; - pathfinding.ClearResults(); - return; - } - - // Become invincible while hiding - NPC.dontTakeDamage = true; - MaxSpeed = 2; - - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, Main.npc[PolypIndex].Center + Main.rand.NextVector2Unit() * Main.rand.Next(20, 30), SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null && PolypIndex <= -1) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4; - return; - } - - MaxSpeed = 6; - - // If a polyp is found, try to run into it - if (PolypIndex > -1) - { - NPC.netUpdate = true; - Vector2 polypPos = Main.npc[PolypIndex].position; - pathfinding.DoPathfinding(new(this, NPC.Center, polypPos, SunkenSeaTileValidity)); - - if (NPC.Distance(Main.npc[PolypIndex].Center) < 50) - { - CurrentBehavior = (int)PhaseType.Hiding; - pathfinding.ClearResults(); - } - } - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - else if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.ai[0] = 1f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 1960f * 1960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - protected override void OnPredatorDetection(NPC predator) - { - if (CurrentBehavior == (int)PhaseType.Idle) - { - pathfinding?.ClearResults(); - CurrentBehavior = (int)PhaseType.Flee; - AlertPolyp(); - } - } - - public void AlertPolyp() - { - // Look for a nearby polyp to hide in - if (PolypIndex <= -1) - { - foreach (NPC n in Main.ActiveNPCs) - { - bool nCloser = PolypIndex <= -1 ? true : n.Distance(NPC.Center) < Main.npc[PolypIndex].Distance(NPC.Center); - if (n.type == ModContent.NPCType() && nCloser) - { - PolypIndex = n.whoAmI; - } - } - } - // If a polyp is found, cause both NPCs to signal each other with a ! - if (PolypIndex > -1) - { - SoundEngine.PlaySound(SoundID.NPCHit37 with { Pitch = 1 }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Red, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote); - Particle emote2 = new EmoteExpressionParticle( - Main.npc[PolypIndex].Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Yellow, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote2); - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (Variant == (int)FishColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPolypPanasea"); - } - if (Variant == (int)FishColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldPolypPanasea"); - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - NPC.ai[3] = frame; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.8f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (Variant < (int)FishColor.Gold) - { - string goreName = Variant switch - { - (int)FishColor.Turquoise => "PolypPanaseaTurquoise", - (int)FishColor.Purple => "PolypPanaseaPurple", - (int)FishColor.Green => "PolypPanaseaGreen", - _ => "PolypPanaseaRed", - }; - CalamityUtils.SpawnGores(NPC, goreName, 2); - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - bool Coated = PanaceaTimer >= 61; - - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)FishColor.Radiant: - texture = Coated ? RadiantTextureCoated.Value : RadiantTexture.Value; - break; - case (int)FishColor.Gold: - texture = Coated ? GoldTextureCoated.Value : GoldTexture.Value; - break; - case (int)FishColor.Purple: - texture = Coated ? PurpleTextureCoated.Value : PurpleTexture.Value; - break; - case (int)FishColor.Green: - texture = Coated ? GreenTextureCoated.Value : GreenTexture.Value; - break; - case (int)FishColor.Turquoise: - texture = Coated ? TurquoiseTextureCoated.Value : TurquoiseTexture.Value; - break; - case (int)FishColor.Red: - texture = Coated ? TextureCoated.Value : TextureAssets.Npc[Type].Value; - break; - } - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Rectangle frame = texture.Frame(1, 6, 0, (int)NPC.ai[3]); - spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - public override bool? CanBeCaughtBy(Item item, Player player) - { - if (PanaceaTimer > 0) - { - if (PanaceaTimer > 60) - { - Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ModContent.ItemType()); - PanaceaTimer = 60; - } - return false; - } - return null; - } - public override bool CanBeHitByNPC(NPC attacker) - { - if (attacker.type == ModContent.NPCType() || attacker.type == ModContent.NPCType()) - return false; - return PredatorIDs.Contains(attacker.type); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.Write(PolypIndex); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - PolypIndex = reader.ReadInt32(); - } - } -} diff --git a/NPCs/SunkenSea/PolypPanasea.png b/NPCs/SunkenSea/PolypPanasea.png deleted file mode 100644 index 08ba323d31..0000000000 Binary files a/NPCs/SunkenSea/PolypPanasea.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGold.png b/NPCs/SunkenSea/PolypPanaseaGold.png deleted file mode 100644 index a48da65906..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png deleted file mode 100644 index 47dddda974..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreen.png b/NPCs/SunkenSea/PolypPanaseaGreen.png deleted file mode 100644 index 7bd323fb82..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png deleted file mode 100644 index 1f46bf5148..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurple.png b/NPCs/SunkenSea/PolypPanaseaPurple.png deleted file mode 100644 index 3871e4e412..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaPurple.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png deleted file mode 100644 index 6d9f423150..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiant.png b/NPCs/SunkenSea/PolypPanaseaRadiant.png deleted file mode 100644 index 2099da1dfb..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png deleted file mode 100644 index 74c021ef11..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRedCoated.png b/NPCs/SunkenSea/PolypPanaseaRedCoated.png deleted file mode 100644 index bfbf7ba316..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRedCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoise.png b/NPCs/SunkenSea/PolypPanaseaTurquoise.png deleted file mode 100644 index e45b512f09..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaTurquoise.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png deleted file mode 100644 index 3d4c9475f8..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/Polyperil.cs b/NPCs/SunkenSea/Polyperil.cs deleted file mode 100644 index c2b9208795..0000000000 --- a/NPCs/SunkenSea/Polyperil.cs +++ /dev/null @@ -1,210 +0,0 @@ -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Polyperil : SunkenSeaNPC - { - public ref float Color => ref NPC.ai[1]; - - public ref float Timer => ref NPC.ai[0]; - - public static Asset blueTexture = null; - - public static Asset greenTexture = null; - - public static Asset pinkTexture = null; - - public static Asset voltaicTexture = null; - - // The tentacles do all the work - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - pinkTexture = ModContent.Request(Texture + "Pink"); - blueTexture = ModContent.Request(Texture + "Blue"); - greenTexture = ModContent.Request(Texture + "Green"); - voltaicTexture = ModContent.Request(Texture + "Voltaic"); - } - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.damage = 20; - NPC.lifeMax = 200; - NPC.defense = 10; - NPC.knockBackResist = 0f; - NPC.chaseable = false; - - NPC.aiStyle = -1; - AIType = -1; - NPC.width = 32; - NPC.height = 36; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(silver: 5); - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.chaseable = reader.ReadBoolean(); - } - - public override void OnSpawn(IEntitySource source) - { - // Pick a random color - Color = Main.rand.Next(0, 3); - // 1 in 15 chance to be Voltaic - if (Main.rand.NextBool(15)) - Color = 3; - - // Spawn tentacles - int dist = 80; - int tentMin = 3; - int tentMax = 8; - for (int i = 0; i < Main.rand.Next(tentMin, tentMax + 1); i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 pos = NPC.Center + new Vector2(Main.rand.Next(-dist, dist), 20); - NPC tent = NPC.NewNPCDirect(NPC.GetSource_FromThis(), NPC.Center, ModContent.NPCType(), ai0: NPC.whoAmI); - tent.ModNPC().anchor = pos; - } - } - } - - public override void AI() - { - Timer++; - NPC.velocity.Y += 10; - - // While out of water, slowly lose health (suffocating) - if (!NPC.wet) - { - if (Timer % 60 == 0) - { - NPC.HitEffect(0, 5); - NPC.life -= 5; - if (NPC.life <= 0) - NPC.life = 1; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - } - if (Color < 3) - { - string goreName = Color switch - { - 1 => "PolyperilBlue", - 2 => "PolyperilGreen", - _ => "PolyperilPink" - }; - CalamityUtils.SpawnGores(NPC, goreName, 1); - } - } - - public override bool CanBeHitByNPC(NPC attacker) - { - return PredatorIDs.Contains(attacker.type); - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - - else if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - } - return 0f; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = Color switch - { - 1 => blueTexture.Value, - 2 => greenTexture.Value, - 3 => voltaicTexture.Value, - _ => pinkTexture.Value - }; - - spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, SpriteEffects.None, 0); - - // Desaturate in color when losing health, based on real anemones - float vibrance = MathHelper.Lerp(1, 0, Utils.GetLerpValue(1, 0.33f, NPC.life / (float)NPC.lifeMax, true)); - - spriteBatch.Draw(tex, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor) * vibrance, NPC.rotation, tex.Size() / 2, NPC.scale, SpriteEffects.None, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Polyperil.png b/NPCs/SunkenSea/Polyperil.png deleted file mode 100644 index 5cec975ef0..0000000000 Binary files a/NPCs/SunkenSea/Polyperil.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilBlue.png b/NPCs/SunkenSea/PolyperilBlue.png deleted file mode 100644 index 4f91afe357..0000000000 Binary files a/NPCs/SunkenSea/PolyperilBlue.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilGreen.png b/NPCs/SunkenSea/PolyperilGreen.png deleted file mode 100644 index 74a51dcf1c..0000000000 Binary files a/NPCs/SunkenSea/PolyperilGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilPink.png b/NPCs/SunkenSea/PolyperilPink.png deleted file mode 100644 index 9c9747e5dd..0000000000 Binary files a/NPCs/SunkenSea/PolyperilPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilTentacle.cs b/NPCs/SunkenSea/PolyperilTentacle.cs deleted file mode 100644 index b1c2b87f05..0000000000 --- a/NPCs/SunkenSea/PolyperilTentacle.cs +++ /dev/null @@ -1,282 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PolyperilTentacle : SunkenSeaNPC - { - public ref float ParentIndex => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public List Segments; - - // Where the tentacle will hover when not attacking - public Vector2 anchor; - - // They attack everything - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - // Tentacles are not a natural enemy, they are manually spawned by Polyperils - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.None; - - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Polyperil.DisplayName"); - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.npcSlots = 0f; - NPC.damage = 20; - NPC.lifeMax = 200; - NPC.defense = 0; - NPC.knockBackResist = 0f; - NPC.chaseable = false; - NPC.dontTakeDamage = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - - NPC.aiStyle = -1; - AIType = -1; - NPC.width = 20; - NPC.height = 20; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - // Banner = NPC.type; - // BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(anchor.X); - writer.Write(anchor.Y); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - anchor = new Vector2(reader.ReadSingle(), reader.ReadSingle()); - } - - public override void AI() - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - NPC.active = false; - return; - } - - // Create a chain - if (Segments == null || Segments.Count < 10) - { - Segments = new List(10); - for (int i = 0; i < 10; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(parent.Center + Vector2.UnitY * i * 10); - Segments.Add(segment); - } - - Segments[0].locked = true; - Segments[^1].locked = true; - } - Entity targ = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - // While aggro'd, launch at the target then retreat - if (targ != null) - { - // Remain stationary while at rest - if (Timer < 0) - { - NPC.velocity = Vector2.Zero; - } - // Launch - if (Timer == 0) - { - NPC.velocity = NPC.SafeDirectionTo(targ.Center) * 8; - SoundEngine.PlaySound(SoundID.Item152 with { Volume = 1.5f, Pitch = 0.4f }, NPC.Center); - } - // Retreat - if (Timer > 20) - { - NPC.velocity = NPC.SafeDirectionTo(anchor) * 5; - if (Timer == 21) - { - RecalculatePosition(parent.Center); - } - } - // Reset timer - if (Timer > 30 && NPC.Distance(anchor) < 20) - { - NPC.velocity = Vector2.Zero; - Timer = -120; - } - } - // Otherwise hover around the anchor position - else - { - NPC.velocity = NPC.SafeDirectionTo(anchor) * 3; - // Randomly relocate position - if (Timer > 300 && Main.rand.NextBool(180)) - { - RecalculatePosition(parent.Center); - Timer = 0; - } - } - // If the anchor is too far from the parent (usually happens if the parent is moved) recalculate the anchor position - if (anchor.Distance(parent.Center) > 200) - { - RecalculatePosition(parent.Center); - } - - // Repel other tentacles - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherTentacle = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherTentacle.active || k == NPC.whoAmI || (otherTentacle.type != ModContent.NPCType())) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherTentacle.position.X) + Math.Abs(NPC.position.Y - otherTentacle.position.Y); - if (taxicabDist < NPC.width * 1.5f) - { - if (NPC.position.X < otherTentacle.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherTentacle.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - NPC.rotation = NPC.DirectionTo(parent.Center).ToRotation(); - - // Update the chain - Segments[0].oldPosition = Segments[0].position; - Segments[0].position = parent.Center; - - Segments[^1].oldPosition = Segments[^1].position; - Segments[^1].position = parent.active ? NPC.Center : parent.Center; - - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 5, loops: 1, gravity: 0.3f); - - NPC.netUpdate = true; - NPC.netSpam = 0; - - Timer++; - } - - public void RecalculatePosition(Vector2 basePos, int dist = 50) - { - anchor = basePos + new Vector2(Main.rand.Next(-dist, dist), Main.rand.Next(-dist, dist)); - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 460f * 460f; - } - - protected override bool NPCSearchFilter(NPC n) - { - // The tentacles go after EVERYTHING - return (Vector2.DistanceSquared(NPC.Center, n.Center) < 660f * 660f && n.type != NPC.type && n.type != ModContent.NPCType() && n.type != ModContent.NPCType()); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Kelpie Seadragons have high resistance to Polyperils as they eat them - if (target.type == ModContent.NPCType()) - { - modifiers.SourceDamage *= 0.05f; - } - } - - public override void ModifyTypeName(ref string typeName) - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - return; - } - if (parent.ai[1] == 3) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPolyperil"); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - return false; - } - - // Color is based on parent color - Color col = parent.ai[1] switch - { - 1 => new Color(27, 190, 255), - 2 => new Color(7, 255, 180), - 3 => new Color(122, 255, 240), - _ => new Color(255, 140, 248) - }; - - // Desaturate as parent's health lowers - float vibrance = MathHelper.Lerp(1, 0, Utils.GetLerpValue(1, 0.33f, parent.life / (float)parent.lifeMax, true)); - Color final = Color.Lerp(Color.White, col, vibrance); - - Texture2D tex = TextureAssets.Npc[Type].Value; - Rectangle tip = new Rectangle(0, 0, 8, 10); - Rectangle chain = new Rectangle(0, 12, 8, 8); - - if (Segments == null || Segments.Count <= 0) - { - spriteBatch.Draw(tex, NPC.Center - screenPos, tip, drawColor.MultiplyRGB(final), NPC.rotation, new Vector2(4, 10), NPC.scale, SpriteEffects.None, 0); - return false; - } - - // Draw tentacle chains - for (int i = 0; i < Segments.Count - 1; i++) - { - VerletSimulatedSegment seg = Segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 4; - if (i == Segments.Count - 1) - { - dist = Vector2.Distance(seg.position, parent.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); - SpriteEffects dir = NPC.Center.X > parent.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - spriteBatch.Draw(tex, seg.position - screenPos, chain, drawColor.MultiplyRGB(final), rot + MathHelper.PiOver2, new Vector2(4, 4), new Vector2(1, dist / 8), dir, 0); - } - - // Draw the tip - spriteBatch.Draw(tex, NPC.Center - screenPos, tip, drawColor.MultiplyRGB(final), NPC.rotation - MathHelper.PiOver2, new Vector2(4, 5), NPC.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/PolyperilTentacle.png b/NPCs/SunkenSea/PolyperilTentacle.png deleted file mode 100644 index b6795c38e8..0000000000 Binary files a/NPCs/SunkenSea/PolyperilTentacle.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilVoltaic.png b/NPCs/SunkenSea/PolyperilVoltaic.png deleted file mode 100644 index 184d259a00..0000000000 Binary files a/NPCs/SunkenSea/PolyperilVoltaic.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index dfb0d550fc..7a077f0067 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -1,18 +1,16 @@ using System; -using System.Collections.Generic; using System.IO; -using CalamityMod.Enums; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles.SunkenSea; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -21,53 +19,36 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class PrismBack : SunkenSeaNPC + public class PrismBack : ModNPC { public static Asset GlowTexture; - public ref float BiteCount => ref NPC.ai[0]; - public ref float ShardCooldown => ref NPC.ai[1]; - - /// - /// The horizontal coordinate of a located crystal - /// - public ref float TileX => ref NPC.ai[2]; - - /// - /// The vertical coordinate of a located crystal - /// - public ref float TileY => ref NPC.ai[3]; - - public Vector2 tilePosition => new Vector2(TileX, TileY); - protected override List PreyIDs => []; - protected override List PredatorIDs => []; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - public override void Load() => GlowTexture = ModContent.Request(Texture + "Glow"); public override void SetStaticDefaults() { - //Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - base.SetStaticDefaults(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); NPC.noGravity = true; - NPC.damage = 20; - NPC.width = 88; - NPC.height = 66; - NPC.defense = 15; - NPC.lifeMax = 500; + NPC.damage = Main.hardMode ? 40 : 20; + NPC.width = 72; + NPC.height = 58; + NPC.defense = Main.hardMode ? 25 : 15; + NPC.lifeMax = Main.hardMode ? 1000 : 500; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(silver: 2); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit24; NPC.DeathSound = SoundID.NPCDeath27; NPC.knockBackResist = 0.15f; @@ -78,6 +59,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -92,6 +74,7 @@ namespace CalamityMod.NPCs.SunkenSea { writer.Write(NPC.chaseable); } + public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); @@ -99,102 +82,73 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - if (pathfinding == null) + if ((NPC.Center.Y + 10f) > Main.player[NPC.target].Center.Y) { - pathfinding = new PathfindingManager(this); - MaxSpeed = 1.8f; - } - - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); - - if (ShardCooldown > 0) - ShardCooldown--; - - Tile t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - - // TODO - // Change this to kelp when it's added - int tileType = ModContent.TileType(); - - // Assure the kelp still exists, if it's gone, clear the tile - if ((TileX != 0 || TileY != 0) && t.TileType != tileType) - { - TileX = 0; - TileY = 0; - } - - if (NPC.wet) - { - NPC.noGravity = true; - Vector2? tilePos = tilePosition; - // Find kelp - if (Main.rand.NextBool(300)) + if (CalamityWorld.death) { - if (tilePos == null || tilePos == Vector2.Zero) - { - tilePos = CalamityUtils.NPCTileDetection(NPC, tileType, 300, true); - } + NPC.damage = NPC.defDamage * 3; } - - bool eatBehaviour = false; - // Go to the kelp if one exists nearby - if (tilePos != null && tilePos != Vector2.Zero) + else if (CalamityWorld.revenge) { - TileX = tilePos.Value.X; - TileY = tilePos.Value.Y; - t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - if (t.TileType == tileType) - { - eatBehaviour = true; - // Go to the vine if not far enough - if (tilePos.Value.Distance(NPC.Center) > 40 && BiteCount == 0) - { - pathfinding.DoPathfinding(new(this, NPC.Center, tilePos.Value, SunkenSeaTileValidity)); - } - // Slow down and eat the kelp - else - { - pathfinding.ClearResults(); - NPC.velocity *= 0.97f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(50)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = -0.4f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - BiteCount++; - } - // After munching 5 times, the vine is broken and the turtle continues about its day - if (BiteCount == 5) - { - WorldGen.KillTile((int)TileX / 16, (int)TileY / 16); - TileX = 0; - TileY = 0; - BiteCount = 0; - NPC.netUpdate = true; - } - } - } + NPC.damage = (int)Math.Round(NPC.defDamage * 2.75); } - // Just wander about if it's not trying to eat - else if (!eatBehaviour) + else if (Main.expertMode) { - TileX = 0; - TileY = 0; - BiteCount = 0; - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f), SunkenSeaTileValidity)); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); + } + else + { + NPC.damage = (int)Math.Round(NPC.defDamage * 1.25); } } else { - NPC.noGravity = false; + if (CalamityWorld.death) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); + } + else if (CalamityWorld.revenge) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 2.25); + } + else if (Main.expertMode) + { + NPC.damage = NPC.defDamage * 2; + } + else + { + NPC.damage = NPC.defDamage; + } } + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.1f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } - public override bool CanBeHitByNPC(NPC attacker) => false; public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) @@ -203,35 +157,12 @@ namespace CalamityMod.NPCs.SunkenSea } return null; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - if ((NPC.Center.Y + 10f) > target.Center.Y) - modifiers.SourceDamage *= CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2.75f : Main.expertMode ? 2.5f : 1.25f; - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) => SpawnShards(player); - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) => SpawnShards(projectile); - private void SpawnShards(Entity e) - { - if (ShardCooldown > 0) - return; - - ShardCooldown = 20; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 3; i++) - { - Vector2 shardVel = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(1.25f) * -1); - Projectile.NewProjectile(NPC.GetSource_OnHurt(e), NPC.Center + Vector2.UnitX * Main.rand.NextFloat(-20f, 20f), shardVel, ModContent.ProjectileType(), 10, 0f, Main.myPlayer, Main.rand.Next(3), NPC.whoAmI); - } - } - } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if ((spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.7f; + return SpawnCondition.CaveJellyfish.Chance * 0.9f; } return 0f; } @@ -250,28 +181,19 @@ namespace CalamityMod.NPCs.SunkenSea } if (NPC.life <= 0) { + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore4").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore5").Type, 1f); + } for (int k = 0; k < 25; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } - CalamityUtils.SpawnGores(NPC, "Prismback", 3); - } - - /*public override void FindFrame(int frameHeight) - { - NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.1f : 0f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - }*/ - - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Rectangle frame = GlowTexture.Value.Frame(1, Main.npcFrameCount[Type], 0, NPC.frame.Y); - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - Main.spriteBatch.Draw(GlowTexture.Value, NPC.Center - screenPos, null, color, NPC.rotation, frame.Size() / 2f, 1f, spriteEffects, 0f); } } } diff --git a/NPCs/SunkenSea/PrismBack.png b/NPCs/SunkenSea/PrismBack.png index 80e7d02a14..e0b6fe8eb9 100644 Binary files a/NPCs/SunkenSea/PrismBack.png and b/NPCs/SunkenSea/PrismBack.png differ diff --git a/NPCs/SunkenSea/PrismBackGlow.png b/NPCs/SunkenSea/PrismBackGlow.png index 544f81f34b..55328bedde 100644 Binary files a/NPCs/SunkenSea/PrismBackGlow.png and b/NPCs/SunkenSea/PrismBackGlow.png differ diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs deleted file mode 100644 index 1d28a5484f..0000000000 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ /dev/null @@ -1,737 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Tiles.SunkenSea; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PrismaticGuppy : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Pawn = 1, - Fleeing = 2, - Hiding = 3 - } - - public enum FishColor - { - Blue = 0, - Green = 1, - Pink = 2, - Gold = 3, - Radiant = 4 - } - - // I do not know what to call the variants, so I'm going on intuition - public enum FishShape - { - Normal = 0, - Cube = 1, - Angel = 2 - } - - /// - /// AI State - /// - public ref float CurrentPhase => ref NPC.ai[0]; - - /// - /// The color to use - /// - public ref float CurrentColor => ref NPC.ai[1]; - - /// - /// The shape to use - /// - public ref float CurrentShape => ref NPC.ai[2]; - - /// - /// The fish's role - /// - public ref float Role => ref NPC.ai[3]; - - /// - /// The index of the guppy that this guppy should follow - /// - public ref float OwnerIndex => ref NPC.localAI[0]; - - /// - /// Timer for handling when the guppy goes out of hiding - /// - public ref float HideTimer => ref NPC.localAI[1]; - - /// - /// The horizontal coordinate of a located crystal - /// - public ref float TileX => ref NPC.localAI[2]; - - /// - /// The vertical coordinate of a located crystal - /// - public ref float TileY => ref NPC.localAI[3]; - - public Vector2 tilePosition => new Vector2(TileX, TileY); - - // Each shape has a different frame count - public int FrameCount => CurrentShape == (int)FishShape.Angel ? 5 : CurrentShape == (int)FishShape.Cube ? 4 : 6; - - public Entity avoidedEntity; - - public Vector2 randomPathPoint; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; - public static int IdleMaxPathDistance = 1000; - - public static int FleeTileAnticipationDistance = 64; - - #region Textures - // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works - public static Asset RadiantTexture; - public static Asset GreenTexture; - public static Asset PinkTexture; - public static Asset GoldTexture; - - public static Asset Texture2; - public static Asset RadiantTexture2; - public static Asset GreenTexture2; - public static Asset PinkTexture2; - public static Asset GoldTexture2; - - public static Asset Texture3; - public static Asset RadiantTexture3; - public static Asset GreenTexture3; - public static Asset PinkTexture3; - public static Asset GoldTexture3; - #endregion - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public override void Load() - { - RadiantTexture = ModContent.Request(Texture + "Radiant"); - GoldTexture = ModContent.Request(Texture + "Gold"); - GreenTexture = ModContent.Request(Texture + "Green"); - PinkTexture = ModContent.Request(Texture + "Pink"); - - Texture2 = ModContent.Request(Texture + "2"); - RadiantTexture2 = ModContent.Request(Texture + "Radiant2"); - GoldTexture2 = ModContent.Request(Texture + "Gold2"); - GreenTexture2 = ModContent.Request(Texture + "Green2"); - PinkTexture2 = ModContent.Request(Texture + "Pink2"); - - Texture3 = ModContent.Request(Texture + "3"); - RadiantTexture3 = ModContent.Request(Texture + "Radiant3"); - GoldTexture3 = ModContent.Request(Texture + "Gold3"); - GreenTexture3 = ModContent.Request(Texture + "Green3"); - PinkTexture3 = ModContent.Request(Texture + "Pink3"); - - base.Load(); - } - - public override void SetStaticDefaults() - { - // This is technically redundant as variants handle this - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 28; - NPC.height = 28; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PrismaticGuppy") - }); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.frameCounter = Main.rand.NextFloat(FrameCount); - CurrentShape = Main.rand.Next(0, 3); - // Guppies released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - // Red/Green in reefs, Green/Blue elsewhere - if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - { - CurrentColor = Main.rand.Next(1, 3); - } - else - { - CurrentColor = Main.rand.Next(0, 2); - } - NPC.TargetClosest(); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - CurrentColor = Main.rand.Next(3, 5); - NPC.rarity = 3; - } - // Decide item.......................... - switch (CurrentColor) - { - case (int)FishColor.Pink: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Blue: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Gold: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - } - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - // Spawn more guppies if a leader/naturally spawned guppy - if (Role == 0 && NPC.releaseOwner == 255) - { - Role = 2; - NPC.TargetClosest(false); - // Spawn a shoal of guppies - int fishCount = Main.rand.Next(2, 4); - // More spawn in the Gleaming Burrows/Clam Den - if (NPC.HasPlayerTarget) - { - if (Main.player[NPC.target].Calamity().ZoneGleamingBurrows || Main.player[NPC.target].Calamity().ZoneClamDen) - fishCount += 5; - } - for (int i = 0; i < fishCount; i++) - { - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, Type); - Main.npc[n].ai[0] = (int)PhaseType.Pawn; - Main.npc[n].ai[3] = 1; // mark this guppy as a pawn - Main.npc[n].localAI[0] = NPC.whoAmI; // makes the spawned guppy recognize this one as the alpha - Main.npc[n].netUpdate = true; - } - } - NPC owner = Main.npc[(int)OwnerIndex]; - if (NPC.wet) - { - switch (CurrentPhase) - { - // Just do generic pathfinding if a leader. Target prey if one exists - case (int)PhaseType.Idle: - { - Acceleration = 0.5f; - MaxSpeed = 4; - if (CurrentPrey is not null) - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity)); - else - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - break; - // The unenlightened masses, They cannot make the judgement call - case (int)PhaseType.Pawn: - { - if (owner == null || !owner.active || owner.type != ModContent.NPCType()) - { - CurrentPhase = (int)PhaseType.Idle; - Role = 2; - break; - } - - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 20) - pathfinding.DoPathfinding(new(this, NPC.Center, owner.Center, SunkenSeaTileValidity)); - else - { - float passiveMvtFloat = 0.5f; - float range = 70f; - Vector2 fischPos = NPC.Center; - float xDist = owner.Center.X - fischPos.X; - float yDist = owner.Center.Y - fischPos.Y; - yDist += Main.rand.NextFloat(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - xDist += 20f * -(float)owner.direction; - Vector2 leaderVector = new Vector2(xDist, yDist); - float leaderDist = leaderVector.Length(); - float returnSpeed = 8f; - //If leader is close enough, resume normal - if (leaderDist < range && owner.velocity.Y == 0f && - NPC.Bottom.Y <= owner.Bottom.Y && - !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - { - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - } - - if (leaderDist < 50f) - { - if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) - { - NPC.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (leaderDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (leaderDist > 300f) - { - passiveMvtFloat = 1f; - } - leaderDist = returnSpeed / leaderDist; - leaderVector.X *= leaderDist; - leaderVector.Y *= leaderDist; - } - if (NPC.velocity.X < leaderVector.X) - { - NPC.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) - { - NPC.velocity.X += passiveMvtFloat; - } - } - if (NPC.velocity.X > leaderVector.X) - { - NPC.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) - { - NPC.velocity.X -= passiveMvtFloat; - } - } - if (NPC.velocity.Y < leaderVector.Y) - { - NPC.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) - { - NPC.velocity.Y += passiveMvtFloat * 2f; - } - } - if (NPC.velocity.Y > leaderVector.Y) - { - NPC.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) - { - NPC.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (NPC.velocity.X >= 0.25f) - { - NPC.direction = -1; - } - else if (NPC.velocity.X < -0.25f) - { - NPC.direction = 1; - } - NPC.spriteDirection = -NPC.direction; - } - - float SAImovement = 0.2f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || otherFish.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - } - break; - // Run from predators, attempting to find crystals to camo in - case (int)PhaseType.Fleeing: - { - if (CurrentPredator is not null) - { - Acceleration = 0.6f; - MaxSpeed = 6; - Vector2? tilePos = tilePosition; - - // Find a sea prism - if (tilePos == null || tilePos == Vector2.Zero) - { - tilePos = CalamityUtils.NPCTileDetection(NPC, ModContent.TileType(), 300); - } - - // Go to a Prism Shard if one exists nearby - if (tilePos != null && tilePos != Vector2.Zero) - { - TileX = tilePos.Value.X; - TileY = tilePos.Value.Y; - pathfinding.DoPathfinding(new(this, NPC.Center, tilePos.Value, SunkenSeaTileValiditySizeless)); - if (NPC.Distance(tilePos.Value) < 16) - { - CurrentPhase = (int)PhaseType.Hiding; - NPC.netUpdate = true; - break; - } - } - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - else if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * 96).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - else - { - CurrentPhase = (int)PhaseType.Idle; - } - } - break; - // Hide - case (int)PhaseType.Hiding: - { - // Stay still - NPC.rotation = Utils.AngleLerp(NPC.rotation, 0, 0.05f); - NPC.velocity *= 0.95f; - Tile t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - - // Assure the prism still exists, if the player breaks it, the disguise is gone - if (t.TileType != ModContent.TileType()) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.netUpdate = true; - break; - } - - // Once the coast is clear, wait 2 seconds then go out - if (CurrentPredator is null) - { - HideTimer--; - if (HideTimer <= 0) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.netUpdate = true; - } - } - // Face towards the predator and set the safety timer to 2 seconds - else - { - NPC.direction = NPC.DirectionTo(CurrentPredator.Center).X.DirectionalSign(); - HideTimer = 120; - } - } - break; - } - - NPC.dontTakeDamage = NPC.alpha > 0; - - int dir = NPC.velocity.X.DirectionalSign(); - // Become transparent while hiding and opaque otherwise - if (CurrentPhase != (int)PhaseType.Hiding) - { - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - if (NPC.alpha > 0) - { - NPC.alpha -= 40; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - } - else - { - if (NPC.alpha < 150) - { - NPC.alpha += 10; - } - } - NPC.spriteDirection = NPC.direction = dir; - } - else - { - if (NPC.velocity.Y < 12) - NPC.velocity.Y += 1; - } - - if (Main.rand.NextBool(50)) - { - int dustid = DustID.WhiteTorch; - switch (CurrentColor) - { - case 0: - dustid = DustID.IceTorch; - break; - case 1: - dustid = DustID.CoralTorch; - break; - case 2: - dustid = DustID.PinkTorch; - break; - case 4: - dustid = DustID.BoneTorch; - break; - } - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); - dust.velocity = Vector2.Zero; - dust.noGravity = true; - dust.color *= 0.5f; - dust.noLight = true; - } - - Color c = Color.White; - - switch (CurrentColor) - { - case 0: - c = Color.SkyBlue; - break; - case 1: - c = Color.SeaGreen; - break; - case 2: - c = Color.Pink; - break; - case 4: - c = Color.Cyan; - break; - } - Lighting.AddLight(NPC.Center, c.R / 255f, c.G / 255f, c.B / 255f); - - if (CurrentColor == (int)FishColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - protected override void OnPredatorDetection(NPC predator) - { - // Don't reset the flee state while hiding - if (CurrentPhase != (int)PhaseType.Hiding) - CurrentPhase = (int)PhaseType.Fleeing; - } - - // Item sprite based on fish - public override void OnCaughtBy(Player player, Item item, bool failed) - { - if (item.ModItem != null) - { - if (item.ModItem is PrismaticGuppyItem gup) - { - if (CurrentShape == (int)FishShape.Cube) - gup.shapeVariant = 1; - - if (CurrentShape == (int)FishShape.Angel) - gup.shapeVariant = 2; - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (CurrentColor == (int)FishColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPrismaticGuppy"); - } - if (CurrentColor == (int)FishColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldPrismaticGuppy"); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.1f; - } - return 0f; - } - - public override void FindFrame(int frameHeight) - { - if ((!NPC.wet && !NPC.IsABestiaryIconDummy) || CurrentPhase == (int)PhaseType.Hiding) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - if (NPC.frame.Y >= FrameCount - 1) - { - NPC.frame.Y = 0; - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - // 15 texture variants! - Asset textureAsset; - switch (CurrentColor) - { - case (int)FishColor.Radiant: - textureAsset = CurrentShape == (int)FishShape.Angel ? RadiantTexture3 : CurrentShape == (int)FishShape.Cube ? RadiantTexture2 : RadiantTexture; - break; - case (int)FishColor.Gold: - textureAsset = CurrentShape == (int)FishShape.Angel ? GoldTexture3 : CurrentShape == (int)FishShape.Cube ? GoldTexture2 : GoldTexture; - break; - case (int)FishColor.Green: - textureAsset = CurrentShape == (int)FishShape.Angel ? GreenTexture3 : CurrentShape == (int)FishShape.Cube ? GreenTexture2 : GreenTexture; - break; - case (int)FishColor.Pink: - textureAsset = CurrentShape == (int)FishShape.Angel ? PinkTexture3 : CurrentShape == (int)FishShape.Cube ? PinkTexture2 : PinkTexture; - break; - default: - textureAsset = CurrentShape == (int)FishShape.Angel ? Texture3 : CurrentShape == (int)FishShape.Cube ? Texture2 : TextureAssets.Npc[Type]; - break; - } - Texture2D texture = textureAsset.Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / FrameCount / 2)); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / FrameCount)) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Rectangle frame = texture.Frame(1, FrameCount, 0, NPC.frame.Y); - spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - int dustType = DustID.BlueCrystalShard; - switch (CurrentColor) - { - case (int)FishColor.Pink: - dustType = DustID.PinkCrystalShard; - break; - case (int)FishColor.Green: - dustType = DustID.GemEmerald; - break; - case (int)FishColor.Gold: - dustType = DustID.GoldCritter; - break; - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); - } - if (CurrentColor < (int)FishColor.Gold) - { - string goreName = CurrentColor switch - { - (int)FishColor.Pink => "PrismaticGuppyPink", - (int)FishColor.Green => "PrismaticGuppyGreen", - _ => "PrismaticGuppyBlue", - }; - CalamityUtils.SpawnGores(NPC, goreName, 3); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - } - } -} diff --git a/NPCs/SunkenSea/PrismaticGuppy.png b/NPCs/SunkenSea/PrismaticGuppy.png deleted file mode 100644 index 8f7a2ebc88..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppy2.png b/NPCs/SunkenSea/PrismaticGuppy2.png deleted file mode 100644 index 62a654380c..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppy3.png b/NPCs/SunkenSea/PrismaticGuppy3.png deleted file mode 100644 index 4ebf0754fe..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold.png b/NPCs/SunkenSea/PrismaticGuppyGold.png deleted file mode 100644 index a0e6d461d6..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold2.png b/NPCs/SunkenSea/PrismaticGuppyGold2.png deleted file mode 100644 index 14b7abe149..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold3.png b/NPCs/SunkenSea/PrismaticGuppyGold3.png deleted file mode 100644 index e4f2a4c278..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen.png b/NPCs/SunkenSea/PrismaticGuppyGreen.png deleted file mode 100644 index 1102a61baf..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen2.png b/NPCs/SunkenSea/PrismaticGuppyGreen2.png deleted file mode 100644 index 17abd52720..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen3.png b/NPCs/SunkenSea/PrismaticGuppyGreen3.png deleted file mode 100644 index a57b5a4212..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink.png b/NPCs/SunkenSea/PrismaticGuppyPink.png deleted file mode 100644 index 5abdaad83e..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink2.png b/NPCs/SunkenSea/PrismaticGuppyPink2.png deleted file mode 100644 index bb75923212..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink3.png b/NPCs/SunkenSea/PrismaticGuppyPink3.png deleted file mode 100644 index b565f6a0b8..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant.png b/NPCs/SunkenSea/PrismaticGuppyRadiant.png deleted file mode 100644 index fb6a898a3c..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant2.png b/NPCs/SunkenSea/PrismaticGuppyRadiant2.png deleted file mode 100644 index f5f4e21964..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant3.png b/NPCs/SunkenSea/PrismaticGuppyRadiant3.png deleted file mode 100644 index ba40e9c3ab..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant3.png and /dev/null differ diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs deleted file mode 100644 index e0248b265b..0000000000 --- a/NPCs/SunkenSea/Probesnout.cs +++ /dev/null @@ -1,492 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Probesnout : SunkenSeaNPC - { - #region Members - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 200; - public static int IdleMaxPathDistance = 400; - - public static int FleeTileAnticipationDistance = 5 * 16; - public static int FleeMinPathDistance = 80; - public static int FleeMaxPathDistance = 160; - - protected override List PreyIDs => - [ - NPCType(), - ]; - - protected override List PredatorIDs => - [ - NPCType(), - NPCType(), - NPCType(), - // NPCType(), - // NPCType(), - ]; - - private enum AnimationState { Idle, Eating } - - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - switch (value) - { - case AnimationState.Idle: - AnimationFrames = 8; - TimePerAnimationFrame = 5; - break; - case AnimationState.Eating: - AnimationFrames = 12; - TimePerAnimationFrame = 7; - break; - } - - NPC.ai[1] = (float)value; - } - } - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - - private int AnimationFrames = 8; - - private int TimePerAnimationFrame = 5; - - private Vector2 ScaleSquish = Vector2.One; - - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - - private Action _previousBehavior; - - private int HuntCooldown - { - get => (int)NPC.ai[3]; - set => NPC.ai[3] = value; - } - - public Vector2 Position => NPC.Center; - - public Vector2 Velocity { get => NPC.velocity; set => NPC.velocity = value; } - - private Vector2 SpongeFoundPosition; - - private bool HasEatenSponge; - - #endregion - - #region AI - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = 8f; - MinimumPointDistance = 60f; - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = 8f; - MinimumPointDistance = 60f; - } - CurrentBehavior?.Invoke(); - - NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); - if (CurrentBehavior == EatingBehavior && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) - NPC.spriteDirection = NPC.direction = MathF.Sign(SpongeFoundPosition.X - NPC.Center.X); - else if (NPC.velocity.LengthSquared() != 0f) - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - - if (Main.rand.NextBool(150) && !HasEatenSponge && CurrentBehavior == IdlingBehavior) - ThreadPool.QueueUserWorkItem(_ => DetectSponges(), null); - - if (Main.rand.NextBool(300) && HasEatenSponge && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) > 160f * 160f) - HasEatenSponge = false; - - if (!NPC.wet && CurrentBehavior != OutsideWaterBehavior) - { - NPC.noGravity = false; - CurrentBehavior = OutsideWaterBehavior; - } - - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - } - - protected override void OnPreyDetection(NPC prey) - { - // If it's not a small fish and it's not being chased by a predator, the Probesnout may hunt. - if (CurrentPredator != null) - return; - - CurrentBehavior = HuntBehavior; - ScaleSquish.Y += 0.4f; - } - - protected override void OnPredatorDetection(NPC predator) - { - // Regardless of anything, if it detects a predator, time to run. - CurrentBehavior = FleeingBehavior; - ScaleSquish.Y += 0.4f; - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentPredator != null) - return; - - ScaleSquish.Y += 0.4f; - } - - private void IdlingBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(500f, 3000f), SunkenSeaTileValidity)); - MaxSpeed = 6f; - } - - private void FleeingBehavior() - { - // If the avoided entity is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - var headedDirection = CurrentPredator.DirectionTo(NPC.Center) * 200f; - bool tileNotWater = GetIntersectingPointsInLine(NPC.Center, NPC.Center + headedDirection).Any(point => Main.tile[point].IsTileSolid() || Main.tile[point].LiquidAmount < 255); - - if (tileNotWater) - { - do - { - var randomNormalDirection = headedDirection.RotatedBy(MathHelper.PiOver2 * Main.rand.NextBool().ToDirectionInt()); - _randomPathPoint = randomNormalDirection.RotatedByRandom(MathHelper.PiOver4 * 0.7f); - if (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()) - break; - } - while (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + _randomPathPoint, SunkenSeaTileValidity)); - MaxSpeed = 8f; - } - else - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - } - - private void HuntBehavior() - { - // If there's no more prey, go back to idling. - if (CurrentPrey is null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - bool huntReady = HuntCooldown == 0; - if (huntReady) - HuntCooldown = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, tileValidity: SunkenSeaTileValidity), forceNewTask: huntReady); - MaxSpeed = 8f; - - HuntCooldown--; - } - - private void EatingBehavior() - { - if (Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) - { - NPC.velocity *= 0.9f; - Animation = AnimationState.Eating; - if (NPC.frame.Y >= NPC.height * AnimationFrames) - { - HasEatenSponge = true; - Animation = AnimationState.Idle; - CurrentBehavior = IdlingBehavior; - SpongeFoundPosition = Vector2.Zero; - return; - } - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, SpongeFoundPosition, SunkenSeaTileValidity)); - MaxSpeed = 6f; - } - } - - private void OutsideWaterBehavior() - { - if (NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - - private void DetectSponges() - { - Vector2? spongeFoundPosition = null; - int? tileIndexFound = null; - for (int i = 0; i < 360 && spongeFoundPosition == null; i += 15) - { - var points = GetIntersectingPointsInLine(NPC.Center, NPC.Center - Vector2.UnitY.RotatedBy(MathHelper.ToRadians(i)) * 360f); - for (int j = points.Count - 1; j >= 0; j--) - { - if (Main.tile[points[j]].TileType == TileType()) - { - tileIndexFound = j; - break; - } - } - - if (tileIndexFound == null) - continue; - - for (int k = tileIndexFound.Value; k >= 0; k--) - { - Vector2 worldPos = points[k].ToWorldCoordinates(); - if (NPC.HasSight(worldPos) && SunkenSeaTileValidity(points[k])) - { - CurrentBehavior = EatingBehavior; - spongeFoundPosition = worldPos; - break; - } - } - - tileIndexFound = null; - } - - if (spongeFoundPosition.HasValue) - SpongeFoundPosition = spongeFoundPosition.Value; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - SpawnGores(NPC, "Probesnout", 4); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void AwaitingPathBehavior() - { - if (CurrentBehavior == HuntBehavior) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - #endregion - - #region Drawing & Animation - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > TimePerAnimationFrame) - { - NPC.frame.Y += frameHeight; - NPC.frame.Y = Math.Min(NPC.frame.Y, AnimationFrames * frameHeight); - NPC.frameCounter = 0; - if (Animation == AnimationState.Idle) - NPC.frame.Y %= AnimationFrames * frameHeight; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 drawPosition = NPC.Center - screenPos; - Rectangle frame = texture.Frame(horizontalFrames: 2, verticalFrames: 12, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); - Vector2 anchorPoint = frame.Size() * 0.5f; - SpriteEffects flip = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); - - return false; - } - - #endregion - - #region Other ModNPC Overrides - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 12; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - Banner = Type; - BannerItem = ItemType(); - - NPC.lifeMax = 5; - - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.chaseable = false; - - NPC.width = 44; - NPC.height = 50; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.catchItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - #endregion - - #region Syncing - - private Vector2 _randomPathPoint; - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(_randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - _randomPathPoint = reader.ReadVector2(); - } - - #endregion - } - - public class ProbesnoutGold : Probesnout - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.rarity = 3; - NPC.catchItem = ItemType(); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - } - return 0f; - } - } -} diff --git a/NPCs/SunkenSea/Probesnout.png b/NPCs/SunkenSea/Probesnout.png deleted file mode 100644 index ed19b8ecb7..0000000000 Binary files a/NPCs/SunkenSea/Probesnout.png and /dev/null differ diff --git a/NPCs/SunkenSea/ProbesnoutGold.png b/NPCs/SunkenSea/ProbesnoutGold.png deleted file mode 100644 index 81f7389093..0000000000 Binary files a/NPCs/SunkenSea/ProbesnoutGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs deleted file mode 100644 index fa0c0e958e..0000000000 --- a/NPCs/SunkenSea/SandProwler.cs +++ /dev/null @@ -1,725 +0,0 @@ -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwler : SunkenSeaNPC - { - public const int maxLength = 14; - public float speed = 3f; - public float turnSpeed = 0.0625f; - bool TailSpawned = false; - #region Textures - public static Asset BodySprite1; - public static Asset BodySprite2; - public static Asset BodySprite3; - public static Asset BodySprite4; - public static Asset BodySprite5; - public static Asset BodySprite6; - public static Asset BodySprite7; - public static Asset TailSprite; - #endregion - - public enum AnimType - { - None = 0, - Blink = 1, - Bite = 2 - } - - public bool IsHead => NPC.ai[3] == 0; - - public bool IsTail => NPC.ai[3] == 8; - - public ref float CurrentAnimation => ref NPC.localAI[1]; - - public ref float CurrentFrame => ref NPC.localAI[0]; - - public ref float BlinkTimer => ref NPC.localAI[2]; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back - if (!Main.dedServ) - { - BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); - BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); - BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); - BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); - BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); - BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); - BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); - TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); - } - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 50; - NPC.width = 30; - NPC.height = 24; - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.waterMovementSpeed = 1; - NPC.GravityIgnoresLiquid = true; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler") - }); - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - // only the head gets a healthbar - return IsHead; - } - - - public override void AI() - { - if (IsHead) - HeadAI(); - else - SegmentAI(); - } - public void HeadAI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - if (NPC.ai[2] > 0f) - { - NPC.realLife = (int)NPC.ai[2]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) - { - NPC.TargetClosest(true); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && NPC.ai[0] == 0f) - { - int Previous = NPC.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = NPC.whoAmI; - Main.npc[lol].ai[2] = (float)NPC.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 - int width = 18; - switch (segment) - { - case maxLength - 1: - spriteUse = 8; // Tail - break; - case maxLength - 2: - spriteUse = 7; // Body 7 - width = 14 ; - break; - case maxLength - 3: - spriteUse = 6; // Body 6 - width = 16; - break; - case maxLength - 4: - spriteUse = 5; // Body 5 - break; - case 0: - spriteUse = 1; // Body 1 - break; - case 1: - spriteUse = 2; // Body 2 - break; - } - Main.npc[lol].ai[3] = spriteUse; - Main.npc[lol].npcSlots = 0; - Main.npc[lol].dontCountMe = true; - Main.npc[lol].width = width; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - if (NPC.velocity.X < 0f) - { - NPC.spriteDirection = -1; - } - else if (NPC.velocity.X > 0f) - { - NPC.spriteDirection = 1; - } - if (Main.player[NPC.target].dead) - { - NPC.TargetClosest(false); - } - NPC.alpha -= 42; - if (NPC.alpha < 0) - { - NPC.alpha = 0; - } - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - { - NPC.active = false; - } - float currentSpeed = speed; - float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - Entity targ = CurrentPrey != null ? CurrentPrey : Main.player[NPC.target]; - float targetXDist = targ.position.X + (float)(targ.width / 2); - float targetYDist = targ.position.Y + (float)(targ.height / 2); - bool coinTarget = false; - // fucking run if it notices a predator - if (CurrentPredator != null) - { - Vector2 dirToPred = NPC.DirectionTo(CurrentPredator.Center); - targetXDist = -dirToPred.X * 300; - targetYDist = -dirToPred.Y * 300; - currentSpeed *= 2f; - currentTurnSpeed *= 11.5f; - } - else - { - // Look for silver and gold coins to eat - for (int i = 0; i < Main.maxItems; i++) - { - Item item = Main.item[i]; - // continue if not an active silver or gold coin - if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) - continue; - // can only look for coins in a 75 tile radius - if (item.Distance(NPC.Center) > 1200) - continue; - // if its head touches the coin, eat it - if (item.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - item.active = false; - break; - } - // if it isn't touching the coin, go to it - targetXDist = item.Center.X; - targetYDist = item.Center.Y; - coinTarget = true; - break; - } - } - // aggro on coins takes priority over players - if (CurrentPredator == null && (NPC.life > NPC.lifeMax * 0.99 && targ is Player) && !coinTarget) - { - targetYDist += 300; - if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) - { - if (NPC.velocity.X > 0f) - { - targetXDist = Main.player[NPC.target].Center.X + 300f; - } - else - { - targetXDist = Main.player[NPC.target].Center.X - 300f; - } - } - - // Blink every so often - if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) - { - CurrentAnimation = (int)AnimType.Blink; - BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; - } - } - else if (CurrentPredator == null) - { - currentSpeed *= 1.5f; - currentTurnSpeed *= 1.5f; - } - float maxCurrentSpeed = currentSpeed * 1.3f; - float minCurrentSpeed = currentSpeed * 0.7f; - float speedCompare = NPC.velocity.Length(); - if (speedCompare > 0f) - { - if (speedCompare > maxCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxCurrentSpeed; - } - else if (speedCompare < minCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= minCurrentSpeed; - } - } - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = System.Math.Abs(targetXDist); - float absoluteTargetY = System.Math.Abs(targetYDist); - float timeToReachTarget = currentSpeed / targetDistance; - targetXDist *= timeToReachTarget; - targetYDist *= timeToReachTarget; - if (targetDistance < 128 && targ is NPC || (NPC.life <= NPC.lifeMax * 0.99 && targ is Player) || coinTarget) - { - CurrentAnimation = (int)AnimType.Bite; - } - else if (CurrentAnimation != (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - BlinkTimer--; - if (BlinkTimer <= 0) - { - BlinkTimer = 0; - if (CurrentAnimation == (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - } - if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; - } - } - if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 - } - } - } - else - { - if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - } - } - NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - } - - public void SegmentAI() - { - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType() && Main.npc[i].ai[3] == 0) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float headDivisor = 1; - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override void FindFrame(int frameHeight) - { - if (IsTail) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.localAI[0]++; - NPC.frameCounter = 0; - } - if (NPC.localAI[0] > 7) - { - NPC.localAI[0] = 0; - } - } - if (IsHead) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - switch (CurrentAnimation) - { - case (int)AnimType.None: - NPC.frame.Y = 0; - break; - case (int)AnimType.Bite: - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - break; - case (int)AnimType.Blink: - if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) - { - NPC.frame.Y = frameHeight; - } - break; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override bool CheckActive() - { - return IsHead; - } - - protected override bool NPCSearchFilter(NPC n) - { - float huntRange = 600f; - float avoidRange = 200f; - bool preyFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < huntRange * huntRange && PreyIDs.Contains(n.type); - bool predFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < avoidRange * avoidRange && PredatorIDs.Contains(n.type); - bool hidingGuppy = n.type == ModContent.NPCType() && n.alpha > 0; - return !hidingGuppy && (preyFilter || predFilter); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) - { - return IsHead; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (IsHead) - NPC.chaseable = true; - else - Main.npc[NPC.realLife].chaseable = true; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); - - public static void DefineSandProwlerLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D segmentSprite = TextureAssets.Npc[Type].Value; - if (NPC.IsABestiaryIconDummy) - { - NPC.frame = segmentSprite.Frame(); - // Buffers the segment position and rotations - float offset = -0.2f; - float startX = 0; - float startY = 0; - int segmentSpacing = 16; - int animationSpeed = 5; - float wormTimer = NPC.Calamity().bestiaryWormTimer; - // Draw the body segments - for (int i = 7; i > 0; i--) - { - // The first segment is slightly closer to keep up with the head - float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; - - Texture2D toUse = i == 1 ? BodySprite1.Value : i == 2 ? BodySprite2.Value : i % 2 == 0 ? BodySprite3.Value : BodySprite4.Value; - spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 2), NPC.scale, SpriteEffects.None, 0f); - } - // Draw the head - spriteBatch.Draw(segmentSprite, NPC.position + new Vector2(startX, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), segmentSprite.Frame(1, 11, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(segmentSprite.Width * 0.5f, segmentSprite.Height / 11), NPC.scale, SpriteEffects.None, 0f); - - return false; - } - switch (NPC.ai[3]) - { - case 0: - break; - case 1: - segmentSprite = BodySprite1.Value; - break; - case 2: - segmentSprite = BodySprite2.Value; - break; - case 3: - segmentSprite = BodySprite3.Value; - break; - case 4: - segmentSprite = BodySprite4.Value; - break; - case 5: - segmentSprite = BodySprite5.Value; - break; - case 6: - segmentSprite = BodySprite6.Value; - break; - case 7: - segmentSprite = BodySprite7.Value; - break; - case 8: - segmentSprite = TailSprite.Value; - break; - default: - segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; - break; - } - float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; - Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); - if (IsHead) - { - frame = NPC.frame; - } - else if (IsTail) - { - frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); - } - spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); - return false; - } - } -} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png deleted file mode 100644 index a36c31ffbb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png deleted file mode 100644 index bb3fe551b5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler2.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png deleted file mode 100644 index 7a33532959..0000000000 Binary files a/NPCs/SunkenSea/SandProwler3.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png deleted file mode 100644 index 8588ffaa7e..0000000000 Binary files a/NPCs/SunkenSea/SandProwler4.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png deleted file mode 100644 index c1b0777eeb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler5.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler6.png b/NPCs/SunkenSea/SandProwler6.png deleted file mode 100644 index b9304a7630..0000000000 Binary files a/NPCs/SunkenSea/SandProwler6.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler7.png b/NPCs/SunkenSea/SandProwler7.png deleted file mode 100644 index bbed0cae7f..0000000000 Binary files a/NPCs/SunkenSea/SandProwler7.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png deleted file mode 100644 index c722b5e8f5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler8.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler9.png b/NPCs/SunkenSea/SandProwler9.png deleted file mode 100644 index 594b3586ae..0000000000 Binary files a/NPCs/SunkenSea/SandProwler9.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs deleted file mode 100644 index 8a95c7e615..0000000000 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ /dev/null @@ -1,504 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.GameContent.Bestiary; -using CalamityMod.Enums; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwlerNested : SunkenSeaNPC - { - public bool PeekingOut; - public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; - public Point TileCoordsToHideIn - { - get => SpotToHideIn.ToTileCoordinates(); - set => SpotToHideIn = value.ToWorldCoordinates(); - } - public Vector2 SpotToHideIn - { - get => new Vector2(NPC.ai[0], NPC.ai[1]); - set - { - NPC.ai[0] = value.X; - NPC.ai[1] = value.Y; - } - } - - public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); - - public bool RetreatingToHidingSpot - { - get => NPC.ai[2] == 1f; - set => NPC.ai[2] = value.ToInt(); - } - - public ref float SnapTimer => ref NPC.ai[3]; - public ref float SnapCooldown => ref NPC.localAI[0]; - public ref float InitialSnapDirection => ref NPC.localAI[1]; - public ref float CurrentSnapDirection => ref NPC.localAI[2]; - public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler"; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - NPCID.Sets.TrailingMode[Type] = 0; - NPCID.Sets.TrailCacheLength[Type] = 60; - NPCID.Sets.UsesNewTargetting[Type] = true; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 30; - NPC.height = 30; //32 - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - NPC.netAlways = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - NPC.waterMovementSpeed = 1f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(PeekingOut); - writer.Write(SnapCooldown); - writer.Write(InitialSnapDirection); - writer.Write(CurrentSnapDirection); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - PeekingOut = reader.ReadBoolean(); - SnapCooldown = reader.ReadSingle(); - InitialSnapDirection = reader.ReadSingle(); - CurrentSnapDirection = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - // Choose an initial tile to hide in. - if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) - { - int tries; - for (tries = 0; tries < 1800; tries++) - { - int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); - int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - - // Try again if the tile isn't solid or isn't exposed to air. - if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) - continue; - - // Try again if there's no open water near the tile. - Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); - Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; - float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; - if (collisionDistance <= 10) - continue; - - TileCoordsToHideIn = new Point(x, y); - break; - } - - // Just die if no spot was suitable. - if (tries >= 1799) - NPC.active = false; - - NPC.Center = SpotToHideIn; - NPC.netUpdate = true; - } - - Entity target = null; - - // Look for coins - for (int i = 0; i < Main.maxItems; i++) - { - Item n = Main.item[i]; - if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) - continue; - // if its head touches the coin, eat it - if (n.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - n.active = false; - break; - } - // Set the coin as the target - if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) - { - target = n; - } - } - // Go after sea minnows if not distracted by shiny coin - if (target == null) - { - if (NPC.life > NPC.lifeMax * 0.99f) - { - if (CurrentPrey != null) - target = CurrentPrey; - } - // If you've pissed it off, it now goes after YOU - else - { - NPC.TargetClosest(false); - target = Main.player[NPC.target]; - } - } - - // Open mouth when launching towards a target - if (SnapTimer > 0 && target != null && !PeekingOut) - { - NPC.Calamity().newAI[1] = 1; - } - else if (RetreatingToHidingSpot || InHidingSpot) - { - NPC.Calamity().newAI[1] = 0; - } - - // Become invulnerable and mostly transparent if hiding in a tile. - NPC.dontTakeDamage = InHidingSpot; - NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); - - // Also emit some particle effects as an indicator. - if (InHidingSpot) - { - Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, DustID.AncientLight); - sparkle.color = Color.Orange; - sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); - sparkle.noGravity = true; - } - - // Decide rotation. - NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; - - // Prevent the tile from being destroyed. - FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); - - // Do nothing other than hiding if instructed to do so. - if (RetreatingToHidingSpot) - { - NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; - NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; - - // Stop once the hiding spot has been reached. - if (InHidingSpot) - { - NPC.Center = SpotToHideIn; - NPC.velocity = Vector2.Zero; - RetreatingToHidingSpot = false; - NPC.netUpdate = true; - } - - return; - } - - // Don't do any snapping and such if the cooldown is active. - if (SnapCooldown > 0f) - { - SnapCooldown--; - if (SnapCooldown <= 0f) - NPC.netUpdate = true; - return; - } - - if (SnapTimer > 0f) - { - int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 10f; - float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); - NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; - - // Get closer to the target if one not peeking. - if (!PeekingOut && target != null) - CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); - - // Retreat if velocity is zero for some reason. - if (NPC.velocity == Vector2.Zero) - { - SnapTimer = 0f; - RetreatingToHidingSpot = true; - NPC.netUpdate = true; - return; - } - - SnapTimer++; - if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) - { - SnapTimer = 0f; - SnapCooldown = 35f; - PeekingOut = false; - RetreatingToHidingSpot = true; - } - - return; - } - - Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); - - // Pick a potential direction to snap out. - // This is important for attacking. - int snapDirectionTries = 0; - float targetSnapAngularThreshold = 0.48f; - while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) - { - snapDirectionTries++; - snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); - - if (snapDirectionTries >= 8) - return; - - // Try again if there's a defined target and it isn't in the line of sight of the current direction. - if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) - continue; - } - - // Snap out if a suitable target gets close. - // Otherwise, sometimes randomly peek out. - bool canSnapAtTarget = - target != null && - snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && - Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); - if (Main.rand.NextBool(30) && !canSnapAtTarget) - PeekingOut = true; - - if (PeekingOut || canSnapAtTarget) - { - if (canSnapAtTarget) - SoundEngine.PlaySound(SoundID.Item96, NPC.Center); - else - SoundEngine.PlaySound(SoundID.Item95, NPC.Center); - - // Add some randomness when peeking. - if (PeekingOut) - snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); - - NPC.velocity = snapDirection * 4f; - InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); - SnapTimer = 1f; - NPC.netUpdate = true; - } - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override void FindFrame(int frameHeight) - { - if (NPC.Calamity().newAI[1] == 1) - { - NPC.frameCounter++; - if (NPC.frameCounter > 3) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - } - else - { - NPC.frameCounter = 0; - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (InHidingSpot) - return false; - - Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D body1Texture = SandProwler.BodySprite1.Value; - Texture2D body2Texture = SandProwler.BodySprite2.Value; - Texture2D body3Texture = SandProwler.BodySprite3.Value; - Texture2D body4Texture = SandProwler.BodySprite4.Value; - - Vector2 idealDrawPosition = SpotToHideIn; - Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; - if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) - idealDrawPosition += backOffset; - - List bezierPoints = new List() - { - idealDrawPosition - }; - - // Calculate points to create segments at based on a catmull-rom spine. - float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); - for (int i = 0; i < 20; i++) - { - Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; - Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; - bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); - } - bezierPoints.Add(NPC.Center); - - // And then generalize them with a bezier curve. - BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); - int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); - totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); - - for (int i = 0; i < totalChains - 1; i++) - { - Texture2D textureToUse; - - - if (i % 2 == 0) - { - textureToUse = body3Texture; - } - else - { - textureToUse = body4Texture; - } - - switch (totalChains - i - 1) - { - case 1: - textureToUse = headTexture; - break; - case 2: - textureToUse = body1Texture; - break; - case 3: - textureToUse = body2Texture; - break; - } - - Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); - Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); - float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; - Rectangle frame = textureToUse.Frame(1, 1, 0, 0); - if (textureToUse == headTexture) - { - frame = NPC.frame; - } - Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); - spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); - } - return false; - } - protected override bool NPCSearchFilter(NPC n) - { - return Vector2.DistanceSquared(NPC.Center, n.Center) < 200f * 200f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return NPC.life < NPC.lifeMax * 0.99f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0 && !Main.dedServ) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); - } - } - public override void OnKill() - { - // Increase the kill count of Sand Prowlers for the Bestiary - if (NPC.GetWereThereAnyInteractions()) - { - NPC nPC = new NPC(); - nPC.SetDefaults(ModContent.NPCType()); - Main.BestiaryTracker.Kills.RegisterKill(nPC); - } - } - } -} diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs deleted file mode 100644 index a3875226c1..0000000000 --- a/NPCs/SunkenSea/Scavenger.cs +++ /dev/null @@ -1,999 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Enums; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Fishing.SunkenSeaCatches; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Placeables.FurnitureDriftwood; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Utilities; -using CalamityMod.Items.Placeables.Banners; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Scavenger : SunkenSeaNPC - { - public record ScavengerItem(int itemID, int minimum, int maximum, Func condition); - - public static Asset walkTexture; - - public static Asset inspectTexture; - - public static Asset giveTexture; - - public static Dictionary> ScavengerLoot = new Dictionary>() - { - { ItemID.WhitePearl, new WeightedRandom() }, - { ItemID.BlackPearl, new WeightedRandom() }, - { ItemID.PinkPearl, new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ItemID.GalaxyPearl, new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - }; - - public enum PhaseType - { - Idle = 0, - FoundItem = 1, - Bartering = 2, - Burrow = 3 - } - - // The in world index of the item the crab is going after - public int HeldItemIndex - { - get => (int)NPC.ai[1] - 1; - set => NPC.ai[1] = value + 1; - } - - // The type of currency the crab is currently holding - public int HeldItemType - { - get => (int)NPC.ai[2]; - set => NPC.ai[2] = value; - } - - // The crab's current behaviour - public ref float Phase => ref NPC.ai[0]; - - // Used during trading and as a cooldown - public ref float TradeTimer => ref NPC.ai[3]; - - public ref float WalkTimer => ref NPC.Calamity().newAI[0]; - - public ref float TurnTimer => ref NPC.Calamity().newAI[1]; - - public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; - - public ref float StackMin => ref NPC.localAI[0]; - - public ref float StackMax => ref NPC.localAI[1]; - - public ref float OldItemType => ref NPC.localAI[2]; - - public bool ShouldUseWalkingFrames => NPC.velocity.X != 0 && ((WalkOrStand == 1 && Phase == (int)PhaseType.Idle) || (Phase == (int)PhaseType.FoundItem)); - - public bool ShouldUseInspectionFrames => Phase == (int)PhaseType.Bartering && TradeTimer < 80; - - public bool ShouldUseGivingFrames => Phase == (int)PhaseType.Bartering && TradeTimer >= 80; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.TimelessShores; - - protected override List PreyIDs => new List - { - - }; - - protected override List PredatorIDs => new List - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[NPC.type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 7; - - InitializeScavengerLoot(); - - if (!Main.dedServ) - { - walkTexture = ModContent.Request(Texture + "Walking"); - inspectTexture = ModContent.Request(Texture + "Inspecting"); - giveTexture = ModContent.Request(Texture + "Giving"); - } - } - - #region Trades - - public static void InitializeScavengerLoot() - { - int white = ItemID.WhitePearl; - int black = ItemID.BlackPearl; - int pink = ItemID.PinkPearl; - int minBlock = 6; - int maxBlock = 17; - float coralBlockChance = 0.1f; - - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ItemID.WoodenCrate, 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(white, ItemID.WoodenCrateHard, 1, () => Main.hardMode, 0.1f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); - AddScavengerItem(white, ItemID.ScarabBomb, 3, 10, 0.1f); - AddScavengerItem(white, ItemID.Coral, 3, 10, 0.2f); - AddScavengerItem(white, ItemID.Starfish, 3, 10, 0.2f); - AddScavengerItem(white, ItemID.Seashell, 3, 10, 0.2f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - // Critters. Golds, Radiants, Pearlpods and any Basalt Gully/Timeless Shore critters are to be excluded - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - - AddScavengerItem(black, ModContent.ItemType(), 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.PirateMap, 1, () => Main.hardMode, 0.05f); - AddScavengerItem(black, ItemID.IronCrate, 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.IronCrateHard, 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.GoldenCrate, 1, () => !Main.hardMode, 0.02f); - AddScavengerItem(black, ItemID.GoldenCrateHard, 1, () => Main.hardMode, 0.02f); - AddScavengerItem(black, ItemID.WaterWalkingBoots, 1, 0.05f); - AddScavengerItem(black, ItemID.FishingBobber, 1, 0.05f); - AddScavengerItem(black, ItemID.JellyfishNecklace, 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - //AddScavengerItem(black, ItemID.Nachos, 1, 0.05f); insert food item - AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.FinWings, 1, () => Main.hardMode, 0.1f); - - AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); - AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); - - // Pearlpods can be used as a substitute for pearls - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[white]; - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[black]; - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; - - ScavengerLoot[ItemID.GalaxyPearl] = ScavengerLoot[white]; // Gives 1-2x the amount of white items - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; // Gives 2 pink items - - } - - #region Loot adding methods - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// The minimum amount to drop - /// The maximum amount to drop - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int min, int max, float weight = 1) - { - AddScavengerItem(currency, itemID, min, max, () => true, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// How much should drop - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int amount, float weight = 1) - { - AddScavengerItem(currency, itemID, amount, amount, () => true, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// How much should drop - /// A condition - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int amount, Func condition, float weight = 1) - { - AddScavengerItem(currency, itemID, amount, amount, condition, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// The minimum amount to drop - /// The maximum amount to drop - /// A condition - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int min, int max, Func condition, float weight = 1) - { - if (ScavengerLoot.ContainsKey(currency)) - { - ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); - } - else - { - ScavengerLoot.Add(currency, new WeightedRandom()); - ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); - } - } - #endregion - #endregion - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 20; - NPC.width = 48; - NPC.height = 48; - NPC.defense = 5; - NPC.lifeMax = 350; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 5); - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.15f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Scavenger") - }); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.Calamity().newAI[2] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.Calamity().newAI[2]); - } - - public override void AI() - { - // Check to make sure the target item still exists - if (HeldItemIndex > 0) - { - Item targetItem = Main.item[HeldItemIndex]; - // If the item doesn't exist, reset its held item - if (targetItem == null || !targetItem.active) - { - HeldItemIndex = -1; - } - } - - // Initialize its direction - if (NPC.direction == 0) - NPC.direction = Main.rand.NextBool() ? -1 : 1; - - switch (Phase) - { - // Do idle stuff, actual behavior not determined rn - case (int)PhaseType.Idle: - { - // Decide if it should walk or sit - float movementSpeed = CurrentPrey != null || CurrentPredator != null ? 2 : 1; - bool startMovement = false; - if (WalkTimer <= 0) - { - WalkTimer = Main.rand.Next(180, 340); - WalkOrStand = WalkOrStand <= 0 ? 1 : -1; - if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) - { - NPC.direction *= -1; - } - if (CurrentPrey != null) - { - NPC.direction = (int)(CurrentPrey.Center.X - NPC.Center.X); - } - startMovement = true; - } - bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); - bool waterCheck = WaterCheck(16); - // If it bumps into something, jump or turn around - if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && WalkOrStand == 1) || lookingAtPredator) - { - // Jump if there are a couple tiles and a space above - if (!waterCheck && JumpCheck() && NPC.velocity.Y == 0 && !lookingAtPredator) - { - NPC.velocity.Y -= 7; - NPC.velocity.X = movementSpeed * NPC.direction; - WalkOrStand = 1; - TurnTimer = 10; - } - // Turn around if it can't jump up or a pit/water is in the way - else - { - NPC.direction *= -1; - TurnTimer = 30; - } - } - // Move - if (!NPC.justHit) - { - if (WalkOrStand == 1) - NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); - else if (NPC.velocity.Y == 0) - NPC.velocity.X *= 0.95f; - } - else if (WalkOrStand == -1) - { - WalkTimer = 0; - if (CurrentPredator != null) - { - WalkOrStand = 1; - WalkTimer = Main.rand.Next(180, 340); - } - } - CalamityUtils.StepUpBlocks(NPC); - - // If the trade timer is 0 and the crab isn't looking ofr an item, look for an item - if (TradeTimer >= 0 && HeldItemIndex <= -1 && CurrentPredator == null) - { - float curDist = 0; - bool superRare = false; - foreach (Item i in Main.ActiveItems) - { - if (!i.active) - continue; - if (i.beingGrabbed) - continue; - float distance = i.Distance(NPC.Center); - if (distance > 460) - continue; - if (!NPC.HasSight(i.Center)) - continue; - if (Math.Abs(NPC.Center.Y - i.Center.Y) > 100) - continue; - - // Check if the item is a valid currency and is the closest possible currency - if (ScavengerLoot.ContainsKey(i.type)) - { - if (distance < curDist || curDist == 0) - { - HeldItemIndex = i.whoAmI; - superRare = i.type > ItemID.PinkPearl ? true : false; - } - curDist = distance; - } - } - // If an item was found, go after it - if (curDist != 0) - { - NPC.netUpdate = true; - Phase = (int)PhaseType.FoundItem; - TurnTimer = 0; - WalkTimer = 0; - if (NPC.velocity.Y == 0) - NPC.velocity.Y = -5; - NPC.direction = NPC.DirectionTo(Main.item[HeldItemIndex].Center).X.DirectionalSign(); - - SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.4f }, NPC.Center); - - EmoteExpressionParticle.EmoteType eType = superRare ? EmoteExpressionParticle.EmoteType.DoubleExclamation : EmoteExpressionParticle.EmoteType.Exclamation; - - var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.YellowGreen, - Main.rand.Next(30, 46), - eType); - GeneralParticleHandler.SpawnParticle(emote); - } - } - // Increment the trade timer back to zero if it is below zero - if (TradeTimer < 0) - TradeTimer++; - } - break; - // Go to the item - case (int)PhaseType.FoundItem: - { - // If the item is no longer valid, go back to idle behaviour - if (HeldItemIndex <= -1 || CurrentPredator != null) - { - NPC.netUpdate = true; - Phase = (int)PhaseType.Idle; - HeldItemIndex = -1; - TurnTimer = 0; - WalkTimer = 0; - return; - } - - // If the item is suddenly no longer valid for some reason, go back to idle behaviour - Item targetItem = Main.item[HeldItemIndex]; - if (!targetItem.active || !ScavengerLoot.ContainsKey(targetItem.type)) - { - NPC.netUpdate = true; - targetItem.noGrabDelay = 0; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - HeldItemIndex = -1; - NPC.velocity = Vector2.Zero; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - break; - } - - // Once the jump anim is done, go to the pearl - if (WalkTimer > 0) - { - float movementSpeed = 3; - bool waterCheck = WaterCheck(16); - // If it bumps into something, jump or turn around - if (TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && NPC.velocity.Y == 0) - { - // Jump if there are a couple tiles and a space above - if (!waterCheck && JumpCheck()) - { - NPC.velocity.Y -= 8; - NPC.velocity.X = movementSpeed * NPC.direction; - TurnTimer = 10; - } - // Turn around if it can't jump up or a pit/water is in the way - else - { - NPC.direction *= -1; - TurnTimer = 30; - NPC.netUpdate = true; - targetItem.noGrabDelay = 0; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - } - } - // Change direction if the item position changed - bool itemOnRight = targetItem.Center.X > NPC.Center.X; - if (itemOnRight && NPC.direction == -1) - { - NPC.direction *= -1; - } - else if (!itemOnRight && NPC.direction == 0) - { - NPC.direction *= -1; - } - TurnTimer--; - - NPC.velocity.X = NPC.direction * movementSpeed; - CalamityUtils.StepUpBlocks(NPC); - } - // While the jump animation is occurring, slow down horizontally - else - { - NPC.velocity.X *= 0.95f; - } - // Marks if the jump animation is finished - if (NPC.velocity.Y == 0) - { - WalkTimer++; - } - - // Pull the item if close enough - if (targetItem.Distance(NPC.Center) < 120) - { - targetItem.noGrabDelay = 100; - targetItem.velocity = targetItem.DirectionTo(NPC.Center) * 5; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - // Grab the item if close enough - if (targetItem.Distance(NPC.Center) < 10) - { - Phase = (int)PhaseType.Bartering; - // If the item's stack is 1, despawn the item. Otherwise decrement its stack by 1. - if (targetItem.stack == 1) - targetItem.active = false; - else - targetItem.stack--; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 1, 0f, 0f, 0, 0, 0); - } - // Set the crab's held item type - HeldItemType = targetItem.type; - TurnTimer = 0; - WalkTimer = 0; - NPC.netUpdate = true; - } - } - break; - // Ponder the held item then give a reward back - case (int)PhaseType.Bartering: - { - if (CurrentPredator != null) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Item.NewItem(NPC.GetSource_FromThis(), NPC.getRect(), HeldItemType); - } - - NPC.netUpdate = true; - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - OldItemType = 0; - StackMin = 0; - StackMax = 0; - - SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.3f }, NPC.Center); - - EmoteExpressionParticle.EmoteType eType = EmoteExpressionParticle.EmoteType.Exclamation; - - var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Red, - Main.rand.Next(30, 46), - eType); - GeneralParticleHandler.SpawnParticle(emote); - return; - } - NPC.velocity.X *= NPC.velocity.Y != 0 ? 0.96f : 0.9f; - TradeTimer++; - // Calculate the reward - if (TradeTimer == 132) - { - NPC.netUpdate = true; - OldItemType = HeldItemType; - HeldItemType = CalculateReward(out int min, out int max); - StackMin = min; - StackMax = max; - } - - // After some time, spit out a reward and go back to idle with a cooldown - if (TradeTimer > 160) - { - NPC.netUpdate = true; - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - // This timer increments during its idle phase so it's set to a negative value - // Once the value hits zero, the crab will be able to trade again - TradeTimer = -CalamityUtils.SecondsToFrames(8); - - // Spawn the reward - if (HeldItemType > 0) - { - float stackMult = 1; - int dropAmt = 1; - if (ContentSamples.ItemsByType[HeldItemType].maxStack > 1) - { - if (OldItemType == ModContent.ItemType()) - stackMult *= 2; - if (OldItemType == ItemID.GalaxyPearl) - stackMult *= Main.rand.NextFloat(1.2f, 2f); - } - else - { - if (OldItemType == ModContent.ItemType()) - dropAmt *= 2; - if (OldItemType == ItemID.GalaxyPearl) - dropAmt *= 2; - } - for (int i = 0; i < dropAmt; i++) - { - SpawnItem(HeldItemType, stackMult); - } - } - HeldItemType = 0; - OldItemType = 0; - StackMin = 0; - StackMax = 0; - } - } - break; - // Burrow away and despawn - case (int)PhaseType.Burrow: - { - NPC.velocity.X *= 0.95f; - if (NPC.velocity.Y == 0) - { - WalkTimer++; - GeneralParticleHandler.SpawnParticle(new Particles.StoneDebrisParticle(Main.rand.NextVector2FromRectangle(NPC.getRect() with { Y = (int)NPC.Center.Y }), new Vector2(Main.rand.NextFloat(-6, 6), Main.rand.NextFloat(-6, -2)), Lighting.GetColor(NPC.Bottom.ToTileCoordinates()), Main.rand.NextFloat(0.5f, 1.2f), 10)); - } - if (WalkTimer % 10 == 0) - { - SoundEngine.PlaySound(SoundID.Dig, NPC.Center); - } - int startFall = 40; - if (WalkTimer >= startFall) - { - NPC.alpha += 5; - if (NPC.alpha > 255) - { - NPC.active = false; - } - } - } - break; - } - - if ((Phase != (int)PhaseType.FoundItem && Phase != (int)PhaseType.Burrow) && WalkTimer > 0) - WalkTimer--; - - if (TurnTimer > 0) - TurnTimer--; - - NPC.spriteDirection = NPC.direction; - } - - public void SpawnItem(int ID, float stackMult = 1f) - { - int stack = 1; - if (NPC.localAI[0] != NPC.localAI[1]) - { - stack = Main.rand.Next((int)NPC.localAI[0], (int)NPC.localAI[1] + 1); - } - stack = (int)(stack * stackMult); - int i = Item.NewItem(NPC.GetSource_FromThis(), new Rectangle((int)NPC.Center.X + NPC.direction * 20, (int)NPC.Center.Y - 20, NPC.width, NPC.height), ID, Stack: stack, noBroadcast: false); - Main.item[i].velocity = new Vector2(NPC.direction * Main.rand.NextFloat(3.7f, 4.3f), -Main.rand.NextFloat(-1.2f, 0.8f)); - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i); - } - } - - // Checks if the horizontal position in front of it has water or is a pit so that the crab can avoid it - public bool WaterCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); - for (int i = 1; i < height; i++) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); - Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 1); - // If there's a tile, wegud - if (t.HasTile) - return false; - // If there's liquid or a pit, we not gud - if (t.LiquidAmount > 0 && !above.HasTile) - return true; - - } - return true; - } - - // Checks if the horizontal position in front of the crab can be jumped up - public bool JumpCheck() - { - Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); - bool canJump = false; - int add = NPC.direction == 1 ? 0 : -1; - int jumpHeight = 6; - for (int i = jumpHeight; i > 0; i--) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); - // If there are tiles obfuscating the jump position, return false - if (i > (jumpHeight - 2) && t.HasTile) - return false; - // If there is a tile to jump on, return true - if (t.HasTile) - { - canJump = true; - break; - } - } - return canJump; - } - - public int CalculateReward(out int min, out int max) - { - min = 0; - max = 0; - // Make sure the held item type is valid - if (ScavengerLoot.TryGetValue(HeldItemType, out WeightedRandom value)) - { - // If the held item has no roll value, immediately return - if (value == null) - return 0; - - int tries = 100; - for (int i = 0; i < tries; i++) - { - var v = value.Get(); - if (v.condition.Invoke()) - { - min = v.minimum; - max = v.maximum; - return v.itemID; - } - } - - return 0; - } - else - { - return 0; - } - } - - public static bool IsPassableTile(int x, int y) - { - return (!Main.tile[x, y].HasUnactuatedTile || - !Main.tileSolid[(int)Main.tile[x, y].TileType] || Main.tileSolidTop[(int)Main.tile[x, y].TileType]); - } - - public void StepUp() - { - Vector2 position = NPC.position; - position.X += NPC.velocity.X; - int x = (int)((position.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1)) * NPC.direction) / 16f); - int y = (int)((position.Y + (float)NPC.height - 1f) / 16f); - - if ((float)(x * 16) >= position.X + (float)NPC.width || (float)(x * 16 + 16) <= position.X) - return; - - bool nextTileValid = Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]; - bool aboveTileHalfBlock = Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile; - bool aboveTileHasRoom = Main.tile[x, y - 1].IsHalfBlock && IsPassableTile(x, y - 4); - bool aboveTileEmpty = !Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || aboveTileHasRoom; - bool tile3AbovePassable = !Main.tile[x - NPC.direction, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - NPC.direction, y - 3].TileType]; - - if ((nextTileValid || aboveTileHalfBlock) && aboveTileEmpty && IsPassableTile(x, y - 2) && IsPassableTile(x, y - 3) && tile3AbovePassable) - { - float npcBottom = (float)(y * 16); - if (Main.tile[x, y].IsHalfBlock) - { - npcBottom += 8f; - } - if (Main.tile[x, y - 1].IsHalfBlock) - { - npcBottom -= 8f; - } - if (npcBottom < position.Y + (float)NPC.height) - { - float percentageTileRisen = position.Y + (float)NPC.height - npcBottom; - if (percentageTileRisen <= 16.1f) - { - NPC.gfxOffY += NPC.position.Y + (float)NPC.height - npcBottom; - NPC.position.Y = npcBottom - (float)NPC.height; - if (percentageTileRisen < 9f) - { - NPC.stepSpeed = 1f; - } - else - { - NPC.stepSpeed = 2f; - } - } - } - } - } - - public override void FindFrame(int frameHeight) - { - float frameCount = Main.npcFrameCount[Type] - 1; - - if (ShouldUseWalkingFrames) - frameCount = 5; - else if (ShouldUseInspectionFrames) - frameCount = 23; - else if (ShouldUseGivingFrames) - frameCount = 12; - - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - - // Reset frame when transitioning to giving animation - if (NPC.frame.Y >= frameCount || (Phase == (int)PhaseType.Bartering && TradeTimer == 80)) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - - //fuck this - //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) - //{ - // return 0.05f; - //} - //return 0f; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (Phase != (int)PhaseType.Burrow) - { - WalkTimer = 0; - Phase = (int)PhaseType.Burrow; - foreach (NPC n in Main.ActiveNPCs) - { - if (n == NPC) - continue; - if (n.type != NPC.type) - continue; - if (n.Distance(NPC.Center) > 600) - continue; - Scavenger scav = n.ModNPC(); - scav.PlayerHurt(); - scav.WalkTimer += Main.rand.Next(-20, 10); - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "Scavenger", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - int frameCount = Main.npcFrameCount[Type]; - float extraPosOffset = 0; - if (ShouldUseWalkingFrames) - { - texture = walkTexture.Value; - frameCount = 6; - } - else if (ShouldUseInspectionFrames) - { - texture = inspectTexture.Value; - frameCount = 24; - extraPosOffset = 6; - } - else if (ShouldUseGivingFrames) - { - texture = giveTexture.Value; - frameCount = 13; - } - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / frameCount / 2); - Vector2 npcOffset = NPC.Center - screenPos + Vector2.UnitY * extraPosOffset; - npcOffset -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - int burrowHide = 0; - if (Phase == (int)PhaseType.Burrow) - { - float comp = Utils.GetLerpValue(40, 120, WalkTimer, true); - burrowHide = (int)MathHelper.Lerp(0, texture.Height / frameCount + 1, comp); - npcOffset.Y += MathHelper.Lerp(0, NPC.height, comp); - } - Rectangle frame = texture.Frame(1, frameCount, 0, NPC.frame.Y); - spriteBatch.Draw(texture, npcOffset, frame with { Height = frame.Height - burrowHide }, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - // my dreams devoured - // legacy code for visually holding an item - /*Texture2D item = TextureAssets.Item[HeldItemType].Value; - Vector2 itemOffset = new Vector2(NPC.direction == 1 ? 8 : -8, 20); - if (TradeTimer < 80) - spriteBatch.Draw(item, npcOffset + itemOffset, null, drawColor, 0, new Vector2(item.Width / 2, item.Height), 1f, spriteEffects, 0); - */ - return false; - } - } -} diff --git a/NPCs/SunkenSea/Scavenger.png b/NPCs/SunkenSea/Scavenger.png deleted file mode 100644 index 7e3f646f0d..0000000000 Binary files a/NPCs/SunkenSea/Scavenger.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerGiving.png b/NPCs/SunkenSea/ScavengerGiving.png deleted file mode 100644 index cd08777d65..0000000000 Binary files a/NPCs/SunkenSea/ScavengerGiving.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerInspecting.png b/NPCs/SunkenSea/ScavengerInspecting.png deleted file mode 100644 index 7db93e9712..0000000000 Binary files a/NPCs/SunkenSea/ScavengerInspecting.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerWalking.png b/NPCs/SunkenSea/ScavengerWalking.png deleted file mode 100644 index 229cc451c6..0000000000 Binary files a/NPCs/SunkenSea/ScavengerWalking.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index aa8b778d62..5d1d30a8af 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -1,63 +1,44 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class SeaFloaty : SunkenSeaNPC + public class SeaFloaty : ModNPC { private bool hasBeenHit = false; - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - SpriteDirection = -1 + SpriteDirection = 1 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); } public override void SetDefaults() { - base.SetDefaults(); NPC.npcSlots = 0.5f; NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; - NPC.width = 44; + NPC.damage = 5; + NPC.width = 72; NPC.height = 22; NPC.defense = 0; - NPC.lifeMax = 5; + NPC.lifeMax = 50; NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 0, 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -82,18 +63,17 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - NPC.TargetClosest(false); if (NPC.velocity.X > 0.25f) - { - NPC.spriteDirection = 1; - } - else if (NPC.velocity.X < 0.25f) { NPC.spriteDirection = -1; } + else if (NPC.velocity.X < 0.25f) + { + NPC.spriteDirection = 1; + } if (NPC.ai[0] == 0f) { - NPC.direction = -1; + NPC.direction = 1; NPC.ai[0] = 1f; } NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; @@ -107,27 +87,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.direction *= -1; NPC.netUpdate = true; } - // panic when it gets hit or the player is close enough to it - if ((NPC.justHit || CurrentPlayer != null || CurrentPredator != null) && !hasBeenHit) + + if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; NPC.noTileCollide = true; NPC.noGravity = true; - - SoundEngine.PlaySound(SoundID.NPCHit37 with { Pitch = 1 }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Yellow, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote); - } } NPC.chaseable = hasBeenHit; if (hasBeenHit) @@ -164,29 +129,18 @@ namespace CalamityMod.NPCs.SunkenSea } } } - protected override bool NPCSearchFilter(NPC n) - { - return NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 360f * 360f && PredatorIDs.Contains(n.type); - } - - protected override bool PlayerSearchFilter(Player p) - { - return NPC.HasSight(p.Center) && Vector2.DistanceSquared(NPC.Center, p.Center) < 360f * 360f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.3f : 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } @@ -205,8 +159,13 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore3").Type, 1f); + } } - CalamityUtils.SpawnGores(NPC, "SeaFloaty", 1); } } } diff --git a/NPCs/SunkenSea/SeaFloaty.png b/NPCs/SunkenSea/SeaFloaty.png index 1af90fa4cd..cb786ed41d 100644 Binary files a/NPCs/SunkenSea/SeaFloaty.png and b/NPCs/SunkenSea/SeaFloaty.png differ diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 7da60d1334..6f596ab8da 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -1,54 +1,32 @@ using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class SeaMinnow : SunkenSeaNPC + public class SeaMinnow : ModNPC { - public Entity avoidedEntity; - - public Vector2 randomPathPoint; - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 8; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; } public override void SetDefaults() { - base.SetDefaults(); - NPC.npcSlots = 0f; + NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.damage = 0; - NPC.width = 32; - NPC.height = 26; + NPC.width = 36; + NPC.height = 22; NPC.defense = 0; NPC.lifeMax = 5; NPC.aiStyle = -1; @@ -59,6 +37,7 @@ namespace CalamityMod.NPCs.SunkenSea BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -69,286 +48,117 @@ namespace CalamityMod.NPCs.SunkenSea }); } - public override void OnSpawn(IEntitySource source) - { - NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - } public override void AI() { - if (pathfinding == null) + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + bool shouldSwimAway = false; + if (NPC.direction == 0) { - pathfinding = new PathfindingManager(this); - Acceleration = 0.6f; - MaxSpeed = 5f; + NPC.TargetClosest(true); } - NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { - if (owner == null || !owner.active || (owner.type != ModContent.NPCType() && owner.type != ModContent.NPCType())) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) { - if (CurrentPredator == null) + shouldSwimAway = true; + } + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) + { + shouldSwimAway = false; + } + if (!shouldSwimAway) + { + if (NPC.collideX || NPC.velocity.X == 0f) { - CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); - NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; - NPC.noGravity = true; - bool shouldSwimAway = false; - if (NPC.direction == 0) + NPC.velocity.X = NPC.velocity.X * -3f; + NPC.direction *= -1; + NPC.netUpdate = true; + } + if (NPC.collideY) + { + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - NPC.TargetClosest(true); + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - NPC.TargetClosest(false); - if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && - (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + else if (NPC.velocity.Y < 0f) { - shouldSwimAway = true; - } - if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) - { - shouldSwimAway = false; - } - if (!shouldSwimAway) - { - if (NPC.collideX || NPC.velocity.X == 0f) - { - NPC.velocity.X = NPC.velocity.X * -3f; - NPC.direction *= -1; - NPC.netUpdate = true; - } - if (NPC.collideY) - { - NPC.netUpdate = true; - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; - NPC.directionY = -1; - NPC.ai[0] = -1f; - } - else if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y); - NPC.directionY = 1; - NPC.ai[0] = 1f; - } - } - } - if (shouldSwimAway) - { - NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; - NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; - if (NPC.velocity.X > 6f) - { - NPC.velocity.X = 6f; - } - if (NPC.velocity.X < -6f) - { - NPC.velocity.X = -6f; - } - if (NPC.velocity.Y > 6f) - { - NPC.velocity.Y = 6f; - } - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - NPC.direction *= -1; - } - else - { - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; - if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) - { - NPC.velocity.X = NPC.velocity.X * 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y = NPC.velocity.Y - 0.01f; - if ((double)NPC.velocity.Y < -0.3) - { - NPC.ai[0] = 1f; - } - } - else - { - NPC.velocity.Y = NPC.velocity.Y + 0.01f; - if ((double)NPC.velocity.Y > 0.3) - { - NPC.ai[0] = -1f; - } - } - } - int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; - int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; - if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) - { - if (Main.tile[npcTileX, npcTileY + 1].HasTile) - { - NPC.ai[0] = -1f; - } - else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { - NPC.ai[0] = -1f; - } - } - if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) - { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - else + } + if (shouldSwimAway) + { + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; + if (NPC.velocity.X > 6f) { - // Check who is the avoided entity specifically. - avoidedEntity = avoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - - if (avoidedEntity is not null) - { - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(avoidedEntity.Center) * 96).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(avoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, avoidedEntity.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, Main.rand.NextVector2Unit() * Main.rand.Next(300, 1000), SunkenSeaTileValidity)); - } + NPC.velocity.X = 6f; } + if (NPC.velocity.X < -6f) + { + NPC.velocity.X = -6f; + } + if (NPC.velocity.Y > 6f) + { + NPC.velocity.Y = 6f; + } + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + NPC.direction *= -1; } else { - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 200) - pathfinding.DoPathfinding(new(this, NPC.Center, owner.Center, SunkenSeaTileValidity)); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } else { - float passiveMvtFloat = 0.5f; - float range = 100f; - Vector2 fischPos = NPC.Center; - float xDist = owner.Center.X - fischPos.X; - float yDist = owner.Center.Y - fischPos.Y; - yDist += Main.rand.NextFloat(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - xDist += 30f * -(float)owner.direction; - Vector2 leaderVector = new Vector2(xDist, yDist); - float leaderDist = leaderVector.Length(); - float returnSpeed = 8f; - //If leader is close enough, resume normal - if (leaderDist < range && owner.velocity.Y == 0f && - NPC.Bottom.Y <= owner.Bottom.Y && - !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - } - - if (leaderDist < 50f) - { - if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) - { - NPC.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (leaderDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (leaderDist > 300f) - { - passiveMvtFloat = 1f; - } - leaderDist = returnSpeed / leaderDist; - leaderVector.X *= leaderDist; - leaderVector.Y *= leaderDist; - } - if (NPC.velocity.X < leaderVector.X) - { - NPC.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) - { - NPC.velocity.X += passiveMvtFloat; - } - } - if (NPC.velocity.X > leaderVector.X) - { - NPC.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) - { - NPC.velocity.X -= passiveMvtFloat; - } - } - if (NPC.velocity.Y < leaderVector.Y) - { - NPC.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) - { - NPC.velocity.Y += passiveMvtFloat * 2f; - } - } - if (NPC.velocity.Y > leaderVector.Y) - { - NPC.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) - { - NPC.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (NPC.velocity.X >= 0.25f) - { - NPC.direction = -1; - } - else if (NPC.velocity.X < -0.25f) - { - NPC.direction = 1; - } - NPC.spriteDirection = -NPC.direction; - } - float SAImovement = 0.2f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || (otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType())) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; + NPC.ai[0] = -1f; } } } - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; + int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; + if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) + { + if (Main.tile[npcTileX, npcTileY + 1].HasTile) + { + NPC.ai[0] = -1f; + } + else if (Main.tile[npcTileX, npcTileY + 2].HasTile) + { + NPC.ai[0] = -1f; + } + } + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + { + NPC.velocity.Y = NPC.velocity.Y * 0.95f; + } } else { @@ -365,11 +175,17 @@ namespace CalamityMod.NPCs.SunkenSea { NPC.velocity.Y = 10f; } + NPC.ai[0] = 1f; } - - if (NPC.type == ModContent.NPCType()) + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) { - NPC.ProduceGoldCritterDust(); + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + return; } } @@ -380,54 +196,27 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; return; } - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter += 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - CalamityUtils.SpawnGores(NPC, "SeaMinnow", 2); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - } - public class SeaMinnowGold : SeaMinnow - { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.catchItem = (short)ModContent.ItemType(); - NPC.rarity = 3; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/SunkenSea/SeaMinnow.png b/NPCs/SunkenSea/SeaMinnow.png index 4baf632a28..456d61faab 100644 Binary files a/NPCs/SunkenSea/SeaMinnow.png and b/NPCs/SunkenSea/SeaMinnow.png differ diff --git a/NPCs/SunkenSea/SeaMinnowGold.png b/NPCs/SunkenSea/SeaMinnowGold.png deleted file mode 100644 index f070775305..0000000000 Binary files a/NPCs/SunkenSea/SeaMinnowGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs new file mode 100644 index 0000000000..9b363aaab3 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -0,0 +1,360 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent1 : ModNPC + { + public const int maxLength = 9; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 50; //42 + NPC.height = 24; //32 + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + + public override void AI() + { + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + NPC.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = 0; + if (segment == 0 || segment == 1 || segment == 4 || segment == 5) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 2 || segment == 3 || segment == 6) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 7) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 8) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + + TailSpawned = true; + } + } + + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); + + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + NPC.active = false; + } + + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if (NPC.life > NPC.lifeMax * 0.99) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Texture2D[] bodyTextures = [ + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value + ]; + + // Reimplementation of CalamityUtils.DrawAnimatedBestiaryWorm but tweaked due to body texture logic + NPC.frame = texture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float rotationStrength = 0.3f; + int segmentSpacing = 22; + int animationSpeed = 2; + float range = 10; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + // Draw the body segments + for (int i = 6; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + // Body segment logic here genuinely sucks because of each texture being programmed as separate NPC types, this directly copies body spawning logic + Texture2D toUse = (i == 2 || i == 3) ? bodyTextures[1] : bodyTextures[0]; + spriteBatch.Draw(toUse, NPC.position + new Vector2(bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * range), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, toUse.Size() / 2, NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(texture, NPC.position + new Vector2(0f, MathF.Sin(wormTimer * animationSpeed) * range), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * rotationStrength, new Vector2(texture.Width * 0.5f, texture.Height), NPC.scale, SpriteEffects.None, 0f); + + return false; + } + + return true; + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png new file mode 100644 index 0000000000..0e144e18e2 Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent1.png differ diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs new file mode 100644 index 0000000000..4da1f8d931 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent2 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png new file mode 100644 index 0000000000..bdb5c315db Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent2.png differ diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs new file mode 100644 index 0000000000..aac96e6412 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent3 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png new file mode 100644 index 0000000000..3ca49fc95e Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent3.png differ diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs new file mode 100644 index 0000000000..5f215471e2 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent4 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 30; + NPC.width = 28; //42 + NPC.height = 24; //34 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png new file mode 100644 index 0000000000..5625d8cf2d Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent4.png differ diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs new file mode 100644 index 0000000000..6549cf604f --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent5 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 20; + NPC.width = 36; //42 + NPC.height = 30; //40 + NPC.defense = 30; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png new file mode 100644 index 0000000000..2772709ecb Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent5.png differ diff --git a/NPCs/SunkenSea/Searslug.cs b/NPCs/SunkenSea/Searslug.cs deleted file mode 100644 index e90e0ec8cd..0000000000 --- a/NPCs/SunkenSea/Searslug.cs +++ /dev/null @@ -1,195 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.DataStructures; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Particles; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Searslug : SunkenSeaNPC - { - public bool Skinwalker => NPC.Calamity()?.newAI[0] == 1; - public static Asset glowTexture; - - public override void Load() => glowTexture = ModContent.Request(Texture + "Glow"); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - protected override List PreyIDs => new(); - - protected override List PredatorIDs => new() - { - ModContent.NPCType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 7; - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 56; - NPC.height = 42; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 2; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 2; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Searslug") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // 1 in 10 chance to be a skinwalker - NPC.Calamity().newAI[0] = Main.rand.NextBool(10).ToInt(); - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; - NPC.TargetClosest(false); - Lighting.AddLight(NPC.Center, 1, 0, 0); - if (Skinwalker) - { - // Randomly stutter - if (Main.rand.NextBool(300) && NPC.velocity.Y == 0) - NPC.velocity.X *= 0.7f; - - // If the player gets close enough, burst out and KILL the host - if (NPC.HasPlayerTarget && NPC.Calamity().newAI[1] > 120) - { - Player p = Main.player[NPC.target]; - if (p != null && p.active && p.Distance(NPC.Center) < 120 && Collision.CanHitLine(NPC.Center, 1, 1, p.Center, 1, 1)) - { - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.8f, Volume = 0.6f }, NPC.Center); - SoundEngine.PlaySound(SoundID.NPCDeath1 with { Pitch = 0.4f }, NPC.Center); - for (int i = 0; i < 10; i++) - { - int size = 12; - Vector2 position = NPC.Center; - Vector2 velocity = Main.rand.NextVector2Circular(size, size); - SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.2f, 0.3f), Color.Orange, Main.rand.Next(5, 8), 1, 1.5f); - GeneralParticleHandler.SpawnParticle(energy); - Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(1f, 1.6f)); - dust.noGravity = true; - } - NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - NPC.HitEffect(); - NPC.active = false; - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - int frameGate = Skinwalker ? 8 : 6; - if (NPC.frameCounter > frameGate) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.2f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LavaMoss, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Searslug", 2); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY - (Vector2.UnitY * 10).RotatedBy(NPC.rotation); - float colorMult = 1f; - // Shake if a skinwalker - if (Skinwalker) - { - pos += Main.rand.NextVector2Unit() * Main.rand.NextFloat(-1f, 1f); - colorMult = 0.8f; - } - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - spriteBatch.Draw(glowTexture.Value, pos, NPC.frame, Color.White * colorMult, NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - return false; - } - - public override bool? CanBeCaughtBy(Item item, Player player) - { - return ItemID.Sets.LavaproofCatchingTool[item.type]; - } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - // Wear protection! - if (failed) - { - player.AddBuff(BuffID.OnFire, CalamityUtils.SecondsToFrames(5)); - } - } - } -} diff --git a/NPCs/SunkenSea/Searslug.png b/NPCs/SunkenSea/Searslug.png deleted file mode 100644 index 05aa97f86b..0000000000 Binary files a/NPCs/SunkenSea/Searslug.png and /dev/null differ diff --git a/NPCs/SunkenSea/SearslugGlow.png b/NPCs/SunkenSea/SearslugGlow.png deleted file mode 100644 index 76f3ef5dd1..0000000000 Binary files a/NPCs/SunkenSea/SearslugGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs deleted file mode 100644 index 08c54d3e58..0000000000 --- a/NPCs/SunkenSea/Sharkoon.cs +++ /dev/null @@ -1,602 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Sharkoon : SunkenSeaNPC - { - #region Fields & Properties - - #region Static Fields - - //public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 200; - public static int IdleMaxPathDistance = 400; - - public static int FleeTileAnticipationDistance = 64; - - public static int ExplosionDistance = 80; - public static int ExplosionRadius = 80; - public static int ExplosionCooldown = 600; - public static int RecoveringTime = 120; - - #endregion - - /// - /// The different types of animation this enemy can have. - /// - private enum AnimationState { Normal, Explosion, Shrunk } - - /// - /// The current animation being played right now. - /// - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - // In case an animation is being set constantly, - // so we don't have it reset to the first frame every time, - // it'll only reset the current frame when actually changing animations. - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - NPC.ai[1] = (float)value; - - switch (value) - { - case AnimationState.Normal: - ChangeAnimation(animationFrames: 7, timePerAnimationFrame: 7, loops: true); - break; - case AnimationState.Explosion: - ChangeAnimation(animationFrames: 16, timePerAnimationFrame: 8, loops: false); - break; - case AnimationState.Shrunk: - ChangeAnimation(animationFrames: 6, timePerAnimationFrame: 6, loops: true); - break; - } - } - } - - /// - /// The amount of frames that one column of sprites has.
- /// Defaults to 7 since that's the first column's amount of frames. - ///
- private int _animationFrames = 7; - - /// - /// The amount, in frames, that it takes to go to the next animation frame.
- /// Defaults to 7. - ///
- private int _timePerAnimationFrame = 7; - - /// - /// Whether or not the animation loops or not.
- /// Defaults to . - ///
- private bool _animationLoop = true; - - /// - /// The squish of this NPC while drawing. - /// - private Vector2 ScaleSquish = Vector2.One; - - private Entity _avoidedEntity; - - /// - /// A timer used to know when the NPC should recover after it explodes. - /// - private ref float RecoverTimer => ref NPC.ai[2]; - - /// - /// Whether or not the Sharkoon is capable of exploding. - /// - private bool CanExplode => Animation == AnimationState.Normal; - - /// - /// Whether or not the Sharkoon is currently exploding. - /// - private bool IsExploding => CurrentBehavior == ExplodingBehavior; - - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - if (value != _currentBehavior) - OnBehaviorChange(value); - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - - private Action _previousBehavior; - - private int HuntCooldown - { - get => (int)NPC.ai[3]; - set => NPC.ai[3] = value; - } - - #region SunkenSeaNPC Implementation - - protected override List PreyIDs => - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - ]; - - protected override List PredatorIDs => - [ - NPCType(), - // NPCType(), - NPCType(), - // NPCType, - ]; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - - #endregion - - #endregion - - #region SetDefaults - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 16; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - BannerItem = ItemType(); - - NPC.damage = 20; - NPC.lifeMax = 350; - NPC.defense = 5; - NPC.knockBackResist = 0.15f; - NPC.chaseable = false; - - NPC.width = 52; - NPC.height = 46; - NPC.noGravity = true; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(silver: 5); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - #endregion - - #region Behavior - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 6f; - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 6f; - } - CurrentBehavior?.Invoke(); - - // Leans the Sharkoon towards the direction it's going. - NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - - // When it has already exploded, a timer will start, which when finished it'll make the Sharkoon recover. - if (!CanExplode) - { - RecoverTimer++; - if (RecoverTimer > ExplosionCooldown) - CurrentBehavior = RecoveringBehavior; - } - - // When it gets outside of water, it'll try to gravitate downards towards the water. - if (!NPC.wet && !IsExploding && CurrentBehavior != OutsideWaterBehavior) - CurrentBehavior = OutsideWaterBehavior; - - - // Reset any squish that is done to the Sharkoon, and clamps its upper limit to prevent it from becoming too tall - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - } - - private void IdlingBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - - private void HuntingBehavior() - { - // If there's no more prey, go back to idling. - if (CurrentPrey is null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - bool huntReady = HuntCooldown == 0; - if (huntReady) - HuntCooldown = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - - HuntCooldown--; - } - - private void FleeingBehavior() - { - // Check who is the avoided entity specifically. - _avoidedEntity = _avoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - - // If the avoided entity is gone, go back to idling. - if (_avoidedEntity == null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(_avoidedEntity.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(_avoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, _avoidedEntity.Center); - _randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, _randomPathPoint, SunkenSeaTileValidity)); - } - - // If it's capable of exploding and the predator's within distance, kaboom. - if (CanExplode && NPC.DistanceSQ(_avoidedEntity.Center) < ExplosionDistance * ExplosionDistance && _avoidedEntity is NPC predator && PredatorIDs.Contains(predator.type)) - CurrentBehavior = ExplodingBehavior; - } - - private void ExplodingBehavior() - { - // Deaccelerate. - NPC.velocity *= 0.95f; - - // Produces light while exploding. - Lighting.AddLight(NPC.Center, Color.Orange.ToVector3() * Utils.GetLerpValue(NPC.height, NPC.height * 9, NPC.frame.Y, true)); - - // On the exact frame that the NPC explodes, it'll will, indeed, explode. - if (NPC.frame.Y == NPC.height * 9 && NPC.frameCounter == 0) - Kaboom(); - - // When the animation's finished, go back to being a normal fish. - if (NPC.frame.Y >= NPC.height * 16) - { - Animation = AnimationState.Shrunk; - CurrentBehavior = _previousBehavior; - } - } - - private void RecoveringBehavior() - { - if (RecoverTimer >= RecoveringTime) - { - Animation = AnimationState.Normal; - CurrentBehavior = _previousBehavior; - } - - // Deaccelerates to stay still. - NPC.velocity *= 0.95f; - - // VFX and sound effects go here, - // a dedicated server doesn't need to load these. - if (!Main.dedServ) - { - float fade = Utils.GetLerpValue(RecoveringTime, 0, RecoverTimer); - if (Main.rand.NextBool()) - { - Vector2 velOffset = RandomVelocity(50f, 20f, 70f, 0.04f); - velOffset *= Main.rand.NextFloat(15, 20) * fade; - Dust dust = Dust.NewDustPerfect(NPC.Center + velOffset * 2.5f, DustID.RainbowMk2, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.8f, 0.95f)); - dust.noGravity = true; - dust.color = Color.Aqua; - } - } - - RecoverTimer++; - } - - private void OutsideWaterBehavior() - { - if (NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - - private void OnBehaviorChange(Action newBehavior) - { - // Obviously, when it gets to the exploding behaivor, it should make the explosion animation. - if (newBehavior == ExplodingBehavior) - Animation = AnimationState.Explosion; - - // Resets the timer when it needs to use it again. - if (newBehavior == RecoveringBehavior || CurrentBehavior == RecoveringBehavior) - RecoverTimer = 0f; - - // When it gets outside of water, it'll try to gravitate downards towards the water. - if (newBehavior == OutsideWaterBehavior) - NPC.noGravity = false; - - MinimumPointDistance = newBehavior == HuntingBehavior ? 20f : 48f; - } - - protected override void OnPreyDetection(NPC prey) - { - // If it's not a small fish and it's not being chased by a predator, the Sharkoon may hunt. - if (CanExplode && CurrentPredator is null && !IsExploding) - { - CurrentBehavior = HuntingBehavior; - ScaleSquish.Y += 0.4f; - } - } - - protected override void OnPredatorDetection(NPC predator) - { - // If it detects a predator, time to run. - if (!IsExploding) - { - CurrentBehavior = FleeingBehavior; - _avoidedEntity = predator; - ScaleSquish.Y += 0.4f; - } - } - - protected override void OnPlayerDetection(Player player) - { - // When there's a predator, player's shouldn't matter. - if (CurrentPredator is not null && !IsExploding) - return; - - CurrentBehavior = FleeingBehavior; - _avoidedEntity = player; - ScaleSquish.Y += 0.4f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - if (CanExplode) - { - SpawnGores(NPC, "Sharkoon", 6); - } - else - { - SpawnGores(NPC, "SharkoonSmall", 2); - } - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - - public override void OnHitByNPC(NPC attacker) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - private void Kaboom() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile( - NPC.GetSource_FromThis(), - NPC.Center, - Vector2.Zero, - ProjectileType(), - NPC.damage * 10, - 10f, - ai0: NPC.whoAmI); - } - - AddScreenshakeAt(NPC.Center, 15f); - - // VFX and sound effects go here, - // a dedicated server doesn't need to load these. - if (!Main.dedServ) - { - for (int i = 0; i < 10; i++) - { - Dust dust = Dust.NewDustPerfect(NPC.Center, DustID.FireworksRGB, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); - dust.noGravity = false; - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; - } - for (int i = 0; i < 18; i++) - { - Dust dust = Dust.NewDustPerfect(NPC.Center, DustID.RainbowMk2, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); - dust.noGravity = true; - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; - } - for (int i = 0; i < 8; i++) - { - Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); - Particle smoke = new HeavySmokeParticle(NPC.Center + randVel, randVel, Color.Lerp(Color.SlateGray, Color.Black, Main.rand.NextFloat(0.2f, 0.45f)), Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); - GeneralParticleHandler.SpawnParticle(smoke); - } - SoundStyle boom = new("CalamityMod/Sounds/Custom/SharkoonBoom"); - SoundEngine.PlaySound(boom with { Volume = 0.7f, PitchVariance = 0.15f }, NPC.Center); - } - } - - public override void AwaitingPathBehavior() - { - if (CurrentBehavior == HuntingBehavior) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - } - return 0f; - } - - #endregion - - #region Drawing & Animation - - /// - /// A quick method to change all the animation's properties. - /// - private void ChangeAnimation(int animationFrames, int timePerAnimationFrame, bool loops) - { - _animationFrames = animationFrames; - _timePerAnimationFrame = timePerAnimationFrame; - _animationLoop = loops; - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > _timePerAnimationFrame) - { - NPC.frame.Y += frameHeight; - NPC.frame.Y = Math.Min(NPC.frame.Y, _animationFrames * frameHeight); - NPC.frameCounter = 0; - if (_animationLoop) - NPC.frame.Y = NPC.frame.Y % (_animationFrames * frameHeight); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 drawPosition = NPC.Center - screenPos; - Rectangle frame = texture.Frame(horizontalFrames: 3, verticalFrames: 16, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); - Vector2 anchorPoint = frame.Size() * 0.5f; - SpriteEffects flip = NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); - - return false; - } - - #endregion - - #region Sycning - - private Vector2 _randomPathPoint; - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(_randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - _randomPathPoint = reader.ReadVector2(); - } - - #endregion - } -} diff --git a/NPCs/SunkenSea/Sharkoon.png b/NPCs/SunkenSea/Sharkoon.png deleted file mode 100644 index 44b0698b16..0000000000 Binary files a/NPCs/SunkenSea/Sharkoon.png and /dev/null differ diff --git a/NPCs/SunkenSea/Shoreskipper.cs b/NPCs/SunkenSea/Shoreskipper.cs deleted file mode 100644 index 6a63d540ff..0000000000 --- a/NPCs/SunkenSea/Shoreskipper.cs +++ /dev/null @@ -1,466 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Critters; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Shoreskipper : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Roar = 1, - Jumps = 2, - } - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - public bool spawnedTackleHitbox = false; - public bool notLandedFromWater = false; // When in water or just got out of water but not yet landed on solid ground - public NPC Target; // Chosen target (can only be other shoreskippers) - - #region SunkenSea Fields - protected override List PreyIDs => - [ - NPCType(), - ]; - protected override List PredatorIDs => - [ - NPCType(), - ]; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.TimelessShores; - - protected override bool NPCSearchFilter(NPC n) - { - // Only consider same-type NPCs within 450 pixels - return n.active && n.type == Type && Vector2.DistanceSquared(NPC.Center, n.Center) < 450f * 450f; - } - protected override void OnPreyDetection(NPC prey) - { - if (prey.active && NPC.HasSight(prey.Center) && (Target == null || !Target.active)) - { - ChangePhase((int)PhaseType.Roar); - Target = prey; - } - } - #endregion - - - public override bool CanBeHitByNPC(NPC attacker) => true; - public override bool CanHitNPC(NPC target) => target.type == NPC.type; - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override bool? CanBeHitByItem(Player player, Item item) => true; - public override bool? CanBeHitByProjectile(Projectile projectile) => true; - - // If not a Shoreskipper tackle, nullify knockback - public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) - { - if (projectile.type != ProjectileType()) - projectile.knockBack = 0f; - } - public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) => modifiers.DisableKnockback(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.DisableKnockback(); - - #region Syncing - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.ai[0]); - writer.Write(NPC.ai[1]); - writer.Write(NPC.ai[2]); - writer.Write(NPC.ai[3]); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(spawnedTackleHitbox); - writer.Write(notLandedFromWater); - - int targetWhoAmI = Target == null || !Target.active ? -1 : Target.whoAmI; - writer.Write(targetWhoAmI); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.ai[0] = reader.ReadSingle(); - NPC.ai[1] = reader.ReadSingle(); - NPC.ai[2] = reader.ReadSingle(); - NPC.ai[3] = reader.ReadSingle(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - spawnedTackleHitbox = reader.ReadBoolean(); - notLandedFromWater = reader.ReadBoolean(); - - int targetWhoAmI = reader.ReadInt32(); - if (targetWhoAmI >= 0 && targetWhoAmI < Main.maxNPCs) - Target = Main.npc[targetWhoAmI]; - else - Target = null; - } - #endregion - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 7; - Main.npcCatchable[Type] = true; - } - - public override void SetDefaults() - { - NPC.aiStyle = -1; - NPC.damage = 15; - NPC.width = 64; - NPC.height = 32; - NPC.defense = 4; - NPC.lifeMax = 80; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath9; - NPC.GravityIgnoresLiquid = true; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.catchItem = (short)ModContent.ItemType(); - - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = false; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToWater = false; - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Shoreskipper") - }); - } - public override bool? CanFallThroughPlatforms() - { - // Fall to try to reach target - if (CurrentPhase == (int)PhaseType.Jumps && Target.Top.Y > NPC.Bottom.Y) - return true; - - return false; - } - - private bool HasActiveTackle() // Check for if their melee hitbox exists as to not spawn multiple at once - { - int tackleType = ProjectileType(); - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile proj = Main.projectile[i]; - if (proj.active && proj.type == tackleType && proj.ai[0] == NPC.whoAmI) - return true; - } - return false; - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; // Mark as out of water - NPC.TargetClosest(false); - - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - } - int frameHeight = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; - - - if (NPC.velocity.Y == 0 && NPC.oldVelocity.Y != 0f && notLandedFromWater && !NPC.wet) // Do not maintain velocity from skipping on water - { - NPC.velocity.X = 0f; - notLandedFromWater = false; - } - - if (notLandedFromWater && !NPC.wet && NPC.velocity.Length() > 6.5f && Timer % 4 == 0) // When skipping on water at high enough velocity, spawns trailing rings - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(NPC.Center, -NPC.velocity * 0.33f, Color.DeepSkyBlue * 0.65f, new Vector2(0.5f, 1f), NPC.rotation, 0.12f, 0.24f, 18)); - - - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - int frameDuration = 10; - int currentFrameIndex = (int)(NPC.frameCounter / frameDuration) % Main.npcFrameCount[Type]; - // If it's the third frame - bool isAllowedToMove = NPC.frame.Y / frameHeight == 2; - -                        // Move horizontally in short bursts -                        if (Timer >= 10 && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0 && isAllowedToMove) - { - NPC.ai[2] = 1; - NPC.velocity.X = Main.rand.NextFloat(1.75f, 2.5f) * Main.rand.NextBool().ToDirectionInt(); - if (Main.rand.NextBool(4)) - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperGrunt", 2) { Volume = 0.9f, PitchVariance = 0.15f }, NPC.Center); - } - - // Increment the timer before the slide ends - if (NPC.ai[2] == 1) - { - NPC.ai[3]++; - } - - // Slow down quickly after sliding - else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.835f; - NPC.ai[3]++; - } - - // Handle movement states - if (NPC.ai[3] > Main.rand.Next(20, 40)) - { - // If moving, enter slowdown - if (NPC.ai[2] == 1) - NPC.ai[2] = 2; - // If in slowdown, reset - else if (NPC.ai[2] == 2) - ChangePhase((int)PhaseType.Idle); - NPC.ai[3] = 0; - } - - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - break; - - // Based off of Leerslug's initial detection phase. - case (int)PhaseType.Roar: - { - int roar = 20; - int startAI = 35; - NPC.velocity.X *= 0.9f; - - // Roar in place with a lil jump - if (Timer == roar) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperSighting") { Volume = 0.85f, Pitch = -0.1f, PitchVariance = 0.1f }, NPC.Center); - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -2.5f; - } - } - - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - if (Timer <= startAI && Timer >= roar && Timer % 5 == 0) - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(NPC.Center + new Vector2((NPC.direction == 1 ? 28f : -28f), 0), Vector2.Zero, Color.Gray * 0.55f, new Vector2(1f, 1f), NPC.rotation, 0.05f, 0.6f, 16)); - - if (Timer > startAI) - ChangePhase((int)PhaseType.Jumps); - - if ((!Target.active || Target == null || (Target.Distance(NPC.Center) > 580 && !NPC.HasSight(Target.Center)) || Target.Distance(NPC.Center) > 700) && (NPC.velocity.Y == 0 || NPC.wet)) // If target it dead/out of range and if this shoreskipper isnt midair - { - NPC.velocity.X *= 0.33f; - Target = null; - ChangePhase((int)PhaseType.Idle); - } - } - break; - - case (int)PhaseType.Jumps: - { - // Hops toward the target - int jumpHeight = Target.Bottom.Y < NPC.Top.Y ? 6 : 4; - - // Reset hitbox status when grounded or right after exiting water - if (NPC.oldVelocity.Y != 0 && NPC.velocity.Y == 0 || (NPC.Calamity().newAI[1] == 1f)) - { - spawnedTackleHitbox = false; - NPC.velocity.X = 0; - } - - // Keep facing target while on the ground/water - if (NPC.velocity.Y == 0 || NPC.wet) - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - // Check if the shoreskipper landed - bool isGrounded = NPC.velocity.Y == 0; - - // Jump at the target on the 4th frame - bool isAtJumpFrame = NPC.frame.Y / frameHeight == 3; - - if ((!spawnedTackleHitbox && (isGrounded && isAtJumpFrame)) || (NPC.Calamity().newAI[1] == 1f && HasActiveTackle() == false)) // Latter set of conditions allows spawning a hitbox while skipping on water - { - if (isGrounded) - NPC.velocity.Y = -jumpHeight; - - // Face and chase after target - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - - // Spawn hitbox while jumping - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ProjectileType(), (int)(NPC.damage * Main.rand.NextFloat(0.7f, 1.4f)), Main.rand.Next(3, 7), Main.myPlayer, NPC.whoAmI); - if (Main.rand.NextBool()) - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperGrunt", 2) { Volume = 1f, PitchVariance = 0.15f }, NPC.Center); - - spawnedTackleHitbox = true; - } - } - - if ((!Target.active || Target == null || (Target.Distance(NPC.Center) > 580 && !NPC.HasSight(Target.Center)) || Target.Distance(NPC.Center) > 700) && (NPC.velocity.Y == 0 || NPC.wet)) // If target it dead/out of range and if this shoreskipper isnt midair - { - NPC.velocity.X = 0f; - Target = null; - ChangePhase((int)PhaseType.Idle); - } - } - break; - } - - NPC.StepUpBlocks(); - NPC.spriteDirection = NPC.direction; - - // In / on top of water - if (NPC.wet) - { - if (NPC.Calamity().newAI[0] == 0f || Timer % 120 == 0) - { - int newWaterDirection = NPC.direction; - if (Target != null && Target.active) - newWaterDirection = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - else if (Main.rand.NextBool(3)) - newWaterDirection *= -1; - - NPC.Calamity().newAI[0] = newWaterDirection; - NPC.Calamity().newAI[1] = 0f; - } - - NPC.direction = (int)NPC.Calamity().newAI[0]; - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - notLandedFromWater = true; - - float waterAcceleration = 2.75f; - // Accelerate up to the cap of 12 - if (Math.Abs(NPC.velocity.X) < 12f) - NPC.velocity.X += NPC.direction * waterAcceleration; - NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -12f, 12f); - } - - else - { - // Reset the water direction AI slot when the NPC leaves the water - NPC.Calamity().newAI[0] = 0f; - - if (NPC.Calamity().newAI[1] == 0f) // Just got out of water - { - NPC.Calamity().newAI[1] = 1f; // Will spawn a hitbox if aggroed - } - } - - Timer++; - } - - public void ChangePhase(int phaseNum, bool resetai2 = true, bool resetai3 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - if (resetai3) - NPC.ai[3] = 0; - NPC.netUpdate = true; - - // Reset anim progress - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (!spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water) - return SpawnCondition.Cavern.Chance * 0.6f; - else if (spawnInfo.Player.Calamity().ZoneTimelessShores && spawnInfo.Water) - return SpawnCondition.Cavern.Chance * 0.25f; - } - return 0f; - } - - #region FX + Drawing - public override void FindFrame(int frameHeight) - { - bool isMidAir = NPC.velocity.Y != 0 && !NPC.wet; - int currentFrameIndex = NPC.frame.Y / frameHeight; - - if (CurrentPhase == (int)PhaseType.Roar) - { - NPC.frame.Y = 0; - return; - } - - if (isMidAir && NPC.frame.Y >= frameHeight * 4) - { - NPC.frame.Y = frameHeight * 4; // Cannot progress from last airborne frame until grounded again - return; - } - - NPC.frameCounter++; - if (NPC.frameCounter > (CurrentPhase == (int)PhaseType.Jumps ? 5 : 8)) // Progress faster when in jump phase - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 6; k++) - { - GeneralParticleHandler.SpawnParticle(new GenericBubbleParticle(NPC.Center, new Vector2(Main.rand.NextFloat(3f, 7f) * hit.HitDirection, Main.rand.NextFloat(-5f, 5f)).RotatedByRandom(1), Main.rand.NextFloat(0.22f, 0.52f), NPC.rotation, Main.rand.Next(7, 11))); - } - - for (int k = 0; k < 6; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BloodWater, hit.HitDirection, -3f, 0, default, 0.8f); - } - SpawnGores(NPC, "Shoreskipper", 2); - } - - public override void OnKill() - { - for (int k = 0; k < 10; k++) - { - GeneralParticleHandler.SpawnParticle(new GenericBubbleParticle(NPC.Center, new Vector2(Main.rand.NextFloat(3.25f, 8.5f), Main.rand.NextFloat(-5f, 5f)).RotatedByRandom(MathHelper.TwoPi), Main.rand.NextFloat(0.26f, 0.62f), NPC.rotation, Main.rand.Next(8, 13))); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; - - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - #endregion - } -} diff --git a/NPCs/SunkenSea/Shoreskipper.png b/NPCs/SunkenSea/Shoreskipper.png deleted file mode 100644 index 2c0a735cd7..0000000000 Binary files a/NPCs/SunkenSea/Shoreskipper.png and /dev/null differ diff --git a/NPCs/SunkenSea/Slugbun.cs b/NPCs/SunkenSea/Slugbun.cs deleted file mode 100644 index 66c5f257ea..0000000000 --- a/NPCs/SunkenSea/Slugbun.cs +++ /dev/null @@ -1,256 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.DataStructures; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Slugbun : SunkenSeaNPC - { - public enum SlugSkin - { - Reef = 0, - Burrows = 1, - Polyp = 2, - Radiant = 3 - } - public ref float CurrentSkin => ref NPC.Calamity().newAI[2]; - - public static Asset burrowsTex; - public static Asset polypTex; - public static Asset radiantTex; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.PolypForest | SunkenSeaBiomeFlags.GleamingBurrows; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PreyIDs => new List(); - - public override void Load() - { - burrowsTex = ModContent.Request(Texture + "Gleaming"); - polypTex = ModContent.Request(Texture + "Polyp"); - radiantTex = ModContent.Request(Texture + "Radiant"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 4; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 38; - NPC.height = 28; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = false; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Slugbun") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Guppies released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - CurrentSkin = NPC.ai[1]; - return; - } - // Red/Green in reefs, Green/Blue elsewhere - if (Main.player[NPC.target].Calamity().ZoneGleamingBurrows) - { - CurrentSkin = (int)SlugSkin.Burrows; - } - else if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - { - CurrentSkin = (int)SlugSkin.Reef; - } - else - { - CurrentSkin = (int)SlugSkin.Polyp; - } - NPC.TargetClosest(); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - CurrentSkin = (int)SlugSkin.Radiant; - NPC.rarity = 3; - } - // Decide item.......................... - switch (CurrentSkin) - { - case (int)SlugSkin.Polyp: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Burrows: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Reef: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - } - - public override void AI() - { - Tile vine = CalamityUtils.ParanoidTileRetrieval((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - // Set newAI[0] to 1 if the Slug is inside of a vine - if (vine.TileType == ModContent.TileType() && !NPC.justHit) - { - NPC.Calamity().newAI[0] = 1; - } - // Otherwise reset eating-related variables - else - { - NPC.Calamity().newAI[1] = 0; - NPC.Calamity().newAI[0] = 0; - } - // Eating behavior - if (NPC.Calamity().newAI[0] == 1) - { - NPC.velocity.X *= 0.1f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - NPC.Calamity().newAI[1]++; - } - // After munching 10 times, the vine is broken and the Slugbun continues about its day - if (NPC.Calamity().newAI[1] == 10) - { - if (vine.TileType == ModContent.TileType()) - { - WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 8) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 3) - { - NPC.frame.Y = 0; - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (CurrentSkin == (int)SlugSkin.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantSlugbun"); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 1f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GreenBlood, hit.HitDirection, -1f, 0, default, 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - switch (CurrentSkin) - { - case (int)SlugSkin.Burrows: - tex = burrowsTex.Value; - break; - case (int)SlugSkin.Polyp: - tex = polypTex.Value; - break; - case (int)SlugSkin.Radiant: - tex = radiantTex.Value; - break; - } - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY - (Vector2.UnitY * 6).RotatedBy(NPC.rotation); - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Slugbun.png b/NPCs/SunkenSea/Slugbun.png deleted file mode 100644 index c0cedac24e..0000000000 Binary files a/NPCs/SunkenSea/Slugbun.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunGleaming.png b/NPCs/SunkenSea/SlugbunGleaming.png deleted file mode 100644 index 30eabd798a..0000000000 Binary files a/NPCs/SunkenSea/SlugbunGleaming.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunPolyp.png b/NPCs/SunkenSea/SlugbunPolyp.png deleted file mode 100644 index f66d3f3e55..0000000000 Binary files a/NPCs/SunkenSea/SlugbunPolyp.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunRadiant.png b/NPCs/SunkenSea/SlugbunRadiant.png deleted file mode 100644 index 3959bf1228..0000000000 Binary files a/NPCs/SunkenSea/SlugbunRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/Steampod.cs b/NPCs/SunkenSea/Steampod.cs deleted file mode 100644 index c5630ab79a..0000000000 --- a/NPCs/SunkenSea/Steampod.cs +++ /dev/null @@ -1,498 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; -using System; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Ranged; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Steampod : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Hunting = 1, - LaunchUpSide = 2 - } - - public static Asset glowTex; - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public ref float Jetting => ref NPC.ai[2]; - - public ref float WalkTimer => ref NPC.Calamity().newAI[0]; - - public ref float TurnTimer => ref NPC.Calamity().newAI[1]; - - public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - public override void Load() - { - glowTex = ModContent.Request(Texture + "Glow"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 17; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = -1; - NPC.damage = 40; - NPC.width = 44; - NPC.height = 44; - NPC.defense = 10; - NPC.lifeMax = 200; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToWater = true; - NPC.Calamity().VulnerableToCold = true; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Steampod") - }); - } - - public override void AI() - { - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - // Initialize its direction - if (NPC.direction == 0) - NPC.direction = Main.rand.NextBool() ? -1 : 1; - // Decide if it should walk or sit - float movementSpeed = CurrentPredator != null ? 2 : 1; - bool startMovement = false; - if (WalkTimer <= 0) - { - WalkTimer = Main.rand.Next(120, 270); - WalkOrStand = WalkOrStand <= 0 ? 1 : -1; - if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) - { - NPC.direction *= -1; - } - startMovement = true; - } - bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); - bool pitCheck = FallCheck(16); - // If it bumps into something, jump or turn around - if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || pitCheck) && WalkOrStand == 1) || lookingAtPredator) - { - // Jump if there are a couple tiles and a space above - if (!pitCheck && NPC.velocity.Y == 0 && !lookingAtPredator) - { - // Chance to do a jet - bool jet = Main.rand.NextBool(4) && Jetting == 0 && !NPC.lavaWet; - if (jet) - { - if (JumpCheck(16)) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.LaunchUpSide; - } - } - else if (JumpCheck(6)) - { - NPC.velocity.Y -= 7; - NPC.velocity.X = movementSpeed * NPC.direction; - WalkOrStand = 1; - TurnTimer = 10; - } - } - // Jet upwards if a pit is in the way - else if (Jetting == 0 && !NPC.lavaWet) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.LaunchUpSide; - } - } - // Attack - Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - if (target != null) - { - if (NPC.HasSight(target.Center) && Jetting == 0) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.Hunting; - } - } - - // Move - if (!NPC.justHit) - { - if (WalkOrStand == 1) - NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); - else if (NPC.velocity.Y == 0) - NPC.velocity.X *= 0.95f; - } - else if (WalkOrStand == -1) - { - WalkTimer = 0; - if (CurrentPredator != null) - { - WalkOrStand = 1; - WalkTimer = Main.rand.Next(180, 340); - } - } - // Bounce on lava - if (NPC.lavaWet) - { - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - } - CalamityUtils.StepUpBlocks(NPC); - } - break; - case (int)PhaseType.LaunchUpSide: - { - int jumpUp = 60; // When to jet up - int jetSide = jumpUp + 40; // When to jet sideways - int jetRate = NPC.lavaWet ? 1 : 2; // How often particles spawn - - // Reset if on ground or hit ceiling - if (NPC.velocity.Y == 0 && Jetting > 0 && Timer > 5) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - - // Increment timer while on the ground - if (NPC.velocity.Y == 0 && Jetting == 0) - { - NPC.velocity.X *= 0.95f; - Timer++; - } - - // Jump - if (Timer == jumpUp && Jetting == 0) - { - Jetting = 1; - NPC.velocity.Y = -12 * (NPC.lavaWet ? 1.5f : 1); - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - } - // Release particles - else if (Jetting == 1) - { - Timer++; - if (Timer > jumpUp) - { - NPC.velocity.Y += 0.01f; - if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - } - if (Timer == jetSide) - { - Timer = 0; - Jetting = 2; - } - } - // Jet sideways - else if (Jetting == 2) - { - NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - Timer++; - if (Timer == 1) - { - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - NPC.velocity.X = NPC.direction * 16; - NPC.velocity.Y = -2; - } - else if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - if (Timer > 1) - { - NPC.velocity.X += -NPC.direction * 0.01f; - } - // Failsafe if it gets trapped in jet mode - if (Timer > 300) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - } - } - break; - case (int)PhaseType.Hunting: - { - int jumpUp = 60; - int jetSide = jumpUp + 20; - int jetRate = 1; - - Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - - // If the target is gone, reset - if ((NPC.velocity.Y == 0 && Jetting > 0 && Timer > jetSide) || target == null) - { - NPC.velocity.Y = 0; - NPC.velocity.X = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - - // Jet towards the target - if (NPC.velocity.Y == 0 && Jetting == 0) - { - NPC.velocity.X *= 0.95f; - Timer++; - if (Timer == jumpUp && Jetting == 0) - { - Jetting = 1; - NPC.velocity = NPC.SafeDirectionTo(target.Center) * 20; - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - } - } - // Release particles - if (Jetting == 1) - { - Timer++; - if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - } - // Failsafe reset - if (Timer > 300) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - } - break; - } - - if (Jetting < 0) - Jetting++; - - if (WalkTimer > 0) - WalkTimer--; - - if (TurnTimer > 0) - TurnTimer--; - - NPC.spriteDirection = NPC.direction; - } - - // Checks if the horizontal position in front of it has lava or is a pit so that the pod can avoid it - public bool FallCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); - for (int i = 1; i < height; i++) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); - Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 2); - // If there's a tile, wegud - if (t.HasTile) - return false; - // If there's liquid or a pit, we not gud - if (t.LiquidAmount > 0 && above.LiquidAmount > 0) - return true; - - } - return true; - } - - // Checks if the horizontal position in front of the pod can be jumped up - public bool JumpCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); - bool canJump = false; - int add = NPC.direction == 1 ? 0 : -1; - int jumpHeight = height; - for (int i = jumpHeight; i > 0; i--) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); - // If there are tiles obfuscating the jump position, return false - if (i > (jumpHeight - 2) && t.HasTile) - return false; - // If there is a tile to jump on, return true - if (t.HasTile) - { - canJump = true; - break; - } - } - return canJump; - } - - public override void FindFrame(int frameHeight) - { - bool still = (CurrentPhase == (int)PhaseType.Idle && NPC.velocity.X == 0); - if (!still) - { - NPC.frameCounter++; - } - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - // Jet - if (Jetting > 0) - { - if (NPC.frame.Y >= 17 * frameHeight || NPC.frame.Y < 12 * frameHeight) - { - NPC.frame.Y = 12 * frameHeight; - } - } - // Curl up - else if (CurrentPhase != (int)PhaseType.Idle) - { - if (NPC.frame.Y > 11 * frameHeight) - { - NPC.frame.Y = 11 * frameHeight; - } - if (NPC.frame.Y < 7 * frameHeight) - { - NPC.frame.Y = 7 * frameHeight; - } - } - // Nothing - else if (still) - { - NPC.frame.Y = 7 * frameHeight; - } - // Walk - else - { - if (NPC.frame.Y >= 7 * frameHeight) - { - NPC.frame.Y = 0; - } - } - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPrey && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player n) - { - return base.PlayerSearchFilter(n) || n == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.5f; - } - return 0f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage <= 0) - return; - target.AddBuff(BuffID.OnFire, 120); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Lava, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Steampod", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - spriteBatch.Draw(tex, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - spriteBatch.Draw(glowTex.Value, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, Color.White, NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Steampod.png b/NPCs/SunkenSea/Steampod.png deleted file mode 100644 index dffa275d82..0000000000 Binary files a/NPCs/SunkenSea/Steampod.png and /dev/null differ diff --git a/NPCs/SunkenSea/SteampodGlow.png b/NPCs/SunkenSea/SteampodGlow.png deleted file mode 100644 index 58d243d0ea..0000000000 Binary files a/NPCs/SunkenSea/SteampodGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentry.cs b/NPCs/SunkenSea/StormlionSentry.cs deleted file mode 100644 index 8f26a13bc2..0000000000 --- a/NPCs/SunkenSea/StormlionSentry.cs +++ /dev/null @@ -1,335 +0,0 @@ -using System; -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class StormlionSentry : ModNPC - { - public ref float time => ref NPC.ai[0]; - public ref float attackTimer => ref NPC.ai[1]; - public ref float jitter => ref NPC.ai[2]; - public ref float jitterRate => ref NPC.localAI[0]; - public ref float headRot => ref NPC.localAI[1]; - public ref float attackFeedback => ref NPC.localAI[2]; - public bool canBeMoved => NPC.localAI[3] == 0; - public enum Mode - { - Idle, - Agressive, - Leaping, - Digging - } - public Mode AIState - { - get => (Mode)(int)NPC.ai[3]; - set => NPC.ai[3] = (int)value; - } - - public float fxFade = 1; - public float fxFadeInv => attackFeedback - 1; - public float targetRange = 830; - public int attackRate = 180; - public int digDir = 1; - public Vector2 headPosition; - public Vector2 attackPosition; - - public static Asset headTexture; - public static Asset mandibleTexture; - public static Asset bodyTexture; - - public override void Load() - { - headTexture = ModContent.Request(Texture + "Head"); - mandibleTexture = ModContent.Request(Texture + "Mandible"); - bodyTexture = ModContent.Request(Texture + "Body"); - } - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 20f }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.width = 50; - NPC.height = 108; - NPC.lifeMax = 60; - NPC.damage = 15; - NPC.defense = 3; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 1); - NPC.HitSound = Effects.StormlionEffects.Hit; - NPC.DeathSound = Effects.StormlionEffects.Killed; - NPC.noGravity = true; - NPC.noTileCollide = true; // Custom tile collision - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - AIState = Mode.Idle; - attackFeedback = 1; - headRot = -MathHelper.PiOver2; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange( - [ - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StormlionSentry") - ]); - } - - public override void AI() - { - NPC.TargetClosest(false); - Player target = Main.player[NPC.target]; - NPC.spriteDirection = NPC.direction; - - bool npcFullyInTiles = Collision.SolidCollision(NPC.Center - Vector2.UnitY * 13, 15, 15); - bool npcOnTiles = Collision.SolidCollision(NPC.Center + Vector2.UnitY * 10, 15, 15); - bool targetInRange = Utils.Distance(target.Center, NPC.Center) <= targetRange && Collision.CanHit(headPosition, 1, 1, target.Center, 1, 1); - - attackFeedback = MathHelper.Lerp(attackFeedback, 1, 0.025f); - fxFade = Utils.GetLerpValue(0, attackRate, attackTimer, true); - - if (!npcOnTiles) - { - if (NPC.velocity.Y < 0) - NPC.velocity.Y *= 0.97f; - if (NPC.velocity.Y < 20) - NPC.velocity.Y += 0.5f; - NPC.velocity.X *= 0.97f; - } - - if (!npcFullyInTiles && npcOnTiles && AIState != Mode.Digging) - { - NPC.localAI[3] = 5; - AIState = Mode.Digging; - } - if (AIState == Mode.Idle) - { - attackTimer = (int)MathHelper.Lerp(attackTimer, 0, 0.01f); - jitterRate = MathHelper.Lerp(jitterRate, 0.1f, 0.05f); - headRot = headRot.AngleLerp(-Vector2.UnitY.ToRotation(), 0.02f); - if (targetInRange && !canBeMoved) - AIState = Mode.Agressive; - - if (Main.rand.NextBool(15) && time % 60 == 0) - { - jitterRate = 4.7f; - SoundEngine.PlaySound((Main.rand.NextBool() ? Effects.StormlionEffects.Idle1 : Effects.StormlionEffects.Idle2) with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.2f, 0.1f) }, NPC.Center); - } - } - if (AIState == Mode.Agressive) - { - if (!targetInRange && attackTimer >= 0) - AIState = Mode.Idle; - - if (attackTimer >= 0) - { - jitterRate = MathHelper.Lerp(jitterRate, 1f + 3f * Utils.GetLerpValue(0, attackRate, attackTimer), 0.035f); - headRot = headRot.AngleLerp(NPC.Center.DirectionTo(target.Center).ToRotation(), 0.035f); - } - else - headRot = headRot.AngleLerp(NPC.Center.DirectionTo(target.Center).ToRotation(), 0.01f); - - if (attackTimer == attackRate) - { - SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, NPC.Center); - - Projectile.NewProjectile(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 12), ModContent.ProjectileType(), 15, 0f, Main.myPlayer); - for (int i = 0; i <= 12; i++) - { - float variance = Main.rand.NextFloat(-0.6f, 0.6f); - int dustStyle = Effects.StormlionEffects.EnergyDust; - Dust dust2 = Dust.NewDustPerfect(attackPosition, dustStyle); - dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); - dust2.velocity = (headRot.ToRotationVector2() * 15).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); - dust2.noGravity = true; - dust2.color = Effects.StormlionEffects.EnergyColor; - } - - attackFeedback = 2; - attackTimer = -60; - jitterRate = 0; - NPC.ForceNetUpdate(); - } - attackTimer++; - } - if (AIState == Mode.Digging) - { - if (time % 10 == 0) - { - NPC.velocity = Vector2.Zero; - headRot = MathHelper.ToRadians(4 * digDir) - MathHelper.PiOver2; - SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, NPC.Center); - NPC.Center += Vector2.UnitY * 2; - digDir *= -1; - } - if (npcFullyInTiles) - AIState = Mode.Idle; - } - - if (!canBeMoved) - NPC.velocity = Vector2.Zero; - - - bool dancing = false; // They will dance if a "music projectile" is on screen of if the player is using an instrument (except drums because that would be annoying to make work) - for (int x = 0; x < Main.maxProjectiles; x++) - { - if (Main.mouseLeft && (target.HeldItem.type == ItemID.Bell || target.HeldItem.type == ItemID.CarbonGuitar || target.HeldItem.type == ItemID.IvyGuitar || target.HeldItem.type == ItemID.Harp || target.HeldItem.type == ItemID.TheAxe)) - { - dancing = true; - } - Projectile projectile = Main.projectile[x]; - if (!dancing && projectile.active && (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ProjectileID.SparkleGuitar || projectile.type == ProjectileID.EighthNote || projectile.type == ProjectileID.QuarterNote || projectile.type == ProjectileID.TiedEighthNote)) - { - dancing = true; - } - } - - if (dancing) - { - float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 14.37f / MathHelper.Pi); - if (Main.zenithWorld) - { - if (time % 2 == 0) - { - SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 0.2f, Pitch = 0.4f * sine, MaxInstances = 30 }, NPC.Center); - Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 6), ModContent.ProjectileType(), 15 * target.statLifeMax2, 0f, Main.myPlayer); - proj.friendly = true; - proj.hostile = false; - } - fxFade = 1; - attackTimer = attackRate * 0.9f; - } - else - attackTimer = 0; - jitterRate = 1; - NPC.dontTakeDamage = true; - headRot = MathHelper.ToRadians(100 * sine) - MathHelper.PiOver2; - AIState = Mode.Idle; - } - else - NPC.dontTakeDamage = false; - - float orbSine = (float)Math.Sin(time * 0.575f / MathHelper.Pi) * Utils.GetLerpValue(attackRate * 1.1f, 0, attackTimer); - headPosition = NPC.Center - (Vector2.UnitY * 27).RotatedBy(NPC.rotation) + headRot.ToRotationVector2() * 12 + NPC.velocity; - attackPosition = headPosition + headRot.ToRotationVector2() * (25 + 8 * orbSine); - NPC.rotation = Utils.AngleLerp(0, headRot + MathHelper.PiOver2, 0.35f); - - - if (fxFade > 0) - { - Lighting.AddLight(attackPosition, Effects.StormlionEffects.EnergyColor.ToVector3() * 0.7f * fxFade); - } - - time++; - jitter += jitterRate; - } - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, Effects.StormlionEffects.FleshDust, hit.HitDirection, -1f, 0, Effects.StormlionEffects.FleshColor, Main.rand.NextFloat(0.7f, 1.1f)); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 35; k++) - { - bool type = !Main.rand.NextBool(3); - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, type ? Effects.StormlionEffects.EnergyDust : Effects.StormlionEffects.FleshDust, hit.HitDirection, -1f, 0, type ? Effects.StormlionEffects.EnergyColor : Effects.StormlionEffects.FleshColor, Main.rand.NextFloat(0.7f, 1.1f)); - } - CalamityUtils.SpawnGores(NPC, "StormlionSentry", 3); - } - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return false; - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - Vector2 spawnPosition = new Vector2(spawnInfo.SpawnTileX * 16 + 8, spawnInfo.SpawnTileY * 16); - bool npcOnTiles = Collision.SolidCollision(spawnPosition + Vector2.UnitY * 50, 20, 20); - - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && npcOnTiles) - { - return SpawnCondition.Cavern.Chance * 8f; - } - return 0f; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType()); - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - if (NPC.IsABestiaryIconDummy) - { - spriteBatch.Draw(tex, NPC.Center - screenPos, null, drawColor, NPC.rotation, tex.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - return false; - } - if (time == 0) - return false; - - Texture2D body = bodyTexture.Value; - Texture2D head = headTexture.Value; - Texture2D mandible = mandibleTexture.Value; - Texture2D attack = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - - spriteBatch.Draw(body, NPC.Center - screenPos, null, drawColor, NPC.rotation, body.Size() / 2f, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(head, headPosition - screenPos, null, drawColor, headRot + MathHelper.PiOver2, head.Size() / 2f, NPC.scale, SpriteEffects.None, 0f); - for (int i = -1; i <= 1; i += 2) - { - float sine = (float)Math.Sin(jitter * 0.575f / MathHelper.Pi) * Utils.GetLerpValue(4.8f, 0, jitterRate); - Vector2 madiblePos = headPosition + (Vector2.UnitX * 10 * i).RotatedBy(headRot + MathHelper.PiOver2); - Vector2 madibleOrigin = (new Vector2(i == 1 ? 0 : mandible.Width, mandible.Height)); - float mandibleRot = MathHelper.ToRadians(5 * i) + MathHelper.Lerp(MathHelper.ToRadians(20) * sine * i, MathHelper.ToRadians(50) * i * fxFadeInv, fxFadeInv); - spriteBatch.Draw(mandible, madiblePos - screenPos, null, drawColor, headRot + mandibleRot + MathHelper.PiOver2, madibleOrigin, NPC.scale, i == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - } - - if (attackTimer > 0) - { - float fade = (float)Math.Pow(fxFade, 2); - for (int i = 0; i < 3; i++) - spriteBatch.Draw(attack, attackPosition - screenPos, null, Color.Lerp(Effects.StormlionEffects.EnergyColor, Color.White, i * 0.3f) with { A = 0 } * fade, headRot, attack.Size() / 2f, (NPC.scale * 0.3f - (i * 0.08f)) * fade * Main.rand.NextFloat(0.8f, 1.1f), SpriteEffects.None, 0f); - } - return false; - } - } -} diff --git a/NPCs/SunkenSea/StormlionSentry.png b/NPCs/SunkenSea/StormlionSentry.png deleted file mode 100644 index 8e5990842a..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentry.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentryBody.png b/NPCs/SunkenSea/StormlionSentryBody.png deleted file mode 100644 index 0e8b945f4d..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentryBody.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentryHead.png b/NPCs/SunkenSea/StormlionSentryHead.png deleted file mode 100644 index eefe88b4e4..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentryHead.png and /dev/null differ diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index 79991669b4..60766f4dec 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.SunkenSea ///
/// The NPC to evaluate. /// if the NPC is a valid target; otherwise, . - protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)) && !(n.type == ModContent.NPCType() && n.alpha > 0); + protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); /// /// Updates the current targets of this creature, including prey, predators, and players, based on detection logic. diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 01165da0e4..7712d363c3 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -876,27 +876,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas rumbleSound.Stop(); canDespawn = true; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == bulletHellblast || - projectile.type == barrage || - projectile.type == wave) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == fireblast || projectile.type == gigablast) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 15) - projectile.timeLeft = 15; - } - } - } + DespawnProjectiles(); NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0f, 0.065f); NPC.velocity = Vector2.Lerp(Vector2.UnitY * -4f, Vector2.Zero, (float)Math.Sin(MathHelper.Pi * NPC.Opacity)); @@ -1805,83 +1785,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.noTileCollide = false; NPC.noGravity = false; NPC.damage = 0; - - /* - // Teleport back to the arena on defeat - if (giveUpCounter == GiveUpCounterMax) - { - Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, permafrost ? Color.Cyan : Color.Red); - NPC.Center = initialRitualPosition + new Vector2(0, -30); - NPC.noTileCollide = false; - NPC.noGravity = false; - NPC.damage = 0; - SoundEngine.PlaySound(GiveUpSound with { Volume = 1.7f }, NPC.Center); - } - if (giveUpCounter == 1010) - { - Particle pulse2 = new StaticPulseRing(NPC.Center, Vector2.Zero, Color.Red * 0.55f, new Vector2(1f, 1f), 0f, 5f, 0f, 47); - GeneralParticleHandler.SpawnParticle(pulse2); - } - - if (shieldOpacity > 0f) - shieldOpacity = 0; - if (giveUpCounter > 1000) - forcefieldScale = MathHelper.Lerp(forcefieldScale, 1.55f, 0.045f); - else if (giveUpCounter > 960) - forcefieldScale = MathHelper.Lerp(forcefieldScale, 0.4f, 0.085f); - - if (giveUpCounter > 960) - { - for (int i = 0; i < 2; i++) - { - Vector2 sparkVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * (8 * forcefieldScale), sparkVel * Utils.GetLerpValue(1200, 960, giveUpCounter, true), false, 60, Main.rand.NextFloat(0.7f, 1.7f) * Utils.GetLerpValue(1200, 960, giveUpCounter), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); - GeneralParticleHandler.SpawnParticle(orb); - } - - float vibrate = 15 * Utils.GetLerpValue(1200, 960, giveUpCounter, true); - NPC.Center = (initialRitualPosition + new Vector2(0, -30)) + Main.rand.NextVector2Circular(vibrate, vibrate); - } - else - { - if (giveUpCounter == 960) - { - NPC.Center = initialRitualPosition + new Vector2(0, -30); - - Vector2 BurstFXDirection = new Vector2(0, 15); - for (int i = 0; i < 4; i++) - { - SparkParticle spark = new SparkParticle(NPC.Center, (BurstFXDirection) * (i + 1), false, 11, (5f - i * 0.6f) * 3, Color.Lerp(Color.Red, Color.Magenta, Utils.GetLerpValue(-3, 3, i)) * 0.8f); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int i = 0; i < 4; i++) - { - SparkParticle spark = new SparkParticle(NPC.Center, (-BurstFXDirection) * (i + 1), false, 11, (5f - i * 0.6f) * 3, Color.Lerp(Color.Red, Color.Magenta, Utils.GetLerpValue(-3, 3, i)) * 0.8f); - GeneralParticleHandler.SpawnParticle(spark); - } - - Particle orb = new CustomPulse(NPC.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.2f, 1.1f, 13); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(NPC.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Magenta, 0.5f), "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1f, 0.9f, 13); - GeneralParticleHandler.SpawnParticle(orb2); - for (int i = 0; i < 4; i++) - { - Particle orb3 = new CustomPulse(NPC.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.9f, 0.8f, 13); - GeneralParticleHandler.SpawnParticle(orb3); - } - - for (int i = 0; i < 30; i++) - { - GlowOrbParticle burst = new GlowOrbParticle(NPC.Center, (new Vector2(30, 30).RotatedByRandom(100) + new Vector2(0, -2)) * Main.rand.NextFloat(0.1f, 1.2f), true, 120, Main.rand.NextFloat(1.7f, 2.7f), Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); - GeneralParticleHandler.SpawnParticle(burst); - } - - NPC.velocity = new Vector2(18 * NPC.spriteDirection, -12); - giveUpCounter = GiveUpCounterMax; - hasDoneDeathAnim = true; - } - } - */ } else { @@ -1960,32 +1863,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!gettingTired5 && IsAtHp_Acceptance) { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 90) - projectile.timeLeft = 90; - } - if (projectile.type == bulletHellblast || - projectile.type == barrage || - projectile.type == wave) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == fireblast || projectile.type == gigablast) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 15) - projectile.timeLeft = 15; - } - } - } + DespawnProjectiles(true); if (!BossRushEvent.BossRushActive) { @@ -2066,6 +1944,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas castFire.noGravity = true; } + DespawnProjectiles(); SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal, player.Center); gettingTired = true; return; @@ -2075,27 +1954,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region DespawnProjectiles if (bulletHellCounter2 % BulletHellDuration == 0 && despawnProj) { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == bulletHellblast || - projectile.type == barrage || - projectile.type == wave) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == fireblast || projectile.type == gigablast) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 15) - projectile.timeLeft = 15; - } - } - } + DespawnProjectiles(); despawnProj = false; } #endregion @@ -3263,6 +3122,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas #endregion } + private static void DespawnProjectiles(bool despawnMaelstrom = false) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (despawnMaelstrom && p.type == ModContent.ProjectileType()) + { + if (p.timeLeft > 90) + p.timeLeft = 90; + } + if (p.type == ModContent.ProjectileType() || p.type == ModContent.ProjectileType() || p.type == ModContent.ProjectileType()) + { + if (p.timeLeft > 60) + p.timeLeft = 60; + } + else if (p.type == ModContent.ProjectileType() || p.type == ModContent.ProjectileType()) + { + p.ai[2] = 1f; + + if (p.timeLeft > 15) + p.timeLeft = 15; + } + } + } + public void DoHeartsSpawningCastAnimation(Player target, bool death) { int tempSpawnY = spawnY; diff --git a/NPCs/TownNPCs/Archmage.cs b/NPCs/TownNPCs/Archmage.cs index e5f9ec3ef8..0da74ecf49 100644 --- a/NPCs/TownNPCs/Archmage.cs +++ b/NPCs/TownNPCs/Archmage.cs @@ -167,7 +167,6 @@ namespace CalamityMod.NPCs.TownNPCs .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) .Add() .Add(ItemID.SuperManaPotion) - .Add() .Add() .Add() .Add(Condition.PlayerCarriesItem(ModContent.ItemType())) diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index 6a9ade6571..001595d331 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -121,6 +121,7 @@ namespace CalamityMod.NPCs.TownNPCs "Ariallis", // <@!518231218806980609> (ariallis) "Shade", // <@!613133259563466755> (shade__storm) "Orion", // <@!119164557657636865> (canacx) + "Yuhru", // <@!194276252452913154> (yuhru_) // Original names this.GetLocalizedValue("Name.Laura"), @@ -306,7 +307,6 @@ namespace CalamityMod.NPCs.TownNPCs NPCShop shop = new(Type); shop.Add() .Add() - .Add() .Add() .Add(ItemID.TigerClimbingGear) .Add(Condition.DownedPirates) @@ -314,7 +314,7 @@ namespace CalamityMod.NPCs.TownNPCs .Add(CalamityConditions.DownedCalamitasClone) .Add(Condition.DownedPlantera) .Add(Condition.DownedPlantera) - .Add(Condition.DownedPlantera, Condition.NpcIsPresent(NPCID.Nurse)) + .Add(Condition.NpcIsPresent(NPCID.Nurse)) .Add(Condition.DownedGolem) .Add(Condition.DownedMoonLord) .Add(CalamityConditions.DownedDevourerOfGods) diff --git a/NPCs/TownNPCs/ShadySalesman.cs b/NPCs/TownNPCs/ShadySalesman.cs new file mode 100644 index 0000000000..f98a2eb3ea --- /dev/null +++ b/NPCs/TownNPCs/ShadySalesman.cs @@ -0,0 +1,778 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Systems.Collections; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.ChatTags; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Fishing; +using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.SummonItems.TownPets; +using CalamityMod.Items.Tools; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Terraria.Audio; +using Terraria.Chat; +using Terraria.GameContent.Bestiary; +using Terraria.UI.Chat; +using Terraria.Utilities; +using CalamityMod.Items.Weapons.Magic; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class ShadySalesman : ModNPC + { + public bool hasFiredShotThisAttack = false; + public int attackFrameTimer = 0; + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 10; + NPCID.Sets.AttackFrameCount[Type] = 1; + NPCID.Sets.DangerDetectRange[Type] = 700; + NPCID.Sets.AttackType[Type] = 1; + NPCID.Sets.AttackTime[Type] = 30; + NPCID.Sets.AttackAverageChance[Type] = 10; + NPCID.Sets.HatOffsetY[Type] = 18; + + NPCID.Sets.ShimmerTownTransform[Type] = false; + NPCID.Sets.NoTownNPCHappiness[Type] = true; + NPCID.Sets.IsTownChild[Type] = true; + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + ContentSamples.NpcBestiaryRarityStars[Type] = 3; //Same as the Traveling Merchant + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + } + + public override void SetDefaults() + { + NPC.townNPC = true; + NPC.friendly = true; + NPC.lavaImmune = false; + NPC.width = 48; + NPC.height = 64; + NPC.aiStyle = NPCAIStyleID.Passive; + NPC.damage = 10; + NPC.defense = 15; + NPC.lifeMax = 250; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.99f; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.housingCategory = 1; // Prevent the Salesman from being instantly evicted when housed with existing Town NPCs as Town Piggy + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ShadySalesman") + }); + } + + public override List SetNPCNameList() => ModContent.GetInstance().SetNPCNameList(); + + public override void PartyHatPosition(ref Vector2 position, ref SpriteEffects spriteEffects) => position.X -= 4f * NPC.direction; + + public override void SendExtraAI(System.IO.BinaryWriter writer) + { + writer.Write(hasFiredShotThisAttack); + writer.Write(attackFrameTimer); + } + public override void ReceiveExtraAI(System.IO.BinaryReader reader) + { + hasFiredShotThisAttack = reader.ReadBoolean(); + attackFrameTimer = reader.ReadInt32(); + } + + public override bool PreAI() + { + if (Main.dayTime && !IsNpcOnscreen(NPC.Center)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (CalamityWorld.unlockedTownPig) + { + int oldHomeTileX = -1; + int oldHomeTileY = -1; + if (NPC.homeTileX != -1 && NPC.homeTileY != -1 && !NPC.homeless) + { + oldHomeTileX = NPC.homeTileX; + oldHomeTileY = NPC.homeTileY; + } + + string name = NPC.GivenName; + NPC.Transform(ModContent.NPCType()); + NPC.GivenName = name; + // Transform will force all these back to their unset values, so we need to set them back + if (oldHomeTileX != -1 && oldHomeTileY != -1) + { + NPC.homeTileX = oldHomeTileX; + NPC.homeTileY = oldHomeTileY; + NPC.homeless = false; + } + } + else + { + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue("LegacyMisc.35", NPC.FullName), 50, 125, 255); + else + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("LegacyMisc.35", NPC.GetFullNetName()), new Color(50, 125, 255)); + NPC.active = false; + NPC.netSkip = -1; + } + return false; + } + } + if (!CalamityWorld.unlockedTownPig) + NPC.UpdateHomeTileState(false, -1, -1); + return true; + } + + public override void AI() + { + if (NPC.ai[0] == 12f) // Attacking + { + attackFrameTimer++; + + if (attackFrameTimer >= 3 && !hasFiredShotThisAttack) + { + if (Main.netMode != NetmodeID.Server) + { + Texture2D gunTex = TextureAssets.Item[ModContent.ItemType()].Value; + int holdoutOffset = -21; + + Vector2 gunDrawPos = NPC.Center + new Vector2(0f, 8f); + float rotation = NPC.ai[2] * ((float)Math.PI / 2f) * NPC.spriteDirection; + + Vector2 origin = NPC.spriteDirection == -1 ? new Vector2(gunTex.Width + holdoutOffset, gunTex.Height / 2f) : new Vector2(-holdoutOffset, gunTex.Height / 2f); + Vector2 muzzleLocal = NPC.spriteDirection == -1 ? new Vector2(0f, 6f) : new Vector2(gunTex.Width, 6f); + Vector2 muzzlePos = gunDrawPos + (muzzleLocal - origin).RotatedBy(rotation); + Vector2 barrelDirection = new Vector2(NPC.spriteDirection, 0f).RotatedBy(rotation); + + Particle bloom = new CustomSpark(muzzlePos, Vector2.Zero, "CalamityMod/Particles/BrightFlash", false, 5, 0.18f, Color.Khaki, Vector2.One, true, true, glowOpacity: 0.45f, colorFadeSpeed: 8); + GeneralParticleHandler.SpawnParticle(bloom, true); + + for (int i = 0; i < 8; i++) + { + Vector2 vel = barrelDirection.RotatedByRandom(0.18f) * Main.rand.NextFloat(3f, 7f); + Particle spark = new CustomSpark(muzzlePos, vel, "CalamityMod/Particles/FadeLine", false, Main.rand.Next(10, 18), 0.18f, new Color(255, 230, 140), new Vector2(0.5f, 1f), true, shrinkSpeed: 0.4f, colorFadeSpeed: 10); + GeneralParticleHandler.SpawnParticle(spark, true); + } + SoundEngine.PlaySound(ElephantKiller.Shot with { Volume = 0.9f, PitchVariance = 0.15f, MaxInstances = 3 }, NPC.Center); + } + hasFiredShotThisAttack = true; + NPC.netUpdate = true; + } + } + else + { + if (hasFiredShotThisAttack) + { + hasFiredShotThisAttack = false; + NPC.netUpdate = true; // Syncs state exit + } + attackFrameTimer = 0; + } + } + + private static bool IsNpcOnscreen(Vector2 center) + { + int w = NPC.sWidth + NPC.safeRangeX * 2; + int h = NPC.sHeight + NPC.safeRangeY * 2; + Rectangle npcScreenRect = new Rectangle((int)center.X - w / 2, (int)center.Y - h / 2, w, h); + foreach (Player player in Main.ActivePlayers) + if (player.getRect().Intersects(npcScreenRect)) + return true; + return false; + } + + public override string GetChat() + { + int piggyIndex = NPC.FindFirstNPC(ModContent.NPCType()); + + WeightedRandom dialogue = new WeightedRandom(); + + dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal5")); + dialogue.Add(this.GetLocalizedValue("Chat.Normal6")); + + if (piggyIndex != -1) + { + dialogue.Add(this.GetLocalizedValue("Chat.TownPigPresent1")); + dialogue.Add(this.GetLocalizedValue("Chat.TownPigPresent2")); + dialogue.Add(this.GetLocalizedValue("Chat.TownPigPresent3")); + dialogue.Add(this.GetLocalizedValue("Chat.TownPigPresent4")); + } + + if (Main.raining) + { + dialogue.Add(this.GetLocalizedValue("Chat.Rain")); + } + + if (Main._shouldUseWindyDayMusic) + { + dialogue.Add(this.GetLocalizedValue("Chat.WindyDay")); + } + + if (Main.LocalPlayer.ZoneDesert) + { + dialogue.Add(this.GetLocalizedValue("Chat.Desert")); + } + + if (Main.LocalPlayer.ZoneSnow) + { + dialogue.Add(this.GetLocalizedValue("Chat.Tundra")); + } + + if (Main.LocalPlayer.ZoneGraveyard) + { + dialogue.Add(this.GetLocalizedValue("Chat.Graveyard")); + } + + if (Main.bloodMoon) + { + dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon1")); + dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon2")); + dialogue.Add(this.GetLocalizedValue("Chat.BloodMoon3")); + } + + if (Main.hardMode) + { + dialogue.Add(this.GetLocalizedValue("Chat.Hardmode")); + } + + if (NPC.downedMoonlord) + { + dialogue.Add(this.GetLocalizedValue("Chat.MoonLordDefeated")); + } + + return dialogue; + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + } + + public override void OnChatButtonClicked(bool firstButton, ref string shopName) + { + if (firstButton) + { + shopName = "Shop"; + } + } + + public override void AddShops() + { + NPCShop shop = new(Type); + shop.Add(Condition.MoonPhasesEven) + .Add(Condition.MoonPhasesOdd) + .Add(Condition.MoonPhasesHalf0) + .Add(Condition.MoonPhasesHalf1) + .Add(Condition.MoonPhasesEven) + .Add(Condition.MoonPhasesOdd) + .Add(Condition.DownedGoblinArmy) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhasesOdd) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhasesOdd) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhasesEven) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhasesEven) + .Add() + .Add() + .Add() + .Add() + .Add(CalamityConditions.DownedDreadnautilus, Condition.BloodMoon) + .Add(Condition.Hardmode) + .Add(Condition.Hardmode) + .Add(Condition.DownedGolem) + .Add(CalamityConditions.DownedYharon) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundGladiatorsLocket"), () => RecipeUnlockHandler.HasFoundGladiatorsLocket && Main.moonPhase == 0)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundLuxorsGift"), () => RecipeUnlockHandler.HasFoundLuxorsGift && Main.moonPhase == 1)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundCrimsonEffigy"), () => RecipeUnlockHandler.HasFoundCrimsonEffigy && Main.moonPhase == 2)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundFungalSymbiote"), () => RecipeUnlockHandler.HasFoundFungalSymbiote && Main.moonPhase == 3)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundUnstableGraniteCore"), () => RecipeUnlockHandler.HasFoundUnstableGraniteCore && Main.moonPhase == 4)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundFrozenCube"), () => RecipeUnlockHandler.HasFoundFrozenCube && Main.moonPhase == 5)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundCorruptionEffigy"), () => RecipeUnlockHandler.HasFoundCorruptionEffigy && Main.moonPhase == 6)) + .Add(new Condition(CalamityUtils.GetText("Condition.HasFoundTrinketOfChi"), () => RecipeUnlockHandler.HasFoundTrinketOfChi && Main.moonPhase == 7)) + .Add(Condition.DownedSkeletron, Condition.MoonPhasesEven, CalamityConditions.InRevengeanceMode) + .Add(Condition.DownedSkeletron, Condition.MoonPhasesOdd, CalamityConditions.InRevengeanceMode) + + .Register(); + } + + public override void FindFrame(int frameHeight) + { + NPC.gfxOffY = -2f; + + if (NPC.ai[0] == 12f) // Attacking + { + NPC.spriteDirection = NPC.direction; + + NPC.frameCounter = 0; + NPC.frame.Y = frameHeight * 9; + } + + else if (NPC.velocity.Y == 0f) + { + if (!NPC.IsABestiaryIconDummy) + { + if (NPC.direction == 1) + NPC.spriteDirection = 1; + else if (NPC.direction == -1) + NPC.spriteDirection = -1; + + if (NPC.velocity.X == 0f) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0.0; + return; + } + } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.25f; + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) + { + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - 1) + NPC.frame.Y = frameHeight; + } + + else + { + NPC.frameCounter = 0.0; + NPC.frame.Y = 0; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + // Manually draw gun frame when attacking + if (NPC.ai[0] == 12f && !NPC.IsABestiaryIconDummy) + { + Texture2D gunTex = TextureAssets.Item[ModContent.ItemType()].Value; + int holdoutOffset = -2; + Vector2 origin = NPC.spriteDirection == -1 ? new Vector2(gunTex.Width + holdoutOffset, gunTex.Height / 2f) : new Vector2(-holdoutOffset, gunTex.Height / 2f); + Vector2 drawPos = NPC.Center - screenPos + new Vector2(0f, 8f); + float rotation = NPC.ai[2] * ((float)Math.PI / 2f) * NPC.spriteDirection; + + spriteBatch.Draw(gunTex, drawPos, null, drawColor, rotation, origin, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + } + } + + //Pulled and modified from Vanilla, originally is used to spawn the Travelling Merchant + internal static void SpawnTravelNPC(int npcToSpawnNextTo) + { + int bestX = Main.npc[npcToSpawnNextTo].homeTileX; + int bestY = Main.npc[npcToSpawnNextTo].homeTileY; + int minValue = bestX; + int num3 = bestX; + int num4 = bestY; + int num5 = bestX; + while (num5 > bestX - 10 && (WorldGen.SolidTile(num5, num4) || Main.tileSolidTop[Main.tile[num5, num4].TileType]) && (!Main.tile[num5, num4 - 1].IsTileSolid() || !Main.tileSolid[Main.tile[num5, num4 - 1].TileType] || Main.tileSolidTop[Main.tile[num5, num4 - 1].TileType]) && (!Main.tile[num5, num4 - 2].IsTileSolid() || !Main.tileSolid[Main.tile[num5, num4 - 2].TileType] || Main.tileSolidTop[Main.tile[num5, num4 - 2].TileType]) && (!Main.tile[num5, num4 - 3].IsTileSolid() || !Main.tileSolid[Main.tile[num5, num4 - 3].TileType] || Main.tileSolidTop[Main.tile[num5, num4 - 3].TileType])) + { + minValue = num5; + num5--; + } + for (int k = bestX; k < bestX + 10 && (WorldGen.SolidTile(k, num4) || Main.tileSolidTop[Main.tile[k, num4].TileType]) && (!Main.tile[k, num4 - 1].IsTileSolid() || !Main.tileSolid[Main.tile[k, num4 - 1].TileType] || Main.tileSolidTop[Main.tile[k, num4 - 1].TileType]) && (!Main.tile[k, num4 - 2].IsTileSolid() || !Main.tileSolid[Main.tile[k, num4 - 2].TileType] || Main.tileSolidTop[Main.tile[k, num4 - 2].TileType]) && (!Main.tile[k, num4 - 3].IsTileSolid() || !Main.tileSolid[Main.tile[k, num4 - 3].TileType] || Main.tileSolidTop[Main.tile[k, num4 - 3].TileType]); k++) + { + num3 = k; + } + for (int l = 0; l < 30; l++) + { + int num6 = Main.rand.Next(minValue, num3 + 1); + if (l < 20) + { + if (num6 < bestX - 1 || num6 > bestX + 1) + { + bestX = num6; + break; + } + } + else if (num6 != bestX) + { + bestX = num6; + break; + } + } + int num7 = bestX; + int num8 = bestY; + bool flag = false; + if (!flag && !((double)num8 > Main.worldSurface)) + { + for (int m = 20; m < 500; m++) + { + for (int n = 0; n < 2; n++) + { + num7 = ((n != 0) ? (bestX - m * 2) : (bestX + m * 2)); + if (num7 > 10 && num7 < Main.maxTilesX - 10) + { + int num9 = bestY - m; + double num10 = bestY + m; + if (num9 < 10) + { + num9 = 10; + } + if (num10 > Main.worldSurface) + { + num10 = Main.worldSurface; + } + for (int num11 = num9; (double)num11 < num10; num11++) + { + num8 = num11; + if (!Main.tile[num7, num8].IsTileSolid() || !Main.tileSolid[Main.tile[num7, num8].TileType]) + { + continue; + } + if (Main.tile[num7, num8 - 3].LiquidType != LiquidID.Water || Main.tile[num7, num8 - 2].LiquidType != LiquidID.Water || Main.tile[num7, num8 - 1].LiquidType != LiquidID.Water || Collision.SolidTiles(num7 - 1, num7 + 1, num8 - 3, num8 - 1)) + { + break; + } + flag = true; + Rectangle value = new Rectangle(num7 * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, num8 * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); + for (int num12 = 0; num12 < 255; num12++) + { + if (Main.player[num12].active && new Rectangle((int)Main.player[num12].position.X, (int)Main.player[num12].position.Y, Main.player[num12].width, Main.player[num12].height).Intersects(value)) + { + flag = false; + break; + } + } + break; + } + } + if (flag) + { + break; + } + } + if (flag) + { + break; + } + } + } + int myIndex = NPC.NewNPC(NPC.GetSpawnSourceForTownSpawn(), num7 * 16, num8 * 16, ModContent.NPCType(), 1); + Main.npc[myIndex].homeTileX = bestX; + Main.npc[myIndex].homeTileY = bestY; + Main.npc[myIndex].homeless = true; + if (num7 < bestX) + { + Main.npc[myIndex].direction = 1; + } + else if (num7 > bestX) + { + Main.npc[myIndex].direction = -1; + } + Main.npc[myIndex].netUpdate = true; + string fullName = Main.npc[myIndex].FullName; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue("Announcement.HasArrived", fullName), 50, 125); + } + else if (Main.netMode == NetmodeID.Server) + { + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasArrived", Main.npc[myIndex].GetFullNetName()), new Color(50, 125, 255)); + } + } + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 10; + knockback = 1f; + } + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = ModContent.ProjectileType(); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 8f; + gravityCorrection = 0f; + randomOffset = 0f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 75; + randExtraCooldown = 10; + } + + // Spawn the effects used for Tinkerer's Voucher failing when below 1 life + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life <= 0) + { + for (int d = 0; d < 10; d++) + { + for (int smokeCount = 0; smokeCount < 3; smokeCount++) + { + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f); + Color smokeStart = Main.rand.NextBool() ? Color.Gray : Color.LightGray; + Color smokeEnd = Color.DimGray; + float smokeSize = Main.rand.NextFloat(0.9f, 2f); + + Particle smoke = new SmallSmokeParticle(NPC.Center, velocity, smokeStart, smokeEnd, smokeSize, Main.rand.Next(90, 140)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + Particle skull = new DesertProwlerSkullParticle(NPC.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.LightGray : Color.Silver, Color.Gray, Main.rand.NextFloat(0.15f, 0.5f), Main.rand.Next(100, 190)); + GeneralParticleHandler.SpawnParticle(skull); + } + SoundEngine.PlaySound(SoundID.NPCDeath6, NPC.Center); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + var hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); + hardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ModContent.ItemType())); + + } + + public override void ModifyActiveShop(string shopName, Item[] items) + { + ShadySalesmanShopTooltips.addSalesPitch = true; + } + + public override void ResetEffects() + { + if (Main.npcShop < 1) //ModifyActiveShop only runs once when shop opens, so we only reset this if no shop is open + ShadySalesmanShopTooltips.addSalesPitch = false; + } + } + + public class ShadySalesmanSpawnSystem : ModSystem + { + private static bool CanSpawnTonight = true; + + public override void PreUpdateWorld() + { + if (!DownedBossSystem.downedHorribleHog) // Cannot spawn before Horrible Hog has been killed. + return; + + if (Main.dayTime) + { + CanSpawnTonight = true; + return; + } + + if (!CanSpawnTonight || Main.eclipse || (Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0)) + return; + + for (int i = 0; i < 200; i++) + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + return; + + List townNPCs = []; + if (!NPC.AnyNPCs(ModContent.NPCType())) + { + for (int j = 0; j < 200; j++) + if (Main.npc[j].active && Main.npc[j].townNPC && Main.npc[j].type != NPCID.OldMan && !Main.npc[j].homeless) + townNPCs.Add(j); + + if (townNPCs.Count <= 1) + return; + } + + int petPig = NPC.FindFirstNPC(ModContent.NPCType()); + if (petPig == -1) + { + if (!Main.rand.NextBool(4)) + { + CanSpawnTonight = false; + return; + } + ShadySalesman.SpawnTravelNPC(townNPCs[Main.rand.Next(townNPCs.Count)]); + } + else + { + NPC pig = Main.npc[petPig]; + int oldHomeTileX = -1; + int oldHomeTileY = -1; + if (pig.homeTileX != -1 && pig.homeTileY != -1 && !pig.homeless) + { + oldHomeTileX = pig.homeTileX; + oldHomeTileY = pig.homeTileY; + } + + string name = pig.GivenName; + pig.Transform(ModContent.NPCType()); + pig.GivenName = name; + // Transform will force all these back to their unset values, so we need to set them back + if (oldHomeTileX != -1 && oldHomeTileY != -1) + { + pig.homeTileX = oldHomeTileX; + pig.homeTileY = oldHomeTileY; + pig.homeless = false; + } + } + CanSpawnTonight = false; + } + } + + public class ShadySalesmanShopTooltips : GlobalItem + { + /// + /// Scale for the "fine print" of the shop. + /// + public static float SmallTextSize => 0.8f; + /// + /// Tooltip Line names that should be left alone instead of becoming fine print + /// All exempted tooltip lines are moved above the fine print section + /// + static List ExemptFromSmall => [ + "ItemName", + "SalesPitch", + "Price", + "SpecialPrice", + "JourneyResearch", + ]; + public override void Load() + { + On_ChatManager.DrawColorCodedStringShadow_SpriteBatch_DynamicSpriteFont_TextSnippetArray_Vector2_Color_float_Vector2_Vector2_float_float += HideDefaultShadowForSmallText; + } + + // Doze May 30 2026 + // Terraria forces drawing the shadow effects for all tooltip texts. + // This system forces the shadows to be transparent for SmallTextSnippets as it draws the shadows manually + private void HideDefaultShadowForSmallText(On_ChatManager.orig_DrawColorCodedStringShadow_SpriteBatch_DynamicSpriteFont_TextSnippetArray_Vector2_Color_float_Vector2_Vector2_float_float orig, SpriteBatch spriteBatch, ReLogic.Graphics.DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, float maxWidth, float spread) + { + List colorsToRestore = []; + foreach (var item in snippets) + { + if (item is SmallTextSnippet s) + { + colorsToRestore.Add(s.Color); + s.Color = Color.Transparent; + } + } + orig(spriteBatch, font, snippets, position, baseColor, rotation, origin, baseScale, maxWidth, spread); + if (colorsToRestore.Count > 0) + foreach (var item in snippets) + { + if (item is SmallTextSnippet s) + { + s.Color = colorsToRestore[0]; + colorsToRestore.RemoveAt(0); + } + } + } + + public static bool addSalesPitch = false; //Used to track if the shop should show the pitches + + public override void ModifyTooltips(Item item, List tooltips) + { + if (!addSalesPitch || !CalamityItemSets.HasSalesmanText[item.type]) + return; + tooltips.Insert(1, new TooltipLine(Mod, "SalesPitch", item.ModItem?.GetLocalizedValue("SalesPitch") ?? "Error: Sales Pitches not supported for vanilla items") // While vanilla item support COULD be added, salesman won't need sales pitches for vanilla items ever and so this is fine. + { + }); + + int placetoMove = -1; + + for (var i = 0; i < tooltips.Count; i++) + { + var line = tooltips[i]; + if (!ExemptFromSmall.Contains(line.Name) && line.Visible) + { + if (placetoMove < 0) + placetoMove = i; + TextSnippet[] snippets = ChatManager.ParseMessage(line.Text, Color.White).ToArray(); + ChatManager.ConvertNormalSnippets(snippets); + + string lineText = ""; + for (int i2 = 0; i2 < snippets.Length; i2++) + { + lineText += snippets[i2].Text; + + if (snippets[i2] is BuffTagPlayerEffectHandler.Snippet snip) + { + lineText += Lang.GetBuffName(snip.BuffId); + } + else if (snippets[i2] is BuffTagEnemyEffectHandler.Snippet snip2) + { + lineText += Lang.GetBuffName(snip2.BuffId); + } + } + + if (string.IsNullOrWhiteSpace(lineText)) + //Sometimes the game tries to draw entirely empty lines with no size. + //This would cause no issue except for it still applies the Y offset those lines + //So, we just force hide those lines entirely here + line.Hide(); + else + { + string[] lines = lineText.Split('\n'); + tooltips.RemoveAt(i); + + for (int k = 0; k < lines.Length; k++) + { + if (string.IsNullOrWhiteSpace(lines[k])) + continue; + + // Create a distinct TooltipLine for each line of text + TooltipLine newLine = new TooltipLine(Mod, $"{line.Name}_{k}", $"[scale/{SmallTextSize}:{lines[k]}]") + { + OverrideColor = line.OverrideColor + }; + + // Insert it back into the list at the current position + tooltips.Insert(i, newLine); + i++; + } + + i--; + } + + } + else if (placetoMove > 0) + { + tooltips.RemoveAt(i); + tooltips.Insert(placetoMove, line); + placetoMove++; + } + + } + } + + public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) + { + //Applies the Y offset to lines that are small to ensure they line up properly visually. + //Without this, they'd stay spaced the same as normal text... + //although the tooltip background would still size as if they're stacked closer like this does. Thanks vanilla code jank. + if (line.Text.StartsWith($"[scale/{SmallTextSize}:")) + { + yOffset = -(int)(FontAssets.MouseText.Value.MeasureString(" ") * (1 - SmallTextSize)).Y - 1; + } + return base.PreDrawTooltipLine(item, line, ref yOffset); + } + } +} diff --git a/NPCs/TownNPCs/ShadySalesman.png b/NPCs/TownNPCs/ShadySalesman.png new file mode 100644 index 0000000000..58ae6b7252 Binary files /dev/null and b/NPCs/TownNPCs/ShadySalesman.png differ diff --git a/NPCs/TownNPCs/ShadySalesman_Head.png b/NPCs/TownNPCs/ShadySalesman_Head.png new file mode 100644 index 0000000000..c67ecb92ee Binary files /dev/null and b/NPCs/TownNPCs/ShadySalesman_Head.png differ diff --git a/NPCs/TownNPCs/TownPiggy.cs b/NPCs/TownNPCs/TownPiggy.cs index 3c15194e38..fe50e24b6d 100644 --- a/NPCs/TownNPCs/TownPiggy.cs +++ b/NPCs/TownNPCs/TownPiggy.cs @@ -54,12 +54,15 @@ namespace CalamityMod.NPCs.TownNPCs AIType = NPCID.TownBunny; NPC.damage = 0; NPC.defense = 0; - NPC.lifeMax = 50; + NPC.lifeMax = 250; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.5f; NPC.housingCategory = 1; DrawOffsetY = -4; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { @@ -72,7 +75,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool CanTownNPCSpawn(int numTownNPCs) { - if (CalamityWorld.unlockedTownPig) + if (CalamityWorld.unlockedTownPig && !NPC.AnyNPCs(ModContent.NPCType())) { return true; } @@ -181,6 +184,7 @@ namespace CalamityMod.NPCs.TownNPCs this.GetLocalizedValue("Name.Techno"), // Technoblade this.GetLocalizedValue("Name.JohnPork"), // John Pork this.GetLocalizedValue("Name.Piglet"), // Winnie-the-Pooh + this.GetLocalizedValue("Name.Poogie"), // Monster Hunter // Dedicated names }; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs index f011ff78bd..675782e8c2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs @@ -2,27 +2,19 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Events; -using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss.BrainOfCthulhu; -using CalamityMod.Utilities.Daybreak; using CalamityMod.World; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Graphics.PackedVector; -using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.Chat; -using Terraria.DataStructures; using Terraria.GameContent; -using Terraria.Graphics.Effects; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -67,7 +59,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride #region Health Gates internal static float DesperateOnslaughtCreeperHealthGate => 0.1f; //When the cumulative health % of all creepers falls below this value, BoC will begin its pre-stun attack upon entering its idle phase. - internal static float Phase2HealthGate => 0.5f; //When BoC's health % falls below this value, it will begin entering Phase 2 + internal static float Phase2HealthGate => 0.7f; //When BoC's health % falls below this value, it will begin entering Phase 2 + internal static float ForcedIllusionHealthGate => 0.25f; //When BoC's health % falls below this value, the next attack is forced to be the Illusion Trick #endregion internal static float DespawnRangeSQ => 36000000f; @@ -83,7 +76,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride internal static int CreeperChargeWindUpTime => 22; #endregion - internal static int StunDuration => 480; + internal static int StunDuration => 360; #region Creeper Swipes internal static int SwipesStartupDuration => 120; @@ -253,6 +246,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride internal float SpawnTime = 0; internal int SpawnDelay = 0; internal bool OnSecondCreeperPhase = false; + internal bool ForcedIllusionAttack = false; private bool isNegative = false; internal int AttackSign { get => isNegative ? -1 : 1; set => isNegative = value == -1; } @@ -352,8 +346,6 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.defense = NPC.defDefense; NPC.chaseable = (AIState != BrainAIState.IllusionDash && AIState != BrainAIState.IllusionTrick); - if (Main.getGoodWorld && AIState >= BrainAIState.Phase2TransitionOpen) - NPC.brainOfGravity = NPC.whoAmI; } else NPC.defense = (int)(NPC.defDefense * Phase1DefenseMultiplier); @@ -1674,12 +1666,15 @@ public class BrainOfCthulhuAI : VanillaAIOverride float angleChange = MathHelper.Lerp(MathHelper.Pi / 24f, 0f, MathHelper.Clamp(Time / (ChaseTime * 0.666f), 0f, 1f)); NPC.velocity = NPC.velocity.RotateDirectionTowards(NPC.DirectionTo(Target.Center).ToRotation(), angleChange) * (MathHelper.Lerp(ChaseMinSpeed, ChaseMaxSpeed, Time / ChaseTime) * speedUp * slowDown); + // Teleport ahead of the player's movement if (Time == ChaseTime) { if (Main.netMode != NetmodeID.SinglePlayer) SelectNewTarget(); - Vector2 direction = Target.velocity.SafeNormalize(Vector2.UnitX * Target.direction).RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 3f, MathHelper.Pi / 3f)); - AttackPosition = Target.Center + (direction * DefaultTeleportDistance); + Vector2 direction = Target.velocity.RotatedByRandom(MathHelper.Pi * 0.1f); + if (direction.Length() < 3.5f) + direction = direction.SafeNormalize(Vector2.UnitX * Target.direction) * 3.5f; + AttackPosition = Target.Center + (direction * IdleTeleportDuration * 1.8f); BoCAfterImages = []; NPC.damage = 0; NPC.netUpdate = true; @@ -1743,26 +1738,35 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.rotation = 0; ResetAttackValues(); - if (availableAttacks.Count == 0) + if (!ForcedIllusionAttack && (NPC.life / (float)NPC.lifeMax) <= ForcedIllusionHealthGate) { - bool quickChoice = Main.rand.NextBool(); - availableAttacks = [ - BrainAIState.Bloodletting, + ForcedIllusionAttack = true; + AIState = BrainAIState.IllusionTrick; + PreviousAttack = AIState; + } + else + { + if (availableAttacks.Count == 0) + { + bool quickChoice = Main.rand.NextBool(); + availableAttacks = [ + BrainAIState.Bloodletting, quickChoice ? BrainAIState.SanguineScythes : BrainAIState.IllusionDash, Main.rand.NextBool() ? BrainAIState.Phase2Idle : BrainAIState.Bloodletting, quickChoice ? BrainAIState.IllusionDash : BrainAIState.SanguineScythes, BrainAIState.IllusionTrick - ]; - } + ]; + } - AIState = availableAttacks[0]; - availableAttacks.RemoveAt(0); - PreviousAttack = AIState; + AIState = availableAttacks[0]; + availableAttacks.RemoveAt(0); + PreviousAttack = AIState; - if (AIState == BrainAIState.SanguineScythes) - { - Time = -31; - BoCAfterImages = []; + if (AIState == BrainAIState.SanguineScythes) + { + Time = -31; + BoCAfterImages = []; + } } NPC.netUpdate = true; @@ -2857,7 +2861,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride binaryWriter.Write(SpawnDelay); } - binaryWriter.WriteFlags(OnSecondCreeperPhase, isNegative, AttackFlag); + binaryWriter.WriteFlags(OnSecondCreeperPhase, ForcedIllusionAttack, isNegative, AttackFlag); binaryWriter.Write(AttackRotation); binaryWriter.Write(AttackTime); @@ -2889,7 +2893,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride SpawnDelay = binaryReader.ReadInt32(); } - binaryReader.ReadFlags(out OnSecondCreeperPhase, out isNegative, out AttackFlag); + binaryReader.ReadFlags(out OnSecondCreeperPhase, out ForcedIllusionAttack, out isNegative, out AttackFlag); AttackRotation = binaryReader.ReadSingle(); AttackTime = binaryReader.ReadSingle(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index e5ffa7b8ab..00969c8e2e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.getGoodWorld) NPC.ai[1] += 100f; - if (enrage || death) + if (enrage) { NPC.ai[1] += 18f; } @@ -239,8 +239,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!jump) return; - float velocityBoost = (death ? 5f : 3.8f) * (1f - (lifeRatio / 2)); - float velocityX = (death ? 6f : 4f) + velocityBoost; + float velocityBoost = (death ? 3f : 2f) * (1f - (lifeRatio / 2)); + float velocityX = 4f + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.noTileCollide = true; NPC.ai[2] += 1f; - float jumpVelocity = death ? 26f : 21f; + float jumpVelocity = death ? 21f : 18f; if (enrage) jumpVelocity *= 1.25f; if (turboEnrage) @@ -393,7 +393,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[fiery2].velocity.X *= 2f; } - float projectileVelocity = death ? 7.5f : 4.75f; + float projectileVelocity = 4.75f; if (enrage) projectileVelocity *= 1.5f; if (turboEnrage) @@ -1060,7 +1060,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.ai[1] % 10f == 0f) SoundEngine.PlaySound(SoundID.Item33, spawnLocation); - float laserFireAngle = MathHelper.ToRadians((NPC.ai[1] - telegraphTime + 20) * (death ? 2.45f : 2f)); + float laserFireAngle = MathHelper.ToRadians((NPC.ai[1] - telegraphTime + 20) * (death ? 2.35f : 2f)); Vector2 laserVelocity = Vector2.UnitY.RotatedBy(laserFireAngle * -NPC.localAI[1]) * (death ? 15f : 12f); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1300,7 +1300,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = -1; i <= 1; i += 2) { Vector2 spawnLocation = new Vector2(NPC.Center.X + 14f * NPC.scale * i, NPC.Center.Y - 20f * NPC.scale); - float laserFireAngle = MathHelper.ToRadians((NPC.ai[1] - telegraphTime + 20) * (death ? 2.1f : 2f)); + float laserFireAngle = MathHelper.ToRadians((NPC.ai[1] - telegraphTime + 20) * 2f); Vector2 laserVelocity = -Vector2.UnitY.RotatedBy(laserFireAngle * i) * (death ? 15f : 12f); if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 437d1b4969..eb39b7dd28 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -189,7 +189,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; - int maxRandom = phase4 ? (death ? 5 : 4) : 4; + int maxRandom = phase4 ? 5 : 4; do phase = Main.rand.Next(maxRandom); while (phase == NPC.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3)); @@ -200,7 +200,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (stingerArcs) phase = 5; - CalamityUtils.CalamityTargeting(NPC, CalamityTargetingParameters.BossDefaults); NPC.ai[0] = phase; NPC.ai[1] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 0dca2a085f..9d7c19f24d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -892,7 +892,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float eyeTelegraphGateValue = LaserShootGateValue - LaserShootTelegraphTime; if (NPC.localAI[1] > eyeTelegraphGateValue || NPC.localAI[2] > 0f || enraged) { - Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[NPC.type].Value; var halfSize = NPC.frame.Size() / 2; SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -900,12 +899,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.localAI[2] > 0f ? 1f - ((NPC.localAI[2] - 1f) / TotalLasersPerBarrage) : MathHelper.Clamp((NPC.localAI[1] - eyeTelegraphGateValue) / LaserShootTelegraphTime, 0f, 1f); - Color drawColor2 = new Color(100, 0, 200, 192) * colorScale; - for (int i = 0; i < 2; i++) - { - spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, - drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f); - } + Color drawColor2 = new Color(128, 0, 255) * colorScale; + spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, + drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f); } } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/BatAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/BatAI.cs index dca24249e1..a5103aa3ea 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/BatAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/BatAI.cs @@ -284,12 +284,17 @@ public static partial class RevengeanceAndDeathAI int type = ProjectileID.HarpyFeather; Vector2 featherVelocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (CalamityWorld.death ? 4f : 6f); - int feather = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, featherVelocity, type, damage, 0f, Main.myPlayer); + int feather = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, featherVelocity, type, damage, 0f, Main.myPlayer).identity; Main.projectile[feather].timeLeft = 300; if (CalamityWorld.death) { - Main.projectile[feather].extraUpdates += 1; + Main.projectile[feather].Calamity().extraUpdatesToSync = 1; Main.projectile[feather].timeLeft = 600; + if (Main.dedServ) + { + Main.projectile[feather].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, feather); + } } } } @@ -316,12 +321,17 @@ public static partial class RevengeanceAndDeathAI int type = ProjectileID.DemonSickle; Vector2 sickleVelocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (CalamityWorld.death ? 0.15f : 0.2f); - int sickle = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, sickleVelocity, type, damage, 0f, Main.myPlayer); + int sickle = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, sickleVelocity, type, damage, 0f, Main.myPlayer).identity; Main.projectile[sickle].timeLeft = 300; if (CalamityWorld.death) { - Main.projectile[sickle].extraUpdates += 1; + Main.projectile[sickle].Calamity().extraUpdatesToSync = 1; Main.projectile[sickle].timeLeft = 600; + if (Main.dedServ) + { + Main.projectile[sickle].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, sickle); + } } } } @@ -352,12 +362,17 @@ public static partial class RevengeanceAndDeathAI int damage = 80; int type = ProjectileID.UnholyTridentHostile; - int trident = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer); + int trident = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer).identity; Main.projectile[trident].timeLeft = 300; if (CalamityWorld.death) { - Main.projectile[trident].extraUpdates += 1; + Main.projectile[trident].Calamity().extraUpdatesToSync = 1; Main.projectile[trident].timeLeft = 600; + if (Main.dedServ) + { + Main.projectile[trident].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, trident); + } } } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/CasterAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/CasterAI.cs index 165932bcf7..ff958faa1f 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/CasterAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/CasterAI.cs @@ -296,10 +296,16 @@ public static partial class RevengeanceAndDeathAI if (canSpawnProj) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), (float)(spiritProjSpawnX * 16 + 8), (float)(spiritProjSpawnY * 16 + 8), 0f, 0f, ProjectileID.DesertDjinnCurse, 0, 1f, Main.myPlayer, (float)NPC.target, 0f); + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), new Vector2((float)(spiritProjSpawnX * 16 + 8), (float)(spiritProjSpawnY * 16 + 8)), Vector2.Zero, ProjectileID.DesertDjinnCurse, 0, 1f, Main.myPlayer, (float)NPC.target, 0f).identity; if (CalamityWorld.death) - Main.projectile[proj].extraUpdates += 1; - + { + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } + } break; } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FighterAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FighterAI.cs index a7378e9b3b..dbeb626e14 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FighterAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FighterAI.cs @@ -2922,22 +2922,32 @@ PrepareToShoot: } else if (npcType == NPCID.StardustSoldier) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, (float)NPC.whoAmI); + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition, new Vector2(distX, distY), projectileType, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI).identity; if (CalamityWorld.death) { - Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; Main.projectile[proj].timeLeft = 480; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } } else if (npcType == NPCID.NebulaSoldier) { for (int i = 0; i < 4; i++) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X - (float)(NPC.spriteDirection * 4), NPC.Center.Y + 6f, (float)(-3 + 2 * i) * 0.15f, (float)(-(float)Main.rand.Next(0, 3)) * 0.2f - 0.1f, projectileType, damage, 0f, Main.myPlayer, 0f, (float)NPC.whoAmI); + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), new Vector2(NPC.Center.X - (float)(NPC.spriteDirection * 4), NPC.Center.Y + 6f), new Vector2((float)(-3 + 2 * i) * 0.15f, (float)(-(float)Main.rand.Next(0, 3)) * 0.2f - 0.1f), projectileType, damage, 0f, Main.myPlayer, 0f, (float)NPC.whoAmI).identity; if (CalamityWorld.death) { - Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; Main.projectile[proj].timeLeft = 1200; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } } } @@ -2948,11 +2958,16 @@ PrepareToShoot: } else { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition, new Vector2(distX, distY), projectileType, damage, 0f, Main.myPlayer).identity; if (CalamityWorld.death) { - Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; Main.projectile[proj].timeLeft = 1200; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } } } @@ -3192,12 +3207,17 @@ PrepareToShoot: { int velocityX = 3 * NPC.direction; int velocityY = -5; - int clownBomb = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, velocityX, velocityY, ProjectileID.HappyBomb, 0, 0f, Main.myPlayer, 0f, 0f); + int clownBomb = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), spawnPosition, new Vector2(velocityX, velocityY), ProjectileID.HappyBomb, 0, 0f, Main.myPlayer, 0f, 0f).identity; Main.projectile[clownBomb].timeLeft = 300; if (CalamityWorld.death) { - Main.projectile[clownBomb].extraUpdates += 1; + Main.projectile[clownBomb].Calamity().extraUpdatesToSync = 1; Main.projectile[clownBomb].timeLeft = 600; + if (Main.dedServ) + { + Main.projectile[clownBomb].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, clownBomb); + } } NPC.ai[2] = 0f; } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlowInvaderAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlowInvaderAI.cs index 6ae95decd4..2b3974551c 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlowInvaderAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlowInvaderAI.cs @@ -50,8 +50,13 @@ public static partial class RevengeanceAndDeathAI while (Math.Abs(projDirection.X) < 1.5f) projDirection = Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * new Vector2(5f, 3f); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projDirection, ProjectileID.StardustJellyfishSmall, 60, 0f, Main.myPlayer, 0f, NPC.whoAmI); - Main.projectile[proj].extraUpdates += 1; + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, projDirection, ProjectileID.StardustJellyfishSmall, 60, 0f, Main.myPlayer, 0f, NPC.whoAmI).identity; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } return false; diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlyingAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlyingAI.cs index 1c582877aa..49975d93ee 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlyingAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/FlyingAI.cs @@ -598,9 +598,14 @@ public static partial class RevengeanceAndDeathAI projDamage = (int)(30f * NPC.scale); int stingerType = ProjectileID.Stinger; - int stingerSpawn = Projectile.NewProjectile(NPC.GetSource_FromAI(), projSpawnPosition.X, projSpawnPosition.Y, projTargetXDist, projTargetYDist, stingerType, projDamage, 0f, Main.myPlayer); + int stingerSpawn = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), projSpawnPosition, new Vector2(projTargetXDist, projTargetYDist), stingerType, projDamage, 0f, Main.myPlayer).identity; Main.projectile[stingerSpawn].timeLeft = (CalamityWorld.death || Main.hardMode) ? 600 : 300; - Main.projectile[stingerSpawn].extraUpdates += (CalamityWorld.death || Main.hardMode) ? 1 : 0; + Main.projectile[stingerSpawn].Calamity().extraUpdatesToSync = (CalamityWorld.death || Main.hardMode) ? 1 : 0; + if (Main.dedServ) + { + Main.projectile[stingerSpawn].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, stingerSpawn); + } NPC.ai[1] = 301f; NPC.netUpdate = true; } @@ -673,11 +678,16 @@ public static partial class RevengeanceAndDeathAI NPC.netUpdate = true; NPC.localAI[0] = 0f; bloodShotPosition = NPC.DirectionTo(new Vector2(targetData.Center.X, targetData.Position.Y)); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bloodShotPosition * (CalamityWorld.death ? 6f : 10f), ProjectileID.BloodShot, 50, 1f, Main.myPlayer); + int proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, bloodShotPosition * (CalamityWorld.death ? 6f : 10f), ProjectileID.BloodShot, 50, 1f, Main.myPlayer).identity; if (CalamityWorld.death) { - Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; Main.projectile[proj].timeLeft = 1200; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } } else diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs index 76ff14d407..20155f3abf 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs @@ -188,9 +188,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies spikeShootVelocity *= Main.rand.NextVector2Square(0.75f, 1.25f); spikeShootVelocity.Normalize(); spikeShootVelocity *= Main.rand.NextFloat(3.5f, 4.5f) * projectileShootSpeedFactor; - int proj = Projectile.NewProjectile(source, NPC.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer); + int proj = Projectile.NewProjectileDirect(source, NPC.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer).identity; if (CalamityWorld.death) - Main.projectile[proj].extraUpdates += 1; + { + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } + } projectileShootCountdown = 30f; } @@ -198,11 +205,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies else { Vector2 velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center - Vector2.UnitY * 100f) * projectileShootSpeedFactor * (CalamityWorld.death ? 3.25f : CalamityWorld.revenge ? 5.5f : 4.5f); - int proj = Projectile.NewProjectile(source, NPC.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer); + int proj = Projectile.NewProjectileDirect(source, NPC.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer).identity; if (CalamityWorld.death) { - Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].Calamity().extraUpdatesToSync = 1; Main.projectile[proj].timeLeft = 1200; + if (Main.dedServ) + { + Main.projectile[proj].netSpam = 0; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj); + } } projectileShootCountdown = 50f; diff --git a/Packets/Entities/DivineSwine/DivineSwineOfferingPacket.cs b/Packets/Entities/DivineSwine/DivineSwineOfferingPacket.cs new file mode 100644 index 0000000000..61278d00ae --- /dev/null +++ b/Packets/Entities/DivineSwine/DivineSwineOfferingPacket.cs @@ -0,0 +1,34 @@ +using System.IO; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; + +namespace CalamityMod.Packets +{ + internal class DivineSwineOfferingPacket : CalamityPacket + { + public static DivineSwineOfferingPacket Instance { get; private set; } + + public static void Send(DivineSwine divineSwine, bool? offeringState = null, int toClient = -1, int ignoreClient = -1) + { + if (divineSwine is null || !offeringState.HasValue) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(divineSwine); + packet.Write(offeringState.Value); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var divineSwine = packet.ReadModNPC(); + var offeringState = packet.ReadBoolean(); + + if (divineSwine is null) + return; + + if (Main.dedServ) + divineSwine.AcceptOffering(offeringState); + } + } +} diff --git a/Packets/Entities/RequestApplyTheGiftPacket.cs b/Packets/Entities/RequestApplyTheGiftPacket.cs new file mode 100644 index 0000000000..d71f7654ae --- /dev/null +++ b/Packets/Entities/RequestApplyTheGiftPacket.cs @@ -0,0 +1,39 @@ +using System.IO; +using CalamityMod.Items.Tools; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets.Entities +{ + internal sealed class RequestApplyTheGiftPacket : CalamityPacket + { + public static RequestApplyTheGiftPacket Instance { get; private set; } + + public static void Send(Item item, NPC npc, int toClient = -1, int ignoreClient = -1) + { + if (item is null || npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.Write((short)item.whoAmI); + packet.WriteWhoAmI(npc); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + int itemWhoAmI = packet.ReadInt16(); + NPC npc = packet.ReadNPC(); + + if (!Main.dedServ || npc is null || itemWhoAmI < 0 || itemWhoAmI >= Main.maxItems) + return; + + Item item = Main.item[itemWhoAmI]; + if (!item.active || item.type != ModContent.ItemType()) + return; + + TheGift.TryApplyGift(item, npc); + } + } +} diff --git a/Packets/Entities/TheGiftEffectsPacket.cs b/Packets/Entities/TheGiftEffectsPacket.cs new file mode 100644 index 0000000000..eb6b641e48 --- /dev/null +++ b/Packets/Entities/TheGiftEffectsPacket.cs @@ -0,0 +1,36 @@ +using System.IO; +using CalamityMod.Items.Tools; +using Terraria; + +namespace CalamityMod.Packets.Entities +{ + internal sealed class TheGiftEffectsPacket : CalamityPacket + { + public static TheGiftEffectsPacket Instance { get; private set; } + + public static void Send(NPC npc, bool positive, int toClient = -1, int ignoreClient = -1) + { + if (npc is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(npc); + packet.Write(positive); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + NPC npc = packet.ReadNPC(); + bool positive = packet.ReadBoolean(); + + if (npc is null) + return; + + TheGift.ApplyGiftEffects(npc, positive); + + if (Main.dedServ) + Send(npc, positive, ignoreClient: sender); + } + } +} diff --git a/Packets/Entities/TrustyOldRodEnemyPacket.cs b/Packets/Entities/TrustyOldRodEnemyPacket.cs new file mode 100644 index 0000000000..4d88e14bf6 --- /dev/null +++ b/Packets/Entities/TrustyOldRodEnemyPacket.cs @@ -0,0 +1,39 @@ +using System.IO; +using CalamityMod.Systems; +using Terraria; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Packets.Entities +{ + internal sealed class TrustyOldRodEnemyPacket : CalamityPacket + { + public static TrustyOldRodEnemyPacket Instance { get; private set; } + + public static void Send(Player player, int bobberWhoAmI, int rarity = 1, bool lava = false, bool honey = false, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(bobberWhoAmI); + packet.Write(rarity); + packet.WriteFlags(lava, honey); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var player = packet.ReadPlayer(); + var bobber = packet.ReadInt32(); + var rarity = packet.ReadInt32(); + packet.ReadFlags(out bool lava, out bool honey); + + if (player is null) + return; + + if (Main.dedServ) + TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(player, bobber, rarity, lava, honey); + } + } +} diff --git a/Packets/Players/DisgustingMeatPlayerSyncPacket.cs b/Packets/Players/DisgustingMeatPlayerSyncPacket.cs new file mode 100644 index 0000000000..08e818d6db --- /dev/null +++ b/Packets/Players/DisgustingMeatPlayerSyncPacket.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using CalamityMod.Items.Tools; +using MonoMod.Core.Platforms; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + internal class DisgustingMeatPlayerSyncPacket : CalamityPacket + { + public static DisgustingMeatPlayerSyncPacket Instance { get; private set; } + + public static void Send(DisgustingMeatPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.DoingVomitAnimation); + packet.Write(playerToSync.EjectMiscUpgrades); + packet.Write(playerToSync.VomitTime); + packet.Write((int)playerToSync.Player.eyeHelper.CurrentEyeFrame); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var player = packet.ReadPlayer(); + var doingVomitAnimation = packet.ReadBoolean(); + var ejectMiscUpgrades = packet.ReadBoolean(); + var vomitTime = packet.ReadInt32(); + var currentEyeFrame = packet.ReadInt32(); + + if (player is null) + return; + + var modPlayer = player.GetModPlayer(); + modPlayer.DoingVomitAnimation = doingVomitAnimation; + modPlayer.EjectMiscUpgrades = ejectMiscUpgrades; + modPlayer.VomitTime = vomitTime; + player.eyeHelper.CurrentEyeFrame = (PlayerEyeHelper.EyeFrame)currentEyeFrame; + + if (Main.dedServ) + Send(modPlayer, ignoreClient: sender); + } + } +} diff --git a/Packets/Players/TheElixirTeleportSyncPacket.cs b/Packets/Players/TheElixirTeleportSyncPacket.cs index ce86f534a9..d07339afa3 100644 --- a/Packets/Players/TheElixirTeleportSyncPacket.cs +++ b/Packets/Players/TheElixirTeleportSyncPacket.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,38 +11,23 @@ namespace CalamityMod.Packets { public static TheElixirTeleportSyncPacket Instance { get; private set; } - public static void Send(Player player, int locationIndex = -1, int toClient = -1, int ignoreClient = -1) + public static void Send(Player player, int toClient = -1, int ignoreClient = -1) { - if (player is null || locationIndex == -1) + if (player is null) return; var packet = Instance.CreateBasePacket(); packet.WriteWhoAmI(player); - packet.Write(locationIndex); packet.Send(toClient, ignoreClient); } public override void HandlePacket(BinaryReader packet, int sender) { var player = packet.ReadPlayer(); - var locationIndex = packet.ReadInt32(); - if (player is null) return; - Vector2? location = locationIndex switch - { - 1 => CalamityPlayer.GetAbyssVoidTeleportPosition(player), - 2 => CalamityPlayer.GetTempleTeleportPosition(player), - _ => CalamityPlayer.GetDungeonArchivesTeleportPosition(player) - }; - - if (!location.HasValue) - return; - - player.AddBuff(BuffID.ChaosState, 300, false); - player.AddBuff(BuffID.Cursed, 300, false); - CalamityPlayer.ModTeleport(player, location.Value, false, TeleportationStyleID.RecallPotion); + player.GetModPlayer().RunDangerousLocationTeleportation(); } } } diff --git a/Packets/Worlds/DisableNPCUpgradesSyncPacket.cs b/Packets/Worlds/DisableNPCUpgradesSyncPacket.cs new file mode 100644 index 0000000000..7a16feda3a --- /dev/null +++ b/Packets/Worlds/DisableNPCUpgradesSyncPacket.cs @@ -0,0 +1,39 @@ +using System.IO; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets.Worlds +{ + internal class DisableNPCUpgradesSyncPacket : CalamityPacket + { + public static DisableNPCUpgradesSyncPacket Instance { get; private set; } + + public static void Send(int upgradeType = -1, int toClient = -1, int ignoreClient = -1) + { + if (upgradeType < 0 || upgradeType > 2) + return; + + var packet = Instance.CreateBasePacket(); + packet.Write(upgradeType); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var upgradeType = packet.ReadInt32(); + + if (upgradeType == 0) + NPC.peddlersSatchelWasUsed = false; + else if (upgradeType == 1) + NPC.combatBookWasUsed = false; + else if (upgradeType == 2) + NPC.combatBookVolumeTwoWasUsed = false; + + // Apply change to everyone + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(MessageID.WorldData); + } + } + } +} diff --git a/Particles/FeatherParticle.cs b/Particles/FeatherParticle.cs new file mode 100644 index 0000000000..54a6bd9ab9 --- /dev/null +++ b/Particles/FeatherParticle.cs @@ -0,0 +1,160 @@ +using System; +using System.Threading; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class FeatherParticle : Particle + { + public float RotationSpeed; + + public float Opacity; + + public float SwayAngleStrength; + + public bool AffectedByWind; + + public bool NoGravity; + + public bool ShouldCollideWithTiles; + + public bool DieWithTileCollision; + + private int DeathTimer; + + public static float WaveAngle => MathHelper.ToRadians(25f); + + public float WaveFrameState { get; private set; } + + public int SwayInterval { get; private set; } + + public bool CurrentlyCollidingWithTiles { get; private set; } + + public FeatherParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float? rotationSpeed = null, float swayAngleStrength = 1f, bool affectedByWind = false, bool noGravity = false, bool shouldCollideWithTiles = false, bool dieWithTileCollision = false) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifetime; + RotationSpeed = rotationSpeed ?? Main.rand.NextFloat(120f, 150f) * Main.rand.NextBool().ToDirectionInt(); + SwayAngleStrength = swayAngleStrength; + AffectedByWind = affectedByWind; + NoGravity = noGravity; + ShouldCollideWithTiles = shouldCollideWithTiles; + DieWithTileCollision = dieWithTileCollision; + + Variant = Main.rand.Next(3); + Opacity = 0f; + SwayInterval = Main.rand.Next(75, 150); + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + + public override string Texture => "CalamityMod/Particles/FeatherParticle"; + + public override bool SetLifetime => false; + + public override bool UseCustomDraw => true; + + public override int FrameVariants => 3; + + public override void Update() + { + if (!CurrentlyCollidingWithTiles) + Rotation += (MathHelper.Pi / RotationSpeed) + (Velocity.X * 0.01f); + + // Original math from AstralGodRay.cs. + int waveSign = (WaveFrameState > 0f).ToDirectionInt(); + if (Math.Abs(WaveFrameState) < 1f) + { + int dirToUse = WaveFrameState == 0 ? (Main.rand.NextBool() ? -1 : 1) : waveSign; + waveSign = -dirToUse; + WaveFrameState = dirToUse * SwayInterval * 0.5f; + } + + // Switch directions whenever necessary. + else if (Math.Abs(WaveFrameState) > SwayInterval) + WaveFrameState = -waveSign; + else + WaveFrameState += waveSign; + + // Rotate velocity towards the wave angle to appear as if its swaying side to side. + float swayAngle = WaveAngle / (SwayInterval * 0.5f); + Velocity = Velocity.RotatedBy(waveSign * swayAngle * SwayAngleStrength); + + Velocity.X *= 0.98f; + if (Velocity.Y < 0.6f && !NoGravity) + Velocity.Y += 0.005f; + else + Velocity.Y *= 0.98f; + + // Move with wind speed. + if (AffectedByWind) + Velocity.X += Main.windSpeedCurrent / 3f; + + // Tile collision. + if (ShouldCollideWithTiles) + { + CurrentlyCollidingWithTiles = false; + + Vector2 hitboxDimensions = new(12f, 12f); + if (Collision.SolidCollision(Position, (int)hitboxDimensions.X, (int)hitboxDimensions.Y)) + { + Velocity = Collision.TileCollision(Position, Velocity, (int)hitboxDimensions.X, (int)hitboxDimensions.Y); + CurrentlyCollidingWithTiles = true; + } + + if (Collision.WetCollision(Position, (int)hitboxDimensions.X, (int)hitboxDimensions.Y)) + { + Velocity.Y *= 0.8f; + CurrentlyCollidingWithTiles = true; + } + } + + if (DieWithTileCollision && ShouldCollideWithTiles) + { + if (CurrentlyCollidingWithTiles) + { + Opacity = MathHelper.Lerp(1f, 0f, (float)(DeathTimer / 45)); + if (DeathTimer >= 45) + { + Kill(); + return; + } + + DeathTimer++; + } + else + { + Opacity = MathHelper.Clamp(Opacity + 0.075f, 0f, 1f); + } + } + else + { + int fadeInTime = 45 - (int)(Lifetime * 0.2f); + if (fadeInTime < 20) + fadeInTime = 20; + int fadeOutTime = (int)(Lifetime * 0.8f); + Opacity = Utils.GetLerpValue(0, fadeInTime, Time, true) * Utils.GetLerpValue(Lifetime, fadeOutTime, Time); + + if (Time >= Lifetime) + { + Kill(); + return; + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint())); + Rectangle frame = texture.Frame(1, FrameVariants, 0, Variant); + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, lightColor * Opacity, Rotation, frame.Size() * 0.5f, Scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Particles/FeatherParticle.png b/Particles/FeatherParticle.png new file mode 100644 index 0000000000..874bccc051 Binary files /dev/null and b/Particles/FeatherParticle.png differ diff --git a/Particles/FlyParticle.cs b/Particles/FlyParticle.cs new file mode 100644 index 0000000000..973441726c --- /dev/null +++ b/Particles/FlyParticle.cs @@ -0,0 +1,94 @@ +using System; +using CalamityMod.Systems.Graphic.TempParticleSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class FlyParticle : Particle + { + public float Opacity; + + private bool WasSpawnedWithAnchor; + + public Entity AnchorEntity { get; private set; } + + public Vector2 StoredPosition { get; private set; } + + public float HeightToNeverGoBelow { get; private set; } + + public FlyParticle(Vector2 position, float scale, int lifetime, Entity anchorEntity = null) + { + Position = position; + Scale = scale; + Lifetime = lifetime; + AnchorEntity = anchorEntity; + + if (anchorEntity == null) + { + StoredPosition = position; + HeightToNeverGoBelow = position.Y + 8f; + WasSpawnedWithAnchor = false; + } + else + { + WasSpawnedWithAnchor = true; + } + + Variant = Main.rand.Next(2); + Color = Color.White; + AffectedByLight = true; + } + + public override string Texture => "Terraria/Images/Extra_262"; + + public override bool SetLifetime => true; + + public override bool UseCustomDraw => true; + + public override int FrameVariants => 2; + + public override void Update() + { + if (WasSpawnedWithAnchor) + { + StoredPosition = AnchorEntity.Top; + HeightToNeverGoBelow = AnchorEntity.Top.Y + 8f; + if (!AnchorEntity.active || AnchorEntity == null) + { + Kill(); + return; + } + } + + Velocity += new Vector2(MathF.Sign(StoredPosition.X - Position.X) * 0.02f, MathF.Sign(StoredPosition.Y - Position.Y) * 0.02f); + if (Time % 30 == 0 && Main.rand.NextBool(2)) + { + Velocity = Main.rand.NextVector2Circular(1f, 1f); + if (Main.rand.NextBool(2)) + Velocity /= 2; + } + + if (Position.Y > HeightToNeverGoBelow) + { + Position.Y = HeightToNeverGoBelow; + if (Velocity.Y > 0f) + Velocity *= -1f; + } + + Variant = Time % 6 / 3; + int fadeInTime = (int)(Lifetime * 0.13f); + int fadeOutTime = (int)(Lifetime * 0.93f); + Opacity = Utils.GetLerpValue(0f, fadeInTime, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - fadeOutTime, Time, true); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Color lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint())); + Rectangle frame = GeneralParticleHandler.GetTexture(Type).Frame(1, FrameVariants, 0, Variant); + SpriteEffects effects = (Velocity.X > 0f) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, frame, lightColor * Opacity, Rotation, frame.Size() * 0.5f, Scale, effects, 0f); + } + } +} diff --git a/Particles/GraveyardMistParticle.cs b/Particles/GraveyardMistParticle.cs new file mode 100644 index 0000000000..262597d307 --- /dev/null +++ b/Particles/GraveyardMistParticle.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class GraveyardMistParticle : Particle + { + public float StretchFactor; + + public float BaseOpacity; + + public int Direction; + + public float Opacity { get; private set; } + + public int TextureIndex { get; private set; } + + public GraveyardMistParticle(Vector2 spawnPosition, Vector2 velocity, Color color, float scale, float baseOpacity, int lifetime, int textureIndex) + { + Position = spawnPosition; + Velocity = velocity; + Color = color; + Scale = scale; + BaseOpacity = baseOpacity; + Lifetime = lifetime; + TextureIndex = textureIndex; + StretchFactor = Main.rand.NextFloat(1f, 2f); + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool SetLifetime => true; + + public override bool UseCustomDraw => true; + + public override void Update() + { + float halfLifetime = Lifetime / 2; + Opacity = BaseOpacity * MathHelper.Lerp(0f, 1f, MathF.Sin(MathHelper.TwoPi * (Time / halfLifetime))); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D mistTexture = Main.Assets.Request("Images/Gore_" + TextureIndex).Value; + SpriteEffects spriteEffects = (Velocity.X > 0) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 scale = new Vector2(StretchFactor, 1f) * Scale; + spriteBatch.Draw(mistTexture, Position - Main.screenPosition, mistTexture.Frame(), Color * Opacity * 0.375f, Rotation, mistTexture.Frame().Size() * 0.5f, scale, spriteEffects, 0f); + } + } +} diff --git a/Particles/QuickSparkleParticle.cs b/Particles/QuickSparkleParticle.cs new file mode 100644 index 0000000000..ab4cad8d43 --- /dev/null +++ b/Particles/QuickSparkleParticle.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class QuickSparkleParticle : Particle + { + public float StoredScale; + + public float LightStrength; + + public bool EmitLight; + + public Vector2 StretchFactor; + + public QuickSparkleParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, Vector2? stretchFactor = null,bool emitLight = false, float lightStrength = 1.45f) + { + Position = position; + Velocity = velocity; + Color = color; + StoredScale = scale; + Lifetime = lifetime; + StretchFactor = stretchFactor ?? new(0.75f, 1.75f); + EmitLight = emitLight; + LightStrength = lightStrength; + } + + public override bool SetLifetime => true; + + public override bool UseAdditiveBlend => true; + + public override bool UseCustomDraw => true; + + public override string Texture => "CalamityMod/ExtraTextures/ShineFlare"; + + public override void Update() + { + Velocity *= 0.92f; + Scale = MathHelper.Lerp(0f, StoredScale, MathF.Sin(LifetimeCompletion * MathHelper.Pi)); + if (EmitLight) + Lighting.AddLight(Position, Color.ToVector3() * Scale * LightStrength); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color.White, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.1f, 0, 0f); + spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.2f, 0, 0f); + } + } +} diff --git a/Particles/RancorFog.cs b/Particles/RancorFog.cs new file mode 100644 index 0000000000..924ea7d408 --- /dev/null +++ b/Particles/RancorFog.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class RancorFog : Particle + { + private float Opacity = 0f; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public RancorFog(Vector2 position, Vector2 velocity, int lifetime, float scale, float rotation) + { + Position = position; + Velocity = velocity; + Lifetime = lifetime; + Scale = scale; + Rotation = rotation; + } + + public override void Update() + { + Rotation += Velocity.X * 0.004f; + Velocity *= 0.985f; + Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 90f, Time, true); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + float opacity = Opacity * 0.5f; + Color drawColor = new Color(236, 0, 68) * opacity; + Main.EntitySpriteDraw(texture, Position - Main.screenPosition, null, drawColor, Rotation, texture.Size() * 0.5f, Scale, SpriteEffects.None); + } + } +} diff --git a/Projectiles/Magic/RancorFog.png b/Particles/RancorFog.png similarity index 100% rename from Projectiles/Magic/RancorFog.png rename to Particles/RancorFog.png diff --git a/Particles/TimedSmokeParticle.cs b/Particles/TimedSmokeParticle.cs index 723f1cc0f8..6c869b9763 100644 --- a/Particles/TimedSmokeParticle.cs +++ b/Particles/TimedSmokeParticle.cs @@ -15,8 +15,9 @@ namespace CalamityMod.Particles private Color ColorStart; private Color ColorFade; private float Spin; + private bool FadeIn; - public TimedSmokeParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity, int timeleft, float rotationSpeed = 0f) + public TimedSmokeParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity, int timeleft, float rotationSpeed = 0f, bool fadeIn = false) { Position = position; Velocity = velocity; @@ -27,6 +28,7 @@ namespace CalamityMod.Particles Rotation = Main.rand.NextFloat(MathHelper.TwoPi); Spin = rotationSpeed; Lifetime = timeleft; + FadeIn = fadeIn; Variant = Main.rand.Next(3); } @@ -48,6 +50,9 @@ namespace CalamityMod.Particles Velocity -= Vector2.UnitY * 0.08f; float opacityMult = 1 - (float)Math.Pow(LifetimeCompletion, 2); + if (FadeIn) + opacityMult = 1f * MathF.Sin(LifetimeCompletion * MathHelper.Pi); + Color = Color.Lerp(ColorStart, ColorFade, opacityMult) * (Opacity * opacityMult); } } 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/BaseSporeSacProjectile.cs b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs index 9674720332..f666025365 100644 --- a/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSporeSacProjectile.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public Player Owner => Main.player[Projectile.owner]; public bool FadingOut => GeneralTimer > 5400f; public bool HomesInStronglyOnEnemies => Projectile.ai[1] == 1f; + public bool AvoidFadingOutIfHoming => Projectile.ai[2] == 1f; public ref float GeneralTimer => ref Projectile.ai[0]; public ref float PulseIncrement => ref Projectile.localAI[0]; public ref float MoveTimer => ref Projectile.localAI[1]; @@ -106,18 +107,21 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Fade in. Projectile.alpha = Utils.Clamp(Projectile.alpha - 10, 50, 255); - } - if (HomesInStronglyOnEnemies || Projectile.timeLeft < (3300 + PulseIncrement)) - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(HomeDistance); - if (potentialTarget != null) + if (HomesInStronglyOnEnemies || Projectile.timeLeft < (3300 + PulseIncrement)) { - if (HomesInStronglyOnEnemies) - Projectile.extraUpdates = 5; + NPC potentialTarget = Projectile.Center.ClosestNPCAt(HomeDistance); - Projectile.velocity = (Projectile.velocity * 10f + Projectile.SafeDirectionTo(potentialTarget.Center) * HomeSpeed) / 11f; - return; + if (potentialTarget != null) + { + if (HomesInStronglyOnEnemies) + Projectile.extraUpdates = 5; + if (AvoidFadingOutIfHoming) + GeneralTimer = 0f; + + Projectile.velocity = (Projectile.velocity * 10f + Projectile.SafeDirectionTo(potentialTarget.Center) * HomeSpeed) / 11f; + return; + } } } if (Projectile.velocity.Length() > 0.2f) 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/BrainOfCthulhu/BloodBomb.cs b/Projectiles/Boss/BrainOfCthulhu/BloodBomb.cs index 9caa3a9e92..cdcfeee813 100644 --- a/Projectiles/Boss/BrainOfCthulhu/BloodBomb.cs +++ b/Projectiles/Boss/BrainOfCthulhu/BloodBomb.cs @@ -127,7 +127,7 @@ public class BloodBomb : ModNPC, ILocalizedModType public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) { - if (modifiers.DamageType == TrueMeleeDamageClass.Instance) + if (modifiers.DamageType.CountsAsClass(TrueMeleeDamageClass.Instance)) { modifiers.FinalDamage *= 1.5f; return; @@ -143,7 +143,7 @@ public class BloodBomb : ModNPC, ILocalizedModType public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) { - if (modifiers.DamageType == TrueMeleeDamageClass.Instance) + if (modifiers.DamageType.CountsAsClass(TrueMeleeDamageClass.Instance)) { modifiers.FinalDamage *= 1.5f; return; diff --git a/Projectiles/Boss/BrainOfCthulhu/CrimsonEye.cs b/Projectiles/Boss/BrainOfCthulhu/CrimsonEye.cs index 59747e4788..5459c7f056 100644 --- a/Projectiles/Boss/BrainOfCthulhu/CrimsonEye.cs +++ b/Projectiles/Boss/BrainOfCthulhu/CrimsonEye.cs @@ -158,22 +158,6 @@ public class CrimsonEye : ModProjectile, ILocalizedModType if (DistanceRatio > 0) { - /* - Main.spriteBatch.SetBlendState(BlendState.Additive); - - Texture2D tex = ModContent.Request("CalamityMod/Particles/HollowCircleHardEdge").Value; - Color color = Color.Red * DistanceRatio; - if (Time <= 65) - color *= (Time - 45) / 20f; - - if (Projectile.timeLeft <= 20) - color *= Projectile.timeLeft / 20f; - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, color, 0f, tex.Size() * 0.5f, 1.75f, 0); - - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - */ - float opacity = DistanceRatio; if (Time <= 65) opacity *= (Time - 45) / 20f; diff --git a/Projectiles/Boss/CalamitousFireball.cs b/Projectiles/Boss/CalamitousFireball.cs index 03c0f5dcb0..3de7c71ac7 100644 --- a/Projectiles/Boss/CalamitousFireball.cs +++ b/Projectiles/Boss/CalamitousFireball.cs @@ -91,14 +91,6 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 240); } - public override bool PreDraw(ref Color lightColor) - { - return false; - - /* - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - */ - } + public override bool PreDraw(ref Color lightColor) => false; } } diff --git a/Projectiles/Boss/CataclysmicFlame.cs b/Projectiles/Boss/CataclysmicFlame.cs index 60179713e4..59ecbb93b0 100644 --- a/Projectiles/Boss/CataclysmicFlame.cs +++ b/Projectiles/Boss/CataclysmicFlame.cs @@ -106,60 +106,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool PreDraw(ref Color lightColor) - { - return false; - - /* - 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 - 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; - */ - } + public override bool PreDraw(ref Color lightColor) => false; } } diff --git a/Projectiles/Boss/CrimulanSpike.cs b/Projectiles/Boss/CrimulanSpike.cs deleted file mode 100644 index 4daf6e82f2..0000000000 --- a/Projectiles/Boss/CrimulanSpike.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class CrimulanSpike : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - private const int TimeLeft = 600; - private const int FadeOutTime = 30; - private float MaxVelocity => Projectile.ai[0]; - private float Acceleration => Projectile.ai[1]; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.hostile = true; - Projectile.penetrate = -1; - Projectile.timeLeft = TimeLeft; - } - - public override void AI() - { - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= Acceleration; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= MaxVelocity; - } - } - - if (Projectile.timeLeft < FadeOutTime) - Projectile.Opacity -= 1f / FadeOutTime; - - if (Main.rand.NextBool()) - { - Color dustColor = Color.Crimson; - dustColor.A = 150; - int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, DustID.TintableDust); - Main.dust[redSpiky].velocity *= 0.3f; - Main.dust[redSpiky].velocity += Projectile.velocity * 0.3f; - Main.dust[redSpiky].color = dustColor; - Main.dust[redSpiky].scale = 1.4f; - Main.dust[redSpiky].noGravity = true; - } - } - - public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = Projectile.ai[2] > 0f ? ModContent.Request("CalamityMod/Projectiles/Boss/CrimulanSpike" + ((int)Projectile.ai[2] + 1)).Value : TextureAssets.Projectile[Projectile.type].Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); - return false; - } - } -} diff --git a/Projectiles/Boss/CrimulanSpike.png b/Projectiles/Boss/CrimulanSpike.png deleted file mode 100644 index d6e65576a9..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike2.png b/Projectiles/Boss/CrimulanSpike2.png deleted file mode 100644 index 92b9a54542..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike2.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike3.png b/Projectiles/Boss/CrimulanSpike3.png deleted file mode 100644 index 01bcdccfa6..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike3.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike4.png b/Projectiles/Boss/CrimulanSpike4.png deleted file mode 100644 index ffa29a97aa..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike4.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike5.png b/Projectiles/Boss/CrimulanSpike5.png deleted file mode 100644 index 4b12092bf6..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike5.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike6.png b/Projectiles/Boss/CrimulanSpike6.png deleted file mode 100644 index 2804faaebc..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike6.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike7.png b/Projectiles/Boss/CrimulanSpike7.png deleted file mode 100644 index e5130f045c..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike7.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike8.png b/Projectiles/Boss/CrimulanSpike8.png deleted file mode 100644 index f39dc36563..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike8.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike9.png b/Projectiles/Boss/CrimulanSpike9.png deleted file mode 100644 index 56f28636fc..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike9.png and /dev/null differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 21e7016604..f4bf44ceb7 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -121,5 +122,11 @@ namespace CalamityMod.Projectiles.Boss } public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 120, true); + } } } 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 1b5bd9cb67..a88beb4dcf 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,16 +1,18 @@ using System; -using System.Linq; +using System.Collections.Generic; 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 ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -18,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() { @@ -64,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) { @@ -72,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) @@ -85,137 +102,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1); } - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.End(out var ss); - var device = Main.instance.GraphicsDevice; - - using (Main.spriteBatch.Scope()) - { - using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - 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 = FireColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = ProvUtils.GetProjectileColor(255,true); - float width = 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); - } - Main.spriteBatch.End(); - } - } - - using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) - { - - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - - Texture2D texture = Terraria.GameContent.TextureAssets.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); - - scale = new Vector2(1f, 1f); - texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - using (Main.spriteBatch.Scope()) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, baseColor2, 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.spriteBatch.End(); - } - Main.spriteBatch.End(); - } - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(ss); - 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) { @@ -249,5 +135,168 @@ namespace CalamityMod.Projectiles.Boss ProvUtils.ApplyDebuffs(target, 120); } + + public float FireWidthFunction(float completion) + { + 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); + } + + public Color FireColorFunction(float completion) + { + 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; + } + + 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. + DrawBurnOrb(); + DrawBurnOrbAdditive(); + return false; + } + + private void DrawBurnOrb() + { + 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() * 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; + + 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); + } + + private void DrawBurnOrbAdditive() + { + 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 7981939956..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,133 +101,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.End(out var ss); - var device = Main.instance.GraphicsDevice; - - using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) - { - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - 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 = FireCoreColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = new Color(0, 25, 0); - float width = 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); - } - Main.spriteBatch.End(); - } - - using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - - float vel = Projectile.velocity.Length() / 8; - Projectile.localAI[1] += vel; - - Texture2D drawTexture = Terraria.GameContent.TextureAssets.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, 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); - - 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); - var scale = new Vector2(1f, 1f); - var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - using (Main.spriteBatch.Scope()) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - 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.spriteBatch.End(); - } - Main.spriteBatch.End(); - } - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(ss); - 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); @@ -235,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/Boss/PermafrostMeat.cs b/Projectiles/Boss/PermafrostMeat.cs index 69adc783c8..7bc79ca487 100644 --- a/Projectiles/Boss/PermafrostMeat.cs +++ b/Projectiles/Boss/PermafrostMeat.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Food/DeliciousMeat"; - public override void SetDefaults() { Projectile.width = 30; diff --git a/Projectiles/Boss/PermafrostMeat.png b/Projectiles/Boss/PermafrostMeat.png new file mode 100644 index 0000000000..0fe6eb2cc4 Binary files /dev/null and b/Projectiles/Boss/PermafrostMeat.png differ diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index e40f6f9e35..1f605d1d5d 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class UnstableCrimulanGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override void SetDefaults() { Projectile.width = 30; @@ -28,9 +27,6 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.1f) * Projectile.Opacity; - Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); - // Fly up and then fall down if (Projectile.ai[0] == 1f) { @@ -62,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Crimson; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -75,7 +71,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 17ab17c58b..64838feff8 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class UnstableEbonianGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override void SetDefaults() { Projectile.width = 30; @@ -28,16 +27,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.5f) * Projectile.Opacity; - Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); - - if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f)) + if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive)) { float velocityMult = CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; - - if (Projectile.ai[0] == 1f) - velocityMult += 0.02f; - Projectile.velocity *= velocityMult; } @@ -48,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Lavender; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -61,7 +53,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2b1a9a0db7..5a4cf5ece1 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -95,6 +95,7 @@ namespace CalamityMod.Projectiles ///
* Reducing projectile damage for Hardmode enemies and in Master Mode. ///
* Adding armor penetration to rogue projectiles spawned while wearing Filthy Glove or its upgrades. ///
* Increasing the damage of projectiles from the post-Moon Lord Dungeon, and from the post-DoG Pumpkin Moon, Frost Moon, and Solar Eclipse. + ///
* Manually setting the extraUpdates fields of projectiles who use . ///
private bool frameOneHacksExecuted = false; @@ -227,6 +228,12 @@ namespace CalamityMod.Projectiles ///
public int defExtraUpdates = -1; + /// + /// Set this to a value higher than zero to have a projectile automatically have their extraUpdates field synced across all clients on a server when spawned.

+ /// Please ensure SyncProjectile (or simply is called after setting this. + ///
+ public int extraUpdatesToSync = 0; + /// /// How many times this projectile has pierced an enemy which applies pierce resist.
/// Used for calculating pierce resist damage reduction. @@ -316,7 +323,7 @@ namespace CalamityMod.Projectiles /// /// Custom update priority.
/// Calamity sorts projectiles by their update priority to fix otherwise absurdly difficult to resolve visual bugs on certain weapons.
- /// Examples include Void Eater Marionette segments detaching or Rancor's laser beam being offset from the magic circle. + /// Examples include Rancor's laser beam being offset from the magic circle. ///
public float UpdatePriority = 0f; @@ -324,6 +331,8 @@ namespace CalamityMod.Projectiles public int HomingTarget = -1; + public int storedYoyoDamage = 0; + /// /// Flag used during Rev+ Brain of Cthulhu to denote projectiles that were spawned prior to its Illusion Trick attack starting. /// @@ -343,10 +352,7 @@ namespace CalamityMod.Projectiles // Whenever the player has Daawnlight Spirit Origin, any ranged projectile will have the capacity to infintely supercrit. if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass()) - { - projectile.CritChance += Main.player[projectile.owner].Calamity().spiritOriginCritBoost; projectile.Calamity().supercritHits = -1; - } if (projectile.type == ProjectileID.VolatileGelatinBall && projectile.GetSource_FromThis() == Main.player[projectile.owner].GetSource_Accessory(Main.player[projectile.owner].Calamity().FindAccessory(ItemID.VolatileGelatin))) { @@ -457,10 +463,12 @@ namespace CalamityMod.Projectiles public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) { binaryWriter.Write(ParentNPCIndex); + binaryWriter.Write(extraUpdatesToSync); } public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) { ParentNPCIndex = binaryReader.ReadInt32(); + extraUpdatesToSync = binaryReader.ReadInt32(); } #endregion On Spawn @@ -498,8 +506,10 @@ namespace CalamityMod.Projectiles if (ProjectileID.Sets.LightPet[projectile.type] && Main.LocalPlayer.Calamity().ZoneAbyss) EnhancedDarknessSystem.lights.Add(new() { center = projectile.Center, scale = 1 }); - if (projectile.bobber && projectile.type != ProjectileType() && RunFishingMinigames(projectile) && !Main.LocalPlayer.dead) + // 24DEC2025: Ozzatron: victide bobber culled with SSO + if (projectile.bobber /*&& projectile.type != ProjectileType()*/ && RunFishingMinigames(projectile) && !Main.LocalPlayer.dead) return false; + //Reset the Homing Target immediately before AI can re-set it on applicable projectiles HomingTarget = -1; #region Vanilla Summons AI Changes @@ -536,16 +546,16 @@ namespace CalamityMod.Projectiles if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == ProjAIStyleID.Yoyo) { // Store damage on first frame - if (projectile.localAI[2] == 0f) - projectile.localAI[2] = projectile.damage; + if (storedYoyoDamage == 0f) + storedYoyoDamage = projectile.damage; var MainYoyo = Main.projectile.First(x => x.active && x.type == projectile.type && x.owner == projectile.owner).whoAmI; // Halve damage if not the main yoyo if (projectile.whoAmI != MainYoyo) - projectile.damage = (int)(projectile.localAI[2] * 0.5f); + projectile.damage = (int)(storedYoyoDamage * 0.5f); else - projectile.damage = (int)projectile.localAI[2]; + projectile.damage = storedYoyoDamage; } if (projectile.minion && ExplosiveEnchantCountdown > 0) @@ -3010,6 +3020,7 @@ namespace CalamityMod.Projectiles public float PersistentFishingData = -1; /// public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) { var owner = Main.player[projectile.owner]; @@ -3018,12 +3029,6 @@ namespace CalamityMod.Projectiles bool reelingIn = projectile.ai[0] == 1; bool lineSnapped = projectile.ai[0] == 2; - //Make sure Victide Snail actually fishes when using a minigame rod - foreach (var item in Main.ActiveProjectiles) - { - if (item.type == ProjectileType() && item.owner == projectile.owner) - item.ModProjectile().PlayerFishingTimer = 600; - } #region Utilities void SmallSplashAtOffset(Vector2 offset) { @@ -3368,7 +3373,7 @@ namespace CalamityMod.Projectiles foreach (var item in Main.ActiveProjectiles) { - if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) { validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); } @@ -3762,7 +3767,7 @@ namespace CalamityMod.Projectiles foreach (var item in Main.ActiveProjectiles) { - if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) { validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); } @@ -3826,22 +3831,27 @@ namespace CalamityMod.Projectiles } bool pulledNPC = Main.rand.NextBool(TrustyOldRod.enemyChance.Item1, TrustyOldRod.enemyChance.Item2); + if (owner.HeldItem.type == ModContent.ItemType() && reelingIn && projectile.ai[1] != 0 && projectile.localAI[1] != 0 && pulledNPC) { // Remove any item you would have fished up projectile.ai[1] = 0; // Get rarity of pull - int rarity = 0; + int rarity; int roll = Main.rand.Next(1, 100 + 1); if (roll == 1) rarity = 3; // UltraRare (1/100) else if (roll <= 21) rarity = 2; // Rare ~(1/5) else rarity = 1; // Common ~(4/5) - TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet); + if (Main.netMode == NetmodeID.MultiplayerClient && Main.myPlayer == owner.whoAmI) + TrustyOldRodEnemyPacket.Send(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); + else if(Main.netMode == NetmodeID.SinglePlayer) + TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); + + TrustyOldRodEnemySystem.DoTrustyOldRodVFX(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); projectile.ai[0] = 2; // snap line return false; } - return false; } #endregion @@ -3854,6 +3864,9 @@ namespace CalamityMod.Projectiles if (!frameOneHacksExecuted) { + if (extraUpdatesToSync > 0) + projectile.extraUpdates = extraUpdatesToSync; + if (projectile.hostile) { // Reduce Nail damage from Nailheads because they're stupid @@ -3981,6 +3994,12 @@ namespace CalamityMod.Projectiles if (projectile.aiStyle == ProjAIStyleID.Flare && projectile.ai[2] == 1f && projectile.localAI[0] == 0f) projectile.localAI[1]--; + if (projectile.type == ProjectileID.BoneArrowFromMerchant) // Bone arrow no gravity before hitting tile + { + if (projectile.ai[2] != 1) + projectile.ai[0] = 0; + } + // Hack to allow Desert Tiger minion to fall through platforms while attacking if (projectile.type >= ProjectileID.StormTigerTier1 && projectile.type <= ProjectileID.StormTigerTier3) { @@ -4767,6 +4786,22 @@ namespace CalamityMod.Projectiles modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } + if (projectile.type == ProjectileID.UnholyArrow) // damage falloff + { + if (projectile.numHits > 0) + projectile.damage = (int)(projectile.damage * 0.75f / 0.95f); // Vanilla gives it 5% falloff, this cancels that out + if (projectile.damage < 1) + projectile.damage = 1; + } + + if (projectile.type == ProjectileID.HellfireArrow) // damage falloff + { + if (projectile.numHits > 0) + projectile.damage = (int)(projectile.damage * 0.8f); + if (projectile.damage < 1) + projectile.damage = 1; + } + // Adamantite Throwing Axe's lightning has damage falloff if (projectile.type == ProjectileID.CultistBossLightningOrbArc && projectile.ai[2] == 1f) { @@ -5098,6 +5133,26 @@ namespace CalamityMod.Projectiles #region TileCollide public override bool OnTileCollide(Projectile projectile, Vector2 oldVelocity) { + if (projectile.type == ProjectileID.BoneArrowFromMerchant) // Bone arrow bounce + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + projectile.timeLeft -= 120; + if (projectile.timeLeft < 1) + projectile.timeLeft = 1; + + if (projectile.ai[2] != 1) + SoundEngine.PlaySound(SoundID.NPCHit2 with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, 0.3f), MaxInstances = 10 }, projectile.Center); + projectile.ai[2] = 1; + + return false; + } //Crystal Darts use -1 local that needs to reset whenever they bounce if (projectile.type == ProjectileID.CrystalDart) { @@ -5183,8 +5238,7 @@ namespace CalamityMod.Projectiles return initialColor; } - if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera || - projectile.type == ProjectileID.CultistBossFireBallClone || projectile.type == ProjectileID.AncientDoomProjectile) + if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera) { if (projectile.timeLeft < 85) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 072e1ddb65..3a6f1fa8dd 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) - { ProjectileID.HellfireArrow, Do(ExtraUpdatesDelta(+2)) }, + { ProjectileID.HellfireArrow, Do(ExtraUpdatesDelta(+2), LocalIFrames(-1)) }, { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, { ProjectileID.IchorBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, @@ -300,7 +300,7 @@ namespace CalamityMod.Projectiles { ProjectileID.BombFish, defaultIFrames }, { ProjectileID.Bone, defaultIFrames }, { ProjectileID.BoneArrow, defaultIFrames }, - { ProjectileID.BoneArrowFromMerchant, defaultIFrames }, + { ProjectileID.BoneArrowFromMerchant, Do(ExtraUpdatesExact(2), LocalIFrames(-1)) }, { ProjectileID.BoneDagger, defaultIFrames }, { ProjectileID.BookOfSkullsSkull, defaultIFrames }, { ProjectileID.BookStaffShot, defaultIFrames }, @@ -413,7 +413,7 @@ namespace CalamityMod.Projectiles { ProjectileID.IchorDart, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.JackOLantern, defaultIFrames }, { ProjectileID.JavelinFriendly, defaultIFrames }, - { ProjectileID.JestersArrow, defaultIFrames }, + { ProjectileID.JestersArrow, Do(LocalIFrames(-1)) }, { ProjectileID.Landmine, defaultIFrames }, { ProjectileID.LaserMachinegun, defaultIFrames }, { ProjectileID.LaserMachinegunLaser, defaultIFrames }, @@ -580,7 +580,7 @@ namespace CalamityMod.Projectiles { ProjectileID.TruffleSpore, defaultIFrames }, { ProjectileID.UFOLaser, defaultIFrames }, { ProjectileID.UFOMinion, defaultIFrames }, - { ProjectileID.UnholyArrow, defaultIFrames }, + { ProjectileID.UnholyArrow, Do(LocalIFrames(-1)) }, { ProjectileID.UnholyTridentFriendly, defaultIFrames }, { ProjectileID.UnholyWater, defaultIFrames }, { ProjectileID.VampireKnife, defaultIFrames }, diff --git a/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs index 22e3b48d87..e3b3d53418 100644 --- a/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs +++ b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs @@ -88,19 +88,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal modifiers.HideCombatText(); } - public override void OnKill(int timeLeft) - { - /* - for (int i = 0; i < 7; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 267); - dust.velocity = (Projectile.velocity * 3 * Projectile.scale).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f); - dust.scale = Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale; - dust.noGravity = true; - dust.color = Color.Red; - } - */ - } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { overPlayers.Add(index); diff --git a/Projectiles/DraedonsArsenal/AugerSlash.cs b/Projectiles/DraedonsArsenal/AugerSlash.cs index 4010a6be88..10660af22a 100644 --- a/Projectiles/DraedonsArsenal/AugerSlash.cs +++ b/Projectiles/DraedonsArsenal/AugerSlash.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); float launchPower = (Projectile.ai[2] == 5 ? 35 : 14); - target.MoveNPC(launchVel, launchPower, true, Owner); + target.MoveNPC(launchVel, launchPower, Projectile.ai[2] == 5, Owner); if (Projectile.ai[2] == 5) modifiers.ApplyScalingForcedCrit(Projectile); diff --git a/Projectiles/Enemy/AnglerFlash.cs b/Projectiles/Enemy/AnglerFlash.cs deleted file mode 100644 index 47879ee90d..0000000000 --- a/Projectiles/Enemy/AnglerFlash.cs +++ /dev/null @@ -1,61 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Enemy -{ - public class AnglerFlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 100; - Projectile.hostile = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft = 30; - Projectile.localNPCHitCooldown = -1; - Projectile.usesLocalNPCImmunity = true; - } - - public override void AI() - { - if (Projectile.ai[0] == 0) - { - GeneralParticleHandler.SpawnParticle(new BloomParticle(Projectile.Center, Vector2.Zero, Color.LightCyan, 1, 3, 30, true)); - Projectile.ai[0] = 1; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 100, targetHitbox); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override bool? CanHitNPC(NPC target) - { - if (LazarusLampfish.PredatorList.Contains(target.type)) - { - return true; - } - return null; - } - } -} diff --git a/Projectiles/Enemy/GhostBellShock.cs b/Projectiles/Enemy/GhostBellShock.cs deleted file mode 100644 index 56159811df..0000000000 --- a/Projectiles/Enemy/GhostBellShock.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class GhostBellShock : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - // Max aura size not accounting for babies - public static int MaxDefaultRadius => 160; - - // How much does each baby boost the size of the aura - public static int RadiusBoostPerBaby => 10; - - // Stores the ring points - public List points = []; - - // Stores the bolts which connect from the center to the ring - public List> bolts = []; - - // Stores the bolts which connect to babies - public List> jellyBolts = []; - - // Generic timer - public ref float Timer => ref Projectile.ai[0]; - // The jelly - public ref float Parent => ref Projectile.ai[1]; - // Size of the aura - public ref float CurrentRadius => ref Projectile.ai[2]; - // How many valid babies exist - public ref float CurrentBabies => ref Projectile.localAI[0]; - - public override void SetDefaults() - { - Projectile.width = MaxDefaultRadius * 2; - Projectile.height = MaxDefaultRadius * 2; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.alpha = 255; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - CurrentBabies = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(CurrentBabies); - } - - public override void OnSpawn(IEntitySource source) - { - RecalculateLists(); - } - - public override void AI() - { - bool validOwner = true; - int impactMoment = GhostBell.ElectrifyingPhaseDischarge; - - NPC n = Main.npc[(int)Parent - 1]; - if (n == null || !n.active || n.life < 0) - { - validOwner = false; - } - else - { - Projectile.Center = n.Center; - } - // Recalculate the prims to animate the lightning - if (Projectile.ai[0] % 5 == 0) - { - RecalculateLists(); - } - // Scale the aura size. More babies increases the size of the aura - CurrentRadius = MathHelper.Lerp(0, MaxDefaultRadius + (CurrentBabies * RadiusBoostPerBaby), Utils.GetLerpValue(impactMoment, impactMoment + 10, Timer, true)); - if (Timer == 0 && CurrentBabies > 0) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Pitch = 1f }, Projectile.Center); - } - Timer++; - float pitch = (CurrentBabies > 0 && Timer < impactMoment) ? 1f : 0.4f; - if (Timer % 10 == 0 && (Timer >= impactMoment || CurrentBabies > 0)) - { - SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = pitch }, Projectile.Center); - } - if (Timer == impactMoment) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.Center); - } - if (CurrentBabies > 0 || Timer >= impactMoment) - Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(CurrentRadius, CurrentRadius), DustID.Electric); - // Become opaque - if (Timer < (40 + impactMoment) && validOwner) - { - if (Projectile.alpha > 0) - Projectile.alpha -= 20; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - // become transparent and die - else - { - Projectile.alpha += 20; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } - } - } - - public void RecalculateLists() - { - int ringPoints = 60; // How many times can the ring bend - int boltPoints = 12; // How many times can a bolt bend - int minimumBolts = 6; // Minimum number of bolts - int maximumBolts = 12; // Maximum number of bolts - //int minimumSplits = 0; // Minimum number of split bolts - //int maximumSplits = 2; // Maximum number of split bolts - points.Clear(); - bolts.Clear(); - jellyBolts.Clear(); - for (int i = 0; i < ringPoints; i++) - { - // The radius of the aura. Randomized to be electricky - float rad = CurrentRadius + Main.rand.Next(-20, 20); - // Determinte the end point - // This creates a circle with the given radius - Vector2 end = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi + MathHelper.ToRadians(15), (i + 1) / (float)ringPoints)) * rad; - points.Add(Projectile.Center + end); - - // Randomly create more electric bolts that connect from the center to the ring - if (Main.rand.NextBool(ringPoints / Main.rand.Next(minimumBolts, maximumBolts))) - { - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = Projectile.Center + end.RotatedByRandom(MathHelper.PiOver4); - - bolt.Add(start); - for (int j = 0; j < boltPoints; j++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (j + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(10)); - bolt.Add(newPoint); - - // UNUSED code that occasionally gives bolts their own smaller bolts - /*if (Main.rand.NextBool(boltPoints / Main.rand.Next(minimumSplits + 1, maximumSplits + 1)) && j > boltPoints / 2) - { - Main.NewText("Made a bolt"); - List boltSplit = []; - boltSplit.Add(newPoint); - for (int k = 0; k < boltPoints; k++) - { - Vector2 destSplit = Vector2.Lerp(newPoint, Projectile.Center + end.RotatedBy(MathHelper.PiOver4), (k + 1) / (float)boltPoints); - Vector2 difSplit = destSplit - newPoint; - Vector2 newPointSplit = newPoint + difSplit.RotatedByRandom(MathHelper.ToRadians(10)); - boltSplit.Add(newPointSplit); - } - boltSplit.Add(Projectile.Center + end.RotatedBy(MathHelper.PiOver4)); - bolts.Add(boltSplit); - }*/ - } - bolt.Add(boltEnd); - bolts.Add(bolt); - } - - // Re-add the first point so that the trail can form a full circle - if (i == ringPoints - 1) - { - points.Add(points[0]); - } - } - - // Count how many baby jellies exist and tie lightning to them - CurrentBabies = 0; - foreach (NPC n in Main.ActiveNPCs) - { - if (n.type != ModContent.NPCType()) - continue; - if (n.Distance(Projectile.Center) > 400) - continue; - - CurrentBabies++; - - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = n.Center; - - bolt.Add(start); - for (int i = 0; i < boltPoints; i++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (i + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(4)); - bolt.Add(newPoint); - } - bolt.Add(boltEnd); - jellyBolts.Add(bolt); - } - - Projectile.netUpdate = true; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.alpha <= 0 && CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius, targetHitbox); - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); - float opacity = 0.6f; - float jellyOpacity = 0.2f; - if (Timer >= GhostBell.ElectrifyingPhaseDischarge) - { - // The aura - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 4, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - // Bolts inside of the aura - for (int i = 0; i < bolts.Count; i++) - { - List boltPoints = bolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 3, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - } - // Harmless bolts connecting to babies - for (int i = 0; i < jellyBolts.Count; i++) - { - List boltPoints = jellyBolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 2, (float completion, Vector2 vertexPos) => Color.Cyan * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - Main.spriteBatch.ExitShaderRegion(); - return false; - } - } -} diff --git a/Projectiles/Enemy/HorribleHogChargeHitbox.cs b/Projectiles/Enemy/HorribleHogChargeHitbox.cs new file mode 100644 index 0000000000..b98444cdde --- /dev/null +++ b/Projectiles/Enemy/HorribleHogChargeHitbox.cs @@ -0,0 +1,56 @@ +using CalamityMod.NPCs.NormalNPCs.HorribleHog; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogChargeHitbox : ModProjectile, ILocalizedModType + { + public ref float HogIndex => ref Projectile.ai[0]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 28; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.hide = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanHitNPC(NPC target) => target.whoAmI != (int)HogIndex; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.FinalDamage *= 5f; + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.Knockback *= 0f; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.velocity.X += 8f * info.HitDirection; + target.velocity.Y -= 3f; + } + + public override void AI() + { + if (!Main.npc.IndexInRange((int)HogIndex) || !Main.npc[(int)HogIndex].active || Main.npc[(int)HogIndex].type != ModContent.NPCType()) + { + Projectile.Kill(); + return; + } + + Projectile.Center = Main.npc[(int)HogIndex].Center; + Projectile.velocity = Main.npc[(int)HogIndex].velocity; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogRubble.cs b/Projectiles/Enemy/HorribleHogRubble.cs new file mode 100644 index 0000000000..addde8fd5c --- /dev/null +++ b/Projectiles/Enemy/HorribleHogRubble.cs @@ -0,0 +1,100 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogRubble : ModProjectile, ILocalizedModType + { + public int FrameX; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.DeerclopsRangedProjectile; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.scale = 0f; + Projectile.hostile = true; + } + + public override void OnSpawn(IEntitySource source) + { + Projectile.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + FrameX = Main.rand.Next(3); + } + + public override void AI() + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.25f); + Projectile.ExpandHitboxBy(Projectile.scale); + + Projectile.rotation += Projectile.velocity.X * 0.035f; + if (Projectile.velocity.Y < 8f) + Projectile.velocity.Y += 0.165f; + + if (Projectile.timeLeft <= 250) + Projectile.velocity.X *= 0.92f; + } + + public override void OnKill(int timeLeft) + { + int dustCloudAmt = Main.rand.Next(3, 6); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 velocity = Main.rand.NextVector2Circular(3f, 3f); + Color color = Color.Lerp(Color.SaddleBrown, Color.SandyBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + SmallSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(1.6f, 1.8f), Main.rand.Next(75, 100), rotationSpeed); + GeneralParticleHandler.SpawnParticle(dustCloud, true); + } + + int dustAmt = Main.rand.Next(6, 9); + for (int i = 0; i < dustAmt; i++) + { + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 velocity = Main.rand.NextVector2Circular(3f, 3f); + Dust.NewDust(spawnPosition, 0, 0, DustID.Dirt, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f)); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(3, Main.projFrames[Type], FrameX, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + SpriteEffects spriteEffects = Projectile.spriteDirection < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; ++i) + { + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, frame, Projectile.GetAlpha(lightColor) * 0.3f * interpolant, Projectile.rotation, origin, Projectile.scale * interpolant, spriteEffects, 0f); + } + } + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogShockwave.cs b/Projectiles/Enemy/HorribleHogShockwave.cs new file mode 100644 index 0000000000..778b36dd6f --- /dev/null +++ b/Projectiles/Enemy/HorribleHogShockwave.cs @@ -0,0 +1,132 @@ +using System; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogShockwave : ModProjectile, ILocalizedModType + { + public ref float Timer => ref Projectile.ai[0]; + + public ref float HeightMultiplier => ref Projectile.ai[1]; + + public ref float HogIndex => ref Projectile.ai[2]; + + public float CurrentHeight => 32f * MathHelper.Lerp(1f, HeightMultiplier, Timer / 9f); + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center - Vector2.UnitY * CurrentHeight * Projectile.scale, Projectile.width * Projectile.scale, ref _); + } + + public override bool? CanHitNPC(NPC target) => target.whoAmI != (int)HogIndex; + + // Player knockback is constant and applies whenever any damage is dealt, regardless of if a projectile spawned deals zero knockback or not. + // Therefore, the knockback stat modifier here needs to be multiplied by zero in order for any custom knockback effect to take place. + // This isn't the same for NPCs, so they don't need it so long as the projectile is spawned with zero knockback. + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.Knockback *= 0f; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.FinalDamage *= 5f; + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.velocity.Y -= MathHelper.Clamp(8f + (CurrentHeight * 0.1f), 8f, 16f); + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.velocity.Y -= MathHelper.Clamp(8f + (CurrentHeight * 0.1f) * target.knockBackResist, 8f, 16f); + + public override void AI() + { + if (Timer >= 9f) + { + Projectile.Kill(); + return; + } + + if (Timer == 1f) + SoundEngine.PlaySound(SoundID.Item70, Projectile.Center); + + Projectile.velocity = Vector2.Zero; + + Point topLeft = Projectile.TopLeft.ToTileCoordinates(); + Point bottomRight = Projectile.BottomRight.ToTileCoordinates(); + int halfWidth = Projectile.width / 2; + int dustSpawnInterval = (int)Projectile.ai[0] / 3; + + Timer++; + if (Timer % 3 != 0f) + return; + + float heightMulti = MathHelper.Lerp(1f, HeightMultiplier, Timer / 9f); + int dustCloudAmt = Main.rand.Next(4, 7); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 dustCloudPosition = Projectile.Bottom + Main.rand.NextVector2Circular(24f, 0f); + Vector2 dustVelocity = Vector2.UnitY * -1.3f * heightMulti * i * Main.rand.NextFloat(0.8f, 1.2f); + Color dustCloudColor = Color.Lerp(Color.SandyBrown, Color.SandyBrown, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + TimedSmokeParticle dustCloud = new(dustCloudPosition, dustVelocity, dustCloudColor, dustCloudColor, Main.rand.NextFloat(0.7f, 0.8f), Main.rand.NextFloat(0.72f, 0.84f), Main.rand.Next(30, 45), rotationSpeed); + GeneralParticleHandler.SpawnParticle(dustCloud, true, Enums.GeneralDrawLayer.BeforeSolidTiles); + } + + for (int i = topLeft.X; i <= bottomRight.X; i++) + { + for (int j = topLeft.Y; j <= bottomRight.Y; j++) + { + if (Vector2.Distance(Projectile.Center, new Vector2(i * 16f, j * 16f)) > halfWidth) + continue; + + Tile tile = Framing.GetTileSafely(i, j); + if (!tile.HasTile || !Main.tileSolid[tile.TileType] || Main.tileSolidTop[tile.TileType] || Main.tileFrameImportant[tile.TileType]) + continue; + + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + if (tileAbove.HasTile && Main.tileSolid[tileAbove.TileType] && !Main.tileSolidTop[tileAbove.TileType]) + continue; + + int dustCountFromTile = WorldGen.KillTile_GetTileDustAmount(fail: true, tile, i, j); + for (int k = 0; k < dustCountFromTile; k++) + { + Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tile)]; + dust.velocity.Y -= 3f + dustSpawnInterval * 1.5f * HeightMultiplier; + dust.velocity.Y *= Main.rand.NextFloat(); + dust.velocity.Y *= 0.75f; + dust.scale += dustSpawnInterval * 0.03f; + } + + if (dustSpawnInterval >= 2) + { + for (int m = 0; m < dustCountFromTile - 1; m++) + { + Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tile)]; + dust.velocity.Y -= 1f + dustSpawnInterval * HeightMultiplier; + dust.velocity.Y *= Main.rand.NextFloat(); + dust.velocity.Y *= 0.75f; + } + } + } + } + } + } +} diff --git a/Projectiles/Enemy/HorribleHogShockwaveSpawner.cs b/Projectiles/Enemy/HorribleHogShockwaveSpawner.cs new file mode 100644 index 0000000000..c1308fb433 --- /dev/null +++ b/Projectiles/Enemy/HorribleHogShockwaveSpawner.cs @@ -0,0 +1,120 @@ +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogShockwaveSpawner : ModProjectile, ILocalizedModType + { + public int OwnerIndex; + + public int ShockwaveCounter; + + public int Timer; + + public ref float SpawnInterval => ref Projectile.ai[0]; + + public ref float MaxShockwaves => ref Projectile.ai[1]; + + public ref float Direction => ref Projectile.ai[2]; + + public ref float MinHeightMultiplier => ref Projectile.localAI[0]; + + public ref float MaxHeightMultiplier => ref Projectile.localAI[1]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = -1; + Projectile.hide = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(OwnerIndex); + writer.Write(ShockwaveCounter); + writer.Write(Timer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + OwnerIndex = reader.ReadInt32(); + ShockwaveCounter = reader.ReadInt32(); + Timer = reader.ReadInt32(); + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanHitNPC(NPC target) => false; + + public override bool CanHitPlayer(Player target) => false; + + public override void AI() + { + if (ShockwaveCounter >= MaxShockwaves) + { + Projectile.Kill(); + return; + } + + Direction = MathHelper.Clamp(Direction, -1, 1); + if (Direction == 0) + { + Direction = Main.rand.NextBool().ToDirectionInt(); + Projectile.netUpdate = true; + } + + if (Timer % SpawnInterval == 0f) + { + Vector2 shockwaveSpawnPosition = new(); + + int spawnAttempts = 20; + int shockwaveSpawnDistance = 32 * (int)ShockwaveCounter * (int)Direction; + Point bottomInTileCoords = (Projectile.Bottom + Vector2.UnitX * shockwaveSpawnDistance).ToTileCoordinates(); + for (int i = 0; i < spawnAttempts; i++) + { + int posX = bottomInTileCoords.X; + int posY = bottomInTileCoords.Y - i; + Tile tileAbove = CalamityUtils.ParanoidTileRetrieval(posX, posY - 1); + if (WorldGen.ActiveAndWalkableTile(posX, posY) && !tileAbove.HasTile) + { + shockwaveSpawnPosition = new Point(posX, posY).ToWorldCoordinates(); + break; + } + } + + for (int i = 0; i < spawnAttempts; i++) + { + int posX = bottomInTileCoords.X; + int posY = bottomInTileCoords.Y + i; + if (WorldGen.ActiveAndWalkableTile(posX, posY)) + { + shockwaveSpawnPosition = new Point(posX, posY).ToWorldCoordinates(); + break; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float shockwaveHeight = MathHelper.Lerp(MinHeightMultiplier, MaxHeightMultiplier, ShockwaveCounter / MaxShockwaves); + Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), shockwaveSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, ai1: shockwaveHeight, ai2: OwnerIndex); + } + + ShockwaveCounter++; + } + + Timer++; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogVomitBomb.cs b/Projectiles/Enemy/HorribleHogVomitBomb.cs new file mode 100644 index 0000000000..8df3367964 --- /dev/null +++ b/Projectiles/Enemy/HorribleHogVomitBomb.cs @@ -0,0 +1,196 @@ +using CalamityMod.Effects; +using CalamityMod.Particles; +using CalamityMod.Utilities.Daybreak; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogVomitBomb : ModProjectile, ILocalizedModType + { + public bool HasExplodedYet + { + get => Projectile.ai[0] == 1f; + set => Projectile.ai[0] = value.ToInt(); + } + + public ref float HogIndex => ref Projectile.ai[1]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.Bomb; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.scale = 0f; + Projectile.hostile = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override bool? CanHitNPC(NPC target) => target.whoAmI != (int)HogIndex; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.FinalDamage *= 5f; + + public override void AI() + { + if (!HasExplodedYet && Projectile.timeLeft <= 1) + { + Explode(); + return; + } + + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.25f); + Projectile.ExpandHitboxBy(Projectile.scale); + Projectile.spriteDirection = Projectile.direction; + + Projectile.rotation += Projectile.velocity.X * 0.035f; + if (Projectile.velocity.Y < 8f) + Projectile.velocity.Y += 0.125f; + + Vector2 dustPosition = Projectile.Center + new Vector2(4f, -14f).RotatedBy(Projectile.rotation); + Dust.NewDustPerfect(dustPosition, DustID.Torch, Vector2.UnitY * -2f, Scale: 0.8f); + + int vomitAmt = Main.rand.Next(1, 3); + for (int i = 0; i < vomitAmt; i++) + { + Vector2 velocity = Projectile.oldVelocity * Main.rand.NextFloat(-0.8f, -0.6f); + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + int dust = Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1f, 1.4f)); + Main.dust[dust].noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 velocity = Projectile.oldVelocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(-1.8f, -0.6f) * Projectile.direction; + Color color = Color.Lerp(Color.DarkOliveGreen, Color.Green, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle vomit = new(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), velocity, color, color, Main.rand.NextFloat(0.4f, 0.6f), Main.rand.NextFloat(0.8f, 1f), Main.rand.Next(25, 35), rotationSpeed); + GeneralParticleHandler.SpawnParticle(vomit, false, Enums.GeneralDrawLayer.BeforeProjectiles); + } + } + + private void Explode() + { + Projectile.knockBack = 8f; + Projectile.tileCollide = false; + Projectile.hostile = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 6; + Projectile.velocity *= 0f; + Projectile.ExpandHitboxBy(80, 80); + + int dustCloudAmt = Main.rand.Next(12, 17); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 spawnPosition = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(8f, 8f); + Color color = Color.Lerp(Color.OrangeRed, Color.Orange, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle explosionCloud = new(spawnPosition, velocity, new Color(10, 10, 10), color, Main.rand.NextFloat(1.2f, 1.4f), 1f, Main.rand.Next(20, 30), rotationSpeed); + GeneralParticleHandler.SpawnParticle(explosionCloud, true); + } + + int sparkAmt = Main.rand.Next(7, 13); + for (int i = 0; i < sparkAmt; i++) + { + Vector2 spawnPosition = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(8f, 8f); + Color color = Color.Lerp(Color.Yellow, Color.Orange, Main.rand.NextFloat()); + + SparkParticle explosionSpark = new(spawnPosition, velocity, false, Main.rand.Next(20, 30), Main.rand.NextFloat(1f, 1.2f), color); + GeneralParticleHandler.SpawnParticle(explosionSpark, true); + } + + int dustAmt = Main.rand.Next(6, 9); + for (int i = 0; i < dustAmt; i++) + { + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 velocity = Main.rand.NextVector2Circular(8f, 8f); + Dust.NewDust(spawnPosition, 0, 0, DustID.Torch, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1.2f, 1.6f)); + } + + CalamityUtils.AddScreenshakeAt(Projectile.Center, 3f); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); + Projectile.ai[0] = 1f; + Projectile.netUpdate = true; + } + + public override bool PreKill(int timeLeft) + { + if (!HasExplodedYet) + { + Explode(); + return false; + } + + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Explode(); + return false; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + int targetIndex = Player.FindClosest(Projectile.Center, 1, 1); + Player target = Main.player[targetIndex]; + if (Projectile.Center.Y > target.Center.Y - 48f) + fallThrough = false; + + return true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 origin = texture.Size() * 0.5f; + SpriteEffects spriteEffects = Projectile.spriteDirection < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float timeLeftInterpolant = Utils.Remap(Projectile.timeLeft, 75, 0, 1f, 0f, true); + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; ++i) + { + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float trailLengthInterpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Color afterimageColor = Projectile.GetAlpha(Color.Orange) * 0.5f * trailLengthInterpolant * (1f - timeLeftInterpolant); + + Main.spriteBatch.Draw(texture, afterimageDrawPosition, null, afterimageColor, Projectile.rotation, origin, Projectile.scale * trailLengthInterpolant, spriteEffects, 0f); + } + } + + using (Main.spriteBatch.Scope()) + { + Effect tintShader = CalamityShaders.BasicTintShader.Value; + tintShader.Parameters["uColor"].SetValue(Color.White.ToVector3()); + tintShader.Parameters["uOpacity"].SetValue(1f - timeLeftInterpolant); + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, tintShader, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); + Main.spriteBatch.End(); + } + + return false; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogVomitChunk.cs b/Projectiles/Enemy/HorribleHogVomitChunk.cs new file mode 100644 index 0000000000..640d3da251 --- /dev/null +++ b/Projectiles/Enemy/HorribleHogVomitChunk.cs @@ -0,0 +1,145 @@ +using CalamityMod.Particles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogVomitChunk : ModProjectile, ILocalizedModType + { + private static Asset[] VomitChunkTextures; + + private string[] VomitChunkTexturePaths = new string[] + { + "Terraria/Images/Gore_3", + "Terraria/Images/Gore_154", + "Terraria/Images/Gore_241", + "Terraria/Images/Gore_243", + "Terraria/Images/Gore_246", + "Terraria/Images/Gore_262", + "Terraria/Images/Gore_722", + "Terraria/Images/Gore_1214" + }; + + public ref float TextureVariant => ref Projectile.ai[0]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + { + VomitChunkTextures = new Asset[VomitChunkTexturePaths.Length]; + for (int i = 0; i < VomitChunkTexturePaths.Length; i++) + VomitChunkTextures[i] = ModContent.Request(VomitChunkTexturePaths[i]); + } + } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.scale = 0f; + Projectile.hostile = true; + } + + public override void OnSpawn(IEntitySource source) + { + TextureVariant = Main.rand.Next(VomitChunkTexturePaths.Length); + Projectile.netUpdate = true; + } + + public override void AI() + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.25f); + Projectile.ExpandHitboxBy(Projectile.scale); + + Projectile.spriteDirection = Projectile.direction; + Projectile.rotation += Projectile.velocity.X * 0.035f; + if (Projectile.velocity.Y < 8f) + Projectile.velocity.Y += 0.125f; + + int vomitAmt = Main.rand.Next(1, 3); + for (int i = 0; i < vomitAmt; i++) + { + Vector2 velocity = Projectile.oldVelocity * Main.rand.NextFloat(-0.8f, -0.6f); + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + int dust = Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1f, 1.4f)); + Main.dust[dust].noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 velocity = Projectile.oldVelocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(-1.8f, -0.6f) * Projectile.direction; + Color color = Color.Lerp(Color.DarkOliveGreen, Color.Green, Main.rand.NextFloat()); + float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt(); + + TimedSmokeParticle vomit = new(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), velocity, color, color, Main.rand.NextFloat(0.4f, 0.6f), Main.rand.NextFloat(0.8f, 1f), Main.rand.Next(25, 35), rotationSpeed); + GeneralParticleHandler.SpawnParticle(vomit, false, Enums.GeneralDrawLayer.BeforeProjectiles); + } + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + int targetIndex = Player.FindClosest(Projectile.Center, 1, 1); + Player target = Main.player[targetIndex]; + if (Projectile.Center.Y > target.Center.Y - 48f) + fallThrough = false; + + return true; + } + + public override void OnKill(int timeLeft) + { + int dustAmt = Main.rand.Next(15, 21); + for (int i = 0; i < dustAmt; i++) + { + Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 velocity = Main.rand.NextVector2Circular(3f, 3f); + int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood); + Dust.NewDust(spawnPosition, 0, 0, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1.2f, 1.8f)); + } + + SoundEngine.PlaySound(SoundID.NPCDeath21, Projectile.Center); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = VomitChunkTextures[(int)TextureVariant].Value; + Vector2 origin = texture.Size() * 0.5f; + SpriteEffects spriteEffects = Projectile.spriteDirection < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; ++i) + { + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Color color = Color.GreenYellow * interpolant; + + Main.spriteBatch.Draw(texture, drawPos, null, Projectile.GetAlpha(color) * 0.6f, Projectile.rotation, origin, Projectile.scale * interpolant * 1.25f, spriteEffects, 0f); + } + } + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogVomitEye.cs b/Projectiles/Enemy/HorribleHogVomitEye.cs new file mode 100644 index 0000000000..da33f6207c --- /dev/null +++ b/Projectiles/Enemy/HorribleHogVomitEye.cs @@ -0,0 +1,143 @@ +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogVomitEye : ModProjectile, ILocalizedModType + { + public static int PlayerSearchArea => 128; + + public ref float LockOnTime => ref Projectile.ai[0]; + + public ref float Timer => ref Projectile.ai[1]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "Terraria/Images/NPC_" + NPCID.DemonEye; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.penetrate = -1; + Projectile.timeLeft = 480; + Projectile.scale = 0f; + Projectile.hostile = true; + Projectile.tileCollide = false; + } + + public override bool CanHitPlayer(Player target) => Projectile.scale > 0.15f; + + public override void AI() + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, 0.75f, 0.125f); + Projectile.ExpandHitboxBy(Projectile.scale); + + int targetIndex = Player.FindClosest(Projectile.Center, 1, 1); + if (Main.player[targetIndex].dead || !Main.player.IndexInRange(targetIndex)) + { + Projectile.velocity *= 1.12f; + Projectile.tileCollide = true; + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.Pi, 0.15f); + return; + } + + Player target = Main.player[targetIndex]; + if (Timer >= LockOnTime) + { + if (Timer <= LockOnTime + 45) + { + Projectile.velocity *= 0.94f; + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.AngleTo(target.Center) + MathHelper.Pi, 0.15f); + } + else + { + float turnResistance = 30f; + Vector2 directionToPoint = target.Center - Projectile.Center; + directionToPoint *= 30f / directionToPoint.Length(); + Vector2 idealVelocity = (Projectile.velocity * turnResistance + directionToPoint) / (turnResistance + 1f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.35f); + + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.Pi, 0.15f); + Projectile.tileCollide = true; + } + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; + } + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + Projectile.frame++; + Projectile.frame %= 2; + Projectile.frameCounter = 0; + } + + Timer++; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + int targetIndex = Player.FindClosest(Projectile.Center, 1, 1); + Player target = Main.player[targetIndex]; + if (Projectile.Center.Y > target.Center.Y - 48f) + fallThrough = false; + + return true; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + int bloodAmt = Main.rand.Next(14, 19); + for (int i = 0; i < bloodAmt; i++) + { + Vector2 velocity = Main.rand.NextVector2Circular(8f, 8f); + Dust.NewDust(Projectile.Center, 1, 1, DustID.Blood, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1.2f, 1.4f)); + } + + if (!Main.dedServ) + { + Gore.NewGore(Projectile.Center, Projectile.oldVelocity * -0.8f, 1, 0.75f); + Gore.NewGore(Projectile.Center, Projectile.oldVelocity * -0.8f, 2, 0.75f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; ++i) + { + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + float trailLengthInterpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Color afterimgeColor = Color.Red * trailLengthInterpolant; + + Main.spriteBatch.Draw(texture, afterimageDrawPosition, frame, Projectile.GetAlpha(afterimgeColor) * 0.6f, Projectile.oldRot[i], origin, Projectile.scale * trailLengthInterpolant * 1.25f, 0, 0f); + } + } + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, 0, 0f); + return false; + } + } +} diff --git a/Projectiles/Enemy/HorribleHogZombieSpawner.cs b/Projectiles/Enemy/HorribleHogZombieSpawner.cs new file mode 100644 index 0000000000..aafb9a330b --- /dev/null +++ b/Projectiles/Enemy/HorribleHogZombieSpawner.cs @@ -0,0 +1,196 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorribleHogZombieSpawner : ModProjectile, ILocalizedModType + { + private static Asset ZombieArmTexture; + private static Asset BackglowTexture; + + private static SoundStyle ZombieEmergeSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogZombieEmerge"); + + public List Zombies = new() + { + NPCID.Zombie, + NPCID.FemaleZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.SlimedZombie, + NPCID.SwampZombie, + NPCID.TwiggyZombie, + NPCID.TorchZombie, + NPCID.BloodZombie, + NPCID.MaggotZombie, + ModContent.NPCType(), + }; + + public static CalamityUtils.CurveSegment Rise => new(CalamityUtils.EasingType.ExpOut, 0f, 0f, 1.08f); + + public static CalamityUtils.CurveSegment Fallback => new(CalamityUtils.EasingType.SineOut, 0.08f, Rise.EndingHeight, -0.08f); + + public static CalamityUtils.CurveSegment Linger => new(CalamityUtils.EasingType.Linear, 0.20f, Fallback.EndingHeight, 0f); + + public static CalamityUtils.CurveSegment BounceUp => new(CalamityUtils.EasingType.PolyInOut, 0.82f, Linger.EndingHeight, 0.14f, 4); + + public static CalamityUtils.CurveSegment Descend => new(CalamityUtils.EasingType.PolyOut, 0.92f, BounceUp.EndingHeight, -1.48f, 3); + + public float ZombieArmRiseAnimation => CalamityUtils.PiecewiseAnimation(Timer / MaxTime, Rise, Fallback, Linger, BounceUp, Descend); + + public ref float Timer => ref Projectile.ai[0]; + + public ref float MaxTime => ref Projectile.ai[1]; + + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + { + ZombieArmTexture = ModContent.Request("Terraria/Images/Item_" + ItemID.ZombieArm); + BackglowTexture = ModContent.Request("Terraria/Images/Extra_60"); + } + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.hide = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + } + + public override void OnSpawn(IEntitySource source) + { + Projectile.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + Projectile.rotation = MathHelper.ToRadians(Main.rand.NextFloat(-8f, 8f)); + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override void AI() + { + if (Timer >= MaxTime) + { + Projectile.Kill(); + return; + } + + if (Main.rand.NextBool(6)) + { + int dustAmt = Main.rand.Next(1, 2); + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustPosition = Projectile.Bottom + Main.rand.NextVector2Circular(12f, 0f); + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-3f, -2f)); + int dustType = Main.rand.Next(2); + Dust.NewDustPerfect(dustPosition, dustType, dustVelocity); + } + } + + int dustCloudAmt = Main.rand.Next(1, 2); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 dustCloudPosition = Projectile.Bottom + Main.rand.NextVector2Circular(12f, 0f); + float dustCloudScale = Main.rand.NextFloat(0.2f, 0.3f); + Color dustCloudColor = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat()); + TimedSmokeParticle dustCloud = new(dustCloudPosition, Vector2.Zero, dustCloudColor, dustCloudColor, dustCloudScale, 1f, Main.rand.Next(15, 30)); + GeneralParticleHandler.SpawnParticle(dustCloud, true); + } + + Timer++; + } + + public override void OnKill(int timeLeft) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Raincoat Zombies get added when its raining. + if (Main.raining) + Zombies.Add(NPCID.ZombieRaincoat); + + // Multiple Bucket Zombies and Blood Zombies get added in Revengeance and Death Mode to increase the chances of them spawning. + if (CalamityWorld.revenge) + { + for (int i = 0; i < 3; i++) + Zombies.Add(NPCID.BloodZombie); + } + + if (CalamityWorld.death) + { + for (int i = 0; i < 4; i++) + { + Zombies.Add(ModContent.NPCType()); + Zombies.Add(NPCID.BloodZombie); + } + } + + int zombieType = Utils.SelectRandom(Main.rand, [.. Zombies]); + int zombie = NPC.NewNPC(Projectile.GetItemSource_FromThis(), (int)Projectile.Center.X, (int)Projectile.Center.Y, zombieType); + Main.npc[zombie].velocity = Vector2.UnitY * -4f; + } + + int dustAmt = Main.rand.Next(12, 19); + for (int i = 0; i < dustAmt; i++) + { + Vector2 dustPosition = Projectile.Bottom + Main.rand.NextVector2Circular(12f, 0f); + Vector2 dustVelocity = Vector2.UnitY * Main.rand.NextFloat(-6f, -4f); + int dustType = Main.rand.Next(2); + Dust.NewDust(dustPosition, 0, 0, dustType, dustVelocity.X, dustVelocity.Y); + } + + int dustCloudAmt = Main.rand.Next(9, 13); + for (int i = 0; i < dustCloudAmt; i++) + { + Vector2 dustCloudPosition = Projectile.Bottom + Main.rand.NextVector2Circular(12f, 0f); + Vector2 dustCloudVelocity = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-6f, -4f)); + float dustCloudScale = Main.rand.NextFloat(1.2f, 1.6f); + Color dustCloudColor = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat()); + SmallSmokeParticle dustCloud = new(dustCloudPosition, dustCloudVelocity, dustCloudColor, dustCloudColor, dustCloudScale, Main.rand.Next(120, 150)); + GeneralParticleHandler.SpawnParticle(dustCloud, true); + } + + SoundEngine.PlaySound(ZombieEmergeSound, Projectile.Center); + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCsAndTiles.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float scaleX = MathHelper.Lerp(0f, 1f, ZombieArmRiseAnimation); + Vector2 backglowScale = new(scaleX, 1f); + for (int i = 0; i < 2; i++) + Main.spriteBatch.Draw(BackglowTexture.Value, drawPosition, null, Color.Red with { A = 0 } * ZombieArmRiseAnimation, 0f, BackglowTexture.Size() * 0.5f, backglowScale, 0, 0f); + + float armScale = MathHelper.Lerp(0.2f, 1f, ZombieArmRiseAnimation); + float armRotation = Projectile.rotation - MathHelper.PiOver4 + MathHelper.ToRadians(Main.rand.NextFloat(-2f, 2f)); + + float height = MathHelper.Lerp(68f, 12f, ZombieArmRiseAnimation); + Vector2 armDrawPostion = drawPosition + Vector2.UnitY * height; + + Main.spriteBatch.Draw(ZombieArmTexture.Value, armDrawPostion, null, lightColor, armRotation, ZombieArmTexture.Size() * new Vector2(0f, 1f), armScale, 0, 0f); + return false; + } + } +} diff --git a/Projectiles/Enemy/JellyghoulBolt.cs b/Projectiles/Enemy/JellyghoulBolt.cs index d023799517..b9d14552b4 100644 --- a/Projectiles/Enemy/JellyghoulBolt.cs +++ b/Projectiles/Enemy/JellyghoulBolt.cs @@ -89,17 +89,6 @@ namespace CalamityMod.Projectiles.Enemy Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; int projFrame = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = projFrame * Projectile.frame; - - /*Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Texture2D ring = ModContent.Request("CalamityMod/Particles/HollowCircleHardEdge").Value; - for (int j = 0; j < 2; j++) - { - for (int i = 2; i < 7; i += 2) - { - Main.spriteBatch.Draw(ring, Projectile.oldPos[i] + Projectile.Size / 2 - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), null, Color.Red * Projectile.Opacity, Projectile.velocity.ToRotation(), ring.Size() / 2, new Vector2(0.5f, 1) * 0.2f * MathHelper.Lerp(1f, 0.5f, (i - 2) / 3f), SpriteEffects.None, 0); - } - } - Main.spriteBatch.ExitShaderRegion();*/ return false; } public float SlashWidthFunction(float _, Vector2 vertexPos) => 16 * Utils.GetLerpValue(0f, 0.1f, _, true); diff --git a/Projectiles/Enemy/PodobooSpit.cs b/Projectiles/Enemy/PodobooSpit.cs deleted file mode 100644 index 534740364c..0000000000 --- a/Projectiles/Enemy/PodobooSpit.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; - -namespace CalamityMod.Projectiles.Enemy -{ - public class PodobooSpit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/Ranged/DrizzlefishFire"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.rotation += Projectile.velocity.X * 0.01f; - Lighting.AddLight(Projectile.Center, 0.3f, 0, 0f); - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 30; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(4f, 8f); - Vector2 off = angleVec * distance; - off.Y *= (float)Projectile.height / Projectile.width; - Vector2 pos = Projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, DustID.InfernoFork, angleVec * Main.rand.NextFloat(1f, 2f)); - d.customData = true; - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Orange, 1, TextureAssets.Projectile[Type].Value); - int animSped = 10; - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.25f; - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, TextureAssets.Projectile[Type].Size() / 2, scale, 0); - return false; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.OnFire, 60); - } - } -} diff --git a/Projectiles/Enemy/PodobooSpitHoming.cs b/Projectiles/Enemy/PodobooSpitHoming.cs deleted file mode 100644 index 8ef5b1a60d..0000000000 --- a/Projectiles/Enemy/PodobooSpitHoming.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; - -namespace CalamityMod.Projectiles.Enemy -{ - public class PodobooSpitHoming : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.rotation += Projectile.velocity.X * 0.01f; - Player p = Main.player[(int)Projectile.ai[0]]; - if (p != null && p.active && !p.dead) - { - Projectile.velocity += Projectile.DirectionTo(p.Center) * 0.25f; - Projectile.velocity = Vector2.Clamp(Projectile.velocity, Vector2.One * -8, Vector2.One * 8); - } - Lighting.AddLight(Projectile.Center, 0.3f, 0, 0.3f); - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 30; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(4f, 8f); - Vector2 off = angleVec * distance; - off.Y *= (float)Projectile.height / Projectile.width; - Vector2 pos = Projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, DustID.InfernoFork, angleVec * Main.rand.NextFloat(1f, 2f)); - d.customData = true; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Main.spriteBatch.Draw(bloom, Projectile.Center - Main.screenPosition, null, Color.Magenta with { A = 0 } * 0.45f, 0f, bloom.Size() / 2f, 0.3f, SpriteEffects.None, 0); - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Cyan, 1, TextureAssets.Projectile[Type].Value); - int animSped = 10; - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.25f; - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, TextureAssets.Projectile[Type].Size() / 2, scale, 0); - return false; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.OnFire, 60); - } - } -} diff --git a/Projectiles/Enemy/PodobooSpitHoming.png b/Projectiles/Enemy/PodobooSpitHoming.png deleted file mode 100644 index 26bc4a232e..0000000000 Binary files a/Projectiles/Enemy/PodobooSpitHoming.png and /dev/null differ diff --git a/Projectiles/Enemy/PodobooSpitSplitting.cs b/Projectiles/Enemy/PodobooSpitSplitting.cs deleted file mode 100644 index 98f520d05e..0000000000 --- a/Projectiles/Enemy/PodobooSpitSplitting.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; - -namespace CalamityMod.Projectiles.Enemy -{ - public class PodobooSpitSplitting : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/Ranged/DrizzlefishFire2"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 3; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.rotation += Projectile.velocity.X * 0.01f; - Lighting.AddLight(Projectile.Center, 0.4f, 0, 0.2f); - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 30; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(4f, 8f); - Vector2 off = angleVec * distance; - off.Y *= (float)Projectile.height / Projectile.width; - Vector2 pos = Projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, DustID.InfernoFork, angleVec * Main.rand.NextFloat(1f, 2f)); - d.customData = true; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[0] == 1) - { - if (Projectile.penetrate > 1) - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - Projectile.penetrate--; - return false; - } - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.PiOver2), Type, (int)(Projectile.damage * 0.5f), Projectile.knockBack, ai0: 1); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-MathHelper.PiOver2), Type, (int)(Projectile.damage * 0.5f), Projectile.knockBack, ai0: 1); - } - return true; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.ai[0] == 1) - { - if (Projectile.penetrate > 1) - { - Projectile.velocity *= -1; - } - } - else if(Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.PiOver2), Type, (int)(Projectile.damage * 0.5f), Projectile.knockBack, ai0: 1); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-MathHelper.PiOver2), Type, (int)(Projectile.damage * 0.5f), Projectile.knockBack, ai0: 1); - } - - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.OnFire, 60); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Magenta, 1, TextureAssets.Projectile[Type].Value); - int animSped = 10; - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.25f; - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, TextureAssets.Projectile[Type].Size() / 2, scale, 0); - return false; - } - } -} diff --git a/Projectiles/Enemy/PodobooSpitUltima.cs b/Projectiles/Enemy/PodobooSpitUltima.cs deleted file mode 100644 index c5acee939b..0000000000 --- a/Projectiles/Enemy/PodobooSpitUltima.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using CalamityMod.Graphics.Primitives; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; - -namespace CalamityMod.Projectiles.Enemy -{ - public class PodobooSpitUltima : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.rotation += Projectile.velocity.X * 0.01f; - Lighting.AddLight(Projectile.Center, 0.4f, 0.2f, 0f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - - for (int i = 0; i < 30; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(7f, 18f); - Vector2 off = angleVec * distance; - off.Y *= (float)Projectile.height / Projectile.width; - Vector2 pos = Projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, DustID.InfernoFork, angleVec * Main.rand.NextFloat(2f, 4f)); - d.customData = true; - } - } - - - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - Vector2 overallOffset = Projectile.Size / 2; - int numPoints = 92; - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_,_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); - - int animSped = 10; - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.25f; - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, TextureAssets.Projectile[Type].Size() / 2, scale, 0); - return false; - } - private float PrimitiveWidthFunction(float completionRatio, Vector2 vertexPos) - { - return MathHelper.Lerp(12, 1, completionRatio); - } - - private Color PrimitiveColorFunction(float completionRatio, Vector2 vertexPos) - { - return Color.Lerp(Color.Orange, Color.DarkOrange, completionRatio); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Enemy/PodobooSpitUltima.png b/Projectiles/Enemy/PodobooSpitUltima.png deleted file mode 100644 index 2d0b8b00dd..0000000000 Binary files a/Projectiles/Enemy/PodobooSpitUltima.png and /dev/null differ diff --git a/Projectiles/Enemy/SharkoonExplosion.cs b/Projectiles/Enemy/SharkoonExplosion.cs deleted file mode 100644 index ce4efa0722..0000000000 --- a/Projectiles/Enemy/SharkoonExplosion.cs +++ /dev/null @@ -1,26 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class SharkoonExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.hostile = true; - Projectile.width = Projectile.height = Sharkoon.ExplosionRadius * 2; - Projectile.timeLeft = 2; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - => CalamityUtils.CircularHitboxCollision(Projectile.Center, Sharkoon.ExplosionRadius, targetHitbox); - - public override bool? CanHitNPC(NPC target) => target.whoAmI != Projectile.ai[0]; - } -} diff --git a/Projectiles/Enemy/ShoreskipperTackle.cs b/Projectiles/Enemy/ShoreskipperTackle.cs deleted file mode 100644 index 242025c4b1..0000000000 --- a/Projectiles/Enemy/ShoreskipperTackle.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Enemy -{ - public class ShoreskipperTackle : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private NPC OwnerNPC => Main.npc[(int)Projectile.ai[0]]; - - public override void SetDefaults() - { - Projectile.width = 64; - Projectile.height = 32; - Projectile.hostile = true; - Projectile.friendly = false; - Projectile.ignoreWater = false; - Projectile.tileCollide = false; - Projectile.timeLeft = 120; - Projectile.penetrate = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - if (!OwnerNPC.active || OwnerNPC.type != NPCType()) - { - Projectile.Kill(); - return; - } - - Projectile.Center = OwnerNPC.Center; - - if (OwnerNPC.velocity.Y == 0f) - { - Projectile.Kill(); - } - } - - public override bool? CanHitNPC(NPC target) - { - // Can only damage other Shoreskippers - if (target.type == NPCType()) - { - // Never kill yourself - if (target.whoAmI == OwnerNPC.whoAmI) - return false; - - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Dust.NewDust(target.position, target.width, target.height, DustID.Water, 0f, -2f, 0, default, 1f); - } - } -} diff --git a/Projectiles/Enemy/StormlionSentryBullet.cs b/Projectiles/Enemy/StormlionSentryBullet.cs deleted file mode 100644 index 5802fe3a03..0000000000 --- a/Projectiles/Enemy/StormlionSentryBullet.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Enemy -{ - public class StormlionSentryBullet : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.hostile = true; - Projectile.timeLeft = 160; - Projectile.extraUpdates = 6; - Projectile.tileCollide = true; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - public override void AI() - { - Lighting.AddLight(Projectile.Center, Effects.StormlionEffects.EnergyColor.ToVector3() * 0.3f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Main.rand.NextBool()) - { - int dustStyle = ModContent.DustType(); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle); - dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); - dust2.velocity = Projectile.velocity * Main.rand.NextFloat(0.6f, 1f); - dust2.noGravity = true; - dust2.color = Effects.StormlionEffects.EnergyColor; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - public override void OnKill(int timeLeft) - { - - } - public override bool PreDraw(ref Color lightColor) - { - Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); - - for (int i = 0; i < 4; i++) - { - Vector2 scale = Projectile.scale * new Vector2(0.2f, 1.4f) * (0.05f + i * 0.02f) * 4; - Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, Effects.StormlionEffects.EnergyColor with { A = 0 }, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); - } - return false; - } - } -} diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 128d8bb152..25ae1dbf55 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -103,6 +104,12 @@ namespace CalamityMod.Projectiles.Enemy public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 60f && Projectile.ai[0] <= (Projectile.ai[1] == 1f ? 735f : 540f); + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 120, true); + } + public override bool PreDraw(ref Color lightColor) { float aiTrackCheck = Projectile.ai[1] == 1f ? 795f : 600f; diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index 26286550e9..84a1716635 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -1,26 +1,16 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Particles; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; - namespace CalamityMod.Projectiles.Magic { public class AquamarineBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public Particle bloom = null; - public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() @@ -30,117 +20,31 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 180; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.alpha = 255; } public override void AI() { - // The main bolt simply just homes - if (Projectile.ai[0] == 0) - { - CalamityUtils.HomeInOnNPC(Projectile, false, 600, 10f, 10f); - } - // The secondary bolt """"orbits"""" the main one - else - { - Projectile parent = Main.projectile[(int)Projectile.ai[2]]; - if (parent.active && parent.type == Type) - { - Projectile.timeLeft = parent.timeLeft; - Projectile.ai[1] += 0.18f; - float angle = parent.velocity.ToRotation() + MathHelper.PiOver2; - float pulse = (float)Math.Sin(Projectile.ai[1]); - float radius = 20.8f; - Vector2 offset = angle.ToRotationVector2() * pulse * radius; - Projectile.Center = parent.Center - offset; - } - else - { - Projectile.tileCollide = true; - Projectile.penetrate = 1; - Projectile.ai[0] = 0; - } - } - // Bloom particle behind the bolt. If one already exists, update its position and assure it doesn't prematurely die - if (bloom == null) - { - bloom = new GenericBloom(Projectile.Center, Vector2.Zero, Color.LightBlue * 0.5f, 0.5f * Projectile.scale, 600); - GeneralParticleHandler.SpawnParticle(bloom); - } - else - { - bloom.Position = Projectile.position; - bloom.Velocity = Projectile.velocity; - bloom.Time = 300; - } - - // fade out and kill the bloom - if (Projectile.timeLeft < 60) - { - Projectile.alpha += 10; - if (bloom != null) - { - bloom.Kill(); - } - } - // if it's not fading out, make some idle sparkles - else - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 50; - } - if (Main.rand.NextBool(4) && Projectile.velocity.Length() > 2) - { - Particle sparkle = new SnowflakeSparkle(Projectile.Center, Vector2.Zero, Color.AliceBlue, Color.AliceBlue, Main.rand.NextFloat(0.05f, 0.5f), 20); - GeneralParticleHandler.SpawnParticle(sparkle); - } - } - - // lite Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - Projectile.rotation += 0.3f * Projectile.direction; + int aquaDust = Dust.NewDust(Projectile.Center, Projectile.width - 28, Projectile.height - 28, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1.5f); + Main.dust[aquaDust].noGravity = true; + Main.dust[aquaDust].velocity *= 0.1f; + Main.dust[aquaDust].velocity += Projectile.velocity * 0.5f; + if (Main.rand.NextBool(16)) + { + int aquaticDust = Dust.NewDust(Projectile.Center, Projectile.width - 32, Projectile.height - 32, DustID.BlueCrystalShard, 0f, 0f, 100, default, 1f); + Main.dust[aquaticDust].velocity *= 0.25f; + Main.dust[aquaticDust].velocity += Projectile.velocity * 0.5f; + } + Projectile.rotation += 0.3f * (float)Projectile.direction; } - public override Color? GetAlpha(Color lightColor) => Color.White; - public float PrimitiveWidthFunction(float completionRatio, Vector2 vertexPos) - { - return (1 - completionRatio) * 20 * Projectile.scale; - } - - public Color PrimitiveColorFunction(float completionRatio, Vector2 vertexPos) - { - return Color.Lerp(new Color(86, 176, 240), Color.Azure, (float)Math.Pow(completionRatio, 1.5D)) * 0.6f * Projectile.Opacity; - } - 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 Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); public override bool PreDraw(ref Color lightColor) { - // streakin' - Main.spriteBatch.EnterShaderRegion(); - - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_,_) => Vector2.Zero, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 66); - Main.spriteBatch.ExitShaderRegion(); - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.position - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * Projectile.Opacity, Projectile.rotation, Projectile.getRect().Size() * 0.5f, Projectile.scale, 0, 0); - - Main.spriteBatch.ExitShaderRegion(); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - - public override void OnKill(int timeLeft) - { - // kill the bloom when the projectile dies if it hasn't already (aka if it hits a tile or npc) - if (bloom != null) - { - bloom.Kill(); - } - } } } 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/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index aec84744d8..3c11255b6c 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -29,15 +29,6 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - /* - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int boltDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.25f); - Main.dust[boltDust].position = projPos; - Main.dust[boltDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[boltDust].velocity *= 0.1f; - */ - if (Projectile.timeLeft == 500) { Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3); diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 9c249aed59..9976268724 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -131,8 +132,14 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Frozen, 30); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Frozen, 30); - target.AddBuff(BuffID.Frostburn2, 180); } } } 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/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 8f43f46666..9c367924a7 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -85,7 +85,6 @@ namespace CalamityMod.Projectiles.Magic } } - // Main.dust[dust].velocity /= 2f; Vector2 current = Projectile.Center; if (target) { @@ -115,33 +114,6 @@ namespace CalamityMod.Projectiles.Magic } Projectile.position = current; - - /*int tx = (int)(projectile.position.X / 16f); - int ty = (int)(projectile.position.Y / 16f); - - if (tx < 0) - { - tx = 0; - } - if (tx > Main.maxTilesX) - { - tx = Main.maxTilesX; - } - if (ty < 0) - { - ty = 0; - } - if (ty > Main.maxTilesY) - { - ty = Main.maxTilesY; - } - - if (Main.tile[tx, ty] != null && Main.tileSolid[(int)Main.tile[tx,ty].type] && Main.tile[tx, ty].wall == 0) - { - projectile.timeLeft -= 12; - }*/ - - } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 53d96f1139..8056df5a3e 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -39,14 +39,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity *= 0.1f; if (Projectile.velocity.Length() < 8) Projectile.velocity *= 1.01f; - /* - Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); - dust.noGravity = !Main.rand.NextBool(3); - dust.scale = Main.rand.NextFloat(0.45f, 0.6f); - dust.color = Color.Gold; - dust.noLightEmittence = true; - */ + if (Projectile.timeLeft > 30) { for (int i = 0; i < 2; i++) diff --git a/Projectiles/Magic/MoonSigil.cs b/Projectiles/Magic/MoonSigil.cs index 60a6503f4d..ee4dc5be28 100644 --- a/Projectiles/Magic/MoonSigil.cs +++ b/Projectiles/Magic/MoonSigil.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public Player Owner => Main.player[Projectile.owner]; public bool visuals => Owner.Calamity().mageCrownVisibility; // Enables/disables visuals and sounds based on accessory visibility + public ref float SigilIndex => ref Projectile.ai[1]; + public override void SetDefaults() { Projectile.width = 20; @@ -60,27 +62,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); return; } - int sigils = 0; - int sigilAmt = 0; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == Projectile.type) - { - if (Main.projectile[i] == Projectile) - { - sigils = sigilAmt; - } - sigilAmt++; - } - } - float f = ((float)sigils / (float)sigilAmt + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f); - float num = 24f + (float)sigilAmt * 4.5f; + + float f = ((float)SigilIndex / (float)Owner.ownedProjectileCounts[Type] + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f); + float num = 24f + (float)Owner.ownedProjectileCounts[Type] * 4.5f; Vector2 vector = player.position - player.oldPosition; - base.Projectile.Center += vector; + Projectile.Center += vector; Vector2 vector2 = f.ToRotationVector2(); Projectile.localAI[0] = vector2.Y; Vector2 value = (player.Center + new Vector2(0f, 5f)) + vector2 * new Vector2(1f, 0.05f) * num; - base.Projectile.Center = value; + Projectile.Center = value; if (!Projectile.FinalExtraUpdate()) return; diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index 0bfd8ae7cc..906529f68b 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -24,5 +24,6 @@ namespace CalamityMod.Projectiles.Magic { CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); } + public override bool? CanDamage() => false; } } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index a175116a5a..50547e5260 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -133,7 +133,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); for (int i = 0; i< 2; i++) { Color color = AetherfluxCannon.accentColor; @@ -147,7 +146,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = (int)(Projectile.damage * 0.865f); } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs deleted file mode 100644 index bc4ee599e4..0000000000 --- a/Projectiles/Magic/RancorFog.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class RancorFog : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public ref float LightPower => ref Projectile.ai[0]; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 184; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 210; - Projectile.hide = true; - Projectile.ignoreWater = true; - } - - public override void AI() - { - // Decide scale and initial rotation on the first frame this projectile exists. - if (Projectile.localAI[0] == 0f) - { - Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1]; - Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); - Projectile.localAI[0] = 1f; - } - - Projectile.rotation += Projectile.velocity.X * 0.004f; - Projectile.velocity *= 0.985f; - - // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.dedServ) - return; - - // Calculate light power. This checks below the position of the fog to check if this fog is underground. - // Without this, it may render over the fullblack that the game renders for obscured tiles. - float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); - LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); - Projectile.Opacity = Utils.GetLerpValue(210f, 195f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); - } - - public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) - { - behindNPCsAndTiles.Add(index); - } - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.SetBlendState(BlendState.Additive); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Vector2 origin = texture.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; - Color drawColor = new Color(236, 0, 68) * opacity; - Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale; - Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0); - - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - return false; - } - } -} diff --git a/Projectiles/Magic/RancorHoldout.cs b/Projectiles/Magic/RancorHoldout.cs index 8091e26805..0b1e159ae2 100644 --- a/Projectiles/Magic/RancorHoldout.cs +++ b/Projectiles/Magic/RancorHoldout.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic // Cast the magic circle on the first frame. if (Main.myPlayer == Projectile.owner && Time == 1f) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner); // Handle frames. Projectile.frameCounter++; diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index c79eea665f..be82b4092d 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -128,7 +129,8 @@ namespace CalamityMod.Projectiles.Magic public void CreateTileHitEffects() { Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0f, 1f); + RancorFog fog = new(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); if (Main.rand.NextBool()) { diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index 908e460f4d..33ecd8b802 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner, Projectile.identity); } } diff --git a/Projectiles/Magic/SparklingEmpressHoldout.cs b/Projectiles/Magic/SparklingEmpressHoldout.cs deleted file mode 100644 index c9725236cd..0000000000 --- a/Projectiles/Magic/SparklingEmpressHoldout.cs +++ /dev/null @@ -1,219 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Fishing.SunkenSeaCatches; -using CalamityMod.Particles; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SparklingEmpressHoldout : BaseGunHoldoutProjectile - { - public override int AssociatedItemID => ModContent.ItemType(); - public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -3; - public override float MaxOffsetLengthFromArm => 40f; - public override float OffsetXUpwards => 0f; - public override float BaseOffsetY => 0f; - public override float OffsetYDownwards => 0f; - public override float RecoilResolveSpeed => 0.5f; - public override float WeaponTurnSpeed => 0.05f; - - public ref float shootingTimer => ref Projectile.ai[0]; - public ref float completion => ref Projectile.ai[1]; - public Color EffectsColor = Color.Cyan; - public bool hasLetGo = false; - public int time = 0; - public int postFireTimer = 0; - public bool deservesMana = false; - - public float GfbMult = 1; - public int CooldownTime => 20 * (deservesMana ? 2 : 1); - private const int FishShineTime = 150; - - public override void SetDefaults() - { - base.SetDefaults(); - Projectile.DamageType = DamageClass.Magic; - } - - public override void KillHoldoutLogic() - { - if (HeldItem.type != Owner.HeldItem.type || Owner.dead) - Projectile.Kill(); - if (Owner.CantUseHoldout() && !hasLetGo) - postFireTimer = CooldownTime; - } - - public override void HoldoutAI() - { - if (Main.zenithWorld) - GfbMult = MathHelper.Clamp((int)(time / 60), 1, 7); - if (!hasLetGo) - { - int shootInterval = deservesMana && !Main.zenithWorld ? Owner.HeldItem.useTime * 2 : Owner.HeldItem.useTime; - if (shootingTimer >= shootInterval) - { - if (Owner.CheckMana(HeldItem, (int)(HeldItem.mana * GfbMult), true, false)) - { - Shoot(); - shootingTimer = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); - postFireTimer = CooldownTime; - } - } - - shootingTimer++; - - if (time >= FishShineTime) - deservesMana = true; - if (time == FishShineTime) - { - SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); - SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); - for (int k = 0; k < 14; k++) - { - Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.1f, 8.8f); - - Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), vel); - dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); - dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; - } - } - } - time++; - - if (Main.zenithWorld) - { - if (!hasLetGo) - { - if (time % 60 == 0 && time > 120 && time <= 420) - { - SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); - SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); - } - if (time == 420) - { - SoundStyle warnSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); - SoundEngine.PlaySound(warnSound with { Volume = 0.7f, Pitch = 0.8f }, Projectile.Center); - } - // gfb texts - if (time == 1) - CombatText.NewText(Projectile.Hitbox, Color.SkyBlue, CalamityUtils.GetTextValue("Misc.Empress1")); - if (time == 300) - CombatText.NewText(Projectile.Hitbox, Color.DeepSkyBlue, CalamityUtils.GetTextValue("Misc.Empress2")); - if (time == 510) - CombatText.NewText(Projectile.Hitbox, Color.DodgerBlue, CalamityUtils.GetTextValue("Misc.Empress3")); - Owner.velocity += -Projectile.velocity * MathHelper.Lerp(GfbMult, 1, 0.6f) * 0.1f; - } - - if (time >= 540) - { - if (time < 600) - { - if (time % 10 == 0) - { - Particle boom = new CustomPulse(Projectile.Center, -Projectile.velocity * 0.3f, Color.DodgerBlue, "CalamityMod/Particles/BloomRing", new Vector2(1, 1f), 0, 0, 4, 10); - GeneralParticleHandler.SpawnParticle(boom); - SoundStyle f = new("CalamityMod/Sounds/Item/MeldExplosion"); - SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); - for (int k = 0; k < 18; k++) - { - Projectile explode = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 5).RotatedByRandom(100), ModContent.ProjectileType(), Projectile.damage * 5, Projectile.knockBack, Projectile.owner, 0, 0); - explode.hostile = true; - explode.extraUpdates = 3; - explode.tileCollide = false; - } - } - if (time % 3 == 0) - CombatText.NewText(Projectile.Hitbox, Color.Cyan, CalamityUtils.GetTextValue("Misc.Empress4")); - } - if (postFireTimer == 0) - postFireTimer = (CooldownTime * 5); - deservesMana = false; - } - } - - if (postFireTimer > 0) - PostFireEffect(); - } - public void PostFireEffect() - { - hasLetGo = true; - - if (deservesMana && postFireTimer % 8 == 0) - { - int manaGained = 10; - Owner.statMana += manaGained; - if (Main.myPlayer == Owner.whoAmI) - Owner.ManaEffect(manaGained); - - if (Owner.statMana > Owner.statManaMax2) - Owner.statMana = Owner.statManaMax2; - - for (int i = 0; i < 2; i++) - { - Particle spark = new CustomSpark(GunTipPosition, (-Vector2.UnitY * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.6f), "CalamityMod/Particles/HeartParticle", false, 45, Main.rand.NextFloat(0.9f, 1.2f), Color.Lerp(Color.Aqua, Color.DodgerBlue, i * 0.5f), Vector2.One, true, true, 0, false, false); - GeneralParticleHandler.SpawnParticle(spark); - } - OffsetLengthFromArm -= 9f; - - SoundStyle s = new("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst"); - SoundEngine.PlaySound(s with { Volume = 0.35f, Pitch = -postFireTimer * 0.01f, MaxInstances = -1 }, Projectile.Center); - } - if (postFireTimer == 1) - Projectile.Kill(); - postFireTimer--; - } - public void Shoot() - { - Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); - if (Main.myPlayer == Projectile.owner) - { - Vector2 firingVelocity = (shootDirection * 4); - for (int k = 0; k < (int)(GfbMult); k++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition + firingVelocity * 5, firingVelocity.RotatedByRandom(Main.zenithWorld ? GfbMult * 0.08f : 0), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0); - } - - for (int k = 0; k < 4; k++) - { - Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); - - Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); - dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); - dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; - } - } - public override bool PreDraw(ref Color lightColor) - { - if (time < 2) - return false; - - Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); - Vector2 rotationPoint = texture.Size() * 0.5f; - SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D shineTex = ModContent.Request("CalamityMod/Particles/FullStar").Value; - - Vector2 vibration = (hasLetGo ? Vector2.Zero : (Main.rand.NextVector2Circular(2, 2) * (time >= 840 && Main.zenithWorld ? 4 : 1))); - - Main.EntitySpriteDraw(texture, drawPosition + vibration, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); - if (deservesMana && !hasLetGo) - { - for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(shineTex, GunTipPosition - Main.screenPosition, null, Color.DodgerBlue with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45 * (i == 0 ? -1 : 1)), shineTex.Size() * 0.5f, new Vector2(0.9f, 2.5f) * Main.rand.NextFloat(0.7f, 1.1f) * MathHelper.Lerp(GfbMult, 1, 0.6f), SpriteEffects.None, 0); - } - return false; - } - } -} diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index 54a4b578af..7aab52d236 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,87 +1,239 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; +using System; using CalamityMod.NPCs; -using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { [PierceResistException] - public class SparklingLaser : ModProjectile, ILocalizedModType + public class SparklingLaser : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public ref float time => ref Projectile.ai[0]; - public bool isSplit => Projectile.ai[1] == 5; - public ref NPC targeted => ref Main.npc[(int)Projectile.ai[2]]; - public Color mainColor = Color.Cyan; + + public bool playedSound = false; + public const int ChargeupTime = 50; + + public Player Owner => Main.player[Projectile.owner]; + public override Color LightCastColor => new Color(204, 204, 255); //#CCCCFF + public override float Lifetime => 18000f; + public override float MaxScale => 1f; + public override float MaxLaserLength => 1600f; //100 tiles + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserBegin", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserMid", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserEnd", AssetRequestMode.ImmediateLoad).Value; + private const float AimResponsiveness = 0.8f; // Last Prism is 0.92f. Lower makes the laser turn faster. + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 5; + } + public override void SetDefaults() { - Projectile.width = 25; - Projectile.height = 25; + Projectile.width = 10; + Projectile.height = 10; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.timeLeft = 300; - Projectile.ArmorPenetration = 20; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.timeLeft = 18000; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 20; } - public override void AI() - { - Player Owner = Main.player[Projectile.owner]; - float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - if (time == 0) - { - mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; - } - if (targetDist < 1400) - { - float beamSize = (isSplit ? 0.4f : 1f); - Particle beamBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 65, Projectile.velocity * 0.05f, "CalamityMod/Particles/Crack", false, (int)(7 * (isSplit ? 2 : 1)), 0.15f * beamSize, mainColor * 0.7f, new Vector2(0.7f, 1.4f), true, true, extraRotation: MathHelper.ToRadians(180), shrinkSpeed: (isSplit ? 0.4f : 1.1f), glowCenterScale: 0.7f, glowOpacity: 0.4f); - GeneralParticleHandler.SpawnParticle(beamBody); - } - if (isSplit) - { - Projectile.velocity *= 0.98f; - } - else if (Projectile.velocity.Length() < 9) - { - Projectile.velocity *= 1.01f; - Projectile.velocity = Projectile.velocity.RotatedByRandom(0.035f); - } - time++; - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (!isSplit) - { - Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7; - Projectile splitProj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (shootDirection).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0, 5, target.whoAmI); - splitProj.timeLeft = 120; - splitProj.penetrate = -1; - splitProj.extraUpdates = 2; - for (int k = 0; k < 3; k++) - { - Vector2 shootVel = (shootDirection).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.8f); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), shootVel); - dust2.scale = Main.rand.NextFloat(0.9f, 1.15f); - dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Cyan; + public override void DetermineScale() + { + Projectile.scale = Time < ChargeupTime ? 0f : MaxScale; + } + + public override float DetermineLaserLength() + { + return DetermineLaserLength_CollideWithTiles(); + } + + public override bool PreAI() + { + // Multiplayer support here, only run this code if the client running it is the owner of the projectile + if (Projectile.owner == Main.myPlayer) + { + Vector2 rrp = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + UpdateAim(rrp); + Projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; + Projectile.netUpdate = true; + } + + int dir = Projectile.direction; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.Center = Owner.Center + Projectile.velocity * 56f; //Distance offset + Projectile.timeLeft = 18000; //Infinite lifespan + Owner.ChangeDir(dir); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = ((Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * -Owner.direction).ToRotation(); + + if (!Owner.channel) + { + Projectile.Kill(); + return false; + } + // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore + if (Owner.miscCounter % 10 == 0 && !Owner.CheckMana(Owner.HeldItem, -1, true)) + { + Projectile.Kill(); + return false; + } + + if (Time < ChargeupTime) + { + // Crate charge-up dust. + int dustCount = (int)(Time / 20f); + Vector2 spawnPos = Projectile.Center; + for (int k = 0; k < dustCount + 1; k++) + { + Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, DustID.Electric, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + dust.position += Main.rand.NextVector2Square(-10f, 10f); + dust.velocity = Main.rand.NextVector2Unit() * (10f - dustCount * 2f) / 10f; + dust.scale = Main.rand.NextFloat(0.5f, 1f); + dust.noGravity = true; + } + Time++; + return false; + } + + // Play a cool sound when fully charged. + if (!playedSound) + { + SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); + playedSound = true; + } + return true; + } + + public override void PostAI() + { + // Determine frames. + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 4f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + } + + // Gently adjusts the aim vector of the laser to point towards the mouse. + private void UpdateAim(Vector2 source) + { + Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), AimResponsiveness)); + + if (aimVector != Projectile.velocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => Time >= ChargeupTime; + + // Update CutTiles so the laser will cut tiles (like grass). + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target.life <= 0 && target.lifeMax > 5 && Projectile.owner == Main.myPlayer) + { + int shardDamage = Projectile.damage / 5; + int shardAmt = Main.rand.Next(2, 4); + for (int s = 0; s < shardAmt; s++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, Projectile.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].DamageType = DamageClass.Magic; } } - target.AddBuff(ModContent.BuffType(), (isSplit ? 60 : 120)); - - float minMult = 0.25f; - int hitsToMinMult = 7; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; } - public override bool? CanHitNPC(NPC target) => (target == targeted && isSplit) ? false : null; + + public override bool PreDraw(ref Color lightColor) + { + // This should never happen, but just in case- + if (Projectile.velocity == Vector2.Zero || Time < ChargeupTime) + return false; + + Color beamColor = LaserOverlayColor; + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + + // Start texture drawing. + // This is a lot more scuffed than other lasers... for some reason I'll try not to think about right now. + Vector2 laserBeginCenter = Projectile.Center - Main.screenPosition + Projectile.velocity * Projectile.scale * 50f; + Main.EntitySpriteDraw(LaserBeginTexture, + laserBeginCenter, + startFrameArea, + beamColor, + Projectile.rotation, + LaserBeginTexture.Size() / 2f, + Projectile.scale, + SpriteEffects.None, + 0); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * Projectile.scale; + Vector2 centerOnLaser = Projectile.Center - Main.screenPosition; + centerOnLaser += Projectile.velocity * Projectile.scale * 10.5f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = middleFrameArea.Height * Projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + centerOnLaser += Projectile.velocity * laserOffset; + incrementalBodyLength += laserOffset; + Main.EntitySpriteDraw(LaserMiddleTexture, + centerOnLaser, + middleFrameArea, + beamColor, + Projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + Projectile.scale, + SpriteEffects.None, + 0); + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Main.EntitySpriteDraw(LaserEndTexture, + centerOnLaser, + endFrameArea, + beamColor, + Projectile.rotation, + LaserEndTexture.Frame(1, 1, 0, 0).Top(), + Projectile.scale, + SpriteEffects.None, + 0); + } + return false; + } } } diff --git a/Projectiles/Magic/SpectralFeather.cs b/Projectiles/Magic/SpectralFeather.cs index 1949f0703d..bc7c58ff9f 100644 --- a/Projectiles/Magic/SpectralFeather.cs +++ b/Projectiles/Magic/SpectralFeather.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/Magic/StickyFeather"; public Player Owner => Main.player[Projectile.owner]; public bool visuals => Owner.Calamity().mageCrownVisibility; // Enables/disables visuals and sounds based on accessory visibility + public ref float FeatherIndex => ref Projectile.ai[1]; + public override void SetDefaults() { Projectile.width = 10; @@ -61,27 +63,15 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); return; } - int feathers = 0; - int featherAmt = 0; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == Projectile.type) - { - if (Main.projectile[i] == Projectile) - { - feathers = featherAmt; - } - featherAmt++; - } - } - float f = ((float)feathers / (float)featherAmt + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f); - float num = 18f + (float)featherAmt; + + float f = ((float)FeatherIndex / (float)Owner.ownedProjectileCounts[Type] + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f); + float num = 18f + (float)Owner.ownedProjectileCounts[Type]; Vector2 vector = player.position - player.oldPosition; - base.Projectile.Center += vector; + Projectile.Center += vector; Vector2 vector2 = f.ToRotationVector2(); Projectile.localAI[0] = vector2.Y; Vector2 value = (player.Center + new Vector2(0f, -25f)) + vector2 * new Vector2(1f, 0.05f) * num; - base.Projectile.Center = value; + Projectile.Center = value; if (!Projectile.FinalExtraUpdate()) return; diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index d33a69bb29..395ff2d14c 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -36,8 +37,6 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } } - - public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); diff --git a/Projectiles/Magic/SylvestaffHoldout.cs b/Projectiles/Magic/SylvestaffHoldout.cs index 61b6a1ee5a..6df886b8f7 100644 --- a/Projectiles/Magic/SylvestaffHoldout.cs +++ b/Projectiles/Magic/SylvestaffHoldout.cs @@ -72,6 +72,9 @@ namespace CalamityMod.Projectiles.Magic if (LeftRibbon is null && RightRibbon is null) InitializeRibbons(); + // Refund the mana used to spawn the holdout + if (Time == 0) + Owner.statMana += Owner.GetManaCost(Owner.HeldItem); AimTowardsMouse(); HandleHoldoutLogic(); diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index dfc485f8d0..17aa6cc88a 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic // Compute the gem position, which is needed for visual effects float angle = Projectile.rotation - MathHelper.PiOver2; - Vector2 gemOffset = Vector2.One * ValkyrieRay.GemDistance * 1.4142f; // distance to gem on staff + Vector2 gemOffset = Vector2.One * ValkyrieRay.GemDistance; // distance to gem on staff Vector2 gemPos = Projectile.Center + gemOffset.RotatedBy(angle); // Firing or charging? diff --git a/Projectiles/Magic/VeeringWindAirWave.cs b/Projectiles/Magic/VeeringWindAirWave.cs index f314d7a737..bb72ca9483 100644 --- a/Projectiles/Magic/VeeringWindAirWave.cs +++ b/Projectiles/Magic/VeeringWindAirWave.cs @@ -34,6 +34,11 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); + if (Collision.SolidCollision(Projectile.Center, Projectile.width / 2, Projectile.height / 2)) + { + Projectile.velocity *= 0.97f; + Projectile.timeLeft--; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Magic/VeeringWindFrostWave.cs b/Projectiles/Magic/VeeringWindFrostWave.cs index ee7a6c11d8..8fae62a096 100644 --- a/Projectiles/Magic/VeeringWindFrostWave.cs +++ b/Projectiles/Magic/VeeringWindFrostWave.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -28,13 +29,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.Magic; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 15; + Projectile.idStaticNPCHitCooldown = 18; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.6f); + if (Collision.SolidCollision(Projectile.Center, Projectile.width / 2, Projectile.height / 2)) + { + Projectile.velocity *= 0.97f; + Projectile.timeLeft -= 2; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -43,6 +49,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = (int)(Projectile.damage * 0.5); if (Projectile.damage < 1) Projectile.damage = 1; + + if (Projectile.numHits < 2) + { + target.AddBuff(ModContent.BuffType(), Projectile.numHits == 0 ? 120 : 60); + target.AddBuff(BuffID.Frozen, Projectile.numHits == 0 ? 30 : 15); + } } public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. @@ -75,11 +87,5 @@ namespace CalamityMod.Projectiles.Magic } return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.Frozen, 30); - } } } diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index cec445d21b..83e2a7f9b6 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -1,139 +1,64 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Particles; +using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public ref float time => ref Projectile.ai[0]; - public int dir = 0; - public bool returning = false; public override void SetDefaults() { - Projectile.width = 55; - Projectile.height = 55; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 225; + Projectile.alpha = 0; + Projectile.penetrate = 2; + Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.extraUpdates = 2; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } + public override void AI() { - if (time == 0) - dir = (int)Projectile.ai[1]; - if (time == 4) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; + Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); + for (int i = 0; i < 2; i++) { - Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); - GeneralParticleHandler.SpawnParticle(fadeInfx); - for (int i = 0; i < 3; i++) - { - Particle fadeInfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); - GeneralParticleHandler.SpawnParticle(fadeInfx2); - } - } - Lighting.AddLight(Projectile.Center, Color.RoyalBlue.ToVector3() * 0.7f); - - // Slows down and decays if it's inside tiles - if (Collision.SolidCollision(Projectile.Center, 20, 20)) - { - Projectile.velocity *= 0.95f; - Projectile.timeLeft = (int)(Projectile.timeLeft * 0.9f); - } - - // I hate this but it's the only way to make it move in the very specific way it needs to - int timeValue = (int)(time / 12); - float turnMult = timeValue switch - { - 0 => 0.05f, - 1 => 0.1f, - 2 => 0.2f, - 3 => -0.2f, - 4 => -0.3f, - 5 => -0.4f, - 6 => -0.6f, - 7 => -0.9f, - 8 => -1.13f, - _ => -1.7f, - }; - if (timeValue == 9) - { - returning = true; - for (int i = 0; i < Main.maxNPCs; i++) - Projectile.localNPCImmunity[i] = 0; - Projectile.numHits = 0; - } - Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * turnMult * dir); - - // Making things look convincingly "watery" takes a lot of visual work... - Visuals(); - - time += returning ? -1 : 1; - } - public void Visuals() - { - if (Main.rand.NextBool()) - { - // If you're looking at this to use the water effects, this is the main one I recommend you take - Particle waterfx = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.7f, "CalamityMod/Particles/WaterFoam", false, 9, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.5f); - GeneralParticleHandler.SpawnParticle(waterfx); - } - - Particle projBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 6, 0.3f, Color.RoyalBlue, new Vector2(1, 1f), true, false, shrinkSpeed: 0.5f); - GeneralParticleHandler.SpawnParticle(projBody); - - Vector2 tip = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35; - Particle seafoam = new CustomSpark(tip, Projectile.velocity * Main.rand.NextFloat(0.7f, 0.9f), "CalamityMod/Particles/BloomCircle", false, 2, Main.rand.NextFloat(0.35f, 0.45f), Color.White, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-0.4f, 0.4f)); - GeneralParticleHandler.SpawnParticle(seafoam); - if (Main.rand.NextBool(10)) - { - for (int i = 0; i < 2; i++) - { - Particle smallSeafoam = new CustomSpark(tip, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f), "CalamityMod/Particles/BloomCircle", true, 15, Main.rand.NextFloat(0.12f, 0.18f), Color.White * 0.7f, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1)); - GeneralParticleHandler.SpawnParticle(smallSeafoam); - - Dust dust = Dust.NewDustPerfect(tip + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.65f, 0.8f); - dust.color = Color.White; - dust.noLightEmittence = true; - } + float shortXVel = Projectile.velocity.X / 3f * (float)i; + float shortYVel = Projectile.velocity.Y / 3f * (float)i; + int fourConst = 4; + int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); + Dust dust = Main.dust[waterDust]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += Projectile.velocity * 0.1f; + dust.position.X -= shortXVel; + dust.position.Y -= shortYVel; } if (Main.rand.NextBool(5)) { - Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); - bubble.timeLeft = 12 + Main.rand.Next(8); - bubble.scale = Main.rand.NextFloat(0.5f, 0.9f); - bubble.type = Main.rand.NextBool(3) ? 412 : 411; + int otherFourConst = 4; + int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); + Main.dust[otherWaterDust].velocity *= 0.25f; + Main.dust[otherWaterDust].velocity += Projectile.velocity * 0.5f; + } + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.AddBuff(ModContent.BuffType(), 120); - float minMult = 0.1f; - int hitsToMinMult = 5; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; - } public override void OnKill(int timeLeft) { - Particle fadeOutfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); - GeneralParticleHandler.SpawnParticle(fadeOutfx); - for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + for (int k = 0; k < 10; k++) { - Particle fadeOutfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); - GeneralParticleHandler.SpawnParticle(fadeOutfx2); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); } } } diff --git a/Projectiles/Magic/WaywasherProj.png b/Projectiles/Magic/WaywasherProj.png new file mode 100644 index 0000000000..115a36bf88 Binary files /dev/null and b/Projectiles/Magic/WaywasherProj.png differ diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index c80d9b0306..418fff0c29 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -37,6 +38,16 @@ namespace CalamityMod.Projectiles.Magic } } + 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 void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index e1e5c9c80a..4a72466a8d 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -37,7 +38,15 @@ namespace CalamityMod.Projectiles.Magic } return false; } + 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 void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCHit7, Projectile.Center); diff --git a/Projectiles/Melee/AmidiasTridentBoltProj.cs b/Projectiles/Melee/AmidiasTridentBoltProj.cs deleted file mode 100644 index ae6f70f440..0000000000 --- a/Projectiles/Melee/AmidiasTridentBoltProj.cs +++ /dev/null @@ -1,100 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - class AmidiasTridentBoltProj : ModProjectile, ILocalizedModType - { - public override string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Particles/VerticalSmear"; - public override void SetDefaults() - { - base.SetDefaults(); - - Projectile.width = Projectile.height = 50; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 100; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.aiStyle = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.extraUpdates = 1; - } - bool start = false; - public override bool PreKill(int timeLeft) - { - - return base.PreKill(timeLeft); - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - SeaKingsAssurance.Apply(target, Vector2.Zero); - base.OnHitNPC(target, hit, damageDone); - } - public override void AI() - { - float sc = MathHelper.Clamp(Projectile.velocity.Length() / 8f, 0f, 0.8f); - - Lighting.AddLight(Projectile.Center, new Vector3(0f, 0.2f, 0.5f)); - Projectile.ai[1]++; - if (!start) - { - Projectile.velocity *= 2f; - Projectile.ai[0] = MathHelper.ToRadians(Main.rand.NextFloat(-1.6f, 1.6f)); - Projectile.velocity = Projectile.velocity.RotatedBy(-Projectile.ai[0] * 10f); - start = true; - } - else - { - NPC npc = CalamityUtils.ClosestNPCAt(Projectile.Center, 150); - - if (npc != null) - { - float rot = Projectile.velocity.ToRotation(); - float rot2 = rot.AngleLerp(Projectile.AngleTo(npc.Center), 0.1f); - - Projectile.velocity = Projectile.velocity.RotatedBy(rot2 - rot); - } - else - { - Projectile.velocity = Projectile.velocity.RotatedBy(Projectile.ai[0] / 1.5f); - } - } - - GeneralParticleHandler.SpawnParticle( - new AltSparkParticle(Projectile.Center, Projectile.velocity * 0.1f, false, 8, sc, SeaKingsAssurance.BaseColor.MultiplyRGBA(new(1f, 1f, 1f, 0f))) - ); - - Projectile.velocity *= 0.89f; - if (Projectile.velocity.Length() < 1f) Projectile.Kill(); - } - public override bool PreDraw(ref Color lightColor) - { - Asset MainTexture = ModContent.Request("CalamityMod/Particles/VerticalSmear"); - - float vel = Projectile.velocity.Length() / 50f; - - Main.EntitySpriteDraw(MainTexture.Value, Projectile.Center - Main.screenPosition, MainTexture.Frame(), - SeaKingsAssurance.BaseColor.MultiplyRGBA(new(1f, 1f, 1f, 0f)), Projectile.velocity.ToRotation() + MathHelper.PiOver2, MainTexture.Size() * new Vector2(0.5f, 0f), new Vector2( - vel, vel * 4f - ) * 0.7f, SpriteEffects.None); - for (int i = 0; i < 5; i++) - { - Main.EntitySpriteDraw(MainTexture.Value, Projectile.Center - Main.screenPosition, MainTexture.Frame(), - SeaKingsAssurance.LightColor.MultiplyRGBA(new(1f, 1f, 1f, 0f)), Projectile.velocity.ToRotation() + MathHelper.PiOver2, MainTexture.Size() * new Vector2(0.5f, 0f), new Vector2( - vel, vel * 4f - ) * 0.4f, SpriteEffects.None); - } - - return false; - } - } -} diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index a381b0710a..e4bbcfa42f 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -1,5 +1,4 @@ using System; -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,9 +12,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 5; - ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -140,8 +139,7 @@ namespace CalamityMod.Projectiles.Melee { return new Color(30, 255, 253); } - 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 OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs new file mode 100644 index 0000000000..b2befe5390 --- /dev/null +++ b/Projectiles/Melee/AquaStream.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class AquaStream : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.alpha = 150; + Projectile.penetrate = 2; + Projectile.timeLeft = 90; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + } + + public override void AI() + { + //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment + Projectile.velocity.X += Projectile.ai[0]; + Projectile.velocity.Y += Projectile.ai[1]; + + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = Projectile.Center; + dust = Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 1.5f); + dust.noGravity = true; + } + } +} diff --git a/Projectiles/Melee/AtaraxiaBoom.cs b/Projectiles/Melee/AtaraxiaBoom.cs index e8a9209d6c..b7ccf781d0 100644 --- a/Projectiles/Melee/AtaraxiaBoom.cs +++ b/Projectiles/Melee/AtaraxiaBoom.cs @@ -69,10 +69,8 @@ namespace CalamityMod.Projectiles.Melee } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.88f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float damageMult = MathHelper.Clamp(Utils.GetLerpValue(4, 0, Projectile.numHits), 0.2f, 1); + modifiers.SourceDamage *= damageMult; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0] == 1 ? 130 : 200, targetHitbox); } diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index f5d68cea54..a6f4ef8cec 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 5; ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 4; } public override void SetDefaults() @@ -33,16 +34,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { if (Projectile.ai[0] < 0f) - { Projectile.alpha = 0; - } if (Projectile.alpha > 0) - { Projectile.alpha -= 50; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 5) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.frame = 0; } if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) @@ -104,8 +108,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Main.rand.Next(0, 128)); - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.png b/Projectiles/Melee/BalefulHarvesterProjectile.png index ed73d2a5f7..f585ef78fb 100644 Binary files a/Projectiles/Melee/BalefulHarvesterProjectile.png and b/Projectiles/Melee/BalefulHarvesterProjectile.png differ diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 3c316d190c..da772a6a64 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; - Projectile.penetrate = -1; // Blazing blades and hyper blades hit four times, sunlight blades hit ten times. + Projectile.penetrate = -1; // Blazing blades and hyper blades hit four times, sunlight blades hit eleven times. Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; @@ -158,8 +158,8 @@ namespace CalamityMod.Projectiles.Melee bool hyperBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile; bool sunlightBlade = fullyVisibleDuration == DefiledGreatsword.ProjectileFullyVisibleDuration + DefiledGreatsword.ProjectileFullyVisibleDurationIncreasePerAdditionalProjectile * 2f; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Microsoft.Xna.Framework.Rectangle rectangle = asset.Frame(1, 4); + Texture2D asset = TextureAssets.Projectile[Type].Value; + Rectangle rectangle = asset.Frame(1, 4); Vector2 origin = rectangle.Size() / 2f; float num = Projectile.scale * 1.1f; SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index eb67acd237..0a46c41c5d 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; @@ -102,7 +103,10 @@ namespace CalamityMod.Projectiles.Melee { base.OnHitNPC(target, hit, damageDone); if (SwingMode == 2) + { + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Frozen, 20); + } } public override void AI() diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index c5ed0d8f22..7c7101a961 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { - Projectile.damage = (int)(Projectile.damage * 0.7f); + Projectile.damage = (int)(Projectile.damage * 0.5f); Projectile.ExpandHitboxBy((int)(128f * Projectile.scale)); Projectile.penetrate = -1; Projectile.Damage(); diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 379f8d6c13..6318cf0643 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -110,11 +110,6 @@ namespace CalamityMod.Projectiles.Melee return true; } - /*public override Color? GetAlpha(Color lightColor) - { - return new Color(150, Main.DiscoG, 255, 127); - }*/ - // Only inflict Nightwither if not spawned from Icebreaker public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index 9e308d1d6f..65c0577e3d 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -144,9 +144,7 @@ namespace CalamityMod.Projectiles.Melee DestroyTiles(); } - /* - * Sets the end of the laser position based on where it collides with something - */ + // Sets the end of the laser position based on where it collides with something private void SetLaserPosition(Player player) { Distance = MathHelper.Max(player.Distance(player.ClampedMouseWorld()) - 20f, MOVE_DISTANCE + 5f); @@ -228,9 +226,7 @@ namespace CalamityMod.Projectiles.Melee public override bool ShouldUpdatePosition() => false; - /* - * Update CutTiles so the laser will cut tiles (like grass) - */ + // Update CutTiles so the laser will cut tiles (like grass) public override bool? CanCutTiles() => IsAtMaxCharge ? null : false; public override void CutTiles() { diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 44797b6574..8b4d3ba979 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -1,10 +1,11 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { @@ -96,6 +97,15 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + 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 void OnKill(int timeLeft) { diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 8f22487732..3c3c5694d7 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Projectiles.Melee private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; - private const int FadeOutTime = 85; + private const int FadeOutTime = 30; - private const int TimeLeft = 215 + FadeOutTime; + private const int TimeLeft = 150 + FadeOutTime; private const int Alpha = 100; diff --git a/Projectiles/Melee/DeathsAscensionProjectile.cs b/Projectiles/Melee/DeathsAscensionProjectile.cs index 9492d93041..aa3fedfaa3 100644 --- a/Projectiles/Melee/DeathsAscensionProjectile.cs +++ b/Projectiles/Melee/DeathsAscensionProjectile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee // Player scythes just home if (Projectile.ai[2] <= 0) { - CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 18f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 21f, 20f); Projectile.velocity *= 0.96f; } // Rift scythes have orbital motion diff --git a/Projectiles/Melee/DeathsAscensionRift.cs b/Projectiles/Melee/DeathsAscensionRift.cs index fc66e3383a..5ca9df9a21 100644 --- a/Projectiles/Melee/DeathsAscensionRift.cs +++ b/Projectiles/Melee/DeathsAscensionRift.cs @@ -96,6 +96,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0]--; } } + public override bool? CanDamage() => false; public override void OnKill(int timeLeft) { diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index acb46b317d..891f073e4b 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee // This is needed because EntitySource_ItemUse always sets Projectile.originalDamage to the item's damage, // regardless of the value passed into the damage argument of NewProjectile. // This results in continuous updating damage resetting the damage. - Projectile.originalDamage *= 15; + Projectile.originalDamage *= DevilsDevastation.BigSlashDamageMult; } public override void WhenSpawned() { @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 2; Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType(), 0, 0f, Owner.whoAmI, 1, 0); } - Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.666f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * DevilsDevastation.MarkDamageMult), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); strike.DamageType = DamageClass.Melee; SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center); diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 94db48ae6e..18053a462e 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Melee } // ai[0] controls what type of Draconic Spark this is. - // 0 = Orange spark (inflicts Daybroken) - // 1 = Red spark (inflicts Abyssal Flames) - // 2 = Yellow spark (inflicts Holy Flames) + // 0 = Orange spark + // 1 = Red spark + // 2 = Yellow spark public override void AI() { DrawProjectile(); diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 708d4bba92..6ead67d9bf 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] % 4 == 0) { int type = ModContent.ProjectileType(); - int damage = Projectile.damage / 8; + int damage = Projectile.damage / 2; float kb = 3f; float speed = DragonPow.SparkSpeed; Vector2 vel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Melee { int type = ModContent.ProjectileType(); int numWaterfalls = 12; - int waterfallDamage = Projectile.damage / 6; + int waterfallDamage = Projectile.damage / 4; float waterfallKB = 0f; for (int i = 0; i < numWaterfalls; ++i) { diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 2f788e4530..46fa338742 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.015), 0.75f); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.01), 0.75f); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/EvilSmasherProjectile.cs b/Projectiles/Melee/EvilSmasherProjectile.cs index d7708dd214..958db0e7f4 100644 --- a/Projectiles/Melee/EvilSmasherProjectile.cs +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Melee RotateInStartup = 0; Projectile.width = 64; Projectile.height = 66; + Projectile.DamageType = AllClassDamageClass.Instance; } public override void Spawn() @@ -61,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee if (inStartup) { CurrentChargeMult = timer / (float)(StartupTime-1); - Owner.velocity.X *= 0.97f; + Owner.velocity.X *= CurrentChargeMult < 1 ? 0.98f : 0.995f; } if (inStartup && !Owner.channel && timer > 30) { @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee { Owner.velocity *= 0.15f; - Owner.velocity -= adjustedAngle.RotatedBy(MathHelper.PiOver2) * angle.X * MathHelper.Lerp(7.5f,16f, CurrentChargeMult); + Owner.velocity -= adjustedAngle.RotatedBy(MathHelper.PiOver2) * angle.X * MathHelper.Lerp(7.5f,16f, CurrentChargeMult) * (Projectile.scale / 1.25f); float ringRot = SwingCompletion < 0.5f ? 0 : MathHelper.PiOver2; GeneralParticleHandler.SpawnParticle(new CustomPulse(HammerFrontPos, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloatDirection(), 0.03f, 0.04f * (2 + CurrentChargeMult), 15)); GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.2f, 0.75f * (2 + CurrentChargeMult), 30)); @@ -124,6 +125,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact); } } + if (CooldownTimer == 1) + Owner.Calamity().ConsumeStealthByAttacking(); Owner.heldProj = Projectile.whoAmI; } @@ -186,8 +189,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item69 with { Volume = 1f, LimitsArePerVariant = false, MaxInstances = 1 }); } - target.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, CurrentChargeMult)); - Owner.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, CurrentChargeMult)); + target.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 1200, CurrentChargeMult)); + Owner.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 1200, CurrentChargeMult)); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index b50aac643e..becc25a285 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -368,25 +368,5 @@ namespace CalamityMod.Projectiles.Melee return false; } - /* - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.timeLeft); - writer.Write(Projectile.rotation); - writer.Write(Projectile.localAI[2]); - writer.Write(Projectile.localAI[0]); - - writer.WriteFlags(stuckInTarget, thrown); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.timeLeft = reader.Read(); - Projectile.rotation = reader.ReadSingle(); - Projectile.localAI[2] = reader.ReadSingle(); - Projectile.localAI[0] = reader.ReadSingle(); - - reader.ReadFlags(out stuckInTarget, out thrown); - } - */ } } diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index 4eeb944925..5f55b2ea97 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -530,23 +530,6 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition, null, Color.White, BaseRotation, texture.Size() / 2f, SquishVector * 3f * Projectile.scale, direction, 0); - /* - if (PerformingPowerfulSlash) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, swingFX, Main.GameViewMatrix.TransformationMatrix); - - float bouncyProgression = (float)Math.Sin(Progression * MathHelper.Pi); - swingFX.Parameters["color"].SetValue(Color.MediumSpringGreen.ToVector4() with { W = bouncyProgression * 0.5f }); - - for (int i = 0; i < 4; i++) - { - Vector2 offset = (i / 4f * MathHelper.TwoPi + SwingAngleShift + MathHelper.PiOver4).ToRotationVector2() * 2f * Projectile.scale; - Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition + offset, null, Color.White, BaseRotation, texture.Size() / 2f, SquishVector * 3f * Projectile.scale, direction, 0); - } - } - */ - Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index bae234c799..988ab29af4 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -21,12 +21,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 2; Projectile.MaxUpdates = 2; - Projectile.timeLeft = 600; + Projectile.timeLeft = 180; AIType = ProjectileID.SporeCloud; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8 * Projectile.MaxUpdates; } public override void AI() @@ -48,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > 175) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 7b5e9eb869..11d051bd9f 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -399,7 +399,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.25f; int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 2.9f : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? 2.5f : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index 68a27275bc..8a285a2d6e 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Melee private const float MaxVelocity = DarklightGreatsword.ShootSpeed * 12f; - private const int FadeOutTime = 85; + private const int FadeOutTime = 30; - private const int TimeLeft = 215 + FadeOutTime; + private const int TimeLeft = 150 + FadeOutTime; private const int Alpha = 100; diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index f7a5b243a0..7a8a30cd34 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -6,6 +6,7 @@ using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -16,6 +17,11 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.AllowsContactDamageFromJellyfish[Type] = true; + } + public override void SetDefaults() { Projectile.width = 150; diff --git a/Projectiles/Melee/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs index 4560a28a28..4bc74155ad 100644 --- a/Projectiles/Melee/LightspeedHoldout.cs +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -84,90 +84,61 @@ namespace CalamityMod.Projectiles.Melee public void Positioning(Vector2 toMouse) // Hand and holdout positioning { - if (DashState == 2) + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + + bool isDashing = DashState == 2; + Vector2 baseDir = isDashing ? Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) : toMouse; + Owner.ChangeDir(Math.Sign(baseDir.X)); + + float playerArmRotation = new Vector2(baseDir.X, baseDir.Y * Owner.gravDir).ToRotation(); + float worldArmRotation = baseDir.ToRotation(); // The absolute world angle to point the projectile + + float compositeArmRotation; + + if (isDashing) { - Vector2 dashDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); - Owner.ChangeDir(Math.Sign(dashDirection.X)); - - float dashArmRotation = dashDirection.ToRotation(); - float dashCompositeArmRotation = dashArmRotation + (MathHelper.TwoPi * 0.75f); - - Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, dashCompositeArmRotation); - Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); - bladeRot = 0; - - handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, dashCompositeArmRotation); + compositeArmRotation = playerArmRotation + (MathHelper.TwoPi * 0.75f); + handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation); Projectile.Center = handPos; - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = Owner.itemAnimation = 2; + // Keep projectile rotation in world space, but invert the offset direction when flipped + Projectile.rotation = worldArmRotation + (Owner.direction == 1 ? MathHelper.PiOver4 : MathHelper.Pi * 0.75f) * Owner.gravDir; - // Visual rotation - Projectile.rotation = dashArmRotation; - Projectile.rotation = Projectile.velocity.ToRotation() + (Owner.direction == 1 ? MathHelper.PiOver4 : MathHelper.Pi * 0.75f); - Projectile.rotation += 0.15f * Owner.direction; // Adjustment to make the tip look like its more directly pointing at cursor - - // Item rotation (for arm positioning) - Owner.itemRotation = dashArmRotation + MathHelper.PiOver4; - - if (Owner.direction != 1) - { - Owner.itemRotation -= MathHelper.TwoPi * 0.75f; - } - - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + Owner.itemRotation = playerArmRotation + MathHelper.PiOver4 - (Owner.direction != 1 ? MathHelper.TwoPi * 0.75f : 0f); } - else // If not in dash { - Owner.ChangeDir(Math.Sign(toMouse.X)); + compositeArmRotation = playerArmRotation + bladeRot - MathHelper.PiOver2; - float baseArmRotation = toMouse.ToRotation(); - float compositeArmRotation = baseArmRotation + bladeRot - MathHelper.PiOver2; - - Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation); - Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); - - Vector2 actualInnateOffset = innateOffset; + Vector2 actualOffset = innateOffset; if (Owner.direction == -1) { - actualInnateOffset.X += 1f; - actualInnateOffset.Y += 2f; + actualOffset.X += 1f; + actualOffset.Y += 2f; } - handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation) + actualInnateOffset.RotatedBy(baseArmRotation); - + actualOffset.Y *= Owner.gravDir; + handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation) + actualOffset.RotatedBy(worldArmRotation); Projectile.velocity = toMouse; - Projectile.rotation = toMouse.ToRotation() + bladeRot; - Projectile.rotation += MathHelper.PiOver2 * 0.5f; // Adjustment made so texture actually faces cursor - Projectile.rotation += 0.15f * Owner.direction; // Another to make the tip look like its more directly pointing at cursor + // Adjust sprite rotation logic to compensate for the vertical flip applied in PreDraw + float rotOffset = MathHelper.PiOver4 * Owner.gravDir; if (Owner.direction == -1) - { - Projectile.rotation -= MathHelper.TwoPi * 0.75f; - } + rotOffset -= (Owner.gravDir == 1f ? MathHelper.TwoPi * 0.75f : MathHelper.PiOver2); + Projectile.rotation = worldArmRotation + bladeRot + rotOffset; Projectile.Center = handPos + toMouse * Projectile.scale; - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = Owner.itemAnimation = 2; - - // Item rotation (for arm positioning) - Owner.itemRotation = Projectile.rotation - MathHelper.PiOver4; // Adjustment undone for arm pos - if (Owner.direction == -1) - { - Owner.itemRotation -= MathHelper.Pi; - } - else - { - Owner.itemRotation -= MathHelper.PiOver2; - } - - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); - + // Simplified: The messy itemRotation calculation mathematically reduces to just this! + Owner.itemRotation = compositeArmRotation; } + + Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation); + Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); } public override void AI() @@ -206,7 +177,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.altFunctionUse == 0 && DashState == 0) { - Projectile.Center += (Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f)); + Projectile.Center += (Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f)); // When using M1, randomly offset position UsePrimary(toMouse); } @@ -228,6 +199,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 stabOrigin = Projectile.Center; Vector2 stabTip = stabOrigin + stabDir * 62f * Projectile.scale; + // Spawn spawks extending out of the blade which represent the hitbox for (int i = 0; i < 4; i++) { Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f) * Projectile.scale; @@ -237,10 +209,27 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), 0.6f * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); + bool flipParticle = Owner.gravDir == -1 ? Owner.direction == 1 : Owner.direction == -1; + + float rotOffset = Owner.gravDir == -1 ? -MathHelper.PiOver4 : MathHelper.PiOver4; + Vector2 afterImageDir = Owner.direction == -1 ? stabDir.RotatedBy(rotOffset) : stabDir.RotatedBy(-rotOffset); + + Particle afterImage = new CustomSpark( + Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), + afterImageDir, + new("CalamityMod/Items/Weapons/Melee/Lightspeed"), + false, + Main.rand.Next(5, 9), + 0.6f * Main.rand.NextFloat(0.9f, 1.02f), + Color.White * Main.rand.NextFloat(0.66f, 0.825f), + new Vector2(1, 1), + true, + false, + flipHorizontal: flipParticle + ); GeneralParticleHandler.SpawnParticle(afterImage); - // Make blade randomly vibrate + // Make blade randomly vibrate and draw with quirks bladeRot = Main.rand.NextFloat(-0.12f, 0.3f) * Owner.direction; Projectile.scale *= Main.rand.NextFloat(0.75f, 1f); Projectile.Center += stabDir + Main.rand.NextVector2Circular(7f, 1.5f); @@ -249,9 +238,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation += bladeRot * 0.1f; // Make arm randomly vibrate if (Main.rand.NextBool()) - { Owner.SetCompositeArmFront(true, Main.rand.NextBool() ? CompositeArmStretchAmount.ThreeQuarters : CompositeArmStretchAmount.Quarter, Owner.itemRotation); - } stabSoundTimer++; if (stabSoundTimer % 3 == 0) @@ -297,26 +284,27 @@ namespace CalamityMod.Projectiles.Melee float eased = MathF.Pow(t, 1.2f); AltSpinRotation = eased * (4f * MathHelper.Pi * 0.7175f); - float orbitalAngle = AltSpinRotation * initialDirectionForThisAnim + (initialDirectionForThisAnim == -1 ? MathHelper.Pi : 0); + + float orbitalAngle = (AltSpinRotation * initialDirectionForThisAnim + (initialDirectionForThisAnim == -1 ? MathHelper.Pi : 0)) * Owner.gravDir; float orbitRadius = 40f; Projectile.Center = Owner.MountedCenter + orbitalAngle.ToRotationVector2() * orbitRadius; - float tangentAngle = orbitalAngle + (initialDirectionForThisAnim == 1 ? MathHelper.PiOver4 : -MathHelper.PiOver4 + MathHelper.Pi); - Projectile.rotation = tangentAngle; // Proper arm positioning - Vector2 armDirection = Projectile.Center - Owner.MountedCenter; - float baseArmRotation = armDirection.ToRotation(); + float rotOffset = MathHelper.PiOver4 * Owner.gravDir; + if (initialDirectionForThisAnim == -1) + rotOffset -= (Owner.gravDir == 1f ? MathHelper.TwoPi * 0.75f : MathHelper.PiOver2); - float compositeArmRotation = baseArmRotation + (initialDirectionForThisAnim == 1 ? MathHelper.TwoPi * 0.75f : -MathHelper.PiOver2); + Projectile.rotation = orbitalAngle + rotOffset; + + Vector2 armDirection = Projectile.Center - Owner.MountedCenter; + float playerArmRotation = new Vector2(armDirection.X, armDirection.Y * Owner.gravDir).ToRotation(); + + float compositeArmRotation = playerArmRotation + (initialDirectionForThisAnim == 1 ? MathHelper.TwoPi * 0.75f : -MathHelper.PiOver2); Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation); Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); - Owner.itemRotation = baseArmRotation; - if (Owner.direction == -1) - Owner.itemRotation += MathHelper.Pi; - - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + Owner.itemRotation = MathHelper.WrapAngle(compositeArmRotation); } // Mid-spin VFX @@ -390,7 +378,7 @@ namespace CalamityMod.Projectiles.Melee public float PierceWidthFunction(float completionRatio, Vector2 vertexPos) { float width = Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * Projectile.scale * 24f; - //Fade it out starkly near the end of the lunge + // Fade it out starkly near the end of the lunge width *= (1 - (float)Math.Pow(LungeProgression, 4)); return width; } @@ -400,15 +388,21 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; - Rectangle frame = new Rectangle(0, Projectile.frame * frameHeight, texture.Width, frameHeight); - Vector2 origin = new Vector2(texture.Width / 2f, frameHeight / 2f); + Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 origin = frame.Size() / 2f; - SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - lightColor = Color.White; // Fullbright - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, 0.6f, spriteEffects, 0); + SpriteEffects spriteEffects = SpriteEffects.None; + if (Owner.direction == -1) + spriteEffects |= SpriteEffects.FlipHorizontally; - DrawPierceTrail(); + // Account for inverse gravity + if (Owner.gravDir == -1f) + spriteEffects |= SpriteEffects.FlipVertically; + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White * Projectile.Opacity, Projectile.rotation, origin, 0.6f, spriteEffects, 0); + + if (DashState == 2) + DrawPierceTrail(); return false; } diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs index aad114d70e..42639269a0 100644 --- a/Projectiles/Melee/LightspeedM1Hitbox.cs +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -15,9 +16,13 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; - public bool gotEnergyThisSwing = false; + public override void SetStaticDefaults() + { + ProjectileID.Sets.AllowsContactDamageFromJellyfish[Type] = true; + } + public override void SetDefaults() { Projectile.width = 25; diff --git a/Projectiles/Melee/MawOfInfinityHoldout.cs b/Projectiles/Melee/MawOfInfinityHoldout.cs index 48323eefee..4cc5afab86 100644 --- a/Projectiles/Melee/MawOfInfinityHoldout.cs +++ b/Projectiles/Melee/MawOfInfinityHoldout.cs @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee jawScaleMult = 1-CooldownCompletion; jawScaleMult = MathF.Pow(jawScaleMult, 3); float rotation = Projectile.rotation - (Projectile.spriteDirection == -1 ? MathHelper.PiOver2: 0); - Vector2 DrawPos = Projectile.Center + Projectile.scale * new Vector2(50,10 * Projectile.spriteDirection).RotatedBy(Projectile.rotation - MathHelper.PiOver2 + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver4 : MathHelper.PiOver4)); + Vector2 DrawPos = Projectile.Center + Projectile.scale * new Vector2(50,-10 * Projectile.spriteDirection).RotatedBy(Projectile.rotation - MathHelper.PiOver2 + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver4 : MathHelper.PiOver4)); Main.spriteBatch.SetBlendState(BlendState.Additive); Main.spriteBatch.Draw(tex, DrawPos - Main.screenPosition, tex.Frame(2,1,0,0), modplayer.swingNum == 1 ? Color.Fuchsia : Color.Cyan, rotation + MathHelper.PiOver4, new Vector2(tex.Width * 0.25f,tex.Height * 0.5f), Projectile.scale * jawScaleMult, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); 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/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index 96fa3fea63..f546630e46 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) + if (!CalamityClientConfig.Instance.Photosensitivity && Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f * Projectile.scale, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); diff --git a/Projectiles/Melee/PrismaticBreakerHoldout.cs b/Projectiles/Melee/PrismaticBreakerHoldout.cs index 8fb31ba0a0..695b97e58b 100644 --- a/Projectiles/Melee/PrismaticBreakerHoldout.cs +++ b/Projectiles/Melee/PrismaticBreakerHoldout.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(CrystylCrusher.ChargeSound, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); if (Timer == LaserChargeTime && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * LaserDamageMult), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.originalDamage * LaserDamageMult), Projectile.knockBack, Projectile.owner); } } diff --git a/Projectiles/Melee/PrismaticMagicCircle.cs b/Projectiles/Melee/PrismaticMagicCircle.cs index 66d896bd66..c6fa14f957 100644 --- a/Projectiles/Melee/PrismaticMagicCircle.cs +++ b/Projectiles/Melee/PrismaticMagicCircle.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); SoundEngine.PlaySound(Items.Weapons.DraedonsArsenal.TeslaCannon.FireSound with { Pitch = 1f }); Vector2 spawnPos = Vector2.Lerp(Projectile.Center, Owner.Center, 0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Projectile.velocity, ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner); } } diff --git a/Projectiles/Melee/RemsRevengeExplosion.cs b/Projectiles/Melee/RemsRevengeExplosion.cs index 6289b62d1e..adc02309a1 100644 --- a/Projectiles/Melee/RemsRevengeExplosion.cs +++ b/Projectiles/Melee/RemsRevengeExplosion.cs @@ -66,7 +66,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = MathHelper.Clamp(Utils.GetLerpValue(3, 0, Projectile.numHits), 0.1f, 1); + modifiers.SourceDamage *= damageMult; + modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); } diff --git a/Projectiles/Melee/RiptideWave.cs b/Projectiles/Melee/RiptideWave.cs deleted file mode 100644 index 3e80596056..0000000000 --- a/Projectiles/Melee/RiptideWave.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RiptideWave : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public const int Lifetime = 30; - - public float RotationDirection = 1f; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = Lifetime; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.aiStyle = -1; - } - - public override void AI() - { - Projectile.rotation += MathHelper.Lerp(0.3f, 0f, Projectile.timeLeft / (float)Lifetime) * RotationDirection; - - float MaxSize = 135f * Projectile.ai[1]; - - // Stay on top of the yoyo. - if (Main.projectile[(int)Projectile.ai[0]].active) - Projectile.Center = Vector2.Lerp(Projectile.Center, Main.projectile[(int)Projectile.ai[0]].Center + Main.projectile[(int)Projectile.ai[0]].velocity, 0.2f); - - // Expand the hitbox as lifespan goes on. - int waveSize = (int)MathHelper.Lerp(MaxSize, 16, Projectile.timeLeft / (float)Lifetime); - Projectile.ExpandHitboxBy(waveSize); - - // Fade out. - if (Projectile.timeLeft <= 20) - Projectile.alpha += (int)(12 * Projectile.ai[1]); - } - - // Ensure knockback is always applied away from the player. - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Main.player[Projectile.owner].Center.X).ToDirectionInt(); - - public override bool PreDraw(ref Color lightColor) - { - Texture2D waveTex = ModContent.Request("CalamityMod/Particles/SeaFoam").Value; - Rectangle frame = waveTex.Frame(1, 3, 0, (int)Projectile.ai[2]); - Color Col = Color.Lerp(Color.DarkSlateBlue, Color.DeepSkyBlue, Projectile.ai[1]); - Color waveColor = Lighting.GetColor((Projectile.Center / 16).ToPoint()).MultiplyRGBA(Color.Lerp(Color.Transparent, Col, Projectile.Opacity).MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); - float waveScale = Projectile.width / (float)waveTex.Width; - Main.EntitySpriteDraw(waveTex, Projectile.Center - Main.screenPosition, frame, waveColor, Projectile.rotation, frame.Size() / 2f, waveScale, SpriteEffects.None); - - Color ringColor = Lighting.GetColor((Projectile.Center / 16).ToPoint()).MultiplyRGBA(Color.Lerp(Color.Transparent, Col.MultiplyRGBA(new Color(0.6f, 0.8f, 1f, 0f)), Projectile.Opacity)); - Texture2D ringTex = ModContent.Request("CalamityMod/Particles/HollowCircleSoftEdge").Value; - float ringScale = Projectile.width / (float)ringTex.Width; - Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition, null, ringColor, Projectile.rotation, ringTex.Size() / 2f, ringScale, SpriteEffects.None); - - return false; - } - } -} diff --git a/Projectiles/Melee/RoxcaliburProj.cs b/Projectiles/Melee/RoxcaliburProj.cs index 3b9034c5f4..e68a091c84 100644 --- a/Projectiles/Melee/RoxcaliburProj.cs +++ b/Projectiles/Melee/RoxcaliburProj.cs @@ -55,18 +55,18 @@ namespace CalamityMod.Projectiles.Melee //more precise hitbox. makes the weapon harder to use but looks visually better: use it if you want. /* - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (HitTimer <= 0) - { - float size = Projectile.Size.Length(); - Vector2 hiltPos = Projectile.Center - Projectile.velocity * size / 2; - Vector2 endPos = Projectile.Center + Projectile.velocity * size / 2; - float useless = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), hiltPos, endPos, size / 2, ref useless); - } - return base.Colliding(projHitbox, targetHitbox); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (HitTimer <= 0) + { + float size = Projectile.Size.Length(); + Vector2 hiltPos = Projectile.Center - Projectile.velocity * size / 2; + Vector2 endPos = Projectile.Center + Projectile.velocity * size / 2; + float useless = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), hiltPos, endPos, size / 2, ref useless); + } + return base.Colliding(projHitbox, targetHitbox); + } */ public override void AI() diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index 1ff0f70ab3..184bb4b4dc 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 26; + Projectile.height = 26; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; diff --git a/Projectiles/Melee/SandBlade.png b/Projectiles/Melee/SandBlade.png index fccc308168..69b4d66e1a 100644 Binary files a/Projectiles/Melee/SandBlade.png and b/Projectiles/Melee/SandBlade.png differ 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/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs new file mode 100644 index 0000000000..c493bcb217 --- /dev/null +++ b/Projectiles/Melee/SeashineSwordProj.cs @@ -0,0 +1,118 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SeashineSwordProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + private const int TimeLeft = 120; + + private const int MaxAlpha = 255; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 10; + ProjectileID.Sets.TrailingMode[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = TimeLeft; + Projectile.alpha = MaxAlpha; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue); + + if (Projectile.localAI[1] < 7f) + { + Projectile.localAI[1] += 1f; + } + else + { + float dustScale = 1.8f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + + dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= -0.25f; + Main.dust[dust].position -= Projectile.velocity * 0.5f; + + if (Projectile.localAI[0] == 0f) + { + Projectile.scale -= 0.02f; + Projectile.alpha += 10; + if (Projectile.alpha >= MaxAlpha - 5) + { + Projectile.alpha = MaxAlpha; + Projectile.localAI[0] = 1f; + } + } + else if (Projectile.localAI[0] == 1f) + { + Projectile.scale += 0.02f; + Projectile.alpha -= 10; + if (Projectile.alpha <= 0) + { + Projectile.alpha = 0; + Projectile.localAI[0] = 0f; + } + } + } + + if (Projectile.ai[1] == 0f) + { + Projectile.ai[1] = 1f; + SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > TimeLeft - 5) + return false; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue); + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + + for (int i = 4; i < 31; i++) + { + float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); + float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); + + float dustScale = 3.6f * Projectile.scale; + int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + + dustScale = 3f * Projectile.scale; + dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + } + } + } +} diff --git a/Projectiles/Summon/SeashineSwordProj.png b/Projectiles/Melee/SeashineSwordProj.png similarity index 100% rename from Projectiles/Summon/SeashineSwordProj.png rename to Projectiles/Melee/SeashineSwordProj.png diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 43171a0be7..5fc0e0be7b 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee Owner.SetScreenshake(3f); SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 0.5f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0, 0.5f); proj.timeLeft = (int)(45 / Projectile.scale); proj.scale = Projectile.scale; swingCount = 0; @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0, 1f); proj.scale = Projectile.scale; swingCount = -1; attackPower = 0; diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 597a56c049..1581375c55 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -1,31 +1,21 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.NPCs; -using ReLogic.Content; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Particles; -using Terraria.Audio; -using System; -using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Projectiles.Melee.Spears { - [PierceResistException] - public class AmidiasTridentProj : BaseCustomUseStyleProjectile + public class AmidiasTridentProj : BaseSpearProjectile { - public override int AssignedItemID => ModContent.ItemType(); public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override void SetDefaults() { - Projectile.width = Projectile.height = 50; + Projectile.width = Projectile.height = 28; Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 2; + Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; Projectile.tileCollide = false; @@ -33,220 +23,14 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.hide = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; } - float rot = 0f; - float glow = 0f; - public override void ModifyDamageHitbox(ref Rectangle hitbox) + + public override float InitialSpeed => 3f; + public override float ReelbackSpeed => 1f; + public override float ForwardSpeed => 0.75f; + public override Action EffectBeforeReelback => (proj) => { - Vector2 cen = Projectile.Center + new Vector2(45, 0).RotatedBy(rot); - hitbox = new Rectangle((int)cen.X - 40, (int)cen.Y - 40, 80, 80); - - if (Owner.altFunctionUse == 2) - { - cen = Owner.Center; - hitbox = new Rectangle((int)cen.X - 80, (int)cen.Y - 80, 160, 160); - } - } - public override void WhenSpawned() - { - Projectile.ai[0] = -20; - rot = Owner.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); - } - public override void UseStyle() - { - glow = MathHelper.Lerp(glow, 0f, 0.12f); - Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X); - - switch (Owner.altFunctionUse) - { - case 2: // Alt attack - Projectile.localNPCHitCooldown = 4; - - if (AnimationProgress <= 0) - Projectile.ai[0] = 20; - - if (AnimationProgress < 20) - { - if (AnimationProgress == 1) - { - SoundStyle soundStyle = new SoundStyle("CalamityMod/Sounds/Item/AmidiasTrident_Spin"); - soundStyle.MaxInstances = 5; - SoundEngine.PlaySound(soundStyle, Owner.Center); - } - if (AnimationProgress % 2 == 0) - { - for (int i = 0; i < 3; i++) - GeneralParticleHandler.SpawnParticle(new CustomPulse(Owner.Center, Vector2.Zero, SeaKingsAssurance.BaseColor, - "CalamityMod/Particles/CircularSmearFire3", Vector2.One, Projectile.rotation, 0.8f, 1.2f, 6, effects: Owner.direction > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally)); - } - - glow = MathHelper.Lerp(glow, Projectile.ai[0] * 0.05f / 3f, 0.2f); - rot += MathHelper.ToRadians(Projectile.ai[0] * 0.8f * Owner.direction); - if (AnimationProgress < 5) - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 60, 0.2f); - else if (AnimationProgress >= 10) - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 20, 0.2f); - else - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 40, 0.2f); - } - else - { - if (AnimationProgress == 20) - { - ExpendStacks(); - - SoundStyle soundStyle = new SoundStyle("CalamityMod/Sounds/Item/AmidiasTrident_Raise"); - soundStyle.MaxInstances = 5; - SoundEngine.PlaySound(soundStyle, Owner.Center); - glow = 1.5f; - rot = -MathHelper.PiOver2; - } - - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 60, 0.3f); - } - - Projectile.rotation = rot + MathHelper.ToRadians(135f); - AbsolutePosition = Owner.Center + new Vector2(Projectile.ai[0], 0).RotatedBy(rot); - break; - - - default: // Main attack - if (AnimationProgress < 21) - { - rot = Owner.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(); - if (AnimationProgress % 7 < 2) - { - if (AnimationProgress % 7 == 1) - { - SoundStyle soundStyle = new SoundStyle("CalamityMod/Sounds/Item/AmidiasTrident_Stab" + Main.rand.Next(1, 3).ToString()); - soundStyle.MaxInstances = 5; - soundStyle.PitchVariance = 0.2f; - SoundEngine.PlaySound(soundStyle.WithPitchOffset(0.2f), Owner.Center); - for (int i = 0; i < 6; i++) - { - CustomSpark p = new CustomSpark(Projectile.Center + new Vector2(20, Main.rand.NextFloat(-30, 30)).RotatedBy(rot), Owner.DirectionTo(AbsolutePosition) * 10, "CalamityMod/Particles/ThinEndedLine", false, 5, 1f, Color.CadetBlue.MultiplyRGBA(new(1f, 1f, 1f, 1f)), new Vector2(0.2f, 1.2f)); - GeneralParticleHandler.SpawnParticle(p); - } - if (Main.myPlayer == Projectile.owner) - { - Lighting.AddLight(Projectile.Center, new Vector3(0.2f, 0.45f, 1f)); - Vector2 vel = (Projectile.rotation + MathHelper.ToRadians(-135f)).ToRotationVector2() * 30f; - Projectile.NewProjectile(new EntitySource_Parent(Projectile), Projectile.Center + new Vector2(-30, 0).RotatedBy(Projectile.rotation + MathHelper.ToRadians(-135f)), - vel, ModContent.ProjectileType(), (int)(Projectile.damage * AmidiasTrident.BaseAttackProjectileMult), Projectile.knockBack / 2, Projectile.owner); - } - } - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 92, 0.3f); - glow = MathHelper.Lerp(glow, 1f, 0.3f); - } - else - { - if (AnimationProgress % 7 < 4) - { - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 10, 0.3f); - } - else - { - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 10, 0.1f); - } - } - } - else - { - rot = rot.AngleLerp(Owner.DirectionTo(Owner.Calamity().mouseWorld).ToRotation(), 0.3f); - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 10, 0.1f); - } - - Projectile.rotation = rot + MathHelper.ToRadians(135f); - AbsolutePosition = Owner.Center + new Vector2(Projectile.ai[0], 0).RotatedBy(rot); - break; - } - } - - public override bool? CanDamage() => (Owner.altFunctionUse == 0 && AnimationProgress < 21 && AnimationProgress % 7 < 2) || (Owner.altFunctionUse == 2 && AnimationProgress < 20); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Owner.altFunctionUse == 2 && AnimationProgress < 20) - modifiers.SourceDamage *= AmidiasTrident.SecondaryAttackMeleeMult; - } - - private void ExpendStacks() - { - foreach (NPC npc2 in Main.npc) - { - if (npc2.active && !npc2.friendly && !npc2.isLikeATownNPC) - { - if (npc2.Distance(Owner.Center) < 200) - { - if (npc2.HasBuff(ModContent.BuffType())) - { - int stacks = (int)Math.Ceiling((double)npc2.buffTime[npc2.FindBuffIndex(ModContent.BuffType())] / SeaKingsAssurance.FramesPerStack); - - DamageEffect(npc2, stacks); - - npc2.DelBuff(npc2.FindBuffIndex(ModContent.BuffType())); - } - } - } - } - - for (int i = 0; i < 5; i++) - { - GeneralParticleHandler.SpawnParticle(new CustomPulse( - Owner.Center, Vector2.Zero, SeaKingsAssurance.LightColor, "CalamityMod/Particles/ShineExplosion2", new Vector2(Main.rand.NextFloat(0.2f, 0.3f), Main.rand.NextFloat(0.1f, 0.15f)), - 0f, 0.6f, 1.2f, 6 - )); - } - } - - private static void DamageEffect(NPC npc, int stacks) - { - Projectile.NewProjectileDirect(new EntitySource_Buff(npc, ModContent.BuffType(), - npc.FindBuffIndex(ModContent.BuffType())), npc.Center, Vector2.Zero, ModContent.ProjectileType(), - AmidiasTrident.SecondaryAttackBlastBaseDamage * stacks, 0f, ai0: npc.whoAmI); - - for (int i = 0; i < 5; i++) - { - GeneralParticleHandler.SpawnParticle(new CustomPulse( - npc.Center, Vector2.Zero, SeaKingsAssurance.LightColor, "CalamityMod/Particles/ShineExplosion2", new Vector2(Main.rand.NextFloat(0.2f, 0.3f), Main.rand.NextFloat(0.1f, 0.15f)), - 0f, 0.2f, 0.8f, 6 - )); - } - - for (int i = 0; i < 5; i++) - { - float rot = Main.rand.NextFloat(MathHelper.TwoPi) + MathHelper.PiOver2; - float sc = 0.3f; - - GeneralParticleHandler.SpawnParticle(new CustomPulse( - npc.Center, (rot - MathHelper.PiOver2).ToRotationVector2() * 6f, Color.Lerp(SeaKingsAssurance.BaseColor, SeaKingsAssurance.LightColor, sc * 3f), "CalamityMod/Particles/ForwardSmear", new Vector2(Main.rand.NextFloat(0.015f, 0.1f), 0.1f), - rot, sc, sc * 2f, 8 - )); - } - - } - - public static readonly Asset StabTexture = ModContent.Request("CalamityMod/Particles/LargeSpark"); - public static readonly Asset SwingTexture = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); - public override bool PreDraw(ref Color lightColor) - { - Asset tex = ModContent.Request("CalamityMod/Particles/GlowBlade"); - - for (int i = 0; i < 5; i++) - { - int f = (int)(tex.Height() * glow); - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(-60 + (f * 0.03f), 0).RotatedBy(rot) + new Vector2(0f, Owner.gfxOffY), new Rectangle(0, 0, tex.Width(), f), Color.DeepSkyBlue.MultiplyRGBA(new(glow, glow, glow, 0f)), rot + MathHelper.PiOver2, new Vector2(tex.Width() / 2, tex.Height()), new Vector2(0.03f), SpriteEffects.None); - } - - return base.PreDraw(ref lightColor); - } - public override void AI() - { - base.AI(); - - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + MathHelper.ToRadians(135f)); - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation + MathHelper.ToRadians(135f)); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner, 0f, 0f); + }; } } diff --git a/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs index 3960a33083..1f3ca8a45c 100644 --- a/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs +++ b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 10; } public override float InitialSpeed => 3f; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override Action EffectBeforeReelback => (proj) => { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 1.4f, - ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.7f, Projectile.owner); + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); }; public override void ExtraBehavior() diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 3dbc16e3d9..94f0eca909 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 3; i++) { - Vector2 featherVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 40f) * Main.rand.NextFloat(1.55f, 1.85f); + Vector2 featherVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 40f) * Main.rand.NextFloat(1f, 1.2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, featherVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 8d20e38bb7..f6fe1cbd57 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 10; } public override float InitialSpeed => 3f; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); }; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 8c49023cac..9c6e0cd2a0 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 10; } public override float InitialSpeed => 3f; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override Action EffectBeforeReelback => (proj) => { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - Projectile.velocity * 4f, Projectile.velocity * 2.4f, - ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.85f, Projectile.owner); + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); }; public override void ExtraBehavior() diff --git a/Projectiles/Melee/Spears/VanishingPointProjectile.png b/Projectiles/Melee/Spears/VanishingPointProjectile.png index 254188b871..6d383712d8 100644 Binary files a/Projectiles/Melee/Spears/VanishingPointProjectile.png and b/Projectiles/Melee/Spears/VanishingPointProjectile.png differ diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 69151c2493..29bb27a473 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; - Projectile.timeLeft = 600; + Projectile.timeLeft = 120; AIType = ProjectileID.LightBeam; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 595) + if (Projectile.timeLeft > 115) return false; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs index e187bb142b..893487755b 100644 --- a/Projectiles/Melee/StellarStrikerMeteor.cs +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { - Projectile.damage = (int)(Projectile.damage * 0.3f); + Projectile.damage = (int)(Projectile.damage * 0.25f); Projectile.ExpandHitboxBy((int)(285f * Projectile.scale)); Projectile.penetrate = -1; Projectile.Damage(); diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 0d8723c6a6..d100d1692f 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,6 +33,15 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, false, 200f, 12f, 20f); } + 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 void OnKill(int timeLeft) { diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index 23dbddc32c..367cbce543 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 53d6b7b334..fbb432a8cd 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,7 +50,15 @@ namespace CalamityMod.Projectiles.Melee } Projectile.rotation = Projectile.velocity.ToRotation(); } + 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 void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 6152096f2e..d8edaab018 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -138,8 +138,8 @@ namespace CalamityMod.Projectiles.Melee public void StickToOwner() { // Glue the sword to its owner. This applies a handful of offsets to make the blade look like it's roughly inside of the owner's hand. - Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + SwordDirection * new Vector2(7f, 16f) * Projectile.scale; - Projectile.Center -= Projectile.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(66f, 54f + Projectile.scale * 8f); + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + SwordDirection * new Vector2(7f, 7f) * Projectile.scale; + Projectile.Center -= Projectile.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(44f, 54f + Projectile.scale * 8f); // Set the owner's held projectile to this and register a false item time calculation. Owner.heldProj = Projectile.whoAmI; diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index cd8fb99aaf..048f991b1e 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -150,6 +151,15 @@ namespace CalamityMod.Projectiles.Melee return; } } + 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) { diff --git a/Projectiles/Melee/TriactisHammerExplosion.cs b/Projectiles/Melee/TriactisHammerExplosion.cs index d40436a217..95aff6781f 100644 --- a/Projectiles/Melee/TriactisHammerExplosion.cs +++ b/Projectiles/Melee/TriactisHammerExplosion.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(blastG); Particle blastB = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(3f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation + MathHelper.ToRadians(240f), 0f, 0.4f, 24); GeneralParticleHandler.SpawnParticle(blastB); - Owner.SetScreenshake(40f); + Owner.SetScreenshake(15f); } if (Timer % 4f == 0f) diff --git a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs index 49f6e7f207..13cf62a01b 100644 --- a/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs +++ b/Projectiles/Melee/TrueBiomeBlade_ChainedMeatHook.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; + Projectile.ContinuouslyUpdateDamageStats = true; Projectile.width = Projectile.height = 66; Projectile.tileCollide = false; Projectile.friendly = true; diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs index 48137f78b4..f8f5373825 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee Charge++; OverCharge--; Projectile.timeLeft = 2; - if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) + if ((Charge / MaxCharge >= 0.2f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.4f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.6f && CurrentIndicator == 2f) || (Charge / MaxCharge >= 0.8f && CurrentIndicator == 3f) && Owner.whoAmI == Main.myPlayer) { for (int s = 0; s < 2; s++) { @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee if (Charge >= MaxCharge) { Charge = MaxCharge; - if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) + if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 5f) { for (int s = 0; s < 5; s++) { diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index c88f451f81..a20df2e91d 100644 --- a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -108,18 +108,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos SoundEngine.PlaySound(fire with { Volume = 0.6f, PitchVariance = 0.2f }, Projectile.Center); } - // Technically scrapped because the weapon is complex enough, but we might want to use this in the future - /* - if (timer % 60 == 0) // Fire Heal Stars at player (slightly predictive) - { - Vector2 vel = ((Projectile.Center - Owner.Center) - Owner.velocity * 8).SafeNormalize(Vector2.UnitX) * -10; - Projectile healStar = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0, cloneYoyo ? 3 : 10, 5); - healStar.extraUpdates = 2; - SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); - SoundEngine.PlaySound(fireHeal with { Volume = 0.9f, Pitch = 0.3f }, Projectile.Center); - } - */ - if (timer > 0) { timer--; 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/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index 2cb9f3738d..20e1ec0bcc 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -1,10 +1,8 @@ using System.IO; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -30,19 +28,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(Projectile.localAI[1]); - writer.Write(Projectile.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) { Projectile.localAI[1] = reader.ReadSingle(); - Projectile.localAI[2] = reader.ReadSingle(); } public override void AI() @@ -50,34 +46,72 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) // 200 blocks Projectile.Kill(); - Projectile.localAI[2]++; - if (Projectile.localAI[2] % 10 == 0) + Projectile.localAI[1]++; + if (Projectile.localAI[1] % 15f == 0f) { - Projectile proj = Projectile.NewProjectileDirect(new EntitySource_ItemUse(Main.player[Projectile.owner], Main.player[Projectile.owner].HeldItem), - Projectile.Center, - Vector2.Zero, - ModContent.ProjectileType(), - Projectile.damage, - 0f, - Projectile.owner, - Projectile.whoAmI, - Projectile.localAI[1]); - (proj.ModProjectile as RiptideWave).RotationDirection = Projectile.localAI[2] % 20 == 0 ? -1 : 1; + float xVelocity = 0f; + float yVelocity = -10f; + float xIncrement = 1.2f; + float yIncrement = 0.2f; + switch (Projectile.localAI[1] / 15f) + { + case 1: + break; + + case 2: + xVelocity = 5f; + yVelocity = -5f; + xIncrement = 0.7f; + yIncrement = 0.7f; + break; + + case 3: + xVelocity = 10f; + yVelocity = 0f; + xIncrement = 0.2f; + yIncrement = 1.2f; + break; + + case 4: + xVelocity = 5f; + yVelocity = 5f; + xIncrement = -0.7f; + yIncrement = 0.7f; + break; + + case 5: + xVelocity = 0f; + yVelocity = 10f; + xIncrement = -1.2f; + yIncrement = -0.2f; + break; + + case 6: + xVelocity = -5f; + yVelocity = 5f; + xIncrement = -0.7f; + yIncrement = -0.7f; + break; + + case 7: + xVelocity = -10f; + yVelocity = 0f; + xIncrement = -0.2f; + yIncrement = -1.2f; + break; + + case 8: + Projectile.localAI[1] = 0f; + xVelocity = -10f; + yVelocity = -10f; + xIncrement = 0.7f; + yIncrement = -0.7f; + break; + } + + SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(xVelocity, yVelocity), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, xIncrement, yIncrement); } } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], 2f, 0.09f); - } - - public override bool PreDraw(ref Color lightColor) - { - Asset glowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); - - Main.EntitySpriteDraw(glowTexture.Value, Projectile.Center - Main.screenPosition, glowTexture.Frame(), new Color(0.05f, 0.1f, 0.25f, 0f), 0f, glowTexture.Frame().Size() / 2, 0.3f * Projectile.localAI[1], SpriteEffects.None); - - return true; - } } } diff --git a/Projectiles/Pets/Beldum.cs b/Projectiles/Pets/Beldum.cs new file mode 100644 index 0000000000..14de75451f --- /dev/null +++ b/Projectiles/Pets/Beldum.cs @@ -0,0 +1,173 @@ +using System; +using CalamityMod.Buffs.Pets; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Beldum : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Pets"; + public override void SetStaticDefaults() + { + Main.projPet[Type] = true; + Main.projFrames[Type] = 4; + ProjectileID.Sets.CharacterPreviewAnimations[Type] = ProjectileID.Sets.SimpleLoop(0, 0, 1) + .WithOffset(-8f, -20f).WithSpriteDirection(-1).WhenNotSelected(0, 0); + } + + public override void SetDefaults() + { + Projectile.netImportant = true; + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = false; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Vector2 beldumcenter = Projectile.Center; + Vector2 vectorbeldum = player.Center - beldumcenter; + float playerdistance = vectorbeldum.Length(); + if (!player.active) + { + Projectile.active = false; + return; + } + + //Delete the projectile if the player doesnt have the buff or is very far away (dunno if this needs to be deleted) + if (!player.HasBuff(ModContent.BuffType()) || playerdistance >= 4000f) + { + Projectile.Kill(); + } + + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.beldum = false; + } + if (modPlayer.beldum) + { + Projectile.timeLeft = 2; + } + + if (player.InInteractionRange((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, TileReachCheckSettings.Simple)) + { + if (Projectile.Hitbox.Contains(player.ClampedMouseWorld().ToPoint())) + { + if (player.controlUseItem && player.velocity == Vector2.Zero) + { + Projectile.ai[1] = Projectile.ai[1] == 1 ? 0 : 1; + } + else if (player.controlUseTile) + { + Projectile.ai[1] = Projectile.ai[1] == 2 ? 0 : 2; + } + } + } + + // Normal behaviour + if (Projectile.ai[1] == 0) + { + Projectile.FloatingPetAI(false, 0); + } + // Being pet + else if (Projectile.ai[1] == 1) + { + if (player.velocity != Vector2.Zero || player.HasIFrames()) + { + Projectile.ai[1] = 0; + } + else + { + Projectile.Center = player.Center + new Vector2(40 * player.direction, 0); + Projectile.velocity = Vector2.Zero; + PlayerPetting(); + } + } + // Shoulder + else + { + Projectile.Center = player.Center + new Vector2(0, -20 * player.gravDir) + Vector2.UnitY * player.gfxOffY; + } + + if (Projectile.ai[1] != 2) + { + Projectile.ai[0]++; + if (Projectile.ai[1] == 0) + { + Projectile.spriteDirection = -Projectile.velocity.X.DirectionalSign(); + Projectile.rotation = MathF.Sin(Projectile.ai[0] * 0.05f) * MathHelper.ToRadians(20); + } + else + { + Projectile.spriteDirection = -Projectile.DirectionTo(player.Center).X.DirectionalSign(); + Projectile.rotation = MathF.Sin(Projectile.ai[0] * 0.05f) * MathHelper.ToRadians(5); + } + } + else + { + Projectile.ai[0] = 0; + Projectile.rotation = 0; + Projectile.spriteDirection = -player.direction; + } + + if (Main.rand.NextBool(600) && Projectile.ai[2] == 0) + { + Projectile.ai[2] = 1; + } + + if (Projectile.ai[2] == 1) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) + { + Projectile.frameCounter = 0; + Projectile.frame++; + } + + if (Projectile.frame > 3) + { + Projectile.frame = 0; + Projectile.ai[2] = 0; + } + } + } + + public void PlayerPetting() + { + Player player = Main.player[Projectile.owner]; + int targetDirection = (Projectile.Center.X > player.Center.X) ? 1 : (-1); + player.StopVanityActions(); + player.ChangeDir(targetDirection); + player.gravDir = 1f; + int completion = player.miscCounter % 14 / 7; + Player.CompositeArmStretchAmount stretch = Player.CompositeArmStretchAmount.ThreeQuarters; + if (completion == 1) + { + stretch = Player.CompositeArmStretchAmount.Full; + } + player.SetCompositeArmBack(enabled: true, stretch, player.DirectionTo(Projectile.Center).ToRotation() - MathHelper.PiOver2); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + SpriteEffects fx = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (Main.player[Projectile.owner].gravDir == -1) + fx |= SpriteEffects.FlipVertically; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + Vector2.UnitY * MathF.Cos(Projectile.ai[0] * 0.05f) * (Projectile.ai[1] == 0 ? 10 : 2), tex.Frame(1, 4, 0, Projectile.frame), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(tex.Width / 2, tex.Height / Main.projFrames[Type] / 2), Projectile.scale, fx); + return false; + } + } +} diff --git a/Projectiles/Pets/Beldum.png b/Projectiles/Pets/Beldum.png new file mode 100644 index 0000000000..ff86674959 Binary files /dev/null and b/Projectiles/Pets/Beldum.png differ diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 9bcfc40ee6..87cca66150 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -153,21 +153,11 @@ IL_6899: if (Projectile.tileCollide) { Projectile.hide = false; - - //if (projectile.extraUpdates == 1) PreventFastfall(); - - /*Vector2 distance = Main.player[projectile.owner].Center - projectile.Center; - if (distance.Length() < 100) - projectile.extraUpdates = 0; - else - projectile.extraUpdates = 1;*/ } else { Projectile.hide = true; - //projectile.extraUpdates = 1; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Projectile.owner, (float)Projectile.identity); } diff --git a/Projectiles/Pets/DannyDevitoPet.cs b/Projectiles/Pets/DannyDevitoPet.cs index a57bd3e2d5..5a0fd9662a 100644 --- a/Projectiles/Pets/DannyDevitoPet.cs +++ b/Projectiles/Pets/DannyDevitoPet.cs @@ -249,53 +249,6 @@ namespace CalamityMod.Projectiles.Pets } } - /*public override void PostDraw(Color lightColor) - { - if (!Main.gamePaused || Main.gameMenu) - { - Vector2 projDirect = projectile.position - Main.screenPosition; - if ((float)Main.mouseX > projDirect.X && (float)Main.mouseX < projDirect.X + (float)projectile.width && (float)Main.mouseY > projDirect.Y && (float)Main.mouseY < projDirect.Y + (float)projectile.height) - { - int playerTileX = (int)(Main.player[projectile.owner].Center.X / 16f); - int playerTileY = (int)(Main.player[projectile.owner].Center.Y / 16f); - int projTileX = (int)projectile.Center.X / 16; - int projTileY = (int)projectile.Center.Y / 16; - int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; - int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; - if (playerTileX >= projTileX - lastTileRangeX && playerTileX <= projTileX + lastTileRangeX + 1 && playerTileY >= projTileY - lastTileRangeY && playerTileY <= projTileY + lastTileRangeY + 1) - { - Main.player[projectile.owner].noThrow = 2; - Main.player[projectile.owner].cursorItemIconEnabled = true; - Main.player[projectile.owner].cursorItemIconID = 3213; - if (PlayerInput.UsingGamepad) - { - Main.player[projectile.owner].GamepadEnableGrappleCooldown(); - } - if (Main.mouseRight && Main.mouseRightRelease && Player.StopMoneyTroughFromWorking == 0) - { - Main.mouseRightRelease = false; - if (Main.player[projectile.owner].chest == -2) - { - Main.PlaySound(SoundID.Item11, -1, -1); - Main.player[projectile.owner].chest = -1; - Recipe.FindRecipes(); - return; - } - Main.player[projectile.owner].GetCalamityPlayer().trashManChest = projectile.type; - Main.player[projectile.owner].chest = -2; - Main.player[projectile.owner].chestX = (int)(projectile.Center.X / 16f); - Main.player[projectile.owner].chestY = (int)(projectile.Center.Y / 16f); - Main.player[projectile.owner].talkNPC = -1; - Main.npcShop = 0; - Main.playerInventory = true; - Main.PlaySound(SoundID.Item10, -1, -1); - Recipe.FindRecipes(); - } - } - } - } - }*/ - private bool HoleBelow() //pretty much the same as the one used in mantis { int tileWidth = 4; diff --git a/Projectiles/PowderTransformationsProjectile.cs b/Projectiles/PowderTransformationsProjectile.cs new file mode 100644 index 0000000000..65e26c45d6 --- /dev/null +++ b/Projectiles/PowderTransformationsProjectile.cs @@ -0,0 +1,52 @@ +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.NormalNPCs.HorribleHog; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles +{ + public class PowderTransformationsProjectile : GlobalProjectile + { + public override bool AppliesToEntity(Projectile entity, bool lateInstantiation) + { + return entity.type == ProjectileID.VilePowder || entity.type == ProjectileID.ViciousPowder || entity.type == ProjectileID.PurificationPowder; + } + + public override void AI(Projectile projectile) + { + // Transform certain NPCs into different variants when contact is made with Vile/Vicious Powder or Purification Powder. + // Currently only used for Piggy, Divine Swine and Horrible Hog. + + bool isPurePowder = projectile.type == ProjectileID.PurificationPowder; + bool isEvilPowder = projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder; + + foreach (NPC npc in Main.ActiveNPCs) + { + bool targetIsPiggy = npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType(); + bool targetIsDivineSwine = npc.type == ModContent.NPCType(); + bool targetIsHorribleHog = npc.type == ModContent.NPCType(); + + if (!targetIsPiggy && !targetIsDivineSwine && !targetIsHorribleHog) + continue; + + if (projectile.Hitbox.Intersects(npc.Hitbox)) + { + if (targetIsPiggy && npc.ModNPC().TryTransformingIntoVariant()) + { + if (isEvilPowder) + npc.ModNPC().TransformIntoVariant(ModContent.NPCType()); + else if (isPurePowder) + npc.ModNPC().TransformIntoVariant(ModContent.NPCType()); + } + + if (targetIsDivineSwine && isEvilPowder && npc.ModNPC().TryTransformingIntoPiggy()) + npc.ModNPC().TransformIntoPiggy(); + + if (targetIsHorribleHog && isPurePowder && npc.ModNPC().TryTransformingIntoPiggy()) + npc.ModNPC().TransformIntoPiggy(); + } + } + } + } +} 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/AdamantiteAcceleratorHoldout.cs b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs index b9fef80f94..9056b3945e 100644 --- a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs +++ b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged else if (SoundEngine.TryGetActiveSound(ChargeupSoundSlot, out var soundOut) && soundOut.IsPlaying) { - soundOut.Sound.Pitch = ChargeTimer * 2f; + soundOut.Sound.Pitch = MathF.Min(ChargeTimer * 2f, 1); soundOut.Position = Projectile.Center; } @@ -112,8 +113,10 @@ namespace CalamityMod.Projectiles.Ranged private void FiringEffects(Color color) { - SoundEngine.PlaySound(SoundID.Item92, GunTipPosition); - SoundEngine.PlaySound(SoundID.Item60, GunTipPosition); + bool redBeam = (color == new Color(235, 40, 121)); + SoundEngine.PlaySound(SoundID.Item92 with { pitch = 0.7f, volume = 0.7f }, GunTipPosition); + SoundStyle fire = new("CalamityMod/Sounds/Item/APAShoot"); + SoundEngine.PlaySound(fire with { pitch = (redBeam ? 0.3f : -0.2f)}, GunTipPosition); Particle pulse = new DirectionalPulseRing(GunTipPosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30); GeneralParticleHandler.SpawnParticle(pulse); diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 0e33af218e..174f3c17d0 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -1,140 +1,52 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using CalamityMod.Particles; -using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.GameContent.Animations.Actions.Sprites; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Projectiles.Summon; namespace CalamityMod.Projectiles.Ranged { public class Aquashard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public int time = 0; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 10; + Projectile.height = 10; Projectile.friendly = true; - Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 300; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.extraUpdates = 1; } public override void AI() { - //Rotation - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (time == 1) - { - Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; - int smokeAmount = Main.rand.Next(8, 12 + 1); - for (int i = 0; i < smokeAmount; i++) - { - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); - GeneralParticleHandler.SpawnParticle(smoke); - - } - for (int i = 0; i < 5; i++) - { - Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); - GeneralParticleHandler.SpawnParticle(spark); - } - } - if (time >= 2) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); - dust.scale = Main.rand.NextFloat(0.6f, 0.8f); - dust.noGravity = false; - } - if (time == 14) - { - Projectile.Kill(); - } - time++; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int projAmt = 3; - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 0f, Projectile.owner); - } - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f;; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.DarkTurquoise, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - Player Owner = Main.player[Projectile.owner]; - if (Owner.Calamity().GeneralScreenShakePower < 1.2f) - Owner.Calamity().GeneralScreenShakePower = 1.2f; - target.AddBuff(ModContent.BuffType(), 30); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); - int projAmt = 3; + int projAmt = Main.rand.Next(1, 3); if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < projAmt; i++) { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Projectile.owner); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner); } } - // Create Blast - float blastSize = 80; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - blast.ArmorPenetration = 5; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.08f, 22); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.06f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing3); - for (int i = 0; i < (int)(15); i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); - dust.noGravity = !Main.rand.NextBool(); - dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; - } - } - public override bool PreDraw(ref Color lightColor) - { - if (time < 2) - { - return false; - } - return base.PreDraw(ref lightColor); } } } diff --git a/Projectiles/Ranged/Aquashard.png b/Projectiles/Ranged/Aquashard.png index 54457ff6b4..0e32025173 100644 Binary files a/Projectiles/Ranged/Aquashard.png and b/Projectiles/Ranged/Aquashard.png differ diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 82ce78b9f9..a9555374d0 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -2,15 +2,13 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Ranged { public class AquashardSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() @@ -38,16 +36,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.Center); - Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.SkyBlue, Color.DarkTurquoise, Main.rand.NextFloat(1f, 1.1f), 30, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - int num190 = Main.rand.Next(5, 9); - for (int i = 0; i < num190; i++) + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + for (int k = 0; k < 5; k++) { - int bubbly = Dust.NewDust(Projectile.Center, 0, 0, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.4f); - Main.dust[bubbly].velocity *= 0.8f; - Main.dust[bubbly].position = Vector2.Lerp(Main.dust[bubbly].position, Projectile.Center, 0.5f); - Main.dust[bubbly].noGravity = true; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs index 7845aed473..99bae3b246 100644 --- a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs +++ b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged public override float RecoilResolveSpeed => (KeepRefreshingLifetime || CurrentChargingFrames < ArcNovaDiffuser.Charge2Frames) ? 0.4f : 0.04f; public static int FramesPerLoad = 13; - public static int MaxLoadableShots = 15; + public static int MaxLoadableShots = 20; public static float BulletSpeed = 12f; public SlotId NovaChargeSlot; @@ -107,11 +107,13 @@ namespace CalamityMod.Projectiles.Ranged // Rapid Fire mode else if (ShotsLoaded > 0) { + float lvCompLerp = Math.Min(CurrentChargingFrames / ArcNovaDiffuser.Charge1Frames, 1); + // While bullets are remaining, refresh the lifespan; it will not refresh again after bullets run out Projectile.timeLeft = ArcNovaDiffuser.AftershotCooldownFrames; // Retract recoil & shoot faster if charged - ShootRecoilTimer -= ChargeLV1 ? 2.3f : 2f; + ShootRecoilTimer -= (ChargeLV1 ? 2.8f : 2f) * MathHelper.Lerp(0.4f, 1f, MathF.Pow(lvCompLerp, 2.5f)); if (ShootRecoilTimer <= 0f) { @@ -120,8 +122,9 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; Vector2 fireVec = shootVelocity.RotatedByRandom(MathHelper.ToRadians(2f)); + int damage = (int)(Projectile.damage * MathHelper.Lerp(0.5f, 1f, lvCompLerp)); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec * (ChargeLV1 ? 1 : 0.7f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec * (ChargeLV1 ? 1 : 0.7f), ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner); for (int i = 0; i <= 4; i++) { Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(1.2f, 1.6f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); @@ -137,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged } ShotsLoaded--; - ShootRecoilTimer = (int)MathHelper.Lerp(33, 13, Math.Min(CurrentChargingFrames / ArcNovaDiffuser.Charge1Frames, 1)); + ShootRecoilTimer = (int)MathHelper.Lerp(23, 13, lvCompLerp); OffsetLengthFromArm -= 6f; } } diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 649136df35..b00bfce76c 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public class AuroraFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public static int Lifetime => 480; public static int Fadetime => 450; diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 33f3b8a93f..19be95a743 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -9,11 +9,6 @@ namespace CalamityMod.Projectiles.Ranged public class BallistaGreatArrow : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 1; - } public override void SetDefaults() { @@ -43,16 +38,10 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 2; i++) // Burst into 2 shards upwards { Vector2 baseVelocity = Vector2.UnitY * -12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top, baseVelocity.RotatedByRandom(MathHelper.Pi * 0.1f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.25f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top, baseVelocity.RotatedByRandom(MathHelper.Pi * 0.1f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.25f, Projectile.owner); } } public override void OnKill(int timeLeft) => SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); - return false; - } } } diff --git a/Projectiles/Ranged/BallistaGreatArrow.png b/Projectiles/Ranged/BallistaGreatArrow.png index 2883016d90..a359a261e9 100644 Binary files a/Projectiles/Ranged/BallistaGreatArrow.png and b/Projectiles/Ranged/BallistaGreatArrow.png differ diff --git a/Projectiles/Ranged/BallistaShard.cs b/Projectiles/Ranged/BallistaShard.cs new file mode 100644 index 0000000000..8032d79a8f --- /dev/null +++ b/Projectiles/Ranged/BallistaShard.cs @@ -0,0 +1,61 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class BallistaShard : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 3; + } + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.timeLeft = 120; + AIType = ProjectileID.WoodenArrowFriendly; + } + + public override void AI() + { + if (Projectile.timeLeft == 120) + Projectile.frame = Main.rand.Next(3); + + if (Projectile.velocity.Y <= -2f) + Projectile.velocity.Y = -2f; + Projectile.velocity.Y += 0.025f; + Projectile.rotation += Projectile.velocity.Y; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Ranged/BallistaShard.png b/Projectiles/Ranged/BallistaShard.png new file mode 100644 index 0000000000..aba2ba5a10 Binary files /dev/null and b/Projectiles/Ranged/BallistaShard.png differ diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs index 5fcbb6ddc3..d2cbdc12f4 100644 --- a/Projectiles/Ranged/BlissfulBombardierHoldout.cs +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -96,8 +96,14 @@ namespace CalamityMod.Projectiles.Ranged } public override void HoldoutAI() { - // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. - if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) + // If there's no player, or the player isn't holding fire, or the player's stunned, there'll be no holdout. + // The holdout will persist if on cooldown, but it is absolutely imperative that it can disappear if dead, CCed, etc. + if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems) + { + Projectile.Kill(); + return; + } + if (!Owner.channel && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) { Projectile.Kill(); return; diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 359c21e2e0..011b49ccc0 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged } else { - Projectile.damage = (int)(Projectile.damage * 1.3f); // damage boost + Projectile.damage = (int)(Projectile.damage * 1.2f); // damage boost player.statLife -= 1; if (player.statLife <= 0) { 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/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 51a138913b..2de68049b6 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -126,8 +126,7 @@ namespace CalamityMod.Projectiles.Ranged randNormalize = -Vector2.UnitY; } Vector2 projRandomPos = playerRotate + Utils.RandomVector2(Main.rand, -15f, 15f); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos.X, projRandomPos.Y, randNormalize.X, randNormalize.Y, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner, 0f, 0f); - Main.projectile[proj].noDropItem = true; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos.X, projRandomPos.Y, randNormalize.X, randNormalize.Y, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner); } Vector2 daemonNormalize = Vector2.Normalize(Projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(daemonNormalize.X) || float.IsNaN(daemonNormalize.Y)) @@ -136,7 +135,7 @@ namespace CalamityMod.Projectiles.Ranged } float speedY = daemonNormalize.Y; Vector2 daemonRandomPos = playerRotate + Utils.RandomVector2(Main.rand, -15f, 15f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), daemonRandomPos.X, daemonRandomPos.Y, daemonNormalize.X, daemonNormalize.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0.0f, speedY); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), daemonRandomPos.X, daemonRandomPos.Y, daemonNormalize.X, daemonNormalize.Y, ModContent.ProjectileType(), weaponDamage2, weaponKnockback2, Projectile.owner, 0f, speedY); } else { diff --git a/Projectiles/Ranged/DryadsTearMain.cs b/Projectiles/Ranged/DryadsTearMain.cs index 25268fe87a..d9c91ae175 100644 --- a/Projectiles/Ranged/DryadsTearMain.cs +++ b/Projectiles/Ranged/DryadsTearMain.cs @@ -30,7 +30,8 @@ namespace CalamityMod.Projectiles.Ranged public int turnDirection = 0; // Direction it will rotate public int turnChange = 0; // Adds variance to multiple aspects of the bullet, including when it will change its turn direction public float turnIntensity = 0; // Adds a bit more variance, this time to velocity - public float damageMult = 1; // Multiplier that updates instantly, used for most of the gameplay effects + public float originalDamageMult = 1; // Multiplier that updates instantly, used ONLY for the gameplay effects + public float damageMult = 1; // Multiplier that updates instantly, used for most of the gameplay effects and some visual (why did I do this???) public float visualMult = 0.75f;// Multiplier that updates over time, used for most of the visual effects public Vector2 dropletPosition; // The position of the orbiting teardrop public Vector2 lastDropletPosition; // The previous position of the orbiting teardroplet @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public float dropletAttackLerp = 1; // A lerp variable used for timing the droplet's attack public int frameDelay = 0; // A few frames of delay after landing on the enemy before explosing, which improves the visuals public bool detachEffects = true; // Used for the moment when the droplet detatched from the main bullet - public bool isMaxPower => damageMult >= 1; // If the bullet is at maximum power + public bool isMaxPower = false; // If the bullet is at maximum power public float finalEffectMult => Projectile.scale * visualMult; // Used for many but not all visual scaling effects public NPC targeted; // The target being attacked by the droplet public ref float trueLifetime => ref Projectile.ai[2]; // The lifetime of the projectile, used over vanilla lifetime because it can increment by decimals @@ -50,9 +51,13 @@ namespace CalamityMod.Projectiles.Ranged public int fadeLifetime => (int)(35 + effectSpeedMod * Math.Max(1 - damageMult, 0)); // The time in which the projectile fades out and can no longer hit anything public int extendedLifetime => (int)(85 * Math.Min(damageMult, 1) + effectSpeedMod * Math.Max(1 - damageMult, 0)); // The time after lifetime reaches zero where the droplet does its attack public bool fading => trueLifetime <= fadeLifetime; // If the projectile is fading away + public bool crit = false; // If the main hit crit, used to make the teardrop crit + public Vector2 hitTileVel = Vector2.Zero; - public float explosionDamageMult = 1.4f; - public float maxDamageMult = 1.65f; + public float explosionDamageMult = 1f; + public float mainBulletDamageMult = 0.75f; + public float maxDamageMult = 2.15f; + public float bulletScalingDamagePow = 0.1f; // Applied to bullets so that fast fired bullets still do some damage, the original damage mult based on projectile number is put to the power of this number public static Asset ShineTexture { get; private set; } public static Asset BloomTexture { get; private set; } public override void Load() @@ -79,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.tileCollide = false; + Projectile.tileCollide = true; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -101,13 +106,14 @@ namespace CalamityMod.Projectiles.Ranged trueLifetime = fadeLifetime * 1.5f; turnDirection = Main.rand.NextBool() ? -1 : 1; turnChange = Main.rand.Next(30, 190 + 1); - turnIntensity = Main.rand.NextFloat(0.2f, 1.6f); + turnIntensity = Main.rand.NextFloat(0.45f, 2.9f); effectSpeedMod = Main.rand.Next(5, 35); } - if (time % turnChange == 0 && !fading) + if (time % turnChange == 0) turnDirection *= -1; - visualMult = MathHelper.Lerp(visualMult, damageMult, 0.1f / Projectile.MaxUpdates); + float visualMinPow = (isMaxPower ? damageMult : MathF.Pow(damageMult, 0.25f)); + visualMult = MathHelper.Lerp(visualMult, visualMinPow, 0.1f / Projectile.MaxUpdates); float speed = 8 * MathF.Pow(visualMult, 0.3f) * Math.Max(MathF.Pow(Utils.GetLerpValue(0, fadeLifetime, trueLifetime, true), 2), 0.15f); bool chanceForDust = Main.rand.NextBool((int)Math.Clamp((fading ? 8 : 5) / finalEffectMult, 3, 60)); @@ -122,7 +128,7 @@ namespace CalamityMod.Projectiles.Ranged dust.fadeIn = 1; } - if (time > 0) // Reduce damage and visual intensity for every projectile of this type from the same player that are relativley close to each other + if (time > 0 && Projectile.numHits == 0) // Reduce damage and visual intensity for every projectile of this type from the same player that are relativley close to each other { float damageReduction = 1; int ownedProj = Owner.ownedProjectileCounts[Projectile.type]; @@ -132,16 +138,26 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.owner == Projectile.owner && projectile.active && projectile.type == Projectile.type && projectile != Projectile) damageReduction++; } - float newDamageMult = MathF.Pow(1 / damageReduction, 0.25f); - if (newDamageMult < damageMult && !fading) + int maxProjectilesToCount = 12; + float newDamageMult = (1 / Math.Min(MathF.Pow(damageReduction, 0.4f), maxProjectilesToCount)); + float newOriginalDamageMult = (1 / Math.Min(damageReduction, maxProjectilesToCount)); + if (newDamageMult < damageMult) + { damageMult = newDamageMult; + } + if (newOriginalDamageMult < originalDamageMult) + { + originalDamageMult = newOriginalDamageMult; + } } + if (time > 0) + isMaxPower = originalDamageMult >= 1; - if (isMaxPower) - damageMult = maxDamageMult; + if (isMaxPower && Projectile.numHits == 0) + { damageMult = 1.75f; originalDamageMult = 1.75f; } // This is done for visual reasons, the actual max power damage is applied on hit - float movement = Main.rand.NextFloat(0.009f, 0.0115f) * speed; + float movement = Main.rand.NextFloat(0.0120f, 0.0165f) * speed; if (damageMult < 1) Projectile.velocity += Vector2.Lerp(Projectile.velocity.RotatedBy(MathHelper.PiOver2 * turnDirection).SafeNormalize(Vector2.UnitX) * movement * turnIntensity, Projectile.velocity, MathF.Pow(Math.Min(damageMult + 0.15f, 1), 3.3f)); Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; @@ -232,7 +248,7 @@ namespace CalamityMod.Projectiles.Ranged falling ? (int)(10 * (1 - dropLerp * 0.6f)) : (int)(6 + 2 * dropletScaling), 0.135f * dropletScaling * (1 + dropLerp * 0.3f), Color.Turquoise * colorMult, falling ? Color.Lime * colorMult : Color.Teal * colorMult, new Vector2(0.15f * (falling ? 0.5f + dropLerp * 3 : 1) * damageMult, (Math.Max(0.15f * lastDropletPosition.Distance(dropletPosition), 0.25f) * (1 - dropLerp * 0.2f))), noShrink: true, colorFadeSpeed: 5, glowOpacity: colorMult, shrinkSpeed: falling ? 1.5f - dropLerp : 0); GeneralParticleHandler.SpawnParticle(dropTrail, true); - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool((int)(4 / damageMult) + 1)) { Dust dust = Dust.NewDustPerfect(dropletPosition + Main.rand.NextVector2Circular(5 + 20 * (1 - dropletAttackLerp), 5 + 20 * (1 - dropletAttackLerp)), ModContent.DustType()); dust.noGravity = true; @@ -261,8 +277,30 @@ namespace CalamityMod.Projectiles.Ranged trueLifetime -= 1 / MathF.Pow(damageMult, 0.3f); if (trueLifetime <= -extendedLifetime && Projectile.FinalExtraUpdate()) frameDelay++; + + if (hitTileVel != Vector2.Zero) + { + Projectile.velocity = Vector2.Lerp(Projectile.velocity, hitTileVel, 0.03f / damageMult); + } + time++; } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.numHits == 0) // Store a tile reflect velocity and lerp to it afterwards + { + float velX = oldVelocity.X; + float velY = oldVelocity.Y; + if (Projectile.velocity.Y != oldVelocity.Y) + velY = -oldVelocity.Y; + if (Projectile.velocity.X != oldVelocity.X) + velX = -oldVelocity.X; + Projectile.velocity = oldVelocity; + hitTileVel = new Vector2(velX, velY); + Projectile.tileCollide = false; + } + return false; + } public void Splash() { if (dropletAttack) @@ -327,13 +365,15 @@ namespace CalamityMod.Projectiles.Ranged { float blastSize = 75 * scale; float minMultiplier = 0.15f; - int hitsToMinMult = (int)(3 + 5 * damageMult); - int knockback = (int)(7 * damageMult * (isMaxPower ? -1 : 1)); // Give heavy knockback at full power - int damage = (int)(Projectile.damage * explosionDamageMult * damageMult); - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + int hitsToMinMult = (int)(3 + 5 * originalDamageMult); + int knockback = (int)(7 * originalDamageMult * (isMaxPower ? -1 : 1)); // Give heavy knockback at full power + float finalDamageMult = MathF.Pow(originalDamageMult, bulletScalingDamagePow); + int damage = (int)(Projectile.damage * explosionDamageMult * (isMaxPower ? maxDamageMult : finalDamageMult)); + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); blast.timeLeft = 8; - blast.DamageType = DamageClass.Ranged; + blast.DamageType = Projectile.DamageType; blast.ArmorPenetration = Projectile.ArmorPenetration; + blast.localAI[0] = (crit ? 1 : 0); // Sets the burst to crit if the bullet did } if (damageMult >= 0.75f) Owner.SetScreenshake(3f * damageMult); @@ -377,9 +417,15 @@ namespace CalamityMod.Projectiles.Ranged targeted = target; trueLifetime = fadeLifetime; - modifiers.SourceDamage *= damageMult; + float finalDamageMult = MathF.Pow(originalDamageMult, bulletScalingDamagePow); + modifiers.SourceDamage *= (isMaxPower ? maxDamageMult : finalDamageMult * mainBulletDamageMult); } - public override bool? CanHitNPC(NPC target) => ((time > 1) ? null : false && Projectile.numHits == 0); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (hit.Crit) + crit = true; + } + public override bool? CanHitNPC(NPC target) => ((time > 1 && Projectile.numHits == 0) ? null : false); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float hitboxSize = 20 * Projectile.scale * damageMult; diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index f76f5fdcbd..d5bfec6beb 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged } } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.20f), 0f, Projectile.owner, 0f, 0f); SoundStyle onKill = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(onKill with { Volume = 0.4f, Pitch = 0.4f }, Projectile.position); diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 59fe2939aa..7310012ff8 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -71,10 +72,12 @@ namespace CalamityMod.Projectiles.Ranged // I hate metaballs >:( Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.005f, sparkColor, new Vector2(1f, 1 + Time * 0.1f), true, false); GeneralParticleHandler.SpawnParticle(beam3); + beam3.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; if (!photosens) { Particle beam32 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.003f, Color.Lerp(Color.Blue, sparkColor, 0.5f), new Vector2(1f, 1 + Time * 0.1f), true, false); GeneralParticleHandler.SpawnParticle(beam32); + beam32.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; } } if (Main.rand.NextBool(35) && targetDist < 1400f && Time > 5) diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 99085fbb5a..0f60098d3e 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -131,7 +131,6 @@ namespace CalamityMod.Projectiles.Ranged int snowball = Projectile.NewProjectile(Projectile.GetSource_FromThis(), sourceS, snowballVel, projType, dmg, kBack, Projectile.owner); if (snowball.WithinBounds(Main.maxProjectiles)) { - Main.projectile[snowball].noDropItem = true; Main.projectile[snowball].DamageType = DamageClass.Ranged; Main.projectile[snowball].extraUpdates += Main.rand.Next(0, 2); } diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 03a853f3db..ddf2cd0cea 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -1,5 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -7,6 +10,10 @@ namespace CalamityMod.Projectiles.Ranged public class FossilShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 5; + } public override void SetDefaults() { Projectile.width = 10; @@ -21,6 +28,9 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (Projectile.timeLeft == 120) + Projectile.frame = Main.rand.Next(5); + if (Projectile.ai[1] != 1f) { if (Projectile.velocity.Y <= -2f) @@ -42,5 +52,13 @@ namespace CalamityMod.Projectiles.Ranged Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Ranged/FossilShard.png b/Projectiles/Ranged/FossilShard.png index 9af9080d48..cb51af8250 100644 Binary files a/Projectiles/Ranged/FossilShard.png and b/Projectiles/Ranged/FossilShard.png differ diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs index 4800aa818b..2c3bd5ef6b 100644 --- a/Projectiles/Ranged/HailstormBulletProj.cs +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -71,14 +70,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player Owner = Main.player[Projectile.owner]; - target.AddBuff(BuffID.Frostburn2, 120); if (hit.Crit) { SoundStyle crit = new("CalamityMod/Sounds/NPCHit/CryogenPhaseTransitionCrack"); SoundEngine.PlaySound(crit with { Volume = 0.35f, Pitch = 1f }, Projectile.Center); - if (!target.boss) - target.AddBuff(BuffID.Frozen, 120); + target.AddBuff(BuffID.Frozen, 120); int points = 6; float radians = MathHelper.TwoPi / points; @@ -98,7 +95,8 @@ namespace CalamityMod.Projectiles.Ranged { // This is about equivalent to the previous direct strike extra damage but can't also crit itself obviously // Also it's not as impacted by defense, which is why it's a bit weaker, rather than being a full 1f - modifiers.CritDamage += 0.85f; + Player Owner = Main.player[Projectile.owner]; + modifiers.CritDamage += 0.65f + (Owner.GetTotalCritChance(DamageClass.Ranged) * 0.004f); // .4% crit damage per 1% crit chance if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.5f); @@ -108,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - if (Projectile.localAI[0] > 15f) + if (Projectile.localAI[0] > 16f) CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HalleysInfernoHoldout.cs b/Projectiles/Ranged/HalleysInfernoHoldout.cs index 9d09b629f1..c76f38e264 100644 --- a/Projectiles/Ranged/HalleysInfernoHoldout.cs +++ b/Projectiles/Ranged/HalleysInfernoHoldout.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged { if (ShotTimer <= 0 && Owner.Calamity().AvaliableStarburst > 1) { - ShotTimer = 4; + ShotTimer = 3; var spawnpos = Projectile.Center; var dir = spawnpos.DirectionTo(Main.MouseWorld); var color = Main.rand.Next(1, 7); @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged for (var i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(spawnpos + dir * 36, (dir * Halley.shootSpeed).RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f, 1.5f), false, 7, 0.02f, drawColor, new Vector2(0.5f, 1f))); if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 16,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); - Owner.Calamity().StratusStarburst -= 2; + Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 8 + dir.RotatedByRandom(MathHelper.TwoPi)*4,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); + Owner.Calamity().StratusStarburst -= 1; SoundEngine.PlaySound(HalleysInferno.ShootSound); - RecoilAmount = 4; + RecoilAmount = 16; } } RecoilAmount *= 0.75f; diff --git a/Projectiles/Ranged/HalleysStarburst.cs b/Projectiles/Ranged/HalleysStarburst.cs index 41e48151e3..afde077a30 100644 --- a/Projectiles/Ranged/HalleysStarburst.cs +++ b/Projectiles/Ranged/HalleysStarburst.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 6; + Projectile.MaxUpdates = 9; Projectile.timeLeft = 60 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 89e23accd5..8a236fd3ff 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -146,7 +146,8 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < 2; b++) { Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7 * (tileTouched ? -1 : 1)).RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)Math.Max(Projectile.originalDamage * 0.05f, 1), 0, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + Projectile split = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)Math.Max(Projectile.originalDamage * 0.05f, 1), 0, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + split.DamageType = Projectile.DamageType; } } } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 23b6229b73..454697736d 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -82,8 +83,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn2, 180); - target.AddBuff(BuffID.Frozen, 60); + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Ranged/MistArrowFrostMist.cs b/Projectiles/Ranged/MistArrowFrostMist.cs index 29d8e23ecb..0836006572 100644 --- a/Projectiles/Ranged/MistArrowFrostMist.cs +++ b/Projectiles/Ranged/MistArrowFrostMist.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -67,6 +68,6 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 45); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index d1bb85209d..ce15cad193 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.ai[1] == 0) target.AddBuff(BuffID.Daybreak, 300); if (Projectile.ai[1] == 1) - target.AddBuff(BuffID.Electrified, 300); + target.AddBuff(BuffID.Electrified, 300); if (Projectile.ai[1] == 2) target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Ranged/OmniGunHoldout.cs b/Projectiles/Ranged/OmniGunHoldout.cs index c836aabdbc..db17fe5d03 100644 --- a/Projectiles/Ranged/OmniGunHoldout.cs +++ b/Projectiles/Ranged/OmniGunHoldout.cs @@ -181,11 +181,11 @@ namespace CalamityMod.Projectiles.Ranged } for (int i = 0; i <= 13; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition, DustID.SteampunkSteam, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); dust.noGravity = false; dust.color = Color.White; - Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.5f)); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, DustID.FireworksRGB, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.5f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.52f, 0.72f); dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f)); diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 9a9a0820d6..4f823e1c52 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged public class PristineSecondary : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public ref float ScaleFactor => ref Projectile.ai[0]; public float LightPower = 0; diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index 422818de55..0075db0b8c 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int size = NPCHit ? 60 : 90; //Bigger explosion if no npc is hit + int size = NPCHit ? 128 : 160; //Bigger explosion if no npc is hit Projectile.scale = (size / (float)Projectile.height) * Projectile.scale; Projectile.position -= Vector2.One * (size - Projectile.width) * 0.5f; @@ -84,9 +84,9 @@ namespace CalamityMod.Projectiles.Ranged private void SmokeBoom() { - for (int i = 0; i < 15; i++) + for (int i = 0; i < 25; i++) { - Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); + Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(25f, 25f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.2f, 0.5f) * Projectile.scale, 145 - Main.rand.Next(30)); smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity; GeneralParticleHandler.SpawnParticle(smoke); } diff --git a/Projectiles/Ranged/RiftburstBow.cs b/Projectiles/Ranged/RiftburstBow.cs index baaa0dc66b..e1fc1f552f 100644 --- a/Projectiles/Ranged/RiftburstBow.cs +++ b/Projectiles/Ranged/RiftburstBow.cs @@ -110,8 +110,7 @@ namespace CalamityMod.Projectiles.Ranged randNormalize = -Vector2.UnitY; } Vector2 projRandomPos = playerRotation + Utils.RandomVector2(Main.rand, -15f, 15f); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos, randNormalize, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner); - Main.projectile[proj].noDropItem = true; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), projRandomPos, randNormalize, ammoType, weaponDamage2, weaponKnockback2, Projectile.owner); } } else diff --git a/Projectiles/Ranged/SeadragonHoldout.cs b/Projectiles/Ranged/SeadragonHoldout.cs index a0df628fb3..5e3cd47998 100644 --- a/Projectiles/Ranged/SeadragonHoldout.cs +++ b/Projectiles/Ranged/SeadragonHoldout.cs @@ -51,8 +51,12 @@ namespace CalamityMod.Projectiles.Ranged } //Set the scaling to 0 whenever it reloads Owner.Calamity().sharkGunDamageScaling = 0; - //Has a 1 in 100 chance to set transEffects to true, changing the shot colors to be replaced by the transgender pride flag colors - transEffects = Main.rand.NextBool(100); + //If the player has a Gender Change Potion in their inventory set transEffects to true, changing the shot colors to be replaced by the transgender pride flag colors + //If not, has a 1 in 100 chance every magazine to set it to true + if (Main.LocalPlayer.HasItemInAnyInventory(ItemID.GenderChangePotion)) + transEffects = true; + else + transEffects = Main.rand.NextBool(100); } if (Time >= 90) { diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index deefc94393..54a3e4a9da 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -52,24 +52,17 @@ namespace CalamityMod.Projectiles.Ranged // Consumes a coin, stores it, then calculates what effect will be executed if (Projectile.ai[1] == 0) { - // These checks are here so that the weapon doesn't consume two coins when first used - if (shotonce) + // Ensure the method doesn't consumes ammo on first shot to avoid consuming two coins + if (player.PickAmmo(player.HeldItem, out shot, out scaleFactor, out weaponDamage, out weaponKnockback, out _, !shotonce)) { - if (player.PickAmmo(player.HeldItem, out shot, out scaleFactor, out weaponDamage, out weaponKnockback, out _)) - { - Projectile.ai[0] = shot; - Projectile.ai[1] = CalculateOutcome(); - } - else - { - Projectile.Kill(); - } + Projectile.ai[0] = shot; + Projectile.ai[1] = CalculateOutcome(); } else { - Projectile.ai[1] = CalculateOutcome(); - shotonce = true; + Projectile.Kill(); } + shotonce = true; } rolltimer--; diff --git a/Projectiles/Ranged/ShardshockerCrystal.cs b/Projectiles/Ranged/ShardshockerCrystal.cs deleted file mode 100644 index 8dc08c0597..0000000000 --- a/Projectiles/Ranged/ShardshockerCrystal.cs +++ /dev/null @@ -1,259 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using CalamityMod.Particles; -using CalamityMod.Tiles.Abyss; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.GameContent.Animations.Actions.Sprites; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Melee; -using System; -using System.Data; -using CalamityMod.Items.Ammo; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ShardshockerCrystal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; - public static readonly SoundStyle Collision = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact") { Volume = 0.5f }; - public int time = 0; - - public override void SetDefaults() - { - Projectile.width = 33; - Projectile.height = 33; - Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 240; - } - - //The crystal can only damage enemies if it's not hanging in the air - public override bool? CanDamage() => time <= 30 ? null : false; - public override void AI() - { - //Set the projectile as traveling and only update rotation while traveling - if (time < 30) - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.ai[1] = 1f; - } - - // Make it lose velocity as it travels - Projectile.velocity *= 0.9f; - #region Traveling Visuals - //Firing effects on frame one - if (time == 1) - { - Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; - int smokeAmount = Main.rand.Next(8, 12 + 1); - for (int i = 0; i < smokeAmount; i++) - { - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); - GeneralParticleHandler.SpawnParticle(smoke); - - } - for (int i = 0; i < 5; i++) - { - Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); - GeneralParticleHandler.SpawnParticle(spark); - } - } - //Only spawn dust trails while traveling - if (time >= 2 && time <= 30) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); - dust.scale = Main.rand.NextFloat(0.6f, 0.8f); - dust.noGravity = false; - } - #endregion - //After traveling for 30 frames, come to a stop in the air - if (time >= 30) - { - //Set AI as stopped so traveling crystals can collide with it - Projectile.ai[1] = 0f; - Projectile.velocity = Vector2.Zero; - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); - spark.noGravity = true; - spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.LightSkyBlue; - if (Main.rand.NextBool(13)) - { - // Create a lightning bolt-like particle in the direction of the shot and 3 random hue-shifted ones by the side - Particle bolt = new CrackParticle(Projectile.Center, velocity * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.5f), 12); - GeneralParticleHandler.SpawnParticle(bolt); - - for (int i = 1; i < 4; i++) - { - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.2f, 0.3f), 12); - GeneralParticleHandler.SpawnParticle(bolt2); - } - } - //Create a lightning AoE every second - if (time % 60 == 0) - { - SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); - // Create Blast - float blastSize = 120; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 30); - GeneralParticleHandler.SpawnParticle(blastRing3); - } - //Set up colliding behavior - foreach (Projectile proj in Main.ActiveProjectiles) - { - // Only allow other large crystals to collide - if (proj.type != Type) - continue; - - // Check if the colliding crystal is traveling - if (proj.ai[1] > 0f && Projectile.Hitbox.Intersects(proj.Hitbox)) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); - //Set on kill effects and kill the stopped crystal - Projectile.ai[1] = 2f; - Projectile.Kill(); - //Kill the traveling crystal - proj.timeLeft = 0; - } - } - } - time++; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // Create a smaller AoE on direct hits - float blastSize = 130; - float minMultiplier = 0.25f; - int hitsToMinMult = 4; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - - target.AddBuff(ModContent.BuffType(), 60); - - #region Visuals and Sound - SoundEngine.PlaySound(Collision, Projectile.Center); - - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.1f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.18f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 22); - GeneralParticleHandler.SpawnParticle(blastRing3); - - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.MediumAquamarine, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - - for (int i = 1; i < 8; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(9f, 11f)); - Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); - spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.SkyBlue; - } - - for (int i = 1; i < 6; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.8f, 1.1f), 17); - GeneralParticleHandler.SpawnParticle(bolt2); - } - #endregion - } - - public override void OnKill(int timeLeft) - { - //These effects only occur if another crystal collides with a stopped one - if (Projectile.ai[1] == 2f) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); - Player Owner = Main.player[Projectile.owner]; - if (Owner.Calamity().GeneralScreenShakePower < 1.2f) - Owner.Calamity().GeneralScreenShakePower = 1.2f; - int projAmt = 15; - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.27f), 0f, Projectile.owner); - } - float blastSize = 185; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - int debuff1 = BuffID.Electrified; - int debuffTime = 240; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.localAI[0] = debuff1; - blast.localAI[1] = debuffTime; - blast.DamageType = DamageClass.Ranged; - for (int i = 1; i < 9; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.9f, 1.5f), 20); - GeneralParticleHandler.SpawnParticle(bolt2); - } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.25f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.16f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing3); - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 2.5f, Color.MediumAquamarine, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - } - //These effects always occur - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); - for (int i = 0; i < (int)(15); i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); - dust.noGravity = !Main.rand.NextBool(); - dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; - } - } - public override bool PreDraw(ref Color lightColor) - { - //Don't draw the projectile for the first two frames, to prevent it from coming out of the player - if (time < 2) - { - return false; - } - return base.PreDraw(ref lightColor); - } - } -} diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 315818597a..e1962a30d7 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -19,14 +19,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; AIType = ProjectileID.Bullet; } @@ -35,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.1f, 0.3f, 0.8f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(Projectile.position, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; @@ -45,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } } diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 85150cc826..a9a2e156ac 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -20,14 +20,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = Projectile.height = 34; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; AIType = ProjectileID.Bullet; } @@ -36,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(Projectile.position, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); Main.dust[dust].alpha = Projectile.alpha; Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; @@ -46,10 +45,10 @@ namespace CalamityMod.Projectiles.Ranged Projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); + SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 400f, 12f, 20f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index 49746ec717..a922442a60 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -125,7 +125,8 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(pulse); // Play a sound with volume scaling with charge percent - SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * ChargePercent }, Owner.MountedCenter); + SoundStyle fire = new("CalamityMod/Sounds/Item/TitaniumRailgunShoot"); + SoundEngine.PlaySound(fire with { Volume = ChargePercent }, Owner.MountedCenter); // Set the initial recoil, mark the projectile as fired, and set the target recoil Owner.itemRotation = initialRecoil; diff --git a/Projectiles/Rogue/AntlionSkewerSandCloud.cs b/Projectiles/Rogue/AntlionSkewerSandCloud.cs index dae0dba88c..2e08edf867 100644 --- a/Projectiles/Rogue/AntlionSkewerSandCloud.cs +++ b/Projectiles/Rogue/AntlionSkewerSandCloud.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue public class AntlionSkewerSandCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public ref float CloudHue => ref Projectile.ai[0]; public override void SetDefaults() diff --git a/Projectiles/Rogue/AshenStalactiteDebris.png b/Projectiles/Rogue/AshenStalactiteDebris.png index 8afd326680..8e092d8e18 100644 Binary files a/Projectiles/Rogue/AshenStalactiteDebris.png and b/Projectiles/Rogue/AshenStalactiteDebris.png differ diff --git a/Projectiles/Rogue/AshenStalagmiteProj.png b/Projectiles/Rogue/AshenStalagmiteProj.png index 4f22b80bf9..08e667c762 100644 Binary files a/Projectiles/Rogue/AshenStalagmiteProj.png and b/Projectiles/Rogue/AshenStalagmiteProj.png differ diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index fbf7c948a3..8a5ecd429c 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.alpha += (Projectile.Calamity().stealthStrike ? 11 : 17); + Projectile.alpha += (Projectile.ai[2] > 0f ? 9 : 17); if (Projectile.alpha >= 255) { Projectile.Kill(); diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 21c1045017..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; @@ -28,13 +26,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 400; Projectile.alpha = 100; - Projectile.penetrate = 5; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 150 * Projectile.MaxUpdates; } public override void AI() @@ -44,25 +39,17 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[shadow].noGravity = true; Main.dust[shadow].velocity *= 0f; Projectile.velocity *= 0.95f; - if (Projectile.timeLeft == 400) + if (Projectile.timeLeft <= 135 * Projectile.MaxUpdates) { - originalDamage = Projectile.damage; - Projectile.damage = 0; - } - if (Projectile.timeLeft <= 375) - { - if (Projectile.timeLeft > 350) + if (Projectile.timeLeft > 120 * Projectile.MaxUpdates) Projectile.velocity *= 1.06f; - Projectile.damage = (int)(originalDamage * 1.25); - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 640f, 20f, 20f); } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - Projectile.Kill(); - } + public override bool? CanDamage() => Projectile.timeLeft > 135 * Projectile.MaxUpdates ? false : base.CanDamage(); + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(ref Color lightColor) { @@ -73,24 +60,23 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(50); for (int d = 0; d < 4; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 2f); - Main.dust[shadow].velocity *= 3f; + Dust shadow = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 2f); + shadow.velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[shadow].scale = 0.5f; - Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + shadow.scale = 0.5f; + shadow.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int d = 0; d < 12; d++) + for (int d = 0; d < 6; d++) { - int shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 3f); - Main.dust[shadow].noGravity = true; - Main.dust[shadow].velocity *= 5f; - shadow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 2f); - Main.dust[shadow].velocity *= 2f; + Dust shadow = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); + shadow.noGravity = true; + shadow.velocity *= 5f; + shadow = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); + shadow.velocity *= 2f; } } } 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/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 4b3f248cf1..c6ce288920 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -8,7 +9,6 @@ namespace CalamityMod.Projectiles.Rogue public class DuststormInABottleProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; int lifetime => AIState == 1 ? 300 : 150; public override void SetStaticDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue Timer++; gravTimer++; - Projectile.rotation += 0.175f * Projectile.direction * Projectile.velocity.Length(); + Projectile.rotation += 0.075f * Projectile.direction * Projectile.velocity.Length(); if (gravTimer > 20) { Projectile.velocity.Y += 0.22f; @@ -71,7 +71,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + Vector2 origin = TextureAssets.Projectile[Type].Size() * new Vector2(Projectile.velocity.X < 0f ? 0.4f : 0.6f, 0.5f); + SpriteEffects sp = Projectile.velocity.X < 0f ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, sp); return false; } diff --git a/Projectiles/Rogue/DuststormInABottleProj.png b/Projectiles/Rogue/DuststormInABottleProj.png new file mode 100644 index 0000000000..a6b547a294 Binary files /dev/null and b/Projectiles/Rogue/DuststormInABottleProj.png differ diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index c7d160009e..adfd05797a 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -11,12 +13,16 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/Ranged/FossilShard"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 5; + } public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.aiStyle = ProjAIStyleID.GroundProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.SpikyBall; @@ -31,6 +37,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.originalDamage = SpearofPaleolith.ShardBaseDamage; Projectile.ContinuouslyUpdateDamageStats = true; + Projectile.frame = Main.rand.Next(5); } Projectile.velocity.X *= 0.975f; @@ -59,5 +66,13 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index a9abc5f43b..9577a5e22e 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.coldDamage = true; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index e420a236a8..94f1e25a2d 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft % 15 == 0 && Projectile.owner == Main.myPlayer) { Vector2 sporeVel = Utils.DirectionFrom(Projectile.Center, Main.player[Projectile.owner].Center).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(4.5f, 6.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sporeVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 1f, Projectile.owner, -10f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sporeVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 1f, Projectile.owner, -10f, 1f, 1f); } } } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index b5fd912cb6..42438ea5f3 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public int time = 0; public int ChargeupTime = 50; - public int Lifetime = 500; + public int Lifetime => 500; public bool spinning = false; public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheOldReaper"; public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index eb4fbebd69..d6a3686639 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -1,8 +1,4 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,98 +8,29 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; - public ref float Timer => ref Projectile.ai[0]; - public ref float BounceCheck => ref Projectile.ai[1]; - private const int Pierce = 2; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; - Projectile.penetrate = Pierce; - Projectile.timeLeft = 600; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 25; + Projectile.penetrate = -1; + Projectile.aiStyle = ProjAIStyleID.Boomerang; + Projectile.timeLeft = 300; + AIType = ProjectileID.Bananarang; } - public override void AI() - { - Timer++; - Projectile.rotation += BounceCheck > 0f ? 0.35f : 0.2f; - // Bouncing resets the timer for use in fading in its glow - if (Timer >= 30f || BounceCheck > 0f) - { - if (BounceCheck > 0f && Projectile.Calamity().stealthStrike) - Projectile.velocity *= 0.975f; - else - { - Projectile.velocity.X *= BounceCheck > 0f ? 0.985f : 0.998f; - Projectile.velocity.Y += 0.0375f; - } - } - if (Projectile.velocity.Y > 8f) - Projectile.velocity.Y = 8f; - - // Random dust after bouncing - if (BounceCheck > 0f || Projectile.Calamity().stealthStrike) - { - Vector2 dustPos = Projectile.Center + Main.rand.NextVector2CircularEdge(20f, 15f); - Vector2 dustVel = Utils.DirectionTo(Projectile.Center, dustPos).RotatedBy(MathHelper.PiOver2) * 2f; - Dust dust = Dust.NewDustPerfect(dustPos, DustID.Sand, dustVel, Scale: 0.75f); - dust.noGravity = true; - } - } - public override bool? CanDamage() => BounceCheck > 0f && Projectile.Calamity().stealthStrike ? false : null; - public override bool OnTileCollide(Vector2 oldVelocity) { - // Should only bounce if it hasn't bounced before, hasn't pierced an enemy, and is hitting a floor (moving downwards) - if (BounceCheck == 0f && (Projectile.penetrate == Pierce || Projectile.Calamity().stealthStrike) && Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 0f) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) { - BounceCheck = 1f; - Timer = 0f; - Projectile.penetrate = 1; Projectile.velocity.Y = -oldVelocity.Y; - if (Projectile.velocity.Y < -4f) - Projectile.velocity.Y = -4f; - - // Summon a duststorm on stealth strikes - if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, 1f, Projectile.owner, Projectile.whoAmI); - } - return false; } - return true; - } - - public override void OnKill(int timeLeft) - { - for (int s = 0; s < 8; s++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Scale: 0.9f); - dust.noGravity = true; - } - - if (BounceCheck > 0f && Main.myPlayer == Projectile.owner) - { - for (int i = 1; i <= 3; i++) - { - Vector2 velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 4.5f); - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, i); - Main.projectile[p].rotation = Main.rand.NextFloat(MathHelper.TwoPi); - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = TextureAssets.Projectile[Type].Value; - Vector2 stretch = new Vector2(MathHelper.Lerp(1.2f, 0.8f, (float)Math.Abs(Math.Sin(Projectile.rotation))), MathHelper.Lerp(0.85f, 1.15f, (float)Math.Abs(Math.Sin(Projectile.rotation)))); - Color drawColor = BounceCheck > 0f ? Color.Lerp(lightColor, Color.White, MathHelper.Clamp(Timer / 60f, 0f, 0.5f)) : lightColor; - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, tex.Size() / 2f, stretch, SpriteEffects.None); return false; } } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index 1a7b49c931..43d46d25de 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -1,74 +1,56 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class SandDollarStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Typeless/SandCloakVeil"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; - private const float Radius = 96f; - private const int StartTime = 180; - private bool shouldDie = false; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = StartTime; - Projectile.Opacity = 0f; + Projectile.aiStyle = ProjAIStyleID.Boomerang; + Projectile.timeLeft = 300; + AIType = ProjectileID.Bananarang; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } - public override void AI() - { - Projectile disk = Main.projectile[(int)Projectile.ai[0]]; - Projectile.rotation += 0.025f; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(); - if (disk.active) + public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(); + + private void OnHitEffects() + { + int coralAmt = Main.rand.Next(1, 4); + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { - if (!shouldDie) + for (int coralCount = 0; coralCount < coralAmt; coralCount++) { - Projectile.Center = disk.Center + disk.velocity; - Projectile.timeLeft = 20; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); } - } - else - shouldDie = true; - - if (Projectile.timeLeft >= 20) - Projectile.Opacity += 0.05f; - else - Projectile.Opacity -= 0.05f; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); - public override bool PreDraw(ref Color lightColor) + public override bool OnTileCollide(Vector2 oldVelocity) { - Texture2D tex = TextureAssets.Projectile[Type].Value; - float scaleStep = 0.05f; - Color drawCol = Projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)); - float drawTransparency = 0.2f; - - if (Projectile.timeLeft > StartTime - 20) - drawTransparency *= Utils.GetLerpValue(StartTime - 20, StartTime, Projectile.timeLeft, true); - else if (Projectile.timeLeft < 20) - drawTransparency *= Utils.GetLerpValue(0, 20, Projectile.timeLeft, true); - - for (int i = 0; i < 20; i++) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - float rotation = (Projectile.rotation + scaleStep * i) * (i % 2 == 0).ToDirectionInt(); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, rotation, tex.Size() / 2f, (Radius * 0.0044f) - (i * scaleStep), SpriteEffects.None); + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 0847680f32..b19026c624 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -1,8 +1,4 @@ -using CalamityMod.Dusts; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,101 +8,85 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBombProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int time = 0; - public bool notTheClone => Projectile.Calamity().stealthStrike && Projectile.ai[0] == 0; // If the bomb is the initial thrown stealth strike bomb and not a split public override void SetDefaults() { - Projectile.width = Projectile.height = 38; + Projectile.width = 14; + Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 400; + Projectile.timeLeft = 240; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; } public override void AI() { - Projectile.spriteDirection = Projectile.direction; - float dustscaleMult = 1; - if (notTheClone) - { - Projectile.scale = 1.15f; - Projectile.extraUpdates = 2; - dustscaleMult = 1.5f; - } - if (time > 25) - { - Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; - if (Projectile.velocity.Y > 0) - Projectile.velocity.X = Projectile.velocity.X * 0.975f; - } - Projectile.rotation += Projectile.velocity.X * 0.07f + Projectile.direction * 0.07f; - - Vector2 dustPos = Projectile.Center + (Vector2.UnitY * -22 * Projectile.scale).RotatedBy(Projectile.rotation - (MathHelper.PiOver2 + 0.4f) * Projectile.spriteDirection); - Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f)); - dust2.noGravity = true; - dust2.scale = Main.rand.NextFloat(0.4f, 0.55f) * dustscaleMult; - dust2.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); - if (Main.rand.NextBool(5)) - { - Dust dust = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.65f, 0.85f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.7f, 1f) * dustscaleMult; - dust.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); - } - - time++; - Lighting.AddLight(Projectile.Center, Color.DodgerBlue.ToVector3() * 0.3f * dustscaleMult); + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void OnKill(int timeLeft) { - if (notTheClone) // Split into a few normal bombs that have reduced damage - { - for (int i = 0; i < 15; i++) - { - Vector2 randVel = new Vector2(7, 7).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.8f, 1.6f); - Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.SlateGray * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); - GeneralParticleHandler.SpawnParticle(smoke); - } + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = Projectile.Calamity().stealthStrike ? 256 : 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - float throwCount = Projectile.localAI[0]; - if (Main.myPlayer == Projectile.owner) + for (int i = 0; i < (Projectile.Calamity().stealthStrike ? 5 : 1); i++) + { + float posX = Projectile.Center.X + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + float posY = Projectile.Center.Y + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); + } + + if (Main.netMode != NetmodeID.Server) + { + Vector2 goreSource = Projectile.Center; + int goreAmt = Projectile.Calamity().stealthStrike ? 6 : 3; + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) { - for (int i = 0; i < 8; i++) + float velocityMult = 0.33f; + if (goreIndex < (goreAmt / 3)) { - throwCount++; - Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].localAI[0] = throwCount; - Main.projectile[stealth].ai[0] = 1; - Main.projectile[stealth].extraUpdates = 3; + velocityMult = 0.66f; } - } - - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = -0.3f, Volume = 0.8f }, Projectile.Center); - } - else // Normal bubble spawn - { - Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f, -5f); - bubble.localAI[0] = Projectile.localAI[0]; - SoundEngine.PlaySound(SoundID.Item14 with { Pitch = Main.rand.NextFloat(0.15f, 0.3f), Volume = 0.6f, MaxInstances = 10 }, Projectile.Center); - } - } - public override bool PreDraw(ref Color lightColor) - { - Asset tex = ModContent.Request(Texture); - if (notTheClone) - { - for (int i = 0; i < 25; i++) - { - Color auraColor = Color.Turquoise with { A = 0 } * 0.35f; - Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 3; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + if (goreIndex >= (2 * goreAmt / 3)) + { + velocityMult = 1f; + } + Mod mod = ModContent.GetInstance(); + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; } } - return true; } - public override bool? CanDamage() => (!notTheClone && Projectile.Calamity().stealthStrike && time < 30) ? false : null; // Dont have the cluster bomb splits detonate on enemies right when they spawn } } diff --git a/Projectiles/Rogue/SeafoamBombProj.png b/Projectiles/Rogue/SeafoamBombProj.png index b12539c68c..128c4f76bb 100644 Binary files a/Projectiles/Rogue/SeafoamBombProj.png and b/Projectiles/Rogue/SeafoamBombProj.png differ diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 5cd7cf61a0..d33e0aa2b0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -1,9 +1,4 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,199 +9,59 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public ref float time => ref Projectile.ai[0]; - public ref float bubbleLevel => ref Projectile.ai[1]; // -1 = small bubble, 0 = fusing bubble, 1 = big bubble - public bool startEffects = true; // Spawn effects - public float radius => 40 * Projectile.scale; - public bool canHit = false; // Only the small bubbles can directly hit enemies - public Projectile fuseGoal; // The bubble to fuse with - public NPC targeted; // The enemy to home in on as a small bubble - - public override void SetStaticDefaults() => Main.projFrames[Type] = 2; + public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; public override void SetDefaults() { - Projectile.width = Projectile.height = 32; + Projectile.width = 28; + Projectile.height = 28; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.timeLeft = 180; Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.scale = 1f; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.ArmorPenetration = 15; } + public override void AI() { - // All the on spawn effects, also happens when a mid bubble becomes a big bubble - if (startEffects) + Projectile.ai[0] += 1f; + if (Projectile.alpha < 50) { - if (bubbleLevel == 0) - { - canHit = false; - for (int i = 0; i < 5; i++) - { - Vector2 vel = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 6f * (i % 2 == 0 ? 0.88f : 1f); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - if (bubbleLevel == 1) - { - Projectile.extraUpdates = 2; - Projectile.timeLeft = 180; - Projectile.velocity = Vector2.UnitY * -1.5f; - canHit = false; - for (int i = 0; i < 10; i++) - { - Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 8f * (i % 2 == 0 ? 0.88f : 1f); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - if (bubbleLevel == -1) - { - Projectile.scale = 0.6f; - canHit = true; - } - startEffects = false; + Projectile.alpha = 50; } - - // Mid - if (bubbleLevel == 0) + else if (Projectile.alpha > 50) { - Projectile.scale = 1f; - float distance = 500; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile != Projectile && Vector2.Distance(Projectile.Center, projectile.Center) < distance && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Projectile.owner) - { - distance = Vector2.Distance(Projectile.Center, projectile.Center); - fuseGoal = projectile; - } - } - if (fuseGoal != null) - { - if (Projectile.velocity.Length() < 5) - Projectile.velocity = Projectile.velocity * 0.99f + Utils.DirectionTo(Projectile.Center, fuseGoal.Center) * 0.03f; - else - Projectile.velocity *= 0.995f; - - if (Utils.Distance(Projectile.Center, fuseGoal.Center) < radius) - { - if (fuseGoal.localAI[0] > Projectile.localAI[0]) - { - fuseGoal.localAI[0] = -5; - fuseGoal.Kill(); - Projectile.ai[1]++; - startEffects = true; - } - } - - if (!fuseGoal.active || fuseGoal.ai[1] != 0) - fuseGoal = null; - } - else if (Projectile.velocity.Length() > 2) - Projectile.velocity *= 0.99f; - - if (Projectile.velocity.Y > -2) - Projectile.velocity.Y -= 0.012f; + Projectile.alpha -= 10; } - // Large - if (bubbleLevel == 1) + Projectile.scale += 0.002f; + if (Projectile.ai[0] % 60 == 0) { - Projectile.scale = 1f; - Projectile.velocity *= 0.99f; + Projectile.damage *= 2; } - // Small - if (bubbleLevel == -1) - { - if (targeted == null || !targeted.active || targeted.life <= 0) - targeted = Projectile.Center.ClosestNPCAt(500); - if (time > 90) - { - Projectile.extraUpdates = 2; - if (targeted == null) - { - if (Projectile.velocity.Y > -3) - Projectile.velocity.Y -= 0.02f; - } - else - CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(700), false, 0.18f, 7, 0.98f, accelerate: true); - } - else - { - Projectile.velocity *= 0.99f; - Projectile.velocity.Y -= 0.027f; - } - } - - if (Projectile.ai[1] == -1) - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(Projectile.Center, Color.Turquoise.ToVector3() * 0.3f * Projectile.scale); - time++; - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.AddBuff(ModContent.BuffType(), 60); } + public override void OnKill(int timeLeft) { - float miniBubbles = 0; - if (bubbleLevel == 0) - miniBubbles = 2; - if (bubbleLevel == 1) - miniBubbles = 5; - if (bubbleLevel == -1) + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + int inc; + for (int i = 0; i < 25; i = inc + 1) { - SoundEngine.PlaySound(SoundID.Item54 with { MaxInstances = 6 }, Projectile.Center); - for (int i = 0; i < 2; i++) - { - Vector2 vel = (Vector2.One * 2).RotatedByRandom(Math.PI); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - else - { - SoundStyle sound = new("CalamityMod/Sounds/Custom/BubblyPop"); - SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.7f, 0.9f) - Projectile.scale * 0.6f, MaxInstances = 10 }, Projectile.Center); - - float blastSize = 70 + 70 * bubbleLevel; - float minMultiplier = 0.25f; - int hitsToMinMult = 5; - int debuff1 = ModContent.BuffType(); - int debuffTime = 180; - if (Projectile.localAI[0] >= 0 && Main.myPlayer == Projectile.owner) // On kill but exclude small bubbles and bubbled that died in a fuse - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.localAI[0] = debuff1; - blast.localAI[1] = debuffTime; - blast.DamageType = RogueDamageClass.Instance; - - for (int i = 0; i < miniBubbles; i++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 1.5f).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.9f, 1.6f) + Vector2.UnitY * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), Projectile.knockBack / 5, Projectile.owner, 0, -1); - - } - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f * Projectile.scale, 0.65f * Projectile.scale, 20); - GeneralParticleHandler.SpawnParticle(blastRing2); + int waterDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Rain, 0f, 0f, 0, default, 1f); + Main.dust[waterDust].position = (Main.dust[waterDust].position + Projectile.position) / 2f; + Main.dust[waterDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[waterDust].velocity.Normalize(); + Dust dust = Main.dust[waterDust]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[waterDust].alpha = Projectile.alpha; + inc = i; } } - public override bool PreDraw(ref Color lightColor) - { - float sine = (float)Math.Sin(time * Projectile.scale * 0.275f / MathHelper.Pi); - float sizeMult = ((sine + 2) * 0.05f); - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.ai[1] == 1 ? 1 : 0); - - Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 0.7f), Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 2f)); - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, squash * (Projectile.scale + sizeMult), SpriteEffects.None, 0); - return false; - } - public override bool? CanCutTiles() => false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => canHit ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false; } } diff --git a/Projectiles/Rogue/SeafoamBubble.png b/Projectiles/Rogue/SeafoamBubble.png deleted file mode 100644 index f7b27cd5c1..0000000000 Binary files a/Projectiles/Rogue/SeafoamBubble.png and /dev/null differ diff --git a/Projectiles/Rogue/SealedSingularityProjectile.cs b/Projectiles/Rogue/SealedSingularityProjectile.cs index ea68e347b6..5f21fa8eb0 100644 --- a/Projectiles/Rogue/SealedSingularityProjectile.cs +++ b/Projectiles/Rogue/SealedSingularityProjectile.cs @@ -342,7 +342,7 @@ namespace CalamityMod.Projectiles.Rogue switch (AIState) { case 1: - modifiers.SourceDamage /= Stealth ? 15 : 25; + modifiers.SourceDamage /= Stealth ? 2 : 16; modifiers.SourceDamage *= MathF.Pow(1 - SealedSingularity.FalloffPerTargetHitByAura, Projectile.numHits); return; case 2: diff --git a/Projectiles/Rogue/ShadySalesmanGunshot.cs b/Projectiles/Rogue/ShadySalesmanGunshot.cs new file mode 100644 index 0000000000..0d2ac754c2 --- /dev/null +++ b/Projectiles/Rogue/ShadySalesmanGunshot.cs @@ -0,0 +1,92 @@ +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadySalesmanGunshot : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public new string LocalizationCategory => "Projectiles.Rogue"; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.npcProj = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 10; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Color.Khaki.ToVector3() * 0.2f); + } + + public override void OnSpawn(IEntitySource source) + { + // Shift the projectile up to about the center of the salesman and override its speed + if (source is EntitySource_Parent parentSource && parentSource.Entity is NPC npc && npc.type == ModContent.NPCType()) + { + Projectile.position.Y -= 4f; + + float rotation = npc.ai[2]; + Vector2 barrelDirection = rotation.ToRotationVector2(); + + if (npc.spriteDirection == -1) + barrelDirection.X *= -1; + + float speed = Projectile.velocity.Length(); + Projectile.velocity = barrelDirection * speed; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SpawnImpactEffects(target.Center); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + SpawnImpactEffects(Projectile.Center); + return true; + } + + public void SpawnImpactEffects(Vector2 hitPoint) + { + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX); + + Particle bloom = new CustomSpark(hitPoint, Vector2.Zero, "CalamityMod/Particles/BrightFlash", false, 6, 0.35f, Color.Khaki, Vector2.One, true, true, glowOpacity: 0.5f, colorFadeSpeed: 10); + GeneralParticleHandler.SpawnParticle(bloom, true); + + for (int i = 0; i < 4; i++) + { + Vector2 dustVel = velocity.RotatedByRandom(0.35f) * Main.rand.NextFloat(2f, 7f); + + Dust dust = Dust.NewDustPerfect(hitPoint, DustID.Smoke, dustVel, 120, default, Main.rand.NextFloat(0.8f, 1.1f)); + dust.noGravity = true; + } + + for (int i = 0; i < 3; i++) + { + Vector2 sparkVel = velocity.RotatedByRandom(0.22f) * Main.rand.NextFloat(3f, 8f); + + Particle spark = new CustomSpark(hitPoint, sparkVel, "CalamityMod/Particles/FadeLine", false, Main.rand.Next(12, 18), 0.22f, Color.LightGray, new Vector2(0.45f, 1f), true, shrinkSpeed: 0.45f, colorFadeSpeed: 10); + GeneralParticleHandler.SpawnParticle(spark, true); + } + } + } +} diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index eb99c20e8e..a004c27978 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Projectiles/Ranged/FungiOrb"; private bool initialized = false; + public override float HomeSpeed => 1.2f; public override Color? LightColor => new Color(0f, 0.35f, 0.5f); public override void SetDefaults() { @@ -39,7 +40,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(56); int constant = 36; for (int i = 0; i < constant; i++) { diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs deleted file mode 100644 index a9584f036a..0000000000 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Systems.Collections; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SlickCaneProjectile : BaseSpearProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Rogue/SlickCane"; - - private bool initialized = false; - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 36; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.timeLeft = 120; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - Projectile.hide = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.alpha = 180; - Projectile.scale = 1.25f; - } - public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; - public override float TravelSpeed => 8f; - - public override bool PreAI() - { - // Initialization. Using the AI hook would override the base spear's code, and we don't want that. - if (!initialized) - { - Main.player[Projectile.owner].Calamity().ConsumeStealthByAttacking(); - initialized = true; - } - return true; - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? ModContent.Request("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt").Value : Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); - Main.EntitySpriteDraw(alternateHookTexture, drawPosition, null, - lightColor, Projectile.rotation, - origin, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float spearLengthMult = 2.5f; - float velocityMagnitude = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), - Main.player[Projectile.owner].Center, Main.player[Projectile.owner].Center + Projectile.velocity * spearLengthMult, - (TravelSpeed + 1f) * Projectile.scale, ref velocityMagnitude)) - { - return true; - } - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Player player = Main.player[Projectile.owner]; - //Dont drop money from Dummies, WoF eyes and worm segments to make grinding money a bit harder and not give money from Dummies since that was apparently happening - if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !CalamityNPCSets.ForceDrawDebuffDisplay[target.type]) - { - float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f); - // Maximum of 50 silver, not counting steath strikes - moneyValueToDrop = (int)MathHelper.Clamp(moneyValueToDrop, 0, 5000f); - if (Projectile.Calamity().stealthStrike && Main.rand.NextBool(20)) - { - moneyValueToDrop += Item.buyPrice(0, Main.rand.Next(1, 3), Main.rand.Next(0, 100), Main.rand.Next(0, 100)); - SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); - } - else if (moneyValueToDrop > 0f) - SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); - while (moneyValueToDrop > 10000f) - { - int modifiedMoneyValue = (int)(moneyValueToDrop / 10000f); - if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(3) + 1; - } - moneyValueToDrop -= 10000 * modifiedMoneyValue; - Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.GoldCoin, modifiedMoneyValue); - } - while (moneyValueToDrop > 100f) - { - int modifiedMoneyValue = (int)(moneyValueToDrop / 100f); - if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(3) + 1; - } - moneyValueToDrop -= 100 * modifiedMoneyValue; - Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.SilverCoin, modifiedMoneyValue); - } - while (moneyValueToDrop > 0f) - { - int modifiedMoneyValue = (int)moneyValueToDrop; - if (modifiedMoneyValue > 50 && Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(5)) - { - modifiedMoneyValue /= Main.rand.Next(4) + 1; - } - if (modifiedMoneyValue < 1) - { - modifiedMoneyValue = 1; - } - moneyValueToDrop -= modifiedMoneyValue; - Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.CopperCoin, modifiedMoneyValue); - } - } - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Boost dmg in proportion to money, caps at 1 plat. - if (Projectile.Calamity().stealthStrike) - { - Player player = Main.player[Projectile.owner]; - double money = Utils.CoinsCount(out bool overflow, player.inventory); - double cap = 1000000; - if (money >= cap) - money = cap; - if (money != 0) - { - modifiers.SourceDamage *= (float)(money / 1000000 + 1); - SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); - for (int j = 0; j < 8; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - } - } - } - } -} diff --git a/Projectiles/Rogue/SlickCaneProjectileAlt.png b/Projectiles/Rogue/SlickCaneProjectileAlt.png deleted file mode 100644 index 1453d66510..0000000000 Binary files a/Projectiles/Rogue/SlickCaneProjectileAlt.png and /dev/null differ diff --git a/Projectiles/Rogue/SmallCoral.cs b/Projectiles/Rogue/SmallCoral.cs new file mode 100644 index 0000000000..1c13e6b149 --- /dev/null +++ b/Projectiles/Rogue/SmallCoral.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class SmallCoral : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 1; + Projectile.aiStyle = ProjAIStyleID.Arrow; + } + + public override void AI() + { + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.direction == -1) + Projectile.rotation += MathHelper.Pi; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 16; + Projectile.height = 16; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + for (int i = 0; i < 5; i++) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SnowBlock, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/SmallCoral.png b/Projectiles/Rogue/SmallCoral.png new file mode 100644 index 0000000000..10aba07451 Binary files /dev/null and b/Projectiles/Rogue/SmallCoral.png differ diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index b524a9179d..ceeb14a475 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,7 +71,15 @@ namespace CalamityMod.Projectiles.Rogue CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } + 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 OnKill(int timeLeft) { for (int k = 0; k < 10; k++) diff --git a/Projectiles/Rogue/WalkingCaneProjectile.cs b/Projectiles/Rogue/WalkingCaneProjectile.cs new file mode 100644 index 0000000000..833f863e5e --- /dev/null +++ b/Projectiles/Rogue/WalkingCaneProjectile.cs @@ -0,0 +1,94 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WalkingCaneProjectile : BaseSpearProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public static Asset AltTexture; + + private bool initialized = false; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + AltTexture = ModContent.Request("CalamityMod/Projectiles/Rogue/WalkingCaneProjectileAlt"); + } + public override void SetDefaults() + { + Projectile.width = 80; + Projectile.height = 80; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.timeLeft = 120; + Projectile.friendly = true; + Projectile.hostile = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.ownerHitCheck = true; + Projectile.hide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.alpha = 180; + Projectile.scale = 1.25f; + } + public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; + public override float TravelSpeed => 35f; + + public override bool PreAI() + { + // Initialization. Using the AI hook would override the base spear's code, and we don't want that. + if (!initialized) + { + Main.player[Projectile.owner].Calamity().ConsumeStealthByAttacking(); + initialized = true; + } + return true; + } + + public override bool PreDraw(ref Color lightColor) + { + Vector2 drawPosition = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D alternateHookTexture = Projectile.spriteDirection == -1 ? AltTexture.Value : Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 origin = new Vector2(Projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f); + + Main.EntitySpriteDraw(alternateHookTexture, drawPosition, null, lightColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float spearLengthMult = 3.2f; + float velocityMagnitude = 0f; + // For whatever fucking reason CheckAABBvLineCollision fails when you're completely inside a hitbox, so check for that too + return targetHitbox.Contains(Main.LocalPlayer.Center.ToPoint()) || Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), + Main.player[Projectile.owner].Center, Main.player[Projectile.owner].Center + Projectile.velocity * spearLengthMult, (TravelSpeed + 1f) * Projectile.scale, ref velocityMagnitude); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.Calamity().stealthStrike) + { + target.Calamity().caneInsanityTimer = 600; + } + else if (target.Calamity().caneInsanityTimer > 0) + { + Vector2 position = target.Center + Main.rand.NextVector2CircularEdge(100f, 100f); + Vector2 velocity = (target.Center - position).SafeNormalize(Vector2.Zero) * 6f; + // Friendly shadow hands normally have four different behaviors, but Walking Cane only spawns shadow hands that immediately lunge + Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, velocity, ProjectileID.InsanityShadowFriendly, (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + } + } + } +} diff --git a/Projectiles/Rogue/WalkingCaneProjectile.png b/Projectiles/Rogue/WalkingCaneProjectile.png new file mode 100644 index 0000000000..da54397462 Binary files /dev/null and b/Projectiles/Rogue/WalkingCaneProjectile.png differ diff --git a/Projectiles/Rogue/WalkingCaneProjectileAlt.png b/Projectiles/Rogue/WalkingCaneProjectileAlt.png new file mode 100644 index 0000000000..fe31c83a51 Binary files /dev/null and b/Projectiles/Rogue/WalkingCaneProjectileAlt.png differ diff --git a/Projectiles/Rogue/WrathwingCinder.cs b/Projectiles/Rogue/WrathwingCinder.cs index ab70362863..844aa62b7c 100644 --- a/Projectiles/Rogue/WrathwingCinder.cs +++ b/Projectiles/Rogue/WrathwingCinder.cs @@ -78,15 +78,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.X *= 0.995f; Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - // commented out sound because it was way too loud - /* - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - */ - if (Projectile.ai[0] >= 2f) { Projectile.alpha -= 25; diff --git a/Projectiles/Summon/AmphibiansGuitarMinion.cs b/Projectiles/Summon/AmphibiansGuitarMinion.cs index 5f026779bb..48ea3829a3 100644 --- a/Projectiles/Summon/AmphibiansGuitarMinion.cs +++ b/Projectiles/Summon/AmphibiansGuitarMinion.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon } float oscillation = MathHelper.Clamp(Math.Abs((float)Math.Sin(Time * 5f / MathHelper.Pi)), 0f, 1f); - Vector2 intendedPosition = RotationPosition - Vector2.UnitY.RotatedBy(IntendedRotationAngle) * (Target == null ? 100f : (Target.Size.Length() / 2f) + (600f - 350f * oscillation)); + Vector2 intendedPosition = RotationPosition - Vector2.UnitY.RotatedBy(IntendedRotationAngle) * (Target == null ? 100f : (Target.Size.Length() / 2f) + (250f - 150f * oscillation)); Projectile.Center = Vector2.Lerp(Projectile.Center, intendedPosition, Utils.Remap(Projectile.DistanceSQ(intendedPosition), 6400f, 0f, 0.1f, 0.3f)); Projectile.rotation = IntendedRotationAngle; @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = TextureAssets.Projectile[Type].Value; Rectangle frame = texture.Frame(horizontalFrames: 8, frameX: GuitarSprite); - Projectile.DrawProjectileWithBackglow(_effectsColor with { A = 0 }, lightColor, Target == null ? 0 : 8, texture, frame); + Projectile.DrawProjectileWithBackglow(_effectsColor with { A = 0 }, lightColor, Target == null ? 0 : 3, texture, frame); Main.EntitySpriteDraw( texture, diff --git a/Projectiles/Summon/AmphibiansGuitarProjectile.cs b/Projectiles/Summon/AmphibiansGuitarProjectile.cs index bde7e8a8b4..618e13537b 100644 --- a/Projectiles/Summon/AmphibiansGuitarProjectile.cs +++ b/Projectiles/Summon/AmphibiansGuitarProjectile.cs @@ -78,11 +78,6 @@ namespace CalamityMod.Projectiles.Summon dust.color = noteColor; dust.noLightEmittence = true; } - if (Projectile.ai[2] == 5 && time % 2 == 0) - { - Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 8, 0.065f, noteColor * 0.75f, new Vector2(1, 0.3f), true, false, 1f); - GeneralParticleHandler.SpawnParticle(spark); - } time++; } @@ -115,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon if (IsHatNote) { for (int i = 0; i < 3; i++) - Main.EntitySpriteDraw(tex2.Value, generalDrawPos, null, noteColor with { A = 0 }, Main.GlobalTimeWrappedHourly * 7.3f + i * 2, tex2.Size() * 0.5f, Projectile.scale * (0.7f + i * 0.7f) * 0.9f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, generalDrawPos, null, (noteColor * 0.5f) with { A = 0 }, Main.GlobalTimeWrappedHourly * 7.3f + i * 2, tex2.Size() * 0.5f, Projectile.scale * (0.6f + i * 0.6f), SpriteEffects.None); } return false; } diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 8267a409ae..e07ceebd84 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -68,17 +68,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation += Projectile.velocity.X * 0.04f; // Make the minion spin depending on how fast it is. - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 18f, 12f, true, true, 1); } public override bool MinionContactDamage() => true; - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = true; // Should always be able to fly through platforms - return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 6b5f11be8b..c21edfed24 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -23,11 +23,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -2; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index c5a3c69c48..17e6e8a048 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile modProj = Projectile.Calamity(); //hitbox size scaling - float scale = (float)Math.Log(Projectile.minionSlots, 10f) + 1f; + float scale = 0.8f + Projectile.minionSlots * 0.2f; if (Projectile.scale != scale) Projectile.scale = scale; Projectile.width = (int)(64f * Projectile.scale); @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Summon { attackCounter += Main.rand.Next(1, 4); } - if (attackCounter > 300) + if (attackCounter > 240) { attackCounter = 0; Projectile.netUpdate = true; @@ -202,9 +202,24 @@ namespace CalamityMod.Projectiles.Summon attackCounter += 2; if (Main.myPlayer == Projectile.owner) { - Vector2 laserVel = Projectile.SafeDirectionTo(objectivepos) * laserSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, laserVel, projType, Projectile.damage, 0f, Projectile.owner); - Projectile.netUpdate = true; + if (Main.rand.NextBool()) + { + for (int i = 0; i < 8; i++) + { + Vector2 circleVel = ((MathHelper.TwoPi * i / 8f) - MathHelper.ToRadians(67.5f)).ToRotationVector2() * laserSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, circleVel, projType, Projectile.damage, 0f, Projectile.owner); + } + } + else + { + for (int i = 0; i < 5; i++) + { + Vector2 direction = Projectile.SafeDirectionTo(objectivepos); + Vector2 spreadPos = Projectile.Center + direction * Main.rand.NextFloat(1f, 4f) + direction.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-16f, 16f); + Vector2 laserVel = direction * laserSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spreadPos, laserVel, projType, Projectile.damage, 0f, Projectile.owner); + } + } } } } 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/CorroslimeMinion.png b/Projectiles/Summon/BlightedSlimeCorro.png similarity index 100% rename from Projectiles/Summon/CorroslimeMinion.png rename to Projectiles/Summon/BlightedSlimeCorro.png diff --git a/Projectiles/Summon/CrimslimeMinion.png b/Projectiles/Summon/BlightedSlimeCrim.png similarity index 100% rename from Projectiles/Summon/CrimslimeMinion.png rename to Projectiles/Summon/BlightedSlimeCrim.png diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/BlightedSlimeMinion.cs similarity index 69% rename from Projectiles/Summon/CrimslimeMinion.cs rename to Projectiles/Summon/BlightedSlimeMinion.cs index 934db01829..5871046865 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/BlightedSlimeMinion.cs @@ -2,23 +2,34 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class CrimslimeMinion : ModProjectile, ILocalizedModType + public class BlightedSlimeMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public float dust = 0f; + public static Asset Corroslime; + public static Asset Crimslime; + public override void SetStaticDefaults() { Main.projFrames[Type] = 6; Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; + + if (!Main.dedServ) + { + Corroslime = ModContent.Request("CalamityMod/Projectiles/Summon/BlightedSlimeCorro"); + Crimslime = ModContent.Request("CalamityMod/Projectiles/Summon/BlightedSlimeCrim"); + } } public override void SetDefaults() @@ -34,47 +45,41 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = -1; Projectile.timeLeft *= 5; Projectile.minion = true; + AIType = ProjectileID.BabySlime; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 23; - AIType = ProjectileID.BabySlime; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = false; - return true; - } - public override void AI() { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - int constant = 16; - for (int i = 0; i < constant; i++) + int dustAmt = 16; + for (int i = 0; i < dustAmt; i++) { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Blood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); + int dust = Dust.NewDust(rotate + faceDirection, 0, 0, WorldGen.crimson ? DustID.Blood : DustID.Demonite, faceDirection.X, faceDirection.Y, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = faceDirection; } dust += 1f; } - bool isMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); + bool isMinion = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); if (isMinion) { if (player.dead) { - modPlayer.cSlime2 = false; + modPlayer.blightedSlime = false; } - if (modPlayer.cSlime2) + if (modPlayer.blightedSlime) { Projectile.timeLeft = 2; } @@ -85,7 +90,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture2D13 = (WorldGen.crimson ? Crimslime : Corroslime).Value; int framing = texture2D13.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/BoneMatter.cs b/Projectiles/Summon/BoneMatter.cs deleted file mode 100644 index 5b86428a3d..0000000000 --- a/Projectiles/Summon/BoneMatter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class BoneMatter : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 6; - ProjectileID.Sets.MinionShot[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 32; - Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - if (Projectile.frameCounter++ % 9 == 8) - { - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.Kill(); - } - } - } -} diff --git a/Projectiles/Summon/BoneMatter.png b/Projectiles/Summon/BoneMatter.png deleted file mode 100644 index 2f28b1ab30..0000000000 Binary files a/Projectiles/Summon/BoneMatter.png and /dev/null differ diff --git a/Projectiles/Summon/BoneMatter2.cs b/Projectiles/Summon/BoneMatter2.cs deleted file mode 100644 index f13ef7e259..0000000000 --- a/Projectiles/Summon/BoneMatter2.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class BoneMatter2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 6; - ProjectileID.Sets.MinionShot[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 28; - Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter % 9 == 8) - { - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.Kill(); - } - } - } -} diff --git a/Projectiles/Summon/BoneMatter2.png b/Projectiles/Summon/BoneMatter2.png deleted file mode 100644 index 277aedabfd..0000000000 Binary files a/Projectiles/Summon/BoneMatter2.png and /dev/null differ diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 81f4e960a3..b906f1c827 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -2,7 +2,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -43,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon bool isActive = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.brimElemental && !modPlayer.allElementals && !modPlayer.brimElementalVanity && !modPlayer.allElementalsVanity) + if (modPlayer.brimElemental is null && modPlayer.allElementals is null && !modPlayer.brimElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -219,5 +222,29 @@ namespace CalamityMod.Projectiles.Summon return null; } } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + var cplayer = Main.player[Projectile.owner].Calamity(); + + if ((cplayer.brimElemental.HasValue && !cplayer.brimElemental.Value) || (cplayer.allElementals.HasValue && !cplayer.allElementals.Value)) + { + Vector3 hsl = Main.rgbToHsl(Color.Red); + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(0.25f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - hsl.X, hsl.Y, hsl.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + } + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + + return false; + } } } 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 2b6874179d..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, 30); + target.AddBuff(BuffID.OnFire3, 300); + target.AddBuff(BuffID.Venom, 300); if (MinionCount >= 2f) - target.AddBuff(BuffID.CursedInferno, 30); + target.AddBuff(BuffID.CursedInferno, 300); if (MinionCount >= 3f) - target.AddBuff(BuffID.Venom, 30); + target.AddBuff(BuffID.Ichor, 300); if (MinionCount >= 4f) - { - target.AddBuff(BuffID.Ichor, 30); - target.AddBuff(ModContent.BuffType(), 30); - } + 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/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 336fbb5feb..0b2b9ef16c 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -1,7 +1,11 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.cloudElemental && !modPlayer.allElementals && !modPlayer.cloudElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.cloudElemental.HasValue && modPlayer.allElementals is null && !modPlayer.cloudElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -142,6 +146,16 @@ namespace CalamityMod.Projectiles.Summon } } } + 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? CanDamage() { Player player = Main.player[Projectile.owner]; @@ -155,5 +169,28 @@ namespace CalamityMod.Projectiles.Summon return null; } } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + var cplayer = Main.player[Projectile.owner].Calamity(); + + if ((cplayer.cloudElemental.HasValue && !cplayer.cloudElemental.Value) || (cplayer.allElementals.HasValue && !cplayer.allElementals.Value)) + { + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(0.25f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Color.White); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + } + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + + return false; + } } } 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/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs deleted file mode 100644 index 9fd7296ef8..0000000000 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ /dev/null @@ -1,97 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class CorroslimeMinion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public float dust = 0f; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 6; - Main.projPet[Type] = true; - ProjectileID.Sets.MinionSacrificable[Type] = true; - ProjectileID.Sets.MinionTargettingFeature[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 26; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.minionSlots = 1; - Projectile.alpha = 75; - Projectile.aiStyle = ProjAIStyleID.Pet; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.timeLeft *= 5; - Projectile.minion = true; - AIType = ProjectileID.BabySlime; - Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 23; - Projectile.DamageType = DamageClass.Summon; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = false; - return true; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (dust == 0f) - { - int constant = 16; - for (int i = 0; i < constant; i++) - { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Demonite, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].noLight = true; - Main.dust[dust].velocity = faceDirection; - } - dust += 1f; - } - bool isMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isMinion) - { - if (player.dead) - { - modPlayer.cSlime = false; - } - if (modPlayer.cSlime) - { - Projectile.timeLeft = 2; - } - } - } - - public override bool MinionContactDamage() => true; - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; - int y6 = framing * Projectile.frame; - Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.png b/Projectiles/Summon/CorruptionSlimeGodMinion.png deleted file mode 100644 index 70d4fe5869..0000000000 Binary files a/Projectiles/Summon/CorruptionSlimeGodMinion.png and /dev/null differ diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index 1d7269474d..8bf43bdb38 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = false; Projectile.tileCollide = false; - Projectile.minionSlots = Cosmilamp.LanternSummonCost; + Projectile.minionSlots = 1f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.minion = true; diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs deleted file mode 100644 index 3199f82bbc..0000000000 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ /dev/null @@ -1,99 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class CrimsonSlimeGodMinion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override string Texture => "CalamityMod/Projectiles/Summon/CrimslimeMinion"; - public float dust = 0f; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 6; - ProjectileID.Sets.MinionSacrificable[Type] = true; - ProjectileID.Sets.MinionTargettingFeature[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 26; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.minionSlots = 0f; - Projectile.alpha = 75; - Projectile.aiStyle = ProjAIStyleID.Pet; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.timeLeft *= 5; - Projectile.minion = true; - Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 23; - AIType = ProjectileID.BabySlime; - Projectile.DamageType = DamageClass.Summon; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) - { - fallThrough = false; - return true; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (dust == 0f) - { - int constant = 16; - for (int i = 0; i < constant; i++) - { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Blood, faceDirection.X * 1f, faceDirection.Y * 1f, 100, default, 1.1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].noLight = true; - Main.dust[dust].velocity = faceDirection; - } - dust += 1f; - } - bool isMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (!modPlayer.slimeGod) - { - Projectile.active = false; - return; - } - if (isMinion) - { - if (player.dead) - { - modPlayer.sGod = false; - } - if (modPlayer.sGod) - { - Projectile.timeLeft = 2; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public override bool PreDraw(ref Color lightColor) - { - Texture2D slom = TextureAssets.Projectile[Type].Value; - Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); - return false; - } - } -} diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.png b/Projectiles/Summon/CrimsonSlimeGodMinion.png deleted file mode 100644 index e4e1a4620f..0000000000 Binary files a/Projectiles/Summon/CrimsonSlimeGodMinion.png and /dev/null differ diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index bfa59c1b17..99ffe5c6ac 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.333f; + Projectile.minionSlots = 1f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon bladeColor = Color.Orchid; Projectile.extraUpdates = 1; damageMult = 0.5f; - Projectile.ArmorPenetration = 40; + Projectile.ArmorPenetration = 20; break; case 2: // Rock bladeColor = Color.OrangeRed; @@ -82,7 +82,6 @@ namespace CalamityMod.Projectiles.Summon default: // Flame bladeColor = Color.Orange; damageMult = 1; - Projectile.ArmorPenetration = 20; break; } @@ -124,7 +123,7 @@ namespace CalamityMod.Projectiles.Summon { SoundStyle slam = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 2); SoundEngine.PlaySound(slam with { Volume = 0.4f, Pitch = Main.rand.NextFloat(-0.25f, -0.15f), MaxInstances = -1 }, Projectile.Center); - for (int i = 0; i < 7; i++) + for (int i = 0; i < 5; i++) { Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.75f, 1.2f), Color.White, new Vector2(1.3f, 0.5f), false, false, Main.rand.NextFloat(-5, 5), false, false); GeneralParticleHandler.SpawnParticle(spark); @@ -137,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon { if (KnifeType == 1 && attacksDone > 0 && Utils.Distance(Projectile.Center, storedPos) < 150 && attackCooldown == 0) { - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.1f, false, 20, 0.03f, bladeColor * 0.55f, new Vector2(0.8f, 2.3f), true, false, 0.45f); + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.1f, false, 20, 0.03f, bladeColor * 0.4f, new Vector2(0.8f, 2.3f), true, false, 0.45f); GeneralParticleHandler.SpawnParticle(spark); } if (KnifeType == 2 && attackCooldown == 0) @@ -167,12 +166,6 @@ namespace CalamityMod.Projectiles.Summon Particle spark2 = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.5f) * Main.rand.NextFloat(1f, 5f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 14, Main.rand.NextFloat(0.9f, 1.2f), Color.Gold, new Vector2(0.5f, 1.5f), true, false, 0, false, false, -0.25f); GeneralParticleHandler.SpawnParticle(spark2); - for (int i = 0; i < 2; i++) - { - Particle trail = new GlowSparkParticle(Projectile.Center + i * Projectile.velocity * 0.4f, -Projectile.velocity * 0.05f, false, 9, 0.05f, Color.Orange * 0.6f, new Vector2(1, 0.3f), true, false, 0.85f); - GeneralParticleHandler.SpawnParticle(trail); - } - } if (attackCooldown == 0) SliceTarget(potentialTarget); diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 0f45d5e234..fbdbd673d2 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.appliesImmunityTimeOnSingleHits = true; } public override void AI() @@ -171,8 +174,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int j = 0; j < 20; j++) 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/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 3a3533b16a..40276faf94 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Projectiles.Summon count += 1f; } Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) + if (Projectile.localAI[0] > 4f && Projectile.localAI[0] % 2 == 0f) { - Particle beam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 8, 0.085f, Color.Lerp(Color.OrangeRed, Color.Goldenrod, Utils.GetLerpValue(270, 230, Projectile.timeLeft)), new Vector2(1f, (1 + 0.8f * velPower)), true, false, 0, false, false, 0.5f * velPower); + Particle beam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/SmallBloom", false, 8, 0.085f, Color.Lerp(Color.OrangeRed, Color.Goldenrod, Utils.GetLerpValue(270, 230, Projectile.timeLeft)), new Vector2(1f, 1 + 0.8f * velPower), true, false, 0, false, false, 0.5f * velPower); GeneralParticleHandler.SpawnParticle(beam); } 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/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index 02afaf3337..84575b1c28 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -96,6 +97,11 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs index 10915893e7..feea449d27 100644 --- a/Projectiles/Summon/HarvestStaffMinion.cs +++ b/Projectiles/Summon/HarvestStaffMinion.cs @@ -42,7 +42,8 @@ namespace CalamityMod.Projectiles.Summon if (value == AIState.Attack) { Animation = AnimationState.Run; - SoundEngine.PlaySound(ScreamSound, Projectile.Center); + if (!CalamityClientConfig.Instance.MisophoniaSupport) + SoundEngine.PlaySound(ScreamSound, Projectile.Center); } else if (value == AIState.Idle) Animation = AnimationState.Idle; @@ -385,7 +386,7 @@ namespace CalamityMod.Projectiles.Summon // When the pumpkin encounters a 1-tile-height obstacle, it'll climb it, like the player. Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); - if (Main.rand.NextBool(700)) + if (Main.rand.NextBool(700) && !CalamityClientConfig.Instance.MisophoniaSupport) SoundEngine.PlaySound(Main.rand.NextBool(20) ? IdleRareSound : IdleSound, Projectile.Center); } diff --git a/Projectiles/Summon/HydrothermicVent.cs b/Projectiles/Summon/HydrothermicVent.cs index a90d0b2d32..fdd82f6bb5 100644 --- a/Projectiles/Summon/HydrothermicVent.cs +++ b/Projectiles/Summon/HydrothermicVent.cs @@ -173,15 +173,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] = 20f; } } - - //doesn't look good - /*Vector2 goreVec = new Vector2(projectile.Center.X, projectile.Center.Y - yAdjust - 10f); - Vector2 goreVec = new Vector2(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y); - if (Main.rand.NextBool(8)) - { - int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 0.5f); - Main.gore[smoke].behindTiles = true; - }*/ } } 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/MutatedTruffleMinion.cs b/Projectiles/Summon/MutatedTruffleMinion.cs index 5e97d9c72c..a91eee29b6 100644 --- a/Projectiles/Summon/MutatedTruffleMinion.cs +++ b/Projectiles/Summon/MutatedTruffleMinion.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.BaseProjectiles; @@ -246,7 +247,7 @@ namespace CalamityMod.Projectiles.Summon private void SyncVariables() => Projectile.ForceNetUpdate(false); #endregion - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override bool MinionContactDamage() => State == AIState.Dashing; // The minion while dashing does 1.25x more damge. diff --git a/Projectiles/Summon/MutatedTruffleToothballSpike.cs b/Projectiles/Summon/MutatedTruffleToothballSpike.cs index 46b1ae0f5b..1a5283c6ed 100644 --- a/Projectiles/Summon/MutatedTruffleToothballSpike.cs +++ b/Projectiles/Summon/MutatedTruffleToothballSpike.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -50,6 +51,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override bool? CanDamage() => (TimerForHitbox >= TimeForHitbox && Projectile.getRect().Intersects(TargetShot.getRect())) ? null : false; } } diff --git a/Projectiles/Summon/MutatedTruffleVortex.cs b/Projectiles/Summon/MutatedTruffleVortex.cs index 32fcdfe886..2760237f47 100644 --- a/Projectiles/Summon/MutatedTruffleVortex.cs +++ b/Projectiles/Summon/MutatedTruffleVortex.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -76,6 +77,7 @@ namespace CalamityMod.Projectiles.Summon else return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void OnKill(int timeLeft) { diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 66667c4cdf..4583bf50d0 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -80,7 +80,8 @@ namespace CalamityMod.Projectiles.Summon bee.usesLocalNPCImmunity = true; bee.localNPCHitCooldown = 10; bee.penetrate = 2; - bee.DamageType = DamageClass.Generic; + bee.DamageType = DamageClass.Summon; + bee.CritChance = 0; } } } 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/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 19db3f0522..c6d599c406 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (shootVel * Main.rand.NextFloat(0.8f, 1.2f)).RotatedBy(0.75f * (attacks % 2 == 0 ? -1 : 1)).RotatedByRandom(0.4f), ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, Main.rand.NextFloat(0.75f, 1f), 15); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0, Main.rand.NextFloat(0.6f, 0.75f), 15); GeneralParticleHandler.SpawnParticle(orb2); attackTimer = 8; @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Summon SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); SoundEngine.PlaySound(fireHeal with { Volume = 0.7f, Pitch = 0.3f }, Projectile.Center); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(54, 209, 54), "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.3f, 24); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(54, 209, 54), "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0, 1f, 24); GeneralParticleHandler.SpawnParticle(orb2); } attackCooldown--; 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/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index aa69a548bf..df2e86ec86 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -2,8 +2,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -44,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.oasisElemental && !modPlayer.allElementals && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.oasisElemental.HasValue && modPlayer.allElementals is null && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -198,5 +201,29 @@ namespace CalamityMod.Projectiles.Summon return null; } } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + var cplayer = Main.player[Projectile.owner].Calamity(); + + if ((cplayer.oasisElemental.HasValue && !cplayer.oasisElemental.Value) || (cplayer.allElementals.HasValue && !cplayer.allElementals.Value)) + { + Vector3 hsl = Main.rgbToHsl(Color.LawnGreen); + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(0.25f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - hsl.X, hsl.Y, hsl.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + } + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + + return false; + } } } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 397f3481cd..267d778619 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -1,7 +1,10 @@ using System; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandElemental && !modPlayer.allElementals && !modPlayer.sandElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.sandElemental.HasValue && modPlayer.allElementals is null && !modPlayer.sandElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -250,5 +253,29 @@ namespace CalamityMod.Projectiles.Summon } } public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + var cplayer = Main.player[Projectile.owner].Calamity(); + + if ((cplayer.sandElemental.HasValue && !cplayer.sandElemental.Value) || (cplayer.allElementals.HasValue && !cplayer.allElementals.Value)) + { + Vector3 hsl = Main.rgbToHsl(Color.SandyBrown); + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(0.25f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - hsl.X, hsl.Y, hsl.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + } + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + + return false; + } } } diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs deleted file mode 100644 index d8e21def52..0000000000 --- a/Projectiles/Summon/SeashineSwordProj.cs +++ /dev/null @@ -1,321 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Summon; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SeashineSwordProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public Player Owner => Main.player[Projectile.owner]; - public float attackTimer = 0; - public float time = 0; - public bool isSpawning => time < 180; - - public float bladeCharge = 0; // The charge level of the blade, ranges from 0 to 1 - - public Vector2 tipPosition; - public Vector2 savedTipPos = Vector2.Zero; - public bool attackMode => Owner.HeldItem.type == ModContent.ItemType(); // If not holding the weapon, the blades won't charge (no whips for you) - - // Values stored to create blade swing arc - public Vector2 startPos; - public Vector2 endPos; - public bool setPos = true; - - public bool isAttacking = false; // If the blade is in the swinging animation to attack - public bool readySound = true; - public static int baseReturnSpeed = 18; - public int returnSpeed = baseReturnSpeed; // How fast blades retun to you - public float bladeValue = 0; // The delay between each sword swing - public Color mainColor; - - public float bladeChargeSpeed = 0.0015f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.MinionSacrificable[Type] = true; - // Minion targeting feature is not active here since this isn't a normal summon weapon - } - public override void SetDefaults() - { - Projectile.width = 32; - Projectile.height = 34; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; - Projectile.timeLeft = 90000; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.minion = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 70 * Projectile.MaxUpdates; - Projectile.DamageType = DamageClass.Summon; - Projectile.extraUpdates = 2; - } - - public override void AI() - { - // Color shifting - float rate = (Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 6; - List eColors = new List() - { - Color.RoyalBlue, - Color.Turquoise - }; - - int colorIndex = (int)(rate / 2 % eColors.Count); - Color currentColor = eColors[colorIndex]; - Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); - - // This is the delay between each sword swing, the time bewteen gets shorter as you get more swords - // This is so it doesn't take forever for swords to come out when you have a lot of them - bladeValue = (Projectile.ai[1] * (6 / MathHelper.Clamp(Owner.ownedProjectileCounts[Projectile.type] * 0.1f, 1, 1000))) + 10; - - // This checks when the blade is told to attacking to see if it can attack - if (Projectile.ai[0] == 5 && bladeCharge >= 1) - isAttacking = true; - else if (attackTimer == 0) - Projectile.ai[0] = 0; - - Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.6f); - ApplyPlayerBuffs(); - - tipPosition = Projectile.Center + (Vector2.UnitX * MathHelper.Clamp(bladeCharge * 103, 0, 2000)).RotatedBy(Projectile.rotation) * Projectile.scale; - Vector2 tipVel = (savedTipPos - tipPosition); - savedTipPos = tipPosition; - - if (isSpawning) // The effects when you first throw out a summon - { - if (time >= 110) // Shine effect when spawning - { - if (time == 110) - { - for (int i = 0; i < 15; i++) - { - Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.85f, 1.3f); - dust.color = mainColor; - dust.noLightEmittence = true; - } - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.9f }, Projectile.Center); - for (int i = 0; i < 2; i++) - { - Particle fx = new CustomSpark(tipPosition, (i == 0 ? Vector2.UnitY : Vector2.UnitX).RotatedBy(MathHelper.ToRadians(45)) * 0.01f, "CalamityMod/Particles/ThinEndedLine", false, 18, 1, mainColor, new Vector2(3.3f, 0.6f), extraRotation: 0, shrinkSpeed: 0.9f); - GeneralParticleHandler.SpawnParticle(fx); - } - } - Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.1f); - Projectile.velocity *= 0.95f; - } - else // Spinning - { - Projectile.velocity *= 0.96f; - Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.2f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.55f, 0.7f); - dust.color = mainColor; - dust.noLightEmittence = true; - if (time >= 80) - Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.09f); - else - Projectile.rotation += 0.15f; - } - bladeCharge = 0.4f; - } - else // The actual active ai for the summon - { - if (isAttacking) // When commanded to attack and is fully charged - { - attackTimer++; - if (attackTimer >= 120 + bladeValue) // Reset values after a swing - { - Projectile.netUpdate = true; - attackTimer = 80; - Projectile.ai[0] = 0; - setPos = true; - isAttacking = false; - readySound = true; - bladeCharge = 0.9f; - Projectile.numHits = 0; - Projectile.scale = 1; - returnSpeed = 460; - } - - if (attackTimer > bladeValue && Projectile.ai[0] != 0) // The actual swing - { - Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld()); - float lerp = Utils.GetLerpValue(30 + bladeValue, 100 + bladeValue, attackTimer, true); - if (setPos) - { - Projectile.netUpdate = true; - startPos = Projectile.Center; - endPos = Owner.Calamity().mouseWorld + toMouse * 480; - Projectile.numHits = 0; - setPos = false; - } - - Projectile.velocity = (Vector2.Lerp(startPos, endPos, lerp) - Projectile.Center) / returnSpeed; - float angles = 180 * (Projectile.ai[1] % 2 == 0 ? -1 : 1); - float rot = Utils.DirectionTo(startPos, endPos).RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-angles), MathHelper.ToRadians(angles) / 5, (float)Math.Pow(lerp, 1.5f))).ToRotation(); - Projectile.rotation = Utils.AngleLerp(Projectile.rotation, rot, 0.1f); - - } - else // An altered version of the on back code to get them into position to swing - { - float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); - Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); - Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center, Projectile.Center).ToRotation(), 0.05f); - - float destLerp = Utils.GetLerpValue(0, bladeValue, attackTimer, true); - Vector2 destination = Owner.Center + bonusPos + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 2) * (-20 - 330 * (float)Math.Pow(destLerp, 2)); - Projectile.velocity = (destination - Projectile.Center) / (returnSpeed * 0.6f); - } - } - else // Chill on the players back while charging the blade - { - float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); - Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); - - Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center + Vector2.UnitY * -60, Projectile.Center).ToRotation(), Utils.Remap(returnSpeed, baseReturnSpeed, 460, 0.05f, 0.005f, true)); - - Vector2 destination = Owner.Center + bonusPos - Vector2.UnitY * 40 + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 3) * (-15 - Projectile.ai[1] * 18); - Projectile.velocity = (destination - Projectile.Center) / returnSpeed; - if (bladeCharge < 1f) - bladeCharge += bladeChargeSpeed; - - // The weapon theoretically works with projectile scale, though I ended up not using it - //if (Projectile.scale < 3) - //Projectile.scale += 0.01f; - } - if (readySound && bladeCharge >= 1) // Effect when the blade is fully charged - { - Projectile.netUpdate = true; - for (int i = 0; i < 8; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.65f, 1f); - dust.color = mainColor; - dust.noLightEmittence = true; - } - SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) + Projectile.ai[1] * 0.05f }, Projectile.Center); - readySound = false; - } - } - // This is the tip trail for the blades, it is a very consistently good looking trail, however it creates a LOT of particles - // I do not recommend reusing this effect unless you're using it carefully - if ((returnSpeed == baseReturnSpeed && bladeCharge >= 1 || (isAttacking && attackTimer > bladeValue + 5)) || isSpawning) - { - Particle orb = new CustomSpark(tipPosition, tipVel.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/BloomCircle", false, isAttacking ? 30 : 12, Utils.Remap(tipVel.Length(), 2, 15, 0.15f, 0.3f, true) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, isAttacking ? 1.3f : 1), true, true, shrinkSpeed: Utils.Remap(tipVel.Length(), 1, 8, 0f, 0.4f, true), glowOpacity: 0.5f, glowCenterScale: 0.8f); - GeneralParticleHandler.SpawnParticle(orb); - } - // The uncharge of the blades when you're not holding the item or after they slash - if (!isAttacking && (attackTimer > 0 || !attackMode)) - { - bladeCharge = MathHelper.Clamp(MathHelper.Lerp(bladeCharge, 0, 0.025f), 0.4f, 1); - if (attackTimer > 0) - attackTimer--; - readySound = true; - } - // How fast the blades try to reach their goal position when not activley slashing - // Tries to get back to the base value when possible - if (returnSpeed > baseReturnSpeed) - { - returnSpeed = (int)(returnSpeed * 0.99f); - } - else - returnSpeed = baseReturnSpeed; - - time++; - } - public void ApplyPlayerBuffs() - { - Owner.AddBuff(ModContent.BuffType(), 3600); - if (Projectile.type == ModContent.ProjectileType()) - { - if (Owner.dead) - Owner.Calamity().seashineSwordBuff = false; - if (Owner.Calamity().seashineSwordBuff) - Projectile.timeLeft = 2; - } - } - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineHilt").Value; - Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; - Texture2D tex3 = ModContent.Request("CalamityMod/Particles/FullStar").Value; - - Vector2 drawPos = Projectile.Center - Main.screenPosition; - float extremeLerp = (float)Math.Pow(bladeCharge, 10); - for (int i = 0; i < 3; i++) - Main.EntitySpriteDraw(tex2, drawPos - (Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * 59 * bladeCharge * Projectile.scale), null, Color.Lerp(mainColor, Color.White, i * 0.3f) with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(90), tex2.Size() * 0.5f, new Vector2(0.33f - i * 0.05f, (0.75f + i * 0.03f) * bladeCharge) * 0.05f * Projectile.scale, SpriteEffects.None); - - for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(tex, drawPos, null, Color.Lerp(lightColor, (i == 0 ? Color.White : mainColor) with { A = 0 }, extremeLerp), Projectile.rotation + MathHelper.ToRadians(45), tex.Size() * 0.5f, (i == 0 ? 0.8f : 1) * Projectile.scale, SpriteEffects.None); - - if (!isAttacking && bladeCharge < 1) - { - for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(tex3, drawPos, null, mainColor with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45), tex3.Size() * 0.5f, new Vector2(i == 0 ? 1 : 3, i == 0 ? 3 : 1) * Main.rand.NextFloat(0.8f, 1.1f) * extremeLerp, SpriteEffects.None); - } - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - if (isAttacking) - { - for (int i = 0; i < 6; i++) - { - if (i % 2 == 0) - { - Particle spark = new SeaPrismParticle(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 30f), true, 40, Main.rand.NextFloat(0.85f, 1.3f), Color.White, Vector2.One, false, Main.rand.NextFloat(-0.3f, 0.3f), affectedByLight: false); - GeneralParticleHandler.SpawnParticle(spark); - } - - Particle e = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.1f, 0.2f) * 2.5f, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); - GeneralParticleHandler.SpawnParticle(e); - } - for (int i = 0; i < 3; i++) - { - //Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 15f)); - //dust.noGravity = false; - //dust.scale = Main.rand.NextFloat(0.95f, 1.4f); - //dust.color = mainColor; - //dust.noLightEmittence = true; - } - SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, PitchVariance = 0.3f }, Projectile.Center); - } - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Blades should do big damage on the inital hit due to the large delay between attacks - // However, it's pierce reduction is quite severe (at least right now) - float minMult = 0.1f; - int hitsToMinMult = 4; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear - { - // Perform an AABB line collision check to check the whole spear. - float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 30 * Projectile.scale, ref _); - } - public override bool? CanDamage() => isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0; - } -} 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/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs index d59573fd37..3463b97ee7 100644 --- a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs +++ b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public Projectile OwnerProjectile => CalamityUtils.FindProjectileByIdentity((int)Projectile.ai[1], Projectile.owner); - public const int LifetimeConst = 75; + public const int LifetimeConst = 90; public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTimeWrappedHourly * 10f) * 0.07f; public override float MaxLaserLength => 1560f; public override float Lifetime => LifetimeConst; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 5b9c20254a..a064b4282a 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction float idealRotation = Main.myPlayer != Projectile.owner ? Projectile.rotation : Projectile.AngleTo(Main.MouseWorld); - NPC potentialTarget = Projectile.Center.ClosestNPCAt(AresExoskeleton.TargetingDistance); + NPC potentialTarget = Projectile.Center.MinionHoming(AresExoskeleton.TargetingDistance, Owner); if (potentialTarget != null) { Projectile.ai[1] = 1f; diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs index 2620fa4b84..d8f5c00907 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannon.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon.SmallAresArms @@ -21,6 +22,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; // Item.shoot assigns this as the minion } public override void PostAI() diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index d5be045715..5aaa5133c0 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -36,9 +36,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; - Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 15; + Projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) { @@ -66,82 +65,61 @@ namespace CalamityMod.Projectiles.Summon Projectile.frameCounter = 0; } if (Projectile.frame < 1) - { Projectile.frame = 1; - } if (Projectile.frame >= Main.projFrames[Type]) - { Projectile.frame = 1; - } bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) { if (player.dead) - { modPlayer.necrosteocytesDudes = false; - } if (modPlayer.necrosteocytesDudes) - { Projectile.timeLeft = 2; - } } NPC potentialTarget = Projectile.Center.MinionHoming(900f, player); - if (Projectile.velocity.Y == 0 && (HoleBelow() || (Projectile.Distance(player.Center) > 205f && Projectile.position.X == Projectile.oldPosition.X))) - { + if (Projectile.velocity.Y == 0 && (HoleBelow() || (Projectile.Distance(player.Center) > 320f && Projectile.position.X == Projectile.oldPosition.X) || (potentialTarget is not null && Projectile.Top.Y > potentialTarget.Bottom.Y))) Projectile.velocity.Y = -10f; - } else if (Projectile.velocity.Y != 0f) - { Projectile.frame = 2; - } - if (Projectile.velocity.Y > -16f) - { + if (Projectile.velocity.Y < 16f) Projectile.velocity.Y += 0.3f; - } - Projectile.ai[0]++; - if (Projectile.ai[0] % 60f == 59f && Main.myPlayer == Projectile.owner) - { - int type = Utils.SelectRandom(Main.rand, ModContent.ProjectileType(), ModContent.ProjectileType()); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, Projectile.damage, Projectile.knockBack, Projectile.owner); - } if (potentialTarget is null) { - if (Math.Abs(player.Center.X - Projectile.Center.X + 40f * Projectile.minionPos) > 160f) + if (Math.Abs(player.Center.X - Projectile.Center.X - 30f * Projectile.minionPos * player.direction) > 80f) { - Projectile.velocity.X += Main.rand.NextFloat(0.11f, 0.16f) * (player.Center.X - Projectile.Center.X + 40f * Projectile.minionPos > 0f).ToDirectionInt(); + Projectile.velocity.X += Main.rand.NextFloat(0.1f, 0.13f) * (player.Center.X - Projectile.Center.X + 40f * Projectile.minionPos > 0f).ToDirectionInt(); Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -13f, 13f); } else { - Projectile.velocity.X *= 0.95f; + Projectile.velocity.X *= 0.925f; + if (MathF.Abs(Projectile.velocity.X) < 0.05f) + Projectile.velocity.X = 0f; } - if (Projectile.Distance(player.Center) <= 150f) - { + + if (Projectile.velocity.X == 0f) Projectile.frame = 0; - } if (Projectile.Distance(player.Center) > 1600f) { Projectile.Center = player.Center; + Projectile.velocity = Vector2.Zero; Projectile.netUpdate = true; } } else { - if (Math.Abs(potentialTarget.Center.X - Projectile.Center.X + (int)MathHelper.Min(potentialTarget.width / 2, 40f)) > (int)MathHelper.Min(potentialTarget.width / 2, 40f)) - { - Projectile.velocity.X += Main.rand.NextFloat(0.08f, 0.15f) * (potentialTarget.Center.X - Projectile.Center.X > 0f).ToDirectionInt(); - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -16f, 16f); - } - else - { + Projectile.velocity.X += Main.rand.NextFloat(0.1f, 0.13f) * (potentialTarget.Center.X > Projectile.Center.X).ToDirectionInt(); + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -13f, 13f); + if (Math.Sign(Projectile.velocity.X) != (potentialTarget.Center.X > Projectile.Center.X).ToDirectionInt()) Projectile.velocity.X *= 0.95f; - } + if (Projectile.Distance(player.Center) > 1400f) { Projectile.Center = player.Center; + Projectile.velocity = Vector2.Zero; Projectile.netUpdate = true; } Projectile.MinionAntiClump(0.075f); diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/StatigelBlightedSlime.cs similarity index 82% rename from Projectiles/Summon/CorruptionSlimeGodMinion.cs rename to Projectiles/Summon/StatigelBlightedSlime.cs index e627103010..3b7e1f44a3 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/StatigelBlightedSlime.cs @@ -2,23 +2,33 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class CorruptionSlimeGodMinion : ModProjectile, ILocalizedModType + public class StatigelBlightedSlime : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public override string Texture => "CalamityMod/Projectiles/Summon/CorroslimeMinion"; + public override string Texture => "CalamityMod/Projectiles/Summon/BlightedSlimeCorro"; public float dust = 0f; + public static Asset Corroslime; + public static Asset Crimslime; + public override void SetStaticDefaults() { Main.projFrames[Type] = 6; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; + + if (!Main.dedServ) + { + Corroslime = ModContent.Request("CalamityMod/Projectiles/Summon/BlightedSlimeCorro"); + Crimslime = ModContent.Request("CalamityMod/Projectiles/Summon/BlightedSlimeCrim"); + } } public override void SetDefaults() @@ -37,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon AIType = ProjectileID.BabySlime; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 23; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; } @@ -66,8 +76,8 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - bool isMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); + bool isMinion = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) { Projectile.active = false; @@ -90,7 +100,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Texture2D slom = TextureAssets.Projectile[Type].Value; + Texture2D slom = (WorldGen.crimson ? Crimslime : Corroslime).Value; Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); return false; diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs new file mode 100644 index 0000000000..77ff9b63d2 --- /dev/null +++ b/Projectiles/Summon/UrchinSpike.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class UrchinSpike : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 6; + Projectile.friendly = true; + Projectile.timeLeft = 600; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); + } +} \ No newline at end of file diff --git a/Projectiles/Summon/UrchinSpike.png b/Projectiles/Summon/UrchinSpike.png new file mode 100644 index 0000000000..0d8e8c9ebf Binary files /dev/null and b/Projectiles/Summon/UrchinSpike.png differ diff --git a/Projectiles/Summon/VengefulSunSpiritMinion.cs b/Projectiles/Summon/VengefulSunSpiritMinion.cs index f298bbd61d..7d90986a47 100644 --- a/Projectiles/Summon/VengefulSunSpiritMinion.cs +++ b/Projectiles/Summon/VengefulSunSpiritMinion.cs @@ -108,9 +108,9 @@ namespace CalamityMod.Projectiles.Summon float shootSpeed = 15f; Vector2 source = Projectile.Center; var velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, target, shootSpeed, 2); - Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * (0.75f + Projectile.minionSlots * 0.25f)), Projectile.knockBack, Projectile.owner, ai1: (Projectile.minionSlots - 1) / 6f); + Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * (0.8f + Projectile.minionSlots * 0.2f)), Projectile.knockBack, Projectile.owner, ai1: (Projectile.minionSlots - 1) / 6f); beam.DamageType = DamageClass.Summon; - Projectile.ai[1] += 60f / (0.75f + Projectile.minionSlots * 0.25f); + Projectile.ai[1] += 60f / (0.8f + Projectile.minionSlots * 0.2f); } } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/VictideSeaSnail.cs b/Projectiles/Summon/VictideSeaSnail.cs new file mode 100644 index 0000000000..52e1cc5bf2 --- /dev/null +++ b/Projectiles/Summon/VictideSeaSnail.cs @@ -0,0 +1,231 @@ +using System; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class VictideSeaSnail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public ref float DustTimer => ref Projectile.localAI[0]; + public ref float FireCooldown => ref Projectile.localAI[1]; + public ref float PeekingOut => ref Projectile.ai[0]; + public ref float PlayerStandStillTimer => ref Projectile.ai[1]; + + public const int frameTime = 6; + public const int timeToStandStillBeforePeekOut = 200; + + public bool CanComePeekOut => !Main.player[Projectile.owner].mount.Active && PlayerStandStillTimer >= timeToStandStillBeforePeekOut || Projectile.frame > 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + Main.projFrames[Projectile.type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.minionSlots = 0f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft *= 5; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + if (!modPlayer.victideSummoner) + { + for (int d = 0; d < 45; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + Projectile.active = false; + return; + } + + if (player.dead) + modPlayer.victideSnail = false; + + if (modPlayer.victideSnail) + Projectile.timeLeft = 2; + + //Create a burst of dust as it gets created + DustTimer++; + if (DustTimer <= 3) + { + int dustAmount = Main.rand.Next(40, 50); + for (int d = 0; d < dustAmount; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + } + + if (player.velocity.Length() == 0) + { + PlayerStandStillTimer++; + //pop out the shell + if (PlayerStandStillTimer == timeToStandStillBeforePeekOut) + { + DustTimer = 0; + float direction = Main.rand.NextBool() ? 1f : -1f; + Projectile.velocity = new Vector2(Main.rand.NextFloat(4f, 10f) * direction, Main.rand.NextFloat(-6f, 0f)); + } + + Projectile.velocity *= 0.98f; + Projectile.velocity.X *= 0.95f; + Projectile.velocity.Y = Math.Min(Projectile.velocity.Y + 0.1f, 14f); + Projectile.tileCollide = true; + + if (CanComePeekOut) + Projectile.rotation = Projectile.rotation.AngleTowards(0, MathHelper.PiOver4 * 0.14f); + + if (PeekingOut > 0) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > frameTime) + { + Projectile.frameCounter = 0; + Projectile.frame = Math.Min(6, Projectile.frame + 1); + } + } + } + + //Go back, in the shell + if (player.velocity.Length() > 0 && CanComePeekOut) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > frameTime) + { + Projectile.frameCounter = 0; + Projectile.frame--; + } + + if (Projectile.frame == 0) + { + PlayerStandStillTimer = 0f; + } + } + + if (!CanComePeekOut) + { + PeekingOut = 0f; + + if (player.velocity.Length() > 0) + PlayerStandStillTimer = 0f; + + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Vector2 desiredPosition = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; + //Round the result so it doesn't jitter. + desiredPosition = new Vector2((int)desiredPosition.X, (int)desiredPosition.Y); + + Projectile.rotation += MathHelper.PiOver4 * 0.2f; + + Projectile.Center = Projectile.Center.MoveTowards(desiredPosition, 7f + player.velocity.Length()); + } + + //Fire a projectile + if (Projectile.owner == Main.myPlayer) + { + if (FireCooldown > 0f) + { + FireCooldown--; + return; + } + + bool foundTarget = false; + float maxDist = 300f; + foreach (NPC npc in Main.ActiveNPCs) + { + if (npc.CanBeChasedBy(Projectile, false)) + { + if (Vector2.Distance(Projectile.Center, npc.Center) < maxDist && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) + { + foundTarget = true; + break; + } + } + } + + if (foundTarget) + { + int projAmt = Main.rand.Next(3, 7); + for (int u = 0; u < projAmt; u++) + { + Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Projectile.owner); + } + + SoundEngine.PlaySound(SoundID.Item42, Projectile.position); + FireCooldown = 60f; + } + } + + if ((Projectile.Center - player.Center).Length() > 400) + { + DustTimer = 0; + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; + PlayerStandStillTimer = 0f; + Projectile.frame = 0; + } + } + + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + for (int d = 0; d < 45; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + //Touches the ground + if (oldVelocity.Y >= 0) + { + PeekingOut = 1f; + } + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + Player owner = Main.player[Projectile.owner]; + + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = new Rectangle(0, 36 * Projectile.frame, 38, 34); + Vector2 origin = !CanComePeekOut ? new Vector2(15, 23) : frame.Size() / 2f; + + //Look at the player + SpriteEffects flipperoni = Math.Sign(Projectile.position.X - owner.position.X) > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, flipperoni, 0); + + return false; + } + } +} diff --git a/Projectiles/Typeless/VictideSeaSnail.png b/Projectiles/Summon/VictideSeaSnail.png similarity index 100% rename from Projectiles/Typeless/VictideSeaSnail.png rename to Projectiles/Summon/VictideSeaSnail.png diff --git a/Projectiles/Summon/VoidConcentrationDarkEnergy.png b/Projectiles/Summon/VoidConcentrationDarkEnergy.png new file mode 100644 index 0000000000..d2bb54b72b Binary files /dev/null and b/Projectiles/Summon/VoidConcentrationDarkEnergy.png differ diff --git a/Projectiles/Summon/VoidConcentrationDarkEnergyGlow.png b/Projectiles/Summon/VoidConcentrationDarkEnergyGlow.png new file mode 100644 index 0000000000..696b1d5475 Binary files /dev/null and b/Projectiles/Summon/VoidConcentrationDarkEnergyGlow.png differ diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index e04dd72736..918346f7c3 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -1,7 +1,10 @@ using System; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.waterElemental && !modPlayer.allElementals && !modPlayer.waterElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.waterElemental.HasValue && modPlayer.allElementals is null && !modPlayer.waterElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -185,5 +188,29 @@ namespace CalamityMod.Projectiles.Summon } public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + var cplayer = Main.player[Projectile.owner].Calamity(); + + if ((cplayer.waterElemental.HasValue && !cplayer.waterElemental.Value) || (cplayer.allElementals.HasValue && !cplayer.allElementals.Value)) + { + Vector3 hsl = Main.rgbToHsl(Color.CornflowerBlue); + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseSaturation(0.25f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - hsl.X, hsl.Y, hsl.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + } + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + + return false; + } } } diff --git a/Projectiles/Summon/WaterElementalSong.cs b/Projectiles/Summon/WaterElementalSong.cs index 6cb4b317d4..b8d83fdd82 100644 --- a/Projectiles/Summon/WaterElementalSong.cs +++ b/Projectiles/Summon/WaterElementalSong.cs @@ -51,6 +51,10 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight(Projectile.Center, 0f, 0f, 1.2f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Confused, 30); + } public override Color? GetAlpha(Color lightColor) { diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index 18a1aac1ad..1c7d7480c1 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -247,7 +247,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.soundDelay > 0) Projectile.soundDelay--; - else + else if (!CalamityClientConfig.Instance.MisophoniaSupport) { SoundEngine.PlaySound(RandomChirpSound with { Volume = RandomChirpSound.Volume * Main.rand.NextFloat(0.5f, 1f) }, Projectile.Center); Projectile.soundDelay = NewSoundDelay; diff --git a/Projectiles/Typeless/AscendantAura.cs b/Projectiles/Typeless/AscendantAura.cs index 36a18030fa..1d3b8c7af3 100644 --- a/Projectiles/Typeless/AscendantAura.cs +++ b/Projectiles/Typeless/AscendantAura.cs @@ -63,25 +63,6 @@ namespace CalamityMod.Projectiles.Typeless // Stay on the player's head Projectile.Center = (Owner.MountedCenter + new Vector2(0, -45)); - Vector2 spawnPos = Projectile.Center + Main.rand.NextVector2Circular(5, 5); - int lifetime = Main.rand.Next(3, 6); - float scale = Main.rand.NextFloat(0.5f, 0.9f); - Color color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; - /* - SparkParticle spark1 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(7, 12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); - GeneralParticleHandler.SpawnParticle(spark1); - SparkParticle spark2 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(-7, -12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); - GeneralParticleHandler.SpawnParticle(spark2); - SparkParticle spark3 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(7, 12), Main.rand.NextFloat(-7, -12)), false, lifetime, scale, color); - GeneralParticleHandler.SpawnParticle(spark3); - SparkParticle spark4 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(-7, -12), Main.rand.NextFloat(-7, -12)), false, lifetime, scale, color); - GeneralParticleHandler.SpawnParticle(spark4); - SparkParticle spark5 = new SparkParticle(Projectile.Center + new Vector2(20, 0), new Vector2(Main.rand.NextFloat(7, 12), 0), false, lifetime, scale, color); - GeneralParticleHandler.SpawnParticle(spark5); - SparkParticle spark6 = new SparkParticle(Projectile.Center + new Vector2(-20, 0), new Vector2(Main.rand.NextFloat(-7, -12), 0), false, lifetime, scale - 0.3f, color); - GeneralParticleHandler.SpawnParticle(spark6); - */ - // Emit some light Vector3 Light = new Vector3(0.251f, 0.255f, 0.219f); Lighting.AddLight(Projectile.Center, Light * 5); diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index 7caeee006b..0e138a1a4c 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -124,55 +124,55 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(12)) { - Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 160, default, 1f); - Main.dust[crystalDust].velocity *= 0.1f; - Main.dust[crystalDust].position = Projectile.Center + rotateFirstDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[crystalDust].fadeIn = 0.9f; + Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 16f).RotatedBy(Projectile.velocity.ToRotation()); + Dust crystalDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 160, default, 1f); + crystalDust.velocity *= 0.1f; + crystalDust.position = Projectile.Center + rotateFirstDust * Projectile.width / 2f + Projectile.velocity * 2f; + crystalDust.fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); - Main.dust[greenDust].velocity *= 0.3f; - Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; + Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 8f).RotatedBy(Projectile.velocity.ToRotation()); + Dust greenDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); + greenDust.velocity *= 0.3f; + greenDust.position = Projectile.Center + rotateSecondDust * Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[greenDust].fadeIn = 1.4f; + greenDust.fadeIn = 1.4f; } } if (Main.rand.NextBool(8)) { - Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[randomDust].velocity *= 0.3f; - Main.dust[randomDust].noGravity = true; - Main.dust[randomDust].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; + Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(MathHelper.PiOver4).RotatedBy(Projectile.velocity.ToRotation()); + Dust randomDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + randomDust.velocity *= 0.3f; + randomDust.noGravity = true; + randomDust.position = Projectile.Center + rotateThirdDust * Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[randomDust].fadeIn = 1.4f; + randomDust.fadeIn = 1.4f; } } if (Main.rand.NextBool(6)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int crystalDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); - Main.dust[crystalDust2].velocity *= 0.3f; - Main.dust[crystalDust2].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[crystalDust2].fadeIn = 1.2f; - Main.dust[crystalDust2].scale = 1.5f; - Main.dust[crystalDust2].noGravity = true; + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 16f).RotatedBy(Projectile.velocity.ToRotation()); + Dust crystalDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + crystalDust2.velocity *= 0.3f; + crystalDust2.position = Projectile.Center + value13 * Projectile.width / 2f; + crystalDust2.fadeIn = 1.2f; + crystalDust2.scale = 1.5f; + crystalDust2.noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int paleDust = Dust.NewDust(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); - Main.dust[paleDust].velocity *= 0.1f; - Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; - Main.dust[paleDust].noGravity = true; + Dust paleDust = Dust.NewDustDirect(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); + paleDust.velocity *= 0.1f; + paleDust.velocity += Projectile.velocity * 0.5f; + paleDust.noGravity = true; if (Main.rand.NextBool(12)) { - int shinyDust = Dust.NewDust(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); - Main.dust[shinyDust].velocity *= 0.25f; - Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; + Dust shinyDust = Dust.NewDustDirect(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); + shinyDust.velocity *= 0.25f; + shinyDust.velocity += Projectile.velocity * 0.5f; } } @@ -182,9 +182,9 @@ namespace CalamityMod.Projectiles.Typeless return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 600); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 600); public override void OnKill(int timeLeft) { diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index 4d32133339..1d8ec32ba9 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -126,55 +126,55 @@ namespace CalamityMod.Projectiles.Typeless } if (Main.rand.NextBool(12)) { - Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int crystalDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); - Main.dust[crystalDust].velocity *= 0.1f; - Main.dust[crystalDust].position = Projectile.Center + rotateFirstDust * (float)Projectile.width / 2f + Projectile.velocity * 2f; - Main.dust[crystalDust].fadeIn = 0.9f; + Vector2 rotateFirstDust = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 16f).RotatedBy((double)Projectile.velocity.ToRotation(), default); + Dust crystalDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + crystalDust.velocity *= 0.1f; + crystalDust.position = Projectile.Center + rotateFirstDust * Projectile.width / 2f + Projectile.velocity * 2f; + crystalDust.fadeIn = 0.9f; } if (Main.rand.NextBool(18)) { - Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); - Main.dust[greenDust].velocity *= 0.3f; - Main.dust[greenDust].position = Projectile.Center + rotateSecondDust * (float)Projectile.width / 2f; + Vector2 rotateSecondDust = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 8f).RotatedBy(Projectile.velocity.ToRotation()); + Dust greenDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 155, default, 0.8f); + greenDust.velocity *= 0.3f; + greenDust.position = Projectile.Center + rotateSecondDust * Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[greenDust].fadeIn = 1.4f; + greenDust.fadeIn = 1.4f; } } if (Main.rand.NextBool(8)) { - Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int randomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[randomDust].velocity *= 0.3f; - Main.dust[randomDust].noGravity = true; - Main.dust[randomDust].position = Projectile.Center + rotateThirdDust * (float)Projectile.width / 2f; + Vector2 rotateThirdDust = -Vector2.UnitX.RotatedByRandom(MathHelper.PiOver4).RotatedBy(Projectile.velocity.ToRotation()); + Dust randomDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + randomDust.velocity *= 0.3f; + randomDust.noGravity = true; + randomDust.position = Projectile.Center + rotateThirdDust * Projectile.width / 2f; if (Main.rand.NextBool()) { - Main.dust[randomDust].fadeIn = 1.4f; + randomDust.fadeIn = 1.4f; } } if (Main.rand.NextBool(6)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int crystalDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); - Main.dust[crystalDust2].velocity *= 0.3f; - Main.dust[crystalDust2].position = Projectile.Center + value13 * (float)Projectile.width / 2f; - Main.dust[crystalDust2].fadeIn = 1.2f; - Main.dust[crystalDust2].scale = 1.5f; - Main.dust[crystalDust2].noGravity = true; + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 16f).RotatedBy(Projectile.velocity.ToRotation()); + Dust crystalDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, crystalDustType, 0f, 0f, 100, default, 1f); + crystalDust2.velocity *= 0.3f; + crystalDust2.position = Projectile.Center + value13 * Projectile.width / 2f; + crystalDust2.fadeIn = 1.2f; + crystalDust2.scale = 1.5f; + crystalDust2.noGravity = true; } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - int paleDust = Dust.NewDust(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); - Main.dust[paleDust].velocity *= 0.1f; - Main.dust[paleDust].velocity += Projectile.velocity * 0.5f; - Main.dust[paleDust].noGravity = true; + Dust paleDust = Dust.NewDustDirect(Projectile.position, Projectile.width - 28, Projectile.height - 28, DustID.BoneTorch, 0f, 0f, 100, default, 0.8f); + paleDust.velocity *= 0.1f; + paleDust.velocity += Projectile.velocity * 0.5f; + paleDust.noGravity = true; if (Main.rand.NextBool(12)) { - int shinyDust = Dust.NewDust(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); - Main.dust[shinyDust].velocity *= 0.25f; - Main.dust[shinyDust].velocity += Projectile.velocity * 0.5f; + Dust shinyDust = Dust.NewDustDirect(Projectile.position, Projectile.width - 32, Projectile.height - 32, DustID.Teleporter, 0f, 0f, 100, default, 1f); + shinyDust.velocity *= 0.25f; + shinyDust.velocity += Projectile.velocity * 0.5f; } } @@ -184,9 +184,9 @@ namespace CalamityMod.Projectiles.Typeless return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + 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(), 60); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); public override bool? CanHitNPC(NPC target) { @@ -213,23 +213,22 @@ namespace CalamityMod.Projectiles.Typeless int randomDust = 187; float crystalDust2 = 1.2f; - Vector2 dustRotate = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 dustVel = dustRotate * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; + Vector2 dustRotate = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + Vector2 dustVel = dustRotate * Projectile.velocity.Length() * Projectile.MaxUpdates; SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int dustCount; for (int j = 0; j < 20; j = dustCount + 1) { - int superRandomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, otherDustType, 0f, 0f, 200, default, crystalDust2); - Dust dust = Main.dust[superRandomDust]; - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, otherDustType, 0f, 0f, 200, default, crystalDust2); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat() * Projectile.width / 2f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 3f; dust.velocity += dustVel * Main.rand.NextFloat(); - superRandomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.6f); - dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; + dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 0.6f); + dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat() * Projectile.width / 2f; dust.velocity.Y -= 6f; dust.velocity *= 2f; dust.noGravity = true; @@ -241,9 +240,8 @@ namespace CalamityMod.Projectiles.Typeless for (int k = 0; k < 10; k = dustCount + 1) { - int palestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, 0f, 0f, 0, default, 1.5f); - Main.dust[palestDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Dust dust = Main.dust[palestDust]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, 0f, 0f, 0, default, 1.5f); + dust.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; dust.noGravity = true; dust.velocity.Y -= 6f; dust.velocity *= 0.5f; diff --git a/Projectiles/Typeless/DryadsTearBurst.cs b/Projectiles/Typeless/DryadsTearBurst.cs new file mode 100644 index 0000000000..02b0294c1e --- /dev/null +++ b/Projectiles/Typeless/DryadsTearBurst.cs @@ -0,0 +1,35 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DryadsTearBurst : BasicBurst, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.DamageType = DamageClass.Ranged; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center); + float minMult = Projectile.ai[1]; + int hitsToMinMult = (int)Projectile.ai[2]; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (Projectile.localAI[0] == 0) + modifiers.DisableCrit(); + else + modifiers.SetCrit(); + + if (customKnockback != 0) + target.MoveNPC(pushVelocity, customKnockback, hasStongDisplacement, Main.player[Projectile.owner]); + } + } +} diff --git a/Projectiles/Typeless/Elumphant.cs b/Projectiles/Typeless/Elumphant.cs index f3e16d1e25..3e2d9c487a 100644 --- a/Projectiles/Typeless/Elumphant.cs +++ b/Projectiles/Typeless/Elumphant.cs @@ -123,23 +123,21 @@ namespace CalamityMod.Projectiles.Typeless } public void SetStats() { - maxTargetingDistance = (float)(500 * GetPower(0.25f)); - attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f))); - damageScaling = (float)GetPower(0.015f, 22 * (1 + frozenCubePower)); - cooldownTime = (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f)); + maxTargetingDistance = (float)(400 * (1+frozenCubePower)); + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed/(1+frozenCubePower)); + damageScaling = 1+frozenCubePower; + cooldownTime = (int)(FrozenCube.baseAttackCooldown / (1 + frozenCubePower)); } public void SetElumphantPower() { int usedDefense = Owner.Calamity().frozenCubeUsedDefense; if (time == 0) // Show the player how much defense is being used - CombatText.NewText(Projectile.Hitbox, color2, -usedDefense,false, true); - - frozenCubePower = usedDefense * 0.05f; // 1 point of defense = 5% effectiveness + CombatText.NewText(Projectile.Hitbox, color2, -usedDefense, false, true); - float power = (float)(GetPower(0.0185f, 13f * (1 + frozenCubePower)) - 1); - Owner.Calamity().frozenCubeDebuffBoost = power; - Owner.Calamity().frozenCubeElumphantBoost = damageScaling - 1; - Owner.Calamity().ColdDebuffMultiplier += power; // Boost cold debuff damage + frozenCubePower = usedDefense * 0.04f; + Owner.Calamity().frozenCubeDebuffBoost = frozenCubePower; + Owner.Calamity().frozenCubeElumphantBoost = damageScaling; + Owner.Calamity().ColdDebuffMultiplier += frozenCubePower; } public double GetPower(float efficiency, float intenseScaling = 1) { @@ -280,7 +278,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame = 2; if (recoiling) { - attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / GetPower(0.5f)); + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f))); if (Projectile.numHits > 1) attackTimer = attackTimeAdjusted; Projectile.numHits = 1; @@ -335,6 +333,9 @@ namespace CalamityMod.Projectiles.Typeless int attemptDir = Math.Sign((recoiling ? basePosition.X : targetPos.X) - Projectile.Center.X); SetDirection(attemptDir); + if (dashing && attackTimer >= attackTimeAdjusted + 5) // failsafe + AfterLanding(targeted); + if (attackTimer <= (int)(Math.Max(attackTimeAdjusted, 2) / 2) && recoiling) { Projectile.frame = 0; @@ -383,7 +384,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 shootPosition = Projectile.Center + shootVel * 5 * Projectile.scale; Projectile mist = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), shootPosition, (shootVel * shootPosition.Distance(targeted.Center) / 25) * Main.rand.NextFloat(0.9f, 1.1f), projectile, damage, 0, Owner.whoAmI, 0, Owner.ownedProjectileCounts[projectile] % 3, (float)GetPower(1)); } - mistShootTimer += (float)(0.35f * GetPower(0.25f)); + mistShootTimer += (float)(0.2f * GetPower(0.25f)); if (mistShootTimer >= 2f) mistShootTimer = 0; } @@ -433,7 +434,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.soundDelay == cryStart) // Sound { verticalSquash = 0.3f; - if (vis) + if (vis && !CalamityClientConfig.Instance.MisophoniaSupport) soundSlot = SoundEngine.PlaySound(FrozenCube.cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center); } trunkRotation = Utils.AngleLerp(trunkRotation, maxTrunkRot * Projectile.spriteDirection, 0.025f); @@ -471,16 +472,20 @@ namespace CalamityMod.Projectiles.Typeless if (vis && Projectile.Opacity < 1) ScaleOpacity(1); Projectile.timeLeft++; - SetStats(); GetColor(); - SetElumphantPower(); ManageSquash(); + + if (!Owner.Calamity().frozenCubeVanity) + { + SetStats(); + SetElumphantPower(); + if (targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile))) + GetTarget(false); + } + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) sound.Position = Projectile.Center; - if (targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile))) - GetTarget(false); - float sine = MathF.Sin(time * 0.04f); float sine2 = MathF.Sin(time * 0.08f); float sine3 = MathF.Sin(time * 0.1f); @@ -506,7 +511,12 @@ namespace CalamityMod.Projectiles.Typeless else { Projectile.Center = goalPosition; - if (targeted == null) + if (Owner.Calamity().frozenCubeVanity) + { + targeted = null; + attackTimer = 0; + } + else if (targeted == null) GetTarget(false); if (attackTimer > cooldownTime && targeted != null) // Mist Attack @@ -611,7 +621,7 @@ namespace CalamityMod.Projectiles.Typeless lastProjPos = Projectile.Center; - if (!Owner.Calamity().frozenCube) + if (!Owner.Calamity().frozenCube && !Owner.Calamity().frozenCubeVanity) { if (SoundEngine.TryGetActiveSound(soundSlot, out var sound2) && sound2.IsPlaying) sound2?.Stop(); @@ -675,9 +685,8 @@ namespace CalamityMod.Projectiles.Typeless float attackMult = (float)(0.7f * GetPower(0.5f)); target.MoveNPC(Vector2.UnitY, 8, false, Owner); - hitNPCs.Add(target); - GetTarget(true, 1, true); - lastHitNPCPos = target.Center - Vector2.UnitY * (target.height / 2); + Projectile.numHits--; + AfterLanding(target); bool lastHit = false; if (targeted == null) @@ -686,14 +695,12 @@ namespace CalamityMod.Projectiles.Typeless if (vis) Owner.SetScreenshake(3 * attackMult); lastHit = true; - recoiling = true; modifiers.SourceDamage *= (float)(1.5f * damageScaling); } else { - attackTimer = (int)(attackTimeAdjusted / 2); float minMult = 0.25f; - int hitsToMinMult = 4; + int hitsToMinMult = 10; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= (float)(damageMult * damageScaling); } @@ -744,9 +751,20 @@ namespace CalamityMod.Projectiles.Typeless } } } + public void AfterLanding(NPC target) + { + Projectile.numHits++; + hitNPCs.Add(target); + GetTarget(true, 1, true); + lastHitNPCPos = target.Center - Vector2.UnitY * (target.height / 2); + if (targeted == null) + recoiling = true; + else + attackTimer = (int)(attackTimeAdjusted / 2); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale * 20, targetHitbox); } public override bool? CanHitNPC(NPC target) { @@ -755,5 +773,10 @@ namespace CalamityMod.Projectiles.Typeless // These extra frames before the hit allow for a bit of "hitstop" on the jump attack return (dashing && attackTimer >= attackTimeAdjusted + 3 && target == targeted) ? null : false; } + + public override bool? CanCutTiles() + { + return false; + } } } diff --git a/Projectiles/Typeless/Pigion.cs b/Projectiles/Typeless/Pigion.cs index fb6b6dc040..f2863be666 100644 --- a/Projectiles/Typeless/Pigion.cs +++ b/Projectiles/Typeless/Pigion.cs @@ -41,13 +41,16 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = 42; Projectile.height = 28; Projectile.friendly = true; - Projectile.DamageType = AverageDamageClass.Instance; + highestSpeed = 18; + //Allow it to proc all class on hit effects. Pigion is spawned using a fixed damage, and applies best-class damage when it spawns the burst + Projectile.DamageType = AllClassDamageClass.Instance; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; + Projectile.minion = true; //note: costs 0 minion slots. This allows it to benefit from "minion" effects } public void Frames() { @@ -292,14 +295,14 @@ namespace CalamityMod.Projectiles.Typeless if (deadPig) // Only spawn explosion if death is from collision { int pigNum = Owner.ownedProjectileCounts[Projectile.type]; - int damage = (int)((pigNum * 2 + Projectile.damage) * MathF.Pow(Owner.GetBestClassDamage().ApplyTo(1), 0.4f + pigNum * 0.6f)); // Damage scales with number of pigions at 0.7 power float blastSize = 100; float minMultiplier = 0.1f; int hitsToMinMult = 4; - Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage), -15, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Owner.GetBestClassDamage().ApplyTo(Projectile.originalDamage*pigNum)), -15, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); blast.timeLeft = 5; - blast.DamageType = AverageDamageClass.Instance; + blast.DamageType = AllClassDamageClass.Instance; //Proc effects for all classes, but has no effect on the dmg itself blast.CritChance = 100; + blast.minion = true; //note: costs 0 minion slots. This allows it to benefit from "minion" effects } Owner.SetScreenshake(3); diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index 1e56f608aa..06f3bf0936 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -16,15 +16,6 @@ namespace CalamityMod.Projectiles.Typeless public override int DustType => 108; } - public class EutrophicSandBallFalling : SandBall - { - public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; - public override bool Fired => false; - public override int TileType => ModContent.TileType(); - public override int ItemType => ModContent.ItemType(); - public override int DustType => DustID.Titanium; - } - public class DunesandBallFalling : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; diff --git a/Projectiles/Typeless/VictideBarrier.cs b/Projectiles/Typeless/VictideBarrier.cs deleted file mode 100644 index 7ee97c9e22..0000000000 --- a/Projectiles/Typeless/VictideBarrier.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Cooldowns; -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VictideBarrier : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/BubblyBurst"); - - public static float ExplosionLifetime = 24f; - public static float MaxScale = 6f; - - public static float DashSpeed = 24f; // 24 tiles - public static float DashLifetime = 16f; - public static int DashSlamIFrames = 12; - private List NPCsHitBySlam = new List() { -1 }; - - public ref float ExplodeTimer => ref Projectile.ai[0]; - public ref float DashTimer => ref Projectile.ai[1]; - public ref float HealTimer => ref Projectile.ai[2]; - public Player Owner => Main.player[Projectile.owner]; - - public static Asset Shine; - public static Asset Explosion; - public override void Load() - { - Shine = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Explosion = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion"); - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = (int)ExplosionLifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.rotation = MathHelper.ToRadians(Main.GlobalTimeWrappedHourly * 36f); - - if (ExplodeTimer > 0f) - { - float scaleLevel = PiecewiseAnimation(ExplodeTimer / ExplosionLifetime, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); - Projectile.scale = MathHelper.Lerp(1f, MaxScale, scaleLevel); - Projectile.Opacity = MathF.Sin(MathHelper.PiOver2 + MathHelper.PiOver2 * ExplodeTimer / ExplosionLifetime); - - if (ExplodeTimer == 1f) - { - SoundEngine.PlaySound(ExplosionSound, Projectile.Center); - - for (int i = 0; i < 5; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * Main.rand.NextFloat(10f, 12f) * (i % 2 == 0 ? 0.88f : 1f); - Particle bub = new VelChangingSpark(Projectile.Center, velocity.RotatedByRandom(MathHelper.Pi / 10f), Vector2.UnitY * -6f, "CalamityMod/Particles/BloomRing", Main.rand.Next(36, 42 + 1), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, Vector2.One, shrinkSpeed: 0.08f); - GeneralParticleHandler.SpawnParticle(bub); - } - } - - if (ExplodeTimer == 6f) - { - for (int i = 0; i < 8; i++) - { - Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2.5f, 5.5f); - float smokeScale = Main.rand.NextFloat(1.6f, 2f); - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.PaleTurquoise, 18, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); - GeneralParticleHandler.SpawnParticle(smoke); - } - } - - ExplodeTimer++; - } - else if (DashTimer > 0f) - { - Owner.mount?.Dismount(Owner); - Owner.RemoveAllGrapplingHooks(); - - Owner.velocity = Projectile.velocity; - Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); - - // Move the player to the projectile, allowing them to bypass platforms (but not tiles) - Owner.Center = Projectile.Center; - - // Custom ram effect, similar to the one used in CalamityPlayerDashEffects - Rectangle hitArea = new Rectangle((int)(Owner.position.X + Owner.velocity.X * 0.5 - 4f), (int)(Owner.position.Y + Owner.velocity.Y * 0.5 - 4), Owner.width + 8, Owner.height + 8); - foreach (NPC n in Main.ActiveNPCs) - { - // Ignore critters with the Guide to Critter Companionship - if (Owner.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) - continue; - - if (!n.dontTakeDamage && !n.friendly && !NPCsHitBySlam.Contains(n.whoAmI)) - { - if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Owner.CanHit(n))) - { - Projectile.NewProjectile(Owner.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, n.whoAmI); - Owner.GiveImmuneTimeForCollisionAttack(DashSlamIFrames); - NPCsHitBySlam.Add(n.whoAmI); - } - } - } - - // Dash trail effects - Color trailColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, DashTimer / DashLifetime); - if (DashTimer % 2f == 1f) - { - Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.5f, "CalamityMod/Particles/ForwardSmear", false, 12, 0.2f, trailColor, new Vector2(1f, Main.rand.NextFloat(1.2f, 1.35f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f)); - GeneralParticleHandler.SpawnParticle(trail); - } - for (int direction = -1; direction <= 1; direction += 2) - { - Vector2 sidePos = Projectile.Center - Projectile.velocity * 2f + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * direction) * Utils.Remap(DashTimer, 1f, DashLifetime, 48f, 24f); - Particle sideTrail = new CustomSpark(sidePos, Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 18, 0.3f, trailColor * 0.6f, new Vector2(1f, 2.5f), shrinkSpeed: 0.2f); - GeneralParticleHandler.SpawnParticle(sideTrail); - } - - DashTimer++; - } - else - { - // If the barrier set isn't on, unceremoniously disappear - if (!Owner.Calamity().victideBarrierSet || Owner.dead || !Owner.active) - { - Projectile.Kill(); - Owner.Calamity().victideBarrierHeal = 0; - return; - } - // Set to dash if cooldown is detected and also create an explosion in its place - if (Owner.HasCooldown(WardingWave.ID)) - { - DashTimer++; - Projectile.damage = (int)Owner.GetBestClassDamage().ApplyTo(VictideHeadBarrier.BarrierDamage); - Owner.Calamity().victideBarrierHeal = 0; - if (Projectile.owner == Main.myPlayer) - { - // Set dash velocity - Projectile.velocity = Owner.SafeDirectionTo(Main.MouseWorld) * DashSpeed; - Projectile.tileCollide = true; - - // Spawn explosion - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Vector2.Zero, Type, Projectile.damage, VictideHeadBarrier.BarrierExplosionKB, Projectile.owner, 1f); - } - } - - if (Owner.Calamity().victideBarrierHeal > 0) - { - HealTimer++; - if (HealTimer % VictideHeadBarrier.BarrierFramesPerHeal == VictideHeadBarrier.BarrierFramesPerHeal - 1) - { - Owner.Calamity().victideBarrierHeal--; - Owner.HealPlayer(1); - } - } - else - HealTimer = 0f; - - Lighting.AddLight(Owner.MountedCenter, Color.White.ToVector3() * 0.5f); - Projectile.Center = Owner.MountedCenter; - Projectile.timeLeft = (int)DashLifetime; - } - } - - public override void OnKill(int timeLeft) - { - if (DashTimer > 0f) - Owner.velocity *= 0.5f; - } - - // Explosion collision only (dash has a custom ram logic check effect) - public override bool? CanDamage() => ExplodeTimer > 0f ? null : false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f * Projectile.scale, targetHitbox); - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); - modifiers.SourceDamage *= Utils.Remap(Projectile.numHits, 0, 10, 1f, 0.1f, true); - } - - public override bool PreDraw(ref Color lightColor) - { - if (DashTimer > 0f) - return false; - - Texture2D explosionTex = Explosion.Value; - Color barrierColor = Main.hslToRgb(0.6f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); - - if (ExplodeTimer > 0f) - { - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Vector2 explosionPos = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(explosionTex, explosionPos, null, barrierColor * Projectile.Opacity, Projectile.rotation, explosionTex.Size() * 0.5f, 0.02f * Projectile.scale, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - return false; - } - - Vector2 drawPos = Owner.Center + Vector2.UnitY * Owner.gfxOffY - Main.screenPosition; - Texture2D circleBase = TextureAssets.Projectile[Type].Value; - Color contrastingColor = Main.hslToRgb(0.6f + 0.1f * MathF.Cos(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); - - // Silly solution to making a clean circle over the player - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.5f); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(barrierColor); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Transparent); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(0f); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply(); - - Main.EntitySpriteDraw(circleBase, drawPos, null, Color.White, 0f, circleBase.Size() * 0.5f, 80f, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - - // Give it additional texture - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Main.EntitySpriteDraw(explosionTex, drawPos, null, contrastingColor * 0.3f, Projectile.rotation, explosionTex.Size() * 0.5f, 0.04f, SpriteEffects.None); - Texture2D shineTex = Shine.Value; - Main.EntitySpriteDraw(shineTex, drawPos, null, Color.HotPink * 0.5f, MathHelper.ToRadians(36f), shineTex.Size() * 0.5f, 0.45f, SpriteEffects.None); - Main.EntitySpriteDraw(shineTex, drawPos, null, Color.Orange * 0.3f, MathHelper.ToRadians(216f), shineTex.Size() * 0.5f, 0.55f, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - return false; - } - } -} diff --git a/Projectiles/Typeless/VictideBobber.cs b/Projectiles/Typeless/VictideBobber.cs deleted file mode 100644 index c8584dae10..0000000000 --- a/Projectiles/Typeless/VictideBobber.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using CalamityMod.Items.SummonItems; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VictideBobber : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/Summon/CnidarianJellyfishOnTheString"; - - public static int ReelChancePerFrame = 100; - - public Player Owner => Main.player[Projectile.owner]; - public ref float ParentProjectile => ref Projectile.ai[2]; - public Projectile Parent => Main.projectile[(int)ParentProjectile]; - - public int stuckTimer; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Bobber; - Projectile.bobber = true; - } - - public override bool PreAI() - { - // Snap if the snail is shelled, or just nowhere to be found - if (!Parent.active || Owner.HeldItem.fishingPole <= 0 || Parent == null || Parent.frame < 6) - { - Projectile.Kill(); - return false; - } - return true; - } - - public override void AI() - { - // Automatic reeling - if (Projectile.ai[0] == 0f && Projectile.ai[1] < 0f && Main.rand.NextBool(ReelChancePerFrame)) - { - Projectile.ai[0] = 1f; - Projectile.localAI[0] = 1f; - - // Consume bait as needed - int baitType = Owner.GetFishingConditions().BaitItemType; - int baitSlot = GetBaitSlot(Owner, baitType); - if (baitSlot != -1) - { - Item currentBait = Owner.inventory[baitSlot]; - bool consume = false; - - if (baitType == ItemID.TruffleWorm) - consume = true; - else if (baitType == ItemID.GoldWorm) - consume = Main.rand.NextBool(20); - else - { - float chanceMult = MathF.Max(1f, 1f + currentBait.bait / 6f); - if (Owner.accTackleBox) - chanceMult += 1f; - if (Main.rand.NextFloat() * chanceMult < 1f) - consume = true; - - // Junk (or Quest fish) default to no bait consumption - if (Projectile.localAI[1] > 0f) - { - Item dummyCatch = new Item(); - dummyCatch.SetDefaults((int)Projectile.localAI[1]); - if (dummyCatch.rare < ItemRarityID.White) - consume = false; - } - } - if (CombinedHooks.CanConsumeBait(Owner, currentBait).GetValueOrDefault(consume)) - { - if (currentBait.type == ItemID.LadyBug || currentBait.type == ItemID.GoldLadyBug) - NPC.LadyBugKilled(Owner.Center, currentBait.type == ItemID.GoldLadyBug); - - currentBait.stack--; - if (currentBait.stack <= 0) - currentBait.SetDefaults(); - } - } - - // Summon Duke Fishron as this code otherwise only runs on player rod usage - if (baitType == ItemID.TruffleWorm) - { - Projectile.ai[0] = 2f; - CalamityUtils.SpawnBossUsingItem(Owner, NPCID.DukeFishron); - } - // Line snapping behaviour - else if (!Owner.accFishingLine && Main.rand.NextBool(7)) - Projectile.ai[0] = 2f; - // Return back items - else if (Projectile.localAI[1] > 0f) - { - Projectile.ai[1] = Projectile.localAI[1]; - Projectile.localAI[1] = 0f; - } - // Spawn enemies - else if (Projectile.localAI[1] < 0f) - { - int spawnType = (int)(-Projectile.localAI[1]); - Point spawnPos = new Point((int)Projectile.position.X, (int)Projectile.position.Y); - if (spawnType == NPCID.BloodNautilus) - spawnPos.Y += 64; - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.FishOutNPC, -1, -1, null, spawnPos.X / 16, spawnPos.Y / 16, spawnType); - else - { - Projectile.ai[0] = 2f; - NPC.NewNPC(new EntitySource_FishedOut(Owner), spawnPos.X, spawnPos.Y, spawnType); - - if (spawnType == NPCID.TownSlimeRed) - NPC.unlockedSlimeRedSpawn = true; - WorldGen.CheckAchievement_RealEstateAndTownSlimes(); - } - } - } - - // Anti-stuck auto reelback - if (Projectile.ai[0] == 0f && Projectile.localAI[1] == 0f && Projectile.velocity.Length() <= 0.2f) - { - stuckTimer++; - if (stuckTimer > 60) - Projectile.ai[0] = 1f; - } - } - - public static int GetBaitSlot(Player owner, int baitType) - { - // Ignore Bloodworm as the Old Duke summon method already manually consumes it - if (baitType == ModContent.ItemType()) - return -1; - - // Check ammo slots first - for (int i = 54; i < Main.InventorySlotsTotal; i++) - { - if (owner.inventory[i].type == baitType) - return i; - } - for (int j = 0; j < 54; j++) - { - if (owner.inventory[j].type == baitType) - return j; - } - return -1; - } - - // Anchor the bobber to the parent projectile, since the default is bound to the player - // Yes. This method is obsolete. No, there is no other way and I won't make another IL edit to remedy this fact. - Iris - public override void ModifyFishingLine(ref Vector2 lineOriginOffset, ref Color lineColor) - { - lineColor = Color.Cyan; - if (Parent.active) - { - Vector2 originalPos = Owner.MountedCenter + Vector2.UnitY * (Owner.gfxOffY - (Owner.gravDir == -1 ? 12f : 0f)); - lineOriginOffset = Parent.Center - originalPos + Vector2.UnitY * 13f; - - // How this is a thing is beyond me - lineOriginOffset.X -= 2f; - if (Owner.direction < 0) - lineOriginOffset.X += (Owner.MountedCenter.X - Parent.Center.X) * 2f; - } - } - - public override bool PreDrawExtras() - { - Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.2f); - return true; - } - } -} diff --git a/Projectiles/Typeless/VictideSeaSnail.cs b/Projectiles/Typeless/VictideSeaSnail.cs deleted file mode 100644 index 3b8f61194e..0000000000 --- a/Projectiles/Typeless/VictideSeaSnail.cs +++ /dev/null @@ -1,264 +0,0 @@ -using System; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Weapons.Summon; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VictideSeaSnail : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public ref float DustTimer => ref Projectile.localAI[0]; - public ref float CollisionTimer => ref Projectile.ai[0]; - public ref float PlayerStandStillTimer => ref Projectile.ai[1]; - public ref float PlayerFishingTimer => ref Projectile.ai[2]; - - public const int FrameTime = 6; // Switches frame every 6 frames (10 FPS) - public const int PeekCooldown = 150; - - public Player Owner => Main.player[Projectile.owner]; - public CalamityPlayer ModdedOwner => Owner.Calamity(); - - // Extra requirements so you don't break the bobber, or snail, or how would you fish underwater?? - public bool StandingStill => Owner.velocity.Length() == 0 && !Owner.pulley && !Owner.mount.Active && !Collision.DrownCollision(Owner.position, Owner.width, Owner.height, Owner.gravDir); - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = 38; - Projectile.height = 34; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - } - - public override void AI() - { - if (!ModdedOwner.victideSnailSet) - { - for (int d = 0; d < 25; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - Projectile.active = false; - return; - } - - if (Owner.dead) - ModdedOwner.victideSnail = false; - - if (ModdedOwner.victideSnail) - Projectile.timeLeft = 2; - - //Create a burst of dust as it gets created, teleported, or popped out - DustTimer++; - if (DustTimer <= 3) - { - for (int d = 0; d < 25; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - } - - // Small amount of light - Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0.5f); - - if (StandingStill) - { - PlayerStandStillTimer++; - if (PlayerStandStillTimer >= PeekCooldown) - { - // Pop out the shell when ready. This give a slight velocity boost outwards - if (PlayerStandStillTimer == PeekCooldown) - { - DustTimer = 0f; - Projectile.velocity = new Vector2(Main.rand.NextFloat(2f, 3.6f) * Owner.direction, Main.rand.NextFloat(-4f, 0f)); - } - - // Fall down into position - Projectile.velocity *= 0.98f; - Projectile.velocity.X *= 0.9f; - Projectile.velocity.Y = Math.Min(Projectile.velocity.Y + 0.1f, 14f); - Projectile.tileCollide = true; - - bool? collide = CollidingWithLiquidOrPlatform(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - if (collide.HasValue) - { - CollisionTimer++; - // Bobs up and down if collided with liquids - Projectile.velocity.Y = collide.Value ? MathF.Sin(CollisionTimer * 0.05f) * 0.25f : 0f; - } - - Projectile.rotation = Projectile.rotation.AngleTowards(0, MathHelper.PiOver4 * 0.14f); - - if (CollisionTimer > 0f) - { - Projectile.frameCounter++; - if (Projectile.frameCounter >= FrameTime) - { - Projectile.frameCounter = 0; - Projectile.frame = Math.Min(6, Projectile.frame + 1); - } - } - } - else // keep this guy spinnin' - Projectile.rotation += MathHelper.PiOver4 * 0.2f; - } - else - { - // Slowly puts its head back into shell - if (Projectile.frame > 0) - { - Projectile.frameCounter++; - if (Projectile.frameCounter >= FrameTime) - { - Projectile.frameCounter = 0; - Projectile.frame--; - } - - if (Projectile.frame == 0) - { - CollisionTimer = 0f; - PlayerStandStillTimer = 0f; - PlayerFishingTimer = 0f; - } - } - // Return to resting position once shelled again - else - { - Projectile.velocity = Vector2.Zero; - Projectile.tileCollide = false; - - Vector2 desiredPosition = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 60f) * Owner.gravDir; - //Round the result so it doesn't jitter. - desiredPosition = new Vector2((int)desiredPosition.X, (int)desiredPosition.Y); - Projectile.Center = Projectile.Center.MoveTowards(desiredPosition, 7f + Owner.velocity.Length()); - Projectile.rotation += MathHelper.PiOver4 * 0.2f; - } - } - - // Teleport and reset everything if too far away (this range is deliberately very short) - if (Vector2.Distance(Projectile.Center, Owner.Center) > 240f) - { - Projectile.Center = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 60f) * Owner.gravDir; - DustTimer = 0f; - CollisionTimer = 0f; - PlayerStandStillTimer = 0f; - PlayerFishingTimer = 0f; - Projectile.frame = 0; - return; - } - - // Only does fishing stuff when it's fully popped out - if (Projectile.frame == 6) - { - // Give the player a grace period upon any input with the fishing rod - // This means you can't just AFK with the fishing rod held - if (Owner.itemAnimation > 0 && Owner.HeldItem.fishingPole > 0) - PlayerFishingTimer = 600f; - else - PlayerFishingTimer = Math.Max(PlayerFishingTimer -1f, 0f); - - // Automatically casts bobbers one at a time - // This casts the same way the pole does to prevent position variance - int bobberType = ModContent.ProjectileType(); - if (Owner.ownedProjectileCounts[bobberType] < 1 && Owner.HeldItem.fishingPole > 0 && Projectile.owner == Main.myPlayer && PlayerFishingTimer > 0f) - { - SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); - - Vector2 velocity = Owner.SafeDirectionTo(Main.MouseWorld) * Owner.HeldItem.shootSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, bobberType, 0, 0f, Projectile.owner, ai2: Projectile.whoAmI); - } - } - } - - public static bool? CollidingWithLiquidOrPlatform(Vector2 Position, Vector2 Velocity, int Width, int Height) - { - Rectangle Hitbox = new Rectangle((int)Position.X, (int)Position.Y, Width, Height); - Rectangle ProjectedHitbox = new Rectangle((int)(Position.X + Velocity.X), (int)(Position.Y + Velocity.Y), Width, Height); - - int xMin = Utils.Clamp((int)(Position.X / 16f) - 1, 0, Main.maxTilesX - 1); - int xMax = Utils.Clamp((int)((Position.X + (float)Width) / 16f) + 2, 0, Main.maxTilesX - 1); - int yMin = Utils.Clamp((int)(Position.Y / 16f) - 1, 0, Main.maxTilesY - 1); - int yMax = Utils.Clamp((int)((Position.Y + (float)Height) / 16f) + 2, 0, Main.maxTilesY - 1); - for (int i = xMin; i < xMax; i++) - { - for (int j = yMin; j < yMax; j++) - { - Tile tile = Main.tile[i, j]; - if (tile == null) - return null; - - if (tile.HasTile && (Main.tileSolid[tile.TileType] || Main.tileSolidTop[tile.TileType])) - { - Rectangle Target = new Rectangle(i * 16, j * 16 , 16, 16); - if (Hitbox.Intersects(Target) || ProjectedHitbox.Intersects(Target)) - return false; - } - if (tile.LiquidAmount > 0 && !tile.HasTile) - { - float LiquidDepth = (256 - tile.LiquidAmount) / 16f; - Rectangle Target = new Rectangle(i * 16, j * 16 + (int)LiquidDepth, 16, 16 - (int)LiquidDepth); - if (Hitbox.Intersects(Target)) - return true; - } - } - } - return null; - } - - public override bool? CanDamage() => false; - - public override void OnKill(int timeLeft) - { - for (int d = 0; d < 45; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - // Touches the ground - if (oldVelocity.Y >= 0) - CollisionTimer = 1f; - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - bool CanPeekOut = PlayerStandStillTimer >= PeekCooldown || Projectile.frame > 0; - Vector2 origin = !CanPeekOut ? new Vector2(15, 23) : frame.Size() * 0.5f; - - // Look at the player's direction - SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.EntitySpriteDraw(tex, Projectile.Center + Vector2.UnitY * 2f - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, flip); - - // Fisbing Rod,,. - if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - Texture2D rod = Terraria.GameContent.TextureAssets.Item[ModContent.ItemType()].Value; - Main.EntitySpriteDraw(rod, Projectile.Center - Main.screenPosition + Vector2.UnitX * Owner.direction * 30f, null, lightColor, 0f, rod.Size() * 0.5f, Projectile.scale, flip); - } - return false; - } - } -} diff --git a/Projectiles/Typeless/VictideSpirit.cs b/Projectiles/Typeless/VictideSpirit.cs deleted file mode 100644 index ee52eb2487..0000000000 --- a/Projectiles/Typeless/VictideSpirit.cs +++ /dev/null @@ -1,348 +0,0 @@ -using CalamityMod.Cooldowns; -using CalamityMod.Dusts; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VictideSpirit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[Projectile.owner]; - - public static Asset SpiritGlow; - - public ref float SubmergedTimer => ref Projectile.ai[0]; - public ref float DustCounter => ref Projectile.ai[1]; - - public override void Load() => SpiritGlow = ModContent.Request("CalamityMod/Particles/BloomCircle"); - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 42; - Projectile.friendly = true; - Projectile.tileCollide = false; - } - - public override void OnSpawn(IEntitySource source) - { - Projectile.rotation = MathHelper.PiOver2; - for (int i = 0; i < Projectile.oldPos.Length; i++) - Projectile.oldRot[i] = MathHelper.PiOver2; - - for (int i = 0; i < 3; i++) - { - Color squareColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, i * 0.5f) * 0.6f; - float squareScale = 0.6f + i * 0.2f; - float squareRot = (i % 2 == 0 ? MathHelper.PiOver4 : 0f); - Particle square = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 18, squareScale, squareColor, Vector2.One, true, true, squareRot, true, glowOpacity: 0.5f, glowCenterScale: squareScale * 1.15f); - GeneralParticleHandler.SpawnParticle(square); - } - } - - public override void AI() - { - if (Main.myPlayer == Projectile.owner) - { - // Validate existence - bool hasCD = Owner.Calamity().cooldowns.TryGetValue(BubblyBurrow.ID, out CooldownInstance cd); - if (!hasCD) - { - Owner.AddCooldown(BubblyBurrow.ID, VictideHeadBurrow.BurrowCooldown); - Projectile.Kill(); - return; - } - else if (!Owner.Calamity().victideBurrowSet) - { - cd.timeLeft = VictideHeadBurrow.BurrowCooldown; - Projectile.Kill(); - return; - } - else if (cd.timeLeft <= VictideHeadBurrow.BurrowCooldown) - { - Projectile.Kill(); - return; - } - // Shimmer interaction (Immediately ends if Chromatic Cloak isn't active) - else if (Owner.shimmering) - { - cd.timeLeft = VictideHeadBurrow.BurrowCooldown; - Projectile.Kill(); - return; - } - Projectile.timeLeft = cd.timeLeft - VictideHeadBurrow.BurrowCooldown; - - #region Movement and Controls - float MaxSpeed = Collision.DrownCollision(Projectile.Center - Vector2.One, 2, 2, Owner.gravDir) ? VictideHeadBurrow.SubmergedBurrowSpeed : VictideHeadBurrow.BaseBurrowSpeed; - // Controlling both opposite movement keys brings you to a near immediate stop (faster deceleration than just releasing both buttons) - // Turnaround acceleration is also twice as fast to aid smoothness of movement - if (Owner.controlLeft && Owner.controlRight) - Projectile.velocity.X *= 0.7f; - else if (Owner.controlLeft) - { - if (Projectile.velocity.X < -MaxSpeed) - { - Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, MaxSpeed, 0.05f); - if (Projectile.velocity.X > -MaxSpeed - 0.01f) - Projectile.velocity.X = -MaxSpeed; - } - else if (Projectile.velocity.X > 0f) - Projectile.velocity.X -= VictideHeadBurrow.BaseAcceleration * 2f; - else - Projectile.velocity.X = MathF.Max(Projectile.velocity.X - VictideHeadBurrow.BaseAcceleration, -MaxSpeed); - } - else if (Owner.controlRight) - { - if (Projectile.velocity.X > MaxSpeed) - { - Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, MaxSpeed, 0.05f); - if (Projectile.velocity.X < MaxSpeed + 0.01f) - Projectile.velocity.X = MaxSpeed; - } - else if (Projectile.velocity.X < 0f) - Projectile.velocity.X += VictideHeadBurrow.BaseAcceleration * 2f; - else - Projectile.velocity.X = MathF.Min(Projectile.velocity.X + VictideHeadBurrow.BaseAcceleration, MaxSpeed); - } - else - Projectile.velocity.X *= 0.92f; - - if ((Owner.controlUp || Owner.controlJump) && Owner.controlDown) - Projectile.velocity.Y *= 0.7f; - else if (Owner.controlUp || Owner.controlJump) - { - if (Projectile.velocity.Y < -MaxSpeed) - { - Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, MaxSpeed, 0.05f); - if (Projectile.velocity.Y > -MaxSpeed - 0.01f) - Projectile.velocity.Y = -MaxSpeed; - } - else if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y -= VictideHeadBurrow.BaseAcceleration * 2f; - else - Projectile.velocity.Y = MathF.Max(Projectile.velocity.Y - VictideHeadBurrow.BaseAcceleration, -MaxSpeed); - } - else if (Owner.controlDown) - { - if (Projectile.velocity.Y > MaxSpeed) - { - Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, MaxSpeed, 0.05f); - if (Projectile.velocity.Y < MaxSpeed + 0.01f) - Projectile.velocity.Y = MaxSpeed; - } - else if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y += VictideHeadBurrow.BaseAcceleration * 2f; - else - Projectile.velocity.Y = MathF.Min(Projectile.velocity.Y + VictideHeadBurrow.BaseAcceleration, MaxSpeed); - } - else - Projectile.velocity.Y *= 0.92f; - - // Interrupt movement if burrowing into a solid tile unable to be broken by the player by any means - int LeftRange = Utils.Clamp((int)(Projectile.position.X + Projectile.velocity.X) / 16, 2, Main.maxTilesX - 2); - int RightRange = Utils.Clamp((int)(Projectile.position.X + Projectile.velocity.X) / 16 + 1, 2, Main.maxTilesX - 2); - int TopRange = Utils.Clamp((int)(Projectile.position.Y + Projectile.velocity.Y) / 16, 2, Main.maxTilesY - 2); - int BottomRange = Utils.Clamp((int)(Projectile.position.Y + Projectile.velocity.Y) / 16 + 2, 2, Main.maxTilesY - 2); - bool stop = false; - for (int i = LeftRange; i <= RightRange; i++) - { - if (stop) - break; - - for (int j = TopRange; j <= BottomRange; j++) - { - Tile tile = Main.tile[i, j]; - if (!tile.HasTile || !Main.tileSolid[tile.TileType]) - continue; - - bool breakable = WorldGen.CanKillTile(i, j) && tile.ShouldBeMined(); - if (breakable && Owner.GetBestPickPower() >= tile.GetRequiredPickPower(i, j)) - continue; - - stop = true; - break; - } - } - if (stop) - Projectile.velocity *= 0.1f; - - // Rotation is less sudden so that the visuals are smoother -- velocity is not affected so that it also plays natural - float idealRotation = (Projectile.velocity.Length() == 0f ? MathHelper.PiOver2 : Projectile.velocity.ToRotation()); - if (MathF.Abs(idealRotation - Projectile.rotation) < MathHelper.ToRadians(1f) || MathF.Abs(idealRotation - Projectile.rotation) > MathHelper.ToRadians(90f)) - Projectile.rotation = idealRotation; - else - Projectile.rotation = MathHelper.Lerp(Projectile.rotation, idealRotation, 0.25f); - #endregion - - #region Player Manipulation - // Actively remove mounts and hooks from the player - Owner.mount?.Dismount(Owner); - Owner.RemoveAllGrapplingHooks(); - - // Give immunity frames and kill suffocation - Owner.suffocateDelay = 0; - Owner.immune = true; - Owner.immuneNoBlink = true; - Owner.immuneTime = 4; - for (int k = 0; k < Owner.hurtCooldowns.Length; k++) - { - // Excluded explicitly-anti cheesed bosses - if (k == ImmunityCooldownID.Bosses) - continue; - - Owner.hurtCooldowns[k] = Owner.immuneTime; - } - - Owner.velocity = Projectile.velocity; - if (Owner.velocity.Y == 0f) - Owner.velocity.Y += 0.00001f; // Prevent sprint particles from appearing - Owner.ChangeDir((Projectile.velocity.X > 0).ToDirectionInt()); - Projectile.direction = Owner.direction; - - // Move the player to the projectile, allowing them to bypass all tiles - Owner.Center = Projectile.Center; - #endregion - } - - #region Visual and Sound Effects - if (Collision.DrownCollision(Projectile.Center - Vector2.One, 2, 2, Owner.gravDir)) - SubmergedTimer++; - else - SubmergedTimer = 0f; - - Color BubblyBlue = new Color(97, 200, 255); - Vector2 headPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 8f; - Lighting.AddLight(headPosition, BubblyBlue.ToVector3() * Projectile.Opacity * (0.5f + 0.3f * Utils.GetLerpValue(0f, 60f, SubmergedTimer, true))); - - if (SubmergedTimer == 1f) - { - Particle ring = new DirectionalPulseRing(headPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 0.4f, BubblyBlue, new Vector2(0.5f, 1f), Projectile.rotation, 0.95f, 0f, 30); - GeneralParticleHandler.SpawnParticle(ring); - } - - float lifetimeRatio = Projectile.timeLeft / (float)VictideHeadBurrow.BurrowCooldown; - if (Projectile.soundDelay <= 0) - { - Projectile.soundDelay = Main.rand.Next(20, 36) + (int)(lifetimeRatio * 30); - SoundEngine.PlaySound(Main.rand.NextBool() ? SoundID.ShimmerWeak1 : SoundID.ShimmerWeak2, Projectile.Center); - } - - if ((Main.rand.NextBool(4) || Projectile.velocity.Length() > 0.25f) && SubmergedTimer == 0f) - { - Particle foam = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.7f, "CalamityMod/Particles/WaterFoam", false, 9, 0.25f, Color.DeepSkyBlue, Vector2.One, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi), shrinkSpeed: 1f); - GeneralParticleHandler.SpawnParticle(foam); - } - - DustCounter += Utils.Remap(Projectile.velocity.Length(), 0f, VictideHeadBurrow.BaseBurrowSpeed, 1f, 3f, true); - if (DustCounter >= 15f) - { - DustCounter = 0f; - for (int i = 0; i < 2; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(-4.8f, -6f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.65f, 0.8f); - dust.color = Color.White; - dust.noLightEmittence = true; - } - } - #endregion - } - - public float JetstreamWidthFunction(float completionRatio, Vector2 vertexPos) => Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * 3f; - public float SpiritWidthFunction(float completionRatio, Vector2 vertexPos) => MathF.Min(MathHelper.SmoothStep(64f, 8f, completionRatio), Utils.GetLerpValue(0f, 0.15f, completionRatio, true) * 60f); - - public Color InnerJetstreamColorFunction(float completionRatio, Vector2 vertexPos) => Color.Lerp(Color.CornflowerBlue, new Color(169, 100, 237), MathF.Pow(completionRatio, 2.5f)) * Utils.GetLerpValue(1f, 0.6f, completionRatio, true) * 0.5f; - public Color OuterJetstreamColorFunction(float completionRatio, Vector2 vertexPos) => Color.Lerp(Color.CornflowerBlue, new Color(100, 237, 237), MathF.Pow(completionRatio, 2.5f)) * Utils.GetLerpValue(1f, 0.6f, completionRatio, true) * 0.2f; - public Color SpiritColorFunction(float completionRatio, Vector2 vertexPos) => Color.Lerp(Color.Lerp(Color.White, Color.Cyan, 0.4f + completionRatio), Color.RoyalBlue, completionRatio) * Utils.GetLerpValue(0.8f, 0.54f, completionRatio, true); - - public override bool PreDraw(ref Color lightColor) - { - // Jetstream trails - for (int direction = -1; direction <= 1; direction += 2) - { - List trailPositionsInner = new List(); - List trailPositionsOuter = new List(); - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float mergeFactor = Utils.Remap(i, 0f, 8f, 0f, 1f, true); - - Vector2 trailPosInner = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * i * 8f; - float spreadLengthInner = 20f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f); - Vector2 sinOffsetInner = (Vector2.UnitY * direction * MathF.Sin(i * MathHelper.Pi * 0.125f) * spreadLengthInner * mergeFactor).RotatedBy(Projectile.oldRot[i]); - trailPositionsInner.Add(trailPosInner + sinOffsetInner); - - Vector2 trailPosOuter = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * i * 12f; - float spreadLengthOuter = 32f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f); - Vector2 sinOffsetOuter = (Vector2.UnitY * direction * (6f + MathF.Sin(i * MathHelper.Pi * 0.035f) * spreadLengthOuter * mergeFactor)).RotatedBy(Projectile.oldRot[i]); - trailPositionsOuter.Add(trailPosOuter + sinOffsetOuter); - } - - PrimitiveRenderer.RenderTrail(trailPositionsInner, new(JetstreamWidthFunction, InnerJetstreamColorFunction), 20); - PrimitiveRenderer.RenderTrail(trailPositionsOuter, new(JetstreamWidthFunction, OuterJetstreamColorFunction), 20); - } - - // Oops all trails? - List spiritBodyPositions = new List(); - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - // 3 segments ahead so that it's a little offset forward - Vector2 spiritPos = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * (i - 3) * 8f; - spiritBodyPositions.Add(spiritPos); - } - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); - PrimitiveRenderer.RenderTrail(spiritBodyPositions, new(SpiritWidthFunction, SpiritColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 60); - - // Glow pulses when the ability is about to run out - if (Projectile.timeLeft < 180) - { - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Texture2D glow = SpiritGlow.Value; - Vector2 drawPos = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Color glowColor = new Color(255, 170, 204) * (0.2f * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.25f) + Utils.Remap(Projectile.timeLeft, 180f, 0f, 0.2f, 0.6f, true)); - Main.EntitySpriteDraw(glow, drawPos, null, glowColor, Projectile.rotation, glow.Size() * 0.5f, new Vector2(0.6f, 0.5f), SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - } - return false; - } - - public override bool? CanDamage() => false; - - public override void OnKill(int timeLeft) - { - Owner.velocity *= 0.8f; - Owner.fullRotation = 0f; - Owner.fallStart = (int)(Owner.position.Y / 16f); // Triangle getting hit with the wrath of 2000 fall damage - - SoundEngine.PlaySound(SoundID.Drown, Projectile.Center); - for (int i = 0; i < 3; i++) - { - Color squareColor = Color.Lerp(Color.Cyan, new Color(255, 170, 204), i * 0.5f) * 0.6f; - float squareScale = 0.6f + i * 0.2f; - float squareRot = (i % 2 == 0 ? MathHelper.PiOver4 : 0f); - Particle square = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 18, squareScale, squareColor, Vector2.One, true, true, squareRot, true, glowOpacity: 0.5f, glowCenterScale: squareScale * 1.15f); - GeneralParticleHandler.SpawnParticle(square); - } - } - } -} diff --git a/README.md b/README.md index 694b01251b..42f8aa8f4d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ The Calamity Mod is a vast content mod for Terraria which adds dozens of bosses and thousands of items to create an intense and varied experience. The mod must be installed using [tModLoader](https://github.com/tModLoader/tModLoader). +The Calamity Mod and all associated source code, visual assets, audio assets, characters, names, logos, trademarks, branding, and related materials are proprietary to Azafure, LLC, a Virginia limited liability company (*"Azafure"*), and are protected by applicable intellectual property laws. All rights reserved. Except for the limited permission necessary to access and contribute to the repository in accordance with Azafure's License terms (*see* `LICENSE.md` *in the License tab above*), nothing in this Page or the License terms grants any license, permission, or ownership interest in or to Azafure's intellectual property. + **Note:** This repository contains only the latest public release of the Calamity Mod and any public contributions made since then. Active development by Calamity developers occurs on a separate, private repository. Contributions made here will be cherry picked into that repository. When an update is released to the Steam Workshop, the `1.4.4-release` branch is replaced with the matching branch from the private repository. @@ -16,4 +18,4 @@ Issues are disabled on this repository. To report a bug, please join the [Calami Please do not submit resprites via pull requests. Instead, go to the [Calamity Art Discord](https://discord.gg/CKByxd5) and use the Asset Submission system if you want to propose a resprite for Calamity. -**Do not redistribute the Calamity Mod.** Creating your own builds of the mod from an in-development sourcetree will cause confusion in the community and will make players' mods fail to sync in multiplayer. We will take down any copies of the Calamity Mod published to Steam Workshop or rehosted elsewhere, and reserve the right to take legal action as we see fit. \ No newline at end of file +**Do not redistribute the Calamity Mod.** Creating your own builds of the mod from an in-development sourcetree may cause confusion in the community and make players' mods fail to sync in multiplayer. Azafure will remove any unauthorized copies of the Calamity Mod published to the Steam Workshop or rehosted elsewhere, and reserves all rights and remedies available to Azafure. \ No newline at end of file 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..83bad91d2c 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -13,18 +13,19 @@ 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() { int provIndex = CalamityGlobalNPC.holyBoss; - if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active) + if (!Main.npc.IndexInRange(provIndex)) return -1f; var prov = Main.npc[provIndex]; diff --git a/Scenes/MusicScenes/TheConcoctionMusicScene.cs b/Scenes/MusicScenes/TheConcoctionMusicScene.cs new file mode 100644 index 0000000000..45079987e4 --- /dev/null +++ b/Scenes/MusicScenes/TheConcoctionMusicScene.cs @@ -0,0 +1,18 @@ +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Scenes.MusicScenes +{ + public class TheConcoctionMusicScene : ModSceneEffect + { + public override bool IsSceneEffectActive(Player player) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + return (concoctionPlayer.swinesWrathCounter <= 600 && concoctionPlayer.swinesWrathCounter != -1); + } + public override int Music => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + } +} diff --git a/Schematics/Barbed_Stockade1.csch b/Schematics/Barbed_Stockade1.csch deleted file mode 100644 index 9d07e3aec6..0000000000 Binary files a/Schematics/Barbed_Stockade1.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade2.csch b/Schematics/Barbed_Stockade2.csch deleted file mode 100644 index c21b797d8a..0000000000 Binary files a/Schematics/Barbed_Stockade2.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade3.csch b/Schematics/Barbed_Stockade3.csch deleted file mode 100644 index eae4b2cb42..0000000000 Binary files a/Schematics/Barbed_Stockade3.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade4.csch b/Schematics/Barbed_Stockade4.csch deleted file mode 100644 index a49e0c86d5..0000000000 Binary files a/Schematics/Barbed_Stockade4.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache1.csch b/Schematics/Bonescrapper_Cache1.csch deleted file mode 100644 index d5411fa3e7..0000000000 Binary files a/Schematics/Bonescrapper_Cache1.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache2.csch b/Schematics/Bonescrapper_Cache2.csch deleted file mode 100644 index 1145d46c6e..0000000000 Binary files a/Schematics/Bonescrapper_Cache2.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache3.csch b/Schematics/Bonescrapper_Cache3.csch deleted file mode 100644 index cb90d99889..0000000000 Binary files a/Schematics/Bonescrapper_Cache3.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache4.csch b/Schematics/Bonescrapper_Cache4.csch deleted file mode 100644 index 21fa20a226..0000000000 Binary files a/Schematics/Bonescrapper_Cache4.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache5.csch b/Schematics/Bonescrapper_Cache5.csch deleted file mode 100644 index 09a4f5d4fa..0000000000 Binary files a/Schematics/Bonescrapper_Cache5.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache6.csch b/Schematics/Bonescrapper_Cache6.csch deleted file mode 100644 index 76ecd82c41..0000000000 Binary files a/Schematics/Bonescrapper_Cache6.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium1.csch b/Schematics/Brimstone_Atrium1.csch deleted file mode 100644 index 257b3872c6..0000000000 Binary files a/Schematics/Brimstone_Atrium1.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium2.csch b/Schematics/Brimstone_Atrium2.csch deleted file mode 100644 index a0b5250357..0000000000 Binary files a/Schematics/Brimstone_Atrium2.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium3.csch b/Schematics/Brimstone_Atrium3.csch deleted file mode 100644 index 258c97d742..0000000000 Binary files a/Schematics/Brimstone_Atrium3.csch and /dev/null differ diff --git a/Schematics/Demonic_Dungeon1.csch b/Schematics/Demonic_Dungeon1.csch deleted file mode 100644 index 7b7595096d..0000000000 Binary files a/Schematics/Demonic_Dungeon1.csch and /dev/null differ diff --git a/Schematics/Demonic_Dungeon2.csch b/Schematics/Demonic_Dungeon2.csch deleted file mode 100644 index c8116e9d3d..0000000000 Binary files a/Schematics/Demonic_Dungeon2.csch and /dev/null differ diff --git a/Schematics/Hellstone_Stronghold1.csch b/Schematics/Hellstone_Stronghold1.csch deleted file mode 100644 index f7a79c9c73..0000000000 Binary files a/Schematics/Hellstone_Stronghold1.csch and /dev/null differ diff --git a/Schematics/Hellstone_Stronghold2.csch b/Schematics/Hellstone_Stronghold2.csch deleted file mode 100644 index f05f1d9ef6..0000000000 Binary files a/Schematics/Hellstone_Stronghold2.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion1.csch b/Schematics/Sanctum_of_Oblivion1.csch deleted file mode 100644 index 1746bf4e6b..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion1.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion2.csch b/Schematics/Sanctum_of_Oblivion2.csch deleted file mode 100644 index 924291f7b7..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion2.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion3.csch b/Schematics/Sanctum_of_Oblivion3.csch deleted file mode 100644 index 13e833b9e2..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion3.csch and /dev/null differ diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 71c79ad915..7701418c8a 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -16,66 +16,6 @@ namespace CalamityMod.Schematics internal const string ShimmerShrineKey = "Shimmer Shrine Key"; internal const string ShimmerShrineFilename = "Schematics/Shimmer_Shrine.csch"; - internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key"; - internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch"; - - internal const string BrimstoneAtriumType2Key = "Brimstone Atrium Type 2 Key"; - internal const string BrimstoneAtriumType2Filename = "Schematics/Brimstone_Atrium2.csch"; - - internal const string BrimstoneAtriumType3Key = "Brimstone Atrium Type 3 Key"; - internal const string BrimstoneAtriumType3Filename = "Schematics/Brimstone_Atrium3.csch"; - - internal const string BonescrapperCacheType1Key = "Bonescrapper Cache Type 1 Key"; - internal const string BonescrapperCacheType1Filename = "Schematics/Bonescrapper_Cache1.csch"; - - internal const string BonescrapperCacheType2Key = "Bonescrapper Cache Type 2 Key"; - internal const string BonescrapperCacheType2Filename = "Schematics/Bonescrapper_Cache2.csch"; - - internal const string BonescrapperCacheType3Key = "Bonescrapper Cache Type 3 Key"; - internal const string BonescrapperCacheType3Filename = "Schematics/Bonescrapper_Cache3.csch"; - - internal const string BonescrapperCacheType4Key = "Bonescrapper Cache Type 4 Key"; - internal const string BonescrapperCacheType4Filename = "Schematics/Bonescrapper_Cache4.csch"; - - internal const string BonescrapperCacheType5Key = "Bonescrapper Cache Type 5 Key"; - internal const string BonescrapperCacheType5Filename = "Schematics/Bonescrapper_Cache5.csch"; - - internal const string BonescrapperCacheType6Key = "Bonescrapper Cache Type 6 Key"; - internal const string BonescrapperCacheType6Filename = "Schematics/Bonescrapper_Cache6.csch"; - - internal const string SanctumofOblivionType1Key = "Sanctum of Oblivion Type 1 Key"; - internal const string SanctumofOblivionType1Filename = "Schematics/Sanctum_of_Oblivion1.csch"; - - internal const string SanctumofOblivionType2Key = "Sanctum of Oblivion Type 2 Key"; - internal const string SanctumofOblivionType2Filename = "Schematics/Sanctum_of_Oblivion2.csch"; - - internal const string SanctumofOblivionType3Key = "Sanctum of Oblivion Type 3 Key"; - internal const string SanctumofOblivionType3Filename = "Schematics/Sanctum_of_Oblivion3.csch"; - - internal const string HellstoneStrongholdType1Key = "Hellstone Stronghold Type 1 Key"; - internal const string HellstoneStrongholdType1Filename = "Schematics/Hellstone_Stronghold1.csch"; - - internal const string HellstoneStrongholdType2Key = "Hellstone Stronghold Type 2 Key"; - internal const string HellstoneStrongholdType2Filename = "Schematics/Hellstone_Stronghold2.csch"; - - internal const string DemonicDungeonType1Key = "Demonic Dungeon Type 1 Key"; - internal const string DemonicDungeonType1Filename = "Schematics/Demonic_Dungeon1.csch"; - - internal const string DemonicDungeonType2Key = "Demonic Dungeon Type 2 Key"; - internal const string DemonicDungeonType2Filename = "Schematics/Demonic_Dungeon2.csch"; - - internal const string BarbedStockadeType1Key = "Barbed Stockade Type 1 Key"; - internal const string BarbedStockadeType1Filename = "Schematics/Barbed_Stockade1.csch"; - - internal const string BarbedStockadeType2Key = "Barbed Stockade Type 2 Key"; - internal const string BarbedStockadeType2Filename = "Schematics/Barbed_Stockade2.csch"; - - internal const string BarbedStockadeType3Key = "Barbed Stockade Type 3 Key"; - internal const string BarbedStockadeType3Filename = "Schematics/Barbed_Stockade3.csch"; - - internal const string BarbedStockadeType4Key = "Barbed Stockade Type 4 Key"; - internal const string BarbedStockadeType4Filename = "Schematics/Barbed_Stockade4.csch"; - internal const string RustedWorkshopKey = "Rusted Workshop"; internal const string RustedWorkshopFilename = "Schematics/RustedWorkshop.csch"; @@ -172,28 +112,6 @@ namespace CalamityMod.Schematics // Shimmer Shrine [ShimmerShrineKey] = CalamitySchematicIO.LoadSchematic(ShimmerShrineFilename), - // Underworld structures - [BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename), - [BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename), - [BrimstoneAtriumType3Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType3Filename), - [BonescrapperCacheType1Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType1Filename), - [BonescrapperCacheType2Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType2Filename), - [BonescrapperCacheType3Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType3Filename), - [BonescrapperCacheType4Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType4Filename), - [BonescrapperCacheType5Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType5Filename), - [BonescrapperCacheType6Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType6Filename), - [SanctumofOblivionType1Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType1Filename), - [SanctumofOblivionType2Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType2Filename), - [SanctumofOblivionType3Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType3Filename), - [HellstoneStrongholdType1Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType1Filename), - [HellstoneStrongholdType2Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType2Filename), - [DemonicDungeonType1Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType1Filename), - [DemonicDungeonType2Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType2Filename), - [BarbedStockadeType1Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType1Filename), - [BarbedStockadeType2Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType2Filename), - [BarbedStockadeType3Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType3Filename), - [BarbedStockadeType4Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType4Filename), - // Draedon's Arsenal world gen structures [RustedWorkshopKey] = CalamitySchematicIO.LoadSchematic(RustedWorkshopFilename), [ResearchOutpostKey] = CalamitySchematicIO.LoadSchematic(ResearchOutpostFilename), diff --git a/Sounds/Custom/BubbleCracklePop.ogg b/Sounds/Custom/BubbleCracklePop.ogg deleted file mode 100644 index f1f0f2deca..0000000000 Binary files a/Sounds/Custom/BubbleCracklePop.ogg and /dev/null differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg new file mode 100644 index 0000000000..5f3d4ce420 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg new file mode 100644 index 0000000000..5af604670c Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg new file mode 100644 index 0000000000..5080c3b101 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg new file mode 100644 index 0000000000..2e7fb5a471 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg new file mode 100644 index 0000000000..a195c3cc36 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg new file mode 100644 index 0000000000..6c0ad78480 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg new file mode 100644 index 0000000000..13b5108c9e Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg new file mode 100644 index 0000000000..d8ed0521be Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg new file mode 100644 index 0000000000..1425ea5cc8 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg b/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg new file mode 100644 index 0000000000..3f139a4bac Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogCackle.ogg b/Sounds/Custom/HorribleHog/HorribleHogCackle.ogg new file mode 100644 index 0000000000..0970efd21c Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogCackle.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogDiggingFast.ogg b/Sounds/Custom/HorribleHog/HorribleHogDiggingFast.ogg new file mode 100644 index 0000000000..25b91a680e Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogDiggingFast.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogDiggingSlow.ogg b/Sounds/Custom/HorribleHog/HorribleHogDiggingSlow.ogg new file mode 100644 index 0000000000..22ade083c5 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogDiggingSlow.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogGroundImpact1.ogg b/Sounds/Custom/HorribleHog/HorribleHogGroundImpact1.ogg new file mode 100644 index 0000000000..e303907f68 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogGroundImpact1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogGroundImpact2.ogg b/Sounds/Custom/HorribleHog/HorribleHogGroundImpact2.ogg new file mode 100644 index 0000000000..cbfb66e2fb Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogGroundImpact2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogHiccup1.ogg b/Sounds/Custom/HorribleHog/HorribleHogHiccup1.ogg new file mode 100644 index 0000000000..e222b6edb4 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogHiccup1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogHiccup2.ogg b/Sounds/Custom/HorribleHog/HorribleHogHiccup2.ogg new file mode 100644 index 0000000000..f2cf0ec66e Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogHiccup2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogIdle1.ogg b/Sounds/Custom/HorribleHog/HorribleHogIdle1.ogg new file mode 100644 index 0000000000..fe60871337 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogIdle1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogIdle2.ogg b/Sounds/Custom/HorribleHog/HorribleHogIdle2.ogg new file mode 100644 index 0000000000..e3cece7166 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogIdle2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogJump1.ogg b/Sounds/Custom/HorribleHog/HorribleHogJump1.ogg new file mode 100644 index 0000000000..fd223e0d2f Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogJump1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogJump2.ogg b/Sounds/Custom/HorribleHog/HorribleHogJump2.ogg new file mode 100644 index 0000000000..1518f255e1 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogJump2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogNearbyLoop.ogg b/Sounds/Custom/HorribleHog/HorribleHogNearbyLoop.ogg new file mode 100644 index 0000000000..63b4993d77 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogNearbyLoop.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogVomit1.ogg b/Sounds/Custom/HorribleHog/HorribleHogVomit1.ogg new file mode 100644 index 0000000000..fe278eeef1 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogVomit1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogVomit2.ogg b/Sounds/Custom/HorribleHog/HorribleHogVomit2.ogg new file mode 100644 index 0000000000..f777b2b800 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogVomit2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp1.ogg b/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp1.ogg new file mode 100644 index 0000000000..9b0b260136 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp1.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp2.ogg b/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp2.ogg new file mode 100644 index 0000000000..b0318c2a9c Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp2.ogg differ diff --git a/Sounds/Custom/HorribleHog/HorribleHogZombieEmerge.ogg b/Sounds/Custom/HorribleHog/HorribleHogZombieEmerge.ogg new file mode 100644 index 0000000000..9b718e2509 Binary files /dev/null and b/Sounds/Custom/HorribleHog/HorribleHogZombieEmerge.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_Grunt1.ogg b/Sounds/Custom/Piggy/PiggyIdle_Grunt1.ogg new file mode 100644 index 0000000000..079759cdad Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_Grunt1.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_Grunt2.ogg b/Sounds/Custom/Piggy/PiggyIdle_Grunt2.ogg new file mode 100644 index 0000000000..b1c5986a90 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_Grunt2.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_Grunt3.ogg b/Sounds/Custom/Piggy/PiggyIdle_Grunt3.ogg new file mode 100644 index 0000000000..9948305206 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_Grunt3.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_SnortYip1.ogg b/Sounds/Custom/Piggy/PiggyIdle_SnortYip1.ogg new file mode 100644 index 0000000000..65bf10904e Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_SnortYip1.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_SnortYip2.ogg b/Sounds/Custom/Piggy/PiggyIdle_SnortYip2.ogg new file mode 100644 index 0000000000..ef78b4e388 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_SnortYip2.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_SnortYip3.ogg b/Sounds/Custom/Piggy/PiggyIdle_SnortYip3.ogg new file mode 100644 index 0000000000..9019c3c009 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_SnortYip3.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_Yip1.ogg b/Sounds/Custom/Piggy/PiggyIdle_Yip1.ogg new file mode 100644 index 0000000000..4f6cbb0608 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_Yip1.ogg differ diff --git a/Sounds/Custom/Piggy/PiggyIdle_Yip2.ogg b/Sounds/Custom/Piggy/PiggyIdle_Yip2.ogg new file mode 100644 index 0000000000..35354c6527 Binary files /dev/null and b/Sounds/Custom/Piggy/PiggyIdle_Yip2.ogg differ diff --git a/Sounds/Custom/TickingTimerReverb.ogg b/Sounds/Custom/TickingTimerReverb.ogg new file mode 100644 index 0000000000..5dd9dedc4d Binary files /dev/null and b/Sounds/Custom/TickingTimerReverb.ogg differ diff --git a/Sounds/Item/APAShoot.ogg b/Sounds/Item/APAShoot.ogg new file mode 100644 index 0000000000..b8e1826147 Binary files /dev/null and b/Sounds/Item/APAShoot.ogg differ diff --git a/Sounds/Item/SoupConsumptionMisophonic.ogg b/Sounds/Item/SoupConsumptionMisophonic.ogg new file mode 100644 index 0000000000..065ddcd00d Binary files /dev/null and b/Sounds/Item/SoupConsumptionMisophonic.ogg differ diff --git a/Sounds/Item/StooldownResolve.ogg b/Sounds/Item/StooldownResolve.ogg new file mode 100644 index 0000000000..0c32496879 Binary files /dev/null and b/Sounds/Item/StooldownResolve.ogg differ diff --git a/Sounds/Item/TitaniumRailgunShoot.ogg b/Sounds/Item/TitaniumRailgunShoot.ogg new file mode 100644 index 0000000000..c1d9486835 Binary files /dev/null and b/Sounds/Item/TitaniumRailgunShoot.ogg differ diff --git a/Sounds/NPCHit/HorribleHogHit1.ogg b/Sounds/NPCHit/HorribleHogHit1.ogg new file mode 100644 index 0000000000..2fd18dc979 Binary files /dev/null and b/Sounds/NPCHit/HorribleHogHit1.ogg differ diff --git a/Sounds/NPCHit/HorribleHogHit2.ogg b/Sounds/NPCHit/HorribleHogHit2.ogg new file mode 100644 index 0000000000..272db7cd30 Binary files /dev/null and b/Sounds/NPCHit/HorribleHogHit2.ogg differ diff --git a/Sounds/NPCHit/HorribleHogHit3.ogg b/Sounds/NPCHit/HorribleHogHit3.ogg new file mode 100644 index 0000000000..4627517b48 Binary files /dev/null and b/Sounds/NPCHit/HorribleHogHit3.ogg differ diff --git a/Sounds/NPCKilled/HorribleHogDeath.ogg b/Sounds/NPCKilled/HorribleHogDeath.ogg new file mode 100644 index 0000000000..20989e8a83 Binary files /dev/null and b/Sounds/NPCKilled/HorribleHogDeath.ogg differ diff --git a/Sounds/NPCKilled/PiggyDeath1.ogg b/Sounds/NPCKilled/PiggyDeath1.ogg new file mode 100644 index 0000000000..bf433830bf Binary files /dev/null and b/Sounds/NPCKilled/PiggyDeath1.ogg differ diff --git a/Sounds/NPCKilled/PiggyDeath2.ogg b/Sounds/NPCKilled/PiggyDeath2.ogg new file mode 100644 index 0000000000..e3431f86b8 Binary files /dev/null and b/Sounds/NPCKilled/PiggyDeath2.ogg differ diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs index 6537b0421c..4880709a05 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs; using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; @@ -20,8 +19,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityBuffSets { - private static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = BuffID.Sets.Factory; /// /// If for a buff type, then that buff will have its duration extended with The Amalgam equipped.
@@ -109,8 +107,12 @@ namespace CalamityMod.Systems.Collections ); private static DebuffData Alch(int level) => new DebuffData() { AlcoholLevel = level }; + /// + /// Associates a buff type with its unique . This class is used to store information about the buff such as DoT, elemental affliation, and whether or not it is an alcohol.
+ /// Defaults to null, or having no assigned . + ///
public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") - .Description("Stores DebuffData for a particular debuff") + .Description("Associates a buff with its DebuffData, which stores information about that buff.") .RegisterCustomSet(null, BuffID.OnFire, DebuffData.OnFire, BuffID.OnFire3, DebuffData.Hellfire, diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 529e6a3d9c..3f7a5fca7f 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -1,11 +1,19 @@ -using CalamityMod.Items.Fishing.FishingRods; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Fishing; +using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.SummonItems.TownPets; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using ReLogic.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,8 +24,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityItemSets { - private static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = ItemID.Sets.Factory; /// /// If for an item type, prevents an item from removing Calamity's summon damage penalty mechanic despite having tool power.
@@ -26,7 +33,7 @@ namespace CalamityMod.Systems.Collections public static bool[] WeaponWithToolPowerAffectedBySummonPenalty = Factory.CreateNamedSet("WeaponWithToolPowerAffectedBySummonPenalty") .Description("Makes items with tool power still trigger the summon damage penalty.") .RegisterBoolSet(ItemID.ButchersChainsaw, ItemID.LucyTheAxe, ItemID.Rockfish, ItemType(), ItemType(), ItemType(), - ItemType(), ItemType()); + ItemType(), ItemType(), ItemType()); /// /// If for an item type, manually disables Calamity's summon damage penalty mechanic while that item type is held.
@@ -53,7 +60,7 @@ namespace CalamityMod.Systems.Collections ///
public static bool[] DisablesVeneratedLocketEffect = Factory.CreateNamedSet("DisablesVeneratedLocketEffect") .Description("Prevents this item from triggering Venerated Locket's clone projectiles.") - .RegisterBoolSet(ItemType(), ItemType(), ItemType()); + .RegisterBoolSet(ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a magic gun.
@@ -75,7 +82,7 @@ namespace CalamityMod.Systems.Collections ///
public static bool[] ShowScalingCritDamageTooltip = Factory.CreateNamedSet("ShowScalingCritDamageTooltip") .Description("Replaces the item's critical strike chance tooltip line with a line about critical damage.") - .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType()); + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue bomb.
@@ -112,7 +119,7 @@ namespace CalamityMod.Systems.Collections ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// @@ -134,5 +141,42 @@ namespace CalamityMod.Systems.Collections public static bool[] RogueSpikyBall = Factory.CreateNamedSet("RogueSpikyBall") .Description("Labels this item as a rogue spiky ball, only exists for objective classification.") .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// Defines a list of buff IDs to force display as an expandable tooltip with debuff info for enemy infliction on an item.
+ /// Defaults to an empty list. + ///
+ public static List[] ExtraDebuffTooltip_Enemy = Factory.CreateNamedSet("EnemyDebuffTooltip") + .Description("Defines buff IDs to force display as expandable tooltip with debuff info for enemy infliction.") + .RegisterCustomSet>(new()); + + /// + /// Defines a list of buff IDs to force display as an expandable tooltip with debuff info for player infliction on an item.
+ /// Defaults to an empty list. + ///
+ public static List[] ExtraDebuffTooltip_Player = Factory.CreateNamedSet("PlayerDebuffTooltip") + .Description("Defines buff IDs to force display as expandable tooltip with debuff info for player infliction.") + .RegisterCustomSet>(new()); + + /// + /// Does not support vanilla items. If for an item type, this item has special "sales pitch" flavor text from the Shady Salesman.
+ /// This causes the flavor text to draw at the top of the tooltip, with the actual tooltip being drawn below and with a smaller size.
+ /// Defaults to . + ///
+ public static bool[] HasSalesmanText = Factory.CreateNamedSet("HasSalesmanText") + .Description("Labels this item as having Shady Salesman flavor text, making it draw at the top of the tooltip and the actual tooltip being drawn small below it.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), 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 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/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index 502d723b75..bde061e0e1 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -48,8 +48,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCSets { - private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = NPCID.Sets.Factory; /// /// If for an NPC type, makes this NPC be susceptible to .
@@ -79,6 +78,15 @@ namespace CalamityMod.Systems.Collections .Description("Labels this NPC as a bound town NPC, to prevent them from taking hostile damage.") .RegisterBoolSet(NPCID.BoundGoblin, NPCID.BoundWizard, NPCID.BoundMechanic, NPCID.SleepingAngler, NPCID.BartenderUnconscious, NPCID.WebbedStylist, NPCID.GolferRescue); + /// + /// If for an NPC type, this NPC will not be targeted by various sources of 'unpredicatable' damage.
+ /// Primarily used for NPCs which summon bosses when killed.
+ /// Defaults to . + ///
+ public static bool[] ProtectedHostileNPC = Factory.CreateNamedSet("ProtectedHostileNPC") + .Description("Prevents this NPC from being targeted by various sources of 'unpredictable' damage.") + .RegisterBoolSet(NPCID.CultistArcherBlue, NPCID.CultistDevote, NPCType(), NPCType(), NPCType()); + /// /// If for an NPC type, then that NPC will not provide increased Rage generation despite being considered a boss.
/// Primarily used by worm boss body and tail segments to prevent Rage being extraordinarily easy to get.
@@ -148,13 +156,12 @@ namespace CalamityMod.Systems.Collections NPCID.ZombieElfGirl, NPCID.BloodEelHead, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman); /// - /// If for an NPC type, then that NPC is a post-Plantera Dungeon enemy. This causes two separate changes to the enemy.
- /// First, it grants them a 20% chance to drop Ectoplasm upon death.
- /// Second, it multiplies their max health by 2.5x and increases their damage by a flat 30 if Moon Lord has been defeated.
+ /// If for an NPC type, then that NPC is a post-Plantera Dungeon enemy.
+ /// This will multiply their max health by 2.5x and increase their damage by a flat 30 if Moon Lord has been defeated.
/// Defaults to . ///
public static bool[] IsBuffedDungeonEnemy = Factory.CreateNamedSet("IsBuffedDungeonEnemy") - .Description("Makes this NPC directly drop Ectoplasm on death, and buffs its health and damage after defeating Moon Lord.") + .Description("Makes this Dungeon enemy have buffed health and damage after defeating Moon Lord.") .RegisterBoolSet(NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.SkeletonCommando, NPCID.Paladin, NPCID.GiantCursedSkull, NPCID.BoneLee, NPCID.DiabolistWhite, NPCID.DiabolistRed, NPCID.NecromancerArmored, NPCID.Necromancer, NPCID.RaggedCasterOpenCoat, NPCID.RaggedCaster, NPCID.HellArmoredBonesSword, NPCID.HellArmoredBonesMace, NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBones, NPCID.BlueArmoredBonesSword, NPCID.BlueArmoredBonesNoPants, NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBones, @@ -219,7 +226,8 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); /// - /// If for an NPC type, or will be called on this NPC even if is set. + /// If for an NPC type, or will be called on this NPC, even if is set.
+ /// Defaults to . ///
public static bool[] DoCheckDeadRegardlessRealLife = Factory.CreateNamedSet("DoCheckDeadRegardlessRealLife") .Description("Makes this NPC always call CheckDead, even if it sets realLife.") @@ -233,6 +241,102 @@ namespace CalamityMod.Systems.Collections .Description("Prevents Calamity's IsAnEnemy method from considering this NPC an enemy.") .RegisterBoolSet(NPCID.TargetDummy, NPCType()); + /// + /// Associates an NPC type with its intended boss kill time, in frames.
+ /// Used for calculating enraged Providence's RDR and Yharon's bullet hell self-damage, as well as controlling making an NPC apply Boss Effects.
+ /// Defaults to 0, meaning the NPC has no defined kill time. + ///
+ public static int[] BossKillTimes = Factory.CreateNamedSet("BossKillTimes") + .Description("Defines this NPC's intended boss kill time, in frames.") + .RegisterIntSet(0, + NPCID.KingSlime, 5400, // 1:30 (90 seconds) + NPCID.EyeofCthulhu, 5400, // 1:30 (90 seconds) + NPCID.EaterofWorldsHead, 7200, // 2:00 (120 seconds) + NPCID.EaterofWorldsBody, 7200, + NPCID.EaterofWorldsTail, 7200, + NPCID.BrainofCthulhu, 7200, // 2:00 (120 seconds, total length of fight including Creepers phase) + NPCID.Creeper, 1800, // 0:30 (30 seconds, length of Creepers phase) + NPCID.Deerclops, 5400, // 1:30 (90 seconds) + NPCID.QueenBee, 7200, // 2:00 (120 seconds) + NPCID.SkeletronHead, 7200, // 2:00 (120 seconds) + NPCID.WallofFlesh, 7200, // 2:00 (120 seconds) + NPCID.WallofFleshEye, 7200, + NPCID.QueenSlimeBoss, 7200, // 2:00 (120 seconds) + NPCID.Spazmatism, 10800, // 3:00 (180 seconds) + NPCID.Retinazer, 10800, + NPCID.TheDestroyer, 10800, // 3:00 (180 seconds) + NPCID.TheDestroyerBody, 10800, + NPCID.TheDestroyerTail, 10800, + NPCID.SkeletronPrime, 10800, // 3:00 (180 seconds) + NPCID.Plantera, 10800, // 3:00 (180 seconds) + NPCID.Golem, 9000, // 2:30 (150 seconds) + NPCID.GolemHead, 3600, // 1:00 (60 seconds) + NPCID.DukeFishron, 9000, // 2:30 (150 seconds) + NPCID.HallowBoss, 10800, // 3:00 (180 seconds) + NPCID.CultistBoss, 9000, // 2:30 (150 seconds) + NPCID.MoonLordCore, 14400, // 4:00 (240 seconds) + NPCID.MoonLordHand, 7200, // 2:00 (120 seconds) + NPCID.MoonLordHead, 7200, // 2:00 (120 seconds) + + // + // CALAMITY BOSSES + // + NPCType(), 5400, // 1:30 (90 seconds) + NPCType(), 5400, + NPCType(), 5400, + NPCType(), 5400, // 1:30 (90 seconds) + NPCType(), 7200, // 2:00 (120 seconds) + NPCType(), 7200, // 2:00 (120 seconds) + NPCType(), 9000, // 2:30 (150 seconds) -- total length of Slime God fight + NPCType(), 4500, // 1:15 (75 seconds) + NPCType(), 4500, // 1:15 (75 seconds) + NPCType(), 4500, // 1:15 (75 seconds) -- split slimes should spawn at 1:15 and die at around 2:30 + NPCType(), 4500, // 1:15 (75 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 9000, // 2:30 (150 seconds) + NPCType(), 9000, + NPCType(), 9000, + NPCType(), 9000, + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 10800, + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 7200, // 2:00 (120 seconds) -- first phase is 1:00 + NPCType(), 7200, + NPCType(), 7200, + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 7200, // 2:00 (120 seconds) + NPCType(), 7200, // 2:00 (120 seconds) + NPCType(), 14400, // 4:00 (240 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 1200, // 0:20 (20 seconds) + NPCType(), 8100, // 2:15 (135 seconds) + NPCType(), 8100, + NPCType(), 8100, + NPCType(), 7200, // 2:00 (120 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 10800, // 3:00 (180 seconds) + NPCType(), 14400, // 4:00 (240 seconds) + NPCType(), 14400, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 + NPCType(), 14400, + NPCType(), 14400, // 4:00 (240 seconds) + NPCType(), 21600, // 6:00 (360 seconds) + NPCType(), 21600, + NPCType(), 21600, // 6:00 (360 seconds) + NPCType(), 21600, + NPCType(), 21600, + NPCType(), 21600, + NPCType(), 21600, + NPCType(), 21600, // 6:00 (360 seconds) + NPCType(), 21600, + NPCType(), 21600, + NPCType(), 21600, + NPCType(), 18000, // 5:00 (300 seconds) + NPCType(), 18000 // 5:00 (300 seconds) + ); + /// /// Associates an NPC type with the base value of their max health in Boss Rush.
/// If an NPC type is not a key in this dictionary, then it will use its standard max health value. diff --git a/Systems/Collections/CalamityNPCTypeSets.cs b/Systems/Collections/CalamityNPCTypeSets.cs index 5d8e4a555b..09517fad07 100644 --- a/Systems/Collections/CalamityNPCTypeSets.cs +++ b/Systems/Collections/CalamityNPCTypeSets.cs @@ -20,8 +20,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCTypeSets { - private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = NPCID.Sets.Factory; // Used for dropping Ancient Bone Dust, vanilla has a Skeleton NPCID set which has more unwanted enemies in it public static bool[] Skeleton = Factory.CreateNamedSet("Skeleton") diff --git a/Systems/Collections/CalamityProjectileSets.cs b/Systems/Collections/CalamityProjectileSets.cs index 761ef5f3bb..33f4565204 100644 --- a/Systems/Collections/CalamityProjectileSets.cs +++ b/Systems/Collections/CalamityProjectileSets.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityProjectileSets { - private static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = ProjectileID.Sets.Factory; /// /// If for a projectile type, then that minion will completely ignore Calamity's summon damage penalty mechanic with no exceptions.
@@ -28,7 +27,7 @@ namespace CalamityMod.Systems.Collections /// /// If for a projectile type, then that projectile is spawned by a post-Plantera Dungeon enemy.
- /// This increases the projectile's damage by a flat 30 if Moon Lord has been defeated.
+ /// This increases the projectile's damage by a flat 60 if Moon Lord has been defeated.
/// Defaults to . ///
public static bool[] IsBuffedDungeonProjectile = Factory.CreateNamedSet("IsBuffedDungeonProjectile") @@ -38,7 +37,7 @@ namespace CalamityMod.Systems.Collections /// /// If for a projectile type, then that projectile is spawned by a Solar Eclipse, Pumpkin Moon, or Frost Moon enemy.
- /// This increases the projectile's damage by a flat 15 during those events if Devourer of Gods has been defeated.
+ /// This increases the projectile's damage by a flat 30 during those events if Devourer of Gods has been defeated.
/// Defaults to . ///
public static bool[] IsBuffedEventProjectile = Factory.CreateNamedSet("IsBuffedEventProjectile") diff --git a/Systems/Collections/CalamityTileSets.cs b/Systems/Collections/CalamityTileSets.cs index 45d1e37afc..b4336e4360 100644 --- a/Systems/Collections/CalamityTileSets.cs +++ b/Systems/Collections/CalamityTileSets.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityTileSets { - private static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search); - private static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = TileID.Sets.Factory; /// /// Should only contain modded tiles. If for a tile type, then that tile can be replaced by the Abyss during world generation.
diff --git a/Systems/Graphic/LightingEffectsSystem.cs b/Systems/Graphic/LightingEffectsSystem.cs index 0f37544bcc..a5ef76761f 100644 --- a/Systems/Graphic/LightingEffectsSystem.cs +++ b/Systems/Graphic/LightingEffectsSystem.cs @@ -14,15 +14,11 @@ namespace CalamityMod.Systems { public const float MaxSignusDarkness = -0.4f; public const float MaxGFBSignusDarkness = MaxSignusDarkness * 2f; - public const float MaxAbyssDarkness = -0.7f; + public override void ModifyLightingBrightness(ref float scale) { // Apply the calculated darkness value for the local player. CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f); - - if (modPlayer.ZoneAbyss) - scale += MaxAbyssDarkness * darkRatio; if (CalamityWorld.revenge) { @@ -34,11 +30,8 @@ namespace CalamityMod.Systems { float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - float multiplier = 1f; - // Total darkness - float signusDarkness = signusLifeRatio * multiplier; - darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); + float darkRatio = MathHelper.Clamp(signusLifeRatio, 0f, 1f); scale += (Main.zenithWorld ? MaxGFBSignusDarkness : MaxSignusDarkness) * darkRatio; } } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 27f2b46595..d2a19e76fa 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -745,8 +745,6 @@ namespace CalamityMod.Systems { Vanilla(ItemID.Leather), ChangeIngredientStack(ItemID.RottenChunk, 2) }, { Vanilla(ItemID.JestersArrow), JesterArrowRecipeEdit }, { Vanilla(ItemID.TeleportationPotion), TeleportationPotionRecipeEdit }, - { Vanilla(ItemID.WormFood), WormFoodRecipeEdit }, - { Vanilla(ItemID.BloodySpine), BloodySpineRecipeEdit }, { Vanilla(ItemID.GoblinBattleStandard), ChangeIngredientStack(ItemID.TatteredCloth, 5) }, { Vanilla(ItemID.Beenade), BeenadeRecipeEdit }, { Vanilla(ItemID.ChlorophyteBar), ChangeIngredientStack(ItemID.ChlorophyteOre, 4) }, @@ -757,13 +755,13 @@ namespace CalamityMod.Systems // Tier lock various items to a higher tier (sorted by progression) { Vanilla(ItemID.Trimarang), AddIngredient(ItemType(), 5) }, - { Vanilla(ItemID.NightsEdge), AddIngredient(ItemType(), 5) }, + { Vanilla(ItemID.NightsEdge), AddIngredient(ItemType(), 10) }, { Vanilla(ItemID.FairyBoots), AddIngredient(ItemID.SoulofLight, 5) }, { Vanilla(ItemID.FairyBell), RemoveIngredient(ItemID.SoulofSight) }, { Vanilla(ItemID.HellfireTreads), AddIngredient(ItemType(), 4) }, { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, { Vanilla(ItemID.TerraBlade), AddIngredient(ItemType(), 12) }, - { Vanilla(ItemID.FireGauntlet), AddIngredient(ItemType(), 5) }, + { Vanilla(ItemID.FireGauntlet), AddIngredient(ItemType(), 8) }, { Vanilla(ItemID.Zenith), ZenithRecipeEdit }, // Tier unlock various items to a lower tier (sorted by progression) @@ -844,18 +842,6 @@ namespace CalamityMod.Systems r.ChangeIngredientStack(ItemID.SoulofFright, intendedStack); } - private static void WormFoodRecipeEdit(Recipe r) - { - r.ChangeIngredientStack(ItemID.VilePowder, 20); - r.ChangeIngredientStack(ItemID.RottenChunk, 10); - } - - private static void BloodySpineRecipeEdit(Recipe r) - { - r.ChangeIngredientStack(ItemID.ViciousPowder, 20); - r.ChangeIngredientStack(ItemID.Vertebrae, 10); - } - private static void ZenithRecipeEdit(Recipe r) { r.AddIngredient(ItemType(), 5); @@ -1229,7 +1215,6 @@ namespace CalamityMod.Systems #region Cooked Food private static void AddCookedFood() { - #region Alternative Recipes #region Cooked Fish Recipe r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); @@ -1238,6 +1223,13 @@ namespace CalamityMod.Systems r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); + r = Recipe.Create(ItemID.CookedFish); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); + r.DisableDecraft(); + r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); @@ -1275,13 +1267,6 @@ namespace CalamityMod.Systems #endregion #region Seafood Dinner - r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(); // Consistency would be 2, but considering you need only 1 for Golden Delight, I'm leaving this at 1 - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); - r.DisableDecraft(); - r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); @@ -1318,50 +1303,6 @@ namespace CalamityMod.Systems r.DisableDecraft(); #endregion - #region Golden Delight - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - #endregion - r = Recipe.Create(ItemID.BowlofSoup); r.AddIngredient(ItemID.Mushroom); r.AddIngredient(); @@ -1383,10 +1324,9 @@ namespace CalamityMod.Systems r.Register(); r.SortAfterFirstRecipesOf(ItemID.CookedShrimp); r.DisableDecraft(); - #endregion - r = Recipe.Create(ItemID.Bacon); - r.AddIngredient(); + r = Recipe.Create(ItemID.GoldenDelight); + r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); @@ -1545,7 +1485,7 @@ namespace CalamityMod.Systems r = Recipe.Create(ItemID.IceSkates); r.AddIngredient(ItemID.FlinxFur, 3); r.AddRecipeGroup("IronBar", 5); - r.AddTile(TileID.Anvils); + r.AddTile(TileID.Loom); r.Register(); // Water Walking Boots @@ -1601,14 +1541,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Fledgling Wings - r = Recipe.Create(ItemID.CreativeWings); - r.AddIngredient(2); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.Feather, 10); - r.AddTile(TileID.Anvils); - r.Register(); - // Flying Carpet r = Recipe.Create(ItemID.FlyingCarpet); r.AddIngredient(ItemID.Silk, 10); diff --git a/Systems/Mechanic/TilePingerSystem.PingEffects.cs b/Systems/Mechanic/TilePingerSystem.PingEffects.cs index 0627884742..6217aef3d7 100644 --- a/Systems/Mechanic/TilePingerSystem.PingEffects.cs +++ b/Systems/Mechanic/TilePingerSystem.PingEffects.cs @@ -142,33 +142,6 @@ public class WulfrumPingTileEffect : IPingedTileEffect, ILoadable Main.spriteBatch.Draw(emptyFrame, pos.ToWorldCoordinates() - Main.screenPosition, null, Color.White, 0, new Vector2(emptyFrame.Width / 2f, emptyFrame.Height / 2f), 16f, 0, 0); } - // CIT 16JUL2025: Tile lighting override is now applied via an On edit; this code is duplicated there, and thus is no longer needed here. - /*public void EditDrawData(int i, int j, ref TileDrawInfo drawData) - { - float distanceFromCenter = (new Point(i, j).ToWorldCoordinates() - PingCenter).Length(); - float currentExpansion = MathHelper.Clamp(PingProgress * MaxPingLife / (float)MaxPingTravelTime, 0f, 1f) * MaxPingRadius; - - if (distanceFromCenter - 8 > currentExpansion) - return; - - float brightness = 1f; - Tile tile = Framing.GetTileSafely(i, j); - //Counteracts slopes and half tiles being too bright - if (tile.Slope != SlopeType.Solid || tile.IsHalfBlock) - brightness = 0.64f; - - //Fade on the edges - if (distanceFromCenter + 8 > currentExpansion) - brightness *= 1 - (distanceFromCenter - currentExpansion + 8f) / 16f; - - //Fade away with the effect - brightness *= 1 - Math.Max(PingProgress - 0.9f, 0) / (0.1f); - - if (drawData.tileLight.R < 200 * brightness) drawData.tileLight.R = (byte)(200 * brightness); - if (drawData.tileLight.G < 200 * brightness) drawData.tileLight.G = (byte)(200 * brightness); - if (drawData.tileLight.B < 200 * brightness) drawData.tileLight.B = (byte)(200 * brightness); - }*/ - public void UpdateEffect() { if (PingTimer > 0) diff --git a/Systems/Mechanic/TrustyOldRodEnemySystem.cs b/Systems/Mechanic/TrustyOldRodEnemySystem.cs index 63b2c5b925..dacc8fdc69 100644 --- a/Systems/Mechanic/TrustyOldRodEnemySystem.cs +++ b/Systems/Mechanic/TrustyOldRodEnemySystem.cs @@ -18,7 +18,6 @@ using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.Other; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.PlagueEnemies; @@ -45,7 +44,7 @@ namespace CalamityMod.Systems // Some spawns change with progression public static void SpawnTrustyOldRodNPC(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false) { - Projectile bobber = Main.projectile[bobberWhoAmI]; + Projectile bobber = Main.projectile.FirstOrDefault(p => p.identity == bobberWhoAmI); bool common = rarity == 1; bool rare = rarity == 2; bool ultraRare = rarity == 3; @@ -662,6 +661,16 @@ namespace CalamityMod.Systems } } + #endregion + } + + public static void DoTrustyOldRodVFX(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false) + { + Projectile bobber = Main.projectile.FirstOrDefault(p => p.identity == bobberWhoAmI); + bool common = rarity == 1; + bool rare = rarity == 2; + bool ultraRare = rarity == 3; + float scale = (common ? 1 : rare ? 2.5f : 6); for (int i = 0; i < (int)(12 * scale); i++) { @@ -686,7 +695,6 @@ namespace CalamityMod.Systems SoundStyle epicFail = new("CalamityMod/Sounds/Item/WaterSplash", 2); SoundEngine.PlaySound(epicFail with { Volume = 0.4f + 0.1f * scale, Pitch = 0.2f - 0.1f * scale }, bobber.Center); bobber.velocity += -Vector2.UnitY * (common ? 10 : rare ? 20 : 45); - #endregion } } } diff --git a/Systems/ProgressionAndEvent/DownedBossSystem.cs b/Systems/ProgressionAndEvent/DownedBossSystem.cs index 656e5d0534..c7aa1f0091 100644 --- a/Systems/ProgressionAndEvent/DownedBossSystem.cs +++ b/Systems/ProgressionAndEvent/DownedBossSystem.cs @@ -45,6 +45,7 @@ namespace CalamityMod // Minibosses internal static bool _downedGSS = false; + internal static bool _downedHorribleHog = false; internal static bool _downedCLAM = false; internal static bool _downedCLAMHardMode = false; internal static bool _downedCragmawMire = false; @@ -381,6 +382,17 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedPrimordialWyrm, -1); } } + public static bool downedHorribleHog + { + get => _downedHorribleHog; + set + { + if (!value) + _downedHorribleHog = false; + else + NPC.SetEventFlagCleared(ref _downedHorribleHog, -1); + } + } public static bool downedCLAM { get => _downedCLAM; @@ -548,6 +560,7 @@ namespace CalamityMod downedSecondSentinels = false; + downedHorribleHog = false; downedCLAM = false; downedEoCAcidRain = false; @@ -644,6 +657,8 @@ namespace CalamityMod downed.Add("adultEidolonWyrm"); // Minibosses and events + if (downedHorribleHog) + downed.Add("horribleHog"); if (downedCLAM) downed.Add("clam"); if (downedEoCAcidRain) @@ -711,6 +726,7 @@ namespace CalamityMod downedCalamitas = downed.Contains("supremeCalamitas"); downedPrimordialWyrm = downed.Contains("adultEidolonWyrm"); + downedHorribleHog = downed.Contains("horribleHog"); downedCLAM = downed.Contains("clam"); downedEoCAcidRain = downed.Contains("eocRain"); diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index 4bf79cb76b..e0b0d26647 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -301,6 +301,7 @@ namespace CalamityMod flags12[3] = downedBossRush; flags12[4] = DraedonMechdusa; flags12[5] = unlockedTownPig; + flags12[5] = downedHorribleHog; writer.Write(flags); writer.Write(flags2); @@ -456,6 +457,7 @@ namespace CalamityMod downedBossRush = flags12[3]; DraedonMechdusa = flags12[4]; unlockedTownPig = flags12[5]; + downedHorribleHog = flags12[5]; RecipeUnlockHandler.ReceiveData(reader); diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 81feca5779..af39e18446 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Systems continue; CalamityGlobalNPC.AttemptToSpawnLabCritters(p); - CalamityGlobalNPC.AttemptToSpawnLavaNPCs(p); + //CalamityGlobalNPC.AttemptToSpawnLavaNPCs(p); } // Spawn the Old Man if Skeletron hasn't been defeated and there is no Old Man, it takes too fucking long otherwise. diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 0ccd7c76dc..7cd974f5e0 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -53,33 +53,10 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { - // Better Underworld (similar to Don't Dig Up seed but with some adjustments) - int underworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); - if (underworldIndex != -1) - { - tasks[underworldIndex] = new PassLegacy("Underworld", (progress, config) => - { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; - CustomUnderworld.NewUnderworld(); - }); - } - // Better Underworld structures after the world has been smoothed int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); if (underworldStructuresIndex != -1) { - tasks.Insert(underworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => - { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; - CustomUnderworld.NewUnderworldStructures(); - - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; - CustomUnderworld.AshTreesAndGrass(); - - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; - CustomUnderworld.PlaceGeyserTraps(); - })); - // Generate the Shimmer Shrine directly above the center of the underground Shimmer lake tasks.Insert(underworldStructuresIndex + 2, new PassLegacy("Shimmer Shrine", (progress, config) => { @@ -228,38 +205,16 @@ namespace CalamityMod.Systems })); } - // Sunken Sea - int sunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); - if (sunkenSeaIndex != -1) + // Sunken sea + int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); + if (SunkenSeaIndex != -1) { - tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => + tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; - int sunkenSeaY = Main.maxTilesY / 2; - - // place each piece of the sunken sea based on the above positons - - // messages intentionally in the "incorrect" order for the player's experience. - // they'll see the OG message first, then subsequent biomes are placed in vertical order. - // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, - // rather than keeping the player in the dark about what's happening. - // it doesn't have to make sense, just be cool for the players :) -ena - //SunkenSea.PlaceBasaltGullyBorderBlend(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; - SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; - SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.RadiantReefs").Value; - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; - SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); - SunkenSea.PlaceGleamingBurrowsGeodes(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; - SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; - //SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - SunkenSea.PlaceSunkenSeaAmbience(); + + Point ssBottomLeft = new Point(GenVars.UndergroundDesertLocation.Left, Main.maxTilesY - 400); + SunkenSea.Place(ssBottomLeft); })); } @@ -418,6 +373,12 @@ namespace CalamityMod.Systems SulphurousSea.SulphurSeaGenerationAfterAbyss(); })); + tasks.Insert(++currentFinalIndex, new PassLegacy("Iron Ball", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.IronBall").Value; + MiscWorldgenRoutines.GenerateIronBall(); + })); + // No Traps/GFB Auric Land Mines if (Main.noTrapsWorld) { diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index 8040ce829c..4a2cf2de6f 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Tiles.Astral TileObjectData.addTile(Type); AddMapEntry(new Color(128, 128, 158), CalamityUtils.GetItemName()); TileID.Sets.DisableSmartCursor[Type] = true; - MinPick = 200; } public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 5dfb13a294..1f4219a28d 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -291,7 +291,6 @@ namespace CalamityMod.Tiles // Handle for Demon Altar Drops // Drop: // - Soul of Night (x4) (Only if Early Hardmode Progression Rework is on) - // - Evil Smasher (x1) (Every 12th altar) if (type == TileID.DemonAltar && Main.hardMode) { Vector2 spreadMinMax = new Vector2(-32.0f, 32.0f); @@ -303,10 +302,6 @@ namespace CalamityMod.Tiles WorldGen.altarCount++; // altarCount does not update automatically if ProgressionRework is enabled! AchievementsHelper.NotifyProgressionEvent(6); // Gives the Begone, Evil! achievement } - - // Drop Evil Smasher on every 12 altar smashed - if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) - DropItem(i, j, ItemType(), quantity: 1, asStack: true, prefix: true); } } diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index 728a96dc12..fc184afc16 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -177,9 +177,7 @@ namespace CalamityMod.Tiles.Crags #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface - */ + // If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface if ( CheckTile(Type, false, 0, 1, i, j) || (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) @@ -194,9 +192,7 @@ namespace CalamityMod.Tiles.Crags private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Ending the Extra when a wall is reached - */ + // Ending the Extra when a wall is reached //Left if ( @@ -220,9 +216,7 @@ namespace CalamityMod.Tiles.Crags private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached - */ + // Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached //Left if ( @@ -244,9 +238,7 @@ namespace CalamityMod.Tiles.Crags private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Hanging 'drapes' of the extra element - */ + // Hanging 'drapes' of the extra element //Base if ( @@ -325,113 +317,6 @@ namespace CalamityMod.Tiles.Crags { return Main.tile[i, j].TileFrameNumber * extraFrameWidth; } - - /* - private int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - Tile sourceTile = Main.tile[i, j]; - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - return (variant); - } - */ #endregion } } diff --git a/Tiles/Furniture/BossRelics/SlimeGodRelic.png b/Tiles/Furniture/BossRelics/SlimeGodRelic.png index c52d4bf182..9f20a8d8b0 100644 Binary files a/Tiles/Furniture/BossRelics/SlimeGodRelic.png and b/Tiles/Furniture/BossRelics/SlimeGodRelic.png differ diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index c900255905..b8ee62c97b 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 18 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); diff --git a/Tiles/Furniture/CorruptionEffigy.png b/Tiles/Furniture/CorruptionEffigy.png index 665d755fd0..c7d093ac05 100644 Binary files a/Tiles/Furniture/CorruptionEffigy.png and b/Tiles/Furniture/CorruptionEffigy.png differ diff --git a/Tiles/Furniture/CorruptionEffigy_Highlight.png b/Tiles/Furniture/CorruptionEffigy_Highlight.png index bd91211397..1f60a74d44 100644 Binary files a/Tiles/Furniture/CorruptionEffigy_Highlight.png and b/Tiles/Furniture/CorruptionEffigy_Highlight.png differ diff --git a/Tiles/Furniture/CrimsonEffigy.cs b/Tiles/Furniture/CrimsonEffigy.cs index b462e4769b..75695a3d3d 100644 --- a/Tiles/Furniture/CrimsonEffigy.cs +++ b/Tiles/Furniture/CrimsonEffigy.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 18 }; TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); diff --git a/Tiles/Furniture/CrimsonEffigy.png b/Tiles/Furniture/CrimsonEffigy.png index 623df7c679..73e0722d6a 100644 Binary files a/Tiles/Furniture/CrimsonEffigy.png and b/Tiles/Furniture/CrimsonEffigy.png differ diff --git a/Tiles/Furniture/CrimsonEffigy_Highlight.png b/Tiles/Furniture/CrimsonEffigy_Highlight.png index 65062f866a..95fd6e61b9 100644 Binary files a/Tiles/Furniture/CrimsonEffigy_Highlight.png and b/Tiles/Furniture/CrimsonEffigy_Highlight.png differ diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.cs b/Tiles/Furniture/ForgottenNobleStatueTile.cs deleted file mode 100644 index 31822fe198..0000000000 --- a/Tiles/Furniture/ForgottenNobleStatueTile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class ForgottenNobleStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 7; - TileObjectData.newTile.Origin = new Point16(2, 7); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.png b/Tiles/Furniture/ForgottenNobleStatueTile.png deleted file mode 100644 index 1a7786c565..0000000000 Binary files a/Tiles/Furniture/ForgottenNobleStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.cs b/Tiles/Furniture/ForgottenScholarStatueTile.cs deleted file mode 100644 index 4aa9e5556a..0000000000 --- a/Tiles/Furniture/ForgottenScholarStatueTile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class ForgottenScholarStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 6; - TileObjectData.newTile.Origin = new Point16(2, 6); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.png b/Tiles/Furniture/ForgottenScholarStatueTile.png deleted file mode 100644 index 21859be3fb..0000000000 Binary files a/Tiles/Furniture/ForgottenScholarStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/GluttonyBlender.cs b/Tiles/Furniture/GluttonyBlender.cs index 286f731e27..6dbbdb6d56 100644 --- a/Tiles/Furniture/GluttonyBlender.cs +++ b/Tiles/Furniture/GluttonyBlender.cs @@ -156,6 +156,8 @@ namespace CalamityMod.Tiles.Furniture if (ItemLoader.ConsumeItem(item, player)) { item.stack--; + if (player.selectedItem == 58) + Main.mouseItem.stack--; if (item.stack <= 0) item.TurnToAir(); } @@ -230,13 +232,14 @@ namespace CalamityMod.Tiles.Furniture } } - if (Projectile.timeLeft == 1) + if (Projectile.timeLeft == 1 && Main.netMode != NetmodeID.MultiplayerClient) { Item dummy = new Item(); dummy.SetDefaults(ItemType); - int goodPercent = (int)(dummy.buffTime * (dummy.buffType == BuffID.WellFed3 ? 2f : dummy.buffType == BuffID.WellFed2 ? 1.5f : 1f) / 3600); + // 0.1% per minute of duration, multiplied by 2x for T2 food and 10x for T3 food + float goodPercent = dummy.buffTime * (dummy.buffType == BuffID.WellFed3 ? 10f : dummy.buffType == BuffID.WellFed2 ? 2f : 1f) / 3600f / 10f; - int itemDrop = Main.rand.Next(100) < goodPercent ? ModContent.ItemType() : ModContent.ItemType(); + int itemDrop = Main.rand.NextFloat(100f) < goodPercent ? ModContent.ItemType() : ModContent.ItemType(); int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, itemDrop); Main.item[i].GetGlobalItem().FromGluttonyBlender = true; } diff --git a/Tiles/Furniture/OtonilouStatueTile.cs b/Tiles/Furniture/OtonilouStatueTile.cs deleted file mode 100644 index 2505c01af3..0000000000 --- a/Tiles/Furniture/OtonilouStatueTile.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ObjectData; -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class OtonilouStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Width = 14; - TileObjectData.newTile.Height = 26; - TileObjectData.newTile.Origin = new Point16(2, 24); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - } -} diff --git a/Tiles/Furniture/OtonilouStatueTile.png b/Tiles/Furniture/OtonilouStatueTile.png deleted file mode 100644 index 856cef13cb..0000000000 Binary files a/Tiles/Furniture/OtonilouStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs b/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs deleted file mode 100644 index cd203d22fe..0000000000 --- a/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.Furniture.Paintings -{ - public class AmidiasPaintingTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileSpelunker[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.Width = 6; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - - TileID.Sets.DisableSmartCursor[Type] = true; - TileID.Sets.FramesOnKillWall[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; - DustType = DustID.WoodFurniture; - AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); - } - } -} diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.png b/Tiles/Furniture/Paintings/AmidiasPaintingTile.png deleted file mode 100644 index b2f4c1b913..0000000000 Binary files a/Tiles/Furniture/Paintings/AmidiasPaintingTile.png and /dev/null differ diff --git a/Tiles/Furniture/Paintings/BaseCanvasPainting.cs b/Tiles/Furniture/Paintings/BaseCanvasPainting.cs index 6c036b064e..ebf85fd7f9 100644 --- a/Tiles/Furniture/Paintings/BaseCanvasPainting.cs +++ b/Tiles/Furniture/Paintings/BaseCanvasPainting.cs @@ -93,18 +93,18 @@ namespace CalamityMod.Tiles.Furniture.Paintings var t = Main.tile[i, j]; var texture = TextureAssets.Tile[Type].Value; var cube = CalamityUtils.FindTileEntity(i, j, 1, 1); - var pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; if (cube != null && t.TileFrameX == 0) { var fPX = (int)cube.framePosition.X; var fPY = (int)cube.framePosition.Y; var scale = (int)(texture.Width * 0.1f * cube.scale); + var rasterizer = Main.LocalPlayer.gravDir == -1f ? RasterizerState.CullNone : Main.Rasterizer; spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, rasterizer, null); spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale * Scale, 0, 0); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null); + spriteBatch.Begin(); } // Calculate and draw the borders if (t.TileFrameX == 0 && t.TileFrameY == 0) diff --git a/Tiles/Furniture/PiggyCageGoldTile.cs b/Tiles/Furniture/PiggyCageGoldTile.cs new file mode 100644 index 0000000000..f2d2fa2a19 --- /dev/null +++ b/Tiles/Furniture/PiggyCageGoldTile.cs @@ -0,0 +1,103 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class PiggyCageGoldTile : ModTile + { + public static Asset topTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + topTexture = ModContent.Request("CalamityMod/Tiles/Furniture/TransparentGoldCageTile_Top"); + } + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); + TileObjectData.addTile(Type); + AnimationFrameHeight = 54; + AddMapEntry(new Color(122, 217, 232), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + int frameAmt = 18; + int timeNeeded = 6; + if (frame == 0 || frame == 9) + { + timeNeeded = 90; + } + frameCounter++; + if (frameCounter >= timeNeeded) + { + frame++; + frameCounter = 0; + } + if (frame >= frameAmt) + { + frame = 0; + } + } + + // Since this uses a custom top sprite, all drawing must be redone + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + Tile tile = Main.tile[i, j]; + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; + var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; + var height = 16; + var finalColor = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + if (rect.Y % 54 == 0) + { + Vector2 position = drawPos; + position.Y += 8f; + Rectangle drawRectangle = rect; + drawRectangle.Y += 8; + drawRectangle.Height -= 8; + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + position = drawPos; + position.Y -= 2f; + drawRectangle = rect; + drawRectangle.Y = 0; + drawRectangle.Height = 10; + spriteBatch.Draw(topTexture.Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + else + { + spriteBatch.Draw(TextureAssets.Tile[Type].Value, drawPos, rect, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Tiles/Furniture/PiggyCageGoldTile.png b/Tiles/Furniture/PiggyCageGoldTile.png new file mode 100644 index 0000000000..035201e914 Binary files /dev/null and b/Tiles/Furniture/PiggyCageGoldTile.png differ diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index 8eba891699..007e934bd7 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -38,16 +38,12 @@ namespace CalamityMod.Tiles.Furniture public override void AnimateTile(ref int frame, ref int frameCounter) { - int frameAmt = 34; + int frameAmt = 18; int timeNeeded = 6; - if (frame == 0) + if (frame == 0 || frame == 9) { timeNeeded = 90; } - if (frame == 25) - { - timeNeeded = 30; - } frameCounter++; if (frameCounter >= timeNeeded) { diff --git a/Tiles/Furniture/PiggyCageTile.png b/Tiles/Furniture/PiggyCageTile.png index dd667ca4c3..53138e3e51 100644 Binary files a/Tiles/Furniture/PiggyCageTile.png and b/Tiles/Furniture/PiggyCageTile.png differ diff --git a/Tiles/Furniture/SunkenIdolTile.cs b/Tiles/Furniture/SunkenIdolTile.cs deleted file mode 100644 index e3d5dadf61..0000000000 --- a/Tiles/Furniture/SunkenIdolTile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.Furniture -{ - public class SunkenIdolTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.Origin = new Point16(1, 4); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 18 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} diff --git a/Tiles/Furniture/SunkenIdolTile.png b/Tiles/Furniture/SunkenIdolTile.png deleted file mode 100644 index 5db73b921f..0000000000 Binary files a/Tiles/Furniture/SunkenIdolTile.png and /dev/null differ diff --git a/Tiles/Furniture/TheMonumentTile.cs b/Tiles/Furniture/TheMonumentTile.cs index 79a9999633..8bba424081 100644 --- a/Tiles/Furniture/TheMonumentTile.cs +++ b/Tiles/Furniture/TheMonumentTile.cs @@ -5,33 +5,136 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture { + public class TheMonumentTileEntity : ModTileEntity + { + public override bool IsTileValidForEntity(int x, int y) + { + var tile = Main.tile[x, y]; + return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public static bool IsInArea(Rectangle tileArea) + { + foreach (var (pos, tileEntity) in ByPosition) + { + if (tileEntity is not TheMonumentTileEntity) + { + continue; + } + + var monumentArea = new Rectangle(pos.X, pos.Y, TheMonumentTile.TileWidth, TheMonumentTile.TileHeight); + if (monumentArea.Intersects(tileArea)) + { + return true; + } + } + + return false; + } + } + public class TheMonumentTile : ModTile { + internal static int TileWidth => 7; + internal static int TileHeight => 8; + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.newTile.Width = 7; - TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Width = TileWidth; + TileObjectData.newTile.Height = TileHeight; TileObjectData.newTile.Origin = new Point16(3, 7); TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 16, 16, 16, 16 }; TileObjectData.newTile.DrawYOffset = 2; TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.HookPostPlaceMyPlayer = ModContent.GetInstance().Generic_HookPostPlaceMyPlayer; TileObjectData.addTile(Type); AddMapEntry(new Color(239, 205, 54), CalamityUtils.GetItemName()); } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + base.KillMultiTile(i, j, frameX, frameY); + + ModContent.GetInstance().Kill(i, j); + } + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold); return false; } } + + internal sealed class TheMonumentTileEntityPorter : ModSystem + { + private bool hasPortedTheMonument; + + public override void SaveWorldData(TagCompound tag) + { + base.SaveWorldData(tag); + + tag[nameof(hasPortedTheMonument)] = hasPortedTheMonument; + } + + public override void LoadWorldData(TagCompound tag) + { + base.LoadWorldData(tag); + + hasPortedTheMonument = tag.GetBool(nameof(hasPortedTheMonument)); + } + + // tModLoader only calls this on servers and single player clients, + // so we don't need to check it ourselves. + public override void PostWorldLoad() + { + base.PostWorldLoad(); + + if (hasPortedTheMonument) + { + return; + } + + var cachedType = ModContent.TileType(); + for (var x = 0; x < Main.maxTilesX; x += TheMonumentTile.TileWidth) + { + for (var y = 0; y < Main.maxTilesY; y += TheMonumentTile.TileHeight) + { + var tile = Framing.GetTileSafely(x, y); + if (!tile.HasTile || tile.TileType != cachedType) + { + continue; + } + + AddTheMonumentTileEntityIfItsThereYo(tile, x, y); + } + } + + hasPortedTheMonument = true; + } + + private void AddTheMonumentTileEntityIfItsThereYo(Tile tile, int x, int y) + { + x -= tile.TileFrameX / 16 % TheMonumentTile.TileWidth; + y -= tile.TileFrameY / 16 % TheMonumentTile.TileHeight; + + // Shouldn't ever happen, but better safe than sorry. + if (!ModContent.GetInstance().IsTileValidForEntity(x, y)) + { + Mod.Logger.Warn($"Failed to place TheMonument tile entity near the coordinates: {x}, {y}"); + return; + } + + ModContent.GetInstance().Place(x, y); + } + } } diff --git a/Tiles/Furniture/TransparentGoldCageTile_Top.png b/Tiles/Furniture/TransparentGoldCageTile_Top.png new file mode 100644 index 0000000000..be937ae4cc Binary files /dev/null and b/Tiles/Furniture/TransparentGoldCageTile_Top.png differ diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs index 7eb8b524e2..6935d176e5 100644 --- a/Tiles/FurnitureAshen/AshenAccentSlab.cs +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -532,122 +532,5 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } - - /* - /// - /// Gets the tile variant to use. Returns -1 by default - /// - /// - /// - /// - public int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - if (j % 3 < 2) - { - //We need to get the particular tile to refer to. This is the top left tile in each iteration of the pattern (large slab above the small rune bricks - Tile sourceTile = Main.tile[i - (i % 2), j - (j % 3)]; //Gets the tile for this iteration by taking the current position of the tile minus this tile's position in the pattern - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - return (variant); - } - */ } } diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 809dbd3bc7..88cb5bc72b 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -532,122 +532,5 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } - - /* - /// - /// Gets the tile variant to use. Returns -1 by default - /// - /// - /// - /// - public int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - if (j % 3 < 2) - { - //We need to get the particular tile to refer to. This is the top left tile in each iteration of the pattern (large slab above the small rune bricks - Tile sourceTile = Main.tile[i - (i % 2), j - (j % 3)]; //Gets the tile for this iteration by taking the current position of the tile minus this tile's position in the pattern - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - return (variant); - } - */ } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index 1d736949b8..b8f9142d04 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -82,9 +82,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface - */ + // If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface if ( CheckTile(Type, false, 0, 1, i, j) || (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) @@ -99,9 +97,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Ending the Extra when a wall is reached - */ + // Ending the Extra when a wall is reached //Left if ( @@ -125,9 +121,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached - */ + // Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached //Left if ( @@ -149,9 +143,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Hanging 'drapes' of the extra element - */ + // Hanging 'drapes' of the extra element //Base if ( @@ -230,113 +222,6 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { return Main.tile[i, j].TileFrameNumber * extraFrameWidth; } - - /* - private int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - Tile sourceTile = Main.tile[i, j]; - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - return (variant); - } - */ #endregion } } diff --git a/Tiles/GreedPotTile.cs b/Tiles/GreedPotTile.cs index 8a58ad248d..ea6b14db63 100644 --- a/Tiles/GreedPotTile.cs +++ b/Tiles/GreedPotTile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Particles; using CalamityMod.Utilities.Daybreak; @@ -47,12 +48,29 @@ namespace CalamityMod.Tiles player.cursorItemIconID = availableOres[(int)((Main.GlobalTimeWrappedHourly * 2) % availableOres.Count)]; } + public override void NearbyEffects(int i, int j, bool closer) + { + if (TileEntity.TryGet(new(i, j), out var greedPotTE) && greedPotTE.Activated && Main.LocalPlayer.miscCounter % 5 == 0) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.TileFrameX % (3 * 18) / 18; + if (left != i) + return; + int top = j - tile.TileFrameY % (3 * 18) / 18; + if (top != j) + return; + + Point position = new(left, top); + HeavySmokeParticle p = new(position.ToWorldCoordinates(24 + Main.rand.Next(-10, 11), 2), Vector2.UnitY * -2, Color.Crimson, 90, Main.rand.NextFloat(0.2f, 0.3f), 0.75f, Main.rand.NextFloat(-0.05f, 0.05f), true); + GeneralParticleHandler.SpawnParticle(p); + } + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { if (TileEntity.TryGet(new(i, j), out var greedPotTE)) - { frameXOffset = 18 * 3 * greedPotTE.MyFrame; - } } } @@ -102,14 +120,14 @@ namespace CalamityMod.Tiles public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); - public override void Update() + public void UpdateOnAllClients() { - if(Activated) + if (Activated) { - if(CurrentFrame != 3) + if (CurrentFrame != 3) { FrameTime++; - if(FrameTime % FrameRate == 0) + if (FrameTime % FrameRate == 0) { FrameTime = 0; CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); @@ -123,12 +141,6 @@ namespace CalamityMod.Tiles return; } - if(TimeSinceActivation % 5 == 0) - { - HeavySmokeParticle p = new(Position.ToWorldCoordinates(24 + Main.rand.Next(-10, 11), 2), Vector2.UnitY * -2, Color.Crimson, 90, Main.rand.NextFloat(0.2f, 0.3f), 0.75f, Main.rand.NextFloat(-0.05f, 0.05f), true); - GeneralParticleHandler.SpawnParticle(p); - } - TimeSinceActivation++; } else @@ -161,6 +173,21 @@ namespace CalamityMod.Tiles } } + //Mod Tile Entity's Update functions don't get called on multiplayer clients + public class GreedPotTEUpdateSystem : ModSystem + { + public override void PostUpdateProjectiles() + { + foreach (TileEntity te in TileEntity.ByID.Values) + { + if (te is not GreedPotTE greedTE) + continue; + + greedTE.UpdateOnAllClients(); + } + } + } + public class GreedTransmutation : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Misc"; @@ -213,6 +240,8 @@ namespace CalamityMod.Tiles BezierCurve path = null; private bool Success = false; + private int random = -1; + public override void SetDefaults() { Projectile.width = 24; @@ -233,10 +262,20 @@ namespace CalamityMod.Tiles Projectile.netUpdate = true; } + public override bool PreAI() + { + if (Projectile.timeLeft == 120) + { + GreedPotTE te = TileEntity.ByID[(int)Projectile.ai[2]] as GreedPotTE; + te.Activated = true; + te.TimeSinceActivation = 0; + } + return true; + } public override void AI() { - if(path == null) + if (path == null) { Vector2 startPoint = StartPosition; Vector2 endPoint = PotPosition - Vector2.UnitY * 64; @@ -256,31 +295,36 @@ namespace CalamityMod.Tiles float lerp = 1 - MathHelper.Clamp(((Projectile.timeLeft - 60) / 60f), 0f, 1f); Projectile.Center = path.Evaluate(CalamityUtils.CircOutEasing(lerp, 1)); + } - if (Projectile.timeLeft == 1) + public override void OnKill(int timeLeft) + { + if (Main.myPlayer == Projectile.owner) { int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, Success ? SuccessOutputItemType : ItemID.StoneBlock); - Main.item[i].GetGlobalItem().FromGreedPot = true; + if (i >= 0) + { + Main.item[i].GetGlobalItem().FromGreedPot = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i); + } } } public override bool PreDraw(ref Color lightColor) { - //Anim Plan - //Moving to Pos: 0 -> 60 - //Darken: 70 -> 80 - //Transform: 90 -> 100 - //Undarken: 110 -> 120 - int animTime = 120 - Projectile.timeLeft; bool beforeDarken = animTime < 50; bool darken = animTime < 90; bool transform = animTime < 110; - if(beforeDarken) + if (random == -1) + random = Main.rand.Next(120); + + if (beforeDarken) { Texture2D tex = TextureAssets.Item[InputItemType].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } else if (darken) { @@ -293,7 +337,7 @@ namespace CalamityMod.Tiles glowLerp = CalamityUtils.SineInEasing(glowLerp, 1); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * glowLerp, Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, glowLerp), 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson * glowLerp, Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, glowLerp), 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); @@ -302,7 +346,7 @@ namespace CalamityMod.Tiles darkenLerp = CalamityUtils.CircInEasing(darkenLerp, 1); Texture2D tex = TextureAssets.Item[InputItemType].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } else if(transform) { @@ -312,7 +356,7 @@ namespace CalamityMod.Tiles Main.spriteBatch.Begin(newSnap); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); @@ -322,8 +366,8 @@ namespace CalamityMod.Tiles float transformLerp = MathHelper.Clamp((animTime - 90) / 10f, 0f, 1f); //transformLerp = CalamityUtils.SineInOutEasing(transformLerp, 1); - Main.spriteBatch.Draw(inputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, 1 - transformLerp, 0, 0); - Main.spriteBatch.Draw(outputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, transformLerp, 0, 0); + Main.spriteBatch.Draw(inputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, 1 - transformLerp, 0, 0); + Main.spriteBatch.Draw(outputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, transformLerp, 0, 0); } else { @@ -336,16 +380,30 @@ namespace CalamityMod.Tiles Main.spriteBatch.Begin(newSnap); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * (1 - undarkenLerp), Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, (1 - undarkenLerp)), 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson * (1 - undarkenLerp), Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, (1 - undarkenLerp)), 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); Texture2D tex = TextureAssets.Item[Success ? SuccessOutputItemType : ItemID.StoneBlock].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(Color.Black, lightColor, undarkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Lerp(Color.Black, lightColor, undarkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } return false; } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(StartPosition); + writer.WriteVector2(PotPosition); + writer.Write(Success); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + StartPosition = reader.ReadVector2(); + PotPosition = reader.ReadVector2(); + Success = reader.ReadBoolean(); + } } public class GreedTransmutationGlobalItem : GlobalItem @@ -356,9 +414,6 @@ namespace CalamityMod.Tiles public override bool? UseItem(Item item, Player player) { - if (Main.LocalPlayer.whoAmI != player.whoAmI) - return null; - if (!GreedTransmutation.GreedChain.TryGetValue(item.type, out var transmutation)) return null; @@ -374,17 +429,28 @@ namespace CalamityMod.Tiles if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) return null; - Projectile.NewProjectile(Projectile.GetSource_NaturalSpawn(), Main.LocalPlayer.Center, greedPotTE.Position.ToWorldCoordinates(24, 24) + Main.rand.NextVector2Circular(12, 32), ModContent.ProjectileType(), 0, 0, Main.LocalPlayer.whoAmI, item.type, transmutation.Result, Main.rand.Next(120)); + if (Main.myPlayer == player.whoAmI) + Projectile.NewProjectile(Projectile.GetSource_NaturalSpawn(), player.Center, greedPotTE.Position.ToWorldCoordinates(24, 24) + Main.rand.NextVector2Circular(12, 32), ModContent.ProjectileType(), 0, 0, player.whoAmI, item.type, transmutation.Result, greedPotTE.ID); + greedPotTE.Activated = true; greedPotTE.TimeSinceActivation = 0; player.ApplyItemTime(item, 0.5f, false); - return false; } public override bool CanStackInWorld(Item destination, Item source) { - return !destination.GetGlobalItem().FromGreedPot || !source.GetGlobalItem().FromGreedPot; + return !destination.GetGlobalItem().FromGreedPot && !source.GetGlobalItem().FromGreedPot; + } + + public override void NetSend(Item item, BinaryWriter writer) + { + writer.Write(FromGreedPot); + } + + public override void NetReceive(Item item, BinaryReader reader) + { + FromGreedPot = reader.ReadBoolean(); } } } diff --git a/Tiles/IronBallPlaced.cs b/Tiles/IronBallPlaced.cs new file mode 100644 index 0000000000..7b3a7dc65d --- /dev/null +++ b/Tiles/IronBallPlaced.cs @@ -0,0 +1,55 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class IronBallPlaced : ModTile + { + public static Asset GlowTexture = null; + + public override void Load() + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/IronBallPlaced_Glow"); + } + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLighted[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileOreFinderPriority[Type] = 770; // Same as Chillet + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + DustType = DustID.Silver; + + AddMapEntry(new Color(108, 118, 134), CalamityUtils.GetText("Tiles.IronBall")); + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementSmall.AddVariations(ModContent.ItemType(), Type, 0); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + // Dim flickering red light + r = MathF.Sin(Main.GlobalTimeWrappedHourly * 20) * 0.05f + 0.3f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + spriteBatch.Draw(GlowTexture.Value, new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + CalamityUtils.TileDrawOffset, new Rectangle(Main.tile[i, j].TileFrameX, Main.tile[i, j].TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/IronBallPlaced.png b/Tiles/IronBallPlaced.png new file mode 100644 index 0000000000..232ca8d88f Binary files /dev/null and b/Tiles/IronBallPlaced.png differ diff --git a/Tiles/IronBallPlaced_Glow.png b/Tiles/IronBallPlaced_Glow.png new file mode 100644 index 0000000000..ae2214656d Binary files /dev/null and b/Tiles/IronBallPlaced_Glow.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 12cd3e56cb..a7522beb4f 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Deconstructors; using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.NormalNPCs.HorribleHog; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; @@ -385,13 +386,13 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 104: - npc = NPCType(); + npc = NPCType(); break; case 105: npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam @@ -459,75 +460,79 @@ namespace CalamityMod.Tiles case 128: npc = NPCType(); break; - case 129: + // Hello source code diver, here are a bunch of Sunken Sea enemy names, have fun + /*case 129: npc = NPCType(); - break; - case 130: - npc = NPCType(); - break; - case 131: - npc = NPCType(); - break; - case 132: - npc = NPCType(); - break; - /* case 133: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. break; */ - case 134: + /* case 130: + npc = NPCType(); + break; */ + /* case 131: + npc = NPCType(); + break; */ + /* case 132: + npc = NPCType(); + break; */ + /* case 133: + npc = NPCType(); + break; */ + /* case 134: npc = NPCType(); - break; - case 135: + break; */ + /* case 135: npc = NPCType(); - break; - case 136: + break; */ + /* case 136: npc = NPCType(); - break; - case 137: + break; */ + /* case 137: npc = NPCType(); - break; - case 138: + break; */ + /* case 138: npc = NPCType(); - break; + break; */ /* case 139: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + npc = NPCType(); break; */ /* case 140: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + npc = NPCType(); break; */ - case 141: + /* case 141: npc = NPCType(); // Logic should be applying to other variants - break; - case 142: - npc = NPCType(); - break; - case 143: - npc = NPCType(); - break; - case 144: - npc = NPCType(); - break; - case 145: - npc = NPCType(); - break; - case 146: - npc = NPCType(); - break; - case 147: - npc = NPCType(); - break; - case 148: - npc = NPCType(); - break; - case 149: - npc = NPCType(); - break; - case 150: - npc = NPCType(); - break; - /* case 151: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. break; */ + /* case 142: + npc = NPCType(); + break; */ + /* case 143: + npc = NPCType(); + break; */ + /* case 144: + npc = NPCType(); + break; */ + /* case 145: + npc = NPCType(); + break; */ + /* case 146: + npc = NPCType(); + break; */ + /* case 147: + npc = NPCType(); + break; */ + /* case 148: + npc = NPCType(); + break; */ + /* case 149: + npc = NPCType(); + break; */ + /* case 150: + npc = NPCType(); + break; */ + /* case 151: + npc = NPCType(); + break; */ + case 152: + npc = NPCType(); + break; default: break; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 4142434796..ff17756e1d 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index d3a404368b..be3c6ca0ff 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using CalamityMod.Dusts; -using CalamityMod.Items.Materials; using CalamityMod.Tiles.Astral; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -29,7 +27,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; - MinPick = 110; + MinPick = 210; DustType = DustID.ShadowbeamStaff; AddMapEntry(new Color(255, 153, 255), CreateMapEntryName()); MineResist = 3f; @@ -37,7 +35,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - // TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; TileID.Sets.AvoidedByMeteorLanding[Type] = true; this.RegisterBlendMergeWith(ModContent.TileType()); @@ -72,19 +70,15 @@ namespace CalamityMod.Tiles.Ores } } - public override IEnumerable GetItemDrops(int i, int j) + public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - if (!DownedBossSystem.downedAstrumDeus) - { - if (Main.rand.NextBool()) - yield return new Item(ModContent.ItemType()); - else - yield return new Item(0); - } - else - yield return new Item(ModContent.ItemType()); + return DownedBossSystem.downedAstrumDeus; } + public override bool CanExplode(int i, int j) + { + return false; + } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Pylons/CragsPylonBrokenTile.cs b/Tiles/Pylons/CragsPylonBrokenTile.cs new file mode 100644 index 0000000000..71e0ce16e8 --- /dev/null +++ b/Tiles/Pylons/CragsPylonBrokenTile.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Placeables.Pylons; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Pylons +{ + public class CragsPylonBrokenTile : ModTile + { + public override string Texture => "CalamityMod/Tiles/Pylons/CragsPylonTile"; + + public override void SetStaticDefaults() + { + Main.tileLavaDeath[Type] = false; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.LavaPlacement = LiquidPlacement.Allowed; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + + AddMapEntry(Color.OrangeRed, CalamityUtils.GetItemName(ModContent.ItemType())); + TileID.Sets.PreventsSandfall[Type] = true; + } + public override bool CreateDust(int i, int j, ref int type) => false; + } +} diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index a4b10b3957..359ab48c4e 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.Suffocate[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - TileID.Sets.Falling[Type] = true; - TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 5); this.RegisterBlendMergeWith(ModContent.TileType()); this.RegisterBlendMergeWith(ModContent.TileType()); diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index d4f08a90bf..a12b232265 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -90,9 +90,7 @@ namespace CalamityMod.Tiles #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface - */ + // If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface if ( CheckTile(Type, false, 0, 1, i, j) || (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) @@ -107,9 +105,7 @@ namespace CalamityMod.Tiles private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Ending the Extra when a wall is reached - */ + // Ending the Extra when a wall is reached //Left if ( @@ -133,9 +129,7 @@ namespace CalamityMod.Tiles private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached - */ + // Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached //Left if ( @@ -157,9 +151,7 @@ namespace CalamityMod.Tiles private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Hanging 'drapes' of the extra element - */ + // Hanging 'drapes' of the extra element //Base if ( @@ -238,113 +230,6 @@ namespace CalamityMod.Tiles { return Main.tile[i, j].TileFrameNumber * extraFrameWidth; } - - /* - private int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - Tile sourceTile = Main.tile[i, j]; - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - return (variant); - } - */ #endregion } } diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index 729d05c74c..4826424766 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -199,9 +199,7 @@ namespace CalamityMod.Tiles #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface - */ + // If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface if ( CheckTile(Type, false, 0, 1, i, j) || (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) @@ -216,9 +214,7 @@ namespace CalamityMod.Tiles private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Ending the Extra when a wall is reached - */ + // Ending the Extra when a wall is reached //Left if ( @@ -242,9 +238,7 @@ namespace CalamityMod.Tiles private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached - */ + // Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached //Left if ( @@ -266,9 +260,7 @@ namespace CalamityMod.Tiles private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) { - /* - Hanging 'drapes' of the extra element - */ + // Hanging 'drapes' of the extra element //Base if ( @@ -347,113 +339,6 @@ namespace CalamityMod.Tiles { return Main.tile[i, j].TileFrameNumber * extraFrameWidth; } - - /* - private int GetTileVariant(int i, int j) - { - int variant = 0; //Default to using variant 1 - Tile sourceTile = Main.tile[i, j]; - //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using - int frameX = sourceTile.frameX / 18; - int frameY = sourceTile.frameY / 18; - if (frameY < 3 && !(frameX >= 6 && frameX < 9)) - { - int group = 0; - int[] group1XPos = new int[] { 1, 2, 3 }; - int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; - foreach (int k in group1XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 1; - } - } - foreach (int k in group2XPos) - { - if (frameX < k + 1 && frameX >= k) - { - group = 2; - } - } - if (group == 1) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 3) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (group == 2) - { - if (frameY < 1) - { - variant = 0; - } - else if (frameY < 2) - { - variant = 1; - } - else - { - variant = 2; - } - } - } - else if (frameX < 6 && frameY >= 3) - { - if (frameX < 2) - { - variant = 0; - } - else if (frameX < 4) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 6 && frameX < 9) - { - if (frameX < 7) - { - variant = 0; - } - else if (frameX < 8) - { - variant = 1; - } - else - { - variant = 2; - } - } - else if (frameX >= 9 && frameY >= 3) - { - if (frameX < 10) - { - variant = 0; - } - else if (frameX < 11) - { - variant = 1; - } - else - { - variant = 2; - } - } - return (variant); - } - */ #endregion public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index 5788363cb0..ca6fb43d4b 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -54,12 +55,46 @@ namespace CalamityMod return (dx * dx + dy * dy) <= (radius * radius); } + /// + /// Creates an arc around an entity and returns true if a specific collision check is reached for a specific point along the arc. + ///
+ /// By default, this will check if any individual point along the arc is stuck inside of a solid tile. + ///
+ ///
+ /// The minimum angle of the arc in radians. + /// The maximum angle of the arc in radians. + /// By how many radians should the loop increment by when looping between the two angles. This will affect how many points the arc has. + /// The base position the arc should be scribed from. Defaults to the entity's center. + /// The direction of the arc. Defaults to the entity's velocity. + /// The radius of the arc from the base position in pixels. Defaults to 32. + /// An optional delegate parameter of two Vector2 inputs, the base position and the individual arc point, which can be used to + /// override the default collision check logic. + public static bool ArcCollisionCheck(this Entity entity, float minRadians, float maxRadians, float radiansIncrement, Vector2? basePosition = null, Vector2? arcDirection = null, float arcRadius = 32f, Func optionalCollisionCheckOverride = null) + { + for (float i = minRadians; i < maxRadians; i += radiansIncrement) + { + Vector2 arcPointBase = basePosition ?? entity.Center; + Vector2 checkDirection = arcDirection ?? entity.velocity; + Vector2 arcPoint = arcPointBase + checkDirection.SafeNormalize(Vector2.Zero).RotatedBy(i) * arcRadius; + + bool collisionCheck = !Collision.CanHitLine(arcPointBase, 1, 1, arcPoint, 1, 1); + if (optionalCollisionCheckOverride is not null) + collisionCheck = optionalCollisionCheckOverride.Invoke(arcPointBase, arcPoint); + + if (collisionCheck) + return true; + } + + return false; + } + /// /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles. Gives up after a certain quantity of tiles, or when a world border is reached. /// /// The point to check from. /// The direction in which tiles are checked. Will always be a unit vector. - public static float? DistanceToTileCollisionHit(Vector2 startingPoint, Vector2 checkDirection, int giveUpLimit = 500) + /// An optional delegate function for overriding the base tile check logic with your own custom logic. + public static float? DistanceToTileCollisionHit(Vector2 startingPoint, Vector2 checkDirection, int giveUpLimit = 500, Func optionalTileCheckOverride = null) { // Ensure that the check direction is normalized. checkDirection = checkDirection.SafeNormalize(Vector2.Zero); @@ -78,12 +113,17 @@ namespace CalamityMod // Since Terraria's tile coordinate system is discrete and does not care for more advanced concepts, // the amount of tiles searched such far is a sufficient answer. Tile tile = ParanoidTileRetrieval(checkPosition.X, checkPosition.Y); - if (WorldGen.SolidTile(tile) || (checkDirection.Y >= 0f && tile.HasTile && Main.tileSolidTop[tile.TileType])) + bool validTileHasBeenHit = WorldGen.SolidTile(tile) || (checkDirection.Y >= 0f && tile.HasTile && Main.tileSolidTop[tile.TileType]); + if (optionalTileCheckOverride is not null) + validTileHasBeenHit = optionalTileCheckOverride.Invoke(tile); + + if (validTileHasBeenHit) return i; } return null; } + /// /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles, taking slopes into account. /// diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 0fc90e184c..c7659c381d 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -39,6 +39,20 @@ namespace CalamityMod new Color(199, 62, 62), }; + /// + /// A custom which subtracts overlapping colors instead of adding them.

+ /// This uses the same settings as the blending used for the Light's Bane projectile. + ///
+ public static readonly BlendState SubtractiveBlending = new() + { + ColorBlendFunction = BlendFunction.ReverseSubtract, + ColorDestinationBlend = Blend.One, + ColorSourceBlend = Blend.SourceAlpha, + AlphaBlendFunction = BlendFunction.ReverseSubtract, + AlphaDestinationBlend = Blend.One, + AlphaSourceBlend = Blend.SourceAlpha + }; + /// /// The transformation matrix used for drawing backgrounds in Vanilla Terraria. Should be used for any custom background drawing or CustomSky /// drawing, such as independent sky entities or background shader effects. diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 7dae35e350..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 @@ -275,7 +273,7 @@ namespace CalamityMod public static void AddRevBagAccessories(this ILoot loot) { var lcr = new LeadingConditionRule(If(() => CalamityWorld.revenge)); - lcr.Add(new OneFromOptionsDropRule(20, 1, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType())); + lcr.Add(new OneFromOptionsDropRule(20, 1, ModContent.ItemType(), ModContent.ItemType())); loot.Add(lcr); } @@ -888,6 +886,7 @@ namespace CalamityMod public static IItemDropRuleCondition PostExos(bool ui = true) => CalamityConditions.DownedExoMechs.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); public static IItemDropRuleCondition PostSCal(bool ui = true) => CalamityConditions.DownedSupremeCalamitas.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); public static IItemDropRuleCondition PostAEW(bool ui = true) => CalamityConditions.DownedPrimordialWyrm.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); + public static IItemDropRuleCondition PostHorribleHog(bool ui = true) => CalamityConditions.DownedHorribleHog.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); public static IItemDropRuleCondition PostClam(bool ui = true) => CalamityConditions.DownedClam.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); public static IItemDropRuleCondition PostClamHM(bool ui = true) => CalamityConditions.DownedBuffedClam.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); public static IItemDropRuleCondition PostGSS(bool ui = true) => CalamityConditions.DownedGreatSandShark.ToDropCondition(ui ? ShowItemDropInUI.Always : ShowItemDropInUI.Never); diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 848c00118a..de041faf9f 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -12,6 +12,7 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Systems.Collections; +using Terraria.GameInput; namespace CalamityMod { @@ -54,7 +55,7 @@ namespace CalamityMod if (Main.dedServ || mhk is null) return ""; - List keys = mhk.GetAssignedKeysOrEmpty(); + List keys = mhk.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode); if (keys.Count == 0) return GetText("Misc.HotkeyNotBound").Value; else @@ -109,6 +110,25 @@ namespace CalamityMod tooltips.FindAndReplace("[KEY]", finalKey); } + /// + /// Shortcut for automatically placing one keybind within a tooltip. Requires the "[KEY]" string to be replaced. + /// + /// The tooltip list provided to a ModifyTooltips TML hook. + /// The ModKeybind to integrate into the tooltip. + public static void IntegrateDynamicHotkey(this List tooltips, Item item) + { + if (Main.dedServ) + return; + + var mhk = item.GetDynamicModHotkey(); + + string finalKey = GetText("Misc.HotkeyNotEquipped").Value; + if (mhk is not null) + finalKey = mhk.TooltipHotkeyString(); + + tooltips.FindAndReplace("[KEY]", finalKey); + } + /// /// Shortcut method for adding "You have already consumed this item" tooltip /// diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index d1eab75448..40cebbd5b7 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -314,6 +314,8 @@ namespace CalamityMod try { + if (mode == InputMode.Mouse) + mode = InputMode.Keyboard; return keybind.GetAssignedKeys(mode); } catch diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index e18faa6de9..c5dbd5a42a 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -106,7 +106,7 @@ namespace CalamityMod NPCID.Sets.SpecificDebuffImmunity[npc.type][BuffID.Confused] = true; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. - bool isConsideredSpecialTarget = npc.type == NPCID.SkeletronHead || npc.type == NPCID.DD2EterniaCrystal; + bool isConsideredSpecialTarget = npc.type == NPCID.DD2EterniaCrystal; bool isTownNPC = npc.townNPC || NPCID.Sets.ActsLikeTownNPC[npc.type]; bool applyRegularBuffImmunitySpecialCases = isConsideredSpecialTarget || isTownNPC; if (applyRegularBuffImmunitySpecialCases) @@ -326,13 +326,17 @@ namespace CalamityMod { ModContent.NPCType(), sulphur }, { ModContent.NPCType(), sulphur }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, 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 diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 8d3a4e0e50..10a5088a9f 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -545,8 +545,11 @@ namespace CalamityMod player.immune = true; player.immuneNoBlink = !blink; if (cooldownSlot < 0) - player.immuneTime = frames; - else + { + if (player.immuneTime < frames) + player.immuneTime = frames; + } + else if (player.hurtCooldowns[cooldownSlot] < frames) player.hurtCooldowns[cooldownSlot] = frames; return true; @@ -577,7 +580,8 @@ namespace CalamityMod // Apply iframes thoroughly. Player.AddImmuneTime is not used because iframes should not exceed the intended amount. player.immune = true; player.immuneNoBlink = !blink; - player.immuneTime = frames; + if (player.immuneTime < frames) + player.immuneTime = frames; for (int i = 0; i < player.hurtCooldowns.Length; ++i) if (player.hurtCooldowns[i] < frames) player.hurtCooldowns[i] = frames; diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs new file mode 100644 index 0000000000..9c9f6ff2d6 --- /dev/null +++ b/Walls/EutrophicSandWall.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class EutrophicSandWall : ModWall + { + public override void SetStaticDefaults() + { + DustType = 108; + AddMapEntry(new Color(11, 56, 81)); + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].LiquidAmount == 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].Get().LiquidType = LiquidID.Water; + Main.tile[i, j].LiquidAmount = byte.MaxValue; + WorldGen.SquareTileFrame(i, j); + if (Main.dedServ) + NetMessage.sendWater(i, j); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} \ No newline at end of file diff --git a/Walls/EutrophicSandWall.png b/Walls/EutrophicSandWall.png new file mode 100644 index 0000000000..1e65f4f49e Binary files /dev/null and b/Walls/EutrophicSandWall.png differ diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs new file mode 100644 index 0000000000..cd8dfaf3ad --- /dev/null +++ b/Walls/EutrophicSandWallSafe.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class EutrophicSandWallSafe : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + DustType = 108; + AddMapEntry(new Color(11, 56, 81)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} \ No newline at end of file diff --git a/Walls/EutrophicSandWallSafe.png b/Walls/EutrophicSandWallSafe.png new file mode 100644 index 0000000000..b884b458fe Binary files /dev/null and b/Walls/EutrophicSandWallSafe.png differ diff --git a/Walls/LimestoneWall.cs b/Walls/LimestoneWall.cs index f6c40077db..a7a15cedd6 100644 --- a/Walls/LimestoneWall.cs +++ b/Walls/LimestoneWall.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; +using Terraria; namespace CalamityMod.Walls { @@ -10,6 +11,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = DustID.Pot; AddMapEntry(new Color(125, 85, 61)); this.AddMapEntryWithWaterVisibility(new Color(78, 76, 127)); diff --git a/Walls/NavyslateWall.cs b/Walls/NavyslateWall.cs index 5010e31098..1437881cfb 100644 --- a/Walls/NavyslateWall.cs +++ b/Walls/NavyslateWall.cs @@ -3,7 +3,6 @@ using Terraria.ModLoader; using Terraria.ID; namespace CalamityMod.Walls { - [LegacyName("EutrophicSandWall")] public class NavyslateWall : ModWall, IVisibleThroughWater { int IVisibleThroughWater.WaterMapEntry { get; set; } diff --git a/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs index a543900c4e..70952ffd8b 100644 --- a/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs +++ b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs @@ -15,11 +15,6 @@ namespace CalamityMod.Walls.UnsafeWalls public static Asset leafTexture = null; public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralGrassWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { diff --git a/Waters/FloralParadiseWater.cs b/Waters/FloralParadiseWater.cs deleted file mode 100644 index b51b2cbe5c..0000000000 --- a/Waters/FloralParadiseWater.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class FloralParadiseWaterflow : ModWaterfallStyle { } - - public class FloralParadiseWater : ModWaterStyle - { - public static int Type { get; private set; } - public static ModWaterStyle Instance { get; private set; } - - public override void SetStaticDefaults() - { - Type = Slot; - Instance = this; - } - - public override void Unload() - { - Type = -1; - Instance = null; - } - - public override int ChooseWaterfallStyle() - { - return ModContent.Find("CalamityMod/FloralParadiseWaterflow").Slot; - } - - public override int GetSplashDust() => DustID.Water; - public override int GetDropletGore() => GoreID.WaterDripCavern; - public override Color BiomeHairColor() => Color.PaleTurquoise; - } -} diff --git a/Waters/FloralParadiseWater.png b/Waters/FloralParadiseWater.png deleted file mode 100644 index 050b018ea8..0000000000 Binary files a/Waters/FloralParadiseWater.png and /dev/null differ diff --git a/Waters/FloralParadiseWater_Block.png b/Waters/FloralParadiseWater_Block.png deleted file mode 100644 index 0294eb4b3c..0000000000 Binary files a/Waters/FloralParadiseWater_Block.png and /dev/null differ diff --git a/Waters/FloralParadiseWater_Slope.png b/Waters/FloralParadiseWater_Slope.png deleted file mode 100644 index 2bd68c8094..0000000000 Binary files a/Waters/FloralParadiseWater_Slope.png and /dev/null differ diff --git a/Waters/FloralParadiseWaterflow.png b/Waters/FloralParadiseWaterflow.png deleted file mode 100644 index 6ac360d4b4..0000000000 Binary files a/Waters/FloralParadiseWaterflow.png and /dev/null differ diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 611b17cbc0..314132b000 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -6,6 +6,7 @@ using CalamityMod.Tiles.Crags.Lily; using CalamityMod.Tiles.Crags.Spike; using CalamityMod.Tiles.Crags.Tree; using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.Pylons; using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; @@ -266,6 +267,26 @@ namespace CalamityMod.World SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey2, new Point(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + //place the broken Crags Pylon + Point pylonPlace = new Point(GenVars.dungeonSide == 1 ? (biomeStart + biomeMiddle) / 2 : (biomeMiddle + biomeEdge) / 2, Main.maxTilesY - 150); + while (!Main.tile[pylonPlace].HasTile && pylonPlace.Y < Main.maxTilesY - 75) + pylonPlace.Y++; + if (!Main.tile[pylonPlace].HasTile) + Main.tile[pylonPlace].TileType = (ushort)ModContent.TileType(); + //make sure there's space to place it + for (int i = pylonPlace.X - 1; i <= pylonPlace.X + 1; i++) + { + for (int j = pylonPlace.Y - 4; j <= pylonPlace.Y; j++) + { + Tile t = Main.tile[i, j]; + if (j == pylonPlace.Y) + t.ResetToType(Main.tile[pylonPlace].TileType); + else + WorldGen.KillTile(i, j); + } + } + WorldGen.PlaceObject(pylonPlace.X, pylonPlace.Y - 1, ModContent.TileType()); + //lava clean up again for (int x = biomeStart; x <= biomeEdge; x++) { diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs index 67badca1ee..337a4e3d78 100644 --- a/World/CustomConditions.cs +++ b/World/CustomConditions.cs @@ -33,7 +33,7 @@ namespace CalamityMod.World public class SolidOrPlatform : GenCondition { - protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(x, y); + protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(Framing.GetTileSafely(x, y)); } public class IsNotTouchingAir : GenCondition diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index c2ff85acb2..1826053b78 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -921,6 +921,53 @@ namespace CalamityMod.World } } + // Places the "Lizard King" painting + int paintingAmt = Main.maxTilesX > 6400 ? Main.rand.Next(2, 4) : Main.maxTilesX > 4200 ? 2 : 1; + int paintingAttempts = 0; // Give up if all paintings cannot be placed after 10000 attempts + while (paintingAmt > 0 && paintingAttempts <= 10000) + { + paintingAttempts++; + int spotX = WorldGen.genRand.Next(templeLeft, templeRight); + int spotY = WorldGen.genRand.Next(templeTop, templeBottom); + if (Main.tile[spotX, spotY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[spotX, spotY].HasTile) + { + bool abortPlacement = false; + for (int i = -70; i <= 70; i++) + { + for (int j = -70; j <= 70; j++) + { + int checkSpotX = spotX + i; + int checkSpotY = spotY + j; + if (!WorldGen.InWorld(checkSpotX, checkSpotY, 5)) + continue; + + Tile tile = Main.tile[checkSpotX, checkSpotY]; + if (tile.HasTile) + { + if (tile.TileType == TileID.Painting3X3) + { + abortPlacement = true; + break; + } + if (i >= -4 && i <= 4 && j >= -4 && j <= 4 && tile.TileType == TileID.LihzahrdBrick) + { + abortPlacement = true; + break; + } + } + } + + if (abortPlacement) + break; + } + if (abortPlacement) + continue; + + if (WorldGen.PlaceTile(spotX, spotY, TileID.Painting3X3, true, false, -1, 88)) + paintingAmt--; + } + } + // Return wood spikes back to normal after the above placements are done. Main.tileSolid[TileID.WoodenSpikes] = true; } diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs deleted file mode 100644 index 182cc05cd1..0000000000 --- a/World/CustomUnderworld.cs +++ /dev/null @@ -1,2037 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Schematics; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Generation; -using Terraria.ID; -using Terraria.WorldBuilding; -using static CalamityMod.Schematics.SchematicManager; - -namespace CalamityMod.World -{ - public class CustomUnderworld - { - // Ash island variables - private const double AshIslandGenStart = 0.36; - private const double AshIslandGenStart_Remix = 0.38; - private const double AshIslandGenEnd = 0.64; - private const double AshIslandGenEnd_Remix = 0.62; - private const int AshIslandDepthMaxAboveTheUnderworldFloor = 135; - private const int AshIslandHeightMaxAboveTheUnderworldFloor = 160; - private const int MaxIslands = 8; - private const int SmallWorldIslands = 4; - private const int MediumWorldIslands = 6; - private const int LargeWorldIslands = MaxIslands; - private const int SmallWorldOuterIslands = 1; - private const int MediumAndLargeWorldOuterIslands = 2; - - // Wall variables - private const int MaxWallHeight = 68; - private const int RandomizedWallSectionHeight = 4; - private const int MaxWallDepthAboveUnderworldFloor = 40; - - public static void NewUnderworld() - { - // Generate lower Underworld ash - int ashMin = 160; - int ashMax = 190; - int ashDepth = Main.maxTilesY - WorldGen.genRand.Next(ashMin, ashMax); - for (int x = 0; x < Main.maxTilesX; x++) - { - ashDepth += WorldGen.genRand.Next(-3, 4); - if (ashDepth < Main.maxTilesY - ashMax) - ashDepth = Main.maxTilesY - ashMax; - - if (ashDepth > Main.maxTilesY - ashMin) - ashDepth = Main.maxTilesY - ashMin; - - for (int y = ashDepth - 20 - WorldGen.genRand.Next(3); y < Main.maxTilesY; y++) - { - if (y >= ashDepth) - { - Main.tile[x, y].Get().HasTile = false; - Main.tile[x, y].Get().LiquidType = LiquidID.Water; - } - else - Main.tile[x, y].TileType = TileID.Ash; - } - } - - // Generate lava - int lavaMin = 80; - int lavaMax = 90; - int lavaDepth = Main.maxTilesY - WorldGen.genRand.Next(lavaMin, lavaMax + 1); - int lavaMaxDepth = Main.maxTilesY - lavaMin; - int lavaMaxHeight = Main.maxTilesY - lavaMax; - for (int x = 10; x < Main.maxTilesX - 10; x++) - { - lavaDepth += WorldGen.genRand.Next(-5, 6); - if (lavaDepth > lavaMaxDepth) - lavaDepth = lavaMaxDepth; - - if (lavaDepth < lavaMaxHeight) - lavaDepth = lavaMaxHeight; - - for (int y = lavaDepth; y < Main.maxTilesY - 10; y++) - { - if (!Main.tile[x, y].HasTile) - { - Main.tile[x, y].Get().LiquidType = LiquidID.Lava; - Main.tile[x, y].LiquidAmount = byte.MaxValue; - } - } - } - - // Ash splotches - for (int x = 0; x < Main.maxTilesX; x++) - { - if (WorldGen.genRand.NextBool(50)) - { - int y = Main.maxTilesY - 65; - while (!Main.tile[x, y].HasTile && y > Main.maxTilesY - 135) - y--; - - WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), y + WorldGen.genRand.Next(20, 50), WorldGen.genRand.Next(15, 20), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); - } - } - - // Some cursed water function - Liquid.QuickWater(-2); - - // More Ash splotches - for (int x = 0; x < Main.maxTilesX; x++) - { - if (WorldGen.genRand.NextBool(13)) - { - int y = Main.maxTilesY - 65; - while ((Main.tile[x, y].LiquidAmount > 0 || Main.tile[x, y].HasTile) && y > Main.maxTilesY - 140) - y--; - - if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 30), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); - - double ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); - if (WorldGen.genRand.NextBool(3)) - ashSplotchSizeAdjustment *= 0.5; - - if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) - { - if (WorldGen.genRand.NextBool(2)) - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, 1D, 0.3); - - if (WorldGen.genRand.NextBool(2)) - { - ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, -1D, 0.3); - } - } - - WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(5, 10), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - if (WorldGen.genRand.NextBool(3)) - WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(10, 30), WorldGen.genRand.Next(10, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - - if (WorldGen.genRand.NextBool(5)) - WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 10), WorldGen.genRand.Next(15, 30), WorldGen.genRand.Next(5, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - } - } - - // Cursed lava placement tile runner, thanks redigit - for (int i = 0; i < Main.maxTilesX; i++) - WorldGen.TileRunner(WorldGen.genRand.Next(20, Main.maxTilesX - 20), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 7), -2); - - // Another cursed lava placement tile runner...seriously, why the fuck is this? - for (int i = 0; i < Main.maxTilesX * 2; i++) - WorldGen.TileRunner(WorldGen.genRand.Next((int)(Main.maxTilesX * 0.35), (int)(Main.maxTilesX * 0.65)), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(5, 20), WorldGen.genRand.Next(5, 10), -2); - - // Place two lines of lava at maxTilesY - 145 and maxTilesY - 144 - if (Main.zenithWorld) - { - for (int x = 0; x < Main.maxTilesX; x++) - { - if (!Main.tile[x, Main.maxTilesY - 145].HasTile) - { - Main.tile[x, Main.maxTilesY - 145].LiquidAmount = byte.MaxValue; - Main.tile[x, Main.maxTilesY - 145].Get().LiquidType = LiquidID.Lava; - } - - if (!Main.tile[x, Main.maxTilesY - 144].HasTile) - { - Main.tile[x, Main.maxTilesY - 144].LiquidAmount = byte.MaxValue; - Main.tile[x, Main.maxTilesY - 144].Get().LiquidType = LiquidID.Lava; - } - } - } - - // Place hellstone splotches - for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) - WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), WorldGen.genRand.Next(Main.maxTilesY - 140, Main.maxTilesY), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(3, 7), TileID.Hellstone); - - // Remix world stuff, the Ash islands in the middle - - // Start generating islands at this point - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); - - // Stop generating islands at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); - - // Ash island gen limits - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; - - // Multiple islands in non-remix - if (!WorldGen.remixWorldGen) - { - // Large = 8, Medium = 6, Small = 4 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - bool smallWorld = numIslands == SmallWorldIslands; - - // Total extra distance between islands for lava lakes - int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); - - // Extra distance per island - // Due to this being done on both sides of each island, it is divided by 2 - int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / 2; - - // Calculate distance between islands - int distanceBetweenIslands = (ashIslandX2 - ashIslandX) / numIslands; - - // Used for island height randomization - int minHeightForOuterIslands = 8; - int[] randomHeightAdjustmentLimits = new int[MaxIslands] - { - 28, - 24, - 20, - 16, - 12, - 8, - 4, - 0 - }; - - // Used for island edge drop off randomization - // Taller islands have steeper drop offs - // This is also used to decrease the width of the islands - int minDropOffForOuterIslands = 11; - int[] randomDropOffAdjustmentLimits = new int[MaxIslands] - { - 3, - 4, - 5, - 7, - 9, - 11, - 15, - 19 - }; - - // Loop to gen the islands - int chosenIslandSize; - int previouslyChosenIslandSize = -1; - for (int i = 0; i < numIslands; i++) - { - // Do not repeat the same island size twice in a row - do chosenIslandSize = WorldGen.genRand.Next(MaxIslands); - while (previouslyChosenIslandSize == chosenIslandSize); - previouslyChosenIslandSize = chosenIslandSize; - - int randomizedIslandDropOffAdjustment = randomDropOffAdjustmentLimits[chosenIslandSize]; - int randomizedIslandHeightAdjustment = randomHeightAdjustmentLimits[chosenIslandSize]; - - // Islands on the edges are taller in order to have more structures - bool isTallerIsland = smallWorld ? (i == 0 || i == numIslands - SmallWorldOuterIslands) : (i < MediumAndLargeWorldOuterIslands || i >= numIslands - MediumAndLargeWorldOuterIslands); - if (isTallerIsland && randomizedIslandHeightAdjustment > minHeightForOuterIslands) - { - randomizedIslandHeightAdjustment = minHeightForOuterIslands; - randomizedIslandDropOffAdjustment = minDropOffForOuterIslands; - } - - int randomizedAshIslandDepthLimit = ashIslandDepthLimit + randomizedIslandHeightAdjustment; - int randomizedAshIslandHeightLimit = ashIslandHeightLimit + randomizedIslandHeightAdjustment; - - int ashIslandXAdjustment = distanceBetweenIslands * i; - int ashIslandX2Adjustment = distanceBetweenIslands * (numIslands - i - 1); - - // Decrease the width of each island randomly - // Taller islands have a greater reduction in width - int randomWidthReduction_LeftSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); - int randomWidthReduction_RightSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); - int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; - int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands_PerIslandSide - randomWidthReduction_RightSide; - int ashIslandGenLimiter = Main.maxTilesY - 1; - bool ashIslandGenLimitHit = false; - Liquid.QuickWater(-2); - for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) - { - // Less random ash island terrain to make unmodified traversal less annoying - if (!ashIslandGenLimitHit) - { - // Steeper ash island edges - ashIslandGenLimiter -= WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); - if (ashIslandGenLimiter < randomizedAshIslandDepthLimit) - ashIslandGenLimitHit = true; - } - else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) - { - // Steeper ash island edges - ashIslandGenLimiter += WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); - if (ashIslandGenLimiter > Main.maxTilesY - 1) - ashIslandGenLimiter = Main.maxTilesY - 1; - } - else - { - if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) - { - // More randomized terrain depending on island type - // Lower islands have smoother terrain - // Islands on the edges have smoother terrain - if (isTallerIsland) - { - if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - } - else - { - switch (chosenIslandSize) - { - default: - case 0: - case 1: - if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - break; - - case 2: - case 3: - if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(9)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - - case 4: - case 5: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - - case 6: - case 7: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - } - } - } - - if (ashIslandGenLimiter < randomizedAshIslandHeightLimit) - ashIslandGenLimiter = randomizedAshIslandHeightLimit; - - if (ashIslandGenLimiter > randomizedAshIslandDepthLimit) - ashIslandGenLimiter = randomizedAshIslandDepthLimit; - } - - for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) - Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; - - for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) - { - Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); - Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; - Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; - } - } - - // This is necessary due to earlier calculations - int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; - int endX = ashIslandTilePlacementX2 + extraDistanceBetweenAshIslands_PerIslandSide * 2; - - // Small holes - double holeFrequency = 0.00005 / numIslands; - for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * holeFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); - - // Place smaller hellstone splotches in the ash island - // I don't want there to be too many here because I don't want to encourage players to destroy the environmental Wall of Flesh arena - double hellstoneFrequency = 0.0002 / numIslands; - for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * hellstoneFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); - } - } - else - { - int ashIslandTilePlacementX = ashIslandX; - int ashIslandTilePlacementX2 = ashIslandX2; - int ashIslandGenLimiter = Main.maxTilesY - 1; - bool ashIslandGenLimitHit = false; - Liquid.QuickWater(-2); - for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) - { - // Less random ash island terrain to make unmodified traversal less annoying - if (!ashIslandGenLimitHit) - { - // Steeper ash island edges - ashIslandGenLimiter -= WorldGen.genRand.Next(1, 4); - if (ashIslandGenLimiter < ashIslandDepthLimit) - ashIslandGenLimitHit = true; - } - else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) - { - // Steeper ash island edges - ashIslandGenLimiter += WorldGen.genRand.Next(1, 4); - if (ashIslandGenLimiter > Main.maxTilesY - 1) - ashIslandGenLimiter = Main.maxTilesY - 1; - } - else - { - if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) - { - if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-4, 5); - } - - if (ashIslandGenLimiter < ashIslandHeightLimit) - ashIslandGenLimiter = ashIslandHeightLimit; - - if (ashIslandGenLimiter > ashIslandDepthLimit) - ashIslandGenLimiter = ashIslandDepthLimit; - } - - for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) - Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; - - for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) - { - Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); - Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; - Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; - } - } - } - - // Generate a line of background walls from the approximate underworld lava line and down - int maxWallHeight = MaxWallHeight; - int randomizedWallSectionsHeight = RandomizedWallSectionHeight; - int maxWallTypes = 4; - int newWallTypeStart = maxWallHeight / maxWallTypes; - int maxWallDepth = Main.maxTilesY - MaxWallDepthAboveUnderworldFloor; - int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; - int cinderWallStartDepth = smoulderingStoneWallStartDepth + newWallTypeStart; - int emberWallStartDepth = cinderWallStartDepth + newWallTypeStart; - int magmaWallStartDepth = emberWallStartDepth + newWallTypeStart; - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = smoulderingStoneWallStartDepth; y < maxWallDepth; y++) - { - if (y < smoulderingStoneWallStartDepth + randomizedWallSectionsHeight) - { - switch (smoulderingStoneWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - } - } - else if (y < cinderWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - } - else if (y < cinderWallStartDepth + randomizedWallSectionsHeight) - { - switch (cinderWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - } - } - else if (y < emberWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - } - else if (y < emberWallStartDepth + randomizedWallSectionsHeight) - { - switch (emberWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - } - } - else if (y < magmaWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - } - else if (y < magmaWallStartDepth + randomizedWallSectionsHeight) - { - switch (magmaWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - } - } - else - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - } - } - - // Generate background walls in underworld tiles from Main.maxTilesY - 200 and down - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = Main.maxTilesY - 200; y <= smoulderingStoneWallStartDepth + randomizedWallSectionsHeight; y++) - { - // The placed wall must be surrounded by non-sloped, non-half brick full tiles, otherwise it won't look right - bool surroundedByFullTiles = false; - bool breakLoop = false; - - int indexStartX = x - 1; - if (indexStartX < 0) - indexStartX = 0; - - int indexEndX = x + 1; - if (indexEndX > Main.maxTilesX) - indexEndX = Main.maxTilesX; - - for (int surroundingTileIndexX = indexStartX; surroundingTileIndexX <= indexEndX; surroundingTileIndexX++) - { - if (breakLoop) - break; - - for (int surroundingTileIndexY = y - 1; surroundingTileIndexY <= y + 1; surroundingTileIndexY++) - { - if (Main.tile[surroundingTileIndexX, surroundingTileIndexY].HasTile && - !Main.tile[surroundingTileIndexX, surroundingTileIndexY].IsHalfBlock && - Main.tile[surroundingTileIndexX, surroundingTileIndexY].Slope == SlopeType.Solid) - { - surroundedByFullTiles = true; - } - else - { - surroundedByFullTiles = false; - breakLoop = true; - break; - } - } - } - - if (surroundedByFullTiles) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - } - } - - // More cursed magic water function - Liquid.QuickWater(-2); - - // Create grass on ash - for (int x = ashIslandX; x < ashIslandX2 + 15; x++) - { - for (int y = Main.maxTilesY - 300; y < ashIslandDepthLimit + 30; y++) - { - Main.tile[x, y].LiquidAmount = 0; - - if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && - (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || - !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || - !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || - !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) - Main.tile[x, y].TileType = TileID.AshGrass; - } - } - - // Obsidian and hellstone towers... - AddHellHouses(); - } - - public static void NewUnderworldStructures() - { - if (!WorldGen.remixWorldGen) - { - // Generate some structures on the ash islands - int ashIslandX = (int)((double)Main.maxTilesX * AshIslandGenStart); - int ashIslandX2 = (int)((double)Main.maxTilesX * AshIslandGenEnd); - bool cragsLocationIsLeft = GenVars.dungeonLocation < Main.maxTilesX / 2; - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; - - // Keep track of world size to adjust house distances - float houseDistanceMult = Main.maxTilesX / 4200f; - - // Large = 8, Medium = 6, Small = 4 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - - // Small and medium worlds get less structures - bool smallWorld = numIslands == SmallWorldIslands; - bool mediumWorld = numIslands == MediumWorldIslands; - bool largeWorld = numIslands == LargeWorldIslands; - - // Total extra distance between islands for lava lakes - int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); - - // Extra distance per island - // The right side looks better with half of this adjustment subtracted - int divisor = cragsLocationIsLeft ? 2 : 4; - int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / divisor; - - // Calculate distance between islands - int sideAdjustmentMultiplier = cragsLocationIsLeft ? 1 : -1; - int distanceBetweenStructures = (ashIslandX2 - ashIslandX) / numIslands; - int firstIslandWidth = distanceBetweenStructures + (extraDistanceBetweenAshIslands_PerIslandSide * sideAdjustmentMultiplier); - int firstStructureDistanceFromIslandEdge = firstIslandWidth / 2; - int distanceBetweenStructures_AfterFirstIsland = distanceBetweenStructures; - - // Pick an atrium type - // Small worlds get a random single atrium - // Medium and large worlds get a guaranteed shadow chest atrium and another random non-shadow chest atrium - string atriumMapKey; - int atriumType = smallWorld ? WorldGen.genRand.Next(3) : WorldGen.genRand.Next(2); - int numAtriums = smallWorld ? 1 : 2; - if (!smallWorld) - { - switch (atriumType) - { - default: - case 0: - atriumMapKey = BrimstoneAtriumType1Key; - break; - - case 1: - atriumMapKey = BrimstoneAtriumType3Key; - break; - } - } - else - { - switch (atriumType) - { - default: - case 0: - atriumMapKey = BrimstoneAtriumType1Key; - break; - - case 1: - atriumMapKey = BrimstoneAtriumType2Key; - break; - - case 2: - atriumMapKey = BrimstoneAtriumType3Key; - break; - } - } - var atriumSchematic = TileMaps[atriumMapKey]; - - // Pick stockade types - List stockades = new List(); - int numStockades = largeWorld ? 2 : 1; - int stockadeTypes = 4; - do - { - // Chose a random stockade to add to the list - int chosenStockade = WorldGen.genRand.Next(stockadeTypes); - - // Don't choose the same stockade twice - bool alreadyContainsThisStockadeType = stockades.Contains(chosenStockade); - - if (!alreadyContainsThisStockadeType) - stockades.Add(chosenStockade); - } - while (stockades.Count < numStockades); - - string[] stockadesToGenerate = new string[numStockades]; - for (int stockadeIndex = 0; stockadeIndex < numStockades; stockadeIndex++) - { - switch (stockades[stockadeIndex]) - { - default: - case 0: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType1Key; - break; - - case 1: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType2Key; - break; - - case 2: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType3Key; - break; - - case 3: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType4Key; - break; - } - } - - // Offsets for structures - int atriumOffsetY = 8; - - int cacheOffsetY = 45; - - int sanctumOffsetY = 65; - - int strongholdOffsetX = cragsLocationIsLeft ? 40 : 20; - int strongholdOffsetY = 3; - int secondStrongholdOffsetY = 5; - - int dungeonOffsetX = cragsLocationIsLeft ? 30 : 50; - int dungeonOffsetY = 4; - - int stockadeOffsetX = largeWorld ? strongholdOffsetX : 0; - int secondStockadeOffsetX = dungeonOffsetX; - int stockadeOffsetY = stockadesToGenerate[0] == BarbedStockadeType4Key ? -7 : 8; - - // Place structures - if (cragsLocationIsLeft) - { - // - // Place atriums - // - // Atrium location is on the crags side - int atriumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; - int atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - if (!smallWorld) - { - PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); - - // Move index further along to keep structures spread apart - atriumGenX += distanceBetweenStructures_AfterFirstIsland; - - // Reset the Y index - atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - // Placement point for the second atrium - atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - } - - if (atriumMapKey == BrimstoneAtriumType2Key) - PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - else - PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); - - // - // Place sanctums, strongholds, dungeons, and stockades - // - // All of these structures are on the demonic side - int sanctumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; - int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; - - int strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - int dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - int stockadeGenX = sanctumGenX - (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); - int stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX + stockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - Point strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + strongholdOffsetY); - Point dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); - Point stockadePlacementPoint = new Point(stockadeGenX + stockadeOffsetX, stockadeGenY + stockadeOffsetY); - if (largeWorld) - { - PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); - - // Reset the Y index for stockades - stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX - secondStockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - // Placement point for the second stockade - int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; - stockadePlacementPoint = new Point(stockadeGenX - secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); - } - if (!smallWorld) - { - PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); - - PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); - - PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); - - // Move index further along to keep structures spread apart - sanctumGenX -= distanceBetweenStructures_AfterFirstIsland; - - // Reset the Y index for strongholds - strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - // Placement point for the second stronghold - strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); - - // Reset the Y index for dungeons - dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - // Placement point for the second dungeon - dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); - - // Placement point for the second sanctum - sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - } - - // Large worlds have two stockades - string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; - PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); - - // Small worlds only have one sanctum - string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); - PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); - - // Small worlds only have one stronghold - string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; - PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); - - // Small worlds only have one dungeon - string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; - PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); - } - else - { - int atriumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; - int atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - if (!smallWorld) - { - PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); - - atriumGenX -= distanceBetweenStructures_AfterFirstIsland; - - atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - } - - if (atriumMapKey == BrimstoneAtriumType2Key) - PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - else - PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); - - Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); - - int sanctumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; - int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; - - int strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - int dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - int stockadeGenX = sanctumGenX + (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); - int stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX - stockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - Point strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + strongholdOffsetY); - Point dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); - Point stockadePlacementPoint = new Point(stockadeGenX - stockadeOffsetX, stockadeGenY + stockadeOffsetY); - if (largeWorld) - { - PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); - - // Reset the Y index for stockades - stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX + secondStockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - // Placement point for the second stockade - int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; - stockadePlacementPoint = new Point(stockadeGenX + secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); - } - if (!smallWorld) - { - PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); - - Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); - - PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); - - PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); - - Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); - - sanctumGenX += distanceBetweenStructures_AfterFirstIsland; - - strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); - - dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); - - sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - } - - string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; - PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); - - Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); - - string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); - PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); - - Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); - - string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; - PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); - - string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; - PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); - - Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); - } - - // Pick cache types - List caches = new List(); - int numCaches = largeWorld ? 8 : 4; // THIS NUMBER MUST BE EVEN!!! - int cacheTypes = 6; - int totalCachePositions = numCaches / 2; - do - { - // Chose a random cache to add to the list - int chosenCache = WorldGen.genRand.Next(cacheTypes); - - // Don't choose the same cache twice - bool alreadyContainsThisCacheType = caches.Contains(chosenCache); - - // Avoid an infinite loop by picking a random duplicate cache if the max is reached - bool pickRandomDuplicateCache = caches.Count >= cacheTypes; - if (pickRandomDuplicateCache) - pickRandomDuplicateCache = caches[caches.Count - totalCachePositions] != chosenCache; - - if (!alreadyContainsThisCacheType || pickRandomDuplicateCache) - caches.Add(chosenCache); - } - while (caches.Count < numCaches); - - // Chose random caches to not place - // 1 is not placed in a small/medium world - // 3 are not placed in a large world - List cachesToNotPlace = new List(); - int numCachesToNotPlace = largeWorld ? 3 : 1; - do - { - // Chose a random cache to add to the list - int chosenCache = WorldGen.genRand.Next(numCaches); - - // Don't choose the same cache twice - bool alreadyContainsThisCacheType = cachesToNotPlace.Contains(chosenCache); - if (!alreadyContainsThisCacheType) - cachesToNotPlace.Add(chosenCache); - } - while (cachesToNotPlace.Count < numCachesToNotPlace); - - // - // Place caches - // - int cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * numAtriums); - int cacheGenY = ashIslandDepthLimit + cacheOffsetY; - int randomAdjustmentX = 0; - int randomAdjustmentY = 0; - int minRandomX = -30; - int maxRandomX = -20; - int minRandomY = 15; - int maxRandomY = 20; - for (int cacheIndex = 0; cacheIndex < totalCachePositions; cacheIndex++) - { - randomAdjustmentX += WorldGen.genRand.Next(minRandomX, maxRandomX + 1); - randomAdjustmentX = (int)MathHelper.Clamp(randomAdjustmentX, minRandomX, maxRandomX); - randomAdjustmentY += WorldGen.genRand.Next(minRandomY, maxRandomY + 1); - randomAdjustmentY = (int)MathHelper.Clamp(randomAdjustmentY, minRandomY, maxRandomY); - - string cacheMapKey; - switch (caches[cacheIndex]) - { - default: - case 0: - cacheMapKey = BonescrapperCacheType1Key; - break; - - case 1: - cacheMapKey = BonescrapperCacheType2Key; - break; - - case 2: - cacheMapKey = BonescrapperCacheType3Key; - break; - - case 3: - cacheMapKey = BonescrapperCacheType4Key; - break; - - case 4: - cacheMapKey = BonescrapperCacheType5Key; - break; - - case 5: - cacheMapKey = BonescrapperCacheType6Key; - break; - } - - Point cachePlacementPoint = new Point(cacheGenX + randomAdjustmentX, cacheGenY + randomAdjustmentY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - - bool canPlaceEvenCache = true; - switch (cacheIndex) - { - default: - case 0: - canPlaceEvenCache = !cachesToNotPlace.Contains(0); - break; - - case 1: - canPlaceEvenCache = !cachesToNotPlace.Contains(2); - break; - - case 2: - canPlaceEvenCache = !cachesToNotPlace.Contains(4); - break; - - case 3: - canPlaceEvenCache = !cachesToNotPlace.Contains(6); - break; - } - - // Cache types 2, 3, and 6 have chests - if (canPlaceEvenCache) - { - if (cacheMapKey == BonescrapperCacheType2Key || cacheMapKey == BonescrapperCacheType3Key || cacheMapKey == BonescrapperCacheType6Key) - PlaceSchematic(cacheMapKey, cachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); - else - PlaceSchematic>(cacheMapKey, cachePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle cacheProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[cacheMapKey], cachePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(cacheProtectionArea, 5); - } - - string secondCacheMapKey; - switch (caches[cacheIndex + totalCachePositions]) - { - default: - case 0: - secondCacheMapKey = BonescrapperCacheType1Key; - break; - - case 1: - secondCacheMapKey = BonescrapperCacheType2Key; - break; - - case 2: - secondCacheMapKey = BonescrapperCacheType3Key; - break; - - case 3: - secondCacheMapKey = BonescrapperCacheType4Key; - break; - - case 4: - secondCacheMapKey = BonescrapperCacheType5Key; - break; - - case 5: - secondCacheMapKey = BonescrapperCacheType6Key; - break; - } - - bool canPlaceOddCache = true; - switch (cacheIndex) - { - default: - case 0: - canPlaceOddCache = !cachesToNotPlace.Contains(1); - break; - - case 1: - canPlaceOddCache = !cachesToNotPlace.Contains(3); - break; - - case 2: - canPlaceOddCache = !cachesToNotPlace.Contains(5); - break; - - case 3: - canPlaceOddCache = !cachesToNotPlace.Contains(7); - break; - } - - // Place second cache to the right of the first - if (canPlaceOddCache) - { - Point secondCachePlacementPoint = cachePlacementPoint + new Point(WorldGen.genRand.Next(60, 76), 0); - if (secondCacheMapKey == BonescrapperCacheType2Key || secondCacheMapKey == BonescrapperCacheType3Key || secondCacheMapKey == BonescrapperCacheType6Key) - PlaceSchematic(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); - else - PlaceSchematic>(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle cacheProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondCacheMapKey], secondCachePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(cacheProtectionArea2, 5); - } - - // Reset positions and move cache placement along the X axis - cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * (numAtriums + cacheIndex + 1)); - cacheGenY = ashIslandDepthLimit + cacheOffsetY; - } - } - } - - public static void AshTreesAndGrass() - { - // Start generating islands at this point - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); - - // Stop generating islands at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); - - // Ash island gen limits - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - - // Place ash trees - for (int x = ashIslandX; x < ashIslandX2 + 15; x++) - { - for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) - { - if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) - WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); - } - } - - // Drunk world ash grass and trees - if (WorldGen.drunkWorldGen) - { - for (int x = 25; x < Main.maxTilesX - 25; x++) - { - for (int y = Main.maxTilesY - 300; y < Main.maxTilesY - 100 + WorldGen.genRand.Next(-1, 2); y++) - { - if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && - (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || - !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || - !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || - !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) - Main.tile[x, y].TileType = TileID.AshGrass; - } - } - - for (int x = 25; x < Main.maxTilesX - 25; x++) - { - for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 50; y++) - { - if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) - WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); - } - } - } - } - - public static void PlaceGeyserTraps() - { - // Place Geyser Traps on ash islands - // These are only generated in the no-man's land central islands - if (!WorldGen.remixWorldGen) - { - // Large = 8, Medium = 6, Small = 4 - // No-man's land islands: Large = 4, Medium = 2, Small = 2 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - bool mediumWorld = numIslands == MediumWorldIslands; - - // Start generating traps at this point - int ashIslandX = (int)((double)Main.maxTilesX * (mediumWorld ? 0.453 : 0.43)); - - // Stop generating traps at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (mediumWorld ? 0.546 : 0.57)); - - // Small = 12.6 Medium = 19.2 Large = 25.2 - double trapFrequency = (double)Main.maxTilesX * 0.003; - if (WorldGen.noTrapsWorldGen) - trapFrequency = ((!WorldGen.tenthAnniversaryWorldGen && !WorldGen.notTheBees) ? (trapFrequency * 100D) : (trapFrequency * 5D)); - else if (WorldGen.getGoodWorldGen) - trapFrequency *= 1.5; - - if (Main.starGame) - trapFrequency *= Main.starGameMath(0.2); - - int maxTrapPlacementAttempts = 1150; - for (int trapIndex = 0; (double)trapIndex < trapFrequency; trapIndex++) - { - for (int trapIndex2 = 0; trapIndex2 < maxTrapPlacementAttempts; trapIndex2++) - { - int trapPlacementX = WorldGen.genRand.Next(ashIslandX, ashIslandX2); - int trapPlacementY = WorldGen.genRand.Next(Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor, Main.maxTilesY - 100); - - if (GeyserTraps(trapPlacementX, trapPlacementY)) - break; - } - } - } - } - - private static bool GeyserTraps(int geyserX, int geyserY) - { - int geyserPlacementY = geyserY; - - while (!WorldGen.SolidTile(geyserX, geyserPlacementY)) - { - geyserPlacementY++; - if (geyserPlacementY > Main.maxTilesY - 10) - return false; - } - - geyserPlacementY--; - - if (!WorldGen.InWorld(geyserX, geyserPlacementY, 3)) - return false; - - if (Main.tile[geyserX, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX, geyserPlacementY - 2].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY - 2].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY - 2].HasUnactuatedTile) - return false; - - if (Main.tile[geyserX + 1, geyserPlacementY].HasTile) - return false; - - // Only place on ash grass to avoid placing in the schematics - if (Main.tile[geyserX, geyserPlacementY + 1].TileType != TileID.AshGrass || - Main.tile[geyserX + 1, geyserPlacementY + 1].TileType != TileID.AshGrass) - return false; - - for (int k = geyserX; k <= geyserX + 1; k++) - { - int j2 = geyserPlacementY + 1; - if (!WorldGen.SolidTile(k, j2)) - return false; - } - - int geyserPlacementY2 = WorldGen.genRand.Next(2); - for (int l = 0; l < 2; l++) - { - Main.tile[geyserX + l, geyserPlacementY].Get().HasTile = true; - Main.tile[geyserX + l, geyserPlacementY].TileType = TileID.GeyserTrap; - Main.tile[geyserX + l, geyserPlacementY].TileFrameX = (short)(18 * l + 36 * geyserPlacementY2); - Main.tile[geyserX + l, geyserPlacementY].TileFrameY = 0; - } - - return true; - } - - private static void AddHellHouses() - { - // Original tower gen area was the outer quarters of the underworld - // New tower gen area is the outer thirds of the underworld - int towerGenArea = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.25 : 0.33)); - - // Generate towers - for (int i = 100; i < Main.maxTilesX - 100; i++) - { - if (i > towerGenArea && i < Main.maxTilesX - towerGenArea) - continue; - - int hellFortGenY = Main.maxTilesY - 40; - while (Main.tile[i, hellFortGenY].HasTile || Main.tile[i, hellFortGenY].LiquidAmount > 0) - hellFortGenY--; - - if (Main.tile[i, hellFortGenY + 1].HasTile) - { - ushort hellFortTileType = (ushort)WorldGen.genRand.Next(TileID.ObsidianBrick, TileID.HellstoneBrick + 1); - ushort wallType = WallID.HellstoneBrickUnsafe; - if (WorldGen.genRand.Next(5) > 0) - hellFortTileType = TileID.ObsidianBrick; - - if (hellFortTileType == TileID.ObsidianBrick) - wallType = WallID.ObsidianBrickUnsafe; - - if (WorldGen.getGoodWorldGen) - hellFortTileType = TileID.HellstoneBrick; - - // Place tower - WorldGen.HellFort(i, hellFortGenY, hellFortTileType, (byte)wallType); - - // Move index further along to keep towers spread apart - // Original min and max values were, respectively, 30 and 130 - // New min and max values are, respectively, 30 and 60 - i += WorldGen.genRand.Next(30, WorldGen.remixWorldGen ? 130 : 60); - - // Randomly add more distance between towers - // Original max value was 200 - // New max value is 50 - if (WorldGen.genRand.NextBool(10)) - i += WorldGen.genRand.Next(WorldGen.remixWorldGen ? 200 : 50); - } - } - - // Placing torches in towers - float torchAmountMult = Main.maxTilesX / 4200f; - for (int torchIndex = 0; (float)torchIndex < 200f * torchAmountMult; torchIndex++) - { - int attempts = 0; - bool placedTorch = false; - while (!placedTorch) - { - attempts++; - int x = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.2), (int)((double)Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(Main.maxTilesY - 300, Main.maxTilesY - 20); - if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.ObsidianBrick || Main.tile[x, y].TileType == TileID.HellstoneBrick)) - { - int xOffset = 0; - if (Main.tile[x - 1, y].WallType > WallID.None) - xOffset = -1; - else if (Main.tile[x + 1, y].WallType > WallID.None) - xOffset = 1; - - if (!Main.tile[x + xOffset, y].HasTile && !Main.tile[x + xOffset, y + 1].HasTile) - { - // Check if a torch has already been placed in this location - bool torchAlreadyPlaced = false; - for (int k = x - 8; k < x + 8; k++) - { - for (int l = y - 8; l < y + 8; l++) - { - if (Main.tile[k, l].HasTile && TileID.Sets.Torch[Main.tile[k, l].TileType]) - { - torchAlreadyPlaced = true; - break; - } - } - } - - // Place the torch - if (!torchAlreadyPlaced) - { - WorldGen.PlaceTile(x + xOffset, y, TileID.Torches, mute: true, forced: true, -1, 7); - placedTorch = true; - } - } - } - - if (attempts > 1000) - placedTorch = true; - } - } - - // Place furniture in the towers - double furnitureAmount = 4200000D / (double)Main.maxTilesX; - for (int furnitureIndex = 0; (double)furnitureIndex < furnitureAmount; furnitureIndex++) - { - int attempts = 0; - int furniturePlacementX = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); - int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - while ((Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) - { - furniturePlacementX = WorldGen.genRand.NextBool(2) ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - - attempts++; - if (attempts > 100000) - break; - } - - if (attempts > 100000 || (Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) - continue; - - for (; !WorldGen.SolidTile(furniturePlacementX, y) && y < Main.maxTilesY - 20; y++) - { - } - - y--; - int placementAdjustment = furniturePlacementX; - int placementAdjustment2 = furniturePlacementX; - while (!Main.tile[placementAdjustment, y].HasTile && WorldGen.SolidTile(placementAdjustment, y + 1)) - placementAdjustment--; - - placementAdjustment++; - for (; !Main.tile[placementAdjustment2, y].HasTile && WorldGen.SolidTile(placementAdjustment2, y + 1); placementAdjustment2++) - { - } - - placementAdjustment2--; - int placementSpaceLimit = placementAdjustment2 - placementAdjustment; - int x = (placementAdjustment2 + placementAdjustment) / 2; - if (Main.tile[x, y].HasTile || (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || !WorldGen.SolidTile(x, y + 1)) - continue; - - // Different styles of houses - int style = 16; - int style2 = 13; - int style3 = 14; - int style4 = 49; - int style5 = 4; - int style6 = 8; - int style7 = 15; - int style8 = 9; - int style9 = 10; - int style10 = 17; - int style11 = 25; - int style12 = 25; - int style13 = 23; - int style14 = 25; - int styleChoice = WorldGen.genRand.Next(13); - int sizeX = 0; - int sizeY = 0; - if (styleChoice == 0) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 1) - { - sizeX = 4; - sizeY = 3; - } - - if (styleChoice == 2) - { - sizeX = 3; - sizeY = 5; - } - - if (styleChoice == 3) - { - sizeX = 4; - sizeY = 6; - } - - if (styleChoice == 4) - { - sizeX = 3; - sizeY = 3; - } - - if (styleChoice == 5) - { - sizeX = 5; - sizeY = 3; - } - - if (styleChoice == 6) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 7) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 8) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 9) - { - sizeX = 3; - sizeY = 5; - } - - if (styleChoice == 10) - { - sizeX = 5; - sizeY = 3; - } - - if (styleChoice == 11) - { - sizeX = 2; - sizeY = 4; - } - - if (styleChoice == 12) - { - sizeX = 3; - sizeY = 3; - } - - // Check if there are any tiles in the way of furniture placement - for (int placementIndexX = x - sizeX; placementIndexX <= x + sizeX; placementIndexX++) - { - for (int placementIndexY = y - sizeY; placementIndexY <= y; placementIndexY++) - { - if (Main.tile[placementIndexX, placementIndexY].HasTile) - { - styleChoice = -1; - break; - } - } - } - - // Check if there is enough space to place furniture - if ((double)placementSpaceLimit < (double)sizeX * 1.75) - styleChoice = -1; - - switch (styleChoice) - { - case 0: - WorldGen.PlaceTile(x, y, TileID.Tables, mute: true, forced: false, -1, style2); - int candlePlacementX = WorldGen.genRand.Next(6); - if (candlePlacementX < 3) - WorldGen.PlaceTile(x + candlePlacementX, y - 2, TileID.Candles, mute: true, forced: false, -1, style12); - - if (!Main.tile[x, y].HasTile) - break; - - if (!Main.tile[x - 2, y].HasTile) - { - WorldGen.PlaceTile(x - 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - if (Main.tile[x - 2, y].HasTile) - { - Main.tile[x - 2, y].TileFrameX += 18; - Main.tile[x - 2, y - 1].TileFrameX += 18; - } - } - - if (!Main.tile[x + 2, y].HasTile) - WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 1: - WorldGen.PlaceTile(x, y, TileID.WorkBenches, mute: true, forced: false, -1, style3); - int candlePlacementX2 = WorldGen.genRand.Next(4); - if (candlePlacementX2 < 2) - WorldGen.PlaceTile(x + candlePlacementX2, y - 1, TileID.Candles, mute: true, forced: false, -1, style12); - - if (!Main.tile[x, y].HasTile) - break; - - if (WorldGen.genRand.NextBool()) - { - if (!Main.tile[x - 1, y].HasTile) - { - WorldGen.PlaceTile(x - 1, y, TileID.Chairs, mute: true, forced: false, -1, style); - if (Main.tile[x - 1, y].HasTile) - { - Main.tile[x - 1, y].TileFrameX += 18; - Main.tile[x - 1, y - 1].TileFrameX += 18; - } - } - } - else if (!Main.tile[x + 2, y].HasTile) - WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 2: - WorldGen.PlaceTile(x, y, TileID.Statues, mute: true, forced: false, -1, style4); - break; - - case 3: - WorldGen.PlaceTile(x, y, TileID.Bookcases, mute: true, forced: false, -1, style5); - break; - - case 4: - - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); - Main.tile[x, y].TileFrameX += 18; - Main.tile[x, y - 1].TileFrameX += 18; - } - else - WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 5: - if (WorldGen.genRand.NextBool()) - WorldGen.Place4x2(x, y, TileID.Beds, 1, style6); - else - WorldGen.Place4x2(x, y, TileID.Beds, -1, style6); - break; - - case 6: - WorldGen.PlaceTile(x, y, TileID.Pianos, mute: true, forced: false, -1, style7); - break; - - case 7: - WorldGen.PlaceTile(x, y, TileID.Dressers, mute: true, forced: false, -1, style8); - break; - - case 8: - WorldGen.PlaceTile(x, y, TileID.Benches, mute: true, forced: false, -1, style9); - break; - - case 9: - WorldGen.PlaceTile(x, y, TileID.GrandfatherClocks, mute: true, forced: false, -1, style10); - break; - - case 10: - if (WorldGen.genRand.NextBool()) - WorldGen.Place4x2(x, y, TileID.Bathtubs, 1, style14); - else - WorldGen.Place4x2(x, y, TileID.Bathtubs, -1, style14); - break; - - case 11: - WorldGen.PlaceTile(x, y, TileID.Lamps, mute: true, forced: false, -1, style13); - break; - - case 12: - WorldGen.PlaceTile(x, y, TileID.Candelabras, mute: true, forced: false, -1, style11); - break; - } - } - - // Place paintings in the towers - furnitureAmount = 420000D / (double)Main.maxTilesX; - for (int paintingIndex = 0; (double)paintingIndex < furnitureAmount; paintingIndex++) - { - int attempts = 0; - int x = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); - int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - while ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile) - { - x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - - attempts++; - if (attempts > 100000) - break; - } - - if (attempts > 100000) - continue; - - int paintingPlacementX = x; - int paintingPlacementX2 = x; - int paintingPlacementY = y; - int paintingPlacementY2 = y; - int sizeY = 0; - for (int num32 = 0; num32 < 2; num32++) - { - paintingPlacementX = x; - paintingPlacementX2 = x; - while (!Main.tile[paintingPlacementX, y].HasTile && (Main.tile[paintingPlacementX, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX, y].WallType == WallID.ObsidianBrickUnsafe)) - paintingPlacementX--; - - paintingPlacementX++; - for (; !Main.tile[paintingPlacementX2, y].HasTile && (Main.tile[paintingPlacementX2, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX2, y].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementX2++) - { - } - - paintingPlacementX2--; - x = (paintingPlacementX + paintingPlacementX2) / 2; - paintingPlacementY = y; - paintingPlacementY2 = y; - while (!Main.tile[x, paintingPlacementY].HasTile && (Main.tile[x, paintingPlacementY].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY].WallType == WallID.ObsidianBrickUnsafe)) - paintingPlacementY--; - - paintingPlacementY++; - for (; !Main.tile[x, paintingPlacementY2].HasTile && (Main.tile[x, paintingPlacementY2].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY2].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementY2++) - { - } - - paintingPlacementY2--; - y = (paintingPlacementY + paintingPlacementY2) / 2; - } - - // Clamp this due to out of bounds errors - y = (int)MathHelper.Clamp(y, 1, Main.maxTilesY - 1); - - paintingPlacementX = x; - paintingPlacementX2 = x; - while (!Main.tile[paintingPlacementX, y].HasTile && !Main.tile[paintingPlacementX, y - 1].HasTile && !Main.tile[paintingPlacementX, y + 1].HasTile) - { - paintingPlacementX--; - - // Ensure we don't get out of bounds errors - if (paintingPlacementX < 0) - { - paintingPlacementX = 0; - break; - } - } - - paintingPlacementX++; - for (; !Main.tile[paintingPlacementX2, y].HasTile && !Main.tile[paintingPlacementX2, y - 1].HasTile && !Main.tile[paintingPlacementX2, y + 1].HasTile; paintingPlacementX2++) - { - } - - paintingPlacementX2--; - paintingPlacementY = y; - paintingPlacementY2 = y; - while (!Main.tile[x, paintingPlacementY].HasTile && !Main.tile[x - 1, paintingPlacementY].HasTile && !Main.tile[x + 1, paintingPlacementY].HasTile) - paintingPlacementY--; - - paintingPlacementY++; - for (; !Main.tile[x, paintingPlacementY2].HasTile && !Main.tile[x - 1, paintingPlacementY2].HasTile && !Main.tile[x + 1, paintingPlacementY2].HasTile; paintingPlacementY2++) - { - } - - paintingPlacementY2--; - x = (paintingPlacementX + paintingPlacementX2) / 2; - y = (paintingPlacementY + paintingPlacementY2) / 2; - int sizeX = paintingPlacementX2 - paintingPlacementX; - sizeY = paintingPlacementY2 - paintingPlacementY; - if (sizeX <= 7 || sizeY <= 5) - continue; - - if (!WorldGen.nearPicture2(x, y)) - { - PaintingEntry paintingEntry = WorldGen.RandHellPicture(); - if (!WorldGen.nearPicture(x, y)) - WorldGen.PlaceTile(x, y, paintingEntry.tileType, mute: true, forced: false, -1, paintingEntry.style); - } - } - - // An array used for banner styles - int[] bannerArray = new int[3] - { - WorldGen.genRand.Next(16, 22), - WorldGen.genRand.Next(16, 22), - WorldGen.genRand.Next(16, 22) - }; - - while (bannerArray[1] == bannerArray[0]) - bannerArray[1] = WorldGen.genRand.Next(16, 22); - - while (bannerArray[2] == bannerArray[0] || bannerArray[2] == bannerArray[1]) - bannerArray[2] = WorldGen.genRand.Next(16, 22); - - // Place hanging tiles - furnitureAmount = 420000D / (double)Main.maxTilesX; - for (int hangingTileIndex = 0; (double)hangingTileIndex < furnitureAmount; hangingTileIndex++) - { - int attempts = 0; - int x; - int y; - do - { - x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - attempts++; - } - while (attempts <= 100000 && ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile)); - - if (attempts > 100000) - continue; - - while (!WorldGen.SolidTile(x, y) && y > 10) - y--; - - y++; - if (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) - continue; - - int hangingTileType = WorldGen.genRand.Next(3); - int chandelierStyle = 32; - int lanternStyle = 32; - int hangingTileSizeX; - int hangingTileSizeY; - switch (hangingTileType) - { - default: - hangingTileSizeX = 1; - hangingTileSizeY = 3; - break; - case 1: - hangingTileSizeX = 3; - hangingTileSizeY = 3; - break; - case 2: - hangingTileSizeX = 1; - hangingTileSizeY = 2; - break; - } - - for (int placementIndexX = x - 1; placementIndexX <= x + hangingTileSizeX; placementIndexX++) - { - for (int placementIndexY = y; placementIndexY <= y + hangingTileSizeY; placementIndexY++) - { - Tile tile = Main.tile[x, y]; - if (placementIndexX < x || placementIndexX == x + hangingTileSizeX) - { - if (tile.HasTile) - { - switch (tile.TileType) - { - case TileID.ClosedDoor: - case TileID.OpenDoor: - case TileID.Chandeliers: - case TileID.HangingLanterns: - case TileID.Banners: - hangingTileType = -1; - break; - } - } - } - else if (tile.HasTile) - hangingTileType = -1; - } - } - - switch (hangingTileType) - { - case 0: - WorldGen.PlaceTile(x, y, TileID.Banners, mute: true, forced: false, -1, bannerArray[WorldGen.genRand.Next(3)]); - break; - case 1: - WorldGen.PlaceTile(x, y, TileID.Chandeliers, mute: true, forced: false, -1, chandelierStyle); - break; - case 2: - WorldGen.PlaceTile(x, y, TileID.HangingLanterns, mute: true, forced: false, -1, lanternStyle); - break; - } - } - } - - private static void FillAtriumChests(Chest chest, int Type, bool place) - { - int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); - int shadowChestItems2 = Utils.SelectRandom(WorldGen.genRand, ItemID.HellMinecart, ItemID.OrnateShadowKey, ItemID.HellCake); - List contents = new List() - { - new ChestItem(shadowChestItems, 1), - new ChestItem(shadowChestItems2, 1), - new ChestItem(ItemID.ObsidianSkinPotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.LifeforcePotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.TeleportationPotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(3, 6)), - }; - - for (int i = 0; i < contents.Count; i++) - { - chest.item[i].SetDefaults(contents[i].Type); - chest.item[i].Prefix(-1); - chest.item[i].stack = contents[i].Stack; - } - } - - private static void FillCacheChests(Chest chest, int Type, bool place) - { - int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); - int barTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.MeteoriteBar, GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar); - int ammoTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.HellfireArrow, GenVars.silverBar == TileID.Silver ? ItemID.SilverBullet : ItemID.TungstenBullet); - int potionTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.ManaRegenerationPotion, ItemID.MagicPowerPotion, ItemID.InvisibilityPotion, ItemID.HunterPotion, ItemID.HeartreachPotion); - int potionTypes2 = Utils.SelectRandom(WorldGen.genRand, ItemID.GravitationPotion, ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.BattlePotion, ItemID.InfernoPotion); - int potionTypes3 = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.PotionOfReturn); - int lightSourceTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.Torch, ItemID.Glowstick); - List contents = new List() - { - new ChestItem(shadowChestItems, 1), - new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(1, 3)), - new ChestItem(barTypes, WorldGen.genRand.Next(15, 31)), - new ChestItem(ammoTypes, WorldGen.genRand.Next(50, 76)), - new ChestItem(ItemID.RestorationPotion, WorldGen.genRand.Next(15, 21)), - new ChestItem(potionTypes, WorldGen.genRand.Next(1, 3)), - new ChestItem(potionTypes2, WorldGen.genRand.Next(1, 3)), - new ChestItem(potionTypes3, WorldGen.genRand.Next(1, 3)), - new ChestItem(lightSourceTypes, WorldGen.genRand.Next(15, 31)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 5)), - }; - - for (int i = 0; i < contents.Count; i++) - { - chest.item[i].SetDefaults(contents[i].Type); - chest.item[i].Prefix(-1); - chest.item[i].stack = contents[i].Stack; - } - } - } -} diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index b4441f1453..cd940120f8 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -307,7 +307,7 @@ namespace CalamityMod.World #region Sunken Sea Lab - public static void FillSunkenSeaLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic) + public static void FillSunkenSeaLaboratoryChest(Chest chest, int type, bool notFirstChest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() @@ -324,7 +324,7 @@ namespace CalamityMod.World //Adds the Planetoid Seeking Mechanism contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - if (!hasPlacedLogAndSchematic) + if (notFirstChest) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); @@ -396,7 +396,7 @@ namespace CalamityMod.World #endregion #region Ice Lab - public static void FillIceLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic) + public static void FillIceLaboratoryChest(Chest chest, int type, bool notFirstChest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() @@ -413,7 +413,7 @@ namespace CalamityMod.World //Adds the Base Seeking Mechanism contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - if (!hasPlacedLogAndSchematic) + if (notFirstChest) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 1f37a9c1d9..6f293816e3 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Food; +using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.FurnitureAuric; @@ -564,5 +565,36 @@ namespace CalamityMod.World } } #endregion + + #region Iron Ball + public static void GenerateIronBall() + { + int ballID = ModContent.TileType(); + int attempts = 0; + int ballsPlaced = 0; + int worldSize = WorldGen.GetWorldSize(); + // Same amount as Chillet + int maxBalls = worldSize switch + { + 1 => 9, + 2 => 12, + _ => 6, + }; + while (attempts < 10000) + { + Point location = new Point(WorldGen.genRand.Next(100, Main.maxTilesX - 100), WorldGen.genRand.Next((int)Main.rockLayer, Main.UnderworldLayer)); + Tile t = CalamityUtils.ParanoidTileRetrieval(location.X, location.Y); + Tile above = CalamityUtils.ParanoidTileRetrieval(location.X, location.Y - 1); + if (t.TileType == TileID.Stone && t.HasTile && !above.HasTile) + { + WorldGen.SlopeTile(location.X, location.Y); + WorldGen.PlaceTile(location.X, location.Y - 1, ballID); + ballsPlaced++; + } + if (ballsPlaced >= maxBalls) + break; + } + } + #endregion } } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 5359115d0b..0bcb66de9c 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; -using CalamityMod.Utilities; using CalamityMod.Walls; -using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -15,2410 +14,765 @@ namespace CalamityMod.World { public class SunkenSea { - - internal static class SSOffsets + private struct Hub { - public static int TimelessShoresX = 0, TimelessShoresY = 0; - public static int RadiantReefsX = 0, RadiantReefsY = 55; - public static int PolypForestX = 0, PolypForestY = 30; - public static int GleamingBurrowsX = 0, GleamingBurrowsY = 75; - public static int ClamDenX = 0, ClamDenY = 75; - public static int BasaltGullyX = 0, BasaltGullyY = 15; - public static int GlobalX = 0, GlobalY = -20; - } - static bool IsAirOrDecor(int x, int y) - { - if (y <= 0 || y >= Main.maxTilesY - 1 || x <= 0 || x >= Main.maxTilesX - 1) - return true; // out-of-bounds above counts as clear + public Vector2 Position; - Tile t = Main.tile[x, y]; - if (!t.HasTile) - return true; - - int type = t.TileType; - - // blockers (full blocks / slopes / platforms) - if (WorldGen.SolidOrSlopedTile(x, y)) return false; // solid/half/sloped - if (Main.tileSolidTop[type]) return false; // platforms & similar - - // ambient stuff - if (Main.tileFrameImportant[type] && !Main.tileSolid[type]) return true; // pots, cactus, decor - if (Main.tileCut[type]) return true; // grass/vines/etc. - if (TileID.Sets.BreakableWhenPlacing[type]) return true; // tiny plants, etc. - - return false; - } - - static bool ColumnClearOrDecor(int x, int groundY, int tilesUp) - { - for (int k = 1; k <= tilesUp; k++) + public Hub(Vector2 position) { - if (!IsAirOrDecor(x, groundY - k)) - return false; - } - return true; - } - /* - checklist: - -Make sunken sea walls produce water - cut a half oval out of the top of forest in anticipation of structure placement - */ - - public static void ParallelFor(int fromInclusive, int toExclusive, int step, Action action) - { - FasterParallel.For(fromInclusive, toExclusive, (start, end, _) => - { - for (int i = start; i < end; i += step) - action.Invoke(i); - }); - } - - public static void PlaceTimelessShores(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.TimelessShoresX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.TimelessShoresY; - - int biomeSize = 250 + (Main.maxTilesX / 180); - - int XLeft = GenVars.UndergroundDesertLocation.Left; - - int XRight = GenVars.UndergroundDesertLocation.Right; - - const int totalCuveDepth = 90; - // this converts basalt to runestone directy in line to the desert to make the shape look perfect to blend well with the rest of the desert - ParallelFor(XLeft, XRight, 20, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); - - for (int y = startY + 100; y >= startY - 175; y -= 15) - { - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Rectangle(20, 20), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - } - }); - // - // Makes the bottom borders of the Timeless Shores curved downwards. - // - ParallelFor(startX - biomeSize, startX - biomeSize + 200, 10, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, x, true))); - for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) - { - ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] - { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle) - })); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); - } - }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize, 5, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, x, true))); - for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) - { - ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] - { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle) - })); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); - } - }); - - // Clears out a curved cavity inside the timeless shores, this creates the main large open space inside the biome - ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); - - int random = WorldGen.genRand.Next(-40, 10); - for (int Y = startY - 25 + curveDepth + curveDepth2; Y <= startY + 50; Y++) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10), 5), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y + random), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear() - })); - } - }); - - // - // Places slopes at the sides of the shores to actually make shores. - // - ParallelFor(startX - biomeSize - 85, startX - biomeSize + 200, 20, (moundX) => - { - int RandomX = Main.rand.Next(15, 20); - ShapeData mound = new(); - GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize, startX - biomeSize + 200, moundX))); - - WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); - }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize + 85, 20, (moundX) => - { - ShapeData mound = new(); - GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize, startX + biomeSize - 200, moundX))); - - WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); - }); - - - // - // Makes a large platform in the middle of the Timeless Shores. - // - const int platformSize = 130; - const int platformHeight = 35; // Remember that because of Terraria's coordinate system, making it lower actually makes it higher. - const int platformDepth = 35; // How deep it goes. Like above, the higher it is, the lower it goes. - ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 5, (platformX) => - { - // This makes the "stem" of the platform be thinner towards the base and then expand on the top. - int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; - for (int platformY = startY + platformHeight; platformY <= startY + thickness; platformY++) - { - WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] - { - // Clear all tiles and place tiles. - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } - }); - // - // Makes the platform have a curve on top - // - ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 1, (x) => - { - float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, x, true)); - int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); - WorldUtils.Gen(new Point(x, startY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); - }); - - // Plateau - ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPlateauX) => - { - int randomDisplacement = WorldGen.genRand.Next(-46, -27); - int RandomX = Main.rand.Next(7, 15); - int RandomH = Main.rand.Next(15, 25); - - for (int wallPlateauY = startY + RandomH; wallPlateauY <= startY + 60; wallPlateauY += 10) - { - // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int PlateauWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPlateauY)) * 25); - - ShapeData Circle = new ShapeData(); - GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) - { - WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 2, randomDisplacement + wallPlateauY), new Shapes.Circle(RandomH - PlateauWidth + 3, RandomX), Actions.Chain(new GenAction[] - { - blotchFilter.Output(Circle) - })); - - WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 4, randomDisplacement + wallPlateauY), new ModShapes.All(Circle), Actions.Chain(new GenAction[] - { - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })) - ; - } - } - - } - ); - - //Poop emote for gfb - //ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPillarX) => - //{ - // int randomDisplacement = WorldGen.genRand.Next(-46, -27); - // int RandomX = Main.rand.Next(7, 15); - // int RandomH = Main.rand.Next(15, 25); - - // for (int wallPillarY = startY + RandomH; wallPillarY <= startY + 60; wallPillarY += 10) - // { - // // Along the height of the pillar, it becomes shorter the more closer to the center we get. - // int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPillarY)) * 25); - - // ShapeData rectangle = new ShapeData(); - // GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - // GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 30, startY + 70, wallPillarY) + 0.25, 1)); - // if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) - // { - // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, randomDisplacement + wallPillarY), new Shapes.Circle(RandomH - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] - // { - // // Applies a blotch filter to the rectangle. - // blotchFilter.Output(rectangle) - // })); - - // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, randomDisplacement + wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - // { - // new Actions.SetTile((ushort)ModContent.TileType()) - // })) - // ; - // } - // } - - //} - //); - - //place water below the clear barrier for the islands so that theres water inbetween them - ParallelFor(startX - biomeSize + 35, startX + biomeSize - 35, 1, (WaterX) => - { - for (int WaterY = startY + 37; WaterY <= startY + 60; WaterY++) - { - Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; - Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; - } - }); - - // - // Generates pillars made out of walls at random points in the Timeless Shores. - // - const int furthestDistanceFromCenter = 100; - ParallelFor(startX - (biomeSize / 2) - furthestDistanceFromCenter, startX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => - { - int randomDisplacementX = WorldGen.genRand.Next(-25, 25); - int RandomX = Main.rand.Next(3, 6); - - for (int wallPillarY = startY - 75; wallPillarY <= startY + 80; wallPillarY += 10) - { - // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - 75, startY + 50, wallPillarY)) * 25); - - ShapeData rectangle = new ShapeData(); - GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); - GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 40, startY + 70, wallPillarY) + 0.25, 1)); - - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] - { - ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. - blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. - })); - - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - { - new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. - })) - ; - } - }); - - // places wall flowers in the curved cavity inside the timeless shores. This is done here to prevent them from appearing in the transiton area - ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); - - for (int Y = startY - 60 + curveDepth + curveDepth2; Y <= startY + 30; Y++) - { - int Rand3() => WorldGen.genRand.Next(3); - int ShoresFlowerVariants = Rand3(); - - if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 3, 3)) - { - if (WorldGen.genRand.NextBool(60)) - { - WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); - } - } - - if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 2, 2)) - { - if (WorldGen.genRand.NextBool(60)) - WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); - } - } - }); - - // - // Makes the transition area to the Timeless Shores. - // Replaces tiles, walls, and places some water spots. - // - ParallelFor(startX - biomeSize - 15, startX + biomeSize + 30, 20, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); - - for (int y = startY - 5; y >= startY - 149; y -= 15) - { - float interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - - //WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - //{ - // new Modifiers.OnlyTiles(TileID.Sand), - // new Actions.ClearTile(), - // new Actions.PlaceTile((ushort)ModContent.TileType()), - // new Actions.PlaceWall((ushort)ModContent.WallType()) - //})); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.HardenedSand, TileID.Sand,TileID.Copper,TileID.Tin, TileID.Iron, TileID.Lead), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.DesertFossil,TileID.Tungsten,TileID.Silver,TileID.Gold,TileID.Platinum,TileID.Demonite,TileID.Crimtane), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.RollingCactus), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 200, y, true); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), - new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.Sandstone), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyWalls((ushort)ModContent.WallType()), - new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) - WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); - - if (WorldGen.genRand.NextBool(5) && y < startY - 100) - { - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new GenAction[] - { - new Modifiers.IsNotSolid().Output(new()), - new Actions.SetLiquid(), - })); - } - } - - // Place layer of sand on valid runestone blocks. - for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) - { - for (int Y = startY - 100; Y <= startY + 100; Y++) - { - bool canPlaceSand = Main.tile[X, Y].TileType == ModContent.TileType() && ColumnClearOrDecor(X, Y, 5); - - if (canPlaceSand) - { - if (Main.tile[X, Y - 1].WallType == WallID.None) - { - WorldGen.KillWall(X, Y); - } - PlaceSand(X, Y, 5, ModContent.TileType()); - } - - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - - } - } - - // Slope tiles - for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) - { - for (int Y = startY - 300; Y <= startY + 200; Y++) - { - Tile.SmoothSlope(X, Y); - } - } - }); - } - - // Sides of the sunken sea (radiant reefs) - public static void PlaceRadiantReefs(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.RadiantReefsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.RadiantReefsY; - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 280 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 50f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Shellstone = (ushort)ModContent.TileType(); - ushort ShellstoneWall = (ushort)ModContent.WallType(); - - // Generate the actual caverns - bool runOnce = false; // This is used to make the wall on the left side go boom on the second run - for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - Tile t = Main.tile[X, Y]; - float percent = dist / constant; - float blurPercent = 0.99f; - if (percent > blurPercent) - { - // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - if (!runOnce) - { - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, true, 0f, 0f, true, true); - t.WallType = ShellstoneWall; - runOnce = true; - } - - // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - if (runOnce) - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, false, 0f, 0f, true, true); - t.WallType = ShellstoneWall; - } - else - { - // Clear absolutely everything before generating the caverns - t.ClearEverything(); - - // Generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.380f; - - // Kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Shellstone; - t.HasTile = true; - } - - // Place walls in the biome using a different "seed" so it differs from the cave generation - // This creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 2, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = ShellstoneWall; - } - - if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) - WorldGen.KillTile(X, Y); - - t.Get().LiquidType = LiquidID.Water; - t.LiquidAmount = byte.MaxValue; - } - } - } + Position = position; } - // Cleanup - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) + public Hub(float x, float y) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - } - } - } - - // Place layer of sand blocks on valid surfaces - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - bool canPlaceSand = - Main.tile[X, Y].TileType == ModContent.TileType() && - !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && - !Main.tile[X, Y - 5].HasTile; - - // Place sand clumps on top of exposed shellstone - if (canPlaceSand) - PlaceSand(X, Y, 5, ModContent.TileType()); - } - } - } - - // Cleanup again - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - - // If any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } + Position = new Vector2(x, y); } } - // Middle of the sunken sea (polyp forest) - public static void PlacePolypForest(int startPosX, int startPosY) + private class Cluster : List { - - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.PolypForestX; - - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.PolypForestY; - - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY - 200); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 150 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Limestone = (ushort)ModContent.TileType(); - ushort LimestoneWall = (ushort)ModContent.WallType(); - - // Place the polyp forest caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) - { - Tile t = Main.tile[X, Y]; - // Modify this part so that the generation happens from bottom to top - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - float percent = dist / constant; - float blurPercent = 0.98f; - - // Biome "blending" on the edges (disabled for now) - if (percent > blurPercent) - { - - if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - //ShapeData circle = new ShapeData(); - //GenAction blotchMod = new Modifiers.Blotches(4, 0.7); - //WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - //{ - // blotchMod.Output(circle) - //})); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Limestone; - t.HasTile = true; - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.3f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = LimestoneWall; - } - - if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) - { - if (t.WallType == WallID.None) - t.WallType = (ushort)ModContent.WallType(); - } - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - //cleanup - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed limestone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - - } - } - } - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - bool canPlaceGrass = false; - - //place grass on top of exposed sand - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceGrass = true; - } - - if (canPlaceGrass) - { - PlaceSand(X, Y, 0, ModContent.TileType()); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(25) && !Main.tile[X - 1, Y].HasTile) - { - ushort[] Soil = new ushort[] { (ushort)ModContent.TileType() }; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Soil)) - })); - - } - } - } - } - - - //cleanup again - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - //bottom of the biome (gleaming burrows) - public static void PlaceGleamingBurrowsGeodes(int startPosX, int startPosY) - - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 220 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Navystone = (ushort)ModContent.TileType(); - ushort NavystoneWall = (ushort)ModContent.WallType(); - - - - //cleanup again, also place geodes - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //place geodes - if (WorldGen.genRand.NextBool(800) && Main.tile[X, Y].TileType == ModContent.TileType()) - { - PlaceGeode(X, Y, WorldGen.genRand.Next(10, 17)); - } - - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - public static void PlaceGleamingBurrows(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 220 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Navystone = (ushort)ModContent.TileType(); - ushort NavystoneWall = (ushort)ModContent.WallType(); - - int XStart = origin.X - biomeSize - 3; - int XEnd = origin.X + biomeSize + 3; - - int YStart = (int)(origin.Y - verticalRadius * 0.4f) - 3; - int YEnd = origin.Y + verticalRadius + 3; - - int newTunnelXLeft = (startX - 300); - int newTunnelYLeft = (startY - 10); - - int newTunnelXRight = (startX + 300); - int newTunnelYRight = (startY - 10); - - - //place another barrier so the gleaming burrows doesnt just burst into the gully - - var basaltcircle = new Shapes.Circle(30); - GenAction paintBasalt = Actions.Chain( - new Actions.Clear(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()), - new Actions.SetFrames(true) - ); - - for (int X = XStart; X < XEnd; X += 14) - { - for (int Y = YStart; Y <= YEnd; Y += 12) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) - && Y > origin.Y - 10) - { - WorldUtils.Gen(new Point(X - 5, Y + 5), basaltcircle, paintBasalt); - } - } - } - - var Obsidiancircle = new Shapes.Circle(13); - GenAction paintObsidian = Actions.Chain( - new Actions.Clear(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()), - new Actions.SetFrames(true) - ); - - for (int X = XStart; X < XEnd; X += 5) - { - for (int Y = YStart; Y <= YEnd; Y += 5) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) - && Y > origin.Y - 10) - { - WorldUtils.Gen(new Point(X - 2, Y + 7), Obsidiancircle, paintObsidian); - } - } - } - - - //place the gleaming burrows caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - Tile t = Main.tile[X, Y]; - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 15) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - t.WallType = (ushort)ModContent.WallType(); - } - - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } - } - else - { - - - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Navystone; - t.HasTile = true; - } - - float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; - float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; - - if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) - { - t.WallType = (ushort)ModContent.WallType(); - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - if (t.WallType == WallID.None) - t.WallType = NavystoneWall; - } - - - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - //Tunnels - MiscWorldgenRoutines.ClearTunnel(startX - 200, startY + 40, newTunnelXLeft, newTunnelYLeft, 3, (ushort)ModContent.WallType(), 2, false, false); - MiscWorldgenRoutines.ClearTunnel(startX + 200, startY + 40, newTunnelXRight, newTunnelYRight, 3, (ushort)ModContent.WallType(), 2, false, false); - - //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - } - - } - //Very bottom of the biome (Clam Den) - public static void PlaceClamDen(int startPosX, int startPosY) + private class ClusterGroup : List { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.ClamDenX; + public int Width; - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.ClamDenY; + public int Height; - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.70f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 80 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 10f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - //place the Clam Den caverns - for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) + private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - Tile t = Main.tile[X, Y]; - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 50) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - t.WallType = (ushort)ModContent.WallType(); - } - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = (ushort)ModContent.WallType(); - } - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - - //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - } - - //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - - //public static void PlaceBasaltGullyBorderBlend(int startPosX, int startPosY) - //{ - // int startX = (startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX); - - // int startY = (startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY) - 90; - - // int biomeSize = 250 + (Main.maxTilesX / 180); - - // ushort Basalt = (ushort)ModContent.TileType(); - // ushort BasaltWall = (ushort)ModContent.WallType(); - - // //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - // for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) - // { - // const int totalCurveDepth = -320; - // const int totalCurveDepthTop = 70; - - // var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); - // var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); - - - // int curveDepth = (int)MathHelper.Lerp( - // totalCurveDepth, - // 0f, squrt); - // int curveDepth2 = (int)MathHelper.Lerp( - // totalCurveDepth, 0f, squrt2); - // int curveDepthtop = (int)MathHelper.Lerp( - // totalCurveDepthTop, - // 0f, squrt); - // int curveDepth2top = (int)MathHelper.Lerp( - // totalCurveDepthTop, - // 0f, squrt2); - - // int Height = Main.maxTilesY - 270 + curveDepth + curveDepth2; - // int StartHeight = startY - (625) + curveDepthtop + curveDepth2top; - - // for (int Y = StartHeight; Y <= Height; Y++) - // { - // Tile t = Main.tile[X, Y]; - // if (Main.tile[X, Y].HasTile) - // { - // t.TileType = Basalt; - // t.HasTile = true; - // } - - // t.WallType = BasaltWall; - // } - // } - - // //cleanup - // for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - // { - // for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - // { - // //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - // bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - // bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - // bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - // bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - // if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - // { - // WorldGen.KillTile(X, Y); - // } - - // //kill random single floating tiles - // if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - // { - // WorldGen.KillTile(X, Y); - // } - // Tile.SmoothSlope(X, Y); - // } - // } - //} - public static void PlaceBasaltGully(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY; - - int biomeSize = 270 + (Main.maxTilesX / 180); - - ushort Basalt = (ushort)ModContent.TileType(); - ushort BasaltWall = (ushort)ModContent.WallType(); - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) - { - int leftEdge = startX - biomeSize - 60; - int rightEdge = startX + biomeSize + 60; - int basaltbordernoise = 270 + Main.rand.Next(0, 4); - int basaltbordernoisetop = 625 + Main.rand.Next(0, 4); - const int totalCurveDepth = -475; - const int totalCurveDepthTop = -100; - - var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); - var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); - - - int curveDepth = (int)MathHelper.Lerp( - totalCurveDepth, - 0f, squrt); - int curveDepth2 = (int)MathHelper.Lerp( - totalCurveDepth, 0f, squrt2); - int curveDepthtop = (int)MathHelper.Lerp( - totalCurveDepthTop, - 0f, squrt); - int curveDepth2top = (int)MathHelper.Lerp( - totalCurveDepthTop, - 0f, squrt2); - - int Height = Main.maxTilesY - basaltbordernoise + curveDepth + curveDepth2; - int StartHeight = startY - (basaltbordernoisetop) + curveDepthtop + curveDepth2top; - - for (int Y = StartHeight; Y <= Height; Y++) - { - int leftIndent = Main.rand.Next(0, 12); - int rightIndent = Main.rand.Next(0, 12); - if (X < leftEdge + leftIndent || X > rightEdge - rightIndent) - continue; - - Tile t = Main.tile[X, Y]; - t.ClearEverything(); - t.TileType = Basalt; - t.WallType = BasaltWall; - t.HasTile = true; - } - } - - //place caverns and lava - for (int X = startX - biomeSize - (Main.maxTilesX / 25); X <= startX + biomeSize + (Main.maxTilesX / 25); X++) - { - for (int Y = startY; Y <= Main.maxTilesY - 190; Y++) - { - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - Tile t = Main.tile[X, Y]; - //place caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 130, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 5.5f + 0.235f; - - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - t.HasTile = false; - t.LiquidType = LiquidID.Lava; - } - - float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; - float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; - - if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) - { - if (t.WallType == BasaltWall) - { - WorldGen.KillWall(X, Y); - } - } - - //place lava - if (WorldGen.genRand.NextBool(2000)) - { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new Modifiers.Blotches( - WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.SetLiquid(LiquidID.Lava, 255))); - } - } - } - } - - //place sand blocks - for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - { - for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed basalt - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 3, ModContent.TileType()); - } - } - } - - //cleanup - for(int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - { - for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - Tile.SmoothSlope(X, Y); - - Tile t = Main.tile[X, Y]; - if (Main.tile[X, Y].WallType == BasaltWall) - { - //get rid of water - if (Main.tile[X, Y].LiquidType == LiquidID.Water) - { - t.LiquidType = LiquidID.Lava; - } - - //get rid of obsidian blocks - if (Main.tile[X, Y].TileType == TileID.Obsidian) - { - WorldGen.KillTile(X, Y); - } - } - } - } - } - - - //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it - //public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) - //{ - // ushort BasaltWall = (ushort)ModContent.WallType(); - // int biomeSize = 230 + (Main.maxTilesX / 180); - - // for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) - // { - // for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) - // { - - // } - // } - //} - - - //place all the ambient tiles in the sunken sea - public static void PlaceSunkenSeaAmbience() - { - bool shipPlaced = false; - //first clean up unnecessary chunks of tiles - CleanOutSmallClumps(); - - // Loop through the area around the Sunken Sea and check for the specific tiles - int minX = Math.Max(20, GenVars.UndergroundDesertLocation.Left - 20); - int maxX = Math.Min(GenVars.UndergroundDesertLocation.Right + 20, Main.maxTilesX - 20); - for (int X = minX; X <= maxX; X++) - { - for (int Y = (int)Main.worldSurface; Y <= Main.UnderworldLayer; Y++) - { - if (WorldGen.genRand.NextBool(200)) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - if (WorldGen.genRand.NextBool(200)) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - - - //Timeless Shores ambiant tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int MediumShorePileVariants = WorldGen.genRand.Next(3); - int DriftwoodVariants = WorldGen.genRand.Next(6); - int ShorePileVariants = WorldGen.genRand.Next(9); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(100)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(100)) - {; - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(100)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - //Shore piles - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: ShorePileVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); - } - } - - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - // stay in-bounds - if (Y > 0) - { - Tile above = Main.tile[X, Y - 1]; - - // only if it's open air (no solid tile), and we don't overwrite other special liquids other than lava (just incase) - if (!above.HasTile && - above.Get().LiquidType != LiquidID.Honey && - above.Get().LiquidType != LiquidID.Shimmer) - { - above.Get().LiquidType = LiquidID.Water; - above.LiquidAmount = byte.MaxValue; // 255 - } - } - } - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int DriftwoodVariants = WorldGen.genRand.Next(6); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(80)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(60)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(60)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - } - - //gleaming burrows ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int NavystonePileVariants = WorldGen.genRand.Next(6); - //brain coral - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - //small brain coral - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //tube coral - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - //small tube coral - if (WorldGen.genRand.NextBool(12)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //anemonies - if (WorldGen.genRand.NextBool(18)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //giant navystone piles - if (WorldGen.genRand.NextBool(20)) - { - ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); - } - - //navystone piles - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //small navystone piles - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //misc piles - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 6)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 6)); - } - - //kelp bushes - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 3)); - } - - //Pearls - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int Rand8() => WorldGen.genRand.Next(8); - int MediumSeaPrismCrystalVariants = Rand8(); - //Medium Sea Prism down - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - } - //grow depth vines on navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int TableCoralVariants = WorldGen.genRand.Next(3); - int SpeleothemsVariants = WorldGen.genRand.Next(3); - int NavystonePileVariants = WorldGen.genRand.Next(6); - - if (WorldGen.genRand.NextBool(30) && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); - } - - if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) - { - WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); - } - - //Speleothems below - //stalactites - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y + 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //small stalactites - if (WorldGen.genRand.NextBool(8)) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //stalagmites - if (WorldGen.genRand.NextBool(12)) - { - WorldGen.PlaceTile(X, Y - 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //small stalagmites - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - - //giant navystone piles - if (WorldGen.genRand.NextBool()) - { - ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); - } - - //navystone piles - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //small navystone piles - if (WorldGen.genRand.NextBool(5)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - } - //Mossy Stone - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(5)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 5)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 3)); - } - } - //Polyp Forest Ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int RandStyle() => WorldGen.genRand.Next(8); - int style = RandStyle(); - //BranchCoralsOnLimestone - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); - } - } - //GilHerb Vines - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int BranchCoralVariants = WorldGen.genRand.Next(8); - int WideScarletSeagrassVariants = WorldGen.genRand.Next(4); - int DriftwoodVariants = WorldGen.genRand.Next(6); - - //BranchCoralsOnSand - if (WorldGen.genRand.NextBool(25)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); - } - if (WorldGen.genRand.NextBool(25)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); - } - if (WorldGen.genRand.NextBool(25)) - { - ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); - } - if (WorldGen.genRand.NextBool(12)) - { - ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WideScarletSeagrassVariants); - } - if (WorldGen.genRand.NextBool(12)) - { - ushort[] StalkCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(StalkCorals)); - } - if (WorldGen.genRand.NextBool(16)) - { - ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); - } - if (WorldGen.genRand.NextBool(18)) - { - ushort[] TallDigitateCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(TallDigitateCorals)); - } - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 11)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(),true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (!shipPlaced) - { - if (WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), mute: true)) - shipPlaced = true; - } - //small limestone piles - if (WorldGen.genRand.NextBool(25)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: DriftwoodVariants); - } - } - - //radiant reefs ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - //Coral Blocks (to be removed when we have real gen for them - if (WorldGen.genRand.NextBool(400) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || - (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) - { - ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) - })); - } - - int DriftwoodVariants = WorldGen.genRand.Next(6); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - //multi-colored corals - if (WorldGen.genRand.NextBool(3)) - { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(ColoredCorals)); - } - - //blue coral trees - if (WorldGen.genRand.NextBool(8)) - { - ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BlueCorals)); - } - - //brown coral trees - if (WorldGen.genRand.NextBool(8)) - { - ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BrownCorals)); - } - - //fan coral - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //misc piles - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 9)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(20)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - - //misc corals - if (WorldGen.genRand.NextBool()) - { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int Rand4() => WorldGen.genRand.Next(4); - int WallCoralVariants = Rand4(); - - if (WorldGen.genRand.NextBool(5) && - Main.tile[X, Y].HasTile && - Main.tile[X, Y + 1].HasTile && - Main.tile[X, Y + 2].HasTile && - - !Main.tile[X + 1, Y].HasTile && - !Main.tile[X + 1, Y + 1].HasTile && - !Main.tile[X + 1, Y + 2].HasTile && - - !Main.tile[X + 2, Y].HasTile && - !Main.tile[X + 2, Y + 1].HasTile && - !Main.tile[X + 2, Y + 2].HasTile && - - !Main.tile[X + 3, Y].HasTile && - !Main.tile[X + 3, Y + 1].HasTile && - !Main.tile[X + 3, Y + 2].HasTile && - - !Main.tile[X + 4, Y].HasTile && - !Main.tile[X + 4, Y + 1].HasTile && - !Main.tile[X + 4, Y + 2].HasTile) - { - WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); - } - - if (WorldGen.genRand.NextBool(5) && - Main.tile[X, Y].HasTile && - Main.tile[X, Y + 1].HasTile && - Main.tile[X, Y + 2].HasTile && - - !Main.tile[X - 1, Y].HasTile && - !Main.tile[X - 1, Y + 1].HasTile && - !Main.tile[X - 1, Y + 2].HasTile && - - !Main.tile[X - 2, Y].HasTile && - !Main.tile[X - 2, Y + 1].HasTile && - !Main.tile[X - 2, Y + 2].HasTile && - - !Main.tile[X - 3, Y].HasTile && - !Main.tile[X - 3, Y + 1].HasTile && - !Main.tile[X - 3, Y + 2].HasTile && - - !Main.tile[X - 4, Y].HasTile && - !Main.tile[X - 4, Y + 1].HasTile && - !Main.tile[X - 4, Y + 2].HasTile) - { - WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); - } - } - } - } - } - - //check if theres enough tiles to place sand below - public static bool PlaceSand(int X, int Y, int height, int tileType) - { - for (int j = Y; j <= Y + height; j++) - { - if (Main.tile[X, j].HasTile && Main.tile[X, j + 1].HasTile && Main.tile[X, j + 2].HasTile && Main.tile[X, j + 3].HasTile && - Main.tile[X - 1, j + 3].HasTile && Main.tile[X + 1, j + 3].HasTile) - { - Main.tile[X, j].TileType = (ushort)tileType; - } - else - { - return false; - } - } - - return true; - } - - //placing sea prism geodes - public static bool PlaceGeode(int X, int Y, int radius) - { - int crystalNearby = 0; - - //check a 20 by 20 square for other geodes before placing - for (int i = X - 20; i < X + 20; i++) - { - for (int j = Y - 20; j < Y + 20; j++) - { - //dont allow geodes to place if another one is too close - if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == ModContent.TileType()) - { - crystalNearby++; - if (crystalNearby > 0) - { - return false; - } - } - } - } - - ShapeData circle1 = new ShapeData(); - ShapeData circle2 = new ShapeData(); - ShapeData circle3 = new ShapeData(); - - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - GenAction blotchMod2 = new Modifiers.Blotches(1, 0.1); - - //first circle of navystone - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle1) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //second circle of prisms - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle2) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle2), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //clear out the middle of the circle - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 9), Actions.Chain(new GenAction[] - { - blotchMod2.Output(circle3) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle3), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.SetLiquid(), - })); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] - { - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - return true; - } - - //method to clean up small clumps of tiles (taken from the sulphur sea generation) - public static void CleanOutSmallClumps() - { - List blockTileTypes = new() - { - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - }; - - void getAttachedPoints(int x, int y, List points) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); - Point p = new(x, y); - - if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) + pointCluster.Add(new Point(x, y)); + hubMap[x, y] = false; + level--; + if (level == -1) { return; } - - points.Add(p); - - getAttachedPoints(x + 1, y, points); - getAttachedPoints(x - 1, y, points); - getAttachedPoints(x, y + 1, points); - getAttachedPoints(x, y - 1, points); + if (x > 0 && hubMap[x - 1, y]) + { + SearchForCluster(hubMap, pointCluster, x - 1, y, level); + } + if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) + { + SearchForCluster(hubMap, pointCluster, x + 1, y, level); + } + if (y > 0 && hubMap[x, y - 1]) + { + SearchForCluster(hubMap, pointCluster, x, y - 1, level); + } + if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) + { + SearchForCluster(hubMap, pointCluster, x, y + 1, level); + } } - for (int x = 20; x < Main.maxTilesX - 20; x += 1) + private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster { - for (int y = 20; y < Main.maxTilesY - 20; y++) + int clusterPos = clusterIndexMap[x, y]; + if (clusterPos != -1 && clusterPos != index) { - List chunkPoints = new(); - getAttachedPoints(x, y, chunkPoints); - - int cutoffLimit = 75; - if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) + int clusterHeight = (WorldGen.genRand.NextBool(2)) ? -1 : index; + foreach (Point current in pointClusters[clusterPos]) { - foreach (Point p in chunkPoints) + clusterIndexMap[current.X, current.Y] = clusterHeight; + } + } + } + + public void Generate(int width, int height) //Creates clusters for cluster group + { + Width = width; + Height = height; + Clear(); + bool[,] array = new bool[width, height]; + int clusterPos = (width >> 1) - 1; + int clusterHeight = (height >> 1) - 1; + int clusterSize = (clusterPos + 1) * (clusterPos + 1); + Point point = new Point(clusterPos, clusterHeight); + for (int i = point.Y - clusterHeight; i <= point.Y + clusterHeight; i++) + { + float num4 = (float)clusterPos / (float)clusterHeight * (float)(i - point.Y); + int num5 = Math.Min(clusterPos, (int)Math.Sqrt((float)clusterSize - num4 * num4)); + for (int j = point.X - num5; j <= point.X + num5; j++) + { + array[j, i] = WorldGen.genRand.NextBool(2); + } + } + List> list = new List>(); + for (int k = 0; k < array.GetLength(0); k++) + { + for (int l = 0; l < array.GetLength(1); l++) + { + if (array[k, l] && WorldGen.genRand.NextBool(2)) { - WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] + List list2 = new List(); + SearchForCluster(array, list2, k, l, 2); + if (list2.Count > 2) { - new Actions.ClearTile(true), - new Actions.ClearWall(true) - })); + list.Add(list2); + } + } + } + } + int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; + for (int m = 0; m < array2.GetLength(0); m++) + { + for (int n = 0; n < array2.GetLength(1); n++) + { + array2[m, n] = -1; + } + } + for (int num6 = 0; num6 < list.Count; num6++) + { + foreach (Point current in list[num6]) + { + array2[current.X, current.Y] = num6; + } + } + for (int num7 = 0; num7 < list.Count; num7++) + { + foreach (Point point2 in list[num7]) + { + int x = point2.X; + int y = point2.Y; + if (array2[x, y] == -1) + { + break; + } + int index = array2[x, y]; + if (x > 0) + { + AttemptClaim(x - 1, y, array2, list, index); + } + if (x < array2.GetLength(0) - 1) + { + AttemptClaim(x + 1, y, array2, list, index); + } + if (y > 0) + { + AttemptClaim(x, y - 1, array2, list, index); + } + if (y < array2.GetLength(1) - 1) + { + AttemptClaim(x, y + 1, array2, list, index); + } + } + } + using (List>.Enumerator enumerator2 = list.GetEnumerator()) + { + while (enumerator2.MoveNext()) + { + enumerator2.Current.Clear(); + } + } + for (int num8 = 0; num8 < array2.GetLength(0); num8++) + { + for (int num9 = 0; num9 < array2.GetLength(1); num9++) + { + if (array2[num8, num9] != -1) + { + list[array2[num8, num9]].Add(new Point(num8, num9)); + } + } + } + foreach (List current2 in list) + { + if (current2.Count < 4) + { + current2.Clear(); + } + } + foreach (List current3 in list) + { + Cluster cluster = new Cluster(); + if (current3.Count > 0) + { + foreach (Point current4 in current3) + { + cluster.Add(new Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); + } + Add(cluster); + } + } + } + } + + // Generates clumps / clusters / chunks of general tiles in the Sunken Sea area + private static void PlaceClusters(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector) + { + int totalWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + Vector2 totalScale = new Vector2(totalWidth, totalHeight); + Vector2 individualScale = new Vector2(clusters.Width, clusters.Height); + + //I was a bit worried about editing anything in this loop too drastically, so i just changed all instances of placing navystone to eutrophic sand + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = -20; j < totalHeight + 20; j++) + { + float num3 = 0f; + int clusterAmt = -1; + float num5 = 0f; + int num6 = i + start.X; + int num7 = j + start.Y; + Vector2 vector = new Vector2((float)i, (float)j) / totalScale * individualScale; + float num8 = (new Vector2((float)i, (float)j) / totalScale * 2f - Vector2.One).Length(); + for (int k = 0; k < clusters.Count; k++) + { + Cluster cluster = clusters[k]; + if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) + { + float num9 = 0f; + foreach (Hub current in cluster) + { + num9 += 1f / Vector2.DistanceSquared(current.Position, vector); + } + if (num9 > num3) + { + if (num3 > num5) + { + num5 = num3; + } + num3 = num9; + clusterAmt = k; + } + else if (num9 > num5) + { + num5 = num9; + } + } + } + float num10 = num3 + num5; + Tile tile = Main.tile[num6, num7]; + bool flag = num8 >= 0.8f; + if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + { + tile.ClearEverything(); + tile.LiquidAmount = 192; + if (clusterAmt % 5 == 2) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + tile.LiquidAmount = 0; + } + Tile.SmoothSlope(num6, num7, true); + } + else if (num10 > 1.8f) + { + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 192; + if (!flag || tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.LiquidAmount = 0; + } + } + else if (num10 > 0.7f || !flag) + { + tile.LiquidAmount = 192; + if (!flag || tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.LiquidAmount = 0; + } + tile.WallType = (ushort)ModContent.WallType(); + } + else if (num10 > 0.25f) + { + float num11 = (num10 - 0.25f) / 0.45f; + if (WorldGen.genRand.NextFloat() < num11) + { + if (tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 0; + } + else + { + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 192; + } + } + } + } + } + + //final cleanup loop + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = -20; j < totalHeight + 20; j++) + { + int x = i + start.X; + int y = j + start.Y; + + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileDown2 = Main.tile[x, y + 2]; + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + + //lava BEGONE + if (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType()) + { + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + + //also get rid of any annoying leftover obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(x, y); + } + } + + //place extra caves throughout the biome for variance + if (WorldGen.genRand.NextBool(1000) && tile != null && tile.HasTile && + (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + { + TileRunner runner = new TileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-35, 35), + new Point16(-35, 35), 15f, WorldGen.genRand.Next(25, 50), 0, false, true); + runner.Start(); + } + + //kill any random floating tiles + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + { + WorldGen.KillTile(x, y); + } + } + + //kill any random clumps of navystone without eutrophic sand around them + if (tile.TileType == ModContent.TileType() && tileUp.TileType != ModContent.TileType() && + tileDown.TileType != ModContent.TileType() && tileLeft.TileType != ModContent.TileType() && + tileRight.TileType != ModContent.TileType()) + { + WorldGen.KillTile(x, y); + } + } + } + } + + // Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits" + // Generates sea prism crystals on prism ore and occasionally on navystone + private static void AddGeodes(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + { + int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + bool genCentalHole = true; + Rectangle rectangle = default; + + // Radius of the generated hole + int radius = (int)(WorldGen.genRand.Next(24, 28) * overallBiomeScale); + int diameter = radius * 2; + + // Where to place the giant hole? "Center of the Sunken Sea", defined as follows: + // Dead center horizontally, and 1/3 of the way down the area + Point point = new Point(start.X + totalClusterZoneWidth / 2, start.Y + (int)(totalClusterZoneHeight * 0.33f)); + + ShapeData holeShape = new ShapeData(); + float outerRadiusPercentage = WorldGen.genRand.Next(40, 56) * 0.01f; //Small radius for ore patch to fit inside holes + + // Y coordinate of the "bottom" of the Sunken Sea, 70% of the way down. + int sunkenSeaBottom = start.Y + (int)(totalClusterZoneHeight * 0.7f); + int smallHoles = 0; + + // Scale amount of holes with world size + // 4 on Small, 6 on Normal (rounds down), 8 on Large + int totalHoleCount = (int)(4f * overallBiomeScale); + + for (int i = -20; i < totalClusterZoneWidth + 20; i++) + { + for (int j = -20; j < totalClusterZoneHeight + 20; j++) + { + if (genCentalHole) + { + // Set the rectangle for the central hole + genCentalHole = false; + rectangle = new Rectangle(start.X + totalClusterZoneWidth / 2 - radius, start.Y + (int)(totalClusterZoneHeight * 0.33f) - radius, diameter, diameter); + + WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 192) //Leave some air pockets + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + + // Set the point for non-central holes + int smallHoleX = WorldGen.genRand.Next(start.X + 30, start.X + totalClusterZoneWidth - 30); + int smallHoleY = WorldGen.genRand.Next(start.Y + 20, sunkenSeaBottom); + point = new Point(smallHoleX, smallHoleY); + + if (smallHoles < totalHoleCount && WorldGen.genRand.NextBool(3) && !rectangle.Contains(point)) + { + smallHoles++; + int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * overallBiomeScale); + WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.45).Output(holeShape), + new Actions.ClearTile(true), + new Actions.SetLiquid(0, 192) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear center + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + + int num3 = i + start.X; + int num4 = j + start.Y; + Tile tile = Main.tile[num3, num4]; + Tile testTile = Main.tile[num3, num4 + 1]; + Tile testTile2 = Main.tile[num3, num4 + 2]; + if (tile.TileType == ModContent.TileType() && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + { + tile.TileType = (ushort)ModContent.TileType(); + } + } + } + } + + private static void AddTileVariance(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + { + int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + for (int k = -20; k < totalClusterZoneWidth + 20; k++) + { + for (int l = -20; l < totalClusterZoneHeight + 20; l++) + { + int num5 = k + start.X; + int num6 = l + start.Y; + Tile tile = Main.tile[num5, num6]; + if (tile.HasTile && (tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + { + bool flag = true; + for (int m = -1; m >= -3; m--) + { + if (Main.tile[num5, num6 + m].HasTile) + { + flag = false; + break; + } + } + bool flag2 = true; + for (int n = 1; n <= 3; n++) + { + if (Main.tile[num5, num6 + n].HasTile) + { + flag2 = false; + break; + } + } + bool flag3 = true; + for (int o = -1; o >= -3; o--) + { + if (Main.tile[num5 + o, num6].HasTile) + { + flag3 = false; + break; + } + } + bool flag4 = true; + for (int p = 1; p <= 3; p++) + { + if (Main.tile[num5 + p, num6].HasTile) + { + flag4 = false; + break; + } + } + if (tile.TileType == ModContent.TileType() || ((tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) && WorldGen.genRand.NextBool(8))) + { + if (flag3 ^ flag4) + { + if (tile.Slope == 0 && !tile.IsHalfBlock) + { + Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5 - 1, num6].TileType == ModContent.TileType()) + { + Main.tile[num5 - 1, num6].TileFrameY = (short)(2 * 18); + } + else if (Main.tile[num5 + 1, num6].TileType == ModContent.TileType()) + { + Main.tile[num5 + 1, num6].TileFrameY = (short)(3 * 18); + } + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.Get().HasTile = true; + } + } + if (flag ^ flag2) + { + if (tile.Slope == 0 && !tile.IsHalfBlock) + { + Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5, num6 - 1].TileType == ModContent.TileType()) + { + Main.tile[num5, num6 - 1].TileFrameY = (short)(0 * 18); + } + else if (Main.tile[num5, num6 + 1].TileType == ModContent.TileType()) + { + Main.tile[num5, num6 + 1].TileFrameY = (short)(1 * 18); + } + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.Get().HasTile = true; + } + } + } + } + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(8)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //colorful corals + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //stalactites + if (WorldGen.genRand.NextBool(15)) + { + WorldGen.PlaceObject(num5, num6 + 2, ModContent.TileType(), style: WorldGen.genRand.Next(3)); + } + if (WorldGen.genRand.NextBool(15)) + { + WorldGen.PlaceTile(num5, num6 + 1, ModContent.TileType(), true, false, -1, style: WorldGen.genRand.Next(3)); + } + + //stalagmites + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(num5, num6 - 2, ModContent.TileType(), style: WorldGen.genRand.Next(3)); + } + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 - 1, ModContent.TileType(), true, false, -1, style: WorldGen.genRand.Next(3)); + } + } + if (!tile.HasTile) + { + if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) + { + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } } } } } } + //added this to 100% make sure the sunken sea places where it is supposed to be + static bool foundValidPosition = false; - //method to make sure things only generate in each biome circle - public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false, bool collapseBottom = false) + public static bool Place(Point origin) { - Vector2 point = tile.ToWorldCoordinates(); - - if (collapse) + for (int y = origin.Y; y >= (int)Main.worldSurface; y--) { - float distY = center.Y - point.Y; - point.Y -= distY * 4f; + //check for the desert biomes walls + if (Main.tile[origin.X, y].WallType == WallID.Sandstone || Main.tile[origin.X, y].WallType == WallID.HardenedSand) + { + origin.Y = y + 50; //offset so it doesnt generate weird + foundValidPosition = true; + break; + } } - if (collapseBottom) - { - float distY = center.Y - point.Y; - point.Y += distY * 4f; - } - float distance1 = Vector2.Distance(point, focus1); - float distance2 = Vector2.Distance(point, focus2); - distance = distance1 + distance2; - return distance <= distanceConstant; + while (foundValidPosition) + { + // 1 on Small, 1.52 on Medium, 2 on Large + float scale = Main.maxTilesX / 4200f; + // Clamp scale to prevent problems on extra large worlds + scale = MathHelper.Clamp(scale, 1f, 2f); + + // 80 on Small, 121.6 on Medium, 160 on Large + int sunkenSeaAreaX = (int)(80f * scale); + // 84-102 on Small, 127.68-155.04 on Medium, 168-204 on Large + float baseVerticalSize = 60f * scale; + float verticalScaleFactor = 1.4f + WorldGen.genRand.NextFloat(0.3f); + int sunkenSeaAreaY = (int)(verticalScaleFactor * baseVerticalSize); + + // What the fuck is this and why is it used everywhere + // As far as I can tell, this just scales up the entire Sunken Sea to be 4x wider and 2x taller than what is listed above + Vector2 arbitrary42GodVector = new Vector2(4f, 2f); + + // 04NOV2024: Ozzatron: Remnants mutilates the Underground Desert beyond recognition. + // The above code assumes the size of the underground desert with arbitrary hardcoded values instead of checking it. + // To ensure the Sunken Sea is centered on an Underground Desert of any size, some adjustments are made. + // This would have been easy, but the arbitrary 4-2 God vector makes the math unnecessarily complicated. + int sunkenSeaRealWidth = (int)(sunkenSeaAreaX * arbitrary42GodVector.X); + origin.X = GenVars.UndergroundDesertLocation.Center.X - sunkenSeaRealWidth / 2; + + // Place the majority of the terrain as clusters + ClusterGroup clusterGroup = new ClusterGroup(); + clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); + PlaceClusters(clusterGroup, origin, arbitrary42GodVector); + + // Place Geodes + AddGeodes(clusterGroup, origin, arbitrary42GodVector, scale); + + // Re-frame everything in some arbitrary radius + int totalWidth = (int)(arbitrary42GodVector.X * clusterGroup.Width); + int totalHeight = (int)(arbitrary42GodVector.Y * clusterGroup.Height); + int frameExcessRadius = 40; + for (int i = -frameExcessRadius; i < totalWidth + frameExcessRadius; i++) + { + for (int j = -frameExcessRadius; j < totalHeight + frameExcessRadius; j++) + { + if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) + { + WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); + WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); + Tile.SmoothSlope(i + origin.X, j + origin.Y, true); + } + } + } + + // Add Tile Variance (sand, crystals, etc.) + AddTileVariance(clusterGroup, origin, arbitrary42GodVector, scale); + + return true; + } + + return false; } } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 9d02088c97..92f106df70 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -451,7 +451,6 @@ namespace CalamityMod.World new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 10 + 1)), new ChestItem(ItemID.Eggnog, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(ItemType(), WorldGen.genRand.Next(200, 349 + 1)), new ChestItem(Main.rand.NextBool() ? ItemID.GasTrap : ItemID.Marshmallow, 1) }; } diff --git a/build.txt b/build.txt index 96114a7dee..d7a8171ac4 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = The Calamity Dev Team -version = 2.1.2 +version = 2.2.1 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://calamitymod.com diff --git a/icon.png b/icon.png index 8451ec4099..f94df4c65a 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icon_workshop.png b/icon_workshop.png index 677e0c27a3..5663ad88e5 100644 Binary files a/icon_workshop.png and b/icon_workshop.png differ