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 23b231907c..58f265f0f7 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)))); @@ -167,9 +178,6 @@ namespace CalamityMod.Balancing // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); @@ -209,19 +217,22 @@ 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. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 35% resist to Aerial Bane. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); - // 35% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 30% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Flak Kraken. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 25% resist to Solar Eruption. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.SolarWhipSword, ProjectileID.SolarWhipSwordExplosion)))); + // 20% resist to Ballistic Poison Bomb's clouds. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); @@ -251,9 +262,6 @@ namespace CalamityMod.Balancing // 50% resist to Galactus Blade. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType()))); - // 40% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); - // 40% resist to Stellar Torus Staff. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); #endregion @@ -262,18 +270,12 @@ 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)))); // 50% resist to Legion of Celestia. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Tactician's Trump Card's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -282,11 +284,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 @@ -301,19 +304,8 @@ namespace CalamityMod.Balancing // 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())))); @@ -375,6 +367,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/AlcoholPoisoning.cs b/Buffs/Alcohol/AlcoholPoisoning.cs index c1736b0e64..1880e891a1 100644 --- a/Buffs/Alcohol/AlcoholPoisoning.cs +++ b/Buffs/Alcohol/AlcoholPoisoning.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol @@ -10,10 +11,8 @@ namespace CalamityMod.Buffs.Alcohol Main.debuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; - // The nurse technically cannot get rid of this debuff by herself, as it reapplies immediately after if you have alcohol left - // But she also cleanses excess alcohol if you have Alcohol Poisoning (see CalamityPlayer.PostNurseHeal) - // Removing this set means she costs 1 debuff worth of cost to remove excess alcohol - // BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + // The nurse can remove all alcohol debuffs individually, thus removing this by proxy. + BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/BaconOilBuff.cs b/Buffs/Alcohol/BaconOilBuff.cs new file mode 100644 index 0000000000..5d8408f271 --- /dev/null +++ b/Buffs/Alcohol/BaconOilBuff.cs @@ -0,0 +1,29 @@ +using CalamityMod.DataStructures; +using CalamityMod.Systems.Collections; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Alcohol +{ + public class BaconOilBuff : ModBuff + { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 3 + }; + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + Main.persistentBuff[Type] = true; + CalamityBuffSets.DebuffDataset[Type] = debuffData; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().baconOil = true; + } + } +} diff --git a/Buffs/Alcohol/BaconOilBuff.png b/Buffs/Alcohol/BaconOilBuff.png new file mode 100644 index 0000000000..1873b16f5b Binary files /dev/null and b/Buffs/Alcohol/BaconOilBuff.png differ diff --git a/Buffs/Alcohol/BloodyMaryBuff.cs b/Buffs/Alcohol/BloodyMaryBuff.cs index af35461b47..019cca545d 100644 --- a/Buffs/Alcohol/BloodyMaryBuff.cs +++ b/Buffs/Alcohol/BloodyMaryBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class BloodyMaryBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 40355f1d96..87d65d2345 100644 Binary files a/Buffs/Alcohol/BloodyMaryBuff.png and b/Buffs/Alcohol/BloodyMaryBuff.png differ diff --git a/Buffs/Alcohol/CaribbeanRumBuff.cs b/Buffs/Alcohol/CaribbeanRumBuff.cs index fcdb6422b6..0d96b9caa4 100644 --- a/Buffs/Alcohol/CaribbeanRumBuff.cs +++ b/Buffs/Alcohol/CaribbeanRumBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class CaribbeanRumBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/CaribbeanRumBuff.png b/Buffs/Alcohol/CaribbeanRumBuff.png index 3996666a07..52499ee117 100644 Binary files a/Buffs/Alcohol/CaribbeanRumBuff.png and b/Buffs/Alcohol/CaribbeanRumBuff.png differ diff --git a/Buffs/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index bb724a3a52..7cbbcf5b64 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class CinnamonRollBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index a1a2c0ae34..2aacbc8b75 100644 Binary files a/Buffs/Alcohol/CinnamonRollBuff.png and b/Buffs/Alcohol/CinnamonRollBuff.png differ diff --git a/Buffs/Alcohol/EverclearBuff.cs b/Buffs/Alcohol/EverclearBuff.cs index 1629143a7f..0539414a31 100644 --- a/Buffs/Alcohol/EverclearBuff.cs +++ b/Buffs/Alcohol/EverclearBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class EverclearBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 2 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/EverclearBuff.png b/Buffs/Alcohol/EverclearBuff.png index 3f275ba54f..b6f4007bb3 100644 Binary files a/Buffs/Alcohol/EverclearBuff.png and b/Buffs/Alcohol/EverclearBuff.png differ diff --git a/Buffs/Alcohol/EvergreenGinBuff.cs b/Buffs/Alcohol/EvergreenGinBuff.cs index 1821638bad..0f7450a4d5 100644 --- a/Buffs/Alcohol/EvergreenGinBuff.cs +++ b/Buffs/Alcohol/EvergreenGinBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class EvergreenGinBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/EvergreenGinBuff.png b/Buffs/Alcohol/EvergreenGinBuff.png index f7e2133cd3..85d925b5e5 100644 Binary files a/Buffs/Alcohol/EvergreenGinBuff.png and b/Buffs/Alcohol/EvergreenGinBuff.png differ diff --git a/Buffs/Alcohol/FireballBuff.cs b/Buffs/Alcohol/FireballBuff.cs index 99c877dc50..a2ab1d6c57 100644 --- a/Buffs/Alcohol/FireballBuff.cs +++ b/Buffs/Alcohol/FireballBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class FireballBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/FireballBuff.png b/Buffs/Alcohol/FireballBuff.png index a81dcc472f..53dd87aa12 100644 Binary files a/Buffs/Alcohol/FireballBuff.png and b/Buffs/Alcohol/FireballBuff.png differ diff --git a/Buffs/Alcohol/GrapeBeerBuff.cs b/Buffs/Alcohol/GrapeBeerBuff.cs index 83504af851..84523f0ff0 100644 --- a/Buffs/Alcohol/GrapeBeerBuff.cs +++ b/Buffs/Alcohol/GrapeBeerBuff.cs @@ -1,26 +1,28 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class GrapeBeerBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) { var cplayer = player.Calamity(); cplayer.grapeBeer = true; - cplayer.critDamage -= GrapeBeer.CritLoss * 0.01f; } } } diff --git a/Buffs/Alcohol/GrapeBeerBuff.png b/Buffs/Alcohol/GrapeBeerBuff.png index 258910c643..b073557b01 100644 Binary files a/Buffs/Alcohol/GrapeBeerBuff.png and b/Buffs/Alcohol/GrapeBeerBuff.png differ diff --git a/Buffs/Alcohol/ManhattanBuff.cs b/Buffs/Alcohol/ManhattanBuff.cs index e724375c25..fa326a2ba7 100644 --- a/Buffs/Alcohol/ManhattanBuff.cs +++ b/Buffs/Alcohol/ManhattanBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class ManhattanBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/ManhattanBuff.png b/Buffs/Alcohol/ManhattanBuff.png index 8d3c026da5..5029f83753 100644 Binary files a/Buffs/Alcohol/ManhattanBuff.png and b/Buffs/Alcohol/ManhattanBuff.png differ diff --git a/Buffs/Alcohol/MargaritaBuff.cs b/Buffs/Alcohol/MargaritaBuff.cs index 37299b4fb8..b688c577b6 100644 --- a/Buffs/Alcohol/MargaritaBuff.cs +++ b/Buffs/Alcohol/MargaritaBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class MargaritaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/MargaritaBuff.png b/Buffs/Alcohol/MargaritaBuff.png index 94de724886..61d01e45fd 100644 Binary files a/Buffs/Alcohol/MargaritaBuff.png and b/Buffs/Alcohol/MargaritaBuff.png differ diff --git a/Buffs/Alcohol/MoonshineBuff.cs b/Buffs/Alcohol/MoonshineBuff.cs index 03faabe66d..aa7e4fe2dc 100644 --- a/Buffs/Alcohol/MoonshineBuff.cs +++ b/Buffs/Alcohol/MoonshineBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class MoonshineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/MoonshineBuff.png b/Buffs/Alcohol/MoonshineBuff.png index 028834ea24..21fb314785 100644 Binary files a/Buffs/Alcohol/MoonshineBuff.png and b/Buffs/Alcohol/MoonshineBuff.png differ diff --git a/Buffs/Alcohol/MoscowMuleBuff.cs b/Buffs/Alcohol/MoscowMuleBuff.cs index 21f7569480..8156853251 100644 --- a/Buffs/Alcohol/MoscowMuleBuff.cs +++ b/Buffs/Alcohol/MoscowMuleBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class MoscowMuleBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/MoscowMuleBuff.png b/Buffs/Alcohol/MoscowMuleBuff.png index a9cf2f5a18..088da9641d 100644 Binary files a/Buffs/Alcohol/MoscowMuleBuff.png and b/Buffs/Alcohol/MoscowMuleBuff.png differ diff --git a/Buffs/Alcohol/OldFashionedBuff.cs b/Buffs/Alcohol/OldFashionedBuff.cs index 68820059d4..72947fbd18 100644 --- a/Buffs/Alcohol/OldFashionedBuff.cs +++ b/Buffs/Alcohol/OldFashionedBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class OldFashionedBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/OldFashionedBuff.png b/Buffs/Alcohol/OldFashionedBuff.png index a3ba916b88..150b908bc8 100644 Binary files a/Buffs/Alcohol/OldFashionedBuff.png and b/Buffs/Alcohol/OldFashionedBuff.png differ diff --git a/Buffs/Alcohol/PurpleHazeBuff.cs b/Buffs/Alcohol/PurpleHazeBuff.cs index 16aa30d53f..28fdfdce9a 100644 --- a/Buffs/Alcohol/PurpleHazeBuff.cs +++ b/Buffs/Alcohol/PurpleHazeBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class PurpleHazeBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/PurpleHazeBuff.png b/Buffs/Alcohol/PurpleHazeBuff.png index c7fbec83bd..a2b6ca1235 100644 Binary files a/Buffs/Alcohol/PurpleHazeBuff.png and b/Buffs/Alcohol/PurpleHazeBuff.png differ diff --git a/Buffs/Alcohol/RedWineBuff.cs b/Buffs/Alcohol/RedWineBuff.cs index 087086ca68..07378c7f32 100644 --- a/Buffs/Alcohol/RedWineBuff.cs +++ b/Buffs/Alcohol/RedWineBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class RedWineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/RedWineBuff.png b/Buffs/Alcohol/RedWineBuff.png index 556b48d8fc..7b063a46a3 100644 Binary files a/Buffs/Alcohol/RedWineBuff.png and b/Buffs/Alcohol/RedWineBuff.png differ diff --git a/Buffs/Alcohol/RumBuff.cs b/Buffs/Alcohol/RumBuff.cs index ab842e0649..a03fb4287e 100644 --- a/Buffs/Alcohol/RumBuff.cs +++ b/Buffs/Alcohol/RumBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class RumBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/RumBuff.png b/Buffs/Alcohol/RumBuff.png index e43b540c7a..a23a1e56d9 100644 Binary files a/Buffs/Alcohol/RumBuff.png and b/Buffs/Alcohol/RumBuff.png differ diff --git a/Buffs/Alcohol/ScrewdriverBuff.cs b/Buffs/Alcohol/ScrewdriverBuff.cs index f8f97cd0fe..67774c5422 100644 --- a/Buffs/Alcohol/ScrewdriverBuff.cs +++ b/Buffs/Alcohol/ScrewdriverBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class ScrewdriverBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 4d24f45ebd..2e12c6fd40 100644 Binary files a/Buffs/Alcohol/ScrewdriverBuff.png and b/Buffs/Alcohol/ScrewdriverBuff.png differ diff --git a/Buffs/Alcohol/StarBeamRyeBuff.cs b/Buffs/Alcohol/StarBeamRyeBuff.cs index 50d6ac0bc8..091a295d57 100644 --- a/Buffs/Alcohol/StarBeamRyeBuff.cs +++ b/Buffs/Alcohol/StarBeamRyeBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class StarBeamRyeBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/StarBeamRyeBuff.png b/Buffs/Alcohol/StarBeamRyeBuff.png index f93dc9cfec..b75b146cca 100644 Binary files a/Buffs/Alcohol/StarBeamRyeBuff.png and b/Buffs/Alcohol/StarBeamRyeBuff.png differ diff --git a/Buffs/Alcohol/TequilaBuff.cs b/Buffs/Alcohol/TequilaBuff.cs index a2b307c605..485308d587 100644 --- a/Buffs/Alcohol/TequilaBuff.cs +++ b/Buffs/Alcohol/TequilaBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class TequilaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index ea4d7ed14a..570af3086f 100644 Binary files a/Buffs/Alcohol/TequilaBuff.png and b/Buffs/Alcohol/TequilaBuff.png differ diff --git a/Buffs/Alcohol/TequilaSunriseBuff.cs b/Buffs/Alcohol/TequilaSunriseBuff.cs index af5a5f174a..4e585431be 100644 --- a/Buffs/Alcohol/TequilaSunriseBuff.cs +++ b/Buffs/Alcohol/TequilaSunriseBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class TequilaSunriseBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index 9d36c9250e..269f727796 100644 Binary files a/Buffs/Alcohol/TequilaSunriseBuff.png and b/Buffs/Alcohol/TequilaSunriseBuff.png differ diff --git a/Buffs/Alcohol/Trippy.png b/Buffs/Alcohol/Trippy.png index 7efc1b9c5d..de9e29e023 100644 Binary files a/Buffs/Alcohol/Trippy.png and b/Buffs/Alcohol/Trippy.png differ diff --git a/Buffs/Alcohol/VodkaBuff.cs b/Buffs/Alcohol/VodkaBuff.cs index 46eaee8329..2e8cf72fa9 100644 --- a/Buffs/Alcohol/VodkaBuff.cs +++ b/Buffs/Alcohol/VodkaBuff.cs @@ -1,19 +1,22 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class VodkaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index ba5666ddbc..ee994b6d8b 100644 Binary files a/Buffs/Alcohol/VodkaBuff.png and b/Buffs/Alcohol/VodkaBuff.png differ diff --git a/Buffs/Alcohol/WhiskeyBuff.cs b/Buffs/Alcohol/WhiskeyBuff.cs index 66be5a8a0c..4e67347944 100644 --- a/Buffs/Alcohol/WhiskeyBuff.cs +++ b/Buffs/Alcohol/WhiskeyBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class WhiskeyBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/WhiskeyBuff.png b/Buffs/Alcohol/WhiskeyBuff.png index fce1a5403b..53196936b8 100644 Binary files a/Buffs/Alcohol/WhiskeyBuff.png and b/Buffs/Alcohol/WhiskeyBuff.png differ diff --git a/Buffs/Alcohol/WhiteWineBuff.cs b/Buffs/Alcohol/WhiteWineBuff.cs index eb47a1056f..c8baa10765 100644 --- a/Buffs/Alcohol/WhiteWineBuff.cs +++ b/Buffs/Alcohol/WhiteWineBuff.cs @@ -1,18 +1,21 @@ -using Terraria; -using Terraria.ID; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class WhiteWineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; Main.persistentBuff[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Alcohol/WhiteWineBuff.png b/Buffs/Alcohol/WhiteWineBuff.png index bfa64feecc..8d5ec47e7b 100644 Binary files a/Buffs/Alcohol/WhiteWineBuff.png and b/Buffs/Alcohol/WhiteWineBuff.png differ diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 816051bcf7..a5a4cd48d5 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -140,14 +140,16 @@ namespace CalamityMod.Buffs { // Globally remove summon tag debuff stacking, unless allowed in the SummonTag // Other mods need to add to this list because otherwise we can't tell which IsATag buff is actually for whips - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out var tag1) && !tag1.AllowsWhipStacking && buffIndex > 0) + var tag1 = CalamityBuffSets.SummonTagDebuff[type]; + if (tag1 is not null && !tag1.AllowsWhipStacking && buffIndex > 0) { for (int i = buffIndex; i >= 0; i--) { if (npc.buffTime[i] > 0) { int buffID = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(buffID, out var tag2) && !tag2.AllowsWhipStacking && buffID != type) + var tag2 = CalamityBuffSets.SummonTagDebuff[buffID]; + if (tag2 is not null && !tag2.AllowsWhipStacking && buffID != type) { npc.DelBuff(i); break; diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.cs b/Buffs/DamageOverTime/AstralInfectionDebuff.cs index f2245d91aa..6374e43865 100644 --- a/Buffs/DamageOverTime/AstralInfectionDebuff.cs +++ b/Buffs/DamageOverTime/AstralInfectionDebuff.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/AuricRebuke.cs b/Buffs/DamageOverTime/AuricRebuke.cs index 939e1c5fdf..f06fd01e68 100644 --- a/Buffs/DamageOverTime/AuricRebuke.cs +++ b/Buffs/DamageOverTime/AuricRebuke.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Bane.cs b/Buffs/DamageOverTime/Bane.cs index c429af3dda..be6e0a4104 100644 --- a/Buffs/DamageOverTime/Bane.cs +++ b/Buffs/DamageOverTime/Bane.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -25,7 +26,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public static void BaneNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) { diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index 23daa2a06f..5a9a8730ac 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -24,7 +25,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BrainRot.cs b/Buffs/DamageOverTime/BrainRot.cs index c1f9a49ae2..85e4c1ff09 100644 --- a/Buffs/DamageOverTime/BrainRot.cs +++ b/Buffs/DamageOverTime/BrainRot.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BrimstoneFlames.cs b/Buffs/DamageOverTime/BrimstoneFlames.cs index b05c42232b..ecfaa64e0c 100644 --- a/Buffs/DamageOverTime/BrimstoneFlames.cs +++ b/Buffs/DamageOverTime/BrimstoneFlames.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 5f8e036feb..7988b34e5a 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index 63c9fa2ebc..b2eea3b897 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Daybroken.cs b/Buffs/DamageOverTime/Daybroken.cs index 947f6c2611..bde8625d72 100644 --- a/Buffs/DamageOverTime/Daybroken.cs +++ b/Buffs/DamageOverTime/Daybroken.cs @@ -4,6 +4,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = DebuffData.Daybroken; + CalamityBuffSets.DebuffDataset[Type] = DebuffData.Daybroken; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 8e8fd369a5..2bdfd02258 100644 --- a/Buffs/DamageOverTime/DemonicFlames.cs +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -29,7 +30,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Dragonfire.cs b/Buffs/DamageOverTime/Dragonfire.cs index bc3ff034b3..614e450322 100644 --- a/Buffs/DamageOverTime/Dragonfire.cs +++ b/Buffs/DamageOverTime/Dragonfire.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/ElementalMix.cs b/Buffs/DamageOverTime/ElementalMix.cs index d057dcd645..ee76ef1642 100644 --- a/Buffs/DamageOverTime/ElementalMix.cs +++ b/Buffs/DamageOverTime/ElementalMix.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/GodSlayerInferno.cs b/Buffs/DamageOverTime/GodSlayerInferno.cs index f7d799fafa..21a6d3c7cf 100644 --- a/Buffs/DamageOverTime/GodSlayerInferno.cs +++ b/Buffs/DamageOverTime/GodSlayerInferno.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HadopelagicPressure.cs b/Buffs/DamageOverTime/HadopelagicPressure.cs index 6cc7804326..f014b8789e 100644 --- a/Buffs/DamageOverTime/HadopelagicPressure.cs +++ b/Buffs/DamageOverTime/HadopelagicPressure.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -70,7 +71,7 @@ namespace CalamityMod.Buffs.DamageOverTime Particle smoke = new HeavySmokeParticle(npcSize, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), smokeColor, 40, Main.rand.NextFloat(0.3f, 0.4f) + (0.00000013f * npc.width * npc.height), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); GeneralParticleHandler.SpawnParticle(smoke); } - Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 360, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); + Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 390, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); water.noGravity = true; water.velocity *= 0.75f; water.velocity.X = water.velocity.X * 0.75f; diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs index 49782c6cb6..2b545a3988 100644 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index 84a60b5e22..1a90bca57d 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HolyInferno.cs b/Buffs/DamageOverTime/HolyInferno.cs index eaf25ad6a1..77882f2a00 100644 --- a/Buffs/DamageOverTime/HolyInferno.cs +++ b/Buffs/DamageOverTime/HolyInferno.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Laceration.cs b/Buffs/DamageOverTime/Laceration.cs index 8e50c0422d..021829ed16 100644 --- a/Buffs/DamageOverTime/Laceration.cs +++ b/Buffs/DamageOverTime/Laceration.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/MiracleBlight.cs b/Buffs/DamageOverTime/MiracleBlight.cs index 448b4616a7..eccb776377 100644 --- a/Buffs/DamageOverTime/MiracleBlight.cs +++ b/Buffs/DamageOverTime/MiracleBlight.cs @@ -13,6 +13,7 @@ using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -55,7 +56,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index dbdbef4d02..9578921853 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Plague.cs b/Buffs/DamageOverTime/Plague.cs index 45875dc587..7c3b9a3e77 100644 --- a/Buffs/DamageOverTime/Plague.cs +++ b/Buffs/DamageOverTime/Plague.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/RiptideDebuff.cs b/Buffs/DamageOverTime/RiptideDebuff.cs index e68629fae6..74b3d510fc 100644 --- a/Buffs/DamageOverTime/RiptideDebuff.cs +++ b/Buffs/DamageOverTime/RiptideDebuff.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index 5065122406..ba20aefe40 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -58,7 +59,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { 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/SearingLava.cs b/Buffs/DamageOverTime/SearingLava.cs index 708af57feb..bdc5182787 100644 --- a/Buffs/DamageOverTime/SearingLava.cs +++ b/Buffs/DamageOverTime/SearingLava.cs @@ -2,6 +2,7 @@ using CalamityMod.DataStructures; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -33,7 +34,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index 3b89427e23..f7ef42d959 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -5,6 +5,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -18,7 +19,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = DebuffData.Shadowflame; + CalamityBuffSets.DebuffDataset[Type] = DebuffData.Shadowflame; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index c70408473c..32c4224576 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -1,8 +1,11 @@ -using CalamityMod.Balancing; +using System; +using CalamityMod.Balancing; using CalamityMod.DataStructures; using CalamityMod.Projectiles.Summon; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -10,11 +13,14 @@ namespace CalamityMod.Buffs.DamageOverTime { public static DebuffData debuffData = new DebuffData() { - EnemyLostRegen = 150, //Damage per shellfish + EnemyLostRegen = 170, //Damage per shellfish NPCLifeRegenMethod = ShellfishStacking }; public static void ShellfishStacking(NPC npc, int buffType, ref int buffIndex, ref int damage) { + if (npc.SuperArmor) + return; + int projectileCount = 0; int owner = 255; foreach (Projectile p in Main.ActiveProjectiles) @@ -33,12 +39,12 @@ namespace CalamityMod.Buffs.DamageOverTime } 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); - int totalDisplayedDamage = totalDamage / 5; + int totalDisplayedDamage = (int)Math.Max(totalDamage * debuffData.MultiplierDamageTickSize, debuffData.MinimumDamageTickSize); npc.Calamity().ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); } public override void SetStaticDefaults() @@ -46,7 +52,8 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; + BuffID.Sets.IsATagBuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SnapClamDebuff.cs b/Buffs/DamageOverTime/SnapClamDebuff.cs index acf115c563..8f9f59d4aa 100644 --- a/Buffs/DamageOverTime/SnapClamDebuff.cs +++ b/Buffs/DamageOverTime/SnapClamDebuff.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -34,7 +35,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/StaticDischarge.cs b/Buffs/DamageOverTime/StaticDischarge.cs index 5b88e5a0c0..457d88f93c 100644 --- a/Buffs/DamageOverTime/StaticDischarge.cs +++ b/Buffs/DamageOverTime/StaticDischarge.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index 614e9f0c56..73e3144904 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; // Acid Venom immunity is granted automatically if you are immune to Sulphuric Poisoning. BuffID.Sets.GrantImmunityWith[BuffID.Venom].Add(Type); diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index e7eb641700..2145aba8db 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -28,7 +29,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().trueVHex = true; diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 87e8b8d1b7..47068b9b71 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -23,7 +24,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/VermillionFlux.cs b/Buffs/DamageOverTime/VermillionFlux.cs index 8e4f03ccc0..71384ef591 100644 --- a/Buffs/DamageOverTime/VermillionFlux.cs +++ b/Buffs/DamageOverTime/VermillionFlux.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Voidfrost.cs b/Buffs/DamageOverTime/Voidfrost.cs index 37280063fa..44b85decd2 100644 --- a/Buffs/DamageOverTime/Voidfrost.cs +++ b/Buffs/DamageOverTime/Voidfrost.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index d1275f89ae..2ce9745729 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -31,7 +32,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index 75bf7fdde9..9a0fd3a13b 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -1,6 +1,7 @@ using CalamityMod.DataStructures; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true; diff --git a/Buffs/DamageOverTime/WindChilled.cs b/Buffs/DamageOverTime/WindChilled.cs new file mode 100644 index 0000000000..4b5197bc2b --- /dev/null +++ b/Buffs/DamageOverTime/WindChilled.cs @@ -0,0 +1,108 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class WindChilled : ModBuff + { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 12, + NPCLifeRegenMethod = WindChilledNPCLifeRegen, + ColdDebuffScaling = 1 + }; + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + CalamityBuffSets.DebuffDataset[Type] = debuffData; + } + public static void WindChilledNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + + int baseDoTValue = (int)(cnpc.windChilledMult * npc.Calamity().ActiveColdDebuffMultiplier.ApplyTo(debuffData.EnemyLostRegen)); + cnpc.ApplyDPSDebuff(baseDoTValue, Math.Max((int)(baseDoTValue * debuffData.MultiplierDamageTickSize), debuffData.MinimumDamageTickSize) / 2, ref npc.lifeRegen, ref damage); + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().windChilled = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().windChilled = true; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player player = drawInfo.drawPlayer; + + float widthMult = 1; + float hightMult = 1; + Color color = Elumphant.color1; + Color color2 = Elumphant.color2; + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + if (Main.rand.NextBool(16)) + { + bool start = !Main.rand.NextBool(4); + Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + player.velocity * 0.85f; + Vector2 particlePos = player.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult); + Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult))); + GeneralParticleHandler.SpawnParticle(mist, true, Enums.GeneralDrawLayer.AfterPlayers); + } + if (Main.rand.NextBool(11)) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1); + Dust dust2 = Dust.NewDustPerfect(player.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType(), + Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult)); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? color : color2; + dust2.customData = new Vector2(0.7f, 1.4f); + dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult); + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + float maxSizeMult = 10f; + float widthMult = MathF.Pow(Utils.Remap(npc.width, 10, 500, 1f, maxSizeMult, false), 0.8f); + float hightMult = MathF.Pow(Utils.Remap(npc.height, 10, 500, 1f, maxSizeMult, false), 0.8f); + Color color = Elumphant.color1; + Color color2 = Elumphant.color2; + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + if (Main.rand.NextBool(16)) + { + bool start = !Main.rand.NextBool(4); + Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + npc.velocity * 0.85f; + Vector2 particlePos = npc.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult); + Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult))); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + if (Main.rand.NextBool(11)) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1); + Dust dust2 = Dust.NewDustPerfect(npc.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType(), + Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult)); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? color : color2; + dust2.customData = new Vector2(0.7f, 1.4f); + dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult); + } + } + } +} diff --git a/NPCs/SunkenSea/StormlionSentryHead.png b/Buffs/DamageOverTime/WindChilled.png similarity index 79% rename from NPCs/SunkenSea/StormlionSentryHead.png rename to Buffs/DamageOverTime/WindChilled.png index eefe88b4e4..ad600bb991 100644 Binary files a/NPCs/SunkenSea/StormlionSentryHead.png and b/Buffs/DamageOverTime/WindChilled.png differ 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/Pets/StarSwallowerPetBuff.cs b/Buffs/Pets/StarSwallowerPetBuff.cs new file mode 100644 index 0000000000..210bc1ebf6 --- /dev/null +++ b/Buffs/Pets/StarSwallowerPetBuff.cs @@ -0,0 +1,17 @@ +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class StarSwallowerPetBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) => player.BuffHandle_SpawnPetIfNeededAndSetTime(buffIndex, ref player.Calamity().starSwallowerPetFroge, ModContent.ProjectileType()); + } +} diff --git a/Buffs/Pets/StarSwallowerPetBuff.png b/Buffs/Pets/StarSwallowerPetBuff.png new file mode 100644 index 0000000000..7a12cb7a9a Binary files /dev/null and b/Buffs/Pets/StarSwallowerPetBuff.png differ diff --git a/Buffs/Placeables/BlueCandleBuff.png b/Buffs/Placeables/BlueCandleBuff.png index a73721ff8f..c8ba5aa330 100644 Binary files a/Buffs/Placeables/BlueCandleBuff.png and b/Buffs/Placeables/BlueCandleBuff.png differ diff --git a/Buffs/Placeables/CorruptionEffigyBuff.png b/Buffs/Placeables/CorruptionEffigyBuff.png index 557440806c..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/Placeables/PinkCandleBuff.png b/Buffs/Placeables/PinkCandleBuff.png index c299a08857..a5eb745a86 100644 Binary files a/Buffs/Placeables/PinkCandleBuff.png and b/Buffs/Placeables/PinkCandleBuff.png differ diff --git a/Buffs/Placeables/PurpleCandleBuff.png b/Buffs/Placeables/PurpleCandleBuff.png index 3ff18f000a..64959e5df2 100644 Binary files a/Buffs/Placeables/PurpleCandleBuff.png and b/Buffs/Placeables/PurpleCandleBuff.png differ diff --git a/Buffs/Placeables/YellowCandleBuff.png b/Buffs/Placeables/YellowCandleBuff.png index 2ac39e16dd..cf263248cb 100644 Binary files a/Buffs/Placeables/YellowCandleBuff.png and b/Buffs/Placeables/YellowCandleBuff.png differ diff --git a/Buffs/Potions/BaguetteBuff.cs b/Buffs/Potions/BaguetteBuff.cs index 878bca7213..8e6e11aac2 100644 --- a/Buffs/Potions/BaguetteBuff.cs +++ b/Buffs/Potions/BaguetteBuff.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Potions.Food; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions @@ -7,7 +8,7 @@ namespace CalamityMod.Buffs.Potions { public override void SetStaticDefaults() { - Main.debuff[Type] = false; + Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; } @@ -15,6 +16,7 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { player.Calamity().baguette = true; + player.lifeRegen -= Baguette.RedWineRegenLoss; } } } diff --git a/Buffs/Potions/SwinesWrathBuff.cs b/Buffs/Potions/SwinesWrathBuff.cs new file mode 100644 index 0000000000..14ae221f5b --- /dev/null +++ b/Buffs/Potions/SwinesWrathBuff.cs @@ -0,0 +1,48 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +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() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + TheConcoctionPlayer concoctionPlayer = player.GetModPlayer(); + + if (concoctionPlayer.swinesWrathCounter < 2 && concoctionPlayer.swinesWrathCounter != -1) + { + 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(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/Potions/SwinesWrathBuff.png b/Buffs/Potions/SwinesWrathBuff.png new file mode 100644 index 0000000000..53347dfda7 Binary files /dev/null and b/Buffs/Potions/SwinesWrathBuff.png differ 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/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index 53a0e6b247..6400ba9f56 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class Mushy : ModBuff { - public static int DefenseBoost = 5; + public static int DefenseBoost = 3; public static int RegenBoost = 2; public override LocalizedText Description => base.Description.WithFormatArgs(DefenseBoost, RegenBoost.ToRegenPerSecond()); diff --git a/Buffs/StatBuffs/SmashedEvil.cs b/Buffs/StatBuffs/SmashedEvil.cs index 9991a19dad..2a67a162d9 100644 --- a/Buffs/StatBuffs/SmashedEvil.cs +++ b/Buffs/StatBuffs/SmashedEvil.cs @@ -1,8 +1,7 @@ using System; using CalamityMod.DataStructures; -using CalamityMod.Items.Accessories; +using CalamityMod.Systems.Collections; using Terraria; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs @@ -11,7 +10,7 @@ namespace CalamityMod.Buffs.StatBuffs { public static DebuffData debuffData = new DebuffData() { - EnemyLostRegen = 40, + EnemyLostRegen = 160, SicknessDebuffScaling = 1, HeatDebuffScaling = 1, ColdDebuffScaling = 1, @@ -38,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); } @@ -47,14 +53,13 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } 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/AbsorberAffliction.cs b/Buffs/StatDebuffs/AbsorberAffliction.cs index 55df57f042..5d8251900e 100644 --- a/Buffs/StatDebuffs/AbsorberAffliction.cs +++ b/Buffs/StatDebuffs/AbsorberAffliction.cs @@ -4,6 +4,7 @@ using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/Crumbling.cs b/Buffs/StatDebuffs/Crumbling.cs index 2539449caf..48ce39f04c 100644 --- a/Buffs/StatDebuffs/Crumbling.cs +++ b/Buffs/StatDebuffs/Crumbling.cs @@ -6,8 +6,6 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Crumbling : ModBuff { - public static int DefenseReduction = 10; - public static float MultiplicativeDamageReductionPlayer = 0.7f; // 8% DR reduction public static float MultiplicativeDamageReductionEnemy = 0.92f; @@ -24,10 +22,5 @@ namespace CalamityMod.Buffs.StatDebuffs { npc.Calamity().crumble = true; } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().crumble = true; - } } } diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 512476ef2d..7cafbbd2d4 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -4,6 +4,7 @@ using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -15,7 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } // Purely to make it get electric color in tooltips public static DebuffData debuffData = new DebuffData() diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 21166569fe..ce9a20f3f4 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -53,7 +54,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/Malnourished.cs b/Buffs/StatDebuffs/Malnourished.cs new file mode 100644 index 0000000000..03b0f4e08c --- /dev/null +++ b/Buffs/StatDebuffs/Malnourished.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class Malnourished : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().malnourished = true; + } + } +} diff --git a/Buffs/StatDebuffs/Malnourished.png b/Buffs/StatDebuffs/Malnourished.png new file mode 100644 index 0000000000..8f25176a8a Binary files /dev/null and b/Buffs/StatDebuffs/Malnourished.png differ diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 04f29017ff..a7d62109e7 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -2,11 +2,15 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff { + public static float PlayerDamageReduction = 0.2f; + public static float EnemyDamageReduction = 0.1f; + // Whispering Death does not deal DoT, but is classified as a sickness debuff. public static DebuffData debuffData = new DebuffData() { @@ -18,7 +22,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Summon/RareSandElemental.cs b/Buffs/Summon/OasisElementalBuff.cs similarity index 68% rename from Buffs/Summon/RareSandElemental.cs rename to Buffs/Summon/OasisElementalBuff.cs index 2748620ff6..962ce3dadb 100644 --- a/Buffs/Summon/RareSandElemental.cs +++ b/Buffs/Summon/OasisElementalBuff.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class RareSandElemental : BaseSummonBuff + public class OasisElementalBuff : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.rareSandEleBuff; + protected override ref bool MinionBool => ref BuffModdedOwner.oasisEleBuff; } } diff --git a/Buffs/Summon/RareSandElemental.png b/Buffs/Summon/OasisElementalBuff.png similarity index 100% rename from Buffs/Summon/RareSandElemental.png rename to Buffs/Summon/OasisElementalBuff.png 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.cs b/Buffs/Summon/SeashineSwordBuff.cs deleted file mode 100644 index c45048954a..0000000000 --- a/Buffs/Summon/SeashineSwordBuff.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class SeashineSwordBuff : BaseSummonBuff - { - protected override int MinionProjectileType => ModContent.ProjectileType(); - - protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff; - } -} 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/Buffs/UHFMurasamaCooldown.png b/Buffs/UHFMurasamaCooldown.png deleted file mode 100644 index 7640c31cfa..0000000000 Binary files a/Buffs/UHFMurasamaCooldown.png and /dev/null differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fd8c49ad3f..76ca7d151f 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; @@ -43,6 +44,7 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Potions.Food; using CalamityMod.Items.Tools; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.TreasureBags.MiscGrabBags; @@ -60,7 +62,6 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -68,7 +69,10 @@ 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; using Microsoft.Xna.Framework.Graphics; @@ -84,7 +88,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Net; -using Terraria.WorldBuilding; using static Terraria.Main; using static Terraria.ModLoader.ModContent; @@ -140,6 +143,13 @@ namespace CalamityMod.CalPlayer /// public bool heldGaelsLastFrame = false; /// + /// Tracks whether or not the player is currently holding Elephant Killer.
+ /// Used to reset stealth when swapping to this item. + ///
+ public bool heldElephantKillerLastFrame = false; + public float elephantKillerJoke = 0; + public bool drawingElephantKillerJoke = false; + /// /// Tracks whether or not the player currently has Draedon's Heart equipped.
/// Used to reset Adrenaline when (un)equipped to prevent exploits. ///
@@ -187,11 +197,11 @@ namespace CalamityMod.CalPlayer public enum FishingMinigames { None, - ScrapBobber, - NavystoneBobber, - SkylineBobber, - PerennialBobber, - ScoriaBobber, + WulfrumBobber, + SunkenSinker, + AcrobaticBobber, + FeralBobber, + VolcanicSinker, DevourerofCods //Not a fishing minigame but uses the same code as the rest } public FishingMinigames SelectedFishingMinigame = FishingMinigames.None; @@ -379,9 +389,12 @@ namespace CalamityMod.CalPlayer public int hideOfDeusMeleeBoostTimer = 0; /// /// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.
- /// If this value is greater than 3, the player is inflicted with Alcohol Poisoning. + /// If this value is greater than the max (normally 3), the player is inflicted with Alcohol Poisoning. ///
public int alcoholPoisonLevel = 0; + public static int alcoholPoisonMaxBase = 3; + /// The maximum alcohol level the player can reach before getting Alcohol Poisoning. + public int alcoholPoisonMax = alcoholPoisonMaxBase; public int dashTimeMod; /// /// Timer variable which tracks how long the player has spent outside of Providence's border radius, in frames.
@@ -389,19 +402,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; @@ -423,6 +432,7 @@ namespace CalamityMod.CalPlayer public int murasamaHitCooldown = 0; public int giantShellPostHit = 0; public int tortShellPostHit = 0; + public int sharkGunDamageScaling = 0; public int MiniSwarmerCooldown = 0; public float SulphWaterPoisoningLevel; public float holyInfernoFadeIntensity; @@ -589,6 +599,8 @@ namespace CalamityMod.CalPlayer public bool lordePet = false; public bool frostyBat = false; public bool toastyBat = false; + public bool beldum = false; + public bool starSwallowerPetFroge = false; #endregion #region Rage @@ -767,8 +779,6 @@ namespace CalamityMod.CalPlayer #endregion #region Permanent Buff - /// If true, the player has spawned in Punch Card through its one-time chat easter egg. - public bool spawnedPunchCard = false; /// If true, the player has consumed Celestial Onion. public bool extraAccessoryML = false; /// If true, the player has consumed Comet Shard. @@ -803,6 +813,7 @@ namespace CalamityMod.CalPlayer #endregion #region Accessory + public int friendlyMinions = 0; public bool shieldOfTheHighRulerDashVelocityBoosted = false; public bool yharimsGift = false; public bool luxorsGift = false; @@ -829,15 +840,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 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; @@ -851,16 +858,19 @@ 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; + public bool fishStocks = false; + public float fishStockVisual = 0; + public float fishStockPower = 0; + public float fishStockSlidingPower = 0; + public (float, float, float, float, float) fishStockOldPower = (0, 0, 0, 0, 0); /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; @@ -871,8 +881,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; @@ -910,12 +918,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. @@ -943,8 +947,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; @@ -956,7 +958,7 @@ namespace CalamityMod.CalPlayer public int nanotechHitCooldown = 0; public bool deadshotBrooch = false; public bool shadowMinions = false; - public bool holyMinions = false; + public bool statisMinions = false; public bool alchFlask = false; public bool toxicHeart = false; public bool toxicHeartVisuals = false; @@ -988,12 +990,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. @@ -1032,21 +1031,20 @@ namespace CalamityMod.CalPlayer /// At 0f, the player has regular crit damage. At 1f, the player has +100% crit damage. ///
public float critDamage = 0; + /// + /// Multiplies the amount of coins the player gets from enemies. + /// + public float coinDropMult = 1f; public bool darkSunRing = false; public bool crawCarapace = false; public bool baroclaw = false; public bool IsFirstDashFrame = true; public int fallingBootVelCheckTimer = 0; - public bool voidOfCalamity = false; public bool apollyon = false; - public bool eArtifact = false; - public bool dArtifact = false; - public bool auricSArtifact = 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; @@ -1066,7 +1064,6 @@ 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; @@ -1080,8 +1077,8 @@ namespace CalamityMod.CalPlayer public float summonProjCooldown; public bool sandElemental = false; public bool sandElementalVanity = false; - public bool rareSandElemental = false; - public bool rareSandElementalVanity = false; + public bool oasisElemental = false; + public bool oasisElementalVanity = false; public bool cloudElemental = false; public bool cloudElementalVanity = false; public bool brimElemental = false; @@ -1102,7 +1099,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; @@ -1128,8 +1124,12 @@ namespace CalamityMod.CalPlayer public bool scionsCurioGotHit = false; public bool scionsCurioVisuals = false; public float scionsCurioDebuffDamage = 0; - public bool miniOldDuke = false; - public bool miniOldDukeVanity = false; + 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 starbusterCore = false; public bool starTaintedGenerator = false; public bool hallowedRune = false; @@ -1201,19 +1201,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; @@ -1237,7 +1231,7 @@ namespace CalamityMod.CalPlayer 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; @@ -1256,8 +1250,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; @@ -1268,7 +1261,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; @@ -1278,7 +1270,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; @@ -1326,7 +1317,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. @@ -1368,7 +1358,6 @@ namespace CalamityMod.CalPlayer public bool staticDischarge = false; public bool miracleBlight = false; public bool armorCrunch = false; - public bool crumble = false; public bool irradiated = false; public bool bane = false; public bool brimstoneFlames = false; @@ -1394,6 +1383,7 @@ namespace CalamityMod.CalPlayer public bool riptide = false; public bool hadopelagicPressure = false; public bool fishAlert = false; + public bool malnourished = false; public bool clamity = false; public bool NOU = false; public bool absorberAffliction = false; @@ -1406,6 +1396,7 @@ namespace CalamityMod.CalPlayer public bool vaporfied = false; public bool banishingFire = false; public bool wither = false; + public bool windChilled = false; public bool ManaBurn = false; /// Counter variable used to prevent the player from being inflicted with another immobilizing debuff for a short time after being inflicted with one. @@ -1440,7 +1431,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; @@ -1485,6 +1475,8 @@ namespace CalamityMod.CalPlayer public bool whiteWine = false; public float whiteWineTimer = 0; public bool evergreenGin = false; + public bool baconOil = false; + public int baconOilSoundCooldown = 0; public bool tranquilityCandle = false; public bool chaosCandle = false; public bool blueCandle = false; @@ -1563,8 +1555,8 @@ namespace CalamityMod.CalPlayer public bool sCrystal = false; /// Elemental in a Bottle. public bool sandEleBuff = false; - /// Rare Elemental in a Bottle. - public bool rareSandEleBuff = false; + /// Oasis Elemental in a Bottle. + public bool oasisEleBuff = false; /// Eye of the Storm. public bool cloudEleBuff = false; /// Rose Stone. @@ -1680,7 +1672,6 @@ namespace CalamityMod.CalPlayer public bool abyssDeath = false; public int abyssBreathCD; - public float caveDarkness = 0f; #endregion #region Transformation @@ -1697,11 +1688,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; @@ -1839,7 +1828,6 @@ namespace CalamityMod.CalPlayer #region Saving And Loading public override void Initialize() { - spawnedPunchCard = false; extraAccessoryML = false; eCore = false; mFruit = false; @@ -1891,7 +1879,6 @@ namespace CalamityMod.CalPlayer public override void SaveData(TagCompound tag) { var boost = new List(); - boost.AddWithCondition("spawnedPunchCard", spawnedPunchCard); boost.AddWithCondition("extraAccessoryML", extraAccessoryML); boost.AddWithCondition("etherealCore", eCore); boost.AddWithCondition("miracleFruit", mFruit); @@ -1981,7 +1968,6 @@ namespace CalamityMod.CalPlayer public override void LoadData(TagCompound tag) { var boost = tag.GetList("boost"); - spawnedPunchCard = boost.Contains("spawnedPunchCard"); extraAccessoryML = boost.Contains("extraAccessoryML"); eCore = boost.Contains("etherealCore"); mFruit = boost.Contains("miracleFruit"); @@ -2161,6 +2147,7 @@ namespace CalamityMod.CalPlayer externalAuricRejectionImmunity = false; alcoholPoisonLevel = 0; + alcoholPoisonMax = alcoholPoisonMaxBase; noLifeRegen = false; //Stratus Starburst amount management @@ -2250,6 +2237,7 @@ namespace CalamityMod.CalPlayer if (!pSoulArtifact) pSoulShieldDurability = 0; } + friendlyMinions = 0; pSoulShieldVisible = false; roverDrive = false; roverDriveShieldVisible = false; @@ -2287,13 +2275,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; @@ -2310,7 +2298,7 @@ namespace CalamityMod.CalPlayer nebulousCore = false; godSlayer = false; - godSlayerDamage = false; + godSlayerMelee = false; godSlayerRanged = false; godSlayerThrowing = false; @@ -2319,8 +2307,6 @@ namespace CalamityMod.CalPlayer silvaSummon = false; auricSet = false; - auricSetMelee = false; - GemTechSet = false; CobaltSet = false; @@ -2347,7 +2333,7 @@ namespace CalamityMod.CalPlayer shadeRegen = false; shadowSpeed = false; - dsSetBonus = false; + demonshadeSet = false; wearingRogueArmor = false; blockAllDashes = false; @@ -2373,17 +2359,12 @@ namespace CalamityMod.CalPlayer protolithBangle = false; // Marble band protolithBangleVisual = false; aFossil = false; - aPowder = false; fallingBlockProtection = false; trapProtection = 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); @@ -2417,8 +2398,8 @@ namespace CalamityMod.CalPlayer deadshotBrooch = false; tesla = false; teslaVisuals = true; - cryogenSoul = false; ascendantInsignia = false; + fishStocks = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -2427,14 +2408,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; @@ -2456,7 +2435,6 @@ namespace CalamityMod.CalPlayer 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; @@ -2466,14 +2444,11 @@ namespace CalamityMod.CalPlayer darkSunRing = false; crawCarapace = false; baroclaw = false; - voidOfCalamity = false; apollyon = false; - eArtifact = false; - dArtifact = false; - auricSArtifact = false; + crushingEgo = false; + fadedIdolatry = false; pSoulArtifact = false; giantPearl = false; - shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; sPauldron = false; @@ -2491,8 +2466,6 @@ namespace CalamityMod.CalPlayer hallowedRegen = false; hallowedPower = false; tracersDust = false; - moonWalkers = false; - voidStriders = false; seraphTracers = false; ursaSergeant = false; ursaSergeantVisual = false; @@ -2508,6 +2481,7 @@ namespace CalamityMod.CalPlayer camper = false; corrosiveSpine = false; scionsCurio = false; + frozenCube = false; frozenCubeVanity = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; rottenDogTooth = false; angelicAlliance = false; ChaosStone = false; @@ -2581,18 +2555,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; @@ -2600,7 +2568,6 @@ namespace CalamityMod.CalPlayer plagueReaper = false; plaguebringerPatronSet = false; plaguebringerCarapace = false; - fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; fathomSwarmerTail = false; @@ -2638,7 +2605,6 @@ namespace CalamityMod.CalPlayer moonCrown = false; mageCrownVisibility = false; dragonScales = false; - gloveOfPrecision = false; gloveOfRecklessness = false; vampiricTalisman = false; electricianGlove = false; @@ -2666,7 +2632,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -2693,6 +2658,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; enraged = false; @@ -2706,6 +2672,7 @@ namespace CalamityMod.CalPlayer vaporfied = false; banishingFire = false; wither = false; + windChilled = false; ManaBurn = false; TypelessDebuffMultiplier = new(); @@ -2751,7 +2718,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -2780,6 +2746,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; @@ -2826,7 +2793,7 @@ namespace CalamityMod.CalPlayer cEnergy = false; pSoulGuardians = false; sandEleBuff = false; - rareSandEleBuff = false; + oasisEleBuff = false; cloudEleBuff = false; brimEleBuff = false; waterEleBuff = false; @@ -2843,8 +2810,8 @@ namespace CalamityMod.CalPlayer MutatedTruffleBool = false; sandElemental = false; sandElementalVanity = false; - rareSandElemental = false; - rareSandElementalVanity = false; + oasisElemental = false; + oasisElementalVanity = false; cloudElemental = false; cloudElementalVanity = false; brimElemental = false; @@ -2946,10 +2913,8 @@ namespace CalamityMod.CalPlayer pscState = 0; pscLerpColor = Color.White; - meldTransformationPrevious = meldTransformation; meldTransformation = meldTransformationForce = meldTransformationPower = false; - omegaBlueTransformationPrevious = omegaBlueTransformation; omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; rageModeActive = false; @@ -3069,6 +3034,7 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) consecutiveCaughtFish = 0; heldGaelsLastFrame = false; + heldElephantKillerLastFrame = false; partialLifeRegenCounter = 0f; gaelSwipes = 0; whitewaterHeal = 0; @@ -3076,7 +3042,6 @@ namespace CalamityMod.CalPlayer arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; - galileoCooldown = 0; soundCooldown = 0; dogTextCooldown = 0; auralisStealthCounter = 0f; @@ -3094,6 +3059,7 @@ namespace CalamityMod.CalPlayer holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; critDamage = 0f; + coinDropMult = 1f; rage = 0f; adrenaline = 0f; raiderCritLifespan = 0; @@ -3104,7 +3070,6 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; rOfDelivarenceRam = false; astralStarRainCooldown = 0; - VoidCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; transformerCooldown = 0; @@ -3123,14 +3088,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; @@ -3150,7 +3113,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -3177,6 +3139,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; snowmanNoseless = false; @@ -3189,6 +3152,7 @@ namespace CalamityMod.CalPlayer vaporfied = false; banishingFire = false; wither = false; + windChilled = false; ImmobilityDebuffImmunityTimer = 0; TypelessDebuffMultiplier = new(); HeatDebuffMultiplier = new(); @@ -3262,7 +3226,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -3291,6 +3254,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; blueCandle = false; @@ -3321,12 +3285,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; @@ -3340,7 +3303,6 @@ namespace CalamityMod.CalPlayer AdamantiteSet = false; WearingPostMLSummonerSet = false; AdamantiteSetDecayDelay = 0; - ChlorophyteHealDelay = 0; omegaBlueChestplate = false; omegaBlueSet = false; molluskHelmet = false; @@ -3359,13 +3321,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; @@ -3393,13 +3354,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; @@ -3424,8 +3381,6 @@ namespace CalamityMod.CalPlayer xerocSet = false; tracersDust = false; GemTechState.OnDeathEffects(); - shieldOfTheOceanParry = 0; - shieldOfTheOceanEmpoweredParry = false; blazingCoreParry = 0; blazingCoreEmpoweredParry = false; blazingCoreSuccessfulParry = 0; @@ -3605,7 +3560,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) @@ -3806,12 +3761,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 @@ -3987,36 +3936,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) @@ -4112,7 +4031,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++) @@ -4272,12 +4191,273 @@ namespace CalamityMod.CalPlayer vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles + smallerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings); if (canSpawn) - { return (Vector2?)vector; - } + return null; } + /// + /// Returns a random position in the Lihzhard Temple to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetTempleTeleportPosition(Player player) + { + int foundX = -1; + int foundY = -1; + bool templeOnLeftSide = Main.dungeonX > Main.spawnTileX; + int xSearchEnd = templeOnLeftSide ? 20 : Main.maxTilesX - 20; + + if (templeOnLeftSide) + { + for (int i = Main.spawnTileX; i >= xSearchEnd; i -= 2) + { + for (int j = (int)Main.worldSurface; j < Main.maxTilesY - 210; j++) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + { + foundX = i; + foundY = j; + break; + } + } + if (foundX != -1) + break; + } + } + else + { + for (int i = Main.spawnTileX; i <= xSearchEnd; i += 2) + { + for (int j = (int)Main.worldSurface; j < Main.maxTilesY - 210; j++) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + { + foundX = i; + foundY = j; + break; + } + } + + if (foundX != -1) + break; + } + } + + if (foundX == -1) + return null; + + int attempts = 25; + int rangeX = 100; + int rangeY = 100; + int randomFluff = 400; + Point finalTeleportPoint = Point.Zero; + for (int i = 0; i < attempts; i++) + { + for (int x = 0; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + 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 && 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)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); + } + + /// + /// Returns a random position in the Void (Abyss Layer 4) to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetAbyssVoidTeleportPosition(Player player) + { + int halfWorldWidth = Main.maxTilesX / 2; + int abyssStartX = Abyss.AtLeftSideOfWorld ? halfWorldWidth - (halfWorldWidth - 135) + 35 : halfWorldWidth + (halfWorldWidth - 135) - 35; + int abyssEndX = Abyss.AtLeftSideOfWorld ? 0 : Main.maxTilesX; + + int foundX = -1; + int foundY = -1; + + if (Abyss.AtLeftSideOfWorld) + { + 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; + } + } + 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); + } + + /// + /// Returns a random position in the Forsaken Archives to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetDungeonArchivesTeleportPosition(Player player) + { + // 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; + int xSearchStart = dungeonOnRightSide ? Main.maxTilesX - 20 : 20; + + if (dungeonOnRightSide) + { + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = xSearchStart; x >= Main.spawnTileX; x -= 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + else + { + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = xSearchStart; x <= Main.spawnTileX; x += 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + + if (foundY == -1) + return null; + + teleportStartX = foundX; + teleportStartY = foundY; + } + + + int attempts = 25; + int rangeX = 50; + int rangeY = 50; + int randomFluff = 20; + Point finalTeleportPoint = Point.Zero; + for (int i = 0; i < attempts; i++) + { + for (int x = 0; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + 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 && 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)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); + } + public static void ModTeleport(Player player, Vector2 pos, bool playSound = true, int style = TeleportationStyleID.RecallPotion) { bool postImmune = player.immune; @@ -4594,12 +4774,12 @@ namespace CalamityMod.CalPlayer } //Multiply vertical speed - if (redWine) + if (redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) { if (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f) { redWineStoredY = Player.velocity.Y; - Player.velocity.Y *= 1 + RedWine.VerticalSpeedBoost; + Player.velocity.Y *= 1 + (redWine ? RedWine.VerticalSpeedBoost : 0) + (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine) ? RedWine.VerticalSpeedBoost : 0); } else { @@ -4848,6 +5028,32 @@ namespace CalamityMod.CalPlayer } } } + + if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now + { + alcoholPoisonMax += TheSandwich.alcoholCapBoost; + // Gives inverted buffs from well fed + Player.statDefense -= 2; + Player.GetCritChance() -= 2; + Player.minionKB -= 0.5f; + Player.moveSpeed -= 0.05f; + // damage nerf/boost happens in PostUpdate + Player.pickSpeed += 0.05f; + + + for (int l = 0; l < Player.MaxBuffs; ++l) + { + int buffID = Player.buffType[l]; + if ((CalamityBuffSets.DebuffDataset[buffID] != null && CalamityBuffSets.DebuffDataset[buffID].AlcoholLevel > 0) || buffID == BuffID.Tipsy) + { + Player.buffTime[l]++; + } + } + + if (Player.wellFed) + Player.ClearBuff(ModContent.BuffType()); + } + if (moonshine) Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost)); ForceVariousEffects(); @@ -4880,7 +5086,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateEquips public override void PostUpdateEquips() { - + var dripPlayer = Player.GetModPlayer(); var item = Player.HeldItem; if (!(item.IsAir || item.damage <= 0)) { @@ -4889,11 +5095,13 @@ namespace CalamityMod.CalPlayer TimeHoldingMelee++; if (TimeHoldingMelee > Whiskey.TimeToDischarge) TimeHoldingMelee = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMelee / Whiskey.TimeToDischarge); - } - } else + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + } + else { TimeHoldingMelee -= 2; if (TimeHoldingMelee < 0) @@ -4903,11 +5111,12 @@ namespace CalamityMod.CalPlayer { TimeHoldingRanged++; if (TimeHoldingRanged > Whiskey.TimeToDischarge) - TimeHoldingRanged = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRanged / Whiskey.TimeToDischarge); - } + TimeHoldingRanged = (int)Whiskey.TimeToDischarge; + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); } else { @@ -4920,10 +5129,11 @@ namespace CalamityMod.CalPlayer TimeHoldingMagic++; if (TimeHoldingMagic > Whiskey.TimeToDischarge) TimeHoldingMagic = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMagic / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); } else { @@ -4936,10 +5146,11 @@ namespace CalamityMod.CalPlayer TimeHoldingSummon++; if (TimeHoldingSummon > Whiskey.TimeToDischarge) TimeHoldingSummon = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingSummon / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); } else { @@ -4952,10 +5163,12 @@ namespace CalamityMod.CalPlayer TimeHoldingRogue++; if (TimeHoldingRogue > Whiskey.TimeToDischarge) TimeHoldingRogue = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRogue / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + } else { @@ -4976,6 +5189,10 @@ namespace CalamityMod.CalPlayer if (TimeHoldingRogue-- < 0) TimeHoldingRogue = 0; } + if (dripPlayer.HasAlcohol(AlcoholType.Moonshine)) + { + Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost)); + } // PostUpdateMiscEffects runs after the cap has been applied. Do NOT put mining speed stuff there. @@ -5078,6 +5295,9 @@ namespace CalamityMod.CalPlayer public override void PostUpdate() { + if (Player.Calamity().XykVisualsBlue || Player.Calamity().XykVisualsOrange) + Player.wings = 0; + if (ZoneAbyss && Main.netMode != NetmodeID.Server) { //Main aura @@ -5112,7 +5332,7 @@ namespace CalamityMod.CalPlayer } //reset the stored Y value for red wine's increased vertical speed - if (redWine && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) + if ((redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) { Player.velocity.Y = redWineStoredY; } @@ -5131,6 +5351,17 @@ namespace CalamityMod.CalPlayer } } + // Frozen Cube defense cut + if (Player.Calamity().frozenCube) + { + int usedDefense = (Player.statDefense / FrozenCube.usedDefenseDivide); + Player.Calamity().frozenCubeUsedDefense = usedDefense; + Player.statDefense -= usedDefense; + } + + if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now + Player.GetDamage() += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel; + // Relic of Convergence defense cut if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.HeldItem.type == ModContent.ItemType()) Player.statDefense *= RelicOfConvergence.DefenseMultiplier; @@ -5180,14 +5411,13 @@ 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) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + (laudanum && Player.HasBuff(BuffID.VortexDebuff) ? 0.15f : 0f) + - ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * FrostFlare.HealthRatioThreshold)) ? FrostFlare.AccelerationBoost : 0f) + (dragonScales ? 0.1f : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + @@ -5197,22 +5427,19 @@ 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) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + - ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * FrostFlare.HealthRatioThreshold)) ? FrostFlare.AccelerationBoost : 0f) + (dragonScales ? 0.1f : 0f) + (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) @@ -5231,10 +5458,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; @@ -5262,6 +5494,92 @@ namespace CalamityMod.CalPlayer } #endregion + if ((Player.Calamity().baconOil || Player.GetModPlayer().HasAlcohol(AlcoholType.BaconOil)) && !Player.mount.Active) + { + Player.noFallDmg = true; + + float stackScale = (Player.Calamity().baconOil && Player.GetModPlayer().HasAlcohol(AlcoholType.BaconOil)) ? 1.33f : 1; + + float velX = Math.Abs(Player.velocity.X); + float velY = Math.Abs(Player.velocity.Y); + + float speedMult = Player.GetBestClassDamage().ApplyTo(1); + float maxMoveSpeed = 10.5f * speedMult * stackScale; + float minMoveSpeed = 3 * stackScale; // Minimum move speed to be at if the player can bounce + float hitboxSizeMult = 0.45f; + + bool onPlatform = false; + if (Player.velocity.Y > 0 && !Player.controlDown) + { + for (int i = 4; i < 8; i++) + { + Point bottom = (Player.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType]) + { + onPlatform = true; + } + } + } + + bool hitDown = velY > minMoveSpeed && (Collision.SolidCollision(Player.Bottom + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1) || onPlatform); + bool hitUp = velY > minMoveSpeed && Collision.SolidCollision(Player.Top + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1); + bool hitSide = velX > minMoveSpeed && Collision.SolidCollision(Vector2.Lerp(Player.TopLeft, Player.Left, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Player.TopRight, Player.Right, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)); + float acceleration = 0.05f * stackScale; + float decceleration = -0.025f / speedMult; + float riseSpeed = 0.8f * stackScale; // The speed the player rises when in water or rain + float slipPower = 0.85f; //How strong the slippery effect is + + float bounceReduction = 0.9f; + bool makeSound = false; + if (hitSide) + { + Player.velocity.X = -Player.velocity.X * bounceReduction; + Player.oldVelocity.X = -Player.oldVelocity.X * bounceReduction; + makeSound = true; + } + if ((hitDown || hitUp)) + { + if (Player.controlUp) + bounceReduction = 1.3f; + Player.velocity.Y = -Player.velocity.Y * bounceReduction; + Player.oldVelocity.Y = -Player.oldVelocity.Y * bounceReduction; + if (hitDown) + { + Player.RefreshMovementAbilities(true); + } + makeSound = true; + } + int soundCDMax = 150; + if (makeSound && baconOilSoundCooldown < soundCDMax) + { + if (baconOilSoundCooldown < soundCDMax) + baconOilSoundCooldown += 30; + float pitch = (0.55f * stackScale) * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true); + SoundStyle boyoyoing = new("CalamityMod/Sounds/Item/BaconOilBounce"); + SoundEngine.PlaySound(boyoyoing with { Volume = 0.45f, Pitch = hitSide ? pitch - 0.3f : pitch, MaxInstances = 5 }, Player.Center); + } + + bool playerMoving = Player.controlLeft || Player.controlRight; + bool playerMovingInDirection = (Player.controlLeft && Player.oldVelocity.X < 0) || (Player.controlRight && Player.oldVelocity.X > 0); + if (((Player.oldVelocity.X > 0 && Player.velocity.X > 0) || (Player.oldVelocity.X < 0 && Player.velocity.X < 0))) + Player.velocity.X = MathHelper.Clamp(Player.velocity.X + maxMoveSpeed * MathF.Sign(Player.oldVelocity.X) * + ((playerMovingInDirection || !playerMoving) ? Player.dashDelay == -1 ? decceleration : // If dashing, deccelerate to prevent infinite dash + // If not moving or holding in move direction, accelerate to max speed, otherwise deccelerate + acceleration : decceleration), -maxMoveSpeed, maxMoveSpeed); + + bool raining = Player.Center.Y < Main.worldSurface * 16.0 && Main.raining; + if ((Player.wet || raining) && Player.velocity.Y > -maxMoveSpeed) + { + Player.velocity.Y -= riseSpeed; // Cover yourself in oil (go up in liquid) + } + + + Vector2 lerpedVel = Vector2.Lerp(Player.velocity, Player.oldVelocity, slipPower); + Player.velocity = new Vector2(lerpedVel.X, Player.velocity.Y); + } + if (baconOilSoundCooldown > 0) + baconOilSoundCooldown = (int)MathHelper.Lerp(baconOilSoundCooldown, 0, 0.027f); + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion @@ -5293,7 +5611,8 @@ namespace CalamityMod.CalPlayer // Apply weapon modifier stealth strike damage bonus // 01OCT2023: Ozzatron: This is a multiplicative bonus because it is a prefix. // It should be equivalent to x1.15 (or whatever multiplier) on the base damage of the weapon for stealth only. - if (rogueItem.StealthStrikePrefixBonus != 0f && StealthStrikeAvailable()) + bool dontProvideStealthDamage = Player.HeldItem.type == ModContent.ItemType(); + if (rogueItem.StealthStrikePrefixBonus != 0f && StealthStrikeAvailable() && !dontProvideStealthDamage) damage *= rogueItem.StealthStrikePrefixBonus; // This number centers on 1f, so 1.15f = 1.15x damage. } } @@ -5305,6 +5624,8 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.MoscowMule)) + knockback += MoscowMule.KnockbackBoost; if (titanHeartMantle && rogue) knockback += TitanHeartMantle.RogueKnockbackBoost; @@ -5458,7 +5779,7 @@ namespace CalamityMod.CalPlayer rainbow.noGravity = true; } } - if (dsSetBonus) + if (demonshadeSet) { if (Main.rand.NextBool(3)) { @@ -5483,7 +5804,7 @@ namespace CalamityMod.CalPlayer { if (bladeArmEnchant) return false; - if (purpleHaze) + if (purpleHaze || Player.GetModPlayer().HasAlcohol(AlcoholType.PurpleHaze)) { if (item.CountsAsClass() && StealthStrikeAvailable()) { @@ -5545,6 +5866,8 @@ namespace CalamityMod.CalPlayer { Main.projectile[p].DamageType = DamageClass.Generic; //Makes it not proc shit like nanotech, extorter and other stuff Main.projectile[p].Calamity().LocketClone = true; //To not have clones trigger effects like Sacrifice's Lifesteal and Final Dawn's stealth generation + + Projectile.NewProjectile(LocketSource, Main.projectile[p].Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); // Spawn a little portal! } // Handle AI edge-cases. These are like overlapping projectiles and the projectile not spawning at all @@ -5920,32 +6243,6 @@ namespace CalamityMod.CalPlayer price /= vanillaPriceMult; } } - - public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) - { - // Remove excess alcohol - if (removeDebuffs && alcoholPoisonLevel > 3) - { - List Alcohol = new List(); - for (int i = 0; i < Player.MaxBuffs; i++) - { - int buff = Player.buffType[i]; - if (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level)) - Alcohol.Insert(0, new int[] { i, level }); - } - - int poison = alcoholPoisonLevel; - do - { - // Obtain the index:level relationship - int[] relation = Alcohol[0]; - Player.DelBuff(relation[0]); // Remove the alcohol - poison -= relation[1]; // Cancel the poison level - Alcohol.RemoveAt(0); - } - while (poison > 3); - } - } #endregion #region Rogue Stealth @@ -6040,11 +6337,18 @@ namespace CalamityMod.CalPlayer if (it.type == ItemType()) playerUsingWeapon = false; + // Elephant Killer consumes stealth in a special wa- hey maybe this is a sign this class needs some work huh + 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) { @@ -6106,7 +6410,7 @@ namespace CalamityMod.CalPlayer Player.ownedProjectileCounts[ProjectileType()]; // If you are actively using an item, you cannot gain stealth. - if (Player.itemAnimation > 0 || finalDawnProjCount > 0) + if (Player.itemAnimation > 0 || finalDawnProjCount > 0 || (Player.ownedProjectileCounts[ProjectileType()] > 0 || Player.HeldItem.type == ModContent.ItemType())) return 0f; if (shadow) @@ -6115,12 +6419,6 @@ namespace CalamityMod.CalPlayer stealthGenMoving += ShadowPotion.StealthRegenBoost; } - if (eArtifact) - { - stealthGenStandstill += 0.15f; - stealthGenMoving += 0.15f; - } - // Accessory modifiers can boost these stats stealthGenStandstill += accStealthGenBoost; stealthGenMoving += accStealthGenBoost; diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index cfc495120f..df08aeb84f 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -149,15 +149,11 @@ namespace CalamityMod.CalPlayer // Handle mid-dash effects. UsedDash.MidDashEffects(Player, ref dashSpeed, ref dashSpeedDecelerationFactor, ref runSpeedDecelerationFactor); - int VerticalOmnidashCap = DashID == GodslayerArmorDash.ID ? 75 : 25; - if (UsedDash.IsOmnidirectional && VerticalOmnidashTimer < VerticalOmnidashCap) + if (UsedDash.ForceEndAt > 0) { - VerticalOmnidashTimer++; - if (VerticalOmnidashTimer >= VerticalOmnidashCap) + if (UsedDash.dashTime >= UsedDash.ForceEndAt) { Player.dashDelay = dashDelayToApply; - // Stop the player from going flying - Player.velocity *= 0.2f; } } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index c00ca129b2..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) { @@ -584,18 +577,11 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.vHex && drawInfo.shadow == 0f) VulnerabilityHex.DrawEffects(drawInfo); + + if (calamityPlayer.windChilled && drawInfo.shadow == 0f) + 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 50bd493bad..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,11 +323,12 @@ namespace CalamityMod.CalPlayer itemDrop = ModContent.ItemType(); } - // Lower chance of Spadefish in Hardmode + // Lower chance of Spadefish in Hardmode and/or when already having a spadefish if (underground) // Underground { - int chance = Main.hardMode ? 10 : 2; - if (attempt.veryrare && Main.rand.NextBool(chance)) + 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(); } @@ -370,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 = @@ -411,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 @@ -438,6 +427,10 @@ namespace CalamityMod.CalPlayer if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = fishingLevel * HeronRod.FishingPowerBiomeMult; + // Rage bait gives free sonar effect + if (bait.type == ModContent.ItemType()) + Player.sonarPotion = true; + // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 2c8276d8ee..5579e5a77b 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using CalamityMod.Balancing; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; @@ -43,6 +42,7 @@ using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Pets; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; @@ -282,12 +282,11 @@ namespace CalamityMod.CalPlayer // Custom Death Messages + #region DoT Sources if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { 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 @@ -309,13 +308,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 @@ -324,116 +319,76 @@ 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 @@ -441,6 +396,7 @@ namespace CalamityMod.CalPlayer 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)); @@ -449,6 +405,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())) @@ -456,6 +413,11 @@ namespace CalamityMod.CalPlayer if (sCalDeathCount < 51) sCalDeathCount++; } + #endregion + + // Leon Death Noise RE4 + if (Main.zenithWorld) + SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); return true; } @@ -480,6 +442,9 @@ namespace CalamityMod.CalPlayer #region Modify Hit NPC public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (Player.Calamity().coinDropMult != 1) + target.Calamity().coinDropMult = Player.Calamity().coinDropMult; + if (target.HasBuff()) { //This is essentially 10 AP, but independent of armor amount @@ -494,7 +459,7 @@ namespace CalamityMod.CalPlayer for (int index = 0; index < target.buffType.Length; index++) { int type = target.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; if (debuffData != null) numOfDebuffs++; } @@ -595,7 +560,19 @@ namespace CalamityMod.CalPlayer { if (proj.npcProj || proj.trap) return; - + + //Add raider crit before hit + if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) + { + if (nanotech) + proj.CritChance += Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance += VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance += RaidersTalisman.RaiderBonus; + } + + modifiers.CritDamage += critDamage; // All Calamity multipliers are added together to prevent insane exponential stacking @@ -707,70 +684,10 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().antlionCloudDebuffTimer > 0) modifiers.SourceDamage *= AntlionSkewer.CloudDamageDebuffMult; - // Enemies deal less contact damage while sick, due to being weakened. - if (npc.poisoned) - { - float damageReductionFromPoison = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromPoison *= 2f; - else - damageReductionFromPoison /= 2f; - } - damageReductionFromPoison = 1f - damageReductionFromPoison; - - modifiers.SourceDamage *= damageReductionFromPoison; - } - - if (npc.venom) - { - float damageReductionFromVenom = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromVenom *= 2f; - else - damageReductionFromVenom /= 2f; - } - damageReductionFromVenom = 1f - damageReductionFromVenom; - - modifiers.SourceDamage *= damageReductionFromVenom; - } - - if (npc.Calamity().astralInfection) - { - float damageReductionFromAstralInfection = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromAstralInfection *= 2f; - else - damageReductionFromAstralInfection /= 2f; - } - damageReductionFromAstralInfection = 1f - damageReductionFromAstralInfection; - - modifiers.SourceDamage *= damageReductionFromAstralInfection; - } - - if (npc.Calamity().plague) - { - float damageReductionFromPlague = (float)((npc.Calamity().irradiated? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromPlague *= 2f; - else - damageReductionFromPlague /= 2f; - } - damageReductionFromPlague = 1f - damageReductionFromPlague; - - modifiers.SourceDamage *= damageReductionFromPlague; - } - + // Whispering Death makes enemies deal less damage if (npc.Calamity().whisperingDeath) { - float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.1f); + float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * WhisperingDeath.EnemyDamageReduction); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -1203,8 +1120,6 @@ 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; } } @@ -1342,11 +1257,11 @@ namespace CalamityMod.CalPlayer if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); - SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.5f }, Player.Center); } if (alchFlask) @@ -1517,6 +1432,7 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(GlobalDodge.ID, cooldownDuration); else Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, IconToUse); + Player.SetImmuneTimeForAllTypes(Player.longInvince ? 120 : 80); } //Dodge activation order is as follows: @@ -1624,8 +1540,8 @@ namespace CalamityMod.CalPlayer #region Player Incoming Damage Multiplier (Increases) double damageMult = 1D; - if (dArtifact) // Dimensional Soul Artifact increases incoming damage by 15%. - damageMult += 0.15; + if (crushingEgo) + damageMult += 0.2; if (enraged) // Demonshade Enrage damageMult += DemonshadeHelm.MultDamageTakenBoost; @@ -1711,23 +1627,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; @@ -2181,12 +2080,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); @@ -2225,7 +2118,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item96, Player.Center); } - if (gShell) //3 seconds of no dash reduction and reduced defense + if (gShell) { if (giantShellPostHit == 0) { @@ -2242,10 +2135,10 @@ namespace CalamityMod.CalPlayer dust.scale = Main.rand.NextFloat(1.5f, 1.2f); } } - giantShellPostHit = 180; + giantShellPostHit = GiantShell.PostHitCancelDuration; } - if (tortShell) //3 seconds of no dash reduction and reduced defense + if (tortShell) { if (tortShellPostHit == 0) { @@ -2262,7 +2155,7 @@ namespace CalamityMod.CalPlayer dust.scale = Main.rand.NextFloat(1.6f, 2.2f); } } - tortShellPostHit = 180; + tortShellPostHit = GiantTortoiseShell.PostHitCancelDuration; } if (aquaticHeartIce) @@ -2348,7 +2241,6 @@ namespace CalamityMod.CalPlayer } } } - fleshTotemManaStorage = 0; } @@ -2491,19 +2383,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) @@ -2573,7 +2484,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) @@ -2595,7 +2506,7 @@ namespace CalamityMod.CalPlayer } } } - else if (dsSetBonus) + else if (demonshadeSet) { if (Player.whoAmI == Main.myPlayer) { @@ -2877,8 +2788,9 @@ namespace CalamityMod.CalPlayer defenseDamageRecoveryFrames = 0; // Directly add the base defense damage recovery time to whatever recovery time the player already has. - int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1); + int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1) * (Player.GetModPlayer().HasAlcohol(AlcoholType.Moonshine) ? 3 : 1); totalDefenseDamageRecoveryFrames = defenseDamageRecoveryFrames + baseTime; + if (totalDefenseDamageRecoveryFrames > DefenseDamageMaxRecoveryTime) totalDefenseDamageRecoveryFrames = DefenseDamageMaxRecoveryTime; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 5e33e56b73..efdca23cf9 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.DataStructures; @@ -12,9 +13,7 @@ using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; @@ -74,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 @@ -102,6 +101,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(whisperingDeath, 0, laudanum); ApplyDoTDebuff(irradiated, 4); + ApplyDoTDebuff(windChilled, 4); int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT); ApplyDoTDebuff(riptide, 6); @@ -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. @@ -191,17 +191,34 @@ namespace CalamityMod.CalPlayer #endregion #region Alcohol + var dripPlayer = Player.GetModPlayer(); + for (int l = 0; l < Player.MaxBuffs; l++) { int buff = Player.buffType[l]; - if (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level)) - alcoholPoisonLevel += level; + if (buff <= 0) continue; + + var data = CalamityBuffSets.DebuffDataset[buff]; + if (data?.AlcoholLevel > 0) + alcoholPoisonLevel += data.AlcoholLevel; } - if (Player.Calamity().ivDrip) // +1 stack of poisoning while IV Drip is equipped - alcoholPoisonLevel++; + + if (dripPlayer.ivDripEquipped && dripPlayer.currentAlcohol != AlcoholType.None) + { + int ivBuffID = CalamityBuffSets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol); + + if (ivBuffID != -1) + { + var ivData = CalamityBuffSets.DebuffDataset[ivBuffID]; + if (ivData?.AlcoholLevel > 0) + alcoholPoisonLevel += ivData.AlcoholLevel; + } + } + if (everclear) totalNegativeLifeRegen += Everclear.RegenLoss; - + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + totalNegativeLifeRegen += Everclear.RegenLoss; // Blanket effect for all alcohols if (alcoholPoisonLevel > 0) { @@ -213,14 +230,13 @@ namespace CalamityMod.CalPlayer Player.fishingSkill += 5; } - if (alcoholPoisonLevel > 3) + if (alcoholPoisonLevel > alcoholPoisonMax) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; - // This has to last over 60 frames for the nurse to count the debuff, so... if (Player.whoAmI == Main.myPlayer) - Player.AddBuff(ModContent.BuffType(), 61, false); + Player.AddBuff(ModContent.BuffType(), 2, false); if (Player.lifeRegen > 0) Player.lifeRegen = 0; @@ -269,8 +285,11 @@ namespace CalamityMod.CalPlayer // At the last second, Reaver defense helm reduces DoT debuffs by 20% if (reaverDefense) totalNegativeLifeRegen -= (int)(totalNegativeLifeRegen * ReaverHeadTank.SetBonusDebuffDamageReduction); + if (tequilaSunrise) totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.TequilaSunrise)) + totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); Player.lifeRegen -= (int)totalNegativeLifeRegen; @@ -319,7 +338,7 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(l => BuffDatasets.DebuffDataset[l] is not null && BuffDatasets.DebuffDataset[l].HeatDebuffScaling > 0)) + if (permafrostsConcoction && Player.buffType.Any(l => CalamityBuffSets.DebuffDataset[l] is not null && CalamityBuffSets.DebuffDataset[l].HeatDebuffScaling > 0)) Player.lifeRegen += 6; if (grandDadHealTimer == 0 && grandDadHealPool >= 7) @@ -342,8 +361,18 @@ namespace CalamityMod.CalPlayer if (tequilaSunrise) Player.lifeRegenTime += 1800; + } + if (dripPlayer.HasAlcohol(AlcoholType.TequilaSunrise)) + { + if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff) + { + Player.lifeRegenTime += 1800; + } + } + + #endregion // During Silva revive or God Slayer dash, all negative life regen is canceled @@ -464,9 +493,6 @@ namespace CalamityMod.CalPlayer if (sRegen) Player.lifeRegen += SpiritGlyph.RegenBoost; - if (fortunesFavor) - Player.lifeRegen += FortunesFavor.FortunesFavorRegenBoost; - if (PinkJellyRegen) Player.lifeRegen += LifeJelly.AuraRegenBoost; @@ -559,14 +585,8 @@ namespace CalamityMod.CalPlayer if (community) { int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier); - bool lesserEffect = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = Player.buffType[l]; - lesserEffect = CalamityBuffSets.AlcoholStrength.TryGetValue(hasBuff, out var a); - } if (Player.lifeRegen < 0) - Player.lifeRegen += lesserEffect ? 1 : regenBoost; + Player.lifeRegen += regenBoost; } if (manaOverloader) @@ -674,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; @@ -683,7 +707,6 @@ namespace CalamityMod.CalPlayer regen *= LivingDew.NaturalRegenPower; else if (honeyDew) regen *= HoneyDew.NaturalRegenPower; - // The Camper counteracts the regen loss while moving horizontally if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 8f40b12dd9..384e65a136 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; @@ -17,6 +16,7 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor.Aerospec; using CalamityMod.Items.Armor.Auric; @@ -45,6 +45,7 @@ using CalamityMod.Items.VanillaArmorChanges; 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 CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; @@ -211,22 +212,22 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0)) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + Projectile.NewProjectile(Player.GetProjectileSource_Item_WithPotentialAmmo(Player.HeldItem, 0), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } if (Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0)) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + Projectile.NewProjectile(Player.GetProjectileSource_Item_WithPotentialAmmo(Player.HeldItem, 0), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } if (Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0)) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + Projectile.NewProjectile(Player.GetProjectileSource_Item_WithPotentialAmmo(Player.HeldItem, 0), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } if (Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0)) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + Projectile.NewProjectile(Player.GetProjectileSource_Item_WithPotentialAmmo(Player.HeldItem, 0), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } } @@ -239,6 +240,21 @@ namespace CalamityMod.CalPlayer rage = 0f; } + bool holdingElephantKiller = Player.HeldItem.type == ModContent.ItemType(); + if (holdingElephantKiller && !heldElephantKillerLastFrame) + { + Player.Calamity().rogueStealth = 0; + heldElephantKillerLastFrame = true; + } + else if (!holdingElephantKiller) + heldElephantKillerLastFrame = false; + + if (!drawingElephantKillerJoke) + elephantKillerJoke = 0; + else + elephantKillerJoke++; + drawingElephantKillerJoke = false; + if (furyFuel < FuryFuelMax && furyRefuelTimer >= 0) { furyFuel += (int)furyRefuelTimer; @@ -257,19 +273,21 @@ namespace CalamityMod.CalPlayer } // Apply stealth damage to rogue. - Player.GetDamage() += stealthDamage; + bool dontProvideStealthDamage = Player.HeldItem.type == ModContent.ItemType(); + if (!dontProvideStealthDamage) + Player.GetDamage() += stealthDamage; if ((XykVisualsBlue || XykVisualsOrange)) { bool Orange = XykVisualsOrange; - Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; + Color effectColor = Orange ? XyksBlessingOrange.baseMainColor : XyksBlessingBlue.baseMainColor; float rate = Main.GlobalTimeWrappedHourly * 12; List eColors = new List() { - Orange ? new Color(248, 117, 52) : Color.DodgerBlue, - Orange ? Color.Gold : Color.Cyan, - Orange ? Color.Orange : Color.RoyalBlue + Orange ? XyksBlessingOrange.baseMainColor : XyksBlessingBlue.baseMainColor, + Orange ? XyksBlessingOrange.baseAccentColor : XyksBlessingBlue.baseAccentColor, + Orange ? XyksBlessingOrange.baseEffectColor : XyksBlessingBlue.baseEffectColor }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; @@ -278,7 +296,10 @@ namespace CalamityMod.CalPlayer bool rageOrAdren = (Player.Calamity().rageModeActive || Player.Calamity().adrenalineModeActive); bool rageAndAdren = (Player.Calamity().rageModeActive && Player.Calamity().adrenalineModeActive); - Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : effectColor); + Color dashColor = Orange ? XyksBlessingOrange.animEffectColor : XyksBlessingBlue.animEffectColor; + Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : + Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : + Player.dashDelay == -1 ? dashColor : effectColor); XykFXColor = Color.Lerp(XykFXColor, attemptColor, rageOrAdren ? 0.05f : 0.25f); @@ -311,15 +332,17 @@ namespace CalamityMod.CalPlayer if (dashStart) { lastDashWasTabi = false; - } - if (((gShell && giantShellPostHit == 0) || (tortShell && tortShellPostHit == 0)) && dashStart) - { - Player.velocity.X *= 0.9f; + if ((tortShell && tortShellPostHit == 0)) + Player.velocity.X *= GiantTortoiseShell.DashVelocityMult; + if ((gShell && giantShellPostHit == 0)) + Player.velocity.X *= GiantShell.DashVelocityMult; } // Tabi/Master Ninja Gear dash change - if (lastDashWasTabi) + if (Player.dashDelay != -1) + lastDashWasTabi = false; + else if (lastDashWasTabi) { Player.dashType = 1; } @@ -350,9 +373,9 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % 4 == 0) Player.HealPlayer(1, HealTextType.None); - if (Player.dashDelay > 0) // Reduced dash cooldown + if (Player.dashDelay > 1) // Reduced dash cooldown { - Player.dashDelay = 0; + Player.dashDelay = 1; } if (Player.dashDelay == -1) { @@ -367,9 +390,9 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % 5 == 0) Player.HealPlayer(2, HealTextType.None); - if (Player.dashDelay > 0) // Reduced dash cooldown + if (Player.dashDelay > 1) // Reduced dash cooldown { - Player.dashDelay = 0; + Player.dashDelay = 1; } if (Player.dashDelay == -1) { @@ -430,7 +453,7 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 2.2f; // +120% dash speed + Player.velocity.X *= 1 + LeviathanAmbergris.DashSpeedIncrease; int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } @@ -562,9 +585,16 @@ namespace CalamityMod.CalPlayer if (cinnamonRoll && !(Main.getGoodWorld && Main.npc.Any(x=> x.active && x.type == ModContent.NPCType()))) { if (dashStart) - Player.velocity.X *= 3; + Player.velocity.X *= 2f; else if (Player.dashDelay == -1) - Player.velocity.X *= 0.8f; + Player.velocity.X *= 0.825f; + } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.CinnamonRoll) && !(Main.getGoodWorld && Main.npc.Any(x => x.active && x.type == ModContent.NPCType()))) + { + if (dashStart) + Player.velocity.X *= 2f; + else if (Player.dashDelay == -1) + Player.velocity.X *= 0.825f; } if (Player.dashDelay == -1) @@ -880,6 +910,11 @@ namespace CalamityMod.CalPlayer int scoriaOreID = ModContent.TileType(); int abyssKelpID = ModContent.TileType(); + // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor or have God Mode + // Auric Rejection causes an electrical explosion that yeets the player a considerable distance + // CIT 17AUG2024: Despite providing full invulnerability, Silva armor revive intentionally does not prevent Auric rejection's yeeting. + // 25FEB2025 Ozzatron: Added external bool to control Auric Rejection immunity from the ore. + bool rejectionImmunity = auricSet || seraphTracers || Player.creativeGodMode || externalAuricRejectionImmunity; int auricRejectionDamage = 300; float auricRejectionKB = Player.noKnockback ? 20f : 40f; @@ -916,11 +951,6 @@ namespace CalamityMod.CalPlayer Player.AddBuff(BuffID.Burning, 2); } - // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor or have God Mode - // Auric Rejection causes an electrical explosion that yeets the player a considerable distance - // CIT 17AUG2024: Despite providing full invulnerability, Silva armor revive intentionally does not prevent Auric rejection's yeeting. - // 25FEB2025 Ozzatron: Added external bool to control Auric Rejection immunity from the ore. - bool rejectionImmunity = auricSet || seraphTracers || Player.creativeGodMode || externalAuricRejectionImmunity; bool oreRejection = (tile.TileType == auricOreID) && !rejectionImmunity; // Repulsers always perform this effect because they are player-placed tiles made for this exact purpose @@ -947,6 +977,19 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); } } + + if (Player.sitting.TryGetSittingBlock(Player, out Tile AuricToiletTile) && !rejectionImmunity) + { + if (AuricToiletTile.TileType == ModContent.TileType()) + { + Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").ToNetworkText(Player.name)), auricRejectionDamage, 0); + Player.AddBuff(ModContent.BuffType(), 120); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); + Player.sitting.SitUp(Player, false); + Vector2 yeetVec = new Vector2(Player.direction, -1.5f); + Player.velocity += yeetVec * auricRejectionKB; + } + } } private void HandleBlazingMouseEffects() { @@ -1277,6 +1320,18 @@ namespace CalamityMod.CalPlayer } } } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Margarita)) + { + if (Main.myPlayer == Player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int buffID = Player.buffType[l]; + if (Player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) + Player.buffTime[l]--; + } + } + } // Update the Providence Burn effect drawer if applicable. float providenceBurnIntensity = 0f; @@ -1402,7 +1457,6 @@ namespace CalamityMod.CalPlayer } // Death Mode effects - caveDarkness = 0f; if (CalamityWorld.death || Main.getGoodWorld) { if (Player.whoAmI == Main.myPlayer) @@ -1651,52 +1705,101 @@ namespace CalamityMod.CalPlayer } } } + float minVis = 0.001f; + if (fishStockVisual > minVis) // Fish stock effects are active as long as the UI exists, even if the player removes the item + { + fishStockSlidingPower = MathHelper.Lerp(fishStockSlidingPower, fishStockPower, 0.05f); + if (Player.miscCounter % 60 == 0) + { + bool isExtreme = fishStockPower > 1.5f || fishStockPower < -1.5f; + float smallJump = Main.rand.NextBool(4) ? 0.55f : 0; + float bigJump = Main.rand.NextBool(isExtreme ? 7 : 10) ? 1.8f : 0; + int riseOrFall = Main.rand.NextBool() ? -1 : 1; + float newFishStockPower = Math.Clamp(fishStockPower + (Main.rand.NextFloat(0.1f, 0.2f) + Math.Max(smallJump, bigJump)) * riseOrFall, -2, 2); + fishStockOldPower = // Cycle each power point up as the new point is gotten + (fishStockPower, + fishStockOldPower.Item1, + fishStockOldPower.Item2, + fishStockOldPower.Item3, + fishStockOldPower.Item4); + fishStockPower = newFishStockPower; + } + // Stats + Player.GetDamage() += 0.15f * fishStockPower; + Player.GetCritChance() += 10 * fishStockPower; + Player.Calamity().critDamage += 0.15f * fishStockPower; + Player.statDefense += (int)(10 * fishStockPower); + Player.endurance += 0.1f * fishStockPower; + Player.lifeRegen += (int)(6 * fishStockPower); + Player.pickSpeed -= 0.25f * fishStockPower; + Player.fishingSkill += (int)(50 * fishStockPower); + Player.luck += 0.55f * fishStockPower; + float CoinMult = MathF.Abs(fishStockPower) * 1.5f; + float givenMult = (fishStockPower < 0 ? (1 / CoinMult) : CoinMult); + Player.Calamity().coinDropMult = givenMult; + } + // Only put away fish stocks if the stocks are even or higher, or if they've already been started to be put away + float goalVis = (!fishStocks && (fishStockPower >= 0 || fishStockVisual < 0.9f)) ? 0 : 1; + fishStockVisual = MathF.Round(MathHelper.Lerp(fishStockVisual, goalVis, 0.05f), 4); // Fade in and out the U // The fire boots debuff boosts // bootLevel exists SO THAT THEY DO NOT STACK. Please help me maintain my sanity so we're not "fixing" this issue seventy times if (bootLevel > 0) HeatDebuffMultiplier += 0.25f * bootLevel; - if (rOfResilienceEffect > 0) - rOfResilienceEffect--; - if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + bool holdingRoR = Player.HeldItem.type == ModContent.ItemType(); + bool shieldIsSetup = (rOfResilienceEffect >= RelicOfResilience.baseTimeMax); + bool chargedButNotHolding = (rOfResilienceEffect > RelicOfResilience.baseTimeMax && !holdingRoR); + bool reduceEffect = (!shieldIsSetup || chargedButNotHolding); + if (rOfResilienceEffect > 0 && reduceEffect) + { rOfResilienceEffect -= (chargedButNotHolding ? 4 : 1); if (shieldIsSetup && rOfResilienceEffect < RelicOfResilience.baseTimeMax) rOfResilienceEffect = RelicOfResilience.baseTimeMax; if (rOfResilienceEffect < 0) rOfResilienceEffect = 0; } + if (holdingRoR) // All players close to a player holding RoR get the benefits { - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead && Main.netMode != NetmodeID.MultiplayerClient) { Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); } for (int index = 0; index < Main.player.Length; index++) { Player fella = Main.player[index]; - if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team) + float maxDistancePlayersCanBe = 1000; + bool validEffectBoost = Utils.Distance(fella.Center, Player.Center) < maxDistancePlayersCanBe && fella.team == Player.team && fella.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime + && fella.Calamity().rOfResilienceCooldown == 0 && (fella.Calamity().rOfResilienceEffect > RelicOfResilience.baseTimeMax ? holdingRoR : true); + if (validEffectBoost) { - fella.Calamity().rOfResilienceEffect = (fella != Player ? 480 : 2); + fella.Calamity().rOfResilienceEffect += (reduceEffect ? 2 : 1) + (Player.Calamity().profanedSoulRelicBuff ? 1 : 0); // gets subtracted by 1 every frame, so this goes up by more to keep up } } } + // Adds a floor for defense and dr, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown >= RelicOfResilience.baseCooldown / 2|| Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeInStats = Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true); + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? fadeInStats : MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseCooldown / 2, RelicOfResilience.baseCooldown, Player.Calamity().rOfResilienceCooldown, true), 3)); + float overchargeBoost = 1 + (Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true) * (Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.additionalMaxPowerDefensesMult * 5 : RelicOfResilience.additionalMaxPowerDefensesMult)); // The amount of bulk this gives with artifact is way overkill but it is REALLY funny + int def = (int)(RelicOfResilience.baseDefenseFloor * overchargeBoost); + float dr = RelicOfResilience.baseDrFloor * overchargeBoost; + int maxDefFloor = (int)(def * fadeStats); + float MaxDRFloor = dr * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } if (rOfResilienceEffect > 0) { - if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0) + if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0 && holdingRoR) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); } - // Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage - if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) - { - float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); - int maxDefFloor = (int)(150 * fadeStats); - float MaxDRFloor = 0.10f * fadeStats; - if (Player.statDefense < maxDefFloor) - Player.statDefense += maxDefFloor - Player.statDefense; - if (Player.endurance < MaxDRFloor) - Player.endurance += MaxDRFloor - Player.endurance; - } - + int shardBaseCap = (Player.Calamity().profanedSoulRelicBuff ? (int)(RelicOfResilience.baseMaxShardCount * 1.5f) : RelicOfResilience.baseMaxShardCount); + float postMaxedShards = MathHelper.Lerp(shardBaseCap, shardBaseCap * RelicOfResilience.maxPowerShardMult, MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true), 2)); + int maxShards = (int)(postMaxedShards * Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true)); int numOfShards = 0; for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1706,7 +1809,26 @@ namespace CalamityMod.CalPlayer numOfShards++; } } - if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + float lowestNum = 0; + int whoAmI = 0; + if (numOfShards > maxShards) // Kill the most recent shard if there's too many + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI && projectile.ai[2] > lowestNum) + { + whoAmI = projectile.whoAmI; + lowestNum = projectile.ai[2]; + } + } + if (whoAmI != 0) + { + Projectile shard = Main.projectile[whoAmI]; + shard.ai[1] = -1; + } + } + if (numOfShards < maxShards && Player.Calamity().rOfResilienceCooldown == 0 && (rOfResilienceEffect >= RelicOfResilience.baseTimeMax || holdingRoR)) { if (numOfShards == 0) { @@ -1714,12 +1836,23 @@ namespace CalamityMod.CalPlayer SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); } - int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); - Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.shardBaseDamage * 5 : RelicOfResilience.shardBaseDamage); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); } } if (rOfResilienceCooldown > 0) - rOfResilienceCooldown--; + { rOfResilienceCooldown -= (holdingRoR ? 2 : 1); if (rOfResilienceCooldown < 0) rOfResilienceCooldown = 0; } + + if (Player.Calamity().friendlyMinions > 0) + { + int numOfPigs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; + if (numOfPigs < Player.Calamity().friendlyMinions) + { + 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); + } + } if (transformer && Player.Calamity().transformerCooldown == 0 && transformerDelay == 0) // The code for this acursed thing took much... MUCH, too long to make { @@ -2107,7 +2240,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) @@ -2224,8 +2357,6 @@ namespace CalamityMod.CalPlayer phantomicHeartRegen--; if (phantomicBulwarkCooldown > 0) phantomicBulwarkCooldown--; - if (galileoCooldown > 0) - galileoCooldown--; if (gladiatorTimer > 0) gladiatorTimer--; if (dragonRageCooldown > 0) @@ -2238,8 +2369,6 @@ namespace CalamityMod.CalPlayer raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; - if (VoidCooldown > 0) - VoidCooldown--; if (ursaSergeantCooldown > 0) ursaSergeantCooldown--; if (generalBandCooldown > 0) @@ -2252,8 +2381,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (scuttlerCooldown > 0) - scuttlerCooldown--; if (nanotechHitCooldown > 0) nanotechHitCooldown--; if (spectralVeilImmunity > 0) @@ -2265,7 +2392,7 @@ namespace CalamityMod.CalPlayer if (bloomStoneTotalHeal > 0) { - float healRateDiv = (Player.statLife >= Player.statLifeMax ? 5 : // 5 times as slow if at max hp already (overheal prevention) + float healRateDiv = (Player.statLife >= Player.statLifeMax ? 2 : // 2 times as slow if at max hp already (overheal prevention) bloomStoneBuffedHealRateTimer > 0 ? Utils.Remap(bloomStoneBuffedHealRateTimer, 90, 0, 0.5f, 1f, true) // 2 times faster if pollen buffed, scales back down to regular speed as the buff fades : 1); // Regular speed bloomStoneHealRate = 1 / healRateDiv; @@ -2313,8 +2440,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) @@ -2423,13 +2548,6 @@ namespace CalamityMod.CalPlayer else flameLickedShellParry--; } - if (shieldOfTheOceanParry > 0) - { - if (shieldOfTheOcean) - ShieldoftheOcean.HandleParryCountdown(Player); - else - shieldOfTheOceanParry--; - } if (!flameLickedShell && flameLickedShellParry > 0) flameLickedShellParry--; @@ -2457,8 +2575,6 @@ namespace CalamityMod.CalPlayer } else adamantiteSetDefenseBoostInterpolant = 0f; - if (ChlorophyteHealDelay > 0) - ChlorophyteHealDelay--; if (monolithAccursedShader > 0) monolithAccursedShader--; if (monolithBossRushShader > 0) @@ -2707,12 +2823,6 @@ namespace CalamityMod.CalPlayer } } - // Raider Talisman bonus - if (raiderTalisman && !vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) - Player.GetCritChance() += RaidersTalisman.RaiderBonus; - if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) - Player.GetCritChance() += VampiricTalisman.RaiderBonus; - if (avertorBonus) Player.GetDamage() += 0.1f; @@ -2784,7 +2894,7 @@ namespace CalamityMod.CalPlayer if (permafrostsConcoction) { Player.manaCost -= 0.15f; - Player.statManaMax2 += 50; + Player.statManaMax2 += 40; } if (encased) @@ -3060,11 +3170,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); @@ -3104,7 +3210,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; @@ -3191,14 +3297,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); } } @@ -3355,7 +3457,7 @@ namespace CalamityMod.CalPlayer #region Other Buff Effects private void OtherBuffEffects() { - + var dripPlayer = Player.GetModPlayer(); if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; @@ -3471,7 +3573,7 @@ namespace CalamityMod.CalPlayer if (giantShellPostHit > 0) { - Player.statDefense -= 3; + Player.statDefense -= GiantShell.DefenseBoost; giantShellPostHit--; } if (giantShellPostHit < 0) @@ -3487,11 +3589,11 @@ namespace CalamityMod.CalPlayer if (tortShellPostHit > 0) { - Player.statDefense -= 6; + Player.statDefense -= GiantTortoiseShell.DefenseBoost; tortShellPostHit--; } else - Player.endurance += 0.05f; + Player.endurance += GiantTortoiseShell.DamageReductionBoost; if (tortShellPostHit < 0) { @@ -3509,7 +3611,7 @@ namespace CalamityMod.CalPlayer if (gloveLevel > 0) { // Determine the glove the player benefits from in priority of latest in progression - float gloveAttackSpeed = (gloveLevel == 5 ? 0.15f : gloveLevel == 4 ? 0.14f : gloveLevel == 3 ? 0.12f : gloveLevel <= 2 ? 0.10f : 0); + float gloveAttackSpeed = (gloveLevel == 5 ? 0.15f : gloveLevel == 4 ? 0.14f : gloveLevel >= 2 ? 0.12f : gloveLevel == 1 ? 0.10f : 0); Player.GetAttackSpeed() += gloveAttackSpeed; // Give the player attack speed based on the glove they have } @@ -3542,31 +3644,51 @@ 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)) - Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost; + 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; + stealthDamage -= PurpleHaze.StealthDamageLoss + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.StealthDamageLoss : 0); } if (everclear) Player.GetDamage() += Everclear.DamageBoost; - + if (dripPlayer.HasAlcohol(AlcoholType.Everclear)) + Player.GetDamage() += Everclear.DamageBoost; if (caribbeanRum) { Player.gravity *= CaribbeanRum.GravityMultiplier; Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; } + if (dripPlayer.HasAlcohol(AlcoholType.CaribbeanRum)) + { + Player.gravity *= CaribbeanRum.GravityMultiplier; + Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; + } if (starBeamRye) { Player.manaRegenCount += StarBeamRye.ManaRegenBoost; Player.GetDamage() *= StarBeamRye.MagicDmgMult; } - - if (whiteWine) + if (dripPlayer.HasAlcohol(AlcoholType.StarBeamRye)) { - Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + Player.manaRegenCount += StarBeamRye.ManaRegenBoost; + Player.GetDamage() *= StarBeamRye.MagicDmgMult; + } + + if (dripPlayer.HasAlcohol(AlcoholType.Ale) || dripPlayer.HasAlcohol(AlcoholType.Sake)) + { + Player.GetAttackSpeed() -= 0.1f; + // See CalamityGlobalItem and PlayerUtils for Ale's melee size increase + } + + if (whiteWine || dripPlayer.HasAlcohol(AlcoholType.WhiteWine)) + { + if (whiteWine) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); float bonus = 0f; float MaxDistance = 640f; @@ -3578,7 +3700,12 @@ namespace CalamityMod.CalPlayer } else bonus = 0; - whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + + if (whiteWine) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + while (whiteWineTimer > 1) { if (Player.wingTime < Player.wingTimeMax) @@ -3588,9 +3715,9 @@ namespace CalamityMod.CalPlayer } if (redWine) - { Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); - } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); if (giantPearl) { @@ -3602,10 +3729,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; - } } } } @@ -3702,7 +3826,7 @@ namespace CalamityMod.CalPlayer Player.lifeMagnet = true; if (whisperingDeath && !laudanum) - Player.GetDamage() -= 0.2f; + Player.GetDamage() -= WhisperingDeath.PlayerDamageReduction; if (armorCrunch && !laudanum) { @@ -3718,7 +3842,7 @@ namespace CalamityMod.CalPlayer if (eutrophication) Player.velocity = Vector2.Zero; - if (vaporfied || galvanicCorrosion) + if (vaporfied || galvanicCorrosion || windChilled) Player.velocity *= 0.98f; if (molluskHelmet) @@ -3761,11 +3885,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) { @@ -3799,10 +3918,10 @@ namespace CalamityMod.CalPlayer Player.buffImmune[BuffID.Chilled] = true; Player.buffImmune[BuffID.Frozen] = true; - if (Player.statLife > (int)(Player.statLifeMax2 * 0.5)) - Player.GetDamage() += 0.1f; - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.statDefense += 15; + if (Player.statLife > (int)(Player.statLifeMax2 * FrostFlare.HealthRatioThreshold)) + Player.GetDamage() += FrostFlare.DamageBoost; + else + Player.statDefense += FrostFlare.DefenseBoost; } if (vexation) @@ -3969,15 +4088,6 @@ namespace CalamityMod.CalPlayer Player.npcTypeNoAggro[ModContent.NPCType()] = true; } - if (eArtifact) - { - Player.manaCost -= 0.25f; - Player.maxMinions++; - } - - if (auricSArtifact && Player.FindBuffIndex(ModContent.BuffType()) != -1) - Player.maxMinions += Player.ownedProjectileCounts[ModContent.ProjectileType()]; - if (pSoulArtifact) { if (Player.whoAmI == Main.myPlayer) @@ -4259,12 +4369,6 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += beeBoost; } - if (badgeOfBravery) - { - Player.GetDamage() += 0.1f; - Player.GetCritChance() += 10; - } - // Amalgam boosts if (Main.myPlayer == Player.whoAmI) { @@ -4324,7 +4428,7 @@ namespace CalamityMod.CalPlayer else if (hasBuff == ModContent.BuffType()) { Player.lifeRegenCount += 5; - Player.GetDamage() += 0.2f; + Player.GetDamage() += WhisperingDeath.PlayerDamageReduction; } switch (hasBuff) @@ -4410,8 +4514,8 @@ namespace CalamityMod.CalPlayer // Add any multiplicative damage bonuses here float multiplicativeDamage = 1; - if (dArtifact) - multiplicativeDamage += 0.2f; + if (crushingEgo) + multiplicativeDamage += 0.3f; if (WarbanneroftheRighteous) multiplicativeDamage += warbannerDamageMult; if (multiplicativeDamage != 1) @@ -4741,6 +4845,12 @@ namespace CalamityMod.CalPlayer if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + { + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); + } + if (DesertProwlerHat.ShroudedInSmoke(Player, out _)) Player.statDefense -= (int)(Player.statDefense * DesertProwlerHat.SmokeDefenseMult); } @@ -4844,6 +4954,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 f6ea8ea8b2..f80ed26df4 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -86,11 +86,11 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; + target.Calamity().IncreasedColdEffects_FrozenCube = frozenCube; target.Calamity().IncreasedElectricityEffects_Unused = false; target.Calamity().IncreasedHeatEffects_Fireball = fireball; - target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; target.Calamity().IncreasedHeatEffects_FireBoots = bootLevel; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; @@ -109,15 +109,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Electrified, 300); break; - case ItemID.BeeKeeper: - case ItemID.BladeofGrass: - target.AddBuff(BuffID.Poisoned, 240); - break; - - case ItemID.FieryGreatsword: - target.AddBuff(BuffID.OnFire3, 90); - break; - case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn2, 300); @@ -126,11 +117,6 @@ namespace CalamityMod.CalPlayer case ItemID.IceBlade: target.AddBuff(BuffID.Frostburn, 120); break; - - case (>= ItemID.BluePhaseblade and <= ItemID.YellowPhaseblade) or ItemID.OrangePhaseblade: - case (>= ItemID.BluePhasesaber and <= ItemID.YellowPhasesaber) or ItemID.OrangePhasesaber: - // TODO: find an EPIC lightsaber sound - break; } if (flameWakerBoots) @@ -167,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); @@ -175,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); @@ -226,6 +212,22 @@ namespace CalamityMod.CalPlayer 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) + { + if (nanotech) + proj.CritChance -= Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance -= VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance -= RaidersTalisman.RaiderBonus; + } + // Apply this to player equippable sources ie. Orichalcum set bonus petal spawns // Do not apply if this effect is an extension of a weapon ie. Pearl God round effect as it will mess up Old Fashioned var source = Player.GetSource_OnHit(target); @@ -243,7 +245,10 @@ namespace CalamityMod.CalPlayer if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); - if (moscowMule) + var ivDripPlayer = Player.GetModPlayer(); + + // "Heavy" Knockback effect + if (moscowMule || ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule)) { var center = Player.Center; if (proj.IsMinionOrSentryRelated) @@ -258,10 +263,16 @@ namespace CalamityMod.CalPlayer { proj.damage = (int)(proj.damage * (moscowMule ? 0.8f : 1f) * (bloodyMary ? 0.75f : 1f)); } - + } + if (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) || ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary)) + { + if (!(PierceResistNPC.exemptProjectiles.Contains(proj.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(proj.type) && PierceResistNPC.singleHitboxExemptProjectiles[proj.type]))) + { + proj.damage = (int)(proj.damage * (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? 0.8f : 1f) * (ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? 0.75f : 1f)); + } } - if (witheringWeaponEnchant) + if (witheringWeaponEnchant) witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.TypelessDebuffMultiplier = TypelessDebuffMultiplier; cgn.HeatDebuffMultiplier = HeatDebuffMultiplier; @@ -272,11 +283,11 @@ namespace CalamityMod.CalPlayer switch (proj.type) { + // Remove this in 1.4.5 port case ProjectileID.ObsidianSwordfish: target.AddBuff(BuffID.OnFire3, 180); break; - case ProjectileID.InfluxWaver: case ProjectileID.UFOLaser: case ProjectileID.Electrosphere: target.AddBuff(BuffID.Electrified, 180); @@ -288,11 +299,12 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 90); break; + // Replace with Broken Armor in 1.4.5 port case ProjectileID.GolemFist: target.AddBuff(BuffType(), 180); break; - case ProjectileID.ButchersChainsaw: + // Remove this in 1.4.5 port case ProjectileID.MechanicalPiranha: target.AddBuff(BuffType(), 180); break; @@ -301,21 +313,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); break; - case ProjectileID.Cascade: case ProjectileID.FlamingMace: target.AddBuff(BuffID.OnFire, 60); break; - case ProjectileID.Bee: - case ProjectileID.GiantBee: - case ProjectileID.BladeOfGrass: - target.AddBuff(BuffID.Poisoned, 120); - break; - - case ProjectileID.Wasp: - target.AddBuff(BuffID.Venom, 60); - break; - case ProjectileID.NorthPoleWeapon: target.AddBuff(BuffID.Frostburn, 300); break; @@ -367,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); @@ -375,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); @@ -460,6 +461,15 @@ namespace CalamityMod.CalPlayer GungeonMusicSystem.GUN(); } + // Used by Megalodon, Seadragon & Voidragon, allows bullets to track their damage scaling + if (cgp.sharkBullets) + { + if (proj.numHits == 0) + { + sharkGunDamageScaling++; + } + } + if (cgp.fireBullet) { target.AddBuff(BuffID.OnFire3, 60); @@ -608,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) @@ -899,7 +909,7 @@ namespace CalamityMod.CalPlayer { if (Player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(4)) { - int damage = (int)Player.GetTotalDamage().ApplyTo(100); + int damage = (int)Player.GetTotalDamage().ApplyTo(PhantomicArtifact.DaggerDamage); Projectile.NewProjectile(source, Player.Center, new Vector2(Player.velocity.X,Player.velocity.Y-10).RotatedByRandom(0.3f), ProjectileType(), damage, 1f, Player.whoAmI); } } @@ -1015,7 +1025,7 @@ namespace CalamityMod.CalPlayer if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { - switch (Main.rand.Next(5)) + switch (Main.rand.Next(4)) { case 0: // Exodus Rogue Stars: 80% @@ -1043,13 +1053,6 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), blastDamage, 0f, proj.owner, 0f, 0f); break; - case 4: - // Exodus Rogue Bubble: 60% - int bubbleDamage = (int)(proj.damage * 0.6f); - CalamityUtils.SpawnOrb(proj, bubbleDamage, ProjectileType(), 800f, 15f); - xerocDmg += (int)(bubbleDamage * 0.5); - break; - default: break; } @@ -1088,8 +1091,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); - // TO DO: Add nanotech here - Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, vampiricTalisman ? "Bloodfeast" : "default"); + Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, nanotech ? "Nanotech" : vampiricTalisman ? "Vampiric" : "default"); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1100,12 +1102,12 @@ namespace CalamityMod.CalPlayer if (npcCheck) { // Umbraphile cannot trigger off of itself. It is guaranteed on stealth strikes and 20% chance otherwise. - if (umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) || Main.rand.NextBool(5))) + if (umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) || Main.rand.NextBool(5)) && !modProj.CannotProc) { int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * UmbraphileHood.ExplosionDamageRatio, UmbraphileHood.ExplosionDamageSoftcap); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, Player.whoAmI); } - if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) + if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3 && !modProj.CannotProc) { for (int s = 0; s < 3; s++) { @@ -1238,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); @@ -1297,11 +1294,11 @@ namespace CalamityMod.CalPlayer Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, heal, (raiderCritLifespan > 0 && !proj.Calamity().stealthStrike) ? 1.2f : 1.5f); } - if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike && proj.numHits < 1) + if (bloodyGlove && proj.CountsAsClass() && (modProj.stealthStrike || (nanotech && raiderCritLifespan > 0)) && proj.numHits < 1) //Nanotech has the same heal as Electrician's glove Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, electricianGlove ? 10 : 5, electricianGlove ? 2f : 3f); - if (proj.CountsAsClass() && Player.HeldItem.CountsAsClass()) + if (proj.CountsAsClass()) { if (manaOverloader) { diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index eb9c5f921a..20be36951d 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -27,7 +27,8 @@ namespace CalamityMod.CalPlayer.Dashes public override bool IsOmnidirectional => true; - public int Time = 0; + public override int ForceEndAt => 75; + public float Size = 2.2f; public bool SoundOnce = true; @@ -40,7 +41,7 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnDashEffects(Player player) { - Time = 0; + dashTime = 0; Size = 2.2f; GSDashSlot = SoundEngine.PlaySound(DevourerofGodsHead.DeathAnimationSound, player.Center); SoundOnce = true; @@ -60,24 +61,36 @@ namespace CalamityMod.CalPlayer.Dashes if (SoundEngine.TryGetActiveSound(GSDashSlot, out var Dashsound) && Dashsound.IsPlaying) Dashsound.Position = player.Center; - Time++; Size -= 0.01f; - const int totalDashTime = 75; - // Constantly update the player's velocity direction. - float progress = MathHelper.Clamp(Time / (float)totalDashTime, 0f, 1f); + float progress = MathHelper.Clamp(dashTime / (float)ForceEndAt, 0f, 1f); float ease = 1f - (float)Math.Pow(1f - progress, 0.2f); float finalSpeed = MathHelper.Lerp(32f, 11f, ease); Vector2 dashVel = Main.MouseWorld - player.Center; - Vector2 targetDirection = player.velocity.ToRotation().AngleTowards(dashVel.ToRotation(), 0.175f).ToRotationVector2(); - player.velocity = targetDirection * finalSpeed; + + Vector2 direction = Vector2.Zero; + if (player.controlLeft) + direction.X -= 1; + if (player.controlRight) + direction.X += 1; + if (player.controlUp) + direction.Y -= 1; + if (player.controlDown) + direction.Y += 1; + + Vector2 targetDirection = direction == Vector2.Zero ? player.velocity.SafeNormalize(Vector2.Zero) : player.velocity.ToRotation().AngleTowards(direction.ToRotation(), 0.175f).ToRotationVector2(); + + if (targetDirection == Vector2.Zero) + targetDirection = new(player.direction, 0); + + player.velocity = ((dashTime == 1 && direction != Vector2.Zero) ? direction : targetDirection) * finalSpeed; // Fall way, way, faster than usual. player.maxFallSpeed = 50f; - if (Time < 75) + if (dashTime < ForceEndAt) { Particle jaws = new Jaws(player.Center + player.velocity * 0.5f, player.velocity, Color.Fuchsia, new Vector2(0.8f, 1f), player.velocity.ToRotation() + MathHelper.PiOver2, Size, Size, 2); GeneralParticleHandler.SpawnParticle(jaws); @@ -85,11 +98,11 @@ namespace CalamityMod.CalPlayer.Dashes GeneralParticleHandler.SpawnParticle(jaws2); } - float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true)); + float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, dashTime, true)); for (int i = 0; i < 3; i++) { - float offsetRotationAngle = player.velocity.ToRotation() + Time / 20f; - float radius = (30f + (float)Math.Cos(Time / 3f) * 24f) * radiusFactor; + float offsetRotationAngle = player.velocity.ToRotation() + dashTime / 20f; + float radius = (30f + (float)Math.Cos(dashTime / 3f) * 24f) * radiusFactor; Vector2 dustPosition = player.Center + player.velocity * 0.8f; dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; Dust dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(5) ? 181 : 295); @@ -100,7 +113,7 @@ namespace CalamityMod.CalPlayer.Dashes dust2.noGravity = true; } - if (Time % 2 == 0) + if (dashTime % 2 == 0) { float sparkscale = Size * 1.3f; Vector2 SparkVelocity1 = player.velocity.RotatedBy(player.direction * -4, default) * 0.08f - player.velocity / 2f; @@ -111,14 +124,12 @@ namespace CalamityMod.CalPlayer.Dashes GeneralParticleHandler.SpawnParticle(spark2); } - if (Time > 75 && Time < 78) + if (dashTime >= ForceEndAt) { Particle pulse = new DirectionalPulseRing(player.Center - player.velocity * 0.52f, player.velocity / 1.5f, Color.Fuchsia, new Vector2(1f, 2f), player.velocity.ToRotation(), 0.82f, 0.32f, 60); GeneralParticleHandler.SpawnParticle(pulse); Particle pulse2 = new DirectionalPulseRing(player.Center - player.velocity * 0.40f, player.velocity / 1.5f * 0.9f, Color.Aqua, new Vector2(0.8f, 1.5f), player.velocity.ToRotation(), 0.58f, 0.28f, 50); GeneralParticleHandler.SpawnParticle(pulse2); - - Time = 95; } // Dash at a much, much faster speed than the default value. diff --git a/CalPlayer/Dashes/PlayerDashEffect.cs b/CalPlayer/Dashes/PlayerDashEffect.cs index 30e515cd7f..ef477f1cf2 100644 --- a/CalPlayer/Dashes/PlayerDashEffect.cs +++ b/CalPlayer/Dashes/PlayerDashEffect.cs @@ -20,6 +20,8 @@ namespace CalamityMod.CalPlayer.Dashes public abstract bool IsOmnidirectional { get; } + public virtual int ForceEndAt { get; } = -1; + public abstract float CalculateDashSpeed(Player player); /// /// Effects that happen once when the main dash starts diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index b366846963..4e3deb92bc 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.blazingCore ? EncasementType.BlazingCore : EncasementType.FlameLickedShell; public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -28,7 +27,6 @@ namespace CalamityMod.CalPlayer.DrawLayers { EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0, EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0, - EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0, _ => false }; return visible; @@ -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..84cd4b16b3 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); 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/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/NanotechBoost.png b/Cooldowns/NanotechBoost.png new file mode 100644 index 0000000000..430bd3b98c Binary files /dev/null and b/Cooldowns/NanotechBoost.png differ diff --git a/Cooldowns/NanotechBoostOutline.png b/Cooldowns/NanotechBoostOutline.png new file mode 100644 index 0000000000..cdd0da28cc Binary files /dev/null and b/Cooldowns/NanotechBoostOutline.png differ diff --git a/Cooldowns/NanotechBoostOverlay.png b/Cooldowns/NanotechBoostOverlay.png new file mode 100644 index 0000000000..d1000ec9a4 Binary files /dev/null and b/Cooldowns/NanotechBoostOverlay.png differ diff --git a/Cooldowns/RaiderBoost.cs b/Cooldowns/RaiderBoost.cs index 79bb9ae02d..9ea22fb9fd 100644 --- a/Cooldowns/RaiderBoost.cs +++ b/Cooldowns/RaiderBoost.cs @@ -26,7 +26,14 @@ namespace CalamityMod.Cooldowns { switch (skin) { - case "Bloodfeast": + case "Nanotech": + skinTexture = "NanotechBoost"; + outlineColor = new Color(14, 103, 129); + cooldownColorStart = new Color(85, 252, 229); + cooldownColorEnd = new Color(52,255,171); + break; + + case "Vampiric": skinTexture = "VampiricTalismanBoost"; outlineColor = new Color(143, 27, 27); cooldownColorStart = new Color(133, 5, 5); diff --git a/Cooldowns/RelicOfResilienceCooldown.cs b/Cooldowns/RelicOfResilienceCooldown.cs index 18da908039..cf3109b412 100644 --- a/Cooldowns/RelicOfResilienceCooldown.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Cooldowns { @@ -12,5 +14,11 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); + + public override void Tick() + { + if (instance.player.HeldItem.type == ModContent.ItemType()) + instance.timeLeft--; + } } } 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/DebuffData.cs b/DataStructures/DebuffData.cs index ae5320365e..f90196804d 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,26 +8,6 @@ using Terraria.ModLoader; namespace CalamityMod.DataStructures { - [ReinitializeDuringResizeArrays] - public static class BuffDatasets - { - public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") - .Description("Stores DebuffData for a particular debuff") - .RegisterCustomSet(null, - BuffID.OnFire, DebuffData.OnFire, - BuffID.OnFire3, DebuffData.Hellfire, - BuffID.CursedInferno, DebuffData.CursedInferno, - BuffID.ShadowFlame, DebuffData.Shadowflame, - BuffID.Daybreak, DebuffData.Daybroken, - BuffID.Burning, DebuffData.Burning, - BuffID.Frostburn, DebuffData.Frostburn, - BuffID.Frostburn2, DebuffData.Frostbite, - BuffID.Poisoned, DebuffData.Poisoned, - BuffID.Venom, DebuffData.AcidVenom, - BuffID.Electrified, DebuffData.Electrified, - BuffID.Oiled, DebuffData.Oiled - ); - } public class DebuffData { /// @@ -113,11 +94,10 @@ namespace CalamityMod.DataStructures public bool GearCanModifyDebuff = true; /// - /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR /// How much alcohol this counts as. /// Default is 0, most alcohol is 1, and Everclear is 2 /// - public float AlcoholLevel = 0f; + public int AlcoholLevel = 0; /// /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR @@ -176,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; @@ -191,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; } @@ -204,7 +184,7 @@ namespace CalamityMod.DataStructures /// public void DefaultUpdateOnPlayer(Player player, int buffType, ref int buffIndex, ref int damage) { - + } /// @@ -225,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 @@ -297,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; @@ -310,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 @@ -379,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() @@ -438,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/Dusts/LemonNadeExplodeDust.cs b/Dusts/LemonNadeExplodeDust.cs new file mode 100644 index 0000000000..691f4de2ff --- /dev/null +++ b/Dusts/LemonNadeExplodeDust.cs @@ -0,0 +1,71 @@ +using System; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class LemonNadeExplodeDust : ModDust + { + public override string Texture => "CalamityMod/Particles/LemonNadeExplode"; + Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return new Color(54, 54, 54); + case 1: return new Color(76, 36, 36); + case 2: return new Color(132, 72, 56); + case 3: return new Color(50, 45, 37); + } + return Color.White; + } + } + public override void OnSpawn(Dust dust) + { + if (dust.color == Color.Transparent) + dust.color = RandomColor; + dust.dataAsFloat = 0.75f; + dust.rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); + } + public override bool MidUpdate(Dust dust) + { + return true; + } + + public override bool Update(Dust dust) + { + dust.dataAsFloat *= 0.96f; + dust.position += dust.velocity; + dust.velocity *= 0.925f; + dust.rotation += MathF.Sin(dust.dustIndex * 0.1f) * 0.2f * dust.dataAsFloat; + if (dust.dataAsFloat <= 0.01f) + dust.active = false; + return false; + } + + static Asset tex; + public override bool PreDraw(Dust dust) + { + tex ??= ModContent.Request("CalamityMod/Particles/LemonNadeExplode"); + Main.EntitySpriteDraw( + tex.Value, + dust.position - Main.screenPosition, + null, + dust.color * dust.dataAsFloat, + dust.rotation, + tex.Size() * 0.5f, + dust.scale * 0.1f * (0.75f + 0.25f * dust.dataAsFloat), + SpriteEffects.None, + 0 + ); + return false; + } + + + } +} diff --git a/Effects/AbyssalFireShader.fx b/Effects/AbyssalFireShader.fx new file mode 100644 index 0000000000..6a4a7a5e01 --- /dev/null +++ b/Effects/AbyssalFireShader.fx @@ -0,0 +1,79 @@ +sampler noiseTexture : register(s1); +sampler noiseTexture2 : register(s2); + +float time; +float glowPower; +float overallColorStrength; +float2 noiseScale; +float2 edgeFadeoutThreshold; +float3 innerColor; +float3 outerColor; +float3 overallColor; +float3 tipColor; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float InverseLerp(float from, float to, float x) +{ + return saturate((x - from) / (to - from)); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Account for texture distortion artifacts. + coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5; + + // 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 - edgeFadeoutThreshold, horizonatalDistanceFromCenter); + + // Calculate the main nosie color and distortion. + float4 noiseDistortion = tex2D(noiseTexture, coords * float2(4, 2) + float2(time * -0.72, time * 0.51)); + float4 noiseColor = tex2D(noiseTexture, coords * noiseScale + float2(time * -2.42 - noiseDistortion.r * 0.8, time * -1.33 + noiseDistortion.r * 0.8)); + + // Calculate how much a pixel should glow from the center outwards. + float glow = pow(0.1 / horizonatalDistanceFromCenter, glowPower); + + // Render as white near the tip of the flame jet, then ease into the inner and outer colors of the jet. + float3 flameBodyColor = lerp(tipColor, lerp(outerColor, innerColor, opacity), InverseLerp(0, 0.092, coords.x)); + float3 finalFlameColor = lerp(flameBodyColor, overallColor, overallColorStrength); + + float4 returnColor = (color * float4(finalFlameColor, 1) + noiseColor * glow) * opacity; + return returnColor; +} + +technique Technique1 +{ + pass LaserPass + { + VertexShader = compile vs_3_0 VertexShaderFunction(); + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} diff --git a/Effects/AbyssalFireShader.xnb b/Effects/AbyssalFireShader.xnb new file mode 100644 index 0000000000..9ebdc9a6d2 Binary files /dev/null and b/Effects/AbyssalFireShader.xnb differ 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/CalamityShaders.cs b/Effects/CalamityShaders.cs index c97027ab00..c842fac8ac 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. @@ -254,6 +254,18 @@ namespace CalamityMod.Effects // The distorted circular effect seen emanating from the distortion rift during DoG's fight. internal static Asset DoGRiftAuraShader; + + // 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; #endregion #region Big E's Shaders @@ -514,6 +526,18 @@ namespace CalamityMod.Effects DoGRiftAuraShader = LoadShader("DoGRiftAuraShader"); RegisterMiscShader(DoGRiftAuraShader, "DoGRiftAuraPass", "DoGRiftAura"); + + 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"); #endregion #region Loading Big E's Shaders 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/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 ffab2d16b6..ce412a01e9 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -186,7 +186,13 @@ namespace CalamityMod.Events new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall, NPCID.LittleHornetHoney, NPCID.HornetHoney, NPCID.BigHornetHoney }), - new Boss(NPCID.Deerclops), + new Boss(NPCID.Deerclops, spawnContext: type => + { + Player plr = Main.player[ClosestPlayerToWorldCenter]; + int deer = NPC.NewNPC(Source, (int)plr.Center.X, (int)(plr.Center.Y - 400f), type, 1); + Main.npc[deer].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(deer); + } ), new Boss(NPCID.SkeletronHead, TimeChangeContext.Night, type => { @@ -700,7 +706,8 @@ namespace CalamityMod.Events // Killing any split Deus head ends the fight instantly. You don't need to kill both. else if (npc.type == ModContent.NPCType() && npc.Calamity().newAI[0] != 0f) { - BossRushStage++; + if (BossRushStage <= Bosses.FindIndex(boss => boss.EntityID == ModContent.NPCType())) + BossRushStage++; CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; } 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/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/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/LemonNadePin.png b/Gores/LemonNadePin.png new file mode 100644 index 0000000000..bf59dbedf1 Binary files /dev/null and b/Gores/LemonNadePin.png differ diff --git a/Gores/MegalodonCasing.png b/Gores/MegalodonCasing.png new file mode 100644 index 0000000000..642d500372 Binary files /dev/null and b/Gores/MegalodonCasing.png differ diff --git a/Gores/MegalodonMag.png b/Gores/MegalodonMag.png new file mode 100644 index 0000000000..c5e53a621d Binary files /dev/null and b/Gores/MegalodonMag.png differ diff --git a/Gores/OmniARCasing.png b/Gores/OmniARCasing.png new file mode 100644 index 0000000000..03a5f79ee8 Binary files /dev/null and b/Gores/OmniARCasing.png differ diff --git a/Gores/OmniGrenadeShell.png b/Gores/OmniGrenadeShell.png new file mode 100644 index 0000000000..9da004d0c8 Binary files /dev/null and b/Gores/OmniGrenadeShell.png differ diff --git a/Gores/OmniShotgunShell.png b/Gores/OmniShotgunShell.png new file mode 100644 index 0000000000..5dd01912ff Binary files /dev/null and b/Gores/OmniShotgunShell.png differ diff --git a/Gores/OmniSniperCasing.png b/Gores/OmniSniperCasing.png new file mode 100644 index 0000000000..b3390c138d Binary files /dev/null and b/Gores/OmniSniperCasing.png 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/SeadragonCasing.png b/Gores/SeadragonCasing.png new file mode 100644 index 0000000000..7faaa79ce6 Binary files /dev/null and b/Gores/SeadragonCasing.png differ diff --git a/Gores/SeadragonMag.png b/Gores/SeadragonMag.png new file mode 100644 index 0000000000..681b0094dd Binary files /dev/null and b/Gores/SeadragonMag.png 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/VoidragonCasing.png b/Gores/VoidragonCasing.png new file mode 100644 index 0000000000..ba46e75c91 Binary files /dev/null and b/Gores/VoidragonCasing.png differ diff --git a/Gores/VoidragonMag.png b/Gores/VoidragonMag.png new file mode 100644 index 0000000000..76f97f7169 Binary files /dev/null and b/Gores/VoidragonMag.png differ diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 8c9a78f382..d962242faa 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -322,7 +322,7 @@ namespace CalamityMod.Graphics.Primitives } // Legacy behaviour: sample based on requested point count using Catmull-Rom style interpolation. - PositionsIndex = 1; + PositionsIndex = 0; float controlCountMinusOne = controlCount - 1f; PrimitiveSmoothingType legacyType = settings.SmoothingType; @@ -344,8 +344,6 @@ namespace CalamityMod.Graphics.Primitives MainPositions[PositionsIndex] = EvaluateCurve(legacyType, p0, p1, p2, p3, localSplineInterpolant, settings); PositionsIndex++; } - - MainPositions[0] = controlPoints[0]; MainPositions[PositionsIndex] = controlPoints[controlCount - 1]; PositionsIndex++; controlPoints.Clear(); diff --git a/Graphics/Primitives/PrimitiveSettings.cs b/Graphics/Primitives/PrimitiveSettings.cs index ebc4b51fcd..7996352e4e 100644 --- a/Graphics/Primitives/PrimitiveSettings.cs +++ b/Graphics/Primitives/PrimitiveSettings.cs @@ -309,7 +309,7 @@ namespace CalamityMod.Graphics.Primitives SmoothingTension = smoothingTension; FrameTransportMode = frameTransportMode; Topology = topology; - CapStyle = PrimitiveCapStyle.Flat; + CapStyle = capStyle; } } } diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 2e0e15714d..086b566167 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -401,6 +401,32 @@ namespace CalamityMod.ILEditing } #endregion + #region Flail Balance Changes + // Make flails be unaffected by player velocity + private static void FlailsNoLongerAffectedByPlayerVelocity(On_Projectile.orig_AI_015_Flails orig, Projectile self) + { + orig(self); + if (self.ai[0] == 1f && self.ai[1] == 0f) + self.velocity -= Main.player[self.owner].velocity; + } + + // Increase Flower Pow's return speed + private static void IncreaseFlowerPowRetSpeed(ILContext il) + { + var cursor = new ILCursor(il); + // Move to where Flower Pow receives its specific flail stat changes. This moves it after num2 = 23f + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcR4(23f), i => i.MatchStloc(6))) + { + LogFailure("Flower Pow Buff", "Could not move to Flower Pow's specific flail stat changes."); + return; + } + + // Emit an instruction setting num5 (the return speed) to 21. Vanilla is 16 + cursor.Emit(OpCodes.Ldc_R4, 21f); + cursor.Emit(OpCodes.Stloc, 9); + } + #endregion + #region Terrarian Projectile Limitation for Extra Updates private static void LimitTerrarianProjectiles(ILContext il) { @@ -748,5 +774,115 @@ namespace CalamityMod.ILEditing } } #endregion + + #region Tweak Pygmy Staff Aggro Distance Logic + // Code written by Habble + private static void PygmyAggroOnClosestPointInHitbox(ILContext context) + { + // Adjust Pygmy Staff's attack distance logic to be measured from the closest point to the enemy instead of the enemy's center. + ILCursor cursor = new(context); + + // Go to the latest newly set variable near the point we wanna be, as that is an easy unique instruction to jump to. 131 is the number assigned to that local variable. + if (!cursor.TryGotoNext(i => i.MatchStloc(131))) + { + LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate unique Stloc(131) instruction nearest to aggro distance check."); + return; + } + // Move before the minion range variable emission so as to receive the value being targetted at it. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc(126))) + { + LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate the minion range variable."); + return; + } + cursor.Emit(OpCodes.Ldarg_0); // Emits the Projectile entity itself + cursor.Emit(OpCodes.Ldloc, 129); // Emits the NPC index via the incremented loop variable + cursor.Emit(OpCodes.Ldloc, 6); // Emits the bool containing type check for Pygmies + // Replace the distance with a different value calculated off of closest point in hitboxes + cursor.EmitDelegate((float distance, Projectile projectile, int npcIndex, bool pygmy) => + { + if (!pygmy) + return distance; + + NPC npc = Main.npc[npcIndex]; + Player player = Main.player[projectile.owner]; + float finalDistance = npc.Hitbox.ClosestPointInRect(player.Center).Distance(player.Hitbox.ClosestPointInRect(npc.Center)); + return finalDistance; + }); + + // That was part 1, time for part 2. + // Go directly before the instruction that's meant to receive the distance value of this tagged NPC. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(185))) + { + LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate first unique Stloc(185) instruction."); + return; + } + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldloc, 181); // Emits the tagged NPC + cursor.Emit(OpCodes.Ldloc, 6); + // Replace the distance with a different value calculated off of closest point in hitboxes + cursor.EmitDelegate((float distance, Projectile projectile, NPC npc, bool pygmy) => + { + if (!pygmy) + return distance; + + float finalDistance = npc.Hitbox.ClosestPointInRect(projectile.Center).Distance(projectile.Hitbox.ClosestPointInRect(npc.Center)); + return finalDistance; + }); + + // Go directly before the instruction that's meant to receive the distance value of this NPC currently being iterated over. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(189))) + { + LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate first unique Stloc(189) instruction."); + return; + } + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldloc, 186); // Emits the NPC index via the incremented loop variable + cursor.Emit(OpCodes.Ldloc, 6); + // Replace the distance with a different value calculated off of closest point in hitboxes + cursor.EmitDelegate((float distance, Projectile projectile, int npcIndex, bool pygmy) => + { + if (!pygmy) + return distance; + + NPC npc = Main.npc[npcIndex]; + float finalDistance = npc.Hitbox.ClosestPointInRect(projectile.Center).Distance(projectile.Hitbox.ClosestPointInRect(npc.Center)); + return finalDistance; + }); + } + #endregion + + #region Remove Vanilla Whip Tag Crits + // Code written by Habble + /// + /// IL edits both vanilla whip crit tags' crit bool set calls to ensure they're never assigned a new value + /// + /// + private static void PreventVanillaWhipTagCrits(ILContext context) + { + ILCursor cursor = new(context); + #region Morning Star + // Go to the unique instructions nearest to the Morning Star tag's crit roll and then stand before the crit bool set call + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdloc(59)) || !cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(30))) + { + LogFailure("Removing vanilla whip tag crits", "Could not locate the crit bool set call under Morning Star tag"); + return; + } + // Put the previous value of the crit bool on the stack to then return that instead of the supplied value by "consuming" them as parameters, so as to not overwrite it + // This is more ideal than modifying label conditions because it is likelier for the latter to change over time + cursor.Emit(OpCodes.Ldloc, 30); + cursor.EmitDelegate((int input, bool originalValue) => originalValue.ToInt()); + #endregion Morning Star + #region Kaleidoscope + // Similar deal for Kaleidoscope as well + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(30)) || !cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(30))) + { + LogFailure("Removing vanilla whip tag crits", "Could not locate the crit bool set call under Kaleidoscope tag"); + return; + } + cursor.Emit(OpCodes.Ldloc, 30); + cursor.EmitDelegate((int input, bool originalValue) => originalValue.ToInt()); + #endregion Kaleidoscope + } + #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index d5fb8e25e0..67b5ec5794 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -83,7 +83,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; @@ -104,8 +103,12 @@ namespace CalamityMod.ILEditing // Damage and health balance On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; + IL_Projectile.Damage += PreventVanillaWhipTagCrits; IL_Projectile.Damage += VanillaBossResistChanges; + IL_Projectile.AI_026 += PygmyAggroOnClosestPointInHitbox; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; + On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; + IL_Projectile.AI_015_Flails += IncreaseFlowerPowRetSpeed; IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; On_Player.ConsumeSolarFlare += SolarWingsDashChange; On_Projectile.IsDamageDodgable += GFBNurseMeteorUndodgeable; @@ -150,9 +153,6 @@ namespace CalamityMod.ILEditing IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; - On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; - 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 38e435b56e..f7466891f6 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -563,6 +563,8 @@ namespace CalamityMod.ILEditing { if (self.Calamity().oldFashioned) damage = (int)(damage * OldFashioned.DamageBoostMultiplier); + if (self.GetModPlayer().HasAlcohol(AlcoholType.OldFashioned)) + damage = (int)(damage * OldFashioned.DamageBoostMultiplier); orig(self, npc, damage, knockback, direction, crit, damageType, damageVariation); } #endregion @@ -1651,164 +1653,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 8b11dcb9e3..c2674dcadc 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -318,68 +318,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Remove Flail Throw Velocity Being Affected By Player Velocity - private static void FlailsNoLongerAffectedByPlayerVelocity(On_Projectile.orig_AI_015_Flails orig, Projectile self) - { - orig(self); - if (self.ai[0] == 1f && self.ai[1] == 0f) - self.velocity -= Main.player[self.owner].velocity; - } - #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) { diff --git a/Items/Accessories/SkylineBobber.cs b/Items/Accessories/AcrobaticBobber.cs similarity index 88% rename from Items/Accessories/SkylineBobber.cs rename to Items/Accessories/AcrobaticBobber.cs index 47a9fea7a3..ffd5b98001 100644 --- a/Items/Accessories/SkylineBobber.cs +++ b/Items/Accessories/AcrobaticBobber.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Fishing { - internal class SkylineBobber : ModItem, ILocalizedModType + [LegacyName("SkylineBobber")] + internal class AcrobaticBobber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override string Texture => "CalamityMod/Projectiles/Typeless/HeronBobber"; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Fishing public override void UpdateAccessory(Player player, bool hideVisual) { player.accFishingBobber = true; - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SkylineBobber; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.AcrobaticBobber; } public override void AddRecipes() { 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/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/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..9e51e21962 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -27,7 +27,6 @@ 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; 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/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 14d252e5f0..fcb886a6d6 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; } diff --git a/Items/Accessories/BatholithBangle.cs b/Items/Accessories/BatholithBangle.cs index c244cd51d4..94f50319a8 100644 --- a/Items/Accessories/BatholithBangle.cs +++ b/Items/Accessories/BatholithBangle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static int cooldown = 600; - public static int damage = 100; + public static int damage = 50; public override void SetDefaults() { Item.width = 36; diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 7a6bd7980a..87edf334c1 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.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; @@ -22,6 +24,7 @@ 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; } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 94f56a3c97..a16a16e50d 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 42; - Item.defense = 3; + Item.defense = 2; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; @@ -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 f81bb96832..3cb14f971f 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 12; Item.height = 15; - Item.defense = 3; + Item.defense = 2; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; @@ -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/DimensionalSoulArtifact.cs b/Items/Accessories/CrushingEgo.cs similarity index 88% rename from Items/Accessories/DimensionalSoulArtifact.cs rename to Items/Accessories/CrushingEgo.cs index b8541a3f47..13c92cc9fb 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/CrushingEgo.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class DimensionalSoulArtifact : ModItem, ILocalizedModType + [LegacyName("DimensionalSoulArtifact")] + public class CrushingEgo : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dArtifact = true; + modPlayer.crushingEgo = true; } public override void AddRecipes() diff --git a/Items/Accessories/DimensionalSoulArtifact.png b/Items/Accessories/CrushingEgo.png similarity index 100% rename from Items/Accessories/DimensionalSoulArtifact.png rename to Items/Accessories/CrushingEgo.png diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 2fbb970c79..1e6b2dbbc3 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories /// The amount of critical strike chance bonus where crit starts decaying faster.
/// When the crit bonus reaches this value, the decay rate increases by one tier. ///
- public static readonly int CritDecayThreshold = 60; + public static readonly int CritDecayThreshold = 50; /// /// When the critical strike chance bonus has exceeded , it continues to decay faster for every more. @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Accessories /// /// The maximum amount of extra critical strike chance you can get from this accessory. /// - public static readonly int CritHardCap = 100; + public static readonly int CritHardCap = 75; #endregion @@ -151,7 +151,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(15). AddIngredient(15). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(4). + AddIngredient(ItemID.FragmentVortex, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/DarkMatterSheath.cs b/Items/Accessories/DarkMatterSheath.cs index c77de6db38..c84de1d85c 100644 --- a/Items/Accessories/DarkMatterSheath.cs +++ b/Items/Accessories/DarkMatterSheath.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(5). + AddIngredient(14). //Consistent with Vanilla lunar wing costs AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/DiamondOfTheDeep.cs b/Items/Accessories/DiamondOfTheDeep.cs index ee6c3d8e97..316af2422c 100644 --- a/Items/Accessories/DiamondOfTheDeep.cs +++ b/Items/Accessories/DiamondOfTheDeep.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.dOfTheDeep = true; modPlayer.dOfTheDeepVisual = !hideVisual; - modPlayer.WaterDebuffMultiplier += 0.75f; + modPlayer.WaterDebuffMultiplier += 0.6f; } public override void AddRecipes() 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..6d3e214701 100644 --- a/Items/Accessories/ElementalinaBottle.cs +++ b/Items/Accessories/ElementalinaBottle.cs @@ -23,7 +23,7 @@ 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; public override void UpdateAccessory(Player player, bool hideVisual) { 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/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index 98ee31e460..0a3073ee10 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Accessories public class EtherealExtorter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int soulDamage => 20; public override void SetDefaults() { Item.width = 28; diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index b3c6331489..16567724e8 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -7,6 +7,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; @@ -15,6 +16,13 @@ namespace CalamityMod.Items.Accessories public class EtherealTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxManaBoost = 60; + public static float ManaCostReduction = 0.08f; + public static float MagicDamageBoost = 0.15f; + public static int MagicCritBoost = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + public override void SetDefaults() { Item.width = 28; @@ -65,17 +73,14 @@ 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; - player.statManaMax2 += 150; - player.GetDamage() += 0.15f; - player.manaCost -= 0.1f; - player.GetCritChance() += 5; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 3a270de644..1b011f82d9 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,15 +26,7 @@ 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; public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/FadedIdolatry.cs similarity index 87% rename from Items/Accessories/AuricSoulArtifact.cs rename to Items/Accessories/FadedIdolatry.cs index 9ff5405c94..72f213f81d 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/FadedIdolatry.cs @@ -9,8 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("GodlySoulArtifact")] - public class AuricSoulArtifact : ModItem, ILocalizedModType + [LegacyName("GodlySoulArtifact", "AuricSoulArtifact")] + public class FadedIdolatry : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.auricSArtifact = true; + modPlayer.fadedIdolatry = true; } public override void AddRecipes() diff --git a/Items/Accessories/AuricSoulArtifact.png b/Items/Accessories/FadedIdolatry.png similarity index 100% rename from Items/Accessories/AuricSoulArtifact.png rename to Items/Accessories/FadedIdolatry.png diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index 172ca19e4e..c331bb080a 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; } diff --git a/Items/Accessories/PerennialBobber.cs b/Items/Accessories/FeralBobber.cs similarity index 89% rename from Items/Accessories/PerennialBobber.cs rename to Items/Accessories/FeralBobber.cs index 0705e28791..908249614a 100644 --- a/Items/Accessories/PerennialBobber.cs +++ b/Items/Accessories/FeralBobber.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - internal class PerennialBobber : ModItem, ILocalizedModType + [LegacyName("PerennialBobber")] + internal class FeralBobber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override string Texture => "CalamityMod/Projectiles/Typeless/FeralDoubleBobber"; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories { player.accFishingBobber = true; player.fishingSkill += (int)((player.statLifeMax2 - player.statLife) * 0.25f); - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.PerennialBobber; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralBobber; } public override void AddRecipes() { diff --git a/Items/Accessories/FishStocks.cs b/Items/Accessories/FishStocks.cs new file mode 100644 index 0000000000..a3215a46e0 --- /dev/null +++ b/Items/Accessories/FishStocks.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class FishStocks : ModItem, ILocalizedModType, IHoldShiftTooltipItem + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 30; + Item.height = 38; + 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/FishStocks.png b/Items/Accessories/FishStocks.png new file mode 100644 index 0000000000..0916c5320a Binary files /dev/null and b/Items/Accessories/FishStocks.png differ diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 3b47623fee..53f57e9697 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; @@ -16,7 +18,10 @@ 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 SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 36; diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index 0d19323f73..c01e7ac7ec 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Items.Accessories public static int manaStorageMax = 600; public const int lostSoulDamage = 200; + public static int MinDelay => 60; + public static int MaxDelay => 240; public override void SetDefaults() { @@ -29,7 +31,7 @@ namespace CalamityMod.Items.Accessories modPlayer.fleshTotem = true; modPlayer.fleshTotemMinion = true; modPlayer.fleshTotemVisual = !hideVisual; - player.statManaMax2 += 30; + player.statManaMax2 += 20; player.GetCritChance() += 5; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/FragmentsOfAnotherWorld.cs similarity index 55% rename from Items/Accessories/EldritchSoulArtifact.cs rename to Items/Accessories/FragmentsOfAnotherWorld.cs index 0e1299f0ed..b863550841 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/FragmentsOfAnotherWorld.cs @@ -5,12 +5,20 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class EldritchSoulArtifact : ModItem, ILocalizedModType + [LegacyName("EldritchSoulArtifact")] + public class FragmentsOfAnotherWorld : ModItem, ILocalizedModType { + static float MeleeSpeedIncrease => 0.2f; + static float RangedSpecialistDmgMult => 1.15f; + static float ManaCostReduction => 0.25f; + static int MaxSentries => 2; + static float RogueSpeedIncrease => 0.1f; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -21,12 +29,16 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Purple; } + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeSpeedIncrease.ToPercent(), RangedSpecialistDmgMult, ManaCostReduction.ToPercent(), MaxSentries, RogueSpeedIncrease.ToPercent()); + public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eArtifact = true; player.buffImmune[ModContent.BuffType()] = true; - player.GetAttackSpeed() += 0.1f; + player.GetAttackSpeed() += MeleeSpeedIncrease; + player.specialistDamage *= RangedSpecialistDmgMult; + player.manaCost -= ManaCostReduction; + player.maxTurrets += MaxSentries; + player.GetAttackSpeed() += RogueSpeedIncrease; } public override void AddRecipes() diff --git a/Items/Accessories/EldritchSoulArtifact.png b/Items/Accessories/FragmentsOfAnotherWorld.png similarity index 100% rename from Items/Accessories/EldritchSoulArtifact.png rename to Items/Accessories/FragmentsOfAnotherWorld.png diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 647d427878..93326a9153 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,13 @@ namespace CalamityMod.Items.Accessories public class FrostFlare : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float HealthRatioThreshold = 0.5f; + public static float DamageBoost = 0.1f; + public static int DefenseBoost = 10; + public static float AccelerationBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(HealthRatioThreshold.ToPercent(), DamageBoost.ToPercent(), DefenseBoost, AccelerationBoost.ToPercent()); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 4)); diff --git a/Items/Accessories/FrozenCube.cs b/Items/Accessories/FrozenCube.cs new file mode 100644 index 0000000000..ebc32c8439 --- /dev/null +++ b/Items/Accessories/FrozenCube.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +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 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 }; + public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/ElumphantBop") { Volume = 0.6f }; + public static readonly SoundStyle jokeBonk = new("CalamityMod/Sounds/Item/Bonk") { Volume = 0.6f }; + + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 34; + Item.height = 34; + 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(); + modPlayer.frozenCube = true; + modPlayer.frozenCubeVisuals = !hideVisual; + + 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 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) + list.FindAndReplace("[DAMAGELINE]", Main.LocalPlayer.Calamity().frozenCube ? + this.GetLocalization("EquippedDebuff").Format((Main.LocalPlayer.Calamity().frozenCubeDebuffBoost.ToPercent("N0")).ToString()) + "\n" + + this.GetLocalization("EquippedElumphant").Format((Main.LocalPlayer.Calamity().frozenCubeElumphantBoost.ToPercent("N1")).ToString()) + : this.GetLocalizedValue("Unequipped")); + } + } +} diff --git a/Items/Accessories/FrozenCube.png b/Items/Accessories/FrozenCube.png new file mode 100644 index 0000000000..01db00cba3 Binary files /dev/null and b/Items/Accessories/FrozenCube.png differ 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/GiantShell.cs b/Items/Accessories/GiantShell.cs index fe575c6fd1..07a4087a9e 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,11 +10,17 @@ namespace CalamityMod.Items.Accessories public class GiantShell : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int DefenseBoost = 4; + public static float DashVelocityMult = 0.9f; + public static int PostHitCancelDuration = CalamityUtils.SecondsToFrames(3); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((1f - DashVelocityMult).ToPercent(), PostHitCancelDuration.FramesToSeconds()); + public override void SetDefaults() { Item.width = 30; Item.height = 28; - Item.defense = 5; + Item.defense = DefenseBoost; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 9551ffbb81..95a335be53 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -8,11 +9,18 @@ namespace CalamityMod.Items.Accessories public class GiantTortoiseShell : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int DefenseBoost = 6; + public static float DamageReductionBoost = 0.1f; + public static float DashVelocityMult = 0.9f; + public static int PostHitCancelDuration = CalamityUtils.SecondsToFrames(3); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageReductionBoost.ToPercent(), (1f - DashVelocityMult).ToPercent(), PostHitCancelDuration.FramesToSeconds()); + public override void SetDefaults() { Item.width = 46; Item.height = 30; - Item.defense = 10; + Item.defense = DefenseBoost; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; 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..c1648a12b3 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -28,8 +28,7 @@ namespace CalamityMod.Items.Accessories 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 948499ad65..718c929754 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.rareSandElemental || modPlayer.cloudElemental || modPlayer.waterElemental) + if (modPlayer.brimElemental || modPlayer.sandElemental || modPlayer.oasisElemental || modPlayer.cloudElemental || modPlayer.waterElemental) { return false; } @@ -48,7 +51,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.allElementals = true; - modPlayer.elementalHeart = true; 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(); @@ -177,7 +178,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index aebb7705d0..d934e91c64 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -1,21 +1,70 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Rarities; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using Terraria.UI; namespace CalamityMod.Items.Accessories { + public enum AlcoholType + { + None, + BaconOil, + BloodyMary, + CaribbeanRum, + CinnamonRoll, + Everclear, + EvergreenGin, + Fireball, + GrapeBeer, + Manhattan, + Margarita, + Moonshine, + MoscowMule, + OldFashioned, + PurpleHaze, + RedWine, + Rum, + Screwdriver, + StarBeamRye, + Tequila, + TequilaSunrise, + Vodka, + Whiskey, + WhiteWine, + Ale, + Sake, + } + + public interface IAlcoholItem + { + Action IVDripAlcoholEffect { get; } + AlcoholType AlcoholVariant { get; } + LocalizedText DripEffectText { get; } + } + public class IVDripOnTheRocks : ModItem, ILocalizedModType { + public int containedAlcoholID = -1; + public AlcoholType currentAlcoholType = AlcoholType.None; public new string LocalizationCategory => "Items.Accessories"; - public static readonly float DamageBoostMultiplier = 1.25f; // Same as Old Fashioned but can be changed at any time - public static readonly float DamageReductionMultiplier = 0.75f; // Same as Old Fashioned but can be changed at any time - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); public override void SetDefaults() + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new Terraria.DataStructures.DrawAnimationVertical(1, 26)); + ItemID.Sets.AnimatesAsSoul[Item.type] = true; + } + + public override void SetDefaults() { Item.width = 58; Item.height = 60; @@ -24,19 +73,244 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void Load() { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ivDrip = true; + On_ItemSlot.OverrideLeftClick += IvDripAlcoholEquip; } - public override void AddRecipes() + public override void Unload() { - CreateRecipe(). - AddIngredient(). - AddIngredient(6). - AddTile(TileID.MythrilAnvil). - Register(); + 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) + { + Item mouseItem = Main.mouseItem; + Item targetItem = inv[slot]; + + // Vanilla alcohols have to be applied manually + bool isMouseAle = mouseItem.type == ItemID.Ale; + bool isTargetAle = targetItem.type == ItemID.Ale; + bool isMouseSake = mouseItem.type == ItemID.Sake; + bool isTargetSake = targetItem.type == ItemID.Sake; + + // Alcohol into this acc + if (targetItem.ModItem is IVDripOnTheRocks drip && (mouseItem.ModItem is IAlcoholItem || isMouseAle || isMouseSake)) + { + if (drip.containedAlcoholID == -1) + { + drip.containedAlcoholID = mouseItem.type; + drip.currentAlcoholType = isMouseAle ? AlcoholType.Ale : (isMouseSake ? AlcoholType.Sake : (mouseItem.ModItem as IAlcoholItem).AlcoholVariant); + + mouseItem.stack--; + if (mouseItem.stack <= 0) + mouseItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + + if (mouseItem.ModItem is IVDripOnTheRocks dripHeld && (targetItem.ModItem is IAlcoholItem || isTargetAle || isTargetSake)) + { + if (dripHeld.containedAlcoholID == -1) + { + dripHeld.containedAlcoholID = targetItem.type; + dripHeld.currentAlcoholType = isTargetAle ? AlcoholType.Ale : (isTargetSake ? AlcoholType.Sake : (targetItem.ModItem as IAlcoholItem).AlcoholVariant); + + targetItem.stack--; + if (targetItem.stack <= 0) + targetItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + } + return orig(inv, context, slot); + } + + #region Shift-Right Click to Empty IV Drip + + // Allow shift-right clicking only if the IV drip actually contains alcohol + public override bool CanRightClick() => containedAlcoholID != -1 && Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); + + public override void RightClick(Player player) + { + if (containedAlcoholID != -1) + { + // Give the alcohol back to the player + player.QuickSpawnItem(player.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + + Item.stack++; + + SoundEngine.PlaySound(SoundID.Grab); + } + } + #endregion + public override void PreReforge() + { + if (containedAlcoholID != -1) + { + // Refund the alcohol to the player. + Main.LocalPlayer.QuickSpawnItem(Main.LocalPlayer.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + IVDripPlayer dripPlayer = player.GetModPlayer(); + dripPlayer.ivDripEquipped = true; + + if (containedAlcoholID != -1) + { + dripPlayer.currentAlcohol = currentAlcoholType; + + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + dripPlayer.ApplyIVDripAlcoholEffect(alcohol.IVDripAlcoholEffect); + } + } + + public override void ModifyTooltips(List tooltips) + { + if (tooltips == null) return; + + var effectLine = tooltips.FirstOrDefault(x => x.Text.Contains("[EFFECT]")); + var nameLine = tooltips.FirstOrDefault(x => x.Text.Contains("[NAME]")); + + if (containedAlcoholID == -1) + { + if (effectLine != null) + { + effectLine.Text = this.GetLocalizedValue("Empty"); + } + nameLine?.Hide(); + return; + } + + if (effectLine != null) + { + if (containedAlcoholID == ItemID.Ale || containedAlcoholID == ItemID.Sake) + effectLine.Text = this.GetLocalizedValue("SakeAndAleText"); + + else + { + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + effectLine.Text = alcohol.DripEffectText.Value; + } + } + + if (nameLine != null) + { + string alcoholName = Lang.GetItemNameValue(containedAlcoholID); + nameLine.Text = this.GetLocalizedValue("CurrentAlcoholText") + $" [c/FF81E4:{alcoholName}]"; + } + } + + // Draw the correct alcohol variant frame + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = TextureAssets.Item[Item.type].Value; + + int frameHeight = texture.Height / 26; + int frameIndex = (int)currentAlcoholType; + + Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight); + + spriteBatch.Draw(texture, position, targetFrame, drawColor, 0f, origin, scale, SpriteEffects.None, 0f); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = TextureAssets.Item[Item.type].Value; + + int frameHeight = texture.Height / 26; + int frameIndex = (int)currentAlcoholType; + + Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight); + + Vector2 drawPosition = Item.position - Main.screenPosition + new Vector2(Item.width / 2, Item.height - frameHeight / 2); + Vector2 origin = targetFrame.Size() / 2f; + + spriteBatch.Draw(texture, drawPosition, targetFrame, lightColor, rotation, origin, scale, SpriteEffects.None, 0f); + return false; + } + } + + public class IVDripPlayer : ModPlayer + { + public Dictionary, float> IVDripAlcoholEffects = new(); + public bool ivDripEquipped; + public AlcoholType currentAlcohol = AlcoholType.None; + + // would otherwise be spamming these checks manually any time another class wants to check for if IV drip has a certain alcohol filled + public bool HasAlcohol(AlcoholType type) + { + return ivDripEquipped && currentAlcohol == type; + } + + public override void ResetEffects() + { + IVDripAlcoholEffects.Clear(); + ivDripEquipped = false; + currentAlcohol = AlcoholType.None; + } + + public void ApplyIVDripAlcoholEffect(Action effect) + { + if (effect == null) + return; + + if (IVDripAlcoholEffects.ContainsKey(effect)) + IVDripAlcoholEffects[effect] += 1f; + else + IVDripAlcoholEffects[effect] = 1f; + } + + public override void PostUpdateEquips() + { + foreach (var effect in IVDripAlcoholEffects) + { + effect.Key.Invoke(Player, effect.Value); + } } } } diff --git a/Items/Accessories/IVDripOnTheRocks.png b/Items/Accessories/IVDripOnTheRocks.png index b2736f4dac..24f80d57d7 100644 Binary files a/Items/Accessories/IVDripOnTheRocks.png and b/Items/Accessories/IVDripOnTheRocks.png differ 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 50ae2b6ba1..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; @@ -8,7 +10,12 @@ namespace CalamityMod.Items.Accessories public class LeviathanAmbergris : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int ambergrisDashDamage = 650; + 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/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/ManaPolarizer.cs b/Items/Accessories/ManaPolarizer.cs index 73fc472501..dbf71c47da 100644 --- a/Items/Accessories/ManaPolarizer.cs +++ b/Items/Accessories/ManaPolarizer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.manaOverloader = true; - player.statManaMax2 += 50; + player.statManaMax2 += 40; } } } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index cc6ed61b48..6616b0030f 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.moonCrown = true; modPlayer.mageCrownVisibility = !hideVisual; - player.statManaMax2 += 70; + player.statManaMax2 += 40; player.GetDamage() += (0.02f * modPlayer.mageCrownCount); //2% per moon sigil, up to 20% player.manaCost -= (0.01f * modPlayer.mageCrownCount); //1% per moon sigil, up to 10% if (modPlayer.mageCrownCount >= 5) //At 5 sigils, grant a mana regen bonus @@ -56,7 +56,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 270d1bbe1c..b6472598ad 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Accessories { //The stealth damage boost is handled in CalamityPlayer for some reason, maybe someone didn't want em to stack? public new string LocalizationCategory => "Items.Accessories"; + public static int RaiderBonus => 10; public override void SetDefaults() { Item.width = 46; @@ -27,6 +29,7 @@ namespace CalamityMod.Items.Accessories modPlayer.electricianGlove = true; modPlayer.filthyGlove = true; modPlayer.bloodyGlove = true; + modPlayer.raiderTalisman = true; player.GetDamage() += 0.15f; player.Calamity().rogueVelocity += 0.15f; } @@ -35,7 +38,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). + AddIngredient(). AddIngredient(). + AddIngredient(ItemID.LunarBar, 8). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 7033bda892..91b3cc3860 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -1,6 +1,8 @@ -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.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Accessories public class NebulousCore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; 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/RareElementalinaBottle.cs b/Items/Accessories/OasisElementalinaBottle.cs similarity index 75% rename from Items/Accessories/RareElementalinaBottle.cs rename to Items/Accessories/OasisElementalinaBottle.cs index 6dafdf72e7..ac3b466f00 100644 --- a/Items/Accessories/RareElementalinaBottle.cs +++ b/Items/Accessories/OasisElementalinaBottle.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -8,8 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("WifeinaBottlewithBoobs")] // Yes, that was the actual name. - public class RareElementalinaBottle : ModItem, ILocalizedModType + [LegacyName("WifeinaBottlewithBoobs", "RareElementalinaBottle")] // Yes, that was the actual name. + public class OasisElementalinaBottle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -25,25 +26,17 @@ 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; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rareSandElemental = true; + modPlayer.oasisElemental = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -59,12 +52,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rareSandElementalVanity = true; + modPlayer.oasisElementalVanity = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/RareElementalinaBottle.png b/Items/Accessories/OasisElementalinaBottle.png similarity index 100% rename from Items/Accessories/RareElementalinaBottle.png rename to Items/Accessories/OasisElementalinaBottle.png diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 30e331049d..b8207f6c8b 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; diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index e077129fdf..e739630aae 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,15 +29,7 @@ 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; public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 9804f10732..28a37b992d 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -17,9 +17,10 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int RegenBoost = 2; - public static int DefenseBoost = 8; - public static float SummonDamageBoost = 0.1f; + public static int RegenBoost => 2; + public static int DefenseBoost => 8; + public static float SummonDamageBoost => 0.1f; + public static float DaggerDamage => 300; public LocalizedText TooltipExtensionText => this.GetLocalization("HoldShiftTooltip").WithFormatArgs(SummonDamageBoost.ToPercent(), DefenseBoost, RegenBoost.ToRegenPerSecond()); public override void SetStaticDefaults() { diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 11de8740a1..30445b7dcc 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.GetDamage() += 0.15f; - player.GetCritChance() += 5; + player.GetCritChance() += 7; player.magicQuiver = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.deadshotBrooch = true; 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 c9c1807c50..2d446d05c8 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; @@ -36,7 +38,11 @@ namespace CalamityMod.Items.Accessories public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; - public static SummonTag SummonTag = new() { MultiplicativeTagDamage = 0.2f, TagModifyHitEffects = ApplyTagModifyHit, AutoDrawTooltip = false }; + public static SummonTag SummonTag = new() { + MultiplicativeTagDamage = 0.2f, + TagModifyHitEffects = ApplyTagModifyHit, + AutoDrawTooltip = false + }; public static void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) { @@ -215,13 +221,13 @@ 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(); } public override void SetDefaults() { - SummonTag.TagItem = Item.type; + SummonTag.TagItem = Type; SummonTag.TagTexture = TextureAssets.Item[Type]; Item.width = 50; Item.height = 50; diff --git a/Items/Accessories/ProtolithBangle.cs b/Items/Accessories/ProtolithBangle.cs index b80f6f8225..ccb02720ab 100644 --- a/Items/Accessories/ProtolithBangle.cs +++ b/Items/Accessories/ProtolithBangle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static int cooldown = 420; - public static int damage = 60; + public static int damage = 30; public override void SetDefaults() { Item.width = 34; diff --git a/Items/Accessories/PusSac.png b/Items/Accessories/PusSac.png deleted file mode 100644 index b7e706c8d0..0000000000 Binary files a/Items/Accessories/PusSac.png and /dev/null differ diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index 9efd1466f7..57ce750d51 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddRecipeGroup("AnyQuiver"). - AddIngredient(5). + AddIngredient(ItemID.FragmentVortex, 5). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 775a842fa1..fdbbeef494 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 15f; - public const int RaiderCooldown = 10; //seconds + public static int RaiderBonus => 15; + public static int RaiderCooldown => 10; //seconds public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() @@ -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..dd2aaed632 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() diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index be56ae478a..e27ceb86df 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,15 +26,7 @@ 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; public override void UpdateAccessory(Player player, bool hideVisual) { 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 94c5dd7487..a3dee2aa70 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Accessories public class SigilofCalamitas : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxManaBoost = 60; + public static float MagicDamageBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); @@ -27,9 +33,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.manaMagnet = true; - player.statManaMax2 += 100; - player.GetDamage() += 0.15f; - player.manaCost -= 0.1f; + player.statManaMax2 += MaxManaBoost; + player.GetDamage() += MagicDamageBoost; } public override void AddRecipes() diff --git a/Items/Accessories/SlagsplitterPauldron.cs b/Items/Accessories/SlagsplitterPauldron.cs index 62ca8e1c6d..497c71082d 100644 --- a/Items/Accessories/SlagsplitterPauldron.cs +++ b/Items/Accessories/SlagsplitterPauldron.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public class SlagsplitterPauldron : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int PauldronSlamDamage = 330; + public static int PauldronSlamDamage => 250; public override void SetDefaults() { Item.width = 42; diff --git a/Items/Accessories/SpringStool.cs b/Items/Accessories/SpringStool.cs index e68a6b1687..b3c39d4ca4 100644 --- a/Items/Accessories/SpringStool.cs +++ b/Items/Accessories/SpringStool.cs @@ -72,7 +72,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 (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active && hasGroundedSinceJump && !(Player.grappling[0] >= 0)) { springStoolTimer = 12; @@ -96,8 +97,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)) 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/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/NavystoneBobber.cs b/Items/Accessories/SunkenSinker.cs similarity index 89% rename from Items/Accessories/NavystoneBobber.cs rename to Items/Accessories/SunkenSinker.cs index e78241dccd..0563341a47 100644 --- a/Items/Accessories/NavystoneBobber.cs +++ b/Items/Accessories/SunkenSinker.cs @@ -7,7 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - internal class NavystoneBobber : ModItem, ILocalizedModType + [LegacyName("NavystoneBobber")] + internal class SunkenSinker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override string Texture => "CalamityMod/Projectiles/Typeless/NavyBobber"; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.accFishingBobber = true; - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavystoneBobber; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SunkenSinker; } public override void AddRecipes() { 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/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 08416580fe..91bac3cf1e 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(5). - AddIngredient(6). + AddIngredient(14). //Consistent with Vanilla lunar wing costs AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 4d4836af00..bc4d57d665 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() @@ -39,11 +42,11 @@ namespace CalamityMod.Items.Accessories modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; - modPlayer.HeatDebuffMultiplier += 3f; - modPlayer.ColdDebuffMultiplier += 3f; - modPlayer.SicknessDebuffMultiplier += 3f; - modPlayer.WaterDebuffMultiplier += 3f; - modPlayer.ElectricDebuffMultiplier += 3f; + modPlayer.HeatDebuffMultiplier += 2f; + modPlayer.ColdDebuffMultiplier += 2f; + modPlayer.SicknessDebuffMultiplier += 2f; + modPlayer.WaterDebuffMultiplier += 2f; + modPlayer.ElectricDebuffMultiplier += 2f; } public override void AddRecipes() 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/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index eb0800a9db..9967c7d23e 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -9,9 +9,9 @@ namespace CalamityMod.Items.Accessories { public class VampiricTalisman : ModItem, ILocalizedModType, IHoldShiftTooltipItem { - internal const int ArmorCrunchDebuffTime = 150; - internal const int HeavyBleedingDebuffTime = 300; - public const float RaiderBonus = 15f; + internal static int ArmorCrunchDebuffTime => 150; + internal static int HeavyBleedingDebuffTime => 300; + public static int RaiderBonus => 15; public bool ShowExtensionIndicator => false; diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 3c0954a148..359862b34c 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -1,9 +1,20 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; +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.NetModules; +using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity @@ -11,7 +22,14 @@ namespace CalamityMod.Items.Accessories.Vanity public class XyksBlessingBlue : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - + int itemFrame = 0; + int itemFrameTimer = 1; + int pulseTimer = 0; + public static Vector2 extraPosition = Vector2.Zero; + public static Color baseEffectColor = new Color(150, 255, 210); // Teal-ish Glow + public static Color animEffectColor = new Color(255, 85, 252); // Purple Flash + public static Color baseMainColor = new Color(25, 118, 218); // Mid Blue + public static Color baseAccentColor = new Color(0, 255, 250); // Light blue public override (EquipType, string, string)[] EquipSlots => [ (EquipType.Head, "Xyk", null), @@ -19,11 +37,104 @@ namespace CalamityMod.Items.Accessories.Vanity (EquipType.Legs, "Xyk", null), (EquipType.Wings, null, null), //results in setting this equip slot to -1 ]; + public static Asset Texture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingBlueAnim"); + public static Asset AltTexture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingBlueAnim2"); + public static Asset ShapeTexture = ModContent.Request("CalamityMod/Particles/BloomRing"); + public static Asset BloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + bool NoArmorEnabled = false; + bool DoTransformAnimation = false; + float effectsMult = 1; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", NoArmorEnabled ? this.GetLocalizedValue("ArmorDisabled") : this.GetLocalizedValue("ArmorEnabled")); + } + public override bool ConsumeItem(Player player) => !Main.keyState.PressingShift(); + public override void SaveData(TagCompound tag) + { + tag.Add("noArmor", NoArmorEnabled); + tag.Add("doAnim", DoTransformAnimation); + } + public override void LoadData(TagCompound tag) + { + NoArmorEnabled = tag.GetBool("noArmor"); + DoTransformAnimation = tag.GetBool("doAnim"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(NoArmorEnabled); + writer.Write(DoTransformAnimation); + } + public override void NetReceive(BinaryReader reader) + { + NoArmorEnabled = reader.ReadBoolean(); + DoTransformAnimation = reader.ReadBoolean(); + } + public Rectangle GetFrame() + { + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + int vertialFramesNum = DoTransformAnimation ? 13 : 20; + Rectangle frame = texture.Frame(verticalFrames: vertialFramesNum, frameY: itemFrame); + return frame; + } + public void DrawItem(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, float scale, float rotation, bool inWorld) + { + itemFrameTimer++; + if (itemFrameTimer % 5 == 0) + itemFrame++; + + effectsMult = MathHelper.Lerp(effectsMult, 1, 0.1f); + Color effectColor = Color.Lerp(baseAccentColor, animEffectColor, Math.Max(effectsMult - 1, 0)); + + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 5); + extraPosition = new Vector2(0, 5 * (inWorld ? 1 : 0.2f) * sine); + Vector2 animPlaceAdjust = Vector2.UnitY * (DoTransformAnimation ? 2.8f : 0); + + float pulseProgress = MathF.Pow(Utils.GetLerpValue(90, 0, pulseTimer % 90), 3.5f); + + if (itemFrame >= (DoTransformAnimation ? 13 : 20)) + { + itemFrame = (DoTransformAnimation ? 8 : 0); + if (DoTransformAnimation) { DoTransformAnimation = false; Item.NetStateChanged(); } + } + //Pulse + Texture2D pulse = ShapeTexture.Value; + spriteBatch.Draw(pulse, position + extraPosition, null, Color.Lerp(effectColor, baseEffectColor, pulseProgress) with { A = 0 } * pulseProgress, rotation, pulse.Size() / 2, scale * (1 - pulseProgress) * effectsMult, SpriteEffects.None, 0f); + + Texture2D bloom = BloomTexture.Value; + Vector2 squash = new Vector2(1 + Math.Max(effectsMult - 1, 0) * 3.5f, 0.85f - Math.Max(effectsMult - 1, 0) * 0.75f); + float bloomScale = 0.75f; + // Bloom effects + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, new Vector2(1, 0.85f) * (scale + 0.05f * sine) * bloomScale, SpriteEffects.None, 0f); + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, squash * (scale + 0.05f * sine) * 0.9f * bloomScale, SpriteEffects.None, 0f); + // Sprite + spriteBatch.Draw(texture, position + extraPosition + animPlaceAdjust, frame, (inWorld ? Lighting.GetColor((Item.Center + extraPosition + animPlaceAdjust).ToTileCoordinates()) : Color.White), 0f, frame.Size() / 2, scale, SpriteEffects.None, 0f); + pulseTimer++; + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + frame = GetFrame(); + DrawItem(spriteBatch, position, frame, scale * 1.5f, 0, false); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle itemFrame = GetFrame(); + Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, (itemFrame.Size() / 2).Y); + DrawItem(spriteBatch, drawPosition, itemFrame, scale * 0.5f, rotation, true); + return false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3); + Color clr = Color.Lerp(baseEffectColor, baseMainColor, Utils.GetLerpValue(-1, 1, sine)); + Lighting.AddLight(Item.Center + extraPosition, clr.ToVector3() * 0.55f); + } public override void SetDefaults() { - Item.width = 36; - Item.height = 34; + Item.width = 30; + Item.height = 25; Item.accessory = true; Item.vanity = true; Item.rare = ModContent.RarityType(); @@ -33,23 +144,43 @@ namespace CalamityMod.Items.Accessories.Vanity public override bool CanRightClick() => true; public override void RightClick(Player player) { - player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); + if (Main.keyState.PressingShift()) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/StarfleetFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) + 0.9f * i, MaxInstances = 6 }, player.Center); + + effectsMult = 2; + pulseTimer = 20; + itemFrameTimer = 1; + itemFrame = 0; + NoArmorEnabled = !NoArmorEnabled; + DoTransformAnimation = true; + Item.NetStateChanged(); + } + else + player.PutItemInInventoryFromItemUsage(ModContent.ItemType()); } + public override Func ShouldTransform => ((player) => !NoArmorEnabled); public override void UpdateVanity(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsBlue = true; + EquipEffects(player); } - public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsBlue = true; + EquipEffects(player); } } - + public void EquipEffects(Player player) + { + player.DisableWingFlapSound(); + if (NoArmorEnabled) + IsForced = false; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsBlue = true; + } // Also research the other variant public override void OnResearched(bool fullyResearched) { diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.png b/Items/Accessories/Vanity/XyksBlessingBlue.png index de950cbaa1..1ee0bc2ffb 100644 Binary files a/Items/Accessories/Vanity/XyksBlessingBlue.png and b/Items/Accessories/Vanity/XyksBlessingBlue.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlueAnim.png b/Items/Accessories/Vanity/XyksBlessingBlueAnim.png new file mode 100644 index 0000000000..b1931d456b Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingBlueAnim.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png b/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png new file mode 100644 index 0000000000..f62e4bba41 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 940278db9e..fb3a71a78d 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -1,9 +1,17 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.NetModules; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity @@ -11,7 +19,14 @@ namespace CalamityMod.Items.Accessories.Vanity public class XyksBlessingOrange : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - + int itemFrame = 0; + int itemFrameTimer = 1; + int pulseTimer = 0; + public static Vector2 extraPosition = Vector2.Zero; + public static Color baseEffectColor = new Color(255, 153, 153); // Red-ish Glow + public static Color animEffectColor = new Color(255, 105, 85); // Crimson Flash + public static Color baseMainColor = new Color(239, 117, 34); // Mid Orange + public static Color baseAccentColor = new Color(251, 242, 54); // Light Orange/Yellow public override (EquipType, string, string)[] EquipSlots => [ (EquipType.Head, "Xyk2", null), @@ -19,11 +34,104 @@ namespace CalamityMod.Items.Accessories.Vanity (EquipType.Legs, "Xyk2", null), (EquipType.Wings, null, null), //results in setting this equip slot to -1 ]; + public static Asset Texture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingOrangeAnim"); + public static Asset AltTexture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingOrangeAnim2"); + public static Asset ShapeTexture = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick"); + public static Asset BloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + bool NoArmorEnabled = false; + bool DoTransformAnimation = false; + float effectsMult = 1; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", NoArmorEnabled ? this.GetLocalizedValue("ArmorDisabled") : this.GetLocalizedValue("ArmorEnabled")); + } + public override bool ConsumeItem(Player player) => !Main.keyState.PressingShift(); + public override void SaveData(TagCompound tag) + { + tag.Add("noArmor", NoArmorEnabled); + tag.Add("doAnim", DoTransformAnimation); + } + public override void LoadData(TagCompound tag) + { + NoArmorEnabled = tag.GetBool("noArmor"); + DoTransformAnimation = tag.GetBool("doAnim"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(NoArmorEnabled); + writer.Write(DoTransformAnimation); + } + public override void NetReceive(BinaryReader reader) + { + NoArmorEnabled = reader.ReadBoolean(); + DoTransformAnimation = reader.ReadBoolean(); + } + public Rectangle GetFrame() + { + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + int vertialFramesNum = DoTransformAnimation ? 13 : 20; + Rectangle frame = texture.Frame(verticalFrames: vertialFramesNum, frameY: itemFrame); + return frame; + } + public void DrawItem(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, float scale, float rotation, bool inWorld) + { + itemFrameTimer++; + if (itemFrameTimer % 5 == 0) + itemFrame++; + + effectsMult = MathHelper.Lerp(effectsMult, 1, 0.1f); + Color effectColor = Color.Lerp(baseAccentColor, animEffectColor, Math.Max(effectsMult - 1, 0)); + + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 5); + extraPosition = new Vector2(0, 5 * (inWorld ? 1 : 0.2f) * sine); + Vector2 animPlaceAdjust = Vector2.UnitY * (DoTransformAnimation ? 2.8f : 0); + + float pulseProgress = MathF.Pow(Utils.GetLerpValue(90, 0, pulseTimer % 90), 3.5f); + + if (itemFrame >= (DoTransformAnimation ? 13 : 20)) + { + itemFrame = (DoTransformAnimation ? 8 : 0); + if (DoTransformAnimation) { DoTransformAnimation = false; Item.NetStateChanged(); } + } + //Pulse + Texture2D pulse = ShapeTexture.Value; + spriteBatch.Draw(pulse, position + extraPosition, null, Color.Lerp(effectColor, baseEffectColor, pulseProgress) with { A = 0 } * pulseProgress, rotation + MathHelper.PiOver4, pulse.Size() / 2, scale * (1 - pulseProgress) * effectsMult * 0.65f, SpriteEffects.None, 0f); + + Texture2D bloom = BloomTexture.Value; + Vector2 squash = new Vector2(1 + Math.Max(effectsMult - 1, 0) * 3.5f, 0.85f - Math.Max(effectsMult - 1, 0) * 0.75f); + float bloomScale = 0.75f; + // Bloom effects + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, new Vector2(1, 0.85f) * (scale + 0.05f * sine) * bloomScale, SpriteEffects.None, 0f); + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, squash * (scale + 0.05f * sine) * 0.9f * bloomScale, SpriteEffects.None, 0f); + // Sprite + spriteBatch.Draw(texture, position + extraPosition + animPlaceAdjust, frame, (inWorld ? Lighting.GetColor((Item.Center + extraPosition + animPlaceAdjust).ToTileCoordinates()) : Color.White), 0f, frame.Size() / 2, scale, SpriteEffects.None, 0f); + pulseTimer++; + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + frame = GetFrame(); + DrawItem(spriteBatch, position, frame, scale * 1.5f, 0, false); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle itemFrame = GetFrame(); + Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, (itemFrame.Size() / 2).Y); + DrawItem(spriteBatch, drawPosition, itemFrame, scale * 0.5f, rotation, true); + return false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3); + Color clr = Color.Lerp(baseEffectColor, baseMainColor, Utils.GetLerpValue(-1, 1, sine)); + Lighting.AddLight(Item.Center + extraPosition, clr.ToVector3() * 0.55f); + } public override void SetDefaults() { - Item.width = 36; - Item.height = 34; + Item.width = 30; + Item.height = 25; Item.accessory = true; Item.vanity = true; Item.rare = ModContent.RarityType(); @@ -33,23 +141,44 @@ namespace CalamityMod.Items.Accessories.Vanity public override bool CanRightClick() => true; public override void RightClick(Player player) { - player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); + if (Main.keyState.PressingShift()) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/StarfleetFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) + 0.9f * i, MaxInstances = 6 }, player.Center); + + effectsMult = 2; + pulseTimer = 20; + itemFrameTimer = 1; + itemFrame = 0; + NoArmorEnabled = !NoArmorEnabled; + DoTransformAnimation = true; + Item.NetStateChanged(); + } + else + player.PutItemInInventoryFromItemUsage(ModContent.ItemType()); + } + public override Func ShouldTransform => ((player) => !NoArmorEnabled); public override void UpdateVanity(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsOrange = true; + EquipEffects(player); } - public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsOrange = true; + EquipEffects(player); } } - + public void EquipEffects(Player player) + { + player.DisableWingFlapSound(); + if (NoArmorEnabled) + IsForced = false; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsOrange = true; + } // Also research the other variant public override void OnResearched(bool fullyResearched) { diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.png b/Items/Accessories/Vanity/XyksBlessingOrange.png index 34e567b436..03504a8213 100644 Binary files a/Items/Accessories/Vanity/XyksBlessingOrange.png and b/Items/Accessories/Vanity/XyksBlessingOrange.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png b/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png new file mode 100644 index 0000000000..59a9ef12c0 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png b/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png new file mode 100644 index 0000000000..2800fb1b86 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png differ 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/ScoriaBobber.cs b/Items/Accessories/VolcanicSinker.cs similarity index 89% rename from Items/Accessories/ScoriaBobber.cs rename to Items/Accessories/VolcanicSinker.cs index 7ad5e649d2..6843821e45 100644 --- a/Items/Accessories/ScoriaBobber.cs +++ b/Items/Accessories/VolcanicSinker.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - internal class ScoriaBobber : ModItem, ILocalizedModType + [LegacyName("ScoriaBobber")] + internal class VolcanicSinker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override string Texture => "CalamityMod/Projectiles/Typeless/RiftReelerBobber"; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories { player.accFishingBobber = true; player.accLavaFishing = true; - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.ScoriaBobber; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VolcanicSinker; } public override void AddRecipes() { 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/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 015f195b2d..2c7bd99117 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(14). + AddIngredient(14). AddIngredient(ItemID.LunarBar, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/Wings/MoonWalkers.cs b/Items/Accessories/Wings/MoonWalkers.cs index 7915738b80..659f71464f 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() diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index cd56fbaa3f..427b82779d 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 5). 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/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/ScrapBobber.cs b/Items/Accessories/WulfrumBobber.cs similarity index 88% rename from Items/Accessories/ScrapBobber.cs rename to Items/Accessories/WulfrumBobber.cs index 81a7444885..1a6ee66728 100644 --- a/Items/Accessories/ScrapBobber.cs +++ b/Items/Accessories/WulfrumBobber.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - internal class ScrapBobber : ModItem, ILocalizedModType + [LegacyName("ScrapBobber")] + internal class WulfrumBobber : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override string Texture => "CalamityMod/Projectiles/Typeless/WulfrumBobber"; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.ScrapBobber; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumBobber; } public override void AddRecipes() { diff --git a/Items/Ammo/CinderArrow.cs b/Items/Ammo/CinderArrow.cs index e9ced9fd6d..1d647a03d4 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; } diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index 52dcc7ba58..c5533bdfe1 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; } diff --git a/Items/Ammo/HailstormBullet.cs b/Items/Ammo/HailstormBullet.cs index 664f50c928..db811b79bc 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,6 +13,7 @@ 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() 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/HolyFireBullet.png b/Items/Ammo/HolyFireBullet.png index ade0ab6783..5c7ff644ff 100644 Binary files a/Items/Ammo/HolyFireBullet.png and b/Items/Ammo/HolyFireBullet.png differ 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/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 97e9ae7fbd..46b8982385 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(15). AddIngredient(ItemID.Feather, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Aerospec/AerospecHeadMagic.cs b/Items/Armor/Aerospec/AerospecHeadMagic.cs index 5dda2d7b17..19435bdd7d 100644 --- a/Items/Armor/Aerospec/AerospecHeadMagic.cs +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Aerospec { public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public static int MaxManaBoost = 30; + public static int MaxManaBoost = 40; public static float MagicDamageBoost = 0.1f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent()); @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). 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..b57eada540 100644 --- a/Items/Armor/Aerospec/AerospecHeadMelee.cs +++ b/Items/Armor/Aerospec/AerospecHeadMelee.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). 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..39ea869177 100644 --- a/Items/Armor/Aerospec/AerospecHeadRanged.cs +++ b/Items/Armor/Aerospec/AerospecHeadRanged.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). 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..de0f62a21d 100644 --- a/Items/Armor/Aerospec/AerospecHeadRogue.cs +++ b/Items/Armor/Aerospec/AerospecHeadRogue.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). 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..f7d31c08be 100644 --- a/Items/Armor/Aerospec/AerospecHeadSummon.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). 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..202f00ed8f 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(10). AddIngredient(ItemID.Feather, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Auric/AuricTeslaHeadMelee.cs b/Items/Armor/Auric/AuricTeslaHeadMelee.cs index feb38df486..c28da3d700 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)) diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index fd2394ccd7..1b29e447df 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index b93e9b2d92..188e83ea26 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index 09107dbbf4..e5e8e4b668 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index b52bf0a10a..0eadffe839 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 495458d722..2007d1a7df 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index ec516460a0..2b2026327c 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 0d45fae2e7..34b19ad388 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 997c216a6f..297a2e4bd0 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; diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 4d16ffe959..0e0afa9361 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). + AddIngredient(20). AddIngredient(ItemID.LunarBar, 16). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index ff7916ea14..54044dfcdd 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.LunarBar, 12). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 08759c2a23..8c9505f16a 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(10). AddIngredient(ItemID.LunarBar, 8). AddTile(TileID.LunarCraftingStation). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index f6da56b0e4..0eced74d3f 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; diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 395471447f..a8e33fe18f 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -74,6 +74,7 @@ namespace CalamityMod.Items.Armor.Fearmonger ModContent.BuffType(), BuffID.Chilled, BuffID.Frozen, + ModContent.BuffType(), }; for (var i = 0; i < immuneDebuffs.Length; ++i) player.buffImmune[immuneDebuffs[i]] = true; diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index b4e1b3c222..6f36d82ac4 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent(), RogueVelocityBoost.ToPercent()); // Set Bonus - public static float SetBonusRogueStealth = 0.4f; + public static float SetBonusRogueStealth = 1.05f; public static int TagDuration = CalamityUtils.SecondsToFrames(10); public static int StormManaCost = 60; public static int StormCooldown = 45; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor { //These tag damage fields determine the damage of the spawned eater. The resulting number from each is added together //So, 0.5 multiplicative and 10 flat would make the damage be 50% of the spawning hit's damage, plus 10 more. - //If you want entirely flt, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. + //If you want entirely flat, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. MultiplicativeTagDamage = 0.25f, FlatTagDamage = 5, AllowsWhipStacking = true, @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Armor if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(),summonTag); } public override void SetDefaults() diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 4e5af57b08..0470808230 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GemTech @@ -25,7 +26,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe() .AddIngredient(16) - .AddIngredient(5) + .AddIngredient(ItemID.FragmentSolar, 5) + .AddIngredient(ItemID.FragmentVortex, 5) + .AddIngredient(ItemID.FragmentNebula, 5) + .AddIngredient(ItemID.FragmentStardust, 5) + .AddIngredient(5) .AddIngredient(2) .AddTile() .Register(); diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index cc96471327..af3aecac6d 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -150,7 +151,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe(). AddIngredient(10). - AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(ItemID.FragmentVortex, 5). + AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(ItemID.FragmentStardust, 5). + AddIngredient(5). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index 84ba7d24ea..178c1cade7 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GemTech @@ -26,7 +27,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe(). AddIngredient(12). - AddIngredient(4). + AddIngredient(ItemID.FragmentSolar, 4). + AddIngredient(ItemID.FragmentVortex, 4). + AddIngredient(ItemID.FragmentNebula, 4). + AddIngredient(ItemID.FragmentStardust, 4). + AddIngredient(4). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index 5230c288c0..cefd8ea258 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -12,16 +12,16 @@ namespace CalamityMod.Items.Armor.GodSlayer { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; - public static float DamageBoost = 0.15f; - public static int CritBoost = 11; + public static float DamageBoost => 0.15f; + public static int CritBoost => 11; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); // Common Set Bonus - public static int DashCooldown = CalamityUtils.SecondsToFrames(45); - public static int DashDamage = 3000; - public static float DashKnockback = 15f; - public static int DashIFrames = 12; - public static int DashGodSlayerInfernoDuration = CalamityUtils.SecondsToFrames(5); + public static int DashCooldown => CalamityUtils.SecondsToFrames(45); + public static int DashDamage => 3000; + public static float DashKnockback => 15f; + public static int DashIFrames => 12; + public static int DashGodSlayerInfernoDuration => CalamityUtils.SecondsToFrames(5); public override void SetDefaults() { diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index b43f8bf6f0..fd3e644a0b 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; diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index 6e4f64d76f..b35d5bc00d 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 1eb312a365..c6961124b2 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index dad4af3e81..eafe23a27c 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 4aaa9d6e2c..e772532f66 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index c64bfd93f5..c906206ff5 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index a13dce4e57..86ad6eba9f 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -76,7 +76,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 2dcac69f9c..f896863d03 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 4eb7dc362e..83f1874634 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 28; + Item.defense = 20; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 7e881b56ac..beb164e68f 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 19; + Item.defense = 15; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 60637a499a..d0d6e96c73 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 22; + Item.defense = 15; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index f44835ab63..991ad6b50e 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 26598da235..307e36a692 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index ec0e3a7efd..613eb37fb2 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -59,7 +59,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 8d84aede61..6ab102d56c 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 90cba4743e..60d307b21b 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index c89fd173f6..8da8e24312 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; diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index f6c99987d2..2655e42ecf 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; diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index 980989d6c0..2ead3f7278 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; diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index 747b2bb836..65d8ee98d7 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; diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index 758ec5d5ba..508f21ec18 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); 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 9c7c4f70b3..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 = 2; - - 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 4049099c85..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 = 2; - public static float RunAccelerationMult = 1.75f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), RunAccelerationMult.Round()); - - // Set Bonus - public static int BarrierCooldown = CalamityUtils.SecondsToFrames(8); - public static int BarrierDefenseBoost = 6; - public static float BarrierDamageAbsorptionPercent = 0.1f; - public static int BarrierFramesPerHeal = 15; - 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 5618cd3570..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 = 9f; // 46 mph - public static float SubmergedBurrowSpeed = 12f; // 61 mph - public static float BaseAcceleration = 0.4f; // For reference, base player running acceleration is 0.08 - public static int BurrowDuration = CalamityUtils.SecondsToFrames(7); - 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/BleachedPowder.png b/Items/BleachedPowder.png deleted file mode 100644 index 46d1bb49eb..0000000000 Binary files a/Items/BleachedPowder.png and /dev/null differ diff --git a/Items/BloodBroccoli.png b/Items/BloodBroccoli.png deleted file mode 100644 index 2bc47a0418..0000000000 Binary files a/Items/BloodBroccoli.png and /dev/null differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 5f20ad405b..f2425587c1 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Balancing; +using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; @@ -328,9 +329,6 @@ namespace CalamityMod.Items if (modPlayer.gloveOfRecklessness) velocity = velocity.RotatedByRandom(MathHelper.ToRadians(12f)); } - - if (modPlayer.eArtifact && item.CountsAsClass()) - velocity *= 1.25f; } public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) @@ -481,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; } @@ -616,7 +629,7 @@ namespace CalamityMod.Items } //Mana Potion interactions - if (item.healMana > 0) + if (item.healMana > 0 || player.HasBuff(ModContent.BuffType())) { //If mana potion used, kill all active Crown projectiles if ((modPlayer.moonCrown || modPlayer.featherCrown) && modPlayer.mageCrownCount > 0) @@ -720,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)) { @@ -886,8 +895,10 @@ namespace CalamityMod.Items // This assume all items with a damage hit is a weapon. There appears to be no edge cases for this thus far if (player.Calamity().oldFashioned) modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; - if (player.Calamity().ivDrip) - modifiers.SourceDamage *= IVDripOnTheRocks.DamageReductionMultiplier; + + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned)) + modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; } public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -938,7 +949,9 @@ namespace CalamityMod.Items { // Xyk 3MARCH2026: Doesn't work on any non use style 1 items currently, Doze will fix it if (item.CountsAsClass() && player.HasBuff(BuffID.Tipsy)) - scale += 0.15f; + scale += 0.25f; + if (item.CountsAsClass() && (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake))) + scale += 0.25f; } public override void UpdateArmorSet(Player player, string set) { @@ -1088,18 +1101,18 @@ namespace CalamityMod.Items modPlayer.fairyBoots = true; // Mana Flower tinker buffs - if (item.type == ItemID.MagnetFlower) - player.manaCost -= 0.02f; - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) - player.manaCost -= 0.04f; if (item.type == ItemID.ArcaneFlower) player.GetDamage() += 0.05f; - if (item.type == ItemID.EyeoftheGolem) { player.Calamity().critDamage += 0.15f; } + if (item.type == ItemID.ReconScope) + { + player.GetDamage() += 0.05f; //Total 15% damage + player.GetCritChance() -= 5; //Total 5% crit + } if (item.type == ItemID.SniperScope) { player.GetDamage() -= 0.1f; //Total 0% damage @@ -1116,32 +1129,7 @@ namespace CalamityMod.Items modPlayer.magmaStoneVisuals = !hideVisual; // hides the fire dust when hiding the accessory } - // 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; @@ -1153,16 +1141,12 @@ namespace CalamityMod.Items if (modPlayer.gloveLevel < 1) modPlayer.gloveLevel = 1; } - if (item.type == ItemID.PowerGlove) + if (item.type == ItemID.PowerGlove || item.type == ItemID.BerserkerGlove) { - player.GetAttackSpeed() -= 0.12f; // Power Glove 10% + player.GetAttackSpeed() -= 0.12f; // Power/Berserker Glove 12% if (modPlayer.gloveLevel < 2) modPlayer.gloveLevel = 2; } - if (item.type == ItemID.BerserkerGlove) - { - player.GetAttackSpeed() -= 0.12f; // Berserker Glove 0% - } if (item.type == ItemID.MechanicalGlove) { player.GetAttackSpeed() -= 0.12f; // Mechanical Glove 12% @@ -1198,6 +1182,7 @@ namespace CalamityMod.Items if (item.type == ItemID.GravityGlobe) { + player.noFallDmg = true; player.GetJumpState().Enable(); if (player.Calamity().justChangedGravity) { @@ -1335,8 +1320,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]) @@ -1436,8 +1419,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (CalamityItemSets.ItemForcedInsideWorld[item.type]) - CalamityUtils.ForceItemIntoWorld(item); + CalamityUtils.ForceItemIntoWorld(item); } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index ad3ed2a996..55823811b7 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Items int standardTooltipCount = 0; for (int i = 0; i < tooltips.Count; i++) { - if (tooltips[i].Name.StartsWith("Tooltip")) + if (tooltips[i]?.Name?.StartsWith("Tooltip") == true) { if (firstTooltipIndex == -1) firstTooltipIndex = i; @@ -169,11 +169,16 @@ 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)) { - tooltips.Insert(tooltips.FindIndex(0, (x) => x.Name == "Knockback") + 1, new(Mod, "Minions", CalamityUtils.GetText(ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 ? "Common.MinionSlotCost" : "Common.MinionSlotCostSingle").Format(ItemID.Sets.StaffMinionSlotsRequired[item.type]))); + float cost = ItemID.Sets.StaffMinionSlotsRequired[item.type]; + if (item.type == ModContent.ItemType() && Main.LocalPlayer.Calamity().fadedIdolatry) + cost--; + tooltips.Insert(tooltips.FindIndex(0, (x) => x.Name == "Knockback") + 1, new(Mod, "Minions", CalamityUtils.GetText(cost > 1 ? "Common.MinionSlotCost" : "Common.MinionSlotCostSingle").Format(cost))); } @@ -319,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; @@ -523,12 +544,8 @@ namespace CalamityMod.Items string MultTagTooltip(float mult) => (CalamityUtils.GetText($"Common.SummonTagDamageMult").Format((mult + 1).ToString("0.##"))); string CritTagTooltip(float crit) => (CalamityUtils.GetText($"Common.SummonTagCrit").Format((crit * 100).ToString("0.#"))); - Dictionary TagByItem = new(); - foreach (SummonTag tag1 in CalamityBuffSets.SummonTagDebuff.Values) - { - if (tag1.TagItem > -1) TagByItem.Add(tag1.TagItem, tag1); - } - if (TagByItem.TryGetValue(item.type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff.FirstOrDefault(x => x is not null && x.TagItem == item.type && x.AutoDrawTooltip, null); + if (tag is not null) { if (!tag.AutoDrawTooltip) return; var modPlayer = Main.LocalPlayer.Calamity(); @@ -661,7 +678,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) @@ -732,7 +749,7 @@ namespace CalamityMod.Items } #endregion - // Whip tag is dynamically generated for all whips based on the SummonTagDebuffDict, so we'll remove the vanilla tag tootlips. + // Whip tag is dynamically generated for all whips based on the SummonTagDebuff dictionary, so we'll remove the vanilla tag tootlips. #region Whip Tag removal // Additive tag changes if (item.type == ItemID.BlandWhip) @@ -782,11 +799,14 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text += AddedTooltip("TitanGloveLine")); if (item.type == ItemID.PowerGlove) { - EditTooltipByNum(1, (line) => line.Text = EditedTooltip("PowerGlove")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("PowerBerserkerGlove")); EditTooltipByNum(0, (line) => line.Text += AddedTooltip("TitanGloveLine")); } if (item.type == ItemID.BerserkerGlove) - EditTooltipByNum(1, (line) => line.Text = EditedTooltip("BerserkerGlove")); + { + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("PowerBerserkerGlove")); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("TitanGloveLine")); + } if (item.type == ItemID.MechanicalGlove) EditTooltipByNum(1, (line) => line.Text = EditedTooltip("MechanicalGlove") + AddedTooltip("TitanGloveLine")); if (item.type == ItemID.FireGauntlet) @@ -814,7 +834,11 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = EditedTooltip("RifleScope2")); } if (item.type == ItemID.ReconScope) + { EditTooltipByNum(0, (line) => line.Text += AddedTooltip("RifleScope")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("ReconScope1")); + EditTooltipByNum(1, (line) => line.Text += AddedTooltip("ReconScope2")); + } if (item.type == ItemID.SniperScope) { EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SniperScope")); @@ -823,10 +847,6 @@ namespace CalamityMod.Items } // Mana Flower tinker buffs. - if (item.type == ItemID.MagnetFlower) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("8%", "10%")); - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("8%", "12%")); if (item.type == ItemID.ArcaneFlower) EditTooltipByNum(2, (line) => line.Text += AddedTooltip("ArcaneFlower")); @@ -933,18 +953,6 @@ namespace CalamityMod.Items #endregion #region Hardmode Armor - // Cobalt - if (item.type == ItemID.CobaltHat) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", $"{CobaltArmorSetChange.MaxManaBoost + 40}")); - - // Mythril - if (item.type == ItemID.MythrilHood) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("60", $"{MythrilArmorSetChange.MaxManaBoost + 60}")); - - // Adamantite - if (item.type == ItemID.AdamantiteHeadgear) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("80", $"{AdamantiteArmorSetChange.MaxManaBoost + 80}")); - // Titanium if (item.type == ItemID.TitaniumMask) EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9%", "14%")); @@ -1084,7 +1092,7 @@ namespace CalamityMod.Items if (item.type == ItemID.HiveFive) AddYoyoStats(24f, 320f, 20f); if (item.type == ItemID.JungleYoyo) - AddYoyoStats(20f, 288f, 17f); + AddYoyoStats(24f, 320f, 20f); if (item.type == ItemID.Kraken) AddYoyoStats(-1f, 480f, 54f); if (item.type == ItemID.Rally) @@ -1507,6 +1515,18 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { + if (line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects && line.Name == "Damage") + { + string fakeLine = line.Text.Replace(" " + RogueDamageClass.Instance.DisplayName.ToString(), DamageClass.Ranged.DisplayName.ToString()); + float fade = Utils.GetLerpValue(18, 120, Main.LocalPlayer.Calamity().elephantKillerJoke, true); + + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, fakeLine, new Vector2(line.X, line.Y), line.Color * (1 - fade), line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, new Vector2(line.X, line.Y), line.Color * fade, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects) { Color rarityColor = Color.White; @@ -1515,17 +1535,15 @@ namespace CalamityMod.Items float rate = Main.GlobalTimeWrappedHourly * 6; List eColors = new List() { - Color.DodgerBlue, - Color.Cyan, - Color.RoyalBlue + XyksBlessingBlue.baseMainColor, + XyksBlessingBlue.baseAccentColor, }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); Vector2 backScale = line.BaseScale; - Color backColor = usedColor; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); @@ -1533,19 +1551,19 @@ namespace CalamityMod.Items int draws = 20; for (int i = 0; i < draws; i++) { + float clrProgress = Utils.GetLerpValue(0, draws - 1, i, true); Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress), line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); } Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D square = ModContent.Request("CalamityMod/Particles/BloomRing").Value; Vector2 drawPosition = basePosition; - Color drawColor = backColor; Vector2 rotationPoint = texture.Size() * 0.5f; int length = line.Text.Length; for (int i = 0; i < 8; i++) { - Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, usedColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); } for (int i = 0; i < 10; i++) { @@ -1554,10 +1572,11 @@ namespace CalamityMod.Items float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10); + float clrProgress = Utils.GetLerpValue(0, 9, i, true); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress) * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress) * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); } Main.spriteBatch.End(); @@ -1576,38 +1595,35 @@ namespace CalamityMod.Items float rate = Main.GlobalTimeWrappedHourly * 6; List eColors = new List() { - new Color(248, 117, 52), - Color.Gold, - Color.Orange + XyksBlessingOrange.baseMainColor, + XyksBlessingOrange.baseAccentColor, }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); Vector2 backScale = line.BaseScale; - Color backColor = usedColor; - Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); int draws = 20; for (int i = 0; i < draws; i++) { + float clrProgress = Utils.GetLerpValue(0, draws - 1, i, true); Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress), line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); } Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D texture2 = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; Vector2 drawPosition = basePosition; - Color drawColor = backColor; Vector2 rotationPoint = texture.Size() * 0.5f; int length = line.Text.Length; for (int i = 0; i < 8; i++) { - Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, usedColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); } for (int i = 0; i < 10; i++) { @@ -1615,10 +1631,11 @@ namespace CalamityMod.Items float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10); + float clrProgress = Utils.GetLerpValue(0, 9, i, true); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress) * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress) * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); } Main.spriteBatch.End(); diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index d51e357e31..9ed8e64673 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -41,45 +41,43 @@ namespace CalamityMod.Items currentTweaks = new SortedDictionary { #region CATEGORY 1: Weapon Balancing - { ItemID.AdamantiteGlaive, Do(TrueMelee, DamageExact(69), UseExact(7), ShootSpeedExact(18f)) }, // VANILLA: 49 DMG, 25 UT, 5 VEL + { ItemID.AdamantiteGlaive, Do(TrueMelee, DamageExact(66), UseExact(7), ShootSpeedExact(18f)) }, // VANILLA: 49 DMG, 25 UT, 5 VEL { ItemID.AdamantiteRepeater, Do(UseExact(14)) }, // VANILLA: 18 UT - { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(75), UseExact(7)) }, // VANILLA: 61 DMG, 21 UT - { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(15)) }, // VANILLA: 28 UT/UA, 0 RUD + { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(72), UseExact(7)) }, // VANILLA: 61 DMG, 21 UT + { ItemID.AmberStaff, Do(UseTimeExact(18), UseAnimationExact(36), ReuseDelayExact(15)) }, // VANILLA: 28 UT/UA, 0 RUD { ItemID.AmethystStaff, Do(ManaExact(2)) }, // VANILLA: 5 MANA - { ItemID.Anchor, Do(DamageExact(107), UseExact(30)) }, // VANILLA: 70 DMG, 20 UT + { ItemID.Anchor, Do(DamageExact(107)) }, // VANILLA: 70 DMG { ItemID.AntlionClaw, Do(UseExact(10)) }, // Mandible Blade. VANILLA: 18 UT { ItemID.AquaScepter, Do(DamageRatio(0.9f)) }, // VANILLA: 27 DMG. Uses ratios due to remix seed - { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, // VANILLA: 45 DMG, 11 UT + { ItemID.Bananarang, Do(DamageExact(60)) }, // VANILLA: 45 DMG { ItemID.BatScepter, Do(DamageExact(50)) }, // VANILLA: 45 DMG { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(131), UseAnimationExact(40), KnockbackExact(8)) }, // VANILLA: 52 DMG, 20 UT, 6.5 KB - { ItemID.BeeGun, Do(DamageExact(11), ManaExact(4)) }, // VANILLA: 9 DMG, 5 MANA - { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, // VANILLA: 30 DMG - { ItemID.Beenade, Do(DamageExact(11), UseTimeExact(22), ShootSpeedExact(10f)) }, // VANILLA: 12 DMG, 15 UT, 6 VEL - { ItemID.BeesKnees, Do(DamageExact(21), UseExact(38)) }, // VANILLA: 23 DMG, 23 UT + { ItemID.BeeGun, Do(DamageExact(11)) }, // VANILLA: 9 DMG + { ItemID.Beenade, Do(UseTimeExact(22), ShootSpeedExact(10f)) }, // VANILLA: 15 UT, 6 VEL + { ItemID.BeesKnees, Do(DamageExact(21), UseExact(35)) }, // VANILLA: 23 DMG, 23 UT { ItemID.Bladetongue, Do(UseTurn, DamageExact(120), UseExact(22)) }, // VANILLA: 55 DMG, 28 UT - { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, // VANILLA: 58 DMG, 9 MANA + { ItemID.BlizzardStaff, Do(DamageExact(41)) }, // VANILLA: 58 DMG { ItemID.BloodyMachete, Do(DamageExact(24)) }, // VANILLA: 20 DMG { ItemID.Blowgun, Do(DamageExact(40), ShootSpeedExact(15f)) }, // VANILLA: 27 DMG, 13 VEL { ItemID.BluePhaseblade, phaseblade }, { ItemID.BluePhasesaber, phasesaber }, { ItemID.BoneSword, Do(UseTurn, DamageExact(25)) }, // VANILLA: 19 DMG - { ItemID.BookofSkulls, Do(DamageExact(27), ManaExact(13), ShootSpeedExact(5.5f)) }, // VANILLA: 29 DMG, 18 MANA, 3.5 VEL - { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom. VANILLA: 20 MANA + { ItemID.BookofSkulls, Do(ShootSpeedExact(5.5f)) }, // VANILLA: 3.5 VEL { ItemID.Boomstick, Do(DamageExact(11)) }, // VANILLA: 14 DMG - { ItemID.BreakerBlade, Do(UseTurn, DamageExact(140)) }, // VANILLA: 70 DMG - { ItemID.CandyCornRifle, Do(DamageExact(66)) }, // VANILLA: 44 DMG + { ItemID.BreakerBlade, Do(UseTurn, DamageExact(160)) }, // VANILLA: 70 DMG + { ItemID.CandyCornRifle, Do(DamageExact(80)) }, // VANILLA: 44 DMG { ItemID.Cascade, Do(DamageExact(31)) }, // VANILLA: 27 DMG - { ItemID.ChainGuillotines, Do(DamageExact(100)) }, // VANILLA: 59 DMG + { ItemID.ChainGuillotines, Do(DamageExact(75)) }, // VANILLA: 59 DMG { ItemID.ChainGun, Do(DamageExact(35)) }, // VANILLA: 31 DMG { ItemID.ChainKnife, Do(DamageRatio(1.34f)) }, // VANILLA: 12 DMG. Uses ratios due to remix seed { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed, DamageExact(180), UseExact(45), ShootSpeedExact(22f)) }, // VANILLA: 95 DMG, 26 UT, 8 VEL - { ItemID.ChlorophytePartisan, Do(UseMeleeSpeed, DamageExact(95)) }, // VANILLA: 49 DMG + { ItemID.ChlorophytePartisan, Do(UseMeleeSpeed, DamageExact(80)) }, // VANILLA: 49 DMG { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(92), UseExact(10)) }, // VANILLA: 57 DMG, 16 UT { ItemID.ChristmasTreeSword, Do(UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, // VANILLA: 86 DMG, 23 UT - { ItemID.ClockworkAssaultRifle, Do(DamageExact(21)) }, // VANILLA: 17 DMG - { ItemID.CobaltNaginata, Do(TrueMelee, DamageExact(55), UseExact(9), ShootSpeedExact(12f)) }, // VANILLA: 44 DMG, 28 UT, 4.3 VEL - { ItemID.CobaltRepeater, Do(UseExact(18)) }, // VANILLA: 23 UT - { ItemID.CobaltSword, Do(DamageExact(60), UseExact(9)) }, // VANILLA: 40 DMG, 19 UT + { ItemID.ClockworkAssaultRifle, Do(DamageExact(24)) }, // VANILLA: 17 DMG + { ItemID.CobaltNaginata, Do(TrueMelee, DamageExact(60), UseExact(9), ShootSpeedExact(12f)) }, // VANILLA: 44 DMG, 28 UT, 4.3 VEL + { ItemID.CobaltRepeater, Do(UseExact(17)) }, // VANILLA: 23 UT + { ItemID.CobaltSword, Do(DamageExact(69), UseExact(9)) }, // VANILLA: 40 DMG, 19 UT { ItemID.Code2, Do(DamageExact(43)) }, // VANILLA: 54 DMG { ItemID.CoinGun, Do(UseExact(12)) }, // VANILLA: 8 UT { ItemID.CorruptYoyo, Do(DamageExact(20)) }, // Malaise. VANILLA: 16 DMG @@ -90,13 +88,11 @@ namespace CalamityMod.Items { 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(14)) }, // VANILLA: 53 DMG, 16 UT + { ItemID.Cutlass, Do(DamageExact(90), UseExact(11)) }, // VANILLA: 53 DMG, 16 UT { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, // VANILLA: 38 DMG { ItemID.DaoofPow, Do(DamageExact(85)) }, // Displays as 170 damage. VANILLA: 50 DMG (displays as 100) - { ItemID.DarkLance, Do(TrueMelee, DamageExact(40)) }, // VANILLA: 34 DMG - { ItemID.DartRifle, Do(DamageExact(58)) }, // VANILLA: 52 DMG { ItemID.DayBreak, Do(DamageExact(125), UseExact(22)) }, // VANILLA: 150 DMG, 16 UT - { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // VANILLA: 39 DMG. Compensation for removing aerial multiplier + { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane. VANILLA: 39 DMG. Compensation for removing aerial multiplier { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon. VANILLA: 180 DMG { ItemID.DeadlySphereStaff, Do(DamageExact(50)) }, // VANILLA: 40 DMG { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(65), ShootSpeedExact(15f)) }, // VANILLA: 57 DMG, 9 VEL @@ -106,20 +102,20 @@ namespace CalamityMod.Items { ItemID.ElfMelter, Do(ShootSpeedDelta(+5f)) }, // VANILLA: 8.5 VEL { ItemID.EmeraldStaff, Do(DamageExact(27)) }, // VANILLA: 19 DMG { ItemID.EmpressBlade, Do(DamageExact(68)) }, // Terraprisma. VANILLA: 90 DMG - { ItemID.EnchantedBoomerang, Do(DamageExact(24)) }, // VANILLA: 17 DMG - { ItemID.EnchantedSword, Do(UseMeleeSpeed, DamageExact(30), ShootSpeedExact(15f)) }, // VANILLA: 23 DMG, 9.5 VEL + { ItemID.EnchantedBoomerang, Do(DamageExact(21)) }, // VANILLA: 17 DMG + { ItemID.EnchantedSword, Do(UseMeleeSpeed) }, { ItemID.EndlessMusketPouch, Do(DamageExact(8)) }, // VANILLA: 7 DMG. Gives it the same damage as Tungsten Bullet { ItemID.Excalibur, Do(TrueMelee, DamageExact(170)) }, // VANILLA: 72 DMG { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow. VANILLA: 50 DMG { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, // VANILLA: 20 UT { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration. VANILLA: 25 DMG, 30 UT - { ItemID.Flamarang, Do(DamageExact(37)) }, // VANILLA: 49 DMG - { ItemID.Flamelash, Do(DamageExact(36), ManaExact(18)) }, // VANILLA: 32 DMG, 21 MANA + { ItemID.Flamarang, Do(DamageExact(40)) }, // VANILLA: 49 DMG + { ItemID.Flamelash, Do(DamageExact(36)) }, // VANILLA: 32 DMG { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, // VANILLA: 35 DMG, 7 VEL - { ItemID.FlowerofFire, Do(DamageRatio(0.78f), ManaExact(7)) }, // VANILLA: 48 DMG, 12 MANA. Uses ratios due to remix seed - { ItemID.FlowerofFrost, Do(DamageExact(70), UseExact(22), ManaExact(7), ShootSpeedExact(14)) }, // VANILLA: 60 DMG, 12 UT, 11 MANA, 9 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.Frostbrand, Do(UseMeleeSpeed, DamageExact(88)) }, // VANILLA: 49 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 { ItemID.GolemFist, Do(DamageExact(150)) }, // VANILLA: 90 DMG @@ -144,21 +140,20 @@ namespace CalamityMod.Items { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, // VANILLA: 100 DMG, 20 UT { ItemID.IronShortsword, Do(TrueMelee, DamageExact(10)) }, // VANILLA: 8 DMG { ItemID.Keybrand, Do(UseTurn) }, - { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // VANILLA: 40 DMG. Uses ratios due to remix seed + { ItemID.KOCannon, Do(DamageRatio(3f)) }, // VANILLA: 40 DMG. Uses ratios due to remix seed { ItemID.Kraken, Do(DamageExact(65)) }, // VANILLA: 95 DMG { ItemID.LaserMachinegun, Do(DamageExact(49)) }, // VANILLA: 60 DMG - { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, // VANILLA: 29 DMG, 12 UT, 8 MANA - { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, // VANILLA: 100 DMG, 12 MANA + { ItemID.LaserRifle, Do(DamageExact(46)) }, // VANILLA: 29 DMG + { ItemID.LastPrism, Do(DamageExact(57)) }, // VANILLA: 100 DMG { ItemID.LeadShortsword, Do(TrueMelee, DamageExact(11)) }, // VANILLA: 9 DMG { ItemID.LeafBlower, Do(DamageExact(61)) }, // VANILLA: 48 DMG { ItemID.LightDisc, Do(DamageExact(80), ShootSpeedExact(18)) }, // VANILLA: 60 DMG, 16 VEL { ItemID.LunarFlareBook, Do(DamageExact(110)) }, // VANILLA: 100 DMG { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, // VANILLA: 42 DMG, 4.5 VEL - { ItemID.MagicMissile, Do(DamageExact(23), UseAnimationExact(20), UseTimeExact(10), ManaExact(10)) }, // VANILLA: 35 DMG, 22 UT/UA, 14 MANA + { ItemID.MagicMissile, Do(DamageExact(23), UseAnimationExact(20), UseTimeExact(10)) }, // VANILLA: 35 DMG, 22 UT/UA { ItemID.Marrow, Do(DamageExact(60)) }, // VANILLA: 53 DMG - { ItemID.MedusaHead, Do(DamageExact(75), ManaExact(6)) }, // VANILLA: 40 DMG, 15 MANA - { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, // VANILLA: 200 DMG - { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, // VANILLA: 50 DMG, 9 MANA, 10 VEL + { ItemID.MedusaHead, Do(DamageExact(75)) }, // VANILLA: 40 DMG + { ItemID.Meowmere, Do(UseMeleeSpeed) }, { ItemID.MiniNukeI, Do(DamageExact(90)) }, // VANILLA: 75 DMG { ItemID.MiniNukeII, Do(DamageExact(90)) }, { ItemID.Minishark, Do(DamageExact(4)) }, // VANILLA: 6 DMG @@ -168,24 +163,23 @@ namespace CalamityMod.Items { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury. VANILLA: 140 DMG { ItemID.MoonlordBullet, Do(DamageExact(17)) }, // Luminite Bullet. VANILLA: 20 DMG { ItemID.MoonlordTurretStaff, Do(DamageExact(50)) }, // Lunar Portal Staff. VANILLA: 100 DMG - { ItemID.Muramasa, Do(CritDelta(+10)) }, // VANILLA: 4% CRIT { ItemID.MushroomSpear, Do(TrueMelee, DamageExact(100), UseExact(32)) }, // VANILLA: 60 DMG, 40 UT { ItemID.Musket, Do(DamageExact(22)) }, // VANILLA: 31 DMG { ItemID.MythrilHalberd, Do(TrueMelee, DamageExact(65), UseExact(8), ShootSpeedExact(15f)) }, // VANILLA: 45 DMG, 26 UT, 4.5 VEL { ItemID.MythrilRepeater, Do(UseExact(16)) }, // VANILLA: 20 UT { ItemID.MythrilSword, Do(UseTurn, DamageExact(70), UseExact(8)) }, // VANILLA: 50 DMG, 20 UT { ItemID.NailGun, Do(DamageExact(77)) }, // VANILLA: 85 DMG - { ItemID.NettleBurst, Do(DamageExact(65), ManaExact(10)) }, // VANILLA: 35 DMG, 12 MANA + { ItemID.NettleBurst, Do(DamageExact(65)) }, // VANILLA: 35 DMG { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, // VANILLA: 40 DMG { ItemID.NorthPole, Do(UseMeleeSpeed) }, { ItemID.OrangePhaseblade, phaseblade }, { ItemID.OrangePhasesaber, phasesaber }, { ItemID.OrichalcumHalberd, Do(TrueMelee, DamageExact(128), ShootSpeedExact(6f)) }, // VANILLA: 46 DMG, 4.5 VEL - { ItemID.OrichalcumRepeater, Do(DamageExact(48)) }, // VANILLA: 40 DMG + { ItemID.OrichalcumRepeater, Do(DamageExact(50)) }, // VANILLA: 40 DMG { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(175)) }, // VANILLA: 59 DMG { ItemID.PaladinsHammer, Do(DamageExact(95), ShootSpeedExact(28)) }, // VANILLA: 90 DMG, 14 VEL { ItemID.PalladiumPike, Do(TrueMelee, DamageExact(120), ShootSpeedExact(5.4f)) }, // VANILLA: 44 DMG, 4.4 VEL - { ItemID.PalladiumRepeater, Do(DamageExact(45)) }, // VANILLA: 37 DMG + { ItemID.PalladiumRepeater, Do(DamageExact(48)) }, // VANILLA: 37 DMG { ItemID.PalladiumSword, Do(DamageExact(150)) }, // VANILLA: 49 DMG { ItemID.PearlwoodBow, Do(DamageExact(32)) }, // VANILLA: 12 DMG { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, // VANILLA: 30 DMG @@ -199,9 +193,9 @@ namespace CalamityMod.Items { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, // VANILLA: 8 KB { ItemID.PurplePhaseblade, phaseblade }, { ItemID.PurplePhasesaber, phasesaber }, - { ItemID.PygmyStaff, Do(DamageExact(63)) }, // VANILLA: 40 DMG - { ItemID.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, // VANILLA: 45 DMG, 20 MANA - { ItemID.RainbowRod, Do(DamageExact(40), KnockbackExact(8f), ManaExact(13)) }, // VANILLA: 50 DMG, 6 KB, 21 MANA + { ItemID.PygmyStaff, Do(DamageExact(60)) }, // VANILLA: 40 DMG + { ItemID.RainbowGun, Do(DamageExact(60)) }, // VANILLA: 45 DMG + { ItemID.RainbowRod, Do(DamageExact(40), KnockbackExact(8f)) }, // VANILLA: 50 DMG, 6 KB { ItemID.Rally, Do(DamageExact(18)) }, // VANILLA: 14 DMG { ItemID.RavenStaff, Do(DamageExact(36)) }, // VANILLA: 55 DMG { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, // VANILLA: 85 DMG @@ -227,22 +221,20 @@ namespace CalamityMod.Items { 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.SolarEruption, Do(DamageExact(122)) }, // VANILLA: 105 DMG { 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 { ItemID.SpectreStaff, Do(DamageExact(72)) }, // VANILLA: 65 DMG - { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, // VANILLA: 22 UT, 14 MANA, 3 VEL + { ItemID.SpiritFlame, Do(UseExact(20), ShootSpeedExact(2f)) }, // VANILLA: 22 UT, 3 VEL { ItemID.StaffofEarth, Do(DamageExact(150)) }, // VANILLA: 125 DMG { ItemID.StarCannon, Do(UseExact(18)) }, // VANILLA: 12 UT - { ItemID.StardustDragonStaff, Do(DamageExact(20)) }, // VANILLA: 40 DMG + { ItemID.StardustDragonStaff, Do(DamageExact(24)) }, // VANILLA: 40 DMG { ItemID.StormTigerStaff, Do(DamageExact(49)) }, // Desert Tiger Staff. VANILLA: 41 DMG { ItemID.StylistKilLaKillScissorsIWish, Do(UseTurn, DamageExact(21)) }, // Stylish Scissors. VANILLA: 14 DMG { ItemID.Stynger, Do(DamageExact(75)) }, // VANILLA: 45 DMG - { ItemID.SuperStarCannon, Do(DamageExact(55)) }, // VANILLA: 60 DMG - { ItemID.Swordfish, Do(TrueMelee, DamageExact(24)) }, // VANILLA: 19 DMG + { ItemID.Swordfish, Do(TrueMelee, DamageExact(21)) }, // VANILLA: 19 DMG { ItemID.TacticalShotgun, Do(DamageExact(34)) }, // VANILLA: 29 DMG - { ItemID.TaxCollectorsStickOfDoom, Do(UseTurn, DamageExact(70), UseExact(12)) }, // Classy Cane. VANILLA: 16 DMG, 15 UT + { 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.Terragrim, Do(TrueMeleeNoSpeed, DamageExact(13)) }, // VANILLA: 17 DMG @@ -252,26 +244,24 @@ namespace CalamityMod.Items { ItemID.TheRottedFork, Do(TrueMelee, DamageExact(20)) }, // VANILLA: 17 DMG { ItemID.TheUndertaker, Do(DamageExact(15)) }, // VANILLA: 19 DMG { ItemID.ThunderSpear, Do(UseMeleeSpeed) }, // Storm Spear - { ItemID.ThunderStaff, Do(DamageExact(18)) }, // Thunder Zapper. VANILLA: 20 DMG + { ItemID.ThunderStaff, Do(DamageExact(15)) }, // Thunder Zapper. VANILLA: 20 DMG { ItemID.TitaniumRepeater, Do(DamageExact(52)) }, // VANILLA: 43 DMG - { ItemID.TitaniumSword, Do(UseTurn, DamageExact(192)) }, // VANILLA: 61 DMG + { ItemID.TitaniumSword, Do(UseTurn, DamageExact(185)) }, // VANILLA: 61 DMG { ItemID.TitaniumTrident, Do(TrueMelee, DamageExact(144), ShootSpeedExact(6.5f)) }, // VANILLA: 48 DMG, 5 VEL { ItemID.TopazStaff, Do(ManaExact(2)) }, // VANILLA: 5 MANA - { ItemID.ToxicFlask, Do(DamageExact(62), UseExact(33), ManaExact(20)) }, // VANILLA: 52 DMG, 45 UT, 30 MANA + { 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.Trimarang, Do(DamageExact(24)) }, // VANILLA: 21 DMG { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(112)) }, // VANILLA: 72 DMG { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, // 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), ManaRatio(0.78f)) }, // VANILLA: 88 DMG, 19 MANA. Uses ratios due to remix seed + { 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 - { ItemID.VenomStaff, Do(UseExact(27)) }, // VANILLA: 30 UT - { ItemID.WaspGun, Do(DamageExact(44)) }, // VANILLA: 31 DMG + { ItemID.WaspGun, Do(DamageExact(41)) }, // VANILLA: 31 DMG { ItemID.WaterBolt, Do(DamageExact(23)) }, // VANILLA: 19 DMG { ItemID.WhitePhaseblade, phaseblade }, { ItemID.WhitePhasesaber, phasesaber }, @@ -284,10 +274,6 @@ namespace CalamityMod.Items #endregion #region CATEGORY 2: Defense Balancing - { ItemID.LavaSkull, Do(DefenseExact(1)) }, // Magma Skull. VANILLA: 0 DEF - { ItemID.MoltenCharm, Do(DefenseExact(1)) }, // VANILLA: 0 DEF - { ItemID.MoltenSkullRose, Do(DefenseExact(3)) }, // VANILLA: 0 DEF - { ItemID.ObsidianSkullRose, Do(DefenseExact(1)) }, // VANILLA: 0 DEF // Valhalla Knight armor { ItemID.SquireAltHead, Do(DefenseDelta(-2)) }, // VANILLA: 20 DEF { ItemID.SquireAltPants, Do(DefenseDelta(-3)) }, // VANILLA: 24 DEF @@ -299,31 +285,31 @@ namespace CalamityMod.Items #region CATEGORY 3: Tool Balancing { ItemID.AcornAxe, Do(AxePower(100)) }, // Axe of Regrowth. VANILLA: 150% AXE - { ItemID.AdamantiteChainsaw, Do(TrueMeleeNoSpeed, DamageExact(75), AxePower(90), TileBoostExact(+0)) }, // VANILLA: 33 DMG, 100 AXE, -1 TILE - { ItemID.AdamantiteDrill, Do(TrueMeleeNoSpeed, DamageExact(32), TileBoostExact(+0)) }, // VANILLA: 20 DMG, -1 TILE + { ItemID.AdamantiteChainsaw, Do(TrueMeleeNoSpeed, DamageExact(58), AxePower(90), TileBoostExact(+0)) }, // VANILLA: 33 DMG, 100 AXE, -1 TILE + { 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.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 - { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+0)) }, // VANILLA: 4 SPD, -1 TILE + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, DamageExact(100), UseTimeExact(3), TileBoostExact(+0)) }, // VANILLA: 4 SPD, -1 TILE { ItemID.CactusPickaxe, Do(UseTimeExact(9)) }, // VANILLA: 16 SPD { ItemID.CnadyCanePickaxe, Do(UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe. VANILLA: 16 SPD - { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, DamageExact(112), UseTimeExact(3), AxePower(120), TileBoostExact(+1)) }, // VANILLA: 50 DMG, 4 SPD, 115 AXE, 0 TILE - { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, DamageExact(43), TileBoostExact(+1)) }, // VANILLA: 35 DMG, 0 TILE + { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, DamageExact(88), UseTimeExact(3), AxePower(120), TileBoostExact(+1)) }, // VANILLA: 50 DMG, 4 SPD, 115 AXE, 0 TILE + { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, DamageExact(45), TileBoostExact(+1)) }, // VANILLA: 35 DMG, 0 TILE { ItemID.ChlorophyteGreataxe, Do(AxePower(165), TileBoostExact(+2)) }, // VANILLA: 115 AXE, +1 TILE - { ItemID.ChlorophyteJackhammer, Do(TrueMeleeNoSpeed, DamageExact(53), UseTimeExact(5), TileBoostExact(+1)) }, // VANILLA: 45 DMG, 4 SPD, 0 TILE + { ItemID.ChlorophyteJackhammer, Do(TrueMeleeNoSpeed, DamageExact(58), UseTimeExact(5), TileBoostExact(+1)) }, // VANILLA: 45 DMG, 4 SPD, 0 TILE { ItemID.ChlorophytePickaxe, Do(TileBoostExact(+2)) }, // VANILLA: +1 TILE { ItemID.ChlorophyteWarhammer, Do(UseTimeExact(8), TileBoostExact(+2)) }, // VANILLA: 14 SPD, +1 TILE - { ItemID.CobaltChainsaw, Do(TrueMeleeNoSpeed, DamageExact(51), UseTimeExact(4)) }, // VANILLA: 23 DMG, 7 SPD - { ItemID.CobaltDrill, Do(TrueMeleeNoSpeed, DamageExact(21), UseTimeExact(5), PickPower(130)) }, // VANILLA: 10 DMG, 7 SPD, 110 PICK + { ItemID.CobaltChainsaw, Do(TrueMeleeNoSpeed, DamageExact(42), UseTimeExact(4)) }, // VANILLA: 23 DMG, 7 SPD + { ItemID.CobaltDrill, Do(TrueMeleeNoSpeed, DamageExact(13), UseTimeExact(5), PickPower(130)) }, // VANILLA: 10 DMG, 7 SPD, 110 PICK { ItemID.CobaltPickaxe, Do(UseTimeExact(9), PickPower(130)) }, // VANILLA: 13 SPD, 110 PICK { ItemID.CobaltWaraxe, Do(UseTimeExact(12), AxePower(125)) }, // VANILLA: 13 SPD, 70 AXE { ItemID.CopperAxe, Do(UseTimeExact(16), AxePower(50), TileBoostExact(+0)) }, // VANILLA: 21 SPD, 35 AXE, -1 TILE { ItemID.CopperHammer, Do(UseTimeExact(12), TileBoostExact(+0)) }, // VANILLA: 23 SPD, -1 TILE { ItemID.CopperPickaxe, Do(UseTimeExact(10), TileBoostExact(+0)) }, // VANILLA: 15 SPD, -1 TILE { ItemID.DeathbringerPickaxe, Do(UseTimeExact(10)) }, // VANILLA: 14 SPD - { ItemID.Drax, Do(TrueMeleeNoSpeed, DamageExact(80), TileBoostExact(+0)) }, // VANILLA: 35 DMG, -1 TILE + { ItemID.Drax, Do(TrueMeleeNoSpeed, DamageExact(62), TileBoostExact(+0)) }, // VANILLA: 35 DMG, -1 TILE { ItemID.EbonwoodHammer, Do(UseTimeExact(9), HammerPower(25)) }, // VANILLA: 20 SPD, 40 HAM { ItemID.FleshGrinder, Do(UseTimeExact(13), HammerPower(70)) }, // VANILLA: 19 SPD, 55 HAM { ItemID.GoldAxe, Do(UseTimeExact(14), AxePower(80)) }, // VANILLA: 18 SPD, 55 AXE @@ -333,7 +319,7 @@ namespace CalamityMod.Items { ItemID.IronAxe, Do(UseTimeExact(15), AxePower(60)) }, // VANILLA: 19 SPD, 45 AXE { ItemID.IronHammer, Do(UseTimeExact(11), HammerPower(45)) }, // VANILLA: 20 SPD, 40 HAM { ItemID.IronPickaxe, Do(UseTimeExact(8)) }, // VANILLA: 13 SPD - { ItemID.LaserDrill, Do(DamageExact(54), UseTimeExact(4), PickPower(220)) }, // VANILLA: 35 DMG, 6 SPD, 230 PICK + { ItemID.LaserDrill, Do(DamageExact(50), UseTimeExact(4), PickPower(220)) }, // VANILLA: 35 DMG, 6 SPD, 230 PICK { ItemID.LeadAxe, Do(UseTimeExact(15), AxePower(60)) }, // VANILLA: 19 SPD, 50 AXE { ItemID.LeadHammer, Do(UseTimeExact(11), HammerPower(45)) }, // VANILLA: 19 SPD, 43 HAM { ItemID.LeadPickaxe, Do(UseTimeExact(8), PickPower(40)) }, // VANILLA: 12 SPD, 43 PICK @@ -345,18 +331,18 @@ namespace CalamityMod.Items { ItemID.MeteorHamaxe, Do(HammerPower(70)) }, // VANILLA: 60 HAM { ItemID.MoltenHamaxe, Do(AxePower(125), HammerPower(75)) }, // VANILLA: 150 AXE, 70 HAM { ItemID.MoltenPickaxe, Do(UseTimeExact(10)) }, // VANILLA: 18 SPD - { ItemID.MythrilChainsaw, Do(TrueMeleeNoSpeed, DamageExact(63), UseTimeExact(4), AxePower(80)) }, // VANILLA: 29 DMG, 6 SPD, 85 AXE - { ItemID.MythrilDrill, Do(TrueMeleeNoSpeed, DamageExact(26), UseTimeExact(4), PickPower(160)) }, // VANILLA: 15 DMG, 6 SPD, 150 PICK + { ItemID.MythrilChainsaw, Do(TrueMeleeNoSpeed, DamageExact(52), UseTimeExact(4), AxePower(80)) }, // VANILLA: 29 DMG, 6 SPD, 85 AXE + { ItemID.MythrilDrill, Do(TrueMeleeNoSpeed, DamageExact(20), UseTimeExact(4), PickPower(160)) }, // VANILLA: 15 DMG, 6 SPD, 150 PICK { ItemID.MythrilPickaxe, Do(UseTimeExact(8), PickPower(160)) }, // VANILLA: 10 SPD, 150 PICK { ItemID.MythrilWaraxe, Do(UseTimeExact(11), AxePower(140)) }, // VANILLA: 10 SPD, 85 AXE - { ItemID.NebulaDrill, Do(TrueMeleeNoSpeed, DamageExact(95), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE + { ItemID.NebulaDrill, Do(TrueMeleeNoSpeed, DamageExact(70), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE { ItemID.NightmarePickaxe, Do(UseTimeExact(9), PickPower(66)) }, // VANILLA: 15 SPD, 65 PICK - { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(63), UseTimeExact(4), AxePower(80)) }, // VANILLA: 31 DMG, 5 SPD, 90 AXE - { ItemID.OrichalcumDrill, Do(TrueMeleeNoSpeed, DamageExact(26), UseTimeExact(4), PickPower(160)) }, // VANILLA: 17 DMG, 5 SPD, 165 PICK + { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(54), UseTimeExact(4), AxePower(80)) }, // VANILLA: 31 DMG, 5 SPD, 90 AXE + { ItemID.OrichalcumDrill, Do(TrueMeleeNoSpeed, DamageExact(22), UseTimeExact(4), PickPower(160)) }, // VANILLA: 17 DMG, 5 SPD, 165 PICK { ItemID.OrichalcumPickaxe, Do(UseTimeExact(8), PickPower(160)) }, // VANILLA: 9 SPD, 165 PICK { ItemID.OrichalcumWaraxe, Do(UseTimeExact(11), AxePower(140)) }, // VANILLA: 9 SPD, 90 AXE - { ItemID.PalladiumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(51), UseTimeExact(4), AxePower(70)) }, // VANILLA: 26 DMG, 7 SPD, 75 AXE - { ItemID.PalladiumDrill, Do(TrueMeleeNoSpeed, DamageExact(21), UseTimeExact(5)) }, // VANILLA: 12 DMG, 7 SPD + { ItemID.PalladiumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(44), UseTimeExact(4), AxePower(70)) }, // VANILLA: 26 DMG, 7 SPD, 75 AXE + { ItemID.PalladiumDrill, Do(TrueMeleeNoSpeed, DamageExact(15), UseTimeExact(5)) }, // VANILLA: 12 DMG, 7 SPD { ItemID.PalladiumPickaxe, Do(UseTimeExact(9)) }, // VANILLA: 12 SPD { ItemID.PalladiumWaraxe, Do(AxePower(125)) }, // VANILLA: 75 AXE { ItemID.PalmWoodHammer, Do(UseTimeExact(11), HammerPower(25)) }, // VANILLA: 23 SPD, 35 HAM @@ -373,22 +359,22 @@ namespace CalamityMod.Items { ItemID.SilverAxe, Do(UseTimeExact(14), AxePower(70)) }, // VANILLA: 18 SPD, 50 AXE { ItemID.SilverHammer, Do(UseTimeExact(10), HammerPower(55)) }, // VANILLA: 19 SPD, 45 HAM { ItemID.SilverPickaxe, Do(PickPower(50)) }, // VANILLA: 45 PICK - { ItemID.SolarFlareDrill, Do(TrueMeleeNoSpeed, DamageExact(95), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE + { ItemID.SolarFlareDrill, Do(TrueMeleeNoSpeed, DamageExact(70), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE { ItemID.SpectreHamaxe, Do(AxePower(170), TileBoostExact(+4)) }, // VANILLA: 150 AXE, +3 TILE { ItemID.SpectrePickaxe, Do(TileBoostExact(+4)) }, // VANILLA: +3 TILE - { ItemID.StardustDrill, Do(TrueMeleeNoSpeed, DamageExact(95), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE + { ItemID.StardustDrill, Do(TrueMeleeNoSpeed, DamageExact(70), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE { ItemID.TheBreaker, Do(UseTimeExact(13), HammerPower(70)) }, // VANILLA: 19 SPD, 55 HAM { ItemID.TinAxe, Do(UseTimeExact(16), AxePower(50)) }, // VANILLA: 20 SPD, 40 AXE { ItemID.TinHammer, Do(UseTimeExact(12), HammerPower(35)) }, // VANILLA: 21 SPD, 38 HAM { ItemID.TinPickaxe, Do(UseTimeExact(10)) }, // VANILLA: 14 SPD - { ItemID.TitaniumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(75), AxePower(90), TileBoostExact(+0)) }, // VANILLA: 34 DMG, 105 AXE, -1 TILE - { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, DamageExact(32), PickPower(180), TileBoostExact(+0)) }, // VANILLA: 27 DMG, 190 PICK, -1 TILE + { ItemID.TitaniumChainsaw, Do(TrueMeleeNoSpeed, DamageExact(60), AxePower(90), TileBoostExact(+0)) }, // VANILLA: 34 DMG, 105 AXE, -1 TILE + { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, DamageExact(35), PickPower(180), TileBoostExact(+0)) }, // VANILLA: 27 DMG, 190 PICK, -1 TILE { ItemID.TitaniumPickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, // VANILLA: 7 SPD, 190 PICK, 0 TILE { ItemID.TitaniumWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, // VANILLA: 7 SPD, 105 AXE, 0 TILE { ItemID.TungstenAxe, Do(UseTimeExact(14), AxePower(70)) }, // VANILLA: 18 SPD, 55 AXE { ItemID.TungstenHammer, Do(UseTimeExact(10), HammerPower(55)) }, // VANILLA: 25 SPD, 50 HAM { ItemID.TungstenPickaxe, Do(UseTimeExact(11)) }, // VANILLA: 19 SPD - { ItemID.VortexDrill, Do(TrueMeleeNoSpeed, DamageExact(95), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE + { ItemID.VortexDrill, Do(TrueMeleeNoSpeed, DamageExact(70), UseTimeExact(3), TileBoostExact(+3)) }, // VANILLA: 50 DMG, 2 SPD, +2 TILE { ItemID.WarAxeoftheNight, Do(UseTimeExact(13), AxePower(100)) }, // VANILLA: 15 SPD, 75 AXE { ItemID.WoodenHammer, Do(UseTimeExact(11), TileBoostExact(+0)) }, // VANILLA: 25 SPD, -1 TILE #endregion @@ -396,6 +382,7 @@ namespace CalamityMod.Items #region CATEGORY 4: True Melee support { ItemID.Arkhalis, trueMeleeNoSpeed }, { ItemID.CopperShortsword, trueMelee }, + { ItemID.DarkLance, trueMelee }, { ItemID.Gladius, trueMelee }, { ItemID.HallowJoustingLance, trueMelee }, { ItemID.JoustingLance, trueMelee }, @@ -412,6 +399,7 @@ namespace CalamityMod.Items #endregion #region CATEGORY 5: UseTurn + { ItemID.BeeKeeper, Do(UseTurn) }, { ItemID.BladeofGrass, Do(UseTurn) }, { ItemID.BloodButcherer, Do(UseTurn) }, { ItemID.BorealWoodSword, 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/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/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/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 63f0aeb0d8..d869d50d5b 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(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index da0bc6e2f1..7b74df80bf 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { Item.width = 24; Item.height = 28; - Item.useAnimation = 8; - Item.useTime = 8; + Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.fishingPole = 45; diff --git a/Items/Fishing/FishingRods/TrustyOldRod.cs b/Items/Fishing/FishingRods/TrustyOldRod.cs new file mode 100644 index 0000000000..d19e2a3b81 --- /dev/null +++ b/Items/Fishing/FishingRods/TrustyOldRod.cs @@ -0,0 +1,33 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.FishingRods +{ + public class TrustyOldRod : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) enemyChance = (1, 3); // x/x Chance to pull up enemies + public override void SetDefaults() + { + Item.width = 70; + Item.height = 70; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 45; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.rare = ItemRarityID.Green; + 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) + { + lineOriginOffset = new Vector2(68f, -52f); + lineColor = new Color(171, 171, 171, 0); + } + } +} diff --git a/Items/Fishing/FishingRods/TrustyOldRod.png b/Items/Fishing/FishingRods/TrustyOldRod.png new file mode 100644 index 0000000000..4b0dddb409 Binary files /dev/null and b/Items/Fishing/FishingRods/TrustyOldRod.png differ 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 new file mode 100644 index 0000000000..22f1d68c6a --- /dev/null +++ b/Items/Fishing/RageBait.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing +{ + public class RageBait : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) junkChance = (2, 3); // x/x Chance to turn items to junk + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = Item.CommonMaxStack; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(silver: 15); // Sold by Shady Salesman + Item.bait = 100; + Item.consumable = true; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.FishingBait; + } + } +} diff --git a/Items/Fishing/RageBait.png b/Items/Fishing/RageBait.png new file mode 100644 index 0000000000..1d97f4c96d Binary files /dev/null and b/Items/Fishing/RageBait.png differ diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index a7c0df913e..a2172c962b 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -1,28 +1,409 @@ -using Terraria.ID; +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 : ModItem, ILocalizedModType + 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 = 15; + Item.damage = 30; Item.knockBack = 2f; - Item.useTime = 7; - Item.useAnimation = 20; - Item.pick = 34; - - Item.DamageType = DamageClass.Melee; - Item.useTurn = true; + 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 oldSpin = 0; + int digDir = 0; + + 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 index 27b3e76ffd..601b91c115 100644 Binary files a/Items/Fishing/Spadefish.png and b/Items/Fishing/Spadefish.png differ 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/DisgustingSlop.png b/Items/Materials/DisgustingSlop.png new file mode 100644 index 0000000000..6d88c2df93 Binary files /dev/null and b/Items/Materials/DisgustingSlop.png differ diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs deleted file mode 100644 index f1bdcb44f6..0000000000 --- a/Items/Materials/GalacticaSingularity.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class GalacticaSingularity : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 28; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 80); - Item.rare = ItemRarityID.Red; - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.FragmentSolar). - AddIngredient(ItemID.FragmentVortex). - AddIngredient(ItemID.FragmentNebula). - AddIngredient(ItemID.FragmentStardust). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = (float)Main.rand.Next(90, 111) * 0.01f; - brightness *= Main.essScale; - Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 1f * brightness, 0.3f * brightness, 0.3f * brightness); - } - } -} diff --git a/Items/Materials/GalacticaSingularity.png b/Items/Materials/GalacticaSingularity.png deleted file mode 100644 index cdf70f5cf0..0000000000 Binary files a/Items/Materials/GalacticaSingularity.png and /dev/null differ diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index c7bb47de1b..3b87947858 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -7,18 +7,26 @@ namespace CalamityMod.Items.Materials public class MeldBlob : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 100; + Item.ResearchUnlockCount = 25; + ItemID.Sets.ItemIconPulse[Type] = true; } public override void SetDefaults() { - Item.width = 16; - Item.height = 14; + Item.width = 24; + Item.height = 22; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Red; + Item.rare = ItemRarityID.Cyan; + ItemID.Sets.ItemNoGravity[Type] = true; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.5f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/MeldBlob.png b/Items/Materials/MeldBlob.png index a24387680f..1c0aafc145 100644 Binary files a/Items/Materials/MeldBlob.png and b/Items/Materials/MeldBlob.png differ diff --git a/Items/Materials/MeldConstruct.cs b/Items/Materials/MeldConstruct.cs deleted file mode 100644 index 3fe527e5cc..0000000000 --- a/Items/Materials/MeldConstruct.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - [LegacyName("MeldiateBar")] - public class MeldConstruct : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - } - - public override void SetDefaults() - { - Item.width = 15; - Item.height = 12; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 42); - Item.rare = ItemRarityID.Red; - } - public override void AddRecipes() - { - CreateRecipe(3). - AddIngredient(6). - AddIngredient(3). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Materials/MeldConstruct.png b/Items/Materials/MeldConstruct.png deleted file mode 100644 index 1150c8db8f..0000000000 Binary files a/Items/Materials/MeldConstruct.png and /dev/null differ diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 39a7fa9695..46ba4a1278 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -88,7 +88,11 @@ namespace CalamityMod.Items.Materials AddIngredient(5). AddIngredient(). AddIngredient(). - AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 3). + AddIngredient(ItemID.FragmentVortex, 3). + AddIngredient(ItemID.FragmentNebula, 3). + AddIngredient(ItemID.FragmentStardust, 3). + AddIngredient(3). AddIngredient(). AddTile(). 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/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 3511bc45e1..84aa0dd540 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/CometShardUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 4f5d4438ce..ca91374064 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/EtherealCoreUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index bfa46677c1..bfc1d8f6c5 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhantomHeartUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() 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/Pets/StarSwallowerUnit.cs b/Items/Pets/StarSwallowerUnit.cs new file mode 100644 index 0000000000..85fededc2a --- /dev/null +++ b/Items/Pets/StarSwallowerUnit.cs @@ -0,0 +1,41 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class StarSwallowerUnit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Pets"; + public override void SetDefaults() + { + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.value = Item.sellPrice(gold: 1); + Item.rare = ModContent.RarityType(); + Item.useStyle = ItemUseStyleID.HoldUp; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(Item.buffType, 15, true); + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Frog). + AddIngredient(8). + AddIngredient(4). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Pets/StarSwallowerUnit.png b/Items/Pets/StarSwallowerUnit.png new file mode 100644 index 0000000000..9c51f4ae86 Binary files /dev/null and b/Items/Pets/StarSwallowerUnit.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/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 8885e6ffce..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 55da90cc1e..5da9b8e3af 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -29,7 +29,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddRecipeGroup("HardmodeAnvil"). AddIngredient(10). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(12). + 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 new file mode 100644 index 0000000000..7c1fe747fb --- /dev/null +++ b/Items/Placeables/Furniture/GluttonyBlender.cs @@ -0,0 +1,88 @@ +using CalamityMod.Items.Fishing; +using CalamityMod.Tiles.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class GluttonyBlender : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman + } + } + + public class QualitySlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override string Texture => "CalamityMod/Items/Potions/Food/QualitySlop"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = [ + new Color(183, 65, 68), + new Color(167, 116, 36), + new Color(175, 87, 190) + ]; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(32, 30, BuffID.WellFed3, CalamityUtils.MinutesToFrames(30)); + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Orange; + } + } + + public class DisgustingSlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override string Texture => "CalamityMod/Items/Materials/DisgustingSlop"; + + public override void SetStaticDefaults() + { + ItemID.Sets.ExtractinatorMode[Type] = Type; + } + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = Item.CommonMaxStack; + 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/GluttonyBlender.png b/Items/Placeables/Furniture/GluttonyBlender.png new file mode 100644 index 0000000000..18cc167ca0 Binary files /dev/null and b/Items/Placeables/Furniture/GluttonyBlender.png differ 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 f50c787909..e9d47d8eef 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings { public new string LocalizationCategory => "Items.Placeables"; public const int DropInt = 100; + public static bool holdShift = true; + public static bool showingFormerDevs = true; public override void SetDefaults() { @@ -22,35 +24,44 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings public override void ModifyTooltips(List tooltips) { - if (!Main.keyState.PressingShift()) - return; - - string tooltip = ""; - - int namesPerLine = 5; - for (int i = 0; i < devList.Count; i++) + if (Main.keyState.PressingShift()) { - tooltip += devList[i]; + if (!holdShift) + { + holdShift = true; + showingFormerDevs = !showingFormerDevs; + } - if (i == devList.Count - 1) - break; + string tooltip = "--------\n"; + int namesPerLine = 7; + IList listToPullFrom = showingFormerDevs ? formerDevList : currentDevList; - if (i % namesPerLine == 0) - tooltip += "\n"; + for (int i = 1; i <= listToPullFrom.Count; i++) + { + tooltip += listToPullFrom[i - 1]; - else - tooltip += ", "; + if (i == listToPullFrom.Count) + break; + + if (i % namesPerLine == 0) + tooltip += "\n"; + else + tooltip += ", "; + } + + TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + if (line != null) + line.Text = tooltip; } - - TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); - if (line != null) - line.Text = tooltip; + else + holdShift = false; } - public static IList devList = new List() + public static IList currentDevList = new List() { - "Altixal", + "Altixal", "apotofkoolaid", + "ArchonSystem", "Atalya", "Ben-TK", "Big E", @@ -60,21 +71,19 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Cooper", "CosmaticMango", "CrabBar", + "Critaquil", "Dandy", - "Dia", "Done", "dozezoze", - "ENNWAY", "Flowaria", "Fluffy", "fryzahh", - "HaguriHat", + "Gpscorpion", + "Hugekraken", "jasper", "LordMetarex", - "math2", "Moonburn", "Ozzatron", - "Piky", "PokerFace", "Raesh", "Sagittariod", @@ -84,11 +93,14 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "_tofu", "Tomat", "Triangle", - "TYESKI (Universe)", + "TYESKI", "Xyk", "YuH", - // Former devs - "Afzofa", + }; + + public static IList formerDevList = new List() + { + "Afzofa", "AdipemDragon", "Akeeli", "Aleksh", @@ -109,6 +121,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Daim", "DarkTiny", "Demik", + "Dia", "DM Dokuro", "Doog", "drh", @@ -120,6 +133,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Ein", "enamoured", "Enreden", + "ENNWAY", "Epsilon", "Fargowilta", "Frous", @@ -130,7 +144,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Grox the Great", "Heart Plus Up!", "Hectique", - "Hugekraken", "Huggles", "Ian-1KV", "IbanPlay", @@ -147,6 +160,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Lompl Allimath", "Lucille Karma", "MarieArk", + "math2", "Mercutio 'Merkalto' Takle", "Mihaii", "Minecat", @@ -163,6 +177,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Pbtopacio", "Phantasmal Deathray", "Phupperbat", + "Piky", "Pinkie Poss", "Poly", "Popo", 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..481b99da72 Binary files /dev/null and b/Items/Placeables/Furniture/PiggyCageGold.png differ diff --git a/Items/Placeables/Furniture/ResilientCandle.png b/Items/Placeables/Furniture/ResilientCandle.png index 29c5480f8c..dad1b54c54 100644 Binary files a/Items/Placeables/Furniture/ResilientCandle.png and b/Items/Placeables/Furniture/ResilientCandle.png differ diff --git a/Items/Placeables/Furniture/ShroombleCage.cs b/Items/Placeables/Furniture/ShroombleCage.cs new file mode 100644 index 0000000000..d8a02e2f78 --- /dev/null +++ b/Items/Placeables/Furniture/ShroombleCage.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ShroombleCage : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Terrarium). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/ShroombleCage.png b/Items/Placeables/Furniture/ShroombleCage.png new file mode 100644 index 0000000000..f794638982 Binary files /dev/null and b/Items/Placeables/Furniture/ShroombleCage.png differ diff --git a/Items/Placeables/Furniture/SpitefulCandle.png b/Items/Placeables/Furniture/SpitefulCandle.png index 48403fea34..c078643850 100644 Binary files a/Items/Placeables/Furniture/SpitefulCandle.png and b/Items/Placeables/Furniture/SpitefulCandle.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 new file mode 100644 index 0000000000..e852c856fa --- /dev/null +++ b/Items/Placeables/Furniture/TheMonument.cs @@ -0,0 +1,43 @@ +using CalamityMod.NPCs; +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class TheMonument : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public const float MonumentTaxIncrease = 0.5f; + public const float MonumentHappinessReduction = 0.15f; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 40; + Item.height = 50; + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(platinum: 1); // Sold by Shady Salesman + } + + public override void Load() + { + On_Player.CollectTaxes += AddMonumentTaxes; + } + + private static void AddMonumentTaxes(On_Player.orig_CollectTaxes orig, Player self) + { + orig(self); + + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.homeless && !NPCID.Sets.IsTownPet[n.type] && NPC.TypeToDefaultHeadIndex(n.type) > 0 && n.GetGlobalNPC().AffectedByTheMonument) + self.taxMoney += (int)(CalamityGlobalTownNPC.TotalTaxesPerNPC * MonumentTaxIncrease); + } + if (self.taxMoney > CalamityGlobalTownNPC.TaxesToCollectLimit) + self.taxMoney = CalamityGlobalTownNPC.TaxesToCollectLimit; + } + } +} diff --git a/Items/Placeables/Furniture/TheMonument.png b/Items/Placeables/Furniture/TheMonument.png new file mode 100644 index 0000000000..ba34a00847 Binary files /dev/null and b/Items/Placeables/Furniture/TheMonument.png differ diff --git a/Items/Placeables/Furniture/VigorousCandle.png b/Items/Placeables/Furniture/VigorousCandle.png index ca1f8a3523..d347366a31 100644 Binary files a/Items/Placeables/Furniture/VigorousCandle.png and b/Items/Placeables/Furniture/VigorousCandle.png differ diff --git a/Items/Placeables/Furniture/WeightlessCandle.png b/Items/Placeables/Furniture/WeightlessCandle.png index bf005cfb95..02faad55a9 100644 Binary files a/Items/Placeables/Furniture/WeightlessCandle.png and b/Items/Placeables/Furniture/WeightlessCandle.png differ diff --git a/Items/Placeables/FurnitureDriftwood/Driftwood.cs b/Items/Placeables/FurnitureDriftwood/Driftwood.cs index f041b00d8e..17363b5acd 100644 --- a/Items/Placeables/FurnitureDriftwood/Driftwood.cs +++ b/Items/Placeables/FurnitureDriftwood/Driftwood.cs @@ -22,10 +22,14 @@ namespace CalamityMod.Items.Placeables.FurnitureDriftwood public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddTile(TileID.WorkBenches). - DisableDecraft(). - Register(); + AddIngredient(2). + DisableDecraft(). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); } } } diff --git a/Items/Placeables/GreedPot.cs b/Items/Placeables/GreedPot.cs new file mode 100644 index 0000000000..7fe33db41c --- /dev/null +++ b/Items/Placeables/GreedPot.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles; + +namespace CalamityMod.Items.Placeables +{ + public class GreedPot : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman + } + } +} diff --git a/Items/Placeables/GreedPot.png b/Items/Placeables/GreedPot.png new file mode 100644 index 0000000000..9b89cb6405 Binary files /dev/null and b/Items/Placeables/GreedPot.png differ diff --git a/Items/Placeables/Pylons/CragsPylon.cs b/Items/Placeables/Pylons/CragsPylon.cs index 3b63072df8..43631e2f86 100644 --- a/Items/Placeables/Pylons/CragsPylon.cs +++ b/Items/Placeables/Pylons/CragsPylon.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Pylons; +using CalamityMod.Items.Placeables.Crags; +using CalamityMod.Tiles.Pylons; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,5 +16,15 @@ 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/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/Potions/Alcohol/BaconOil.cs b/Items/Potions/Alcohol/BaconOil.cs new file mode 100644 index 0000000000..96704a3bc2 --- /dev/null +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -0,0 +1,50 @@ +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Alcohol +{ + public class BaconOil : ModItem, ILocalizedModType, IAlcoholItem + { + public new string LocalizationCategory => "Items.Potions"; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BaconOil.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BaconOil; + public Action IVDripAlcoholEffect => ApplyBaconOilEffect; + + private static void ApplyBaconOilEffect(Player player, float intensity) + { + // See CalamityPlayer + } + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(204, 90, 73), + new Color(168, 37, 37), + new Color(120, 28, 28) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.value = Item.buyPrice(silver: 30); // Sold by Shady Salesman + Item.rare = ItemRarityID.Blue; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } + } +} diff --git a/Items/Potions/Alcohol/BaconOil.png b/Items/Potions/Alcohol/BaconOil.png new file mode 100644 index 0000000000..a9b35f923c Binary files /dev/null and b/Items/Potions/Alcohol/BaconOil.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 6dd7d3f933..39aa5c99b9 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,35 +1,55 @@ -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class BloodyMary : ModItem, ILocalizedModType + public class BloodyMary : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float PierceDamageMultiplier = 0.66f; + public static float SpawnRateGateMultiplier = 0.142f; + public static float IVDripAdditionalSpawnRateGateMultiplier = 0.7f; + public static float SpawnLimitMultiplier = 5f; + public static float IVDripAdditionalSpawnLimitMultiplier = 1.5f; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BloodyMary.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BloodyMary; + + public Action IVDripAlcoholEffect => ApplyBloodyMaryEffect; + + private static void ApplyBloodyMaryEffect(Player player, float intensity) + { + // See CalamityPlayerOnHit + } + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(204, 90, 73), new Color(168, 37, 37), new Color(120, 28, 28) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } - public override void AddRecipes() + public override void AddRecipes() { CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). @@ -37,5 +57,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 11; + } } } diff --git a/Items/Potions/Alcohol/BloodyMary.png b/Items/Potions/Alcohol/BloodyMary.png index 333f4ab986..60acaee69e 100644 Binary files a/Items/Potions/Alcohol/BloodyMary.png and b/Items/Potions/Alcohol/BloodyMary.png differ diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index ea3de081cf..1b51c9b792 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,35 +1,48 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CaribbeanRum : ModItem, ILocalizedModType + public class CaribbeanRum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MoveSpeedBoost = 0.25f; public static float GravityMultiplier = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), (1-GravityMultiplier).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CaribbeanRum.DripEffect").WithFormatArgs(MoveSpeedBoost.ToPercent(), (1 - GravityMultiplier).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.CaribbeanRum; + + public Action IVDripAlcoholEffect => ApplyCaribbeanRumEffect; + + private static void ApplyCaribbeanRumEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Based on the drink itself + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(105, 29, 14), new Color(128, 39, 22), new Color(138, 28, 7) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +56,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.png b/Items/Potions/Alcohol/CaribbeanRum.png index 834ce1a26a..4a833a3dd4 100644 Binary files a/Items/Potions/Alcohol/CaribbeanRum.png and b/Items/Potions/Alcohol/CaribbeanRum.png differ diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 990fcb4353..04031b69ea 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,31 +1,44 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CinnamonRoll : ModItem, ILocalizedModType + public class CinnamonRoll : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public AlcoholType AlcoholVariant => AlcoholType.CinnamonRoll; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CinnamonRoll.DripEffect"); + public Action IVDripAlcoholEffect => ApplyCinnamonRollEffect; + + private static void ApplyCinnamonRollEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 223, 181), new Color(222, 186, 147), new Color(176, 129, 106) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -38,5 +51,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.png b/Items/Potions/Alcohol/CinnamonRoll.png index 66f03882a4..d58d51053b 100644 Binary files a/Items/Potions/Alcohol/CinnamonRoll.png and b/Items/Potions/Alcohol/CinnamonRoll.png differ diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 3089c42d4d..0568ee5ec5 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Everclear : ModItem, ILocalizedModType + public class Everclear : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,20 +19,29 @@ namespace CalamityMod.Items.Potions.Alcohol public static int RegenLoss = 10; public static float DefenseLossPercent = 0.30f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Everclear.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Everclear; + public Action IVDripAlcoholEffect => ApplyEverclearEffect; + + private static void ApplyEverclearEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Everclear is clear so uhm... yeah? + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(153, 168, 162, 180), new Color(198, 205, 207, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(16, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +56,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Everclear.png b/Items/Potions/Alcohol/Everclear.png index 5e734af391..b7d15e16e5 100644 Binary files a/Items/Potions/Alcohol/Everclear.png and b/Items/Potions/Alcohol/Everclear.png differ diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e1b4a1fa07..7e55b0710d 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,35 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class EvergreenGin : ModItem, ILocalizedModType + public class EvergreenGin : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.EvergreenGin.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.EvergreenGin; + + public Action IVDripAlcoholEffect => ApplyEvergreenGinEffect; + private static void ApplyEvergreenGinEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.SicknessDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.WaterDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.ElectricDebuffMultiplier -= EvergreenGin.DebuffLoss; + cplayer.HeatDebuffMultiplier -= EvergreenGin.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green-blue + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(201, 248, 248), new Color(201, 248, 221), new Color(177, 240, 184) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.png b/Items/Potions/Alcohol/EvergreenGin.png index 5f1f9ae1ff..5848d618af 100644 Binary files a/Items/Potions/Alcohol/EvergreenGin.png and b/Items/Potions/Alcohol/EvergreenGin.png differ diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 8fcea00497..f6942b5d7e 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,34 +1,50 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Fireball : ModItem, ILocalizedModType + public class Fireball : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Fireball.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Fireball; + + public Action IVDripAlcoholEffect => ApplyFireballEffect; + + private static void ApplyFireballEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier += Fireball.DebuffBoost; + cplayer.SicknessDebuffMultiplier -= Fireball.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 171, 22), new Color(227, 128, 41), new Color(237, 82, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -36,7 +52,6 @@ namespace CalamityMod.Items.Potions.Alcohol public override void AddRecipes() { - CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). AddIngredient(ItemID.LivingFireBlock, 50). @@ -44,5 +59,9 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Fireball.png b/Items/Potions/Alcohol/Fireball.png index 48ba41816b..a9b9596bcc 100644 Binary files a/Items/Potions/Alcohol/Fireball.png and b/Items/Potions/Alcohol/Fireball.png differ diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 1fcd4d64cf..3f46580767 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,34 +1,48 @@ -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class GrapeBeer : ModItem, ILocalizedModType + public class GrapeBeer : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float CritLoss = 50; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritLoss); + public static float CloseRangeDistance = 80; + public static float LongRangeDistance = 1200; + public static float CloseRangeDamage = 0.75f; + public static float LongRangeDamage = 0.25f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.GrapeBeer.DripEffect").WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public AlcoholType AlcoholVariant => AlcoholType.GrapeBeer; + public Action IVDripAlcoholEffect => ApplyGrapeBeerEffect; + + private static void ApplyGrapeBeerEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(36, 2, 41), new Color(56, 0, 64), new Color(82, 10, 92) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(12, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(20, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -41,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.png b/Items/Potions/Alcohol/GrapeBeer.png index 1727991aa4..dc93fd517a 100644 Binary files a/Items/Potions/Alcohol/GrapeBeer.png and b/Items/Potions/Alcohol/GrapeBeer.png differ diff --git a/Items/Potions/Alcohol/Manhattan.cs b/Items/Potions/Alcohol/Manhattan.cs index b2b338a0b3..dc38313a10 100644 --- a/Items/Potions/Alcohol/Manhattan.cs +++ b/Items/Potions/Alcohol/Manhattan.cs @@ -1,35 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Manhattan : ModItem, ILocalizedModType + public class Manhattan : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Manhattan.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Manhattan; + public Action IVDripAlcoholEffect => ApplyManhattanEffect; + + private static void ApplyManhattanEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ColdDebuffMultiplier += Manhattan.DebuffBoost; + cplayer.WaterDebuffMultiplier -= Manhattan.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(19, 58, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Manhattan.png b/Items/Potions/Alcohol/Manhattan.png index c6226e8ff7..226f575e75 100644 Binary files a/Items/Potions/Alcohol/Manhattan.png and b/Items/Potions/Alcohol/Manhattan.png differ diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 4df44ae8fb..2a86e3127a 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Margarita : ModItem, ILocalizedModType + public class Margarita : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,37 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffLoss = 0.5f; public static int MinuteDuration = 3; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Margarita.DripEffect").WithFormatArgs(DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Margarita; + public Action IVDripAlcoholEffect => ApplyMargaritaEffect; + + private static void ApplyMargaritaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.TypelessDebuffMultiplier -= Margarita.DebuffLoss; + // Also see CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(219, 227, 191), new Color(186, 189, 147), new Color(142, 161, 125) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(28, 40, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(42, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +62,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Margarita.png b/Items/Potions/Alcohol/Margarita.png index e147d8dfd4..3471d98bf5 100644 Binary files a/Items/Potions/Alcohol/Margarita.png and b/Items/Potions/Alcohol/Margarita.png differ diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index fd89995259..d684a80632 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,34 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Moonshine : ModItem, ILocalizedModType + public class Moonshine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxLifePercentBoost = 0.33f; + public static float MaxLifePercentBoost = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Moonshine.DripEffect").WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Moonshine; + public Action IVDripAlcoholEffect => ApplyMoonshineEffect; + + private static void ApplyMoonshineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerHitHurt + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 237, 218, 128), new Color(227, 219, 191, 128), new Color(209, 204, 194, 128) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Moonshine.png b/Items/Potions/Alcohol/Moonshine.png index f4131089b9..9eed064da5 100644 Binary files a/Items/Potions/Alcohol/Moonshine.png and b/Items/Potions/Alcohol/Moonshine.png differ diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 69406883aa..8e5c1c37e9 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,35 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class MoscowMule : ModItem, ILocalizedModType + public class MoscowMule : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float KnockbackBoost = 0.5f; + public static float PierceDamageMultiplier = 0.7f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.MoscowMule.DripEffect").WithFormatArgs(KnockbackBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.MoscowMule; + public Action IVDripAlcoholEffect => ApplyMoscowMuleEffect; + + private static void ApplyMoscowMuleEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green with a hint of red + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(194, 252, 192), new Color(226, 252, 192), new Color(250, 225, 222) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(46, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +53,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/MoscowMule.png b/Items/Potions/Alcohol/MoscowMule.png index 9a3a129c08..3673e404b9 100644 Binary files a/Items/Potions/Alcohol/MoscowMule.png and b/Items/Potions/Alcohol/MoscowMule.png differ diff --git a/Items/Potions/Alcohol/OddMushroom.png b/Items/Potions/Alcohol/OddMushroom.png index 947d323e19..2d8288fb9f 100644 Binary files a/Items/Potions/Alcohol/OddMushroom.png and b/Items/Potions/Alcohol/OddMushroom.png differ diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 802234bc9d..f2f8c726c4 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class OldFashioned : ModItem, ILocalizedModType + public class OldFashioned : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static readonly float DamageBoostMultiplier = 1.25f; public static readonly float DamageReductionMultiplier = 0.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.OldFashioned.DripEffect").WithFormatArgs(DamageBoostMultiplier.ToString("N2"), DamageReductionMultiplier.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.OldFashioned; + public Action IVDripAlcoholEffect => ApplyOldFashionedEffect; + + private static void ApplyOldFashionedEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(255, 118, 3), new Color(255, 200, 82), new Color(255, 228, 122) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(38, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/OldFashioned.png b/Items/Potions/Alcohol/OldFashioned.png index c46adf86ba..618028fba5 100644 Binary files a/Items/Potions/Alcohol/OldFashioned.png and b/Items/Potions/Alcohol/OldFashioned.png differ diff --git a/Items/Potions/Alcohol/PurpleHaze.cs b/Items/Potions/Alcohol/PurpleHaze.cs index 4c7792e387..5da0e3abdf 100644 --- a/Items/Potions/Alcohol/PurpleHaze.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -1,7 +1,10 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -9,28 +12,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class PurpleHaze : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DamageBoost = 0.25f; public static float StealthDamageLoss = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(),StealthDamageLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.PurpleHaze.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), StealthDamageLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.PurpleHaze; + + public Action IVDripAlcoholEffect => ApplyPurpleHazeEffect; + + private static void ApplyPurpleHazeEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(239, 123, 202), new Color(187, 56, 158), new Color(165, 47, 255) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(24, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -44,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/PurpleHaze.png b/Items/Potions/Alcohol/PurpleHaze.png index 2baf8212db..d43e134c80 100644 Binary files a/Items/Potions/Alcohol/PurpleHaze.png and b/Items/Potions/Alcohol/PurpleHaze.png differ diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index f0314cc7f1..2afbf3ad47 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,36 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class RedWine : ModItem, ILocalizedModType + public class RedWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float VerticalSpeedBoost = 0.1f; public static float FlightTimeLoss = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.RedWine.DripEffect").WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.RedWine; + + public Action IVDripAlcoholEffect => ApplyRedWineEffect; + + private static void ApplyRedWineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(54, 5, 21), new Color(82, 9, 36), new Color(105, 4, 29) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6)); - + Item.DefaultToFood(20, 61, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; } @@ -42,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/RedWine.png b/Items/Potions/Alcohol/RedWine.png index 025a1ad4fa..991922d87a 100644 Binary files a/Items/Potions/Alcohol/RedWine.png and b/Items/Potions/Alcohol/RedWine.png differ diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index e1b83237a8..59de073e29 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Rum : ModItem, ILocalizedModType + public class Rum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float NonMinionBoost = 1.15f; public static float MinionBoost = 0.85f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NonMinionBoost-1).ToPercent(), (1- MinionBoost).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Rum.DripEffect").WithFormatArgs((NonMinionBoost - 1).ToPercent(), (1 - MinionBoost).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Rum; + public Action IVDripAlcoholEffect => ApplyRumEffect; + + private static void ApplyRumEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 165, 9), new Color(247, 219, 54), new Color(255, 195, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Rum.png b/Items/Potions/Alcohol/Rum.png index 1f582e6294..fef2821ba3 100644 Binary files a/Items/Potions/Alcohol/Rum.png and b/Items/Potions/Alcohol/Rum.png differ diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 65c071fa43..ae75b8f518 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,36 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Screwdriver : ModItem, ILocalizedModType + public class Screwdriver : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Screwdriver.DripEffect").WithFormatArgs(DebuffBoost.ToString("N2"), DebuffLoss.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.Screwdriver; + public Action IVDripAlcoholEffect => ApplyScrewdriverEffect; + + private static void ApplyScrewdriverEffect(Player player, float intensity) + { + player.blockRange += 5; + player.tileSpeed += 1; + player.wallSpeed += 1; + player.GetDamage(DamageClass.Generic) *= 0.75f; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -42,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/Screwdriver.png b/Items/Potions/Alcohol/Screwdriver.png index e499f35d90..aa6147ccb9 100644 Binary files a/Items/Potions/Alcohol/Screwdriver.png and b/Items/Potions/Alcohol/Screwdriver.png differ diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index bbc2dc0f21..7493d3d13c 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class StarBeamRye : ModItem, ILocalizedModType + public class StarBeamRye : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MagicDmgMult = 0.9f; public static int ManaRegenBoost = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDmgMult); + public AlcoholType AlcoholVariant => AlcoholType.StarBeamRye; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.StarBeamRye.DripEffect").WithFormatArgs(MagicDmgMult); + public Action IVDripAlcoholEffect => ApplyStarBeamRyeEffect; + + private static void ApplyStarBeamRyeEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Dark red-orange + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(89, 18, 10), new Color(102, 39, 14), new Color(128, 31, 9) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 54, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.png b/Items/Potions/Alcohol/StarBeamRye.png index 3c1d30b238..f61b9aea7d 100644 Binary files a/Items/Potions/Alcohol/StarBeamRye.png and b/Items/Potions/Alcohol/StarBeamRye.png differ diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index b9d4df742e..c5ba5d92f8 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.DataStructures; namespace CalamityMod.Items.Potions.Alcohol { - public class Tequila : ModItem, ILocalizedModType + public class Tequila : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,32 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Tequila.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Tequila; + public Action IVDripAlcoholEffect => ApplyTequilaEffect; + + private static void ApplyTequilaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ElectricDebuffMultiplier += Tequila.DebuffBoost; + cplayer.ColdDebuffMultiplier -= Tequila.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(163, 110, 10), new Color(176, 135, 0), new Color(194, 132, 25) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -44,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Tequila.png b/Items/Potions/Alcohol/Tequila.png index 8ef6726cd6..87d5dd41e0 100644 Binary files a/Items/Potions/Alcohol/Tequila.png and b/Items/Potions/Alcohol/Tequila.png differ diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 2e04f06f82..71fd80ec42 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class TequilaSunrise : ModItem, ILocalizedModType + public class TequilaSunrise : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DoTMultiplier = 1.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DoTMultiplier-1).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.TequilaSunrise.DripEffect").WithFormatArgs((DoTMultiplier-1).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.TequilaSunrise; + public Action IVDripAlcoholEffect => ApplyTequilaSunriseEffect; + + private static void ApplyTequilaSunriseEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(220, 75, 59), new Color(229, 147, 47), new Color(255, 190, 76) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.png b/Items/Potions/Alcohol/TequilaSunrise.png index 30974d148a..4f2ee50759 100644 Binary files a/Items/Potions/Alcohol/TequilaSunrise.png and b/Items/Potions/Alcohol/TequilaSunrise.png differ diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ca404e6e3c..f91304ab41 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,30 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Vodka : ModItem, ILocalizedModType + public class Vodka : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.25f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Vodka.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Vodka; + public Action IVDripAlcoholEffect => ApplyVodkaEffect; + + private static void ApplyVodkaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.TypelessDebuffMultiplier += Vodka.DebuffBoost; + cplayer.HeatDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Vodka.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(219, 219, 208, 180), new Color(181, 181, 176, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -43,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Vodka.png b/Items/Potions/Alcohol/Vodka.png index f1e7333959..5ffef8df03 100644 Binary files a/Items/Potions/Alcohol/Vodka.png and b/Items/Potions/Alcohol/Vodka.png differ diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 8affbb3282..fc77890852 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,37 +1,52 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Whiskey : ModItem, ILocalizedModType + public class Whiskey : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxDamageBoost = 0.15f; - public static float MinDamageBoost = -0.15f; + public static float StandardDamageCeiling = 0.15f; + public static float StandardDamageFloor = -0.15f; public static float TimeToDischarge = 600; public static float TimeToRecharge = 300; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinDamageBoost.ToPercent(), MaxDamageBoost.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public static float CombinedDamageCeiling = 0.3f; + public static float CombinedDamageFloor = -0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Whiskey.DripEffect").WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge / 60).ToString("0.##"), (TimeToRecharge / 60).ToString("0.##"), CombinedDamageFloor.ToPercent(), CombinedDamageCeiling.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Whiskey; + + public Action IVDripAlcoholEffect => ApplyWhiskeyEffect; + + private static void ApplyWhiskeyEffect(Player player, float intensity) + { + // See CalamityPlayer + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(227, 148, 11), new Color(235, 177, 5), new Color(250, 190, 12) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -43,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Whiskey.png b/Items/Potions/Alcohol/Whiskey.png index 351f288939..b4e8e20c6d 100644 Binary files a/Items/Potions/Alcohol/Whiskey.png and b/Items/Potions/Alcohol/Whiskey.png differ diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 32890d06ad..17ab737b17 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,32 +1,43 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameInput; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class WhiteWine : ModItem, ILocalizedModType + public class WhiteWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float FlightTimeRecoveryAmount = 0.66f; public static float FlightTimeLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.WhiteWine.DripEffect").WithFormatArgs(FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.WhiteWine; + public Action IVDripAlcoholEffect => ApplyWhiteWineEffect; + + private static void ApplyWhiteWineEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Clear, yellow-green + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(242, 252, 177, 180), new Color(250, 252, 215, 180), new Color(228, 245, 181, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -48,5 +59,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/WhiteWine.png b/Items/Potions/Alcohol/WhiteWine.png index 2341999a22..11d14186eb 100644 Binary files a/Items/Potions/Alcohol/WhiteWine.png and b/Items/Potions/Alcohol/WhiteWine.png differ diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 11496ee727..4cbbc4eaf7 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.Potions { public new string LocalizationCategory => "Items.Potions"; - public static int ManaPerFrame = 2; - public static int SelfDamage = 5; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaPerFrame * 60, SelfDamage); + public static int ManaPerFrame = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaPerFrame * 60); public override void SetStaticDefaults() { @@ -28,40 +27,20 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToFood(14, 34, ModContent.BuffType(), CalamityUtils.SecondsToFrames(5), true); + Item.DefaultToFood(14, 34, ModContent.BuffType(), CalamityUtils.SecondsToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; } - public override void OnConsumeItem(Player player) - { - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); - player.statLife -= SelfDamage; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-SelfDamage, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInjection" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), 1000.0, 0, false); - } - } + public override void OnConsumeItem(Player player) => player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); public override void AddRecipes() { CreateRecipe(15). - AddIngredient(ItemID.BottledWater, 15). + AddIngredient(ItemID.SuperManaPotion, 15). AddIngredient(4). AddIngredient(). - AddTile(TileID.AlchemyTable). - AddConsumeIngredientCallback(Recipe.IngredientQuantityRules.Alchemy). - Register(); - - CreateRecipe(15). - AddIngredient(ItemID.BottledWater, 15). - AddIngredient(5). - AddIngredient(). - AddTile(TileID.AlchemyTable). + AddTile(TileID.Bottles). Register() .DisableDecraft(); } diff --git a/Items/Potions/AureusCell.cs b/Items/Potions/AureusCell.cs index 5878710f40..3297737fec 100644 --- a/Items/Potions/AureusCell.cs +++ b/Items/Potions/AureusCell.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Potions { // Eating animation but gulp sound? Sure Item.DefaultToFood(22, 38, BuffID.MagicPower, CalamityUtils.MinutesToFrames(8)); - Item.healMana = 200; Item.UseSound = SoundID.Item3; Item.value = Item.sellPrice(silver: 50); // Based on material cost rather than potion cost Item.rare = ItemRarityID.Lime; @@ -32,19 +31,6 @@ namespace CalamityMod.Items.Potions public override void OnConsumeItem(Player player) { - if (PlayerInput.Triggers.JustPressed.QuickBuff) - { - player.statMana += Item.healMana; - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(Item.healMana); - } - } player.AddBuff(BuffID.MagicPower, Item.buffTime); player.AddBuff(BuffID.ManaRegeneration, Item.buffTime); } diff --git a/Items/Potions/BottledPanacea.cs b/Items/Potions/BottledPanacea.cs index 347e59c2f1..b61d284f6d 100644 --- a/Items/Potions/BottledPanacea.cs +++ b/Items/Potions/BottledPanacea.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Items.Potions { @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Potions for (int i = Player.MaxBuffs - 1; i >= 0; i--) { int buffType = player.buffType[i]; - if (BuffDatasets.DebuffDataset[buffType] is not null && (BuffDatasets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || BuffDatasets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) + if (CalamityBuffSets.DebuffDataset[buffType] is not null && (CalamityBuffSets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || CalamityBuffSets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) player.DelBuff(i); } diff --git a/Items/Potions/Food/Baguette.cs b/Items/Potions/Food/Baguette.cs index 862d4a1da9..d245dca640 100644 --- a/Items/Potions/Food/Baguette.cs +++ b/Items/Potions/Food/Baguette.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Potions; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Potions; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,9 +13,10 @@ namespace CalamityMod.Items.Potions.Food { public new string LocalizationCategory => "Items.Potions"; - public static int RedWineBuffedHealValue = 250; - public static int RedWineBuffedRegenLoss = 4; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RedWineBuffedHealValue, RedWineBuffedRegenLoss.ToRegenPerSecond()); + public static int RedWineHealValue = 200; + public static int RedWineRegenLoss = 4; + public static int RedWineRegenLossDuration = CalamityUtils.SecondsToFrames(15); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RedWineRegenLoss.ToRegenPerSecond()); public override void SetStaticDefaults() { @@ -28,6 +30,20 @@ namespace CalamityMod.Items.Potions.Food ItemID.Sets.IsFood[Type] = true; } + public override void UpdateInventory(Player player) + { + if (player.HasBuff()) + { + Item.healLife = RedWineHealValue; + Item.potion = true; + } + else + { + Item.healLife = 0; + Item.potion = false; + } + } + public override void SetDefaults() { Item.DefaultToFood(52, 38, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); @@ -45,7 +61,8 @@ namespace CalamityMod.Items.Potions.Food { // 5 minutes for both player.AddBuff(BuffID.WellFed, Item.buffTime); - player.AddBuff(ModContent.BuffType(), Item.buffTime); + if (player.HasBuff()) + player.AddBuff(ModContent.BuffType(), RedWineRegenLossDuration); } public override void AddRecipes() 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..f418a525e5 100644 --- a/Items/Potions/Food/LavaChickenBroth.cs +++ b/Items/Potions/Food/LavaChickenBroth.cs @@ -27,7 +27,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; diff --git a/Items/Potions/Food/QualitySlop.png b/Items/Potions/Food/QualitySlop.png new file mode 100644 index 0000000000..236e7ebf2d Binary files /dev/null and b/Items/Potions/Food/QualitySlop.png differ diff --git a/Items/Potions/Food/TheSandwich.cs b/Items/Potions/Food/TheSandwich.cs new file mode 100644 index 0000000000..6d1128ef0e --- /dev/null +++ b/Items/Potions/Food/TheSandwich.cs @@ -0,0 +1,42 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class TheSandwich : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public static int alcoholCapBoost = 2; + public static float statBoost = 0.05f; // The player starts with negative stat boosts, so it is a bit less than you'd expect + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(statBoost.ToPercent()); + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(132, 171, 87), + new Color(174, 91, 107), + new Color(218, 176, 133) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(70, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(10)); + 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) + { + player.ClearBuff(BuffID.WellFed); + player.ClearBuff(BuffID.WellFed2); + player.ClearBuff(BuffID.WellFed3); + } + } +} diff --git a/Items/Potions/Food/TheSandwich.png b/Items/Potions/Food/TheSandwich.png new file mode 100644 index 0000000000..63404497ee Binary files /dev/null and b/Items/Potions/Food/TheSandwich.png differ diff --git a/Items/Potions/TheConcoction.cs b/Items/Potions/TheConcoction.cs new file mode 100644 index 0000000000..581eb2bdd3 --- /dev/null +++ b/Items/Potions/TheConcoction.cs @@ -0,0 +1,138 @@ +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; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TheConcoction : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public static int healValue = 9999; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] + { + new Color(255, 190, 250), + new Color(255, 225, 183), + new Color(246, 34, 79) + }; + } + public override void SetDefaults() + { + 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) + { + 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 ModifyTooltips(List tooltips) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + + if (concoctionPlayer.hoverTimer <= 10 && concoctionPlayer.hoverTimer > 0) + { + TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (healLine != null) + { + healLine.Text = this.GetLocalization("EasterEggText").Value; + } + } + } + } + + 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()) + { + 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/TheConcoction.png b/Items/Potions/TheConcoction.png new file mode 100644 index 0000000000..1a78543c8e Binary files /dev/null and b/Items/Potions/TheConcoction.png differ diff --git a/Items/Potions/TheElixir.cs b/Items/Potions/TheElixir.cs new file mode 100644 index 0000000000..2200a67d6d --- /dev/null +++ b/Items/Potions/TheElixir.cs @@ -0,0 +1,135 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Packets; +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 +{ + public class TheElixir : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(159, 67, 199), + new Color(176, 147, 243), + new Color(84, 50, 185) + }; + } + + public override void SetDefaults() + { + 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. + // Even though the item also inflicts Cursed, this is kept as a failsafe in the event the player has something equipped that + // provides immunity to Cursed. (i.e Countercurse Mantra or Nazar) + public override bool CanUseItem(Player player) + { + if (player.HasBuff(BuffID.ChaosState)) + return false; + + return base.CanUseItem(player); + } + + 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)) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + player.GetModPlayer().RunDangerousLocationTeleportation(); + } + else if (player.whoAmI == Main.myPlayer) + { + TheElixirTeleportSyncPacket.Send(player); + } + + 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 + { + 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(); + int dustAmt = rect.Width * rect.Height / 5; + for (int k = 0; k < dustAmt; k++) + { + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.TeleportationPotion); + dust.scale = Main.rand.NextFloat(0.2f, 0.7f); + if (k < 10) + dust.scale += 0.25f; + if (k < 5) + dust.scale += 0.25f; + } + for (int k = 0; k < 70; k++) + { + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.DungeonSpirit); + dust.noGravity = true; + for (int i = 0; i < 5; i++) + { + if (Main.rand.NextBool(3)) + dust.velocity *= 0.75f; + } + if (Main.rand.NextBool(3)) + { + dust.velocity *= 2f; + dust.scale *= 1.2f; + } + if (Main.rand.NextBool(3)) + { + dust.velocity *= 2f; + dust.scale *= 1.2f; + } + if (Main.rand.NextBool()) + { + dust.fadeIn = Main.rand.NextFloat(0.75f, 1f); + dust.scale = Main.rand.NextFloat(0.25f, 0.75f); + } + dust.scale *= 0.8f; + } + 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/Potions/TheElixir.png b/Items/Potions/TheElixir.png new file mode 100644 index 0000000000..1d25a72177 Binary files /dev/null and b/Items/Potions/TheElixir.png differ diff --git a/Items/SulphuricPowder.png b/Items/SulphuricPowder.png deleted file mode 100644 index a8241aba56..0000000000 Binary files a/Items/SulphuricPowder.png and /dev/null differ diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 2c7bbb1321..341e60f662 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -60,7 +60,11 @@ namespace CalamityMod.Items.SummonItems // sequence breaking recipe CreateRecipe(). AddIngredient(ItemID.LunarBar, 40). - AddIngredient(10). + AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(ItemID.FragmentVortex, 10). + AddIngredient(ItemID.FragmentNebula, 10). + AddIngredient(ItemID.FragmentStardust, 10). + AddIngredient(10). AddIngredient(40). AddTile(TileID.MythrilAnvil). Register(); 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..0176a2ae0c 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.SummonItems { 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)) || canPissOffProvi) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/TownPets/TheHousingContract.cs b/Items/SummonItems/TownPets/TheHousingContract.cs new file mode 100644 index 0000000000..53a959ca3e --- /dev/null +++ b/Items/SummonItems/TownPets/TheHousingContract.cs @@ -0,0 +1,67 @@ +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Chat; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.TownPets +{ + public class TheHousingContract : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.SummonItems"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = true; + Item.useAnimation = 45; + Item.useTime = 45; + Item.UseSound = SoundID.Item92; + Item.width = 28; + Item.height = 28; + Item.maxStack = Item.CommonMaxStack; + Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(gold: 5)); // Same price as other Pet Licenses; Sold by Shady Salesman + } + + public override bool? UseItem(Player player) + { + int npcType = ModContent.NPCType(); + if (player.ItemAnimationJustStarted && (!CalamityWorld.unlockedTownPig || NPC.AnyNPCs(npcType))) + { + if (player.whoAmI == Main.myPlayer) + { + SpawnPiggy(); + } + return true; + } + return false; + } + + public static void SpawnPiggy() + { + Color color = new(50, 255, 130); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (!CalamityWorld.unlockedTownPig) + { + SyncTownPigLicensePacket.Send(); + } + } + else if (!CalamityWorld.unlockedTownPig) + { + CalamityWorld.unlockedTownPig = true; + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Mods.CalamityMod.Misc.PiggyLicense"), color); + CalamityNetcode.SyncWorld(); + } + } + } +} diff --git a/Items/SummonItems/TownPets/TheHousingContract.png b/Items/SummonItems/TownPets/TheHousingContract.png new file mode 100644 index 0000000000..e2b10b4af8 Binary files /dev/null and b/Items/SummonItems/TownPets/TheHousingContract.png differ diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index d07fd537db..844958f74b 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -33,8 +33,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/AggressiveVoucher.png b/Items/Tools/AggressiveVoucher.png new file mode 100644 index 0000000000..a76f8ad580 Binary files /dev/null and b/Items/Tools/AggressiveVoucher.png differ diff --git a/Items/Tools/CombatVoucher.png b/Items/Tools/CombatVoucher.png new file mode 100644 index 0000000000..039206c49d Binary files /dev/null and b/Items/Tools/CombatVoucher.png differ 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/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 056e668089..444ac16aac 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe() - .AddIngredient(12) + .AddIngredient(12) .AddIngredient(ItemID.LunarBar, 10) .AddTile(TileID.LunarCraftingStation) .Register(); diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 73deccfbe7..c586a680e5 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Tools public static float DamageBoost = 0.15f; public static int DefenseBoost = 15; - public static int GraxBoostDuration = CalamityUtils.SecondsToFrames(10); + public static int GraxBoostDuration = CalamityUtils.SecondsToFrames(15); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), DefenseBoost, GraxBoostDuration.FramesToSeconds()); public override void SetStaticDefaults() { diff --git a/Items/Tools/HurriedVoucher.png b/Items/Tools/HurriedVoucher.png new file mode 100644 index 0000000000..92ec38b48c Binary files /dev/null and b/Items/Tools/HurriedVoucher.png differ diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 44429ca5dd..dd8eaa1695 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,14 +16,14 @@ namespace CalamityMod.Items.Tools { Item.width = 80; Item.height = 66; - Item.damage = 110; + Item.damage = 55; Item.crit = 10; Item.knockBack = 7f; Item.useTime = 8; Item.useAnimation = 12; Item.axe = 135 / 5; Item.tileBoost += 1; - + Item.shoot = ProjectileID.Spark; // Dummy argument to ensure it doesn't get set to true melee Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; @@ -31,6 +33,8 @@ namespace CalamityMod.Items.Tools Item.autoReuse = true; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { hitbox = CalamityUtils.FixSwingHitbox(54, 54); @@ -112,7 +116,7 @@ namespace CalamityMod.Items.Tools sparkXSpawn *= (float)player.direction; sparkYSpawn *= player.gravDir; var source = player.GetSource_ItemUse(Item); - int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.2f); + int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.5f); int spark = Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + sparkXSpawn, (float)(hitbox.Y + hitbox.Height / 2) + sparkYSpawn, (float)player.direction * sparkXVel, sparkYVel * player.gravDir, ProjectileID.Spark, damage, 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) Main.projectile[spark].DamageType = DamageClass.Melee; @@ -129,9 +133,10 @@ namespace CalamityMod.Items.Tools if (hit.Crit) { var source = player.GetSource_ItemUse(Item); - int boom = Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (boom.WithinBounds(Main.maxProjectiles)) - Main.projectile[boom].DamageType = DamageClass.Melee; + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, Item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int onHitDamage = player.CalcIntDamage(Item.damage * 0.5f); + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); + blast.DamageType = Item.DamageType; } target.AddBuff(BuffID.OnFire3, 300); } diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 636fbc944a..4e8ffccdb8 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Tools public new string LocalizationCategory => "Items.Tools"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MarniteObliteratorUse") { PitchVariance = 0.3f }; - public static int ArmorPenetration = 5; + public static int ArmorPenetration = 15; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); public override void SetDefaults() diff --git a/Items/Tools/OddVoucher.png b/Items/Tools/OddVoucher.png new file mode 100644 index 0000000000..d406dc4c13 Binary files /dev/null and b/Items/Tools/OddVoucher.png differ diff --git a/Items/Tools/RelicOfResilience.cs b/Items/Tools/RelicOfResilience.cs index af20a97f04..db68a53d8c 100644 --- a/Items/Tools/RelicOfResilience.cs +++ b/Items/Tools/RelicOfResilience.cs @@ -7,6 +7,16 @@ namespace CalamityMod.Items.Tools public class RelicOfResilience : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + public static int baseTimeMax => 300; + public static int maxPowerTime => 1800; + public static int baseCooldown => 900; + public static int baseDefenseFloor => 200; + public static float baseDrFloor => 0.1f; + public static int shardBaseDamage => 180; + public static float orbitDamageMult => 0.2f; + public static int baseMaxShardCount => 30; + public static float maxPowerShardMult => 2; // Applied to number of shards at max power + public static float additionalMaxPowerDefensesMult => 1; // This is added to the base 100% effectiveness public override void SetDefaults() { Item.width = 40; diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 9a969c5485..f92338d42d 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.SunplateBlock, 3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/TheGift.cs b/Items/Tools/TheGift.cs new file mode 100644 index 0000000000..25adf7d117 --- /dev/null +++ b/Items/Tools/TheGift.cs @@ -0,0 +1,190 @@ +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; + +namespace CalamityMod.Items.Tools +{ + public class TheGift : ModItem, ILocalizedModType + { + 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; + Item.height = 20; + Item.maxStack = Item.CommonMaxStack; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.noMelee = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman + Item.rare = ItemRarityID.Green; + } + + public override void Load() + { + On_ShopHelper.ProcessMood += TheGiftHappiness; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + // Controls actually applying the effect to an NPC + // None of this should work in Remix because Remix disables happiness + bool localGiftCollisionCheck = Main.netMode == NetmodeID.SinglePlayer || Item.playerIndexTheItemIsReservedFor == Main.myPlayer; + if (Item.noGrabDelay <= 0 && !Main.remixWorld && localGiftCollisionCheck) + { + foreach (NPC n in Main.ActiveNPCs) + { + if (!CanApplyToNPC(n)) + continue; + + if (Item.Hitbox.Intersects(n.Hitbox)) + { + if (Main.netMode == NetmodeID.SinglePlayer) + TryApplyGift(Item, n); + else if (Main.netMode == NetmodeID.MultiplayerClient) + RequestApplyTheGiftPacket.Send(Item, n); + + // Make sure it can't apply to multiple NPCs at once + break; + } + } + } + } + + // Also contains logic for The Monument, so I can make sure these apply in the correct order + private static void TheGiftHappiness(On_ShopHelper.orig_ProcessMood orig, ShopHelper self, Player player, NPC npc) + { + 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 || !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.AffectedByTheMonument) + { + float oldHappiness = self._currentPriceAdjustment; + self._currentPriceAdjustment += TheMonument.MonumentHappinessReduction; + self.LimitAndRoundMultiplier(self._currentPriceAdjustment); + string dialogueKey; + if (npc.type < NPCID.Count) + { + dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.Monument"; + // Zoologist has separate dialogue when transformed + if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope()) + dialogueKey += "Transformed"; + } + else + { + var modNPC = NPCLoader.GetNPC(npc.type); + dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.Monument"; + } + + // If the NPC is content, it should override that text because they are no longer content + if (oldHappiness == 1f) + self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " "; + else + self._currentHappiness += Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " "; + } + + // The Gift sets happiness to a fixed either extremely high or extremely low value, depending on its random state. + bool? gift = gtnpc.TheGiftStatus; + if (gift.HasValue) + { + if (gift.Value) + self._currentPriceAdjustment = 0.5f; + else + self._currentPriceAdjustment = 1.75f; + + string locKey = gift.Value ? "GiftPositive" : "GiftNegative"; + string dialogueKey; + if (npc.type < NPCID.Count) + { + dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.{locKey}"; + // Zoologist has separate dialogue when transformed + if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope()) + dialogueKey += "Transformed"; + } + else + { + var modNPC = NPCLoader.GetNPC(npc.type); + dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.{locKey}"; + } + // Yes, it's intentional that this completely overrides all other happiness report dialogue + self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue($"Vanilla.TownNPCMood.Default{locKey}") + " "; + } + } + } +} diff --git a/Items/Tools/TheGift.png b/Items/Tools/TheGift.png new file mode 100644 index 0000000000..c3a8480e60 Binary files /dev/null and b/Items/Tools/TheGift.png differ diff --git a/Items/Tools/TinkerersVoucher.cs b/Items/Tools/TinkerersVoucher.cs new file mode 100644 index 0000000000..4bdb04a8d8 --- /dev/null +++ b/Items/Tools/TinkerersVoucher.cs @@ -0,0 +1,395 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Prefixes; +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public static class VoucherReforgeSystem + { + public static int ForcedPrefix = -1; + public static bool RollWon = false; + } + + public class VoucherGlobalItem : GlobalItem + { + public override void PreReforge(Item item) + { + Player player = Main.LocalPlayer; + bool isAccessory = item.accessory; + + VoucherReforgeSystem.ForcedPrefix = -1; + + for (int i = 0; i < player.inventory.Length; i++) + { + Item invItem = player.inventory[i]; + + if (invItem.ModItem is VoucherItem voucher) + { + if (voucher.IsUsableVoucher(player, item, isAccessory)) + { + VoucherReforgeSystem.ForcedPrefix = voucher.GetPrefixForItem(player, item, isAccessory); + + invItem.stack--; + if (invItem.stack <= 0) + invItem.TurnToAir(); + + if (Main.netMode != NetmodeID.Server) + { + if (VoucherReforgeSystem.RollWon) + { + for (int dustCount = 0; dustCount < 8; dustCount++) + { + // Light dust and sparks + Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f); + Vector2 dustVel = (sparkVel).SafeNormalize(Vector2.UnitY).RotatedBy(Main.rand.Next(100)) * Main.rand.NextFloat(1f, 15f); + Vector2 fxPos = player.Center + sparkVel; + Color fxColor = Color.Lerp(Color.MediumAquamarine, Color.MediumSeaGreen, Main.rand.NextFloat(1f)); + + Particle fx = new CustomSpark(fxPos, sparkVel, "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(30, 60)), Main.rand.NextFloat(1.3f, 1.8f), fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f)); + GeneralParticleHandler.SpawnParticle(fx); + + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.8f, 1.6f)); + dust.noGravity = true; + dust.color = fxColor; + + + // Crit sparkles + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(1f, 25f); + Color color = Main.rand.NextBool() ? Color.LightBlue : Color.LightSkyBlue; + + Particle sparkle = new CritSpark(player.MountedCenter, velocity, color, bloom: Color.Cyan, scale: 1f, lifeTime: Main.rand.Next(15, 60)); + GeneralParticleHandler.SpawnParticle(sparkle); + } + + SoundEngine.PlaySound(SoundID.Item4, player.position); + } + else + { + 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(player.MountedCenter, velocity, smokeStart, smokeEnd, smokeSize, Main.rand.Next(90, 140)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + Particle skull = new DesertProwlerSkullParticle(player.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.Item16, player.position); + } + } + break; + } + } + } + } + } + + public abstract class VoucherItem : ModItem + { + #region CyclePrefixes + protected virtual int[] prefixChoices => Array.Empty(); + protected int chosenPrefix = 0; + public override void ModifyTooltips(List tooltips) + { + string selected = GetSelectedPrefixName(); + string all = GetAllPrefixNames(); + + foreach (var line in tooltips) + { + if (line.Mod == "Terraria" && line.Name.StartsWith("Tooltip")) + { + line.Text = line.Text + .Replace("{0}", selected) + .Replace("{1}", all); + } + } + } + + public string GetAllPrefixNames() + { + var pool = prefixChoices; + if (pool.Length == 0) + return null; + + List names = new(); + + foreach (int p in pool) + { + if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null) + names.Add(Lang.prefix[p].Value); + } + + return string.Join(", ", names); + } + + public string GetSelectedPrefixName() + { + var pool = prefixChoices; + if (pool.Length == 0) + return null; + + int p = pool[chosenPrefix]; + + if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null) + return Lang.prefix[p].Value; + + return null; + } + #endregion + + public bool IsUsableVoucher(Player player, Item itemBeingReforged, bool isAccessory) + { + return Item.favorited && CanApply(player, itemBeingReforged, isAccessory); + } + + public override bool CanRightClick() => Main.keyState.PressingShift(); + + public override void RightClick(Player player) + { + if (prefixChoices.Length == 0) + return; + + chosenPrefix++; + if (chosenPrefix >= prefixChoices.Length) + chosenPrefix = 0; + + Item.NetStateChanged(); + } + + public override bool ConsumeItem(Player player) => false; + + public override void NetSend(BinaryWriter writer) + { + writer.Write(chosenPrefix); + } + + public override void NetReceive(BinaryReader reader) + { + chosenPrefix = reader.ReadInt32(); + } + + public virtual bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return true; + } + + public virtual int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory) + { + if (prefixChoices.Length == 0) + return -1; + + if (isAccessory) + { + if (Main.rand.NextBool()) + { + VoucherReforgeSystem.RollWon = true; + return prefixChoices[chosenPrefix]; + } + else + { + VoucherReforgeSystem.RollWon = false; + return ModContent.PrefixType(); + } + } + + VoucherReforgeSystem.RollWon = true; + return prefixChoices[chosenPrefix]; + } + } + + public class CombatVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return !isAccessory; + } + + public override int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory) + { + int prefix = -1; + var category = itemBeingReforged.GetPrefixCategories(); + + if (!category.Any()) + return -1; + + if ((itemBeingReforged).knockBack == 0f) // Weapons which do not apply knockback universally have demonic as their best reforge + prefix = PrefixID.Demonic; + + else if (itemBeingReforged.CountsAsClass() && itemBeingReforged.type != ModContent.ItemType()) + { + bool weirdMelee = !category.Contains(PrefixCategory.Melee); // Weapons which deal melee damage but cannot recieve melee prefixes because Item.noUseGraphic is true + + if (weirdMelee || itemBeingReforged.CountsAsClass()) + prefix = PrefixID.Godly; + else + prefix = PrefixID.Legendary; + } + else if (itemBeingReforged.CountsAsClass() || itemBeingReforged.type == ModContent.ItemType()) + prefix = PrefixID.Unreal; + else if (itemBeingReforged.CountsAsClass()) + prefix = PrefixID.Mythical; + else if (itemBeingReforged.CountsAsClass()) + prefix = ModContent.PrefixType(); + else if (itemBeingReforged.CountsAsClass()) + prefix = itemBeingReforged.IsWhip() ? PrefixID.Legendary : PrefixID.Ruthless; + + else // Fallback case + prefix = PrefixID.Godly; + + if (Main.rand.NextBool()) + { + VoucherReforgeSystem.RollWon = true; + return prefix; + } + else + { + VoucherReforgeSystem.RollWon = false; + return ModContent.PrefixType(); + } + } + } + + public class AggressiveVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Jagged, + PrefixID.Angry, + PrefixID.Spiked, + PrefixID.Menacing, + PrefixID.Precise, + PrefixID.Lucky + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class UnbreakableVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Hard, + PrefixID.Armored, + PrefixID.Guarding, + PrefixID.Warding, + ModContent.PrefixType(), + ModContent.PrefixType() + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class HurriedVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Brisk, + PrefixID.Fleeting, + PrefixID.Hasty2, + PrefixID.Quick2 + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class OddVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Arcane, + PrefixID.Wild, + PrefixID.Rash, + PrefixID.Intrepid, + PrefixID.Violent, + ModContent.PrefixType() + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } +} diff --git a/Items/Tools/UnbreakableVoucher.png b/Items/Tools/UnbreakableVoucher.png new file mode 100644 index 0000000000..bab18aaed6 Binary files /dev/null and b/Items/Tools/UnbreakableVoucher.png differ diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 99ac145eee..a7e47e03ea 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Tools @@ -10,12 +11,15 @@ namespace CalamityMod.Items.Tools public class WulfrumDrill : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + public static int ArmorPenetration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); public override void SetDefaults() { Item.width = 46; Item.height = 38; Item.damage = 5; Item.DamageType = DamageClass.Melee; + Item.ArmorPenetration = ArmorPenetration; Item.pick = 35; Item.tileBoost += 1; Item.useAnimation = 16; diff --git a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index 8ae7e117cf..e37abd0f63 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -17,18 +17,11 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Adamantite"; - public const int MaxManaBoost = 20; public const int DefenseBoostMax = 10; public const int TimeUntilDecayBeginsAfterAttacking = 60; public const int TimeUntilBoostCompletelyDecays = 210; // Unlisted use: this is also the amount of hits to max out defense. public const int CritToDRConversionPercent = 25; - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.AdamantiteHeadgear) - player.statManaMax2 += MaxManaBoost; - } - public override void UpdateSetBonusText(ref string setBonusText) { Player player = Main.LocalPlayer; diff --git a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs index d8cd7c5c0f..b4441ddbcd 100644 --- a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs @@ -18,16 +18,9 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Cobalt"; public const int SpeedBoostSetBonusPercentage = 10; - public const int MaxManaBoost = 20; public const int MovementSpeedBoostPercentageMax = 10; public const int MovementSpeedBoostMphThreshold = 80; - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.CobaltHat) - player.statManaMax2 += MaxManaBoost; - } - public override void UpdateSetBonusText(ref string setBonusText) { Player player = Main.LocalPlayer; 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/MythrilArmorSetChange.cs b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs index 5ed1269dab..ac878db015 100644 --- a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Mythril"; - public const int MaxManaBoost = 20; public const int FlareFrameSpawnDelay = 12; public const int FlareDamageSoftcap = 40; @@ -27,12 +26,6 @@ namespace CalamityMod.Items.VanillaArmorChanges setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(FlareFrameSpawnDelay)}"; } - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.MythrilHood) - player.statManaMax2 += MaxManaBoost; - } - public override void ApplyArmorSetBonus(Player player) { player.Calamity().MythrilSet = true; diff --git a/Items/Weapons/AstralGelStaff.png b/Items/Weapons/AstralGelStaff.png deleted file mode 100644 index 0a59b58a09..0000000000 Binary files a/Items/Weapons/AstralGelStaff.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 6aa71e69b2..3e47eb756f 100644 --- a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -9,6 +9,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal @@ -21,6 +22,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public static readonly SoundStyle Sound1 = new("CalamityMod/Sounds/Item/ShrimpSound1"); public static readonly SoundStyle Sound2 = new("CalamityMod/Sounds/Item/ShrimpSound2"); public static readonly SoundStyle Surprise = new("CalamityMod/Sounds/Item/ShrimpSurprise"); + + public static int ArmorPenetration = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration); + public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); @@ -29,6 +34,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 32; Item.shootSpeed = 10f; Item.damage = 24; + Item.ArmorPenetration = ArmorPenetration; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/DraedonsArsenal/Auger.cs b/Items/Weapons/DraedonsArsenal/Auger.cs index 6f20e1189a..f7ce73b68d 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 = 68; + Item.damage = 60; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTime = Item.useAnimation = 12; Item.knockBack = 12f; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 7520d358ee..a7d095df89 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -33,10 +33,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Magic; Item.damage = 705; Item.knockBack = 7f; - Item.useTime = 45; - Item.useAnimation = 45; + Item.useAnimation = Item.useTime = 45; Item.autoReuse = true; - Item.mana = 24; + Item.mana = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 45033681b3..73226ea694 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -24,10 +24,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Magic; Item.damage = 42; Item.knockBack = 3f; - Item.useTime = 64; - Item.useAnimation = 64; + Item.useAnimation = Item.useTime = 64; Item.autoReuse = true; - Item.mana = 15; + Item.mana = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = PulseRifle.FireSound with { Pitch = 0.3f, Volume = 0.7f }; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 4abbc9858a..6745f8807d 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 10f; Item.useTime = Item.useAnimation = 90; Item.autoReuse = true; - Item.mana = 60; + Item.mana = 120; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; 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 bc02df607b..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,13 +12,17 @@ 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; Item.height = 32; - Item.damage = 27; + Item.damage = 30; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 14; Item.useAnimation = Item.useTime = 19; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 002238f231..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,14 +14,18 @@ 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; Item.height = 28; - Item.damage = 28; + Item.damage = 18; Item.DamageType = DamageClass.Magic; - Item.mana = 9; - Item.useAnimation = Item.useTime = 45; + Item.mana = 12; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; 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 ee0ed26f78..9789aa3161 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -28,9 +28,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 74; Item.damage = 150; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 12; - Item.useAnimation = 12; + Item.mana = 16; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.2f; diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 2bf63f0bd7..7f6cb2cda0 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 17; - Item.useAnimation = 17; + Item.mana = 15; + Item.useAnimation = Item.useTime = 17; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; 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/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs index 799f6e63bc..71c021eeaa 100644 --- a/Items/Weapons/Magic/Apathanull.cs +++ b/Items/Weapons/Magic/Apathanull.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 63; Item.DamageType = DamageClass.Magic; Item.crit = 12; - Item.mana = 20; + Item.mana = 26; Item.useTime = 8; Item.useAnimation = 20; Item.reuseDelay = 8; @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(9). + AddIngredient(18). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index db3036dc29..2052a2ec6f 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 40; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.useAnimation = 5; - Item.useTime = 5; + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 6f; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 278a72e01e..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,13 +16,18 @@ 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; Item.height = 34; Item.damage = 222; Item.DamageType = DamageClass.Magic; - Item.mana = 42; + Item.mana = 277; Item.useAnimation = Item.useTime = 167; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index a5eab40668..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; @@ -23,15 +25,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 84; Item.damage = 17; Item.DamageType = DamageClass.Magic; - Item.mana = 3; - Item.useTime = 22; - Item.useAnimation = 22; + Item.mana = 10; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; 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; @@ -39,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/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 654f269409..60dcbb5cbb 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 68; Item.damage = 58; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 23; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; 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/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index b16f045350..48eedfc601 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -16,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 70; - Item.damage = 80; + Item.damage = 120; Item.DamageType = DamageClass.Magic; - Item.mana = 20; + Item.mana = 60; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,6 +35,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.Calamity().donorItem = true; } + // Cancels out the mana used to summon the holdout + public override void OnConsumeMana(Player player, int manaConsumed) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.statMana += manaConsumed; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index a4338c8a20..ed1cac00a0 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -21,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 55; Item.DamageType = DamageClass.Magic; - Item.mana = 19; - Item.useTime = 21; - Item.useAnimation = 21; + Item.mana = 16; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 9aaf1df0bd..4a6587427b 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 81; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 15; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; 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 f9e5d70960..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,14 +15,17 @@ 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; Item.height = 22; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 16; Item.useTime = 12; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index 3c40c780a5..366922308f 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -14,11 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 38; - Item.damage = 21; + Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 9; - Item.useTime = 18; - Item.useAnimation = 18; + Item.mana = 13; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 53bf0748d8..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() @@ -23,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 50; Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 12; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 3baf578096..4521a1989a 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() @@ -20,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 45; Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.useTime = 16; - Item.useAnimation = 16; + Item.mana = 12; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 91257ae1d1..30a9db9b37 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,11 +17,17 @@ 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; Item.height = 30; - Item.damage = 69; + Item.damage = 56; Item.DamageType = DamageClass.Magic; Item.mana = 8; Item.useTime = 20; diff --git a/Items/Weapons/Magic/ChronomancersScythe.cs b/Items/Weapons/Magic/ChronomancersScythe.cs index 7785365ef0..33b9019373 100644 --- a/Items/Weapons/Magic/ChronomancersScythe.cs +++ b/Items/Weapons/Magic/ChronomancersScythe.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = false; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item71; - Item.mana = 10; + Item.mana = 30; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; 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/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index 29915efe9f..495e00f293 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -25,9 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 9; Item.DamageType = DamageClass.Magic; - Item.mana = 7; - Item.useTime = 26; - Item.useAnimation = 26; + Item.mana = 30; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index cb6f719579..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,15 +10,18 @@ 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; Item.height = 34; Item.damage = 96; Item.DamageType = DamageClass.Magic; - Item.mana = 18; - Item.useTime = 40; - Item.useAnimation = 40; + Item.mana = 22; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index ed3956944a..a7bd4d6d42 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 16; Item.damage = 60; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 12; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); 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 6eb2576e61..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,13 +12,17 @@ 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; Item.height = 60; Item.damage = 943; Item.DamageType = DamageClass.Magic; - Item.mana = 30; + Item.mana = 90; Item.useTime = 10; Item.useAnimation = 30; Item.reuseDelay = 40; diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index f3c14ab5b0..cbd9a58959 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 180; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 18; - Item.useAnimation = 18; + Item.mana = 24; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index db855f0b79..fefa3f26ea 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 32; Item.DamageType = DamageClass.Magic; Item.crit = 5; - Item.mana = 7; + Item.mana = 13; Item.useTime = 7; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 39d89390ce..913475841f 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; - Item.mana = 30; + Item.mana = 300; Item.useAnimation = Item.useTime = 120; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 70401af4c4..3215eaa9db 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 46; - Item.damage = 70; + Item.damage = 120; Item.knockBack = 3.5f; Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.mana = 12; + Item.mana = 45; - Item.useAnimation = Item.useTime = 32; + Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index 6bbe8845ab..22b05cc0fe 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; diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index bff3fc20e7..58678eb19e 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 50; Item.damage = 130; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 5; - Item.useAnimation = 10; + Item.mana = 14; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -40,21 +39,6 @@ namespace CalamityMod.Items.Weapons.Magic public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.useTime = 20; - Item.useAnimation = 20; - } - else - { - Item.useTime = 5; - Item.useAnimation = 10; - } - return base.CanUseItem(player); - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) @@ -64,19 +48,9 @@ namespace CalamityMod.Items.Weapons.Magic } else { - int note = Main.rand.Next(2); - if (note == 0) - { - damage = (int)(damage * 1.5f); - type = ModContent.ProjectileType(); - } - else - { - velocity.X *= 1.5f; - velocity.Y *= 1.5f; - type = ModContent.ProjectileType(); - } - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + Vector2 offset = velocity.SafeNormalize(Vector2.UnitX) * 8f; + Projectile.NewProjectile(source, position + offset.RotatedBy(MathHelper.PiOver2), velocity, type, (int)(damage * 1.5f), knockback, player.whoAmI); + Projectile.NewProjectile(source, position + offset.RotatedBy(-MathHelper.PiOver2), velocity * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 26f28c4056..4250819277 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 120; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = 16; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; @@ -66,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Magic } realPlayerPos += new Vector2(mouseXDist, mouseYDist); - int numProjectiles = 5; + int numProjectiles = 6; for (int i = 0; i < numProjectiles; i++) { realPlayerPos.X += (float)Main.rand.Next(-100, 101); diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 2dfac6fc97..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,15 +11,18 @@ 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; Item.height = 38; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 80; - Item.useAnimation = 80; + Item.mana = 40; + Item.useAnimation = Item.useTime = 80; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 7bdd5e22e0..4a8289e334 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; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index c88eaef054..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() { @@ -27,9 +29,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 95; Item.DamageType = DamageClass.Magic; - Item.mana = 13; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; 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/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index 1e24726a97..cfa6466d6a 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 20; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 36; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index f3806aa889..56a4cd3c5b 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 53; Item.DamageType = DamageClass.Magic; - Item.mana = 11; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 15; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index fa31df187f..899d39a098 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -9,16 +9,18 @@ namespace CalamityMod.Items.Weapons.Magic public class GloriousEnd : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int PlayerExplosionDmgMin = 60; - public static int PlayerExplosionDmgMax = 80; + + // Scales with difficulty (Expert: 60-80) + public static int PlayerExplosionDmgMin = 30; + public static int PlayerExplosionDmgMax = 40; public override void SetDefaults() { Item.width = 30; Item.height = 58; - Item.damage = 100; + Item.damage = 60; Item.knockBack = 10f; Item.useAnimation = Item.useTime = 30; - Item.mana = 20; + Item.mana = 60; Item.DamageType = DamageClass.Magic; Item.channel = true; Item.shootSpeed = 7f; diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 2e56c3fd15..d5be533bb1 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 400; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 30; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -29,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 356a140f32..aa0592be55 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.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; @@ -23,14 +25,21 @@ 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; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 5100; + Item.damage = 3000; Item.knockBack = 9.5f; - Item.mana = 80; + Item.mana = 120; Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.autoReuse = true; Item.noMelee = true; 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/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 1a4654ad88..8d9e965715 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -21,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 22; Item.DamageType = DamageClass.Magic; - Item.mana = 7; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 10; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 6b23620bef..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() { @@ -23,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.useStyle = ItemUseStyleID.HoldUp; Item.DamageType = DamageClass.Magic; - Item.mana = 180; + Item.mana = 300; Item.noMelee = true; Item.UseSound = CastSound; 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 5b4f710290..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() @@ -23,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.crit = 25; - Item.mana = 15; + Item.mana = 25; Item.useTime = 2; Item.useAnimation = 30; Item.reuseDelay = Item.useAnimation + 6; diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index 8126a4a72f..8ed8097342 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Items.Weapons.Magic public class IonBlaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public static int ArmorPenetration = 40; + public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; @@ -20,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 68; Item.height = 38; Item.damage = 24; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Magic; Item.mana = 12; Item.useAnimation = 7; diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index 7da3eaaf27..1c05db456a 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -1,7 +1,9 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,15 +19,18 @@ namespace CalamityMod.Items.Weapons.Magic public int FiringMode = 0; // 0 = hellfireballs, 1 = hellblasts public int ProjectilesFired = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 111; + Item.damage = 130; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 46; - Item.useAnimation = 46; + Item.mana = 28; + Item.useAnimation = Item.useTime = 46; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; @@ -33,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 11f; + Item.shootSpeed = 14f; } // Shoots twice as fast (and uses half as much mana to compensate) during hellblasts diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index c3a329728b..f08a786564 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 78; Item.damage = 200; Item.DamageType = DamageClass.Magic; - Item.mana = 32; - Item.useTime = 37; - Item.useAnimation = 37; + Item.mana = 45; + Item.useAnimation = Item.useTime = 37; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 79a5e5bdbf..09233ac96a 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 38; Item.damage = 20; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 38; - Item.useAnimation = 38; + Item.mana = 15; + Item.useAnimation = Item.useTime = 38; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index e2d1fb0d40..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() @@ -22,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 64; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 16; + Item.mana = 22; Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index 426c3841ea..f9fd80822b 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -20,11 +20,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 48; Item.height = 48; - Item.damage = 54; + Item.damage = 59; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 6; - Item.useAnimation = 6; + Item.mana = 7; + Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 00b99ac405..b83032ebf9 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 124; Item.damage = 530; Item.DamageType = DamageClass.Magic; - Item.mana = 70; + Item.mana = 120; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = null; diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 7cdb460325..89b098e73e 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 20; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 15; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index 8dddf82b8d..53f67402a2 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = 108; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 30; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index 76e953984c..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() @@ -24,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 116; Item.damage = 70; Item.DamageType = DamageClass.Magic; - Item.mana = 18; + Item.mana = 30; Item.useTime = 4; Item.useAnimation = 16; Item.reuseDelay = 14; diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 551aecb37b..fe5f1c9c71 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 80; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 15; Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(10). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index ecae376a81..5a87c385ae 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = Item.height = 52; Item.damage = 12; Item.knockBack = 3f; - Item.mana = 10; + Item.mana = 12; Item.useAnimation = Item.useTime = 35; Item.autoReuse = true; Item.DamageType = DamageClass.Magic; diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 3c3c0b7f3f..bb4bbb35b7 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 80; + Item.mana = 120; Item.useTime = 3; Item.useAnimation = 45; Item.reuseDelay = 75; diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 1d915a0feb..2bfd0561cf 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 140; Item.damage = 140; Item.DamageType = DamageClass.Magic; - Item.mana = 35; + Item.mana = 40; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index c1bb33dcf2..d6192eacb9 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 32; Item.damage = 52; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 49; - Item.useAnimation = 49; + Item.mana = 30; + Item.useAnimation = Item.useTime = 49; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 7f76b27f3f..883e202d33 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 3825; Item.DamageType = DamageClass.Magic; - Item.mana = 95; + Item.mana = 104; Item.useTime = Item.useAnimation = 72; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index f0f2663dd6..40fa87bb55 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int BuffDefenseBoost = 12; + public static int BuffDefenseBoost = 4; public static float BuffDamageBoost = 0.12f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDefenseBoost, BuffDamageBoost.ToPercent()); diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index e75ae3fdfe..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,15 +15,18 @@ 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; Item.height = 48; Item.damage = 152; Item.DamageType = DamageClass.Magic; - Item.mana = 50; - Item.useTime = 38; - Item.useAnimation = 38; + Item.mana = 14; + Item.useAnimation = Item.useTime = 38; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,6 +39,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + + // Cancels out the mana used to summon the holdout + public override void OnConsumeMana(Player player, int manaConsumed) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.statMana += manaConsumed; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 49abe53755..bb50e67103 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 170; Item.DamageType = DamageClass.Magic; - Item.mana = 25; + Item.mana = 60; Item.crit += 4; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index c18625be66..cc4ed7049d 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -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 96af4794a6..171a1c539b 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -18,11 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 60; Item.crit = 20; - Item.mana = 17; + Item.mana = 22; Item.noMelee = true; - Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 22; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item8; Item.autoReuse = true; 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 f7fa8e662f..3c886885ef 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 117; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 30; Item.useAnimation = Item.useTime = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index f4cb2ed872..fcd7ce5a95 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 16; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 7; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 90da4ae001..f712d13968 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() @@ -24,8 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 1050; Item.DamageType = DamageClass.Magic; Item.mana = 36; - Item.useTime = 25; - Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.channel = true; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 45cd4e9c0e..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,15 +16,18 @@ 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; Item.height = 32; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 60; - Item.useAnimation = 60; + Item.mana = 30; + Item.useAnimation = Item.useTime = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 2a9e1ff387..24722773df 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 10; Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 35; - Item.useAnimation = 35; + Item.mana = 22; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index 1858eb3dc1..ffcb99ec1f 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() { @@ -21,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 40; Item.useTime = 7; Item.useAnimation = 14; Item.reuseDelay = 49; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 8fc506cf8e..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,14 +31,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 = Item.height = 42; Item.damage = 19; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 14; Item.useAnimation = Item.useTime = 34; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index f5639d3e79..d5699749e6 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 285; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 72; Item.useTime = 8; Item.useAnimation = 24; Item.reuseDelay = 30; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 71f95c4283..df373ff41f 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; 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 cc5d6061da..cfe95212aa 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,11 +22,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 74; - Item.damage = 8; + Item.damage = 11; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 9; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index 64ddf0ec5d..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,13 +12,17 @@ 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; Item.height = 40; Item.damage = 50; Item.DamageType = DamageClass.Magic; - Item.mana = 11; + Item.mana = 20; Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 674b3ffb97..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; @@ -15,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 39; Item.DamageType = DamageClass.Magic; Item.channel = true; - Item.mana = 18; - Item.useTime = 70; - Item.useAnimation = 70; + Item.mana = 40; + Item.useAnimation = Item.useTime = 70; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 52b15901ca..df63864e59 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() @@ -24,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 64; Item.damage = 235; Item.DamageType = DamageClass.Magic; - Item.mana = 19; + Item.mana = 30; Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index c6784b6a12..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() @@ -51,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 7f; - Item.mana = 22; + Item.mana = 28; Item.knockBack = 5f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs index ec5fdb3816..48bfd4d5f2 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(). 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 065b00b449..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() { @@ -31,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 60; Item.knockBack = 8f; - Item.mana = 18; + Item.mana = 30; Item.UseSound = SoundID.DD2_MonkStaffSwing; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 9f50835ece..620409269f 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 515; Item.DamageType = DamageClass.Magic; Item.crit = 20; - Item.mana = 6; + Item.mana = 26; Item.knockBack = 4f; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index 7aec53e0f5..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,18 +18,19 @@ 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 = 102; Item.height = 112; - Item.damage = 166; + Item.damage = 180; Item.knockBack = 4.25f; Item.shootSpeed = 23.5f; Item.DamageType = DamageClass.Magic; Item.noMelee = true; - Item.mana = 12; + Item.mana = 16; Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; 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 4a02a8674c..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,14 +20,15 @@ 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.mana = 150; + Item.damage = 1; + Item.mana = 200; Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.useAnimation = 19; @@ -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/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index d948d7f944..0b35898e83 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 68; Item.damage = 120; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 27; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 7a665800ad..c99d7ec652 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 23; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 6; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; @@ -31,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(7). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 79819761d0..1569a747dc 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(ItemID.AquaScepter). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 3b0c0a2a62..2213a85c36 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() diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 10aff81ac9..f9ec35fb43 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() 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 63c8f0dcad..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,13 +16,14 @@ 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() { Item.width = 28; Item.height = 32; - Item.damage = 19; + Item.damage = 16; Item.DamageType = DamageClass.Magic; Item.mana = 14; Item.useAnimation = Item.useTime = 36; diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 0e330fb229..05bffd9f68 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 44; Item.damage = 6666; Item.DamageType = DamageClass.Magic; - Item.mana = 41; + Item.mana = 120; Item.useAnimation = Item.useTime = 43; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index ea4d77de37..c98dcc9c6a 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -1,6 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,17 +18,17 @@ 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 = 70; Item.height = 68; - Item.damage = 2800; + Item.damage = 1150; Item.DamageType = DamageClass.Magic; - Item.mana = 40; - Item.useTime = 65; - Item.useAnimation = 65; + Item.mana = 90; + Item.useAnimation = Item.useTime = 65; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index c5095b7d93..1bf3fc164f 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 62; - Item.damage = 50; - Item.mana = 7; + Item.damage = 55; + Item.mana = 8; Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 15; Item.noMelee = true; diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 82854d3c88..b7e8e976c7 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; diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index a384441b9a..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,13 +14,17 @@ 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; Item.height = 62; Item.damage = 2626; //Some kind of... brainstorm Item.DamageType = DamageClass.Magic; - Item.mana = 45; + Item.mana = 60; Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 25647e0b5a..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,15 +23,16 @@ 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 = 140; Item.height = 140; - Item.damage = 133; + Item.damage = 162; Item.DamageType = DamageClass.Magic; - Item.mana = 42; + Item.mana = 54; Item.useTime = 4; Item.useAnimation = 20; Item.reuseDelay = Item.useAnimation; diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 8c0e9cfa2a..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() @@ -25,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 130; Item.damage = 210; Item.DamageType = DamageClass.Magic; - Item.mana = 60; + Item.mana = 70; Item.useAnimation = Item.useTime = 49; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 2f20bd1f80..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() @@ -26,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 78; Item.damage = 215; Item.DamageType = DamageClass.Magic; - Item.mana = 32; + Item.mana = 45; Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index 8ce8aee871..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,13 +14,17 @@ 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; Item.height = 60; Item.damage = 890; Item.DamageType = DamageClass.Magic; - Item.mana = 50; + Item.mana = 90; Item.useAnimation = Item.useTime = 80; // 42 frames of firing animation Item.knockBack = 2f; Item.shoot = ModContent.ProjectileType(); 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/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index b083e19c88..e5e24a1386 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 82; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 8; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; 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/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 1028f4af5a..adbbc94821 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -32,9 +32,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 18; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 10; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index 67b618de61..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() @@ -22,9 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 74; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 14; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.75f; diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index d2173baeb2..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,13 +14,17 @@ 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; Item.height = 16; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 15; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); 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..3a8120a2be 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,6 +13,10 @@ 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; diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 3c03fb9b15..4d88c54792 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(7). 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..e3c51d2339 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; diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 4dc95aa92f..13cd093f00 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,6 +51,10 @@ namespace CalamityMod.Items.Weapons.Melee parryTooltip.OverrideColor = Color.Orange; } } + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index 475588999f..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,15 +12,18 @@ 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; Item.height = 10; - Item.damage = 28; + Item.damage = 25; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 99890c2b25..50c00db006 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,11 +14,15 @@ 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; Item.height = 60; - Item.damage = 85; + Item.damage = 65; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index 978212c6eb..1a5f7aa014 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 = 65; 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; } diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index a84839d1e6..c193ac8313 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,7 +12,10 @@ 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; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 39a841fea3..f8cb726434 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; 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/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index d290ff5246..886968018d 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 54; Item.damage = 32; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 21; + Item.useAnimation = Item.useTime = 24; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5.5f; 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/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..ba39ea2a6e 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; diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index de1086891f..f09743e25f 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.BlueMoon). AddIngredient(8). AddIngredient(3). AddIngredient(16). diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 62b7bcfe59..25fd6b6150 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; @@ -23,6 +25,10 @@ namespace CalamityMod.Items.Weapons.Melee 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() { 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..66e1955b04 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,6 +22,10 @@ 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() { 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..76da84fb72 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,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 = 118; diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index e9c89a9a0c..803e40bb4d 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() { diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index 7a99bb4606..b1b62226f8 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,11 +14,15 @@ 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; Item.height = 90; - Item.damage = 200; + Item.damage = 350; Item.DamageType = DamageClass.Melee; Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 3b7300228c..9b8f4af53d 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 128; Item.height = 140; - Item.damage = 1075; + Item.damage = 888; Item.knockBack = 7.5f; Item.useAnimation = Item.useTime = 25; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 24d310a7ab..bad5ef2a16 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; 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/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 8316a87785..6fa77ead69 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -90,8 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee Particle spark3 = new AltSparkParticle(partPos, partVel, false, 24, partScale, Color.Black); GeneralParticleHandler.SpawnParticle(spark3); Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); @@ -104,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 7d6a21fa2c..2154aef30e 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; 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..101b4ff14d 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; 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..4415eec8c9 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,8 +12,11 @@ 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; diff --git a/Items/Weapons/Melee/FaultLine.cs b/Items/Weapons/Melee/FaultLine.cs index 28a6fd39e3..51436cd0e4 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() diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 4822393f51..62e01c0075 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; diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 05ef94c203..259086b8b5 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,6 +11,10 @@ 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; diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 1f474602f8..c98f63055c 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; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index dd45adfed8..71bccf18c8 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -14,19 +14,19 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; // Weapon attribute constants - public static readonly int BaseDamage = 690; - public static readonly float GiantSkullDamageMultiplier = 1.7f; - + public static int BaseDamage => 850; + public static float GiantSkullDamageMultiplier => 2.0f; + // Weapon projectile attribute constants - public static readonly int SearchDistance = 1450; - public static readonly int ImmunityFrames = 10; + public static int SearchDistance => 1450; + public static int ImmunityFrames => 10; // Skull ring attribute constants - public static readonly float SkullsplosionDamageMultiplier = 1.5f; + public static float SkullsplosionDamageMultiplier => 1.5f; internal static string SkullsplosionEntitySourceContext => "GaelsGreatswordRageSkullsplosion"; // Rage gain attribute constant - public static readonly float RagePerSecond = 0.025f; // 2.5% rage per second + public static float RagePerSecond => 0.025f; // 2.5% rage per second //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 9fbcb94c5e..623a1e3b37 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -132,7 +132,10 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.StarWrath). AddIngredient(10). - AddIngredient(5). + 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 eba0964390..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,13 +17,17 @@ 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() { Item.width = 86; Item.height = 72; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 1180; + Item.damage = 1100; Item.knockBack = 14f; Item.useTime = Item.useAnimation = 48; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 108b448374..0f9a59b975 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 44; Item.useStyle = ItemUseStyleID.Rapier; Item.damage = 600; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 8; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index bae656ef03..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; @@ -15,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; base.SetStaticDefaults(); CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; } diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index cd2cf73cb4..4ae1af9abe 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(ItemID.SunplateBlock, 4). + AddIngredient(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index c22652b727..2adf365c8e 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 3777; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( + Item.damage = 5777; // 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; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 3b5ced3498..38d7b0ff16 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 515; + Item.damage = 360; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 35; Item.useTime = 35; diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index cc8e3162bd..b6d84eb778 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnProj = true; public bool spawnTrueMeleeProj = true; public bool playSound = true; + public float scaling = 1; public Color clr = Color.MediumOrchid; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 78; Item.height = 78; - Item.damage = 310; + Item.damage = 280; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 20; @@ -48,10 +49,14 @@ namespace CalamityMod.Items.Weapons.Melee { return false; } + public override void ModifyItemScale(Player player, ref float scale) + { + scale = scaling = player.GetMeleeScale(); + } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC - float scale = 8f; + float scale = 8f * scaling; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); } @@ -60,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 mPos = player.Calamity().mouseWorld; Vector2 shootDir = player.Center.DirectionTo(mPos); float _ = float.NaN; - bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _); + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30 * scaling, player.Center + shootDir * 145 * scaling, Item.width * 3f * scaling, ref _); return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) @@ -109,9 +114,11 @@ namespace CalamityMod.Items.Weapons.Melee if (completion >= 0.65f && spawnProj) { if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted - Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); - - Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false); + { + Projectile beam = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + beam.ai[1] = scaling; + } + Particle swipe = new CustomSpark(player.Center - shootDir * 5 * scaling, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f * scaling, clr, new Vector2(1f, 1f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); SoundEngine.PlaySound(SoundID.Item60, player.Center); @@ -123,7 +130,7 @@ namespace CalamityMod.Items.Weapons.Melee } float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); - bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180 * scaling; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); @@ -137,13 +144,14 @@ namespace CalamityMod.Items.Weapons.Melee { if (spawnTrueMeleeProj) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.35f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.2f); Vector2 mouseClamped = player.ClampedMouseWorld(); SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); for (int i = 0; i < 2; i++) { Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20); - Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); + Projectile star = Projectile.NewProjectileDirect(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); + star.scale = scaling; } spawnTrueMeleeProj = false; } @@ -157,7 +165,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.LunarBar, 7). AddIngredient(). - AddIngredient(5). + AddIngredient(ItemID.ShimmerBlock, 10). 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..e4e2d52b0e 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; diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 94a013896c..362f888b31 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,9 +12,9 @@ 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; diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 51133ffcf2..a0d8a82f4c 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,6 +17,10 @@ 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; diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 2c7b01de10..fe800a7be0 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 44; Item.height = 62; - Item.damage = 400; + Item.damage = 525; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; 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 27700e8c12..95595ad0cc 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() @@ -48,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", Main.zenithWorld ? "\n" + this.GetLocalizedValue("GFBFlavor") : ""); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Lightspeed.cs b/Items/Weapons/Melee/Lightspeed.cs index 28e525dd29..2b6cae8972 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,6 +18,10 @@ 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() { 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/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..5d1f55e272 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,6 +20,7 @@ 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() diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 3152bb7eb5..cf15358643 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,8 +1,10 @@ -using CalamityMod.Items.Weapons.Summon; +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; @@ -29,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() @@ -92,33 +95,9 @@ namespace CalamityMod.Items.Weapons.Melee { if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); - (proj2.ModProjectile as MirrorBlast).shardShield = 0; - (proj2.ModProjectile as MirrorBlast).shardNum = 11; - proj2.netUpdate = true; - } - } - reflectTimer = 0; - return; - } else - if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) - { - if (shardCount > 0) - { - SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); - } - if (shardCount >= 10) - { - player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); - } - proj.Calamity().multiplicativeDR += shardCount / 10f; - proj.Calamity().multiplicativeDRTimer = 60; - foreach (var proj2 in Main.projectile) - { - if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) - { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); (proj2.ModProjectile as MirrorBlast).shardShield = 0; (proj2.ModProjectile as MirrorBlast).shardNum = 11; proj2.netUpdate = true; @@ -127,6 +106,35 @@ namespace CalamityMod.Items.Weapons.Melee reflectTimer = 0; return; } + else + if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) + { + if (shardCount > 0) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); + } + if (shardCount >= 10) + { + player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); + } + proj.Calamity().multiplicativeDR += shardCount / 10f; + proj.Calamity().multiplicativeDRTimer = 60; + foreach (var proj2 in Main.projectile) + { + if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) + { + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + (proj2.ModProjectile as MirrorBlast).shardShield = 0; + (proj2.ModProjectile as MirrorBlast).shardNum = 11; + proj2.netUpdate = true; + } + } + reflectTimer = 0; + return; + } } } reflectTimer--; @@ -149,9 +157,9 @@ namespace CalamityMod.Items.Weapons.Melee hasShard = true; } } - + if (!alreadyReflecting && hasShard) - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy,player.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy, player.Center); return false; } return base.Shoot(player, source, position, velocity, type, damage, knockback); 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..599732a4a1 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,6 +13,10 @@ 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; diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 142c3e5f28..178a6e626d 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -20,6 +22,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/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index d3673b326a..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,12 +13,16 @@ 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() { Item.width = 76; Item.height = 76; - Item.damage = 144; + Item.damage = 100; Item.DamageType = TrueMeleeDamageClass.Instance; Item.crit = 11; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index ac56bb47f4..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; @@ -15,10 +18,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 146; Item.damage = 100; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.crit = 45; - Item.useAnimation = 12; + Item.crit = 41; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.useTurn = true; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 3fc0e1639a..b184ca0daf 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; @@ -31,6 +33,11 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnProj = true; 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; @@ -46,6 +53,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; } + public override void ModifyItemScale(Player player, ref float scale) + { + scale = scaling = player.GetMeleeScale(); + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { return false; @@ -53,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC - float scale = 8f; + float scale = 8f * scaling; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); } @@ -62,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 mPos = player.Calamity().mouseWorld; Vector2 shootDir = player.Center.DirectionTo(mPos); float _ = float.NaN; - bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _); + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30 * scaling, player.Center + shootDir * 215 * scaling, Item.width * 3f * scaling, ref _); return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) @@ -110,17 +121,19 @@ namespace CalamityMod.Items.Weapons.Melee { if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted { - Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); - + Projectile beam = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + beam.ai[1] = scaling; + for (int i = 0; i < 4; i++) { float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1); Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f); - Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + Projectile star = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + star.scale = scaling; } } - Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.Center - shootDir * 5 * scaling, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f * scaling, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); SoundEngine.PlaySound(SoundID.Item60, player.Center); @@ -132,8 +145,8 @@ namespace CalamityMod.Items.Weapons.Melee } float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); - bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240; - Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240 * scaling; + Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180 * scaling; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); @@ -147,7 +160,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (spawnTrueMeleeProj) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.35f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.10f); Vector2 mouseClamped = player.ClampedMouseWorld(); SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); for (int i = 0; i < 2; i++) @@ -159,7 +172,8 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; - Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + Projectile skybeam = Projectile.NewProjectileDirect(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + skybeam.scale = scaling; } spawnTrueMeleeProj = false; } diff --git a/Items/Weapons/Melee/Ozzathoth.cs b/Items/Weapons/Melee/Ozzathoth.cs index 5259795122..5fb5c259ef 100644 --- a/Items/Weapons/Melee/Ozzathoth.cs +++ b/Items/Weapons/Melee/Ozzathoth.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 40; Item.height = 54; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 90; + Item.damage = 145; Item.knockBack = 6f; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/Pandemic.cs b/Items/Weapons/Melee/Pandemic.cs index f6e8d04a94..e5c60d9495 100644 --- a/Items/Weapons/Melee/Pandemic.cs +++ b/Items/Weapons/Melee/Pandemic.cs @@ -11,9 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static float Reach = 480f; - public static float Speed = 40f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + //Changing these first 3 values requires restarting the game or hijacking some function to do the yoyo's SetStaticDefaults again. + public static float Lifetime => 15; + public static float Reach => 480f; + public static float Speed => 24f; + public static float DamageMultiplier(int count) => 1 + count * 0.2f; + public static float SizeMultiplier(int count) => 0.5f + DamageMultiplier(count) * 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Lifetime); public override void SetStaticDefaults() { @@ -27,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 32; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 100; + Item.damage = 125; Item.knockBack = 2.5f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 1579b0affa..c97e8bf4bd 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,6 +11,10 @@ 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; 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 568e60509b..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; } @@ -20,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 134; Item.height = 54; - Item.damage = 3725; + Item.damage = 1400; Item.crit = 18; Item.knockBack = 12f; Item.useTime = 5; 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/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 4e6f6f1fcd..111b1073f8 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; diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index 71c7e89b04..cc2950afc7 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,11 +16,15 @@ 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; Item.height = 62; - Item.damage = 350; + Item.damage = 400; Item.DamageType = DamageClass.Melee; Item.useTime = 10; Item.useAnimation = 40; 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/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index a68101c08b..2ac51b673b 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,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/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs new file mode 100644 index 0000000000..044d2272f4 --- /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 = 30; + Item.damage = 25; + 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..d4e3ce1078 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; 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 33deea51ab..8435cf73c5 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -78,7 +78,8 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.BeamSword). AddIngredient(20). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 5e96d09f84..b57c559428 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,6 +14,10 @@ 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; 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..78aa68e9ab 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; } diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index ca015ca064..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,16 +12,18 @@ 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; Item.height = 74; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 650; + Item.damage = 525; Item.knockBack = 28f; - Item.useTime = 45; - Item.useAnimation = 45; + Item.useTime = Item.useAnimation = 48; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; @@ -39,7 +43,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 9445abfed3..87193b5c73 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,7 +10,10 @@ 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; 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..be6ac805f3 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 = 43; 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..9d6763fb07 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; diff --git a/Items/Weapons/Melee/StygianShield.cs b/Items/Weapons/Melee/StygianShield.cs index 53f56777d9..ef54c26f90 100644 --- a/Items/Weapons/Melee/StygianShield.cs +++ b/Items/Weapons/Melee/StygianShield.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee public static readonly SoundStyle ShieldCatchSound = new("CalamityMod/Sounds/Item/StygianCatch"); // Held stats - public const int HeldDefense = 16; + public const int HeldDefense = 8; public const int DisableDashDuration = 90; public int ThrownShieldID = ModContent.ProjectileType(); 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/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index be38aa1993..5e101a6f57 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -100,6 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.LunarBar, 5). AddIngredient(10). AddIngredient(15). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 939db3f77d..e91262ae77 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,10 +10,14 @@ 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 = 56; - Item.height = 66; + Item.width = 54; + Item.height = 76; Item.damage = 38; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; diff --git a/Items/Weapons/Melee/TeardropCleaver.png b/Items/Weapons/Melee/TeardropCleaver.png index b6942f2283..b277bae8e8 100644 Binary files a/Items/Weapons/Melee/TeardropCleaver.png and b/Items/Weapons/Melee/TeardropCleaver.png differ 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/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 4147065fcb..56c8923805 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -47,6 +47,10 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool RangedPrefix() => true; //class identity is fake public override bool MeleePrefix() => false; + public override void ModifyItemScale(Player player, ref float scale) + { + scale = player.GetMeleeScale(); + } 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/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 2a95e484ab..e013c7fb45 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; diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index ee6e286544..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,15 +15,18 @@ 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; Item.height = 94; Item.DamageType = DamageClass.Melee; - Item.damage = 550; + Item.damage = 600; Item.knockBack = 8.5f; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = Item.useTime = 20; Item.autoReuse = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 3f71b02898..1ce3d7ff66 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; diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 25c24004a0..6e33876710 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,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 42; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 475; + Item.damage = 400; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; 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 9edfa0d77f..1c3b293927 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs @@ -2,6 +2,8 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -20,10 +22,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 40; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 14f; - Item.UseSound = SoundID.Item1; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/SwingMid") with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }; Item.DamageType = DamageClass.MeleeNoSpeed; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 36b0850ef5..0082fe6841 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee public static float ColdAttunement_ThirdSwingBoost = 1.25f; public static float ColdAttunement_MistDamageReduction = 0.11f; - public static int HotAttunement_BaseDamage = 126; + public static int HotAttunement_BaseDamage = 115; 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 @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee 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 = 84; + public static int HolyAttunement_BaseDamage = 88; public static float HolyAttunement_BaseSwingDamageMult = 0.5f; public static float HolyAttunement_FullSwingDamageMult = 1f; public static float HolyAttunement_ThrowDamageBoost = 3f; 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/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index 3da0ed1b9e..d9e51352cd 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,6 +11,10 @@ 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; 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..16c5888422 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(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index ff12b06675..a38fd73aa6 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee public static float ScrewBazingaModeDamageMult = 6.5f; public static float ScrewBazingaAimAssistAngle = 0.52f; //This may look high but remember this is the FULL angle, so it actually checks for half that angle deviation public static float ScrewBazingaAimAssistReach = 600f; + public float scaler = 1; public override ModItem Clone(Item item) { @@ -99,6 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { + scaler = player.GetMeleeScale(); player.Calamity().mouseWorldListener = true; if (Main.myPlayer == player.whoAmI) @@ -143,8 +145,8 @@ namespace CalamityMod.Items.Weapons.Melee //Prevent it from being thrown at any less than -1f chuckSpeed.Y = Math.Clamp(chuckSpeed.Y, -1f, 3f); - int p = Projectile.NewProjectile(source, position, chuckSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - + Projectile p = Projectile.NewProjectileDirect(source, position, chuckSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + p.scale = scaler + 0.2f; ScrewStored = false; return false; } @@ -188,7 +190,7 @@ namespace CalamityMod.Items.Weapons.Melee position = Vector2.Lerp(new Vector2(ScrewPosition.X, ScrewPosition.Y), new Vector2(ScrewStart.X, ScrewStart.Y), ProgressionOfScrew); float rotation = ScrewPosition.Z.AngleLerp(ScrewStart.Z, ProgressionOfScrew); float outlineOpacity = (float)Math.Pow(1 - ScrewTimer / ScrewTime, 2); - scale = 1.05f + 0.05f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f); + scale = 1.05f * scale + 0.05f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f); Main.spriteBatch.Draw(screwOutlineTex, position, null, Color.Lerp(Color.GreenYellow, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.5f + 0.5f) * outlineOpacity, rotation, screwOutlineTex.Size() / 2f, scale, 0, 0); Main.spriteBatch.Draw(screwTex, position, null, Color.White, rotation, screwTex.Size() / 2f, scale, 0, 0); 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/NebulaBlaster.png b/Items/Weapons/NebulaBlaster.png deleted file mode 100644 index d98985b3c4..0000000000 Binary files a/Items/Weapons/NebulaBlaster.png and /dev/null differ 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 860c80bc8b..492cb34a2b 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -1,11 +1,13 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; +using Terraria.Localization; namespace CalamityMod.Items.Weapons.Ranged { @@ -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() { @@ -65,7 +71,6 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent; } } diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index aee4c0087e..33961056b5 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; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index eed33698bf..573607889b 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; 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/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..d0876e9c16 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; 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..24a1259bde 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() diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index c4d586c689..d624424177 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; } diff --git a/Items/Weapons/Ranged/Buzzkill.cs b/Items/Weapons/Ranged/Buzzkill.cs index 6c34e7b8ae..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() @@ -42,8 +45,7 @@ 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) { - // The holdout deals 1.5x base damage. - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.5), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } 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/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 6782f1e87a..73dddcb0f8 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -14,11 +14,6 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public static int MaxLoadedArrows = 9; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } - public override void SetDefaults() { Item.width = 130; @@ -40,26 +35,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-50f, 0f); - public override bool AltFunctionUse(Player player) => true; - public override void HoldItem(Player player) { var calPlayer = player.Calamity(); if (Main.myPlayer == player.whoAmI) { - calPlayer.rightClickListener = true; calPlayer.mouseRotationListener = true; } - - if (calPlayer.mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - { - Item.noUseGraphic = false; - } - else - { - Item.noUseGraphic = true; - } + Item.noUseGraphic = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; @@ -71,17 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - - // Single arrow firing. - if (player.Calamity().mouseRight) - { - Vector2 tipPosition = position + shootDirection * 110f; - Projectile.NewProjectile(source, tipPosition, shootVelocity, Item.shoot, damage, knockback, player.whoAmI); - } - - // Charge-up. Done via a holdout projectile. - else - Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } } 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..d08fcdd342 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -36,11 +36,10 @@ 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; } diff --git a/Items/Weapons/Ranged/DeadSunsWind.cs b/Items/Weapons/Ranged/DeadSunsWind.cs index ac6a849c6c..75de902a0f 100644 --- a/Items/Weapons/Ranged/DeadSunsWind.cs +++ b/Items/Weapons/Ranged/DeadSunsWind.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). 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/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..5f76492ce8 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(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index b4ecc5f53c..5f0fd31abf 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; diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index c97d932eaf..2518bb25db 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 118; Item.height = 56; - Item.damage = 50; + Item.damage = 100; Item.DamageType = DamageClass.Ranged; Item.useTime = 10; Item.useAnimation = 20; diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 759c3af8c5..9f58bbae14 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; 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/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 4c6c6151ff..c575c6c3e8 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -18,14 +18,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public int SineCounter = 0; + public static int ArmorPenetration = 20; public static int AmmoSavedPercent = 80; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration, AmmoSavedPercent); public override void SetDefaults() { Item.width = 56; Item.height = 24; Item.damage = 75; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 4; @@ -57,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = -1; i <= 1; i += 2) { Vector2 helixVel = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(i * sine)); - Projectile.NewProjectile(source, position, helixVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, player.altFunctionUse != 2 ? 1 : 0); + Projectile.NewProjectile(source, position, helixVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 1); } } Particle spark2 = new LineParticle(position + Main.rand.NextVector2Circular(6, 6), (velocity * 4).RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(1.5f, 2f), new Color(229, 49, 39)); diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index a8ed967b01..2efc46e683 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -70,7 +70,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(25). AddIngredient(8). AddIngredient(20). - AddIngredient(5). AddTile(). Register(); } 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..70ef2d68d4 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; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index deaea9191e..e43b736e27 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,73 +1,66 @@ using System; +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.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Localization; namespace CalamityMod.Items.Weapons.Ranged { public class Megalodon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private bool fireWater = false; + public int sharkGunDamageScaling = 0; + public static int AmmoSavedPercent = 50; + 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 = 72; - Item.height = 32; - Item.damage = 29; + Item.width = 102; + Item.height = 43; + Item.damage = 58; Item.DamageType = DamageClass.Ranged; - Item.useTime = 6; - Item.useAnimation = 6; + Item.useTime = 4; + Item.useAnimation = 4; + Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item11; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; Item.useAmmo = AmmoID.Bullet; } - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Reposition to the gun's tip + add some inaccuracy - Vector2 newPos = position + new Vector2(64f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(3f)); - - // Fire either the bullet or the water jet, depending on cadence. - int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); - - // Always fires a close range water blast. - // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. - int waterRingDamage = (int)(damage * 0.5f); - float boostedKB = knockback + 7f; // Stronger guaranteed KB than Archerfish for mid-late Hardmode - Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.5f, 0.6f), ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); - - // Swap between firing bullets and water jets each shot. - fireWater = !fireWater; + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } - - // Does not consume ammo when firing water jets. - public override bool CanConsumeAmmo(Item ammo, Player player) => !fireWater; - public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.Megashark). AddIngredient(). - AddIngredient(10). - AddIngredient(10). + AddIngredient(15). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Megalodon.png b/Items/Weapons/Ranged/Megalodon.png index 85bd1f10b9..6d3e45d1aa 100644 Binary files a/Items/Weapons/Ranged/Megalodon.png and b/Items/Weapons/Ranged/Megalodon.png differ 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 new file mode 100644 index 0000000000..4e626cac2d --- /dev/null +++ b/Items/Weapons/Ranged/OmniGun.cs @@ -0,0 +1,47 @@ +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 OmniGun : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetDefaults() + { + Item.width = 118; + Item.height = 32; + Item.damage = 57; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = null; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; + + 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; + 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); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/OmniGun.png b/Items/Weapons/Ranged/OmniGun.png new file mode 100644 index 0000000000..34664bc2ae Binary files /dev/null and b/Items/Weapons/Ranged/OmniGun.png differ 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/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 331eec6798..fa94b9ccb1 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -20,6 +20,9 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle Shot = new("CalamityMod/Sounds/Item/PolarisShot") { Volume = 0.6f }; public static readonly SoundStyle Squeak = new("CalamityMod/Sounds/Custom/CuteSqueak") { Volume = 0.75f }; + + public static int ArmorPenetration = 15; + public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; @@ -31,11 +34,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 36; Item.height = 34; Item.damage = 35; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Ranged; - - Item.useTime = 9; - Item.useAnimation = 9; - + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalization(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal").Format(ArmorPenetration)); public override bool AltFunctionUse(Player player) => Main.zenithWorld ? true : false; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -129,7 +130,7 @@ namespace CalamityMod.Items.Weapons.Ranged SoundEngine.PlaySound(Shot, player.Center); for (int i = 0; i < (Happy ? 3 : 1); i++) - Projectile.NewProjectile(source, position + velocity * 5f, velocity.RotatedByRandom(0.05f * (i != 0 ? 6 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ShotNumber); + Projectile.NewProjectile(source, position + velocity * 5f, velocity.RotatedByRandom(0.05f * (i != 0 ? 6 : 1)), type, damage, knockback, player.whoAmI, 0f, ShotNumber); if (ShotNumber >= 2) // Cycle the shot color ShotNumber = 0; diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 233a1ecc5a..df4ff7caa0 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 100; Item.height = 46; - Item.damage = 77; + Item.damage = 60; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 15; @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().furyFuel > 0) { Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.25f), knockback, player.whoAmI); //.25x base damage + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.2f), knockback, player.whoAmI); //.2x base damage Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); dust.noGravity = true; 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/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 60d2fadde4..7531b70854 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,13 +1,16 @@ 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; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged @@ -15,83 +18,46 @@ namespace CalamityMod.Items.Weapons.Ranged public class Seadragon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - // Odd shots are bullets (including the first). Even shots are water jets. - // The 9th shot adds a rocket. The 17th shot adds an ultra powerful muzzle blast, then resets the counter to 2. - // This is intentional so you don't get the muzzle blast instantly when you start firing and have to play around it. - private int shotCounter = 1; + 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 = 90; Item.height = 38; - Item.damage = 60; + Item.damage = 154; Item.DamageType = DamageClass.Ranged; - Item.useTime = 5; - Item.useAnimation = 5; + Item.useTime = 3; + Item.useAnimation = 3; + Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item11; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; Item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - + public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal + 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 Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Reposition to the gun's tip + add some inaccuracy - Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - - // Fire either the bullet or the water jet, depending on cadence. - bool fireWater = shotCounter % 2 == 0; - int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); - - // Always fires a close range water blast. - // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. - int waterRingDamage = (int)(damage * 0.5f); - float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying. - Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); - - // Check cadence position to determine which bonus projectile to add, if any. - bool fireRocket = shotCounter == 9; - bool muzzleBlast = shotCounter == 17; - - // Rockets have their own more chaotic spread than bullets. - if (fireRocket) - { - int rocketDamage = damage * 3; - Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType(), rocketDamage, knockback, player.whoAmI); - SoundEngine.PlaySound(SoundID.Item109, player.Center); - } - - // Muzzle blasts are always directly in line with the gun's muzzle. - if (muzzleBlast) - { - int muzzleBlastDamage = damage * 12; // "This might be too much but it's every 18th shot..." Narrator: 25x was in fact too much. - float muzzleBlastKB = knockback + 12f; - Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI); - - // Play additional sound for muzzle blasts - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position); - } - - // Increment and then reset the shot counter so the pattern loops indefinitely. The muzzle blast replaces the first bullet in the repeating pattern. - ++shotCounter; - if (shotCounter > 17) - shotCounter = 2; + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } - // Does not consume ammo when firing water jets. - public override bool CanConsumeAmmo(Item ammo, Player player) => shotCounter % 2 == 1; - public override void AddRecipes() { CreateRecipe(). 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/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 6c3656b312..d2114fab15 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -14,10 +14,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 58; Item.height = 24; - Item.damage = 24; + Item.damage = 36; Item.DamageType = DamageClass.Ranged; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; @@ -30,10 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + 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) { 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/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/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 973c243ce8..bb4e8b030a 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.SuperStarCannon). AddIngredient(4). AddIngredient(ItemID.FallenStar, 15). - AddIngredient(3). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } 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 69a4afb43a..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() { @@ -58,8 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 100; Item.DamageType = DamageClass.Ranged; Item.crit = 21; - Item.useTime = 10; - Item.useAnimation = 10; + Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -124,8 +126,8 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } - // The holdout deals 2x base damage. - Projectile.NewProjectile(source, position, velocity, Item.shoot, damage * 2, knockback, player.whoAmI); + // The holdout deals 1.5x base damage. + Projectile.NewProjectile(source, position, velocity, Item.shoot, (int)(damage * 1.5), knockback, player.whoAmI); return false; } 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 ae859ea8b6..4a698709e7 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -18,14 +18,16 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public int SineCounter = 0; + public static int ArmorPenetration = 200; public static int AmmoSavedPercent = 80; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ArmorPenetration, AmmoSavedPercent); public override void SetDefaults() { Item.width = 60; Item.height = 26; Item.damage = 232; + Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 4; @@ -61,9 +63,9 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2)); - Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 2f : 0); - Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 4f : 0); - Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 3f : 0); + Projectile.NewProjectile(source, position, helixVel1, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, 2f); + Projectile.NewProjectile(source, position, helixVel2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, 4f); + Projectile.NewProjectile(source, position, helixVel3, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0, 3f); } Particle spark2 = new LineParticle(position + Main.rand.NextVector2Circular(6, 6), (velocity * 4).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(1.5f, 2f), Main.rand.NextBool() ? Color.MediumOrchid : Color.DarkViolet); GeneralParticleHandler.SpawnParticle(spark2); 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/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/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 882a0ad8d3..d3978f6ae7 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -12,6 +12,11 @@ namespace CalamityMod.Items.Weapons.Ranged public class TheJailor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } public override void SetDefaults() { Item.width = 102; diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index d84ae38408..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,11 +15,15 @@ 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; Item.height = 12; - Item.damage = 530; + Item.damage = 550; Item.useTime = 45; Item.useAnimation = 45; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index fc2338f5fe..97516ab4c9 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -25,13 +25,6 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle JackpotGFB = new("CalamityMod/Sounds/Item/SevensStrikerJackpotGFB"); public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f }; - public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier - public static readonly float RightClickCopperMultiplier = 0.04f; - public static readonly float RightClickSilverMultiplier = 0.08f; - public static readonly float RightClickGoldMultiplier = 0.16f; - public static int RightClickAmmoSavedPercent = 80; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RightClickAmmoSavedPercent); - public static readonly float DoublesMultiplier = 1f; // Unfortunately doubles can't be doubles. Balancing! public static readonly float TriplesCherryMultiplier = 1f; public static readonly float TriplesCherrySplitMultiplier = 0.333f; @@ -39,11 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow... public static readonly float JackpotMultiplierGFB = 7f; // ...Unless you simply cannot stop winning - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } - public override void SetDefaults() { Item.width = 170; @@ -57,114 +45,25 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.useTurn = true; Item.autoReuse = true; + Item.UseSound = null; + Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Shoot; Item.useAmmo = AmmoID.Coin; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.shoot = ProjectileID.PlatinumCoin; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } - - public override bool AltFunctionUse(Player player) => true; - - public override bool? UseItem(Player player) - { - // Right click has a chance to save money - if (player.altFunctionUse == 2) - { - bool consumeCoin = Main.rand.Next(100) >= RightClickAmmoSavedPercent; - long coinCount = Utils.CoinsCount(out bool overflow, player.inventory); - int price; - - if (overflow || coinCount > 10000) - { - price = 10000; - ShotCoin = ProjectileID.GoldCoin; - } - else if (coinCount > 100) - { - price = 100; - ShotCoin = ProjectileID.SilverCoin; - } - else - { - price = 1; - ShotCoin = ProjectileID.CopperCoin; - } - - if (consumeCoin) - player.BuyItem(price); - } - - // Left click does nothing, it just spawns the holdout - else - Item.shoot = ModContent.ProjectileType(); - - return base.UseItem(player); - } - public override Vector2? HoldoutOffset() => new Vector2(-30, -11); - - // Left click spawns a holdout, so the item must not appear normally. - // Right click uses the item like a standard gun, so draw it normally. - public override void UseAnimation(Player player) - { - if (player.altFunctionUse == 2) - { - Item.UseSound = CoinSound; - Item.noUseGraphic = false; - } - else - { - Item.UseSound = null; - Item.noUseGraphic = true; - } - } - - // Right click fires coins extremely rapidly (3 use time) - public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.1f : 1f; - - // Right click consumes coins manually instead of using Terraria's ammo system - // (otherwise it could shoot Platinum Coins) - public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; - - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - return true; - - if (player.altFunctionUse == 2) - { - Utils.CoinsCount(out bool overflow, player.inventory); - return overflow; - } - return true; - } - + public override bool CanUseItem(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) { - // Right click damage multiplier varies by coin type - if (player.altFunctionUse == 2) - { - Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction); - Vector2 gunTip = position + shootDirection * Item.scale * 90f; - gunTip.Y -= 20f; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - // spread copied from Onyxia, angular conic spread instead of Terraria's square spread - float randAngle = Main.rand.NextFloat(-0.05f, 0.05f); - float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); - Vector2 finalVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; - float damageMult = ShotCoin == ProjectileID.GoldCoin - ? RightClickGoldMultiplier : ShotCoin == ProjectileID.SilverCoin - ? RightClickSilverMultiplier : RightClickCopperMultiplier; - int finalDamage = (int)(damage * damageMult); - Projectile.NewProjectile(source, gunTip, finalVelocity, ShotCoin, finalDamage, knockback, player.whoAmI); - } - - // Left click just spawns the holdout - else - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, type, 0f); + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } 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 cde4b30f11..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; @@ -21,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { 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 955813f31c..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; @@ -11,65 +14,57 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - [LegacyName("Megafleet")] + // Long live Megafleet. You will be missed. Maybe one day we can revive you. + [LegacyName("Megafleet")] public class Voidragon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private int shotType = 1; - - public static int AmmoSavedPercent = 50; + 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; Item.height = 38; - Item.damage = 240; + Item.damage = 1400; Item.DamageType = DamageClass.Ranged; - Item.useTime = 5; - Item.useAnimation = 5; + Item.useTime = 3; + Item.useAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.UseSound = SoundID.Item11; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; + Item.noUseGraphic = true; + Item.channel = true; Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-5, 6) * 0.05f; - - if (shotType > 2) - shotType = 1; - - if (shotType == 1) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - - shotType++; - - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f)); - + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent && shotType % 2 == 1; - public override void AddRecipes() { CreateRecipe(). AddIngredient(). + AddIngredient(). AddIngredient(5). AddTile(). Register(); 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/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/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 6c1da5bf6e..54c1b8412e 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; diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index a6cd12bcf6..371e0343d0 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; diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 68c8965605..036b76098e 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 14; Item.height = 38; - Item.damage = 56; + Item.damage = 49; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 10; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; 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..540e906b7e 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,6 +14,12 @@ 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; @@ -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(), damage * 3, 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..04a79f2125 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; 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 762b079e8d..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,14 +15,18 @@ 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; Item.height = 58; Item.DamageType = RogueDamageClass.Instance; - Item.useTime = Item.useAnimation = 24; + Item.useTime = Item.useAnimation = 27; Item.knockBack = 7f; - Item.damage = 980; + Item.damage = 725; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; @@ -34,6 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; } + public override float StealthDamageMultiplier => 1.3f; 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/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 612a1f66f7..b93e62e28a 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 = 65; + Item.damage = 110; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; @@ -25,38 +25,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; + Item.channel = true; } - - public override float StealthDamageMultiplier => 0.6f; - - public static int CloudLifetime = 200; - public static float DustRadius = 11f; - - //Cloud hitbox size manipulation - public static float MaxSize = 3.2f; - public static float MaxSizeStealth = 3.6f; - public static float GrowthRate = 0.025f; - public static float StealthGrowthRate = 0.035f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandstorminaBottle). + AddIngredient(). AddIngredient(ItemID.AncientCloth,5). AddIngredient(). AddTile(TileID.MythrilAnvil). 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/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index e625e2d5b1..cceb7bbd87 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 34; - Item.damage = 2850; + Item.damage = 2000; Item.DamageType = RogueDamageClass.Instance; Item.useTime = 42; Item.useAnimation = 42; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 17f; } - public static float StealthDmgMult = 0.3f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers + public static float StealthDmgMult = 0.25f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers public override float StealthDamageMultiplier => StealthDmgMult; public override float StealthVelocityMultiplier => 0.8f; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 073d54b200..b4bbba795e 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,60 +1,837 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +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.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.UI.Chat; +#region Item namespace CalamityMod.Items.Weapons.Rogue { public class EclipsesFall : RogueWeapon { + /// + /// Base damage of the spear, dynamically updated to match rogue stats. + /// This is reduced if the spear has less fragments than MaxFragmentCount + /// + public static int EclipseSpearBaseDmg => 1250; + /// + /// How much damage fragments and sparks should do + /// + public static float FragmentDmgMult => 0.33f; + /// + /// How many fragments are spawned per spear hit + /// + public static int FragmentCount => 2; + /// + /// How many fragments can exist before they start homing in. + /// Also the required amount of fragments for 100% base dmg on Eclipse Spear + /// + public static int MaxFragmentCount => 20; + public override void SetDefaults() { Item.width = 82; Item.height = 88; - Item.damage = 500; + Item.damage = 700; Item.knockBack = 3.5f; Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; - Item.shootSpeed = 15f; - Item.shoot = ModContent.ProjectileType(); - + Item.shootSpeed = 32f; + Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - 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) { - if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request(Texture + "Glow").Value); public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddIngredient(12). + AddIngredient(5). + AddIngredient(15). AddTile(). Register(); } } } +#endregion + +namespace CalamityMod.Projectiles.Rogue +{ + #region Main Javelin + public class EclipsesFall_Javelin : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + private int SplitProjDamage => (int)(Projectile.damage * EclipsesFall.FragmentDmgMult); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 2; + Projectile.penetrate = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; + Projectile.timeLeft = 150 * Projectile.MaxUpdates; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(5)) + { + Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); + float trailScale = Main.rand.NextFloat(0.8f, 1.2f); + Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; + Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); + GeneralParticleHandler.SpawnParticle(eclipseTrail); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int onHitCount = EclipsesFall.FragmentCount + 4; + float spread = 20f; + int projectileDamage = SplitProjDamage; + float kb = 5f; + int sparkID = ModContent.ProjectileType(); + int starID = ModContent.ProjectileType(); + for (int i = 0; i < onHitCount; i++) + { + int projID = i < EclipsesFall.FragmentCount ? starID : sparkID; + Vector2 velocity = Projectile.oldVelocity.RotateRandom(MathHelper.ToRadians(spread)) * 0.5f; + float speed = Main.rand.NextFloat(1.5f, 2f); + float moveDuration = Main.rand.Next(5, 15); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * speed, projID, projectileDamage, kb, Projectile.owner, 0f, moveDuration, 20); + } + + SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * 0.6f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item68 with { Volume = SoundID.Item68.Volume * 0.2f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item122 with { Volume = SoundID.Item122.Volume * 0.4f }, Projectile.position); + + + List frags = new(); + var p = -2; + foreach (var item in Main.ActiveProjectiles) + { + + if (item.type == ModContent.ProjectileType() && item.owner == Projectile.owner && item.Opacity > 0.1f) + { + if (Projectile.Calamity().stealthStrike && item.timeLeft > 600 * item.MaxUpdates) + { + if (item.timeLeft < 1120 * item.MaxUpdates) + { + item.timeLeft = 60 * item.MaxUpdates; + item.ai[0] = target.whoAmI; + continue; + } + item.timeLeft = 1200 * item.MaxUpdates; + p = item.whoAmI; + } + item.ai[0] = target.whoAmI; + } + if (item.type == ModContent.ProjectileType() && item.owner == Projectile.owner && item.ai[0] > -2) + { + frags.Add(item); + } + } + if (Projectile.Calamity().stealthStrike && p < 0) + for (int i = 0; i < 1; i++) + { + int projID = ModContent.ProjectileType(); + Vector2 velocity = Vector2.Zero; + var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(default) * 64f, projID, Projectile.damage, kb, Projectile.owner, target.whoAmI, 0, Math.Min(20, frags.Count(x => x.ai[0] == 0))); + proj.rotation = Projectile.rotation; + p = proj.whoAmI; + } + + + frags = frags.OrderBy(x => x.timeLeft).ToList(); + int toRemove = frags.Count(x => x.ai[0] == 0) - EclipsesFall.MaxFragmentCount; + foreach (var item in frags) + { + if (toRemove > 0 && item.ai[0] == 0) + { + item.ai[0] = -2; + item.timeLeft = EclipsesFall_LightFragment.lifetime; + toRemove--; + continue; + } + if (Projectile.Calamity().stealthStrike) + { + if (item.ai[0] == 0) + { + item.ai[1] = Main.rand.Next(5, 15); + item.ai[2] = 20; + } + item.ai[0] = p + 1; + item.timeLeft = EclipsesFall_LightFragment.lifetime; + item.damage = 0; + item.netUpdate = true; + } + } + + + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request(Texture + "Glow").Value; + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + #endregion + + #region Stealth Projectiles + + [PierceResistException] + public class EclipsesFall_StealthSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + bool initialized = false; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + (Vector2 start, Vector2 end) LinePos = (new(), new()); + float LineWidth = 0; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 48; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.timeLeft = 1200 * Projectile.MaxUpdates; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void AI() + { + if (!initialized) + { + Projectile.ai[0] = -1; + Projectile.localAI[0] = Projectile.ai[2]; + Projectile.ai[2] = 0; + initialized = true; + } + + Projectile.originalDamage = (int)(EclipsesFall.EclipseSpearBaseDmg * (Projectile.ai[2] / (float)EclipsesFall.MaxFragmentCount)); + if (Projectile.ai[0] >= 0 && Projectile.ai[2] >= Projectile.localAI[0] && Projectile.Opacity > 0) + { + LinePos.end = Projectile.position; + Projectile.velocity = Projectile.DirectionTo(Main.npc[(int)Projectile.ai[0]].Center) * 64; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center + Projectile.velocity; + Projectile.Damage(); + Projectile.ai[0] = -1; + LineWidth = 1f; + LinePos.start = Projectile.Center; + Projectile.localAI[1] = 0; + } + + + LineWidth -= 0.05f; + Projectile.localAI[1]++; + if (Projectile.localAI[1] > 60) + { + var dis = Projectile.Distance(Main.player[Projectile.owner].Center); + Projectile.velocity += Projectile.DirectionTo(Main.player[Projectile.owner].Center) * dis / 320f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + + } + Projectile.velocity *= 0.9f; + } + public override bool PreDraw(ref Color lightColor) + { + + if (LineWidth > 0) + { + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + + using (Main.spriteBatch.Scope()) + { + using (lease.Scope(clearColor: Color.Transparent)) + { + + List posList = []; + //For the prim to render properly I need to divide the distance between the positions into a couple points. Just using start and end doesn't render. + for (var i = 0; i <= 2; i++) + { + posList.Add(Vector2.Lerp(Projectile.position, LinePos.end, i / 2f)); + } + var pos = posList.ToArray(); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(pos, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), pos.Length); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(pos, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), pos.Length); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + } + } + var tex = TextureAssets.Item[ModContent.ItemType()]; + if (Projectile.Opacity > 0.5f) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, 0); + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity * (Projectile.localAI[0] > 0 ? Projectile.ai[2] / Projectile.localAI[0] : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + Main.spriteBatch.End(); + } + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.oldPosition + new Vector2(Projectile.width, Projectile.height) * 0.5f, Projectile.Center, 48f, ref _)) + { + return true; + } + + return base.Colliding(projHitbox, targetHitbox); + } + + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[0] < 0) + return false; + return null; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Half damage to any NPC that isn't the primary target + if (Projectile.ai[0] != target.whoAmI) + modifiers.SourceDamage *= 0.5f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + if (Projectile.timeLeft < 600 * Projectile.MaxUpdates && Projectile.ai[0] == target.whoAmI) + { + Projectile.Opacity = 0; + Projectile.Center = target.Center; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.velocity = new(0, 1E-05f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + } + Projectile.netUpdate = true; + if (Projectile.ai[0] == target.whoAmI) + SoundEngine.PlaySound(SarosPossession.FiringSound with { Pitch = -1f, Volume = 0.75f, }, Projectile.Center); + } + + public override void OnKill(int timeLeft) + { + if (Projectile.Opacity > 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + return; + } + + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + return 96 * LineWidth * MathHelper.Clamp((Projectile.ai[2] / 20f), 0.25f, 1f); + } + + public Color FireColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = Color.Lerp(new Color(238, 226, 153), new Color(255, 191, 73), (MathF.Sin(completion * MathHelper.TwoPi + Main.GlobalTimeWrappedHourly * 5) + 1) * 0.5f); + return mainColor * MathF.Pow(1 - completion * 1.1f, 0.5f); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + return 32 * LineWidth * MathHelper.Clamp((Projectile.ai[2] / 20f), 0.25f, 1f); + } + + public Color FireCoreColorFunction(float completion, Vector2 vertexPos) + { + return Color.Black * MathF.Pow(1 - completion * 1.1f, 0.5f); + } + } + public class EclipsesFall_StealthSpearExplosion : ModProjectile, IAdditiveDrawer, ILocalizedModType + { + //Based on Terratomere explosion + public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 520; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.scale = 0.2f; + Projectile.hide = true; + } + + public override void AI() + { + // Play an explosion sound on the first frame of this projectile's existence. + if (Projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SubsumingVortex.ExplosionSound with { Volume = 0.6f }, Projectile.Center); + Projectile.localAI[0] = 1f; + } + + // Emit a strong white light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.5f); + + // Determine frames. Once the maximum frame is reached the projectile dies. + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame++; + if (Projectile.frame >= 17) + Projectile.Kill(); + + // Exponentially accelerate. + Projectile.scale *= 1.013f; + Projectile.Opacity = Utils.GetLerpValue(5f, 36f, Projectile.timeLeft, true); + } + + public override bool PreDraw(ref Color lightColor) + { + return base.PreDraw(ref lightColor); + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D lightTexture = ModContent.Request("CalamityMod/Skies/XerocLight").Value; + Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = frame.Size() * 0.5f; + + for (int i = 0; i < 2; i++) + { + Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTimeWrappedHourly * 5f).ToRotationVector2() * Projectile.scale * 12f; + Color lightBurstColor = CalamityUtils.MulticolorLerp(Projectile.timeLeft / 144f, Terratomere.TerraColor1, Terratomere.TerraColor2); + lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * Projectile.Opacity * 0.24f; + Main.spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, Projectile.scale * 1.32f, SpriteEffects.None, 0); + } + if (Projectile.timeLeft < 149) + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, 1.6f, 0); + Main.spriteBatch.End(); + } + } + } + #endregion + + #region Shatter Projectiles + public class EclipsesFall_LightFragment : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public static int lifetime => 1200; + Color? color = null; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.MaxUpdates = 2; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.rotation += Projectile.direction * 0.02f; + if (Projectile.ai[0] < -1) + { + Projectile.penetrate = 1; + Projectile.damage = Projectile.originalDamage; + Projectile.stopsDealingDamageAfterPenetrateHits = false; + var target = Projectile.FindTargetWithinRange(4000); + if (target is not null) + { + Projectile.velocity += Projectile.DirectionTo(target.Center) * 2; + Projectile.velocity *= 0.95f; + } + } + + if (Projectile.ai[0] == 0f || Projectile.ai[2] > 0) + { + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.ai[2] >= 0) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + Projectile.velocity *= Projectile.ai[2]; + Projectile.ai[2]--; + } + } + else + { + if (Main.projectile.IndexInRange((int)Projectile.ai[0] - 1) && Main.projectile[(int)Projectile.ai[0] - 1].active) + { + var proj = Main.projectile[(int)Projectile.ai[0] - 1]; + if (Projectile.timeLeft > 100) + Projectile.timeLeft = 100; + Projectile.Center = Vector2.Lerp(Projectile.Center, proj.Center, (1 - (Projectile.timeLeft / 100f))); + Projectile.velocity = new(0, 1E-05f); + if (Projectile.Distance(proj.Center) < 16) + { + proj.ai[2]++; + proj.netUpdate = true; + if (proj.ai[2] == proj.localAI[0]) + SoundEngine.PlaySound(SarosPossession.SpawnSound with { Pitch = 1f, Volume = 1f, }, Projectile.Center); + Projectile.active = false; + + } + } + } + } + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[0] < -1 && target.Calamity().IsArmored()) + return false; + return null; + } + + public override void OnKill(int timeLeft) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(16).ToArray(); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + } + float dis = Projectile.position.Distance(Projectile.oldPos.Last()) / 32; + if (dis > 1) + { + dis = 1f; + } + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * dis, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); + + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + Main.spriteBatch.End(); + } + return false; + } + + // Matches Saros Possesion sunfire with slight edits + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = 24f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + 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 vertexPos) + { + Color mainColor = new Color(238, 226, 153); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = Projectile.scale * 16; + 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 vertexPos) + { + Color mainColor = new Color(255, 191, 73); + return mainColor; + } + } + public class EclipsesFall_LightExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public const int Lifetime = 35; // 7 animation frames, 12 FPS + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 102; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5; + + if (Projectile.frameCounter > Lifetime) + Projectile.Kill(); + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request(Texture + "Glow").Value; + Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + public class EclipsesFall_LightSpark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static int lifetime = 150; + Color? color = null; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localAI[0] = 20f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.rotation += Projectile.direction * Projectile.ai[0]; + + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.localAI[0] >= 0) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.localAI[0]; + Projectile.localAI[0]--; + Projectile.timeLeft++; + } + + if (Projectile.localAI[0] == 0) + { + Projectile.velocity = new(0, 1E-05f); + Projectile.damage = 0; + float dis = Projectile.position.Distance(Projectile.oldPos.Take(16).Last()); + if (dis < 0.1f) + Projectile.Kill(); + } + } + + public override bool PreDraw(ref Color lightColor) + { + color ??= Color.Lerp(Color.OrangeRed, new Color(255, 191, 73), Main.rand.NextFloat(0.25f, 0.5f)); + + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(16); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + } + float dis = Projectile.position.Distance(Projectile.oldPos.Take(16).Last()) / 128f - 0.1f; + if (dis > 1) + { + dis = 1f; + } + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * dis, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); + + return false; + } + + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = 24f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + 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 vertexPos) + { + Color mainColor = new Color(255, 191, 73); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = Projectile.scale * 16; + 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 vertexPos) + { + Color mainColor = color.Value; + return mainColor; + } + } + #endregion +} diff --git a/Items/Weapons/Rogue/ElephantKiller.cs b/Items/Weapons/Rogue/ElephantKiller.cs new file mode 100644 index 0000000000..e4cb6c8c26 --- /dev/null +++ b/Items/Weapons/Rogue/ElephantKiller.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class ElephantKiller : RogueWeapon + { + public static readonly SoundStyle Throw = new("CalamityMod/Sounds/Item/ElephantKillerThrow"); + public static readonly SoundStyle Catch = new("CalamityMod/Sounds/Item/ElephantKillerCatch"); + public static readonly SoundStyle Shot = new("CalamityMod/Sounds/Item/ElephantKillerShot"); + public static readonly SoundStyle ShotFail = new("CalamityMod/Sounds/Item/ElephantKillerShotFail"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ElephantKillerHit"); + public static readonly SoundStyle BoostedShotHit = new("CalamityMod/Sounds/Item/ElephantKillerBoostedShotHit"); + public static readonly SoundStyle ElephantSound = new("CalamityMod/Sounds/Item/ElephantKillerElephant"); + public static readonly SoundStyle Shine = new("CalamityMod/Sounds/Item/ElephantKillerShine"); + public static readonly SoundStyle Woosh = new("CalamityMod/Sounds/Item/ElephantKillerWoosh"); + + public static float stealthGainOnThrowHit => 0.25f; // Amount of stealth gained on a thrown hit based on max stealth + public static float stealthCostToShoot => 0.1f; // Amount of stealth it costs to fire the gun with right click based on max stealth + public static float stealthShotDamageMult => 1.9f; + public static float elephantBoostedShotDamageMult => 1.6f; // This is multiplicative with the stealth shot damage boost + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() + { + Item.width = 46; + Item.height = 58; + Item.damage = 135; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 38; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.DamageType = RogueDamageClass.Instance; + } + public override bool PreDrawTooltipLine(DrawableTooltipLine line, ref int yOffset) + { + if (Main.LocalPlayer != null) + Main.LocalPlayer.Calamity().drawingElephantKillerJoke = true; + return base.PreDrawTooltipLine(line, ref yOffset); + } + public override void ModifyTooltips(List list) + { + if (Main.LocalPlayer != null) + { + list.FindAndReplace("[STEALTHCOST]", stealthCostToShoot.ToPercent()); + list.FindAndReplace("[STEALTHGAIN]", stealthGainOnThrowHit.ToPercent()); + } + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool shoot = player.Calamity().mouseRight; + Projectile gun = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0, shoot ? 1f : 0); + gun.scale = 0; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/ElephantKiller.png b/Items/Weapons/Rogue/ElephantKiller.png new file mode 100644 index 0000000000..e5b2a62323 Binary files /dev/null and b/Items/Weapons/Rogue/ElephantKiller.png differ diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 72d6da8198..14849ad47c 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; diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index e67b1ec4cc..9a28caea5e 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; - Item.damage = 25; - Item.useAnimation = Item.useTime = 20; + Item.damage = 22; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 2f; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } - public override float StealthDamageMultiplier => 0.7f; + public override float StealthDamageMultiplier => 0.6f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -54,8 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 4). + AddIngredient(7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index a43492d9e0..1f8298046b 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; 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/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 2f6b9a5492..d4ed994172 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 32; - Item.damage = 22; + Item.damage = 19; Item.DamageType = RogueDamageClass.Instance; Item.crit = 6; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 22; + Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3; Item.value = Item.buyPrice(gold: 10); // Sold by Bandit @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override float StealthVelocityMultiplier => 1.3f; - public override float StealthDamageMultiplier => 0.6f; + public override float StealthDamageMultiplier => 0.4f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { var p = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, -1f); diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 02bd23baf5..d673dd0cfe 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; 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 0beafe26c6..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,16 +10,20 @@ 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; - Item.damage = 45; - Item.crit = 7; + Item.damage = 35; + Item.crit = 3; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = 17; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; + Item.useTime = 17; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; 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/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index fdbb110ebd..7a08a73b3c 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 12; Item.DamageType = RogueDamageClass.Instance; Item.crit = 16; - Item.knockBack = 12; + Item.knockBack = 9; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; diff --git a/Items/Weapons/Rogue/LemonNade.cs b/Items/Weapons/Rogue/LemonNade.cs new file mode 100644 index 0000000000..478b7623da --- /dev/null +++ b/Items/Weapons/Rogue/LemonNade.cs @@ -0,0 +1,45 @@ +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class LemonNade : RogueWeapon + { + public override void SetDefaults() + { + Item.width = 26; + Item.height = 30; + Item.damage = 33; + Item.DamageType = RogueDamageClass.Instance; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); + } + + public override void HoldItem(Player player) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Lemon). + AddIngredient(ItemID.BouncyGrenade, 99). + AddTile(TileID.TinkerersWorkbench). + Register(); + } + } +} diff --git a/Items/Weapons/Rogue/LemonNade.png b/Items/Weapons/Rogue/LemonNade.png new file mode 100644 index 0000000000..7116727e0f Binary files /dev/null and b/Items/Weapons/Rogue/LemonNade.png differ 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/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 73a34dda76..bf62e3515b 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 40; - Item.damage = 45; + Item.damage = 33; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 26; 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..1e923764aa 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; 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 5c21deb49e..cee79c4396 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,12 +1,14 @@ -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Melee; +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; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -14,6 +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; @@ -36,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Rogue player.Calamity().mouseWorldListener = true; if (player.Calamity().mouseRight) { - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && player.Calamity().focusFlurryAttackCount < FlurryCount) { - player.Calamity().focusFlurryAttackCount = 30; + player.Calamity().focusFlurryAttackCount = FlurryCount; player.Calamity().ConsumeStealthByAttacking(); SoundStyle buff = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); SoundEngine.PlaySound(buff with { Volume = 1f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, player.Center); @@ -72,7 +79,7 @@ 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) { bool fastToss = player.Calamity().focusFlurryAttackCount > 0; - + SoundStyle fire = new("CalamityMod/Sounds/Item/SpearofDestiny"); SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = (player.Calamity().focusFlurryAttackCount > 0 ? -0.4f + (player.Calamity().focusFlurryAttackCount * 0.02f) : Main.rand.NextFloat(-0.4f, -0.65f)) }, position); // Since the positioning of the scythe is important, its velocity is based on your mouse position @@ -87,8 +94,10 @@ namespace CalamityMod.Items.Weapons.Rogue player.Calamity().focusFlurryAttackCount--; } player.Calamity().ConsumeStealthByAttacking(); - + return false; } + + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlurryCount); } } 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/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index b7be65a638..2b52df3964 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -12,12 +12,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 12; Item.height = 40; - Item.damage = 80; + Item.damage = 66; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 10; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index d05f728ce9..bb276e95a3 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 54; Item.height = 54; - Item.damage = 118; + Item.damage = 81; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 24; @@ -27,11 +27,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + float aiVal = player.Calamity().StealthStrikeAvailable() ? -12f : 0f; + int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, ai1: aiVal); if (javelin.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); 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/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 5814d9db9d..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; @@ -11,22 +13,28 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ProfanedPartisan : RogueWeapon { + 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; Item.height = 68; - Item.damage = 222; + Item.damage = 300; Item.crit = 15; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 18; - Item.useAnimation = 18; + 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/ReboundingRainbow.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs index e006335ca7..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; @@ -56,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } 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..c7110b796b 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,36 @@ 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 float StealthDamageMultiplier => 1f; + 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 0489ff32d1..e588335fb2 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 108; Item.height = 108; - Item.damage = 10000; + Item.damage = 8800; Item.crit = 20; Item.noMelee = true; Item.noUseGraphic = true; 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 1aa1b4dd1f..c058053e3e 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -11,40 +12,39 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SealedSingularity : RogueWeapon { + /// + /// Falloff per target hit simultaneously by the aura. Resets every hit interval + /// + public static float FalloffPerTargetHitByAura => 0.2f; + public static float FallofPerTargetHitByBomb => 0.3f; + public override void SetDefaults() { - Item.width = Item.height = 34; - Item.damage = 260; - Item.knockBack = 5f; - Item.useAnimation = Item.useTime = 25; - Item.useStyle = ItemUseStyleID.Swing; + Item.width = 32; + Item.height = 32; + Item.damage = 220; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - - Item.noMelee = Item.noUseGraphic = true; - Item.UseSound = SoundID.Item106; - + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.75f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index c55b583ae2..2bc2ac984a 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Rogue public class Seraphim : RogueWeapon { public const int SplitDaggerCount = 6; - public const int StealthStrikeLightCount = 7; + public const int StealthStrikeLightCount = 8; public override void SetDefaults() { Item.width = 82; Item.height = 82; - Item.damage = 320; + Item.damage = 280; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 13; diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index 40adf3c663..25dbb66d20 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } 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/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 519c1c8cb2..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,11 +11,19 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SpearofPaleolith : RogueWeapon { + public static int ShardBaseDamage => 28; + + 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 = 65; + Item.damage = 70; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 27; @@ -25,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 35f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } 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 3c9d4d3ddf..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) { @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } 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..1e806a465d 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; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 81900bf511..03fd321fe6 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -14,14 +14,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Supernova : RogueWeapon { + public static float StealthTimeInSeconds => 2f; public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f }; public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f }; public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f }; + + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 106; Item.height = 112; - Item.damage = 5036; + Item.damage = 5200; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 70; @@ -31,26 +37,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); + Item.channel = true; } - public override float StealthDamageMultiplier => 0.7f; + public override bool AltFunctionUse(Player player) => true; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override float StealthDamageMultiplier => 0.8f; + + public override void HoldItem(Player player) { - 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; - return false; - } - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) 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..e596c17d32 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,14 +26,14 @@ 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 float StealthDamageMultiplier => 1.0f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -48,11 +49,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..732db8f0bb 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; @@ -46,7 +52,6 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.SunplateBlock, 3). 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/Summon/AmphibiansGuitar.cs b/Items/Weapons/Summon/AmphibiansGuitar.cs index 3958287ca6..4f7e937905 100644 --- a/Items/Weapons/Summon/AmphibiansGuitar.cs +++ b/Items/Weapons/Summon/AmphibiansGuitar.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.channel = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; Item.useStyle = ItemUseStyleID.HoldUp; } 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 309102e5a2..dee0622c01 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -66,6 +66,11 @@ namespace CalamityMod.Items.Weapons.Summon EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); } + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3; + } + public override void SetDefaults() { Item.width = Item.height = 36; 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/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..a9cd33ee10 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,6 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() 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 a37f4cebd2..82d159fbb9 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; @@ -8,9 +10,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class CausticStaff : ModItem, ILocalizedModType + 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; 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/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 56b6601cad..da08793d07 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(BuffType(), summonTag); } public override void SetDefaults() 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..6d44a1e358 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 = 97; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; 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..744d8c80d3 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,6 +13,10 @@ 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; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 4ea967a21e..581ff50223 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 = 75; + 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..53a032d191 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,7 +16,11 @@ 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() { diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 1e6da182f1..ef31f7934b 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() { diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 1bbb84a7fc..3708030c8d 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,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.staff[Type] = true; ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index a1fcef6f85..82327f01db 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,7 +15,11 @@ 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() { 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..91a1ff43bd 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; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class FrostBlossomStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn]; + } public override void SetDefaults() { Item.width = 34; 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/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..761c97911c 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,6 +16,10 @@ 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; 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/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/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 579885a228..1e684ca31e 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; diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index b70e451dc8..992fcc965a 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 28; Item.height = 20; Item.mana = 10; - Item.damage = 8; + Item.damage = 7; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index d1d6cfef1f..85e6139d53 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -5,9 +5,11 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; 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; @@ -73,5 +75,29 @@ namespace CalamityMod.Items.Weapons.Summon AddTile(). Register(); } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + int currentCooldown = Main.LocalPlayer.Calamity().sarosEclipseBeamUsage; + float fill = 1 - currentCooldown / 300f; + + if (fill >= 1) + return; + + + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + 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; + Color colorFG = Color.Lerp(Color.OrangeRed, new Color(238, 226, 153), fill); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f); + } } } 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/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 98dd09eb39..571993ea24 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; 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/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 9d5ac24f1d..0bc84b41ec 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -58,8 +58,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandstoneBrick, 20). - AddIngredient(2). + AddIngredient(ItemID.Amber, 5). + AddIngredient(ItemID.AntlionMandible, 3). + AddIngredient(ItemID.PalmWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 06b5521bd9..eac44d1874 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; @@ -12,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; public const int BulletShootRate = 125; - + public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 30044336d3..60ffc3da53 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() { diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 5725ba1b3d..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,11 +12,16 @@ 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; Item.height = 60; - Item.damage = 40; + Item.damage = 56; Item.mana = 10; Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; 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/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index e71c91306d..1bb8e2897b 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons.Summon { ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(), summonTag); } public override void SetDefaults() @@ -158,11 +157,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() { @@ -173,7 +172,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; @@ -186,17 +185,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() { diff --git a/Items/Weapons/Summon/VoidEaterMarionette.cs b/Items/Weapons/Summon/VoidEaterMarionette.cs index cbcd6952e3..f74c703f3c 100644 --- a/Items/Weapons/Summon/VoidEaterMarionette.cs +++ b/Items/Weapons/Summon/VoidEaterMarionette.cs @@ -1,10 +1,9 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -19,6 +18,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; 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/ClaretCannon.cs b/Items/Weapons/Typeless/ClaretCannon.cs index f3c630c63e..3d8b5fee1c 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; diff --git a/Items/Weapons/UHFMurasama.png b/Items/Weapons/UHFMurasama.png deleted file mode 100644 index f8054f7eaf..0000000000 Binary files a/Items/Weapons/UHFMurasama.png and /dev/null differ 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 db28331712..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,52 +118,34 @@ 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. Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. 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 the 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. +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. DarkEnergy: - DesertNuisance: Though these serpents are of the Desert Scourge's species, they are notably younger and less developed. Choosing to hunt in a pack with the large scourge due to this weakness, many have seen them tear apart prey not unlike the piranhas that once populated the former sea. CosmicGuardian: Though of the same species as the nameless serpent, their minds and functions are far more basic. They possess very little will of their own and blindly follow the orders of their gluttonous master. DankCreeper: Divine puppeteers beheld incessantly through their devotees, an organic panopticon for a wicked hive mind. Their word was truth, and evidence otherwise was burned. Even in decay, they summon subjects to creep, spy and kill. -DarkHeart: Beneath all the schemes and lies, dark desires coiled inside the pitch-black hearts of these deities. With their forms rent beyond recognition, new hearts arise from their rot to beat with misery once more +DarkHeart: Beneath all the schemes and lies, dark desires coiled inside the pitch-black hearts of these deities. With their forms rent beyond recognition, new hearts arise from their rot to beat with misery once more. HiveBlob: The faceless are bulletproof, and so the corrupt coalescence shields itself behind dull pawns, as the gods it was birthed from once did. HiveTumor: This tumor acts as the brain of the putrid wasteland, being all that is left of the minds of the slain gods that lay there. The creatures of the Corruption exist to protect it, and those who attempt to harm it rarely live to tell the tale. AquaticAberration: A spawn of the immense Leviathan, their lifespan can be measured in hours. All they know is how to hunt for their masters. Even non-aquatic life is well within their reach, due to their uncanny ability to fly through air just as easily as swimming through water. 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 f9f02b828f..4c04ee824d 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -8,6 +8,11 @@ AlcoholPoisoning: { Description: You drank too much and you are now dying } +BaconOilBuff: { + DisplayName: Bacon Oil + Description: Oh gosh you spilled it all over yourself! +} + BloodyMaryBuff: { DisplayName: Bloody Mary Description: Increased enemy spawn rates, reduced piercing weapon effectiveness @@ -45,7 +50,7 @@ FireballBuff: { GrapeBeerBuff: { DisplayName: Grape Beer - Description: Ranged projectiles gain homing, reduced critical strike damage + Description: Ranged projectiles gain homing, reduced damage to distant foes } ManhattanBuff: { @@ -76,6 +81,7 @@ OldFashionedBuff: { RedWineBuff: { DisplayName: Red Wine Description: Increased vertical speed, reduced flight time + ItemTooltipPlayer: Causes Baguette to heal 200 HP, but reduce regeneration by 2 HP/s for 15 seconds } RumBuff: { @@ -397,6 +403,22 @@ WeakBrimstoneFlames: { Description: Using the Supreme Witch's power causes you to suffer, but makes your weapons strong } +WindChilled: { + DisplayName: Wind Chilled + Description: Should have worn a coat + ItemTooltipPlayer: + ''' + Cold - 2 DPS + Reduced movement speed + ''' + ItemTooltipEnemy: + ''' + Cold - 6 DPS + 1.5x damage if the enemy is inflicted with a Water debuff + Enhances Water debuff damage + ''' +} + // Mounts AndromedaBuff: { @@ -485,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 @@ -600,6 +627,11 @@ SparksBuff: { Description: Eats butterflies } +StarSwallowerPetBuff: { + DisplayName: Star Swallower + Description: Mmmm myes +} + ThirdSageBuff: { DisplayName: Third Sage Description: Eh? No way it's an oni @@ -674,7 +706,7 @@ AstralInjectionBuff: { BaguetteBuff: { DisplayName: Baguette - Description: Goes well with Red Wine + Description: Life regeneration reduced by 2 HP/s } BloodfinBoost: { @@ -731,6 +763,11 @@ SulphurskinBuff: { Description: The sulphuric waters have a lesser effect on you } +SwinesWrathBuff: { + DisplayName: Swine's Wrath + Description: Divine essence is rejecting your body +} + WeaponImbueBrimstone: { DisplayName: Weapon Imbue: Brimstone Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames @@ -789,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: { @@ -881,11 +918,6 @@ 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 -} - GraxBoost: { DisplayName: Grax Boost Description: Your defenses and muscles are strong @@ -995,7 +1027,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 10 and damage by 10% } SandsWindBuff: { @@ -1005,7 +1037,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: { @@ -1152,8 +1184,8 @@ Irradiated: { MarkedforDeath: { DisplayName: Marked for Death - Description: Damage reduction reduced - ItemTooltipEnemy: Damage reduction is 50% less effective + Description: Increased damage taken + ItemTooltipEnemy: Enemies take 1.1x damage } PearlAura: { @@ -1193,7 +1225,7 @@ WhisperingDeath: { DisplayName: Whispering Death Description: Death approaches; attack power and life regen reduced ItemTooltipPlayer: Negates life regen, reduces damage - ItemTooltipEnemy: Reduced contact damage + ItemTooltipEnemy: Reduced damage } WitherDebuff: { @@ -1203,7 +1235,7 @@ WitherDebuff: { Withered... Defense decreased by {0} ''' - ItemTooltipEnemy: Decreases defense + ItemTooltipEnemy: Decreases defense by 20 } // Summons @@ -1568,9 +1600,9 @@ PuffWarriorBuff: { Description: It confidently and excitedly protects you } -RareSandElemental: { - DisplayName: Rare Sand Elemental - Description: The Sand Elemental will heal you +OasisElementalBuff: { + DisplayName: Oasis Elemental + Description: The Oasis Elemental will heal you } ResurrectionButterflyBuff: { @@ -1598,11 +1630,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? @@ -1744,7 +1771,7 @@ Daybroken: { Shadowflame: { DisplayName: Shadowflame ItemTooltipPlayer: Heat - 15 DPS - ItemTooltipEnemy: Heat - 30 DPS + ItemTooltipEnemy: Heat - 20 DPS } ForbiddenStealthSummonTagBuff: { @@ -1752,6 +1779,15 @@ ForbiddenStealthSummonTagBuff: { Description: If you're seeing this, something went horribly wrong } +Malnourished: { + DisplayName: Malnourished + Description: + ''' + Minor reductions to all stats + Your liver feels stronger! + ''' +} + SeaKingsAssurance: { DisplayName: Sea King's Assurance Description: If you're seeing this, something assuredly went horribly wrong @@ -1767,14 +1803,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 77ec346020..96b23c9436 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -24,6 +24,12 @@ 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 SummonTagDamageFlat: "{0} summon tag damage" diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index b757a152d4..d7a27389e1 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -33,6 +33,7 @@ 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 @@ -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.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.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 74e1213f2a..630795df12 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -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: @@ -233,7 +238,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,12 +252,12 @@ AsgardsValor: { ''' } -AuricSoulArtifact: { - DisplayName: Auric Soul Artifact +FadedIdolatry: { + DisplayName: Faded Idolatry Tooltip: ''' - For each Fiery Draconid you have summoned, you gain 1 minion slot - Loyalty + 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?'] ''' } @@ -325,8 +330,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] ''' } @@ -350,7 +355,7 @@ BloomStone: { Tooltip: ''' Healing Potions are 50% more effective, but provide their healing over time - Grappling hooks retract and pull the player 50% faster, and grow a flower at hookpoints + Grappling hooks retract and pull the player 30 mph faster, and grow a flower at hookpoints Touching a flower makes it burst into pollen which gives a temporary boost to potion healing over time Potion healing slows drastically when at full health 'One of the ancient relics' @@ -390,12 +395,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...' ''' } @@ -588,12 +593,12 @@ DiamondOfTheDeep: { ''' } -DimensionalSoulArtifact: { - DisplayName: Dimensional Soul Artifact +CrushingEgo: { + DisplayName: Crushing Ego Tooltip: ''' - Multiplies all damage by 1.2x, but at the cost of taking 15% increased damage - Power + 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.'] ''' } @@ -658,13 +663,17 @@ EclipseMirror: { FlavorTooltip: "'Its reflection shows naught but darkness'" } -EldritchSoulArtifact: { - DisplayName: Eldritch Soul Artifact +FragmentsOfAnotherWorld: { + DisplayName: Fragments of Another World Tooltip: ''' - Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 15%, max minions by 1 and reduces mana cost by 25% Grants immunity to [cbuffplr:CalamityMod/WhisperingDeath] - Knowledge + {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.'] ''' } @@ -701,7 +710,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' ''' } @@ -729,8 +738,8 @@ EtherealTalisman: { DisplayName: Ethereal Talisman Tooltip: ''' - 15% increased magic damage, 5% increased magic critical strike chance - +150 max mana and 10% decreased mana usage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} Increases pickup range for mana stars You automatically use mana potions when needed [c/aaaaaa:Shift- in your inventory to toggle] [i:ManaFlower] [c/aaaaaa:Mana Flower's effect] @@ -760,7 +769,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: ''' @@ -774,6 +784,35 @@ FilthyGlove: { Tooltip: Stealth strikes have +8 armor penetration and deal 8% more damage } +FishStocks: { + DisplayName: Fish Stocks + Tooltip: + ''' + Pulls up a view of the fish stocks + Provides stats that are multiplied by the state of fish stocks + When unequipped, the effects will only be disabled once stocks are even or higher + ''' + HoldShiftTooltip: + ''' + Stats include: + +10 defense + +15% damage + +10% critical strike chance + +15% critical strike damage + +10% damage reduction + +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: { DisplayName: Flame-Licked Shell Tooltip: @@ -792,11 +831,12 @@ FleshTotem: { Tooltip: ''' 5% increased magic critical strike chance - +30 max mana + Increases maximum mana by 20 Summons an effigy above your head that stores mana as you use it, up to 600 mana - The effigy occasionally pulses, restoring 20 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 + The effigy is transparent and silent if visibility is disabled ''' } @@ -805,7 +845,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] ''' } @@ -814,10 +854,9 @@ FrostFlare: { Tooltip: ''' All attacks and projectiles inflict [cbuff:Frostburn2] - Grants immunity to Frostburn, Chilled and Frozen - Being above 50% life grants 10% increased damage - Being below 50% life grants 15 defense and 15% increased max movement speed and acceleration - Grants resistance against cold attacks + 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, [cbuffplr:Frostburn], [cbuffplr:Chilled] and [cbuffplr:Frozen] ''' } @@ -838,6 +877,7 @@ FungalSymbiote: { Consuming mushrooms provides [cbuffplr:CalamityMod/Mushy], granting 5 defense and +1 HP/s life regen 10% increased damage while you have [cbuffplr:CalamityMod/Mushy] ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } GiantPearl: { @@ -845,8 +885,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} ''' } @@ -855,8 +894,8 @@ GiantShell: { DisplayName: Giant Shell Tooltip: ''' - 10% reduced dash velocity - Taking a hit restores dash velocity and reduces defense for 3 seconds + {0}% reduced dash velocity + Taking a hit restores dash velocity and reduces defense for {1} seconds ''' } @@ -865,8 +904,8 @@ GiantTortoiseShell: { Tooltip: ''' {$Common.KnockbackImmunity} - 5% increased damage reduction and 10% reduced dash velocity - Taking a hit restores dash velocity and reduces defense and damage reduction for 3 seconds + {0}% increased damage reduction and {1}% reduced dash velocity + Taking a hit restores dash velocity and reduces defense and damage reduction for {2} seconds ''' } @@ -877,6 +916,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: { @@ -931,6 +971,11 @@ HarpyRing: { 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: { @@ -969,12 +1014,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: { @@ -1028,12 +1068,16 @@ IVDripOnTheRocks: { DisplayName: IV Drip on the Rocks Tooltip: ''' - Multiplies most non-weapon, non-debuff damage by {0}x - Multiplies all weapon damage by {1}x - Counts as an alcohol stack toward Alcohol Poisoning + [EFFECT] + [NAME] + Inserted alcohols contribute toward alcohol poisoning {$Common.AlcoholWarning} + [c/aaaaaa:Shift- this item in your inventory to empty its contents] [ceffect/drunk:'(drunken mumbling)'] ''' + Empty: Place an alcoholic beverage on this item in your inventory to pour its contents in + CurrentAlcoholText: Filled with + SakeAndAleText: Increases melee weapon scale by 25%, but decreases melee speed by 10% } JellyChargedBattery: { @@ -1041,7 +1085,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 ''' } @@ -1063,8 +1107,8 @@ LeviathanAmbergris: { DisplayName: Leviathan Ambergris Tooltip: ''' - 120% 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] + 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 Visual effects are reduced if visibility is disabled ''' } @@ -1092,18 +1136,19 @@ 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: { DisplayName: Mana Polarizer Tooltip: ''' - Increases max mana by 50 + Increases maximum mana by 40 Provides life regeneration and magic damage that scales based on how much mana you have Lower mana means more life regeneration, but less magic damage These scale from -2 to +2 HP/s, and 15% to 5% damage The provided regeneration is halved when under Mana Sickness - Magic projectiles steal enemy life while holding a magic weapon + Magic projectiles steal enemy life ''' } @@ -1130,13 +1175,14 @@ MoonstoneCrown: { DisplayName: Moonstone Crown Tooltip: ''' - +70 max mana + Increases maximum mana by 40 Summons a [c/27F5E0:Lunar Sigil] every 2 seconds, up to a maximum of 10 Each [c/27F5E0:Lunar Sigil] increases magic damage by 2% and reduces mana cost by 1% 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: ''' @@ -1151,9 +1197,9 @@ Nanotech: { ''' Rogue projectiles create nanoblades as they travel Stealth strikes summon nanobeams and sparks on enemy hits - Stealth strikes have +15 armor penetration, deal 5% more damage, and heal for 2 HP + Stealth strikes have lifesteal, +15 armor penetration, deal 5% more damage 15% increased rogue damage and 15% increased rogue velocity - Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds + Stealth strikes grant lifesteal and 10% critical strike chance to non-stealth strikes for 10 seconds ''' } @@ -1264,7 +1310,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 ''' } @@ -1281,7 +1327,7 @@ PermafrostsConcoction: { DisplayName: Permafrost's Concoction Tooltip: ''' - Increases maximum mana by 50 and reduces mana cost by 15% + Increases maximum mana by 40 and reduces mana cost by 15% +0.5 HP/s life regen below half health, +1 HP/s when below 25% health and +2 HP/s when below 10% health +3 HP/s life regen while afflicted with any fire debuff You will survive fatal damage and revive with 30% life on a 3 minute cooldown @@ -1311,7 +1357,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 ''' } @@ -1320,7 +1366,7 @@ PlanebreakersPouch: { DisplayName: Planebreaker's Pouch Tooltip: ''' - 15% increased ranged damage, 5% increased ranged critical strike chance and 20% reduced ammo usage + 15% increased ranged damage, 7% increased ranged critical strike chance and 20% reduced ammo usage Grants a 20% chance to not consume arrows Pressing [KEY] will automatically swap the ammos in your ammo slots The ammo type swapped depends on the ammo of the weapon you are holding @@ -1435,12 +1481,12 @@ RampartofDeities: { ToggleEffect: ", increases movement speed," } -RareElementalinaBottle: { - DisplayName: Rare Elemental in a Bottle +OasisElementalinaBottle: { + DisplayName: Oasis Elemental in a Bottle Tooltip: ''' - Summons a sand elemental to heal you - ;D + Summons an oasis elemental to assist you + The elemental fires healing orbs that restore 10 health while you are damaged ''' } @@ -1449,7 +1495,7 @@ ReaperToothNecklace: { Tooltip: ''' 20% increased damage - Increases armor penetration by 15 + Increases armor penetration by 30 'A grisly trophy from the ultimate predator' ''' } @@ -1614,12 +1660,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 ''' } @@ -1627,8 +1669,8 @@ SigilofCalamitas: { DisplayName: Sigil of Calamitas Tooltip: ''' - 15% increased magic damage and 10% decreased mana usage - +100 max mana + {$CommonItemTooltip.IncreasesMaxManaBy} + {$CommonItemTooltip.PercentIncreasedMagicDamage@1} Increases pickup range for mana stars ''' } @@ -1693,7 +1735,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 ''' } @@ -1838,6 +1880,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: { @@ -1878,7 +1925,7 @@ TheAmalgam: { DisplayName: The Amalgam Tooltip: ''' - All attacks inflict a variety of debuffs, 300% increased elemental debuff damage + All attacks inflict a variety of debuffs, 200% increased elemental debuff damage Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds @@ -2014,6 +2061,7 @@ TrinketofChi: { This buff expires on hit +{2} HP/s life regen for you and your teammates ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } UnholyTonic: { @@ -2032,6 +2080,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: { @@ -2226,10 +2275,13 @@ XyksBlessingBlue: { Tooltip: ''' Applies visual effects to your dashes, wings, and deaths - to transform + this item in your inventory to transform it, or Shift- to toggle armor visibility + Armor visibility is [TOGGLE] 'It's simply too much to turn back now; passion and time have long since stained it. [c/5f8ae1:Have I always been so selfish?'] ''' + ArmorDisabled: "[c/D44748:DISABLED]" + ArmorEnabled: "[c/58D447:ENABLED]" } XyksBlessingOrange: { @@ -2237,8 +2289,29 @@ XyksBlessingOrange: { Tooltip: ''' Applies visual effects to your dashes, wings, and deaths - to transform + this item in your inventory to transform it, or Shift- to toggle armor visibility + Armor visibility is [TOGGLE] 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. [c/E1B65F:Prove that it was never a waste.'] ''' + 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?'] + ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" + 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..a1531dea4b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -102,7 +102,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 +171,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.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 7d07b1699f..e7a6ec4fc8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -220,7 +220,7 @@ BloodflareHeadMelee: { } BloodflareHeadRanged: { - DisplayName: Bloodflare Horned Helm + DisplayName: Bloodflare Demon Helm Tooltip: ''' {$CommonItemTooltip.PercentIncreasedRangedDamageCritChance} @@ -422,7 +422,7 @@ GodSlayerChestplate: { Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" CommonSetBonus: ''' - Press {0} to [ceffect/dog:Dimensional Drive] towards your cursor for 2 seconds + Press {0} to [ceffect/dog:Dimensional Drive] towards your cursor for 1.25 seconds Enemies you dash through take massive damage During [ceffect/dog:Dimensional Drive] you are immune to damage and most debuffs [ceffect/dog:Dimensional Drive] has a {1} second cooldown 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 ebc986797d..54d12b191e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -1,4 +1,4 @@ -// Quest fish tooltips +// Quest fish tooltips CaughtInAstral: Caught in the Astral Infection CaughtInBrimstoneCrag: Caught in the Brimstone Crag CaughtInSnow: Caught in Tundra @@ -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 ''' } @@ -281,9 +265,14 @@ 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: { @@ -344,8 +333,8 @@ RiftReeler: { DisplayName: Rift Reeler Tooltip: ''' - Fires four lines at once - Can fish in lava + Fires four lines at once. Bobbers deal damage upon contact with enemies + Allows fishing in lava 'The battlefield is a scene of constant chaos. The winner will be the one who controls that chaos, both the pole and the fish.' ''' @@ -355,7 +344,7 @@ SlurperPole: { DisplayName: Slurper Pole Tooltip: ''' - Can fish in lava + Allows fishing in lava 'It is the burning lava of the soul that has a furnace within--a very volcano of grief and sorrow.' ''' } @@ -364,7 +353,7 @@ TheDevourerofCods: { DisplayName: The Devourer of Cods Tooltip: ''' - Fires ten lines at once. Line never snaps and can fish from lava + Fires ten lines at once. Line never breaks and allows fishing in lava Hooked items stay hooked forever Common fish are automatically consumed while fishing Consuming fish allows a bobber to hook a new item and feeds the user @@ -372,6 +361,16 @@ TheDevourerofCods: { ''' } +TrustyOldRod: { + DisplayName: Trusty Old Rod + Tooltip: Allows for especially..."exotic" hauls + SalesPitch: + ''' + '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!' + ''' +} + VerstaltiteFishingRod: { DisplayName: Verstaltite Fishing Rod Tooltip: @@ -391,35 +390,27 @@ WulfrumRod: { } // Bait +RageBait: { + DisplayName: Rage Bait + Tooltip: + ''' + 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!' + ''' +} + GrandMarquisBait: { DisplayName: Grand Marquis Bait Tooltip: "" } // Bobbers -ScrapBobber: { - DisplayName: Wulfrum Bobber - Tooltip: - ''' - Provides a fishing minigame - Hold movement inputs in the indicated directions while fishing to catch items - The rod empowers the longer you go without a mistake, speeding it up - 'There's supposed to be a fish finder installed, but it only beeps when you point it at yourself...' - ''' -} - -NavystoneBobber: { - DisplayName: Sunken Sinker - Tooltip: - ''' - {$ItemTooltip.FishingBobber} - Provides a fishing minigame - The bobber will float at your height underwater, allowing underwater fishing - Move in the indicated direction while fishing to catch items - ''' -} - -SkylineBobber: { +AcrobaticBobber: { DisplayName: Acrobatic Bobber Tooltip: ''' @@ -432,7 +423,7 @@ SkylineBobber: { ''' } -PerennialBobber: { +FeralBobber: { DisplayName: Feral Bobber Tooltip: ''' @@ -444,7 +435,18 @@ PerennialBobber: { ''' } -ScoriaBobber: { +SunkenSinker: { + DisplayName: Sunken Sinker + Tooltip: + ''' + {$ItemTooltip.FishingBobber} + Provides a fishing minigame + The bobber will float at your height underwater, allowing underwater fishing + Move in the indicated direction while fishing to catch items + ''' +} + +VolcanicSinker: { DisplayName: Volcanic Sinker Tooltip: ''' @@ -456,3 +458,14 @@ ScoriaBobber: { When bobbers touch a rift, they automatically reel in the item within ''' } + +WulfrumBobber: { + DisplayName: Wulfrum Bobber + Tooltip: + ''' + Provides a fishing minigame + Hold movement inputs in the indicated directions while fishing to catch items + The rod empowers the longer you go without a mistake, speeding it up + 'There's supposed to be a fish finder installed, but it only beeps when you point it at yourself...' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index ba2ebe56aa..442de828f9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -143,11 +143,6 @@ ExoPrism: { Tooltip: Fractal energies shimmer across its surface } -GalacticaSingularity: { - DisplayName: Galactica Singularity - Tooltip: A shard of the cosmos -} - GrandScale: { DisplayName: Grand Scale Tooltip: Large scale of an apex predator @@ -175,12 +170,7 @@ Lumenyl: { MeldBlob: { DisplayName: Meld Blob - Tooltip: "" -} - -MeldConstruct: { - DisplayName: Meld Construct - Tooltip: "" + Tooltip: "'Shrieks of distorted memories echo within this mass' " } MiracleMatter: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 18c738eb26..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: "" @@ -329,3 +334,8 @@ LegendaryShortTooltip: [c/FF6F00:Tales of legends past radiate around you...] [c/BABABA:Hold Shift to listen closer] ''' + +DisgustingSlop: { + DisplayName: Disgusting Slop + Tooltip: Can be extractinated +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson index 50f567d1bb..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 @@ -165,6 +175,11 @@ RottingEyeball: { Tooltip: Summons a corrupted conglomeration } +StarSwallowerUnit: { + DisplayName: Star Swallower Unit + Tooltip: Summons a biomechanical frog +} + StrangeOrb: { DisplayName: Strange Orb Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 4a8f1cc711..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: { @@ -798,6 +781,20 @@ GloomTorch: { Tooltip: "" } +GluttonyBlender: { + DisplayName: Gluttony Blender + Tooltip: + ''' + 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: { DisplayName: Lantern Center Tooltip: Lights up the night sky with celebratory lanterns @@ -838,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.'" @@ -878,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: @@ -924,7 +902,7 @@ ThankYouPainting: { ''' Thanks to the entire team, everyone who supported, and those who all play the mod and keep it alive! The confines of this painting is not enough to fit the entire team - Hold Shift to see a list of past and current developers + Hold Shift to see a list of developers and press Shift to switch between current and past developers ''' } @@ -933,6 +911,11 @@ PiggyCage: { Tooltip: "" } +PiggyCageGold: { + DisplayName: Gold Piggy Cage + Tooltip: "" +} + RefractivePrismTorch: { DisplayName: Refractive Prism Torch Tooltip: Can be placed in water @@ -964,6 +947,11 @@ SeaMinnowJar: { Tooltip: "" } +ShroombleCage: { + DisplayName: Shroomble Cage + Tooltip: "" +} + SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: @@ -980,16 +968,25 @@ SulphurousTorch: { Tooltip: Can be placed in water } -SunkenIdol: { - DisplayName: Sunken Idol - Tooltip: "" -} - ThaumaticChair: { DisplayName: Thaumatic Chair Tooltip: One of Chloe's finest creations } +TheMonument: { + DisplayName: The Monument + Tooltip: + ''' + 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: { DisplayName: Thermal Torch Tooltip: @@ -4695,3 +4692,25 @@ MossyStone: { DisplayName: Mossy Stone Tooltip: "" } + +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 a4c20d91d5..666b282305 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -8,7 +8,7 @@ AstralInjection: { Tooltip: ''' Restores {0} mana per second - Lower your health by {1} and inflicts {$BuffName.ManaSickness} when used + Inflicts [cbuff:ManaSickness] when used ''' } @@ -22,6 +22,7 @@ Baguette: { Tooltip: ''' {$CommonItemTooltip.MinorStats} + Goes well with [cbuffplr:CalamityMod/RedWineBuff] [c/FCE391:'je suis Monte'] ''' } @@ -64,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...' ''' } @@ -156,6 +158,21 @@ SupremeManaPotion: { Tooltip: "" } +TheConcoction: { + DisplayName: The Concoction + 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: { DisplayName: Zen Potion Tooltip: Vastly decreases enemy spawn rate @@ -166,6 +183,27 @@ ZergPotion: { Tooltip: Vastly increases enemy spawn rate } +BaconOil: { + DisplayName: Bacon Oil + Tooltip: + ''' + Provides "good" mobility that scales with your damage stat boosts + Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} + {$Common.AlcoholWarning} + ''' + DripEffect: + ''' + Provides "good" mobility that scales with your damage stat boosts + 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: { DisplayName: Bloody Mary Tooltip: @@ -174,6 +212,12 @@ BloodyMary: { Greatly reduces piercing weapon effectiveness {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases enemy spawn rates by 7x + Greatly reduces piercing weapon effectiveness + When combined with drinking Bloody Mary straight, enemy spawn rates are increased by 10x total + ''' } CaribbeanRum: { @@ -184,6 +228,11 @@ CaribbeanRum: { Reduces your gravity by {1}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases move speed by {0}% + Reduces your gravity by {1}% + ''' } CinnamonRoll: { @@ -194,14 +243,10 @@ CinnamonRoll: { Greatly reduces dash distance {$Common.AlcoholWarning} ''' -} - -PurpleHaze: { - DisplayName: Purple Haze - Tooltip: + DripEffect: ''' - For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% - {$Common.AlcoholWarning} + Greatly increases dash speed + Greatly reduces dash distance ''' } @@ -214,6 +259,12 @@ Everclear: { Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased damage + Reduces life regen by {1} HP/s and defense by {2}% + Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} + ''' } EvergreenGin: { @@ -224,6 +275,11 @@ EvergreenGin: { {1}% decreased Electric and Heat debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Water and Sickness debuff damage + {1}% decreased Electric and Heat debuff damage + ''' } Fireball: { @@ -234,6 +290,11 @@ Fireball: { {1}% decreased Sickness debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Heat debuff damage + {1}% decreased Sickness debuff damage + ''' } GrapeBeer: { @@ -241,9 +302,17 @@ GrapeBeer: { Tooltip: ''' Bullets, Arrows, Darts, and Rockets gain homing - {0}% reduced critical strike damage + Projectiles deal less damage the further the enemy is + This reaches a minimum of {0}x damage at {1} tiles away {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Bullets, Arrows, Darts, and Rockets gain homing + Projectiles deal less damage the further the enemy is + This reaches a minimum of {0}x damage at {1} tiles away + When combined with drinking Grape Beer straight, homing range is increased + ''' } Manhattan: { @@ -254,6 +323,11 @@ Manhattan: { {1}% decreased Water debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Cold debuff damage + {1}% decreased Water debuff damage + ''' } Margarita: { @@ -264,6 +338,11 @@ Margarita: { Reduces damage of debuffs you inflict by {0}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Halves duration of harmful debuffs you receive + Reduces damage of debuffs you inflict by {0}% + ''' } Moonshine: { @@ -275,6 +354,12 @@ Moonshine: { Defense damage takes three times as long to recover {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases maximum health by {0}% + Attacks always take at least half your defense worth of defense damage + Defense damage takes three times as long to recover + ''' } MoscowMule: { @@ -285,6 +370,11 @@ MoscowMule: { Reduces the effectiveness of piercing weapons {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased knockback, all attacks inflict heavy knockback + Reduces the effectiveness of piercing weapons + ''' } OddMushroom: { @@ -292,7 +382,7 @@ OddMushroom: { Tooltip: ''' Causes you to see many fake, vibrant copies of all nearby entities - [c/FF232C:These visual effects may be nauseating or otherwise bad for some] + [c/FF232C:These visual effects may be nauseating or harmful to those with photosensitivity issues] 'Trippy' ''' } @@ -305,6 +395,21 @@ OldFashioned: { Multiplies all weapon damage by {1}x {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Multiplies most non-weapon, non-debuff damage by {0}x + Multiplies all weapon damage by {1}x + ''' +} + +PurpleHaze: { + DisplayName: Purple Haze + Tooltip: + ''' + For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% + {$Common.AlcoholWarning} + ''' + DripEffect: For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% } RedWine: { @@ -315,6 +420,11 @@ RedWine: { {1}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased vertical speed + {1}% reduced flight time + ''' } Rum: { @@ -325,6 +435,11 @@ Rum: { {1}% decreased minion damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased non-minion summon damage + {1}% decreased minion damage + ''' } Screwdriver: { @@ -335,6 +450,11 @@ Screwdriver: { Greatly reduces damage dealt {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases tile and wall placement range and speed + Greatly reduces damage dealt + ''' } StarBeamRye: { @@ -345,6 +465,11 @@ StarBeamRye: { Magic weapons deal {0}x damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases Mana regeneration, even while using an item + Magic weapons deal {0}x damage + ''' } Tequila: { @@ -355,6 +480,11 @@ Tequila: { {1}% decreased Cold debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Electric debuff damage + {1}% decreased Cold debuff damage + ''' } TequilaSunrise: { @@ -365,6 +495,25 @@ TequilaSunrise: { {0}% increased damage taken from debuffs {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases natural life regeneration after suffering a damaging debuff + {0}% increased damage taken from debuffs + ''' +} + +TheElixir: { + DisplayName: The Elixir + Tooltip: + ''' + 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: { @@ -375,6 +524,11 @@ Vodka: { {1}% decreased elemental debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Typeless debuff damage + {1}% decreased elemental debuff damage + ''' } Whiskey: { @@ -387,6 +541,14 @@ Whiskey: { This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Provides between {0}% and {1}% damage to the held weapon's class + Each class tracks this boost individually + This boost lowers the longer you hold weapons of the same class, taking {2} seconds to fully decay + This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge + When combined with drinking Whiskey straight, damage varies between {4}% and {5}% + ''' } WhiteWine: { @@ -397,6 +559,11 @@ WhiteWine: { {0}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + You regain flight time the closer you are to an enemy + {0}% reduced flight time + ''' } // Food @@ -433,6 +600,15 @@ Mangosteen: { ''' } +QualitySlop: { + DisplayName: Quality Slop + Tooltip: + ''' + {$CommonItemTooltip.MajorStats} + 'You only like it because it's good' + ''' +} + Salak: { DisplayName: Salak Tooltip: "{$CommonItemTooltip.MinorStats}" @@ -446,3 +622,21 @@ ShroomBowl: { 'He has been grounded' ''' } + +TheSandwich: { + DisplayName: The Sandwich + Tooltip: + ''' + A sandwich made of the finest bread, cheese, and fish in the land! + Minor reductions to all stats + {0}% increased damage for every alcohol you are affected by + Allows you to drink 2 more alcohols than normal + 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 8423bc9f44..3ae132b727 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -177,7 +177,7 @@ MarkofProvidence: { Summons the Ceaseless Void Despawns on the surface ''' - SpawnSignus: Summons Signus, Envoy of the Devourer + SpawnSignus: Summons Signus SpawnWeaver: Summons the Storm Weaver } @@ -289,6 +289,16 @@ Terminus: { Tooltip: Hold to start or end the Boss Rush } +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: { DisplayName: Blessed Phoenix Egg Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 0719eba5fb..589bc10f15 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -13,6 +13,23 @@ AerialHamaxe: { Tooltip: "" } +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 + 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: { DisplayName: Anti-Cyst Ointment Tooltip: @@ -39,7 +56,7 @@ AridArtifact: { ''' Summons a sandstorm The sandstorm will happen shortly after the item is used - If used during a sandstorm, the sandstorm will stop some time afterward. + If used during a sandstorm, the sandstorm will stop some time afterward ''' } @@ -141,6 +158,20 @@ BrokenWaterFilter: { ''' } +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 + ''' + 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!” + ''' +} + Cosmolight: { DisplayName: Cosmolight Tooltip: @@ -166,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 ''' } @@ -205,6 +236,23 @@ GreatbayPickaxe: { Tooltip: Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals } +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 + 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: { DisplayName: Inferna Cutter Tooltip: @@ -268,6 +316,23 @@ NormalityRelocator: { ''' } +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 + 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: { DisplayName: Reefclaw Hamaxe Tooltip: "" @@ -292,10 +357,12 @@ RelicOfResilience: { Tooltip: ''' Holding this item creates orbiting rock shards around you and nearby allies - While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10% - Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies - This effect has a 10 second cooldown after taking a hit - Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you + After 5 seconds, the relic will retain orbiting rocks even when not holding the item + Continuing to hold the item will steadily increase the number of rocks and defenses until reaching max power + While they orbit you, your minimum defense is set to 200 and minimum damage reduction to 10% + Taking a hit or pressing while holding this item will pull in the shards, then blast them outward, crippling hit enemies + This effect has a 10 second cooldown after taking a hit, but recharges faster if holding the item + Holding out the shield heavily reduces the damage of all summons [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.] [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.] [c/FF8C00:But when She put faith in my shield, I would never again let it falter.] @@ -358,6 +425,21 @@ TectonicTruncator: { Tooltip: "" } +TheGift: { + DisplayName: The Gift + Tooltip: + ''' + 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 + ''' + 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!' + ''' +} + TorrentialTear: { DisplayName: Torrential Tear Tooltip: @@ -368,6 +450,23 @@ TorrentialTear: { ''' } +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 + 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: { DisplayName: Voodoo Demon Voodoo Doll Tooltip: @@ -390,7 +489,7 @@ WulfrumDiggingTurtle: { WulfrumDrill: { DisplayName: Wulfrum Drill - Tooltip: "" + Tooltip: "{$Common.ArmorPenetration}" } WulfrumScaffoldKit: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson index 61238dff19..b9516e17d0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson @@ -105,7 +105,7 @@ RavagerBag: { } SignusBag: { - DisplayName: Treasure Bag (Signus, Envoy of the Devourer) + DisplayName: Treasure Bag (Signus) Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 0ab28aaaf8..1e018efe36 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -18,6 +18,7 @@ AqueousHunterDrone: { while holding any summon weapon to command the shrimp to launch a vertical missile barrage Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground Each shrimp uses 4 minion slots + {$Common.ArmorPenetration} [c/1FFBFF:'When pursuing the adherents of gods, Yharim believed no stone should be left unturned.] [c/1FFBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] ''' @@ -40,7 +41,7 @@ CountermeasureMitt: { ''' A precision welding glove with laser emitters in each fingertip to focus all emitters into a short range palm blast that always critically strikes - Palm blasts have a cooldown which is significantly shorter if they miss + Palm blasts restore a large amount of mana on hit and have a cooldown which is significantly shorter if they miss [c/1FFBFF:'Most battalions prefer to either spread attacks widely, or focus on a singular target.] [c/1FFBFF:This glove caters to both, though it will never bridge the gap between their strategies.'] ''' @@ -65,7 +66,6 @@ HolofibreImmolator: { Holding quickly charges the bow, firing a high-speed plasma arrow Plasma arrows will detonate after impact, creating stronger explosions if stuck into tiles Holding will repeatedly fire uncharged shots - Holding and will automatically fire charged arrows at a slightly slower rate [c/1FFBFF:'The elegance of holofibre is unmatched.] [c/1FFBFF:However, mechanical tension may have produced more consistent results.'] ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index ce22045fcb..4730855f11 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,12 @@ AetherfluxCannon: { AethersWhisper: { DisplayName: Aether's Whisper - Tooltip: - ''' - Inflicts long-lasting [cbuff:CalamityMod/Shadowflame] and splits on tile hits - Projectiles gain damage as they travel - ''' + Tooltip: Fires void beams that gain damage as they travel and split on tile hits } AlulaAustralis: { DisplayName: Alula Australis - Tooltip: Fires a beautiful aurora that inflicts [cbuff:CalamityMod/AstralInfectionDebuff] trailed by a star shower + Tooltip: Fires a beautiful aurora that spreads the [cbuff:CalamityMod/AstralInfectionDebuff] and is trailed by a star shower } AlphaDraconis: { @@ -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' ''' } @@ -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 ''' } @@ -702,8 +696,8 @@ RecitationoftheBeast: { DisplayName: Recitation of the Beast Tooltip: ''' - Summons beast scythes around the player in a small circle, - before firing toward the cursor and home in to nearby enemies + Summons beast scythes around the player in a small circle + Beast scythes fire toward the cursor and home in to nearby enemies ''' } @@ -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 1d68029706..43d0904593 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: { @@ -88,7 +83,7 @@ ArkoftheCosmos: { ''' to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability - You can also parry projectiles to make them deal 160 less damage for a short period + 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 @@ -111,19 +106,19 @@ ArkoftheElements: { ''' to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability - You can parry projectiles to make them deal 100 less damage for a short period + You can parry projectiles to make them deal 60 less damage for a short period Parrying will empower the next 10 swings of the sword, letting you use both blades at once ''' } 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 +161,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 +181,7 @@ BladecrestOathsword: { BlightedCleaver: { DisplayName: Blighted Cleaver - Tooltip: Fires homing blazing blades + Tooltip: Fires homing, blazing blades } Bonebreaker: { @@ -194,7 +189,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 +200,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 +212,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 +265,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 +286,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 +390,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 ''' } @@ -405,7 +400,7 @@ DragonRage: { Tooltip: ''' Twirls a baton that causes explosions of [cbuff:CalamityMod/Dragonfire] on enemy hits - Every ten hits will summon a ring of fireballs + Once every two seconds, hits summon a ring of fireballs that target the enemy with the most health ''' } @@ -420,18 +415,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 +493,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 +633,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 +756,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 ''' } @@ -779,11 +770,9 @@ Lacerator: { The saw does more damage the more often the yoyo hits, and fades away when not striking enemies Enemies touching the edge of the sawblade get blood orbs torn out of them Picking up these blood orbs reduces the duration of [cbuffplr:PotionSickness] - The direction of the saw's spin depends on which direction you originally threw the yoyo - [GFB] + The direction of the saw's spin depends on which direction you originally threw the yoyo[GFB] ''' - TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol - TooltipGFB: May be a viable weapon against DoG... + GFBFlavor: "[c/ff0a0a:May be a viable weapon against DoG...]" } LifehuntScythe: { @@ -806,7 +795,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 ''' @@ -906,14 +895,14 @@ Nadir: { DisplayName: Nadir Tooltip: ''' - Fires void essences which flay nearby enemies with [cbuff:CalamityMod/Nightwither] 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: { @@ -936,7 +925,7 @@ Oblivion: { 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.] @@ -993,8 +982,10 @@ Pandemic: { DisplayName: Pandemic Tooltip: ''' - {$Common.YoyoStatsInfinite} - Fires plague seekers when enemies are near + {$Common.YoyoStats} + Each unique enemy struck that is infected with [cbuff:CalamityMod/Plague] increases the yoyo's size, power, and airtime + Refreshes [cbuff:CalamityMod/Plague] duration if a target is already infected + Counterweights inflict [cbuff:CalamityMod/Plague] and move twice as fast ''' } @@ -1017,7 +1008,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 +1057,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 +1076,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 +1106,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 +1114,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 +1173,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 ''' } @@ -1283,7 +1278,7 @@ TaintedBlade: { TeardropCleaver: { DisplayName: Teardrop Cleaver - Tooltip: Gives your enemies [cbuff:CalamityMod/TemporalSadness] + Tooltip: Makes your enemies cry } TenebreusTides: { @@ -1291,7 +1286,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 +1339,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 +1357,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' ''' } @@ -1380,7 +1379,11 @@ TheObliterator: { {$Common.YoyoStatsInfinite} [GFB] ''' - TooltipNormal: Occasionally performs a miniature [ceffect/dog:Dimensional Drive] at nearby foes + TooltipNormal: + ''' + Occasionally performs a miniature [ceffect/dog:Dimensional Drive] at nearby foes + Counterweight hits instantly begin another [ceffect/dog:Dimensional Drive] + ''' TooltipGFB: just a slight bit of dust spam on this weapon im afraid } @@ -1389,7 +1392,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' ''' @@ -1399,7 +1402,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 ''' } @@ -1411,7 +1414,7 @@ TriactisTruePaladinianMageHammerofMight: { Throws a heavy, gravity-affected hammer that will return to you after striking an enemy Enemy hits release prismatic light flares which orbit around the struck foe Instead of returning, the fourth hit transforms flares into hardlight hammers - These hammers converge and form a universe-collapsing explosion + These hammers converge and form a universe-collapsing explosion that always critically strikes ''' } @@ -1426,7 +1429,7 @@ TrueArkoftheAncients: { ''' to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you brief invulnerability - You can also parry projectiles to make them deal 80 less damage for a short period + You can also parry projectiles to make them deal 30 less damage for a short period Parrying will empower the next 10 swings of the sword, letting it throw stronger projectiles ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 7a6aa94689..6239730850 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -60,7 +60,7 @@ 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 ''' } @@ -75,6 +75,11 @@ Arbalest: { ''' } +AquashardShotgun: { + DisplayName: Aquashard Shotgun + Tooltip: Converts musket balls into aquashards that split upon hitting an enemy +} + Archerfish: { DisplayName: Archerfish 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 ''' } @@ -286,7 +295,6 @@ Condemnation: { ''' Fires powerful scarlet bolts suffused with hateful magics Hold to load up to nine bolts for powerful burst fire - Hold to use the repeater full auto ''' } @@ -328,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: { @@ -384,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} ''' @@ -396,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 @@ -416,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: { @@ -426,7 +434,6 @@ FetidEmesis: { Fires an accelerating stream of bullets until the barrel overheats When the barrel overheats, a spread of fetid chunks is vomited out After firing, the gun must cool back down before it can be used again - Pressing while firing will instantly launch the chunks {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' } @@ -436,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?' @@ -518,7 +525,7 @@ GoldenEagle: { Goobow: { DisplayName: Goobow - Tooltip: Fires two streams of slime + Tooltip: Addtionally fires two streams of damaging slime } GunkShot: { @@ -563,9 +570,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] ''' } @@ -603,7 +611,7 @@ Hydra: { DisplayName: Hydra Tooltip: ''' - Fires a spread of 4 [cbuff:Venom] bullets + 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 @@ -616,7 +624,8 @@ Infinity: { Tooltip: ''' Fires a twin stream of energy bolts that split - {$CommonItemTooltip.PercentChanceToSaveAmmo} + {$Common.ArmorPenetration} + {$CommonItemTooltip.PercentChanceToSaveAmmo@1} 'They say infinity is neverending, yet you hold it in your hands' ''' } @@ -643,7 +652,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' ''' @@ -711,8 +720,10 @@ Megalodon: { DisplayName: Megalodon Tooltip: ''' - Rapidly fires alternating bullets and pressurized water jets - Water jets consume no ammo + Loads a 30 round magazine of bullets and pressurized water jets that are rapidly unleashed + After firing, the gun unleashes a powerful homing rocket before reloading + Rocket damage is based on how many shots hit + {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' } @@ -768,7 +779,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: { @@ -841,12 +852,29 @@ 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 + ''' + 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!' + ''' +} + 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] ''' } @@ -891,7 +919,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 @@ -904,7 +932,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 ''' } @@ -925,12 +953,14 @@ PolarisParrotfish: { ''' Rapidly fires an array of colorful star shots Firing speed increases the closer you are to an enemy + {$Common.ArmorPenetration} 'It carries the mark of the Northern Star' ''' TooltipGFB: ''' Rapidly fires an array of colorful star shots Firing speed increases the closer you are to an enemy + {$Common.ArmorPenetration} to give the little girl some attention 'She is a happy girl' ''' @@ -1057,9 +1087,10 @@ Seadragon: { DisplayName: Seadragon Tooltip: ''' - Unleashes a deluge of alternating bullets and pressurized water jets - Additionally fires rockets and emits devastating muzzle blasts - Water jets consume no ammo + Loads a 50 round magazine of alternating bullets and pressurized water jets + Water jets summon small fish that swim around you + When all bullets are fired, summoned fish swarm the cursor while you reload + {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' } @@ -1094,18 +1125,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: @@ -1134,14 +1153,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: { @@ -1171,9 +1190,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} @@ -1195,7 +1214,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: { @@ -1236,7 +1255,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' ''' @@ -1244,7 +1263,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: { @@ -1262,7 +1281,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 ''' } @@ -1278,7 +1297,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: @@ -1303,7 +1321,8 @@ Svantechnical: { Tooltip: ''' Fires a trinity of energy bolts that split into beams that track your cursor - {$CommonItemTooltip.PercentChanceToSaveAmmo} + {$Common.ArmorPenetration} + {$CommonItemTooltip.PercentChanceToSaveAmmo@1} 'The age old balance of trading damage for frames' ''' } @@ -1316,7 +1335,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' ''' } @@ -1336,20 +1354,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 ''' @@ -1362,7 +1371,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: { @@ -1374,7 +1383,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 ''' } @@ -1385,8 +1394,6 @@ TheSevensStriker: { ''' Press to consume 1 coin and play a slot machine The quality of the outcome depends on the coin used - Press to rapidly fire a barrage of coins - The coin barrage has an {0}% chance to save ammo and will not fire platinum coins 'A gun given to a great gunslinger Forged by the arms of a man given no name' ''' @@ -1398,7 +1405,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 ''' } @@ -1409,6 +1416,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 ''' } @@ -1432,7 +1440,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' ''' @@ -1443,7 +1451,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} ''' } @@ -1471,9 +1479,11 @@ Voidragon: { DisplayName: Voidragon Tooltip: ''' - Fires [cbuff:CalamityMod/Voidfrost] blasts that explode every other shot - Shoots demon flame tentacles alongside every shot - Void blasts consume no ammo and bullets have a {0}% chance to save ammo + Loads a 50 round magazine of alternating bullets and concentrated void blasts + When all bullets are fired, the gun unleashes an enormous jet of abyssal fire + The power of the abyssal fire scales with the amount of shots hit + {$CommonItemTooltip.PercentChanceToSaveAmmo} + [c/620BB0:'Fade to black'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 689983fb5d..51e11a5e97 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 ''' @@ -339,8 +340,11 @@ DuststormInABottle: { DisplayName: Duststorm in a Bottle Tooltip: ''' - Explodes into a dust cloud - Stealth strikes form a more intense and longer lasting dust cloud + Disables normal stealth generation + Throws a bottle filled with high-pressure dust that shatters on impact with a target or after a short delay + Hold to generate stealth, but cause the bottle to shatter sooner + Stealth strikes cause the bottle to leak dust clouds around it for a few seconds instead of shattering + Will shatter in your hand if charged for too long ''' } @@ -358,9 +362,27 @@ EclipsesFall: { DisplayName: Eclipse's Fall Tooltip: ''' - Summons spears from the sky on hit - Stealth strikes impale enemies and summon a constant barrage of spears over time - 'When the sun goes dark, you will know judgement' + Throws a javelin that shatters into fragments of primordial light upon enemy hits + If more than 20 fragments exist, the oldest fragments will seek out enemies to attack + Stealth strikes coalesce fragments into [ceffect/darksun:Spear of Obscuration], gaining power based on the number of fragments + [ceffect/darksun:Spear of Obscuration] will pierce though any enemy hit by Eclipse's Fall + [ceffect/darksun:'When the sun goes dark, all will know terror'] + ''' +} + +ElephantKiller: { + DisplayName: Elephant Killer + Tooltip: + ''' + Can be tossed to gain [STEALTHGAIN]% of max stealth on hit + to spend [STEALTHCOST]% of max stealth and fire the gun with increased damage + All gun shots always critically strike, with critical strike chance increasing critical strike damage + Stealth strikes fire a [c/87CEFA:Spectral Elephant] from the gun + Any gun shots that pass through the [c/87CEFA:Spectral Elephant] are redirected and greatly empowered + [c/D4827A:Natural stealth generation and stealth damage is disabled when holding this weapon] + [c/D78DDD:'Why's my gun called the Elephant Killer?] + [c/D78DDD:...] + [c/D78DDD:Don't worry about it'] ''' } @@ -378,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 ''' } @@ -398,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 ''' } @@ -537,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' ''' } @@ -547,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 ''' } @@ -556,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] ''' } @@ -631,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' ''' } @@ -667,10 +687,9 @@ 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] ''' } @@ -698,7 +717,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 ''' @@ -708,7 +727,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 ''' @@ -762,7 +781,7 @@ MoltenAmputator: { Throw a spinning scythe that lingers at your cursor to recall all existing scythes Recalling a scythe while it's on an enemy rends them for massive damage - with sufficient stealth to empower yourself, greatly increasing attack speed for a short time + with sufficient stealth to empower the next {0} scythes and greatly increase attack speed You cannot recall scythes thrown while empowered ''' } @@ -865,8 +884,9 @@ ProfanedPartisan: { DisplayName: Profaned Partisan Tooltip: ''' - Fires an unholy spear that explodes on enemy hits - Stealth strikes spawn smaller spears to fly along side it + 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 ''' } @@ -874,7 +894,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 ''' } @@ -911,7 +931,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 ''' } @@ -945,9 +965,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 ''' } @@ -984,10 +1003,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 ''' } @@ -995,8 +1012,12 @@ SealedSingularity: { DisplayName: Sealed Singularity Tooltip: ''' - Shatters on impact, summoning a black hole that sucks in nearby enemies - Stealth strikes summon a black hole that lasts longer and sucks enemies with stronger force + Disables normal stealth generation + Throws a contained singularity bomb that slows down and creates a damaging field after a short fuse + Hold to generate stealth, but burn through the bomb's fuse + After the field collapses, the singularity seeks out the strongest target that it hit and explodes + Stealth strikes increase the size and duration of the damaging field + Will explode in your hand if you hold the fuse too long ''' } @@ -1006,7 +1027,7 @@ Seraphim: { ''' Throws an extraordinarily fast dagger which slows down exponentially and dissipates into light Once dissipation has ended, 6 splitting blades that slice nearby targets are released, along with a large laserbeam - Stealth strikes release a volley of 7 lights which explode into smaller laser beams along with the dagger + Stealth strikes release a volley of 8 lights which explode into smaller laser beams along with the dagger ''' } @@ -1086,9 +1107,9 @@ SpearofPaleolith: { DisplayName: Spear of Paleolith Tooltip: ''' - Throws an ancient spear that shatters enemy armor - Spears rain fossil shards as they travel - Stealth strikes travel slower but further, raining more fossil shards + 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 ''' } @@ -1107,7 +1128,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 ''' } @@ -1127,7 +1148,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' ''' @@ -1137,7 +1158,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'] ''' @@ -1156,6 +1177,8 @@ Supernova: { DisplayName: Supernova Tooltip: ''' + Disables normal stealth generation + Hold to generate stealth, or hold to toss the bomb without generating stealth Tosses a smart bomb that locks onto and tracks targets If no target is found it will return to you Each bomb creates a miniature [cbuff:CalamityMod/MiracleBlight] supernova that drags in weak enemies and chases strong enemies @@ -1206,10 +1229,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 ''' } @@ -1218,7 +1241,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' ''' @@ -1228,8 +1251,8 @@ ThrowingBrick: { DisplayName: Throwing Brick Tooltip: ''' - Prove its resistance by throwing it upwards and catching it with your face - Throws a brick that shatters if stealth is full + Stealth strikes cause the brick to shatter + 'Prove its resistance by throwing it upwards and catching it with your face' ''' } @@ -1239,7 +1262,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' ''' } @@ -1258,7 +1281,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' ''' @@ -1268,8 +1291,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 ''' } @@ -1287,7 +1310,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 @@ -1298,9 +1321,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 ''' } @@ -1308,8 +1331,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' ''' } @@ -1370,7 +1393,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 ''' } @@ -1394,3 +1417,16 @@ Pumpkaboom: { 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 27a0b40339..ed0fa8eb78 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 @@ -48,7 +48,6 @@ AresExoskeleton: { Creates a panel with four slots and four choices above it: Plasma, Tesla, Laser, and Gauss Clicking one of the choices and then clicking one of the slots summons a cannon of that type Clicking on a slot that's already occupied destroys its associated cannon and clears the slot - Cannons take 3 minion slots each ''' } @@ -73,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: { @@ -91,7 +90,7 @@ BorealisBomber: { 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 ''' } @@ -144,8 +143,14 @@ CausticStaff: { Tooltip: ''' Summons a mini dragon to fight for you - The dragon inflicts several debilitating debuffs - The debuffs are only applied if you are holding a summon weapon or tool + The dragon attacks faster and inflicts more debuffs the more are summoned + ''' + HoldShiftTooltip: + ''' + Always inflicts [cbuff:OnFire3] + 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 ''' } @@ -205,8 +210,9 @@ 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] - Requires 10 minion slots to use and there can only be one energy spiral + 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 ''' } @@ -224,11 +230,7 @@ CosmicViperEngine: { Cosmilamp: { DisplayName: Cosmilamp - Tooltip: - ''' - Summons a cosmic lantern above your head to fight for you - Each lantern takes up 2 minion slots - ''' + Tooltip: Summons a cosmic lantern above your head to fight for you } CrimslimeStaff: { @@ -305,7 +307,6 @@ DragonbloodDisgorger: { Summons a skeletal dragon and her two children Baby spits burst into blood orbs upon hitting an enemy Picking up these blood orbs reduces the duration of [cbuffplr:PotionSickness] - Requires 6 minion slots to be summoned There can only be one family at a time ''' } @@ -338,8 +339,7 @@ Endogenesis: { The first mode makes it shoot sweeping lasers aimed at the enemy The second mode sacrifices its limbs to shoot out homing projectiles The third mode allows it to aggressively tackle its enemies - The fourth mode makes the limbs function as endothermic flamethrowers - Requires 10 minion slots to be summoned + The fourth mode makes the limbs function as endothermic flamethrowers There can only be one construct at a time [c/B0FBFF:'Ice puns not included'] ''' @@ -356,11 +356,7 @@ EndoHydraStaff: { EntropysVigil: { DisplayName: Entropy's Vigil - Tooltip: - ''' - Summons a mini Calamitas Clone and her brothers to protect you - One minion trio takes two minion slots - ''' + Tooltip: Summons a mini Calamitas Clone and her brothers to protect you } EtherealSubjugator: { @@ -399,11 +395,7 @@ FleshOfInfidelity: { FlowersOfMortality: { DisplayName: Flowers of Mortality - Tooltip: - ''' - Summons five rainbow flowers over your head that inflict [cbuff:CalamityMod/ElementalMix] - The combined flowers consume three minion slots - ''' + Tooltip: Summons five rainbow flowers over your head } ForgottenApexWand: { @@ -493,6 +485,7 @@ HivePod: { ''' {$CommonItemTooltip.Sentry} Summons an astraglomerate to spawn glomerings at your enemies + Glomerings spread the [cbuff:CalamityMod/AstralInfectionDebuff] on impact ''' } @@ -512,7 +505,7 @@ InfectedRemote: { Tooltip: ''' Summons a humanoid-hybrid Plaguebringer, codenamed 'Virili', to aid you in battle - Virili requires 3 minion slots to summon, and can only be summoned once + Virili can only be summoned once Virili uses a variety of attacks which she cycles through on a timer All attacks spread the [cbuff:CalamityMod/Plague], as was her original design intention 'There's a single label on the back: @@ -524,7 +517,7 @@ KingofConstellationsTenryu: { DisplayName: King of Constellations, Tenryū Tooltip: ''' - Uses 4 minion slots to summon a pair of celestial dragons to fight for you + Summons a pair of celestial dragons to fight for you There can only be one pair of dragons at a time 'The ones who will devour the Unmoving Star' ''' @@ -539,7 +532,6 @@ LiliesOfFinality: { DisplayName: Lilies of Finality Tooltip: ''' - Requires 2 minion slots to use Can only be summoned once 'Wake up' ''' @@ -553,7 +545,7 @@ Metastasis: { While the Sepulcher is active, brimstone hearts will begin to appear and orbit you When too many hearts are present, it will interrupt attacking to attack the hearts instead This happens more frequently depending on how many hearts are present - Requires 4 minion slots to use and can only be summoned once + Can only be summoned once ''' Calamitas: ''' @@ -589,7 +581,6 @@ MutatedTruffle: { ''' Summons a younger fishron to irradiate your foes The fishron will cycle between charging, projectiles, and a typhoon - Requires 3 minion slots to be used There can only be one minion ''' } @@ -610,7 +601,7 @@ Perdition: { {$CommonItemTooltip.Sentry} Summons a beacon at the position of the mouse When a target is manually selected via it releases torrents of souls from below onto the target - Requires one sentry slot to summon, and only one beacon may exist at a time + Only one beacon may exist at a time ''' } @@ -619,7 +610,7 @@ PlantationStaff: { Tooltip: ''' Summons a miniature Plantera to devastate enemies with floral fury - Occupies 3 minion slots and there can only be one Mini Plantera at a time + There can only be one Mini Plantera at a time ''' } @@ -679,8 +670,9 @@ SarosPossession: { ''' Summons a radiant aura harnessing the power of primordial light Repeated summons increase the power of the aura - with full summon slots to channel an eclipse beam that decays over time - This beam recharges when not in use + with full summon slots to channel [ceffect/darksun:Totality Ray] + [ceffect/darksun:Totality Ray] decays while in use and recharges when not in use + [ceffect/darksun:'A ballet of light and shadow, torn from the sky'] ''' } @@ -689,24 +681,9 @@ 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] - Each shellfish takes 2 minion slots - ''' + Tooltip: Summons a shellfish to latch onto enemies and inflict [cbuff:CalamityMod/ShellfishClaps] } Sirius: { @@ -768,7 +745,7 @@ StaffOfNecrosteocytes: { 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: { @@ -794,7 +771,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 @@ -813,7 +790,7 @@ TemporalUmbrella: { - A cyan umbrella to beat down your foes with grace - A lavender rifle to snipe those who stand in your way Best of all, you get to wear a top hat - Requires 5 minion slots to use and there can only be one set of tools at a time + There can only be one set of tools at a time 'Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow' ''' } @@ -909,20 +886,12 @@ VoidEaterMarionette: { WarloksMoonFist: { DisplayName: Warloks' Moon Fist - Tooltip: - ''' - Summons a celestial fist to punch enemies for you - Requires 4 minion slots to use - ''' + Tooltip: Summons a celestial fist to punch enemies for you } WitherBlossomsStaff: { DisplayName: Wither Blossoms Staff - Tooltip: - ''' - Summons four decaying [cbuff:CalamityMod/Plague] flowers over your head - The combined flowers consume two minion slots - ''' + Tooltip: Summons four decaying [cbuff:CalamityMod/Plague] flowers over your head } WulfrumController: { @@ -939,9 +908,5 @@ WulfrumController: { YharonsKindleStaff: { DisplayName: Yharon's Kindle Staff - Tooltip: - ''' - Summons a fiery draconid to fight for you - Requires 5 minion slots to use - ''' + Tooltip: Summons a fiery draconid to fight for you } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index a93cf238be..9f4e6963ec 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -3,7 +3,7 @@ Aestheticus: { Tooltip: ''' Fires crystals that explode and inflict [cbuff:CalamityMod/Vaporfied] - This weapon scales with all your damage stats at once + {$Common.AverageDamageInfo} ''' } @@ -13,10 +13,11 @@ 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 + {$Common.AverageDamageInfo} ''' } @@ -30,8 +31,8 @@ EyeofMagnus: { Tooltip: ''' Fires seeking cosmic masses that restore health and mana on hit - Explodes into a nebula cloud which reduces enemy protection - This weapon scales with the average of all your damage stats + Explodes into a nebula cloud that causes enemies to become [cbuff:CalamityMod/MarkedforDeath] + {$Common.AverageDamageInfo} ''' } @@ -39,8 +40,8 @@ LunicEye: { DisplayName: Lunic Eye Tooltip: ''' - Fires seeking energy bolts that reduce enemy protection - This weapon scales with the average of all your damage stats + Fires seeking energy bolts that cause enemies to become [cbuff:CalamityMod/MarkedforDeath] + {$Common.AverageDamageInfo} ''' } @@ -55,6 +56,7 @@ RelicOfDeliverance: { Being inside tiles for too long will warp you back to where you entered 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.] @@ -83,6 +85,7 @@ StratusSphere: { Influenced players gain Starbursts over time and will consume Starbursts to fly when out of flight time to cause Starbursts to form a barrier, causing you to lose Starbursts instead of health Launching the singularity deactivates the barrier, and creating a barrier deactivates the singularity + {$Common.AverageDamageInfo} 'Channeling souls into stars, an inane concept' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 8d617226ec..873189767c 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -57,12 +57,13 @@ SevensBust: Bust! SevensDoubles: Doubles! SevensTriples: Triples! StylishHammerHit: Stylish! +PiggyLicense: The license teleports away to the piggy delivery service... GenericConsumedText: "[c/8A8A8A:You have already consumed this item]" CelestialOnionText: You have already consumed a Celestial Onion. Consuming another would distort you. SanguineTangerineText: You have already consumed a Sanguine Tangerine. Eating any more would make your blood too thick to flow. MiracleFruitText: You have already consumed a Miracle Fruit. It would take a miracle to put you back together if you ate another. TaintedCloudberryText: You have already consumed a Tainted Cloudberry. Your body would become dust if you ate more than one. -SacredStrawberryText: You have already consumed a Sacred Strawberry. Any more draconic power and you'd be rejected. +SacredStrawberryText: You have already consumed a Sacred Strawberry. One more drop of draconic power would obliterate you. CometShardText: You have already used a Comet Shard. Your neurons would die if you used another. EtherealCoreText: You have already used an Ethereal Core. Your brain would escape your head if you dared to use it a second time. PhantomHeartText: You have already used a Phantom Heart. The voices are telling you it's a bad idea to use it again. diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index da3390cf62..e21ebc6a6a 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 -WildBumblefuck.DisplayName: Draconic Swarmer WulfrumAmplifier.DisplayName: Wulfrum Amplifier WulfrumDrone.DisplayName: Wulfrum Drone WulfrumGyrator.DisplayName: Wulfrum Gyrator @@ -241,7 +248,7 @@ RavagerBody.DisplayName: Ravager RockPillar.DisplayName: Rock Pillar CosmicLantern.DisplayName: Cosmic Lantern CosmicMine.DisplayName: Cosmic Mine -Signus.DisplayName: Signus, Envoy of the Devourer +Signus.DisplayName: Signus CorruptSlimeSpawn.DisplayName: Corrupt Slime Spawn CrimsonSlimeSpawn.DisplayName: Crimson Slime Spawn CrimulanPaladin.DisplayName: Crimulan Paladin @@ -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 @@ -313,9 +286,9 @@ SupremeCataclysm.DisplayName: Cataclysm SupremeCatastrophe.DisplayName: Catastrophe 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 @@ -352,6 +325,9 @@ Archmage: { DislikeNPC: I dislike {NPCName}'s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant. LikeNPC_Princess: "{NPCName} has some very quaint spells. I'm quite impressed, for someone of her age." Princess_LovesNPC: "{NPCName} makes the best ice cream I've ever tasted, it's so good!" + Monument: What a hideous statue! I always advocated for artistic community projects, but this... you really should have better quality control over what gets into your town! + GiftPositive: '''"How culture shaped magic" by Medomaion of Stratia?! I thought this book was lost centuries ago! How did you find it, and how did you...?! Well, no matter! This is the perfect gift, thank you!''' + GiftNegative: Could you please explain what your last gift was? You made an attempt on my life by trying to freeze me!? You better have a good explanation about how a snowstorm made its way inside that box! } } @@ -432,6 +408,9 @@ Bandit: { DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" + Monument: Yo, if your pockets ever feel lighter, that's not me, alright? You brought this on yourself buddy. + GiftPositive: Heeeey, my man! How's it goin'? I really 'preciate your gift, I have no idea how you got your hands on that kind of lockpicker's kit, but you'd catch me dead before I asked any questions! + GiftNegative: Hey man, what the hell is up with that gift?! I'm the most wanted in seven different city-states, do you got any idea how much a warrant on my name messes up my work?! You better do something to clean that mess before they have me walking to the gallows! } } @@ -475,6 +454,9 @@ BrimstoneWitch: { DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her! LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around. Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" + Monument: That monument is ugly as sin. + GiftPositive: Hey, uh... thanks for the gift, really. I never thought you'd ever give me anything, for obvious reasons. But... thanks, really. It's lovely. + GiftNegative: What the hell was that gift? You know what, I don't even want to think about it. Screw you. } } @@ -558,13 +540,72 @@ SeaKing: { HateNPC: "{NPCName} is just a child, but his attitude towards marine life is unacceptable! Absolutely unacceptable!" LikeNPC_Princess: That child, {NPCName}. She is an innocent soul. Let us hope the horrors of war never reach her. Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" + Monument: Take that horrible statue out of my sight! It is a disgrace to art, and to so unabashedly extort your people...! I expected much more of you. + GiftPositive: It was quite the delight to see that you gifted me custom-made shoes. Few people seem to realize that "walking" tends to leave my tail quite sore. Thank you, sincerely! + GiftNegative: A dead fish?! You gifted me a dead fish?! You managed to cross every line with that "gift"! Leave, I don't want to see you any longer. } } -WildBumblebirb.DisplayName: Wild Bumblebirb -DraconicSwarmer.DisplayName: Draconic Swarmer -Dragonfolly.DisplayName: Dragonfolly -Shoreskipper.DisplayName: Shoreskipper -BrainIllusion.DisplayName: Brain Illusion -FalseBrain.DisplayName: False Brain -BloodBomb.DisplayName: Blood Bomb +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 + + Name: { + Oolong: Oolong + Napoleon: Napoleon + Waddles: Waddles + Crenando: Crenando + Olivia: Olivia + Wilbur: Wilbur + Pumbaa: Pumbaa + Peppa: Peppa + Conan: Conan + Reuben: Reuben + Porky: Porky + Hamm: Hamm + Runt: Runt + Roko: Roko + RichardHam: Richard Ham + Curly: Curly + Techno: Techno + JohnPork: John Pork + Piglet: Piglet + Poogie: Poogie + } + + Chat: { + 0: Oink! + 1: Squeal... + 2: Snort! + } +} + +HorribleHog.DisplayName: Horrible Hog diff --git a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson index e8127c2e3e..cefd97c27c 100644 --- a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson @@ -2,13 +2,16 @@ Accessory: { Silent.DisplayName: Silent Invigorating.DisplayName: Invigorating Dauntless.DisplayName: Dauntless + Friendly.DisplayName: Friendly // New modifier effects (this is only positive) StealthGenTooltip: +{0}% stealth generation LifeRegenTooltip: +{0} HP/s life regen MaxLifeBoostTooltip: +{0} max life + FriendlyTooltip: +{0} Minion } Weapon: { + Horrible.DisplayName: Horrible Atrocious.DisplayName: Atrocious Blunt.DisplayName: Blunt Feathered.DisplayName: Feathered diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 80ab9a0ac6..86835a2723 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -48,11 +48,9 @@ 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 -DarkOrb.DisplayName: Dark Orb DesertScourgeDiveSplash.DisplayName: Desert Scourge Dive Splash DesertScourgeSpit.DisplayName: Scourge Spit DestroyerCursedLaser.DisplayName: Cursed Laser @@ -61,7 +59,6 @@ DeusMine.DisplayName: Astral Mine DeusRitualDrama.DisplayName: Deus Ritual Drama DoGBeam.DisplayName: Portal Laser DoGBeamPortal.DisplayName: Beam Portal -DoGDeath.DisplayName: Death Beam DoGDeathBoom.DisplayName: Cosmic Explosion DoGFire.DisplayName: "[ceffect/dog:Faith Incinerator]" DoGLaserWalls.DisplayName: "[ceffect/dog:God's Bane Doombeam Array]" @@ -70,7 +67,6 @@ DoGP1EndPortal.DisplayName: Portal DoGRiftCrack.DisplayName: DoG Distortion Crack DoGTeleportRift.DisplayName: DoG Distortion Rift DraedonSummonLaser.DisplayName: Giant Fuck-off Deathray of Doom -DyingSun.DisplayName: Dying Sun EssenceDust.DisplayName: Cosmic Dust Flare.DisplayName: Flare FlareBomb.DisplayName: Flare Bomb @@ -87,6 +83,7 @@ HellfireExplosion.DisplayName: Brimstone Hellfire Explosion HiveBombGoliath.DisplayName: Hive Bomb HolyAura.DisplayName: Holy Aura HolyBlast.DisplayName: Holy Blast +HolyBlastFrags.DisplayName: Holy Blast Fragment HolyBomb.DisplayName: Holy Bomb HolyBurnOrb.DisplayName: Holy Orb HolyExplosionBoom.DisplayName: Holy Explosion @@ -161,7 +158,6 @@ ShadowflameFireball.DisplayName: Shadowflame Fireball Shadowflamethrower.DisplayName: Shadowflame Breath SignusScythe.DisplayName: Scythe SirenSong.DisplayName: Musical Note -SkyFlare.DisplayName: Sky Flare SkyFlareRevenge.DisplayName: Sky Flare SporeGasPlantera.DisplayName: Spore Gas StormWeaverFrostWaveTelegraph.DisplayName: Frost Wave Telegraph 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..4a28d5a5dc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -277,7 +277,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 diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 7586da81d3..1dd7bb9076 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 @@ -217,7 +217,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 +230,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 diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 303e04c84f..5ab80e38b0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -78,3 +78,5 @@ PlagueShot.DisplayName: Plague Shot PlagueShotBuffer.DisplayName: Plague Shot WaterShot.DisplayName: Water Shot WaterShotBuffer.DisplayName: Water Shot +// Animation +GreedTransmutation.DisplayName: Greed Transmutation diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson index 1578f2adc3..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 @@ -28,6 +29,7 @@ RadiatorPet.DisplayName: Radiator RotomPet.DisplayName: Rotom SCalPet.DisplayName: Supreme Calamitas Sparks.DisplayName: Sparks +StarSwallowerPet.DisplayName: G30RG3 II ThirdSage.DisplayName: Third Sage ToastyBatPet.DisplayName: Toasty Bat Friend YharonSonPet.DisplayName: Son of Yharon diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 11c64b5d92..6016a1e096 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -6,7 +6,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 @@ -188,7 +188,6 @@ ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket ScorpioRocket.DisplayName: Nano Missile ScorpioLargeRocket.DisplayName: Nano Nuke -SeaDragonMuzzleBlast.DisplayName: Seadragon Muzzle Blast SeaDragonRocket.DisplayName: Seadragon RPG SeasSearingBubble.DisplayName: Searing Bubble SeasSearingSecondary.DisplayName: Hydroshower @@ -202,7 +201,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 @@ -261,9 +259,14 @@ VanquisherArrowMain.DisplayName: Vanquisher Arrow VanquisherArrowProj.DisplayName: Vanquisher Arrow Proj VeriumBoltProj.DisplayName: Verium Bolt VernalBolt.DisplayName: Vernal Bolt -Voidragon.DisplayName: Voidragon Blast -VoidragonTentacle.DisplayName: Voidragon Tentacle 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 ac3e08848f..44c29118dc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -78,19 +78,24 @@ DragonScalesInfernado.DisplayName: Infernado DragonShit.DisplayName: Fire DukesDecapitatorBubble.DisplayName: Duke Bubble DukesDecapitatorProj.DisplayName: Duke's Decapitator -DuststormCloud.DisplayName: Dust Cloud -DuststormCloudHitbox.DisplayName: Duststorm Cloud +DuststormCloud.DisplayName: Dust Storm DuststormInABottleProj.DisplayName: Duststorm Bottle +DuststormCloudExplosion.DisplayName: Dust Explosion +DuststormInABottleHoldout.DisplayName: Duststorm Bottle DynamicPursuerElectricity.DisplayName: Dynamic Electricity DynamicPursuerLaser.DisplayName: Dynamic Laser DynamicPursuerProjectile.DisplayName: Dynamic Pursuer EclipseMirrorBurst.DisplayName: Eclipse Mirror Flash -EclipsesFallMain.DisplayName: Eclipse's Fall -EclipsesSmol.DisplayName: Eclipse's Small -EclipsesStealth.DisplayName: Eclipse's Fall -EclipseStealthBoom.DisplayName: Eclipse Blast +EclipsesFall_Javelin.DisplayName: Eclipse's Fall +EclipsesFall_LightFragment.DisplayName: Fragment of Primordial Light +EclipsesFall_LightExplosion.DisplayName: Baily's Beads +EclipsesFall_LightSpark.DisplayName: Spark of Primodial Light +EclipsesFall_StealthSpear.DisplayName: Spear of Obscuration +EclipsesFall_StealthSpearExplosion.DisplayName: Third Contact EGloveSpark.DisplayName: Electrician's Spark EnchantedAxe2.DisplayName: Enchanted Axe +ElephantKillerElephant.DisplayName: Spectral Elephant +ElephantKillerThrown.DisplayName: Elephant Killer EnchantedAxeProj.DisplayName: Enchanted Axe EpidemicShredderProjectile.DisplayName: Epidemic Shredder EquanimityDarkShard.DisplayName: Dark Shard @@ -207,7 +212,8 @@ PrismallineProj.DisplayName: Prismalline PrismRocket.DisplayName: Prism Rocket PrismShurikenBlade.DisplayName: Refraction Blade ProfanedPartisanProj.DisplayName: Profaned Partisan -ProfanedPartisanSpear.DisplayName: Profaned Spear +ProfanedPartisanSpear.DisplayName: Holy Spear +ProfanedPartisanFlare.DisplayName: Holy Light PumpkaboomSmall.DisplayName: Small Pumpkaboom PumpkaboomBoomSmall.DisplayName: Pump-kaboom! PumpkaboomBig.DisplayName: Big Pumpkaboom @@ -243,14 +249,16 @@ ScourgeoftheSeasProjectile.DisplayName: Moist Scourge ScourgeVenomCloud.DisplayName: Venom Cloud SeafoamBombProj.DisplayName: Seafoam Bomb SeafoamBubble.DisplayName: Seafoam Bubble -SealedSingularityBlackhole.DisplayName: Sealed Blackhole +SealedSingularityRock.DisplayName: Sealed Singularity Rock SealedSingularityGore.DisplayName: Sealed Singularity Fragment -SealedSingularityProj.DisplayName: Sealed Singularity +SealedSingularityHoldout.DisplayName: Sealed Singularity +SealedSingularityProjectile.DisplayName: Sealed Singularity SeraphimAngelicLight.DisplayName: Light Orb 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 @@ -264,12 +272,14 @@ 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 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 @@ -287,6 +297,7 @@ Stormfrontspark.DisplayName: Stormfront Spark SubductionFlameburst.DisplayName: Flame Pillar SubductionSlicerProj.DisplayName: Subduction Slicer SulphuricNukesplosion.DisplayName: Nuke +SupernovaHoldout.DisplayName: Supernova SupernovaBomb.DisplayName: Supernova Bomb SupernovaBoom.DisplayName: Micro Supernova SupernovaStealthBoom.DisplayName: Exo Supernova @@ -333,3 +344,7 @@ 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 +SpadefishHoldout.DisplayName: Spinfish +SpadefishThrown.DisplayName: Spadefish diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 1d481724b0..121827ff82 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -246,7 +246,7 @@ SandnadoMinion.DisplayName: Sandnado SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura SarosSunfire.DisplayName: Saros Sunfire -SarosEclipseBeam.DisplayName: Eclipse Beam +SarosEclipseBeam.DisplayName: Totality Ray SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher @@ -309,9 +309,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 0fc9ab152c..dfdadd18a3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -41,6 +41,7 @@ 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 @@ -49,9 +50,10 @@ DragonDust.DisplayName: Dust DunesandBallFalling.DisplayName: Dunesand Ball DuneSandBallGun.DisplayName: Dunesand Ball EarlyBloomBobber.DisplayName: Early Bloom Bobber +Elumphant.DisplayName: Elumphant +ElumphantMist.DisplayName: Elumphant Mist EmpyreanBlast.DisplayName: Empyrean Blast EmpyreanEmber.DisplayName: Empyrean Ember -EmpyreanGlob.DisplayName: Empyeran Glob EmpyreanMarble.DisplayName: Empyrean Marble EmpyreanStellarDetritus.DisplayName: Empyrean Stellar Detritus EnergyShell.DisplayName: Energy Shell @@ -72,10 +74,12 @@ FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem GenericElectricSpark.DisplayName: Electric Spark GhostlyBolt.DisplayName: Bolt +GluttonyBlenderAnimation.DisplayName: Gluttony Blender Animation GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round GreenLabSeeker.DisplayName: Seeking Mechanism +Gunshot.DisplayName: Gunshot HeronBobber.DisplayName: Heron Bobber HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion @@ -107,6 +111,7 @@ PauldronDash.DisplayName: Pauldron Dash PauldronExplosion.DisplayName: Pauldron Explosion PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse +Pigion.DisplayName: Pigion PinkPearlFalling.DisplayName: Pink Pearl PoisonousSeawater.DisplayName: Seawater PolypSandBallFalling.DisplayName: Polyp Sand Ball @@ -141,6 +146,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 @@ -152,12 +158,10 @@ TileSlamDamage.DisplayName: Grand Damage TitanHeartBoom.DisplayName: Titan Heart Boom TransformerAura.DisplayName: Transformer Aura TransformerBlob.DisplayName: Transformer Shard +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 @@ -172,5 +176,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 dd505cfd52..4f5acca788 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -7,8 +7,6 @@ Armageddon: "{0} failed the challenge at hand." AstralInfection1: "{0}'s infection spread too far." AstralInfection2: "{0}'s skin was replaced by the astral virus." AstralInfection3: "{0} succumbed to their spaceborne pustules." -AstralInjection1: "{0}'s blood vessels burst from drug overdose." -AstralInjection2: "{0} couldn't handle another cosmic mana transfer." AuricRebuke1: "{0}'s vital fluids violently vibrated out of their flesh." AuricRebuke2: "{0} did not survive their brief time as a supercapacitor." AuricRebuke3: "{0} could not contain the power overwhelming." @@ -68,6 +66,12 @@ DivinityDevourer3: "{0}'s essence was snuffed by [ceffect/dog:Divinity Devourer] ElementalMix1: "{0} was reduced to technicolor confetti." ElementalMix2: "{0} was blasted apart by a harmonized elemental onslaught." ElementalMix3: "{0} was overwhelmed by elemental turbulence." +FishStocks1: "{0} didn't diversify their portfolio." +FishStocks2: "{0} bought high and sold low." +FishStocks3: "{0} fell victim to the Fish Crash of '{1}." +FishStocks4: "{0} was left holding the bag." +FishStocks5: "{0} is food for the loan sharks." +FishStocks6: "{0} should have taken a short position on their health bar." FlareGunOverheat: "{0}'s gun was simply too hot to handle." GodSlayerInferno1: "{0}'s hopes and dreams were cremated." GodSlayerInferno2: "{0}'s consciousness slipped into oblivion." @@ -83,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." @@ -109,6 +116,13 @@ SulphurMeter: "{0} bathed too long in acidic waters." SulphuricPoisoning1: "{0} was melted by the toxic waste." SulphuricPoisoning2: "{0} ingested too many caustic chemicals." SulphuricPoisoning3: "{0} couldn't handle the industrial backwash." +SwinesWrath1: "{0} was not ready to bask in divinity." +SwinesWrath2: "{0} now resides in Pigatory." +SwinesWrath3: "{0} was ground into a fine dust—a fibrous powder, by the wrath of Swine." +SwinesWrath4: "{0} should be careful what they wish for." +SwinesWrath5: "{0} had the last of their health swinedled out from under their nose." +SwinesWrath6: "{0} did not read the label on The Concoction." +SwinesWrath7: "{0}'s life was hogged to the bone." ThornBlossom: "{0} was violently pricked by a flower." UltracosmicMaelstrom1: "{0} was sublimated by [ceffect/dog:Ultracosmic Maelstrom]." UltracosmicMaelstrom2: "{0} got cut down to size by [ceffect/dog:Ultracosmic Maelstrom]." 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..bd0c8302a5 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -664,6 +664,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..a6f76a79ce 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: diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 504863dab8..4ce439ea10 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -14,6 +14,7 @@ AddedTooltip: { // Also used by Sniper Scope EyeoftheGolem: 15% increased critical strike damage RifleScope: The scope effect can be toggled with visibility + ReconScope2: 5% increased ranged critical strike chance ArcaneFlower: 5% increased magic damage HellfireTreads: ''' @@ -158,8 +159,7 @@ EditedTooltip: { */ SunMoonStones: critical strike chance, life regeneration, CelestialStoneShell: Minor increase to damage, - PowerGlove: 10% increased melee speed, does not stack with downgrades - BerserkerGlove: 10% increased true melee damage + PowerBerserkerGlove: 12% increased melee speed, does not stack with downgrades MechanicalGlove: ''' 12% increased melee damage @@ -174,6 +174,7 @@ EditedTooltip: { MoltenQuiver: Lights wooden arrows ablaze and all arrows inflict Hellfire RifleScope1: Increase view range for guns ( to zoom out) RifleScope2: The scope effect can be toggled with visibility + ReconScope1: 15% increased ranged damage SniperScope: 12% increased ranged critical strike chance Magiluminescence: ''' @@ -210,7 +211,7 @@ EditedTooltip: { ArcheryPotion: 5% increased arrow damage and 20% increased arrow speed AleSake: ''' - Increases melee weapon scale by 15%, but decreases melee speed by 10% + Increases melee weapon scale by 25%, but decreases melee speed by 10% Counts as an alcohol for Alcohol Poisoning {$Common.AlcoholWarning} ''' @@ -256,8 +257,28 @@ BuffDescription: { WeaponImbueVenom: Melee, Whip, and Rogue attacks inflict acid venom on your targets } +HerbTooltips: { + Daybloom: "[C/FFEB8A:A cheerful herb which blooms under daylight]" + Moonglow: "[C/8AFFFF:A radiant herb which blossoms under moonlight]" + Waterleaf: "[C/8AFFAF:A tenacious herb that blossoms in the rain]" + Blinkroot: "[C/FFC28A:A fickle herb, whose blooming is unpredictable]" + Shiverthorn: "[C/AADEFA:A frigid herb that blooms slowly and permanently]" + Deathweed: "[C/A98AFF:A foul herb, blossoming under the Full or Blood Moon]" + Fireblossom: "[C/FF8063:A vibrant herb, blossoming in the sunset hours]" +} + +SeedTooltips: { + Daybloom: "[C/FFEB8A:Must be planted in regular Grass]" + Moonglow: "[C/8AFFFF:Must be planted in Jungle Grass]" + Waterleaf: "[C/8AFFAF:Must be placed in Sand]" + Blinkroot: "[C/FFC28A:Must be sown in Dirt or Mud]" + Shiverthorn: "[C/AADEFA:Must be placed in Snow or Ice]" + Deathweed: "[C/A98AFF:Must be buried in Evil Grass or Evil Stone]" + Fireblossom: "[C/FF8063:Must be buried in Ash]" +} + // Vanilla NPC dialogues added by Calamity -AnglerChat.SeaKing: Someone tell {0} to quit trying to throw me out of town, it's not going to work. +AnglerChat.SeaKing: Hey! Someone tell {0} to quit trying to throw me outta town, it's not gonna work! ArmsDealerChat: { MentionQuadBarrel: That old man left a cranky old gun on his deathbed. You catching my drift? @@ -275,21 +296,19 @@ ClothierChat: { } CyborgChat: { - MoonLordDefeated1: Always shoot for the moon! It has clearly worked before. - MoonLordDefeated2: Draedon? The guy who made these upgrades on me said he wanted to best him. But I never cared about that, I just wanted to shoot lasers from my eyes. + MoonLordDefeated: Always shoot for the moon! It has clearly worked before. MentionPlague: Those big green roaches in the Jungle don't threaten me, but all of the animals it has consumed... Please, do me a favor and protect them. Rain: All these moments will be lost in time. Like tears... in the rain. } DemolitionistChat: { - MentionSkynamite: Tired of blowing your legs off with dynamite? Not my problem, but if you aren't fond of it you could try throwing them into a Sky Mill to see if they fly. + MentionSkynamite: Tired of blowing your legs off with dynamite? That's part of the thrill! But maybe they'll fly if you try throwing them into a Sky Mill. DoGDefeated: God Slayer Dynamite? Boy do I like the sound of that! } DryadChat: { DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too? Hardmode: That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond? - Mushroom: I'm not here for any reason! Just picking up mushrooms for uh, later use. SulphurSea: My Goddess is resting deep below this sea. If you may excuse me, I wish to pay my respects to her alone. } @@ -311,28 +330,23 @@ GuideChat: { Hardmode2: That earthquake wasn't natural, something must have caused it... Beware when exploring, whatever caused it must be a powerful entity, perhaps even otherworldly. } -HerbTooltips: { - Daybloom: "[C/FFEB8A:A cheerful herb which blooms under daylight]" - Moonglow: "[C/8AFFFF:A radiant herb which blossoms under moonlight]" - Waterleaf: "[C/8AFFAF:A tenacious herb that blossoms in the rain]" - Blinkroot: "[C/FFC28A:A fickle herb, whose blooming is unpredictable]" - Shiverthorn: "[C/AADEFA:A frigid herb that blooms slowly and permanently]" - Deathweed: "[C/A98AFF:A foul herb, blossoming under the Full or Blood Moon]" - Fireblossom: "[C/FF8063:A vibrant herb, blossoming in the sunset hours]" -} - MechanicChat: { HasPortalGun: Just what is that contraption? It makes my Teleporters look like child's play! MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me! Eclipse: Um... should my nightlight be on? - AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode. + AcidRain: Oh darn! I should've waterproofed my gadgets, they're starting to corrode. } MerchantChat: { MoonLordDefeated: Every night seems more tense than the last. I feel unspeakable horrors are watching over us. Eclipse: Are you daft?! Turn off those lamps! AcidRain: If this acid rain keeps up, there'll be a shortage of Dirt Blocks soon enough! - Bandit: I happen to have several Angel Statues at the moment, a truely rare commodity. Want one? + Bandit: Have you any idea why I have several Angel Statues in my stock, friend? Please relieve me of them! +} + +NurseChat: { + Bandit: You wouldn't happen to be taking stuff from my biohazard container, would you? + PlanteraDefeatedAndBanditPresent: Things have been going missing lately. First used needles, then dirty scalpels, and now... waste IV bags? } PainterChat: { @@ -353,35 +367,25 @@ PainterChat: { } PartyGirlChat: { - Eclipse1: I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it. + Eclipse1: My light display is turning into an accidental bug zapper. Yeah I don't know, but at least the monsters are enjoying it. Eclipse2: Ooh! I love parties where everyone wears a scary costume! } PirateChat: { - PreLeviathan: Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there. + PreLeviathan: Aye, I hear of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there, matey! WetScourgeDefeated: I have to thank ye again for takin' care of that sea serpent. Or was that another one... - SeaKing: I remember legends about that {0}. He ain't quite how the stories make him out to be though. - Ocean: Now this is a scene that I can admire any time! I feel like something is watching me though. - SulphurSea1: It ain't much of a sight, but there's still life living in these waters. - SulphurSea2: Me ship might just sink from the acid alone. -} - -SeedTooltips: { - Daybloom: "[C/FFEB8A:Must be planted in regular Grass]" - Moonglow: "[C/8AFFFF:Must be planted in Jungle Grass]" - Waterleaf: "[C/8AFFAF:Must be placed in Sand]" - Blinkroot: "[C/FFC28A:Must be sown in Dirt or Mud]" - Shiverthorn: "[C/AADEFA:Must be placed in Snow or Ice]" - Deathweed: "[C/A98AFF:Must be buried in Evil Grass or Evil Stone]" - Fireblossom: "[C/FF8063:Must be buried in Ash]" + SeaKing: There be many a legend about that {0}! He ain't quite how the stories make him outta be though. + Ocean: Aye, the open waters! This be a scene any sea dog can admire! + SulphurSea1: It ain't much a sight, but these waters still be teamin' with life. + SulphurSea2: Argh, this is no proper dock! Me ship might just sink from the acid alone! } SkeletonMerchantChat.Normal: What'dya buyin'? SteampunkerChat: { MoonLordDefeated: Yep! I'm also considering being a space pirate now. - Astral: Some of my machines are starting to go haywire thanks to this Astral Infection. I probably shouldn't have built them here. - Hallow: I'm sorry I really don't have any Unicorn proof tech here, you're on your own. + Astral: Golly! Some of my machines are going haywire thanks to this Astral Infection. I shan't have built them here! + Hallow: I dinnae have any Unicorn proof tech here, you're a wee bit on your own mate. } StylistChat: { @@ -397,16 +401,182 @@ 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! - Has500Plat: Where and how are you getting all of this money? 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! } TruffleChat.Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. WitchDoctorChat: { BloodMoon: This is as good a time as any to pick up the best ingredients for potions. - PrePlantera: I remember hearing some rumours about some villagers that were creating a monster to defend their village, maybe their magic can be of use to you? - Jungle: I wonder how my relatives are doing, last time I checked on them they were too busy praising the... Sun, I think. + PrePlantera: I recall rumors about some villagers that were creating a monster to defend their village. Such magic could never tame beasts, but perhaps it can be of use to you. + Jungle: I wonder how my kind is doing. Last time I checked on them they were too busy praising the... Sun, I think. } WizardChat.Hardmode: Space just got way too close for comfort. + +TownNPCMood: { + // Default dialogues if, for example, a modded NPC does not have a dialogue line registered + DefaultMonument: I hate The Monument. + DefaultGiftPositive: I love The Gift. + DefaultGiftNegative: I hate The Gift. + + Angler: { + Monument: That monument is sooooooo ugly! I think it needs some chopped fish thrown allllll over it! + GiftPositive: Hey! I don't know how you got a hold of all that squishy gross stuff in that gift, but it might be the best prank material I've ever seen! He he he! + GiftNegative: Are you stupid?! I would NEVER fall for such a laaaaame gift prank like that! You better catch a lot of awesome fish to make up! + } + + ArmsDealer: { + Monument: Was anyone really itchin' to have a big ol' statue in my firing ground? Because I wasn't! + GiftPositive: That new ammo belt was just the gift I've been lookin' for, buddy! Let's test it out together later! + GiftNegative: Do you know what you're doin' by pullin' a bomb in a box prank on me? I can kill you in over seven hundred ways, and that's just with my guns! + } + + BestiaryGirl: { + Monument: This monument is like, totally giving me the creeps, bro! + MonumentTransformed: Rrr... BIG ROCK. BAD! NO!! + GiftPositive: Hey!! You're like, suuuper rad and all for gifting me that cute little bunny! Now umm... I need to think of a name for it! + GiftPositiveTransformed: LOVE. GOOD GIFT. CUTE! + GiftNegative: Eek!! Did you really, like, gift me a dead bunny? I really totally hate when people think that's funny! + GiftNegativeTransformed: Grahh!! HATE. CRUEL. GIFT. WATCH YOURSELF!! + } + + Clothier: { + Monument: I think I am becoming too old to understand this... "modern art". + GiftPositive: There was a simple bell in that gift, but its ring was simply extraordinary. Perhaps this means I truly believe... + GiftNegative: Can we get serious now? No one warned me! No one said "You are about to receive the most wretched gift in history". No one could train for that! + } + + Cyborg: { + Monument: Analysis of nearby monument: Provides zero positive qualities to all lifeforms nearby. + GiftPositive: Gift content scan revealed extremely pure silicon for use in upgraded processors. It appears I appreciate that. + GiftNegative: Gift content scan revealed attempt to trigger malfunction in my systems. Translation: I hate this. + } + + DD2Bartender: { + Monument: Had a lot of customers lately complaining about that big monument outside. I gotta say, they're right. + GiftPositive: The pint in that gift of yours reminded me of what I serve back in Etheria! Ahh, I really miss it... but that was quite thoughtful of you. + GiftNegative: What vile concoction of a drink was that? One sip of it and I had to wipe down the bar again! Were you conspiring with the Kobolds?! + } + + Demolitionist: { + Monument: You know, there is a use for that monument - it'll make for a good demolition test for my biggest dynamite yet! + GiftPositive: Hey, is that a shipment of ale? That's the only thing us dwarves love more than blowing things up! You're da' bomb! + GiftNegative: ARGH! You see yourself as a joker, giving me a water gun? That's an affront to my craft in two ways! Now I'm itching to turn you into a firework! + } + + Dryad: { + Monument: I don't like that monument. I can sense its ugly stain on nature. + GiftPositive: I have no need for material goods as a nature spirit... but I can at least sense your gift was given out of genuine compassion. + GiftNegative: It would be unwise for you to tread near me after "gifting" me an oozing mass of corruption. I question whether you are committed to purifying the world... + } + + DyeTrader: { + Monument: Oh no no, that dull monument cannot be. Its mere presence is sucking the color and vibrancy out of life itself! + GiftPositive: What an extraordinary batch of rare flowers there was in that gift, friend! I must thank you for your help, browse my colors at reduced coin in exchange! + GiftNegative: You think you can pull such a drab gift prank on me, I don't think so! I want no business of yours after that attack on my precious palettes! + } + + GoblinTinkerer: { + Monument: You know, even the barbaric goblin camp I was once part of never considered the concept of a useless monument that just funnels funds. + GiftPositive: What a fascinating welding-cutting combo tool in that gift! I would love to reverse-engineer and tinker it for my own research. + GiftNegative: When I reached into your unassuming gift, my hands were lacerated by a handful of spiky balls! I'm afraid I will have to hike my prices to cover the medical costs. + } + + Golfer: { + Monument: This must be mockery. I don't want a monument of greed erected so close to my home. + GiftPositive: I don't know where you found that wedge, but it's been a real lifesaver in the sand. Thanks for helping my game! + GiftNegative: Tell me something. Why did the shoddy driver in that gift splinter all over the place after one swing? Golf is a delicate sport, and this really hurts! + } + + Guide: { + Monument: I quite dislike that monument you have over there. How could one have such little humbleness! + GiftPositive: A thoughtful gift in this world is always a welcome sight. I greatly appreciate it! + GiftNegative: Apologies, I'm currently in shock over your decision to gift me my own voodoo doll. If only I could curse you! + } + + Mechanic: { + Monument: Any more money I have to fork over for this monument and I'm going to have to start charging an electric bill! I would hate to do that. + GiftPositive: Thanks to your gift of signal extenders, I can connect more of this world than ever! That extra burst of motivation is just what I need to finish wiring up this town! + GiftNegative: What compelled you to be so reckless as to gift me an EMP device? Everyone is yelling at me like it's MY fault! Well, now it will be YOUR problem to pay it off when you buy all your wire. + } + + Merchant: { + Monument: That awful monument is driving away my business! + GiftPositive: What a lovely gift of exotic wares you gave me, friend! Please peruse my shop at clearance rates. + GiftNegative: Why offer a "gift" of rubbish Angel Statues? I tire of your jokes, so if you want business, it'll be extra. + } + + Nurse: { + Monument: Eww, who would put such an ugly rock in this town? + GiftPositive: Hey! Thanks for that gift from earlier. You ever need face reconstruction, you know who to call. + GiftNegative: YOU, I hope you understand that gifting the ONLY DOCTOR HERE some snake oil is how to make me never want to treat you! + } + + Painter: { + Monument: That statue certainly is thought provoking. I'm awestruck by how bleak, dull, and hopeless it makes its environs feel. + GiftPositive: How did ya know exactly the paint color I have been looking for? My newest mural greatly appreciates dat! + GiftNegative: You must be sick and cruel, because that water bomb prank of yours washed all over my latest work! Aye, you oughta be covered in red, and not paint! + } + + 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! + } + + Pirate: { + Monument: Arr, ye landlubbers have filthy tastes in decoration! That statue be askin' to be washed away! + GiftPositive: HAR HAR! Ye bring me the best bottle o' rum I ever taste in me life! Nothin' more for me to say, sea dog! + GiftNegative: Arr, ye scallywag! Ye be askin' to be sent to Davy Jones' locker with that foul concoction ye gave me earlier! + } + + Princess: { + Monument: Um... my people have been frequently complaining about that monument. May I request it be taken down, please? + GiftPositive: I do appreciate your thoughtfulness with this gift, my loyal subject! It's always so wonderful to see the many fantastic things inside one! + GiftNegative: Um... may I ask what you were implying with the contents of that gift? Perhaps I shouldn't worry so, but I do find myself concerned... + } + + SantaClaus: { + Monument: Is this what the holiday season means to people now? Naughty, you are! + GiftPositive: Ho ho ho! What an unusual feeling for someone to be gifting me something at this time of year! You'd be great taking up the mantle! + GiftNegative: What a horrible gift you thought you could give me. You will get no presents this year! + } + + Steampunker: { + Monument: Oi, that bloody big rock you got outside is a monumental mistake! Decommission it this very instant! + GiftPositive: Ahh, what a deeply inspiring jetpack engine! The breakthroughs in steampunk technology from this will be exquisite! Consider this sale a return of generosity. + GiftNegative: When I opened your gift, a sudden blast of cold air condensed all of my steam! Were it not for my backup systems, my machines would be unusable! You bloody better watch yourself! + } + + Stylist: { + Monument: That statue has been the talk of the town! ...As in, everyone cannot stand the gross thing. + GiftPositive: Thanks hun, that gift of new exotic hair dyes was just what I was missin' in my life! I know just who else could use some of this style too! + GiftNegative: What were you pullin' on me with a fireball in a gift box? That could've singed me bald, and I could never be a stylist without hair! NEVER! + } + + TaxCollector: { + Monument: Bah! You shouldn't be seeing this message, plebian! + GiftPositive: What a steal, getting a gift full of the only thing worth a damn in this world -- money! + GiftNegative: Bah! You think you're a jester with that lump of coal? Get out of my sight! + } + + Truffle: { + Monument: Your kind have very strange decorative tastes, such as that monument nearby. + GiftPositive: I love them, my new gifted shroomble companions. It's great to see more of our kind around here! + GiftNegative: A little pig jumped out of that gift you gave me earlier, and tried to eat my face! Perhaps I can't trust you either. + } + + WitchDoctor: { + Monument: A vile disruption of nature, that monument is. My soul is wracked with contempt for this unsightly edifice. + GiftPositive: A kind offering to my people, this gift is. May you be blessed by kindred spirits in trying times. + GiftNegative: Sacrilegious defilement against my arts - I speak of your false gift. May your woes be many, and your days few. + } + + Wizard: { + Monument: If I was your age, I would've blasted that loathsome monument with a giant fireball! Alas, I can't recall the spell. + GiftPositive: An authentic tome of wisdom from the Archmage himself? What a prized possession!! ...uh, who is the Archmage again? + GiftNegative: Do you take me for a fool to place a hex on that gift? How about I place a hex on your wallet, and all of your money disappears when you buy from me!! + } +} 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..f8e3246eb3 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": @@ -2250,6 +2257,16 @@ namespace CalamityMod return new ArgumentException("ERROR: The first argument to \"AddToBossHPScalingConfig\" must be an int or short ID."); return AddToHPScaling(npcType6); } + case "GetDebuffDamage": + { + if (args.Length < 2) + 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."); } 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..6aec151c76 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; diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index dae263984c..bbd5408e76 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -10,6 +10,8 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -115,7 +117,7 @@ namespace CalamityMod.NPCs.Abyss if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) NPC.TargetClosest(); - if (NPC.justHit || detectsPlayer || Main.player[NPC.target].chaosState || adultWyrmAlive || (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(160f)) + if (NPC.justHit || detectsPlayer || Main.player[NPC.target].ownedProjectileCounts[ModContent.ProjectileType()] > 0 || Main.player[NPC.target].chaosState || adultWyrmAlive || (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(160f)) { detectsPlayer = true; NPC.damage = Main.expertMode ? 340 : 170; diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index a813e9af22..2ccfab5288 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -122,7 +122,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); } diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index ceee4b8ef8..f1618f6bca 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -102,10 +103,14 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - bool phase1 = NPC.life > NPC.lifeMax * 0.5; - bool phase2 = NPC.life <= NPC.lifeMax * 0.5; + bool phase1 = NPC.localAI[2] != 5 && NPC.life > NPC.lifeMax * 0.5; + bool phase2 = NPC.localAI[2] == 5 || NPC.life <= NPC.lifeMax * 0.5; bool phase3 = NPC.life <= NPC.lifeMax * 0.1; NPC.chaseable = hasBeenHit; + if (hasBeenHit == false) + NPC.TargetClosest(false); + // If fished out, get mad + if (Main.player[NPC.target].ownedProjectileCounts[ModContent.ProjectileType()] > 0) { NPC.localAI[2] = 5; hasBeenHit = true; } if (NPC.soundDelay <= 0) { NPC.soundDelay = 360; 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/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 decf8303fd..bfd43316ca 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -15,6 +15,7 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.PlagueReaper; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.Abyss; @@ -92,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; } @@ -155,13 +153,13 @@ namespace CalamityMod.NPCs // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; public bool IncreasedColdEffects_CryoStone = false; + public bool IncreasedColdEffects_FrozenCube = false; // Electric effects public bool IncreasedElectricityEffects_Unused = false; // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; - public bool IncreasedHeatEffects_CinnamonRoll = false; public int IncreasedHeatEffects_FireBoots = 0; // Toxic Heart effect @@ -194,6 +192,9 @@ namespace CalamityMod.NPCs /// Set this value to reduce target defense by a flat amount. public int miscDefenseLoss = 0; + /// If true, enemy will not drop any items. + public bool preventDrops = false; + /// /// Constant representing a distance of 200 tiles in pixel measurement.
/// Used by bosses to increase their velocity in order to catch up to their target. @@ -266,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; @@ -351,6 +342,8 @@ namespace CalamityMod.NPCs ///
public bool pacified = false; + public float coinDropMult = 1; + // Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage // It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently /// Tracks how many stacks of the Shred debuff this NPC is inflicted with. @@ -386,6 +379,8 @@ namespace CalamityMod.NPCs public bool trueVulnerabilityHex = false; public bool banishingFire = false; public bool wither = false; + public bool windChilled = false; + public float windChilledMult = 1; /// /// If greater than 0, this enemy will appear to disintegrate into ash when killed.
/// Used by Rancor's laser beam. @@ -393,8 +388,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; @@ -512,9 +505,9 @@ namespace CalamityMod.NPCs myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; + myClone.IncreasedColdEffects_FrozenCube = IncreasedColdEffects_FrozenCube; myClone.IncreasedElectricityEffects_Unused = IncreasedElectricityEffects_Unused; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; - myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; myClone.IncreasedHeatEffects_FireBoots = IncreasedHeatEffects_FireBoots; myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; myClone.IncreasedWaterEffects_Amulet1 = IncreasedWaterEffects_Amulet1; @@ -529,6 +522,8 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; + myClone.preventDrops = preventDrops; + myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) myClone.dashImmunityTime[i] = dashImmunityTime[i]; @@ -553,7 +548,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; @@ -604,6 +598,8 @@ namespace CalamityMod.NPCs myClone.pacified = pacified; + myClone.coinDropMult = coinDropMult; + myClone.somaShredStacks = somaShredStacks; myClone.somaShredApplicator = somaShredApplicator; myClone.somaShredFalloff = somaShredFalloff; @@ -632,10 +628,9 @@ namespace CalamityMod.NPCs myClone.trueVulnerabilityHex = trueVulnerabilityHex; myClone.banishingFire = banishingFire; myClone.wither = wither; + myClone.windChilled = windChilled; myClone.ashesOnDeath = ashesOnDeath; - myClone.fortunesFavor = fortunesFavor; - // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; myClone.ManaBurnFireDrawer = null; @@ -798,11 +793,10 @@ namespace CalamityMod.NPCs ladHearts--; banishingFire = false; wither = false; + windChilled = false; if (ashesOnDeath > 0) ashesOnDeath--; - fortunesFavor = false; - if (antlionCloudDebuffTimer > 0) antlionCloudDebuffTimer--; if (cursorFocus > 0 && cursorFocus < cursorFocusMax) @@ -862,6 +856,7 @@ namespace CalamityMod.NPCs ActiveSicknessDebuffMultiplier = SicknessDebuffMultiplier; ActiveElectricDebuffMultiplier = ElectricDebuffMultiplier; ActiveWaterDebuffMultiplier = WaterDebuffMultiplier; + ActiveTypelessDebuffMultiplier = TypelessDebuffMultiplier; if (irradiated) { @@ -884,9 +879,13 @@ namespace CalamityMod.NPCs ActiveColdDebuffMultiplier += 1; ActiveHeatDebuffMultiplier -= 0.5f; } - if (npc.HasBuff(BuffID.Chilled)) //Nothing inflicts this at the moment. Put here so we can start using it. + if (npc.HasBuff(ModContent.BuffType())) { - ActiveWaterDebuffMultiplier += 1; + ActiveWaterDebuffMultiplier += 0.5f; + } + if (npc.buffType.Any(i => CalamityBuffSets.DebuffDataset[i] is not null && CalamityBuffSets.DebuffDataset[i].WaterDebuffScaling > 0) || npc.wet || npc.honeyWet || npc.dripping) + { + windChilledMult = 1.5f; } if (VulnerableToHeat.HasValue) { @@ -927,16 +926,11 @@ 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++) { var type = npc.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; if (debuffData == null || debuffData == DebuffData.Oiled) //Oiled is done after continue; debuffData.NPCLifeRegenMethod(npc, type, ref index, ref damage); @@ -997,7 +991,7 @@ namespace CalamityMod.NPCs int dmg = 0; if (glaiveShredTimer > 0) { - dmg += 120; // 60 DPS + dmg += 200; // 100 DPS glaiveShredTimer--; } if (blazingStarShredTimer > 0) @@ -1058,120 +1052,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; @@ -1198,8 +1090,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) @@ -2777,7 +2669,7 @@ namespace CalamityMod.NPCs // Apply armor penetration based on Calamity debuffs. The hit system manages the sequencing. // Ozzatron 05JAN2023: fixed doubled armor pen, this time for real - int defenseReduction = (markedForDeath && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither ? RemsRevenge.WitherDefenseReduction : 0) + miscDefenseLoss; + int defenseReduction = (wither ? RemsRevenge.WitherDefenseReduction : 0) + miscDefenseLoss; modifiers.ArmorPenetration += defenseReduction; // DR applies after vanilla defense. @@ -2853,8 +2745,6 @@ namespace CalamityMod.NPCs private float ApplyDRReduction(NPC npc, float DR) { float calcDR = DR; - if (markedForDeath) - calcDR *= 0.5f; if (absorberAffliction) calcDR *= 0.8f; if (npc.Calamity().armorCrunch) @@ -3314,36 +3204,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); @@ -3505,9 +3365,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) @@ -3648,6 +3505,9 @@ namespace CalamityMod.NPCs public override void ModifyHitByItem(NPC npc, Player player, Item item, ref NPC.HitModifiers modifiers) { CalamityPlayer modPlayer = player.Calamity(); + if (markedForDeath) + modifiers.SourceDamage *= 1.1f; + if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.5f; @@ -3690,7 +3550,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 @@ -3745,7 +3605,8 @@ namespace CalamityMod.NPCs // Hitbox criteria were changed to allow long one dimensional projectiles so that Condemnation would work. bool acceptableVelocity = projectile.velocity != Vector2.Zero; bool acceptableHitbox = (projectile.width <= 36) || (projectile.height <= 36); - if (bullseye != null && acceptableVelocity && acceptableHitbox) + + if (bullseye != null && acceptableVelocity && acceptableHitbox && !CalamityProjectileSets.DaawnlightBlacklist[projectile.type]) { // Bullseyes are visually different on bosses and thus have larger hitboxes. float bullseyeRadius = npc.IsABoss() ? DaawnlightSpiritOrigin.BossBullseyeRadius : DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius; @@ -3834,6 +3695,9 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.33f; } + if (markedForDeath) + modifiers.SourceDamage *= 1.1f; + if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.5f; @@ -3911,24 +3775,12 @@ namespace CalamityMod.NPCs if (npc.buffTime[i] >= 1) { int type = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[type]; + if (tag is not null) tag.TagModifyHitEffects(proj, npc, ref modifiers, ref TagDamageMult, ref critChance); } } - //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())) { @@ -3945,8 +3797,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. @@ -3963,7 +3813,8 @@ namespace CalamityMod.NPCs if (npc.buffTime[i] >= 1) { int type = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[type]; + if (tag is not null) tag.TagOnHit(npc, projectile, hit, damagedone); } } @@ -4243,10 +4094,16 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 0.25); // 4x spawn rate maxSpawns = (int)(maxSpawns * 4f); } - if (player.Calamity().bloodyMary) + if (player.Calamity().bloodyMary || player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) { - spawnRate = (int)(spawnRate * 0.142); // ~7x spawn rate - maxSpawns = (int)(maxSpawns * 5f); // Only 5x the cap, however + spawnRate = (int)(spawnRate * BloodyMary.SpawnRateGateMultiplier); // ~7x spawn rate + maxSpawns = (int)(maxSpawns * BloodyMary.SpawnLimitMultiplier); // 5x spawn rate cap + } + // Only when BOTH effects are active, also applies the previous spawn rate and limit boosts multiplicatively + if (player.Calamity().bloodyMary && player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) + { + spawnRate = (int)(spawnRate * BloodyMary.IVDripAdditionalSpawnRateGateMultiplier); // 1.429x spawn rate, total of 10x + maxSpawns = (int)(maxSpawns * BloodyMary.IVDripAdditionalSpawnLimitMultiplier); // 1.5x spawn rate cap } // Reductions @@ -4350,7 +4207,7 @@ namespace CalamityMod.NPCs } } - public static void AttemptToSpawnLavaNPCs(Player player) + /*public static void AttemptToSpawnLavaNPCs(Player player) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -4382,7 +4239,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) @@ -4396,7 +4252,7 @@ namespace CalamityMod.NPCs } } } - } + }*/ public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { @@ -4704,9 +4560,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); @@ -4825,6 +4678,9 @@ namespace CalamityMod.NPCs if (voidfrost) Voidfrost.DrawEffects(npc, ref drawColor); + if (windChilled) + WindChilled.DrawEffects(npc, ref drawColor); + // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs if (electrified) { @@ -4920,7 +4776,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; @@ -4963,6 +4819,7 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux), ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost), ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex), + ("CalamityMod/Buffs/DamageOverTime/WindChilled", NPC => NPC.Calamity().windChilled), // All other important Calamity debuffs, in alphabetical order ("CalamityMod/Buffs/StatDebuffs/AbsorberAffliction", NPC => NPC.Calamity().absorberAffliction), @@ -5117,13 +4974,13 @@ namespace CalamityMod.NPCs ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } - // Draw summon tag display. TODO: make it use custom textures provided by SummonTag. int yOffset = 0; for (int i = NPC.maxBuffs - 1; i >= 0; i--) { if (npc.buffTime[i] > 0) { - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(npc.buffType[i], out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[npc.buffType[i]]; + if (tag is not null) { // Fetch the item and its frames var tex = TextureAssets.Item[tag.TagItem].Value; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 5fa1266546..fc2a6c5711 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.Furniture.Paintings; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -266,11 +267,11 @@ namespace CalamityMod.NPCs // Sand Elemental // Elemental in a Bottle @ 20% Normal, 33.33% Expert+ - // Rare Elemental in a Bottle @ 10% Normal, 16.67% Expert+ + // Oasis Elemental in a Bottle @ 10% Normal, 16.67% Expert+ // Desert Key @ 10% case NPCID.SandElemental: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); npcLoot.Add(ItemID.DungeonDesertKey, 10); break; @@ -1867,6 +1868,13 @@ DukeEditFailed: #region Pre Kill public override bool PreKill(NPC npc) { + if (npc.Calamity().preventDrops) + { + // This NEEDS to have an exception to function, so I put a very unlikely item to ever drop from an enemy + DropHelper.BlockEverything(ModContent.ItemType()); + npc.value = 0; + } + // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ if (CalamityWorld.revenge && (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); @@ -1884,6 +1892,9 @@ DukeEditFailed: #region On Kill Main Hook public override void OnKill(NPC npc) { + if (npc.Calamity().coinDropMult != 1) + npc.value = (int)(npc.value * npc.Calamity().coinDropMult); + // Boss Rush on-kill effects if (BossRushEvent.BossRushActive) { diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 0d477e9611..f02551ccd6 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; @@ -22,15 +23,19 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Rogue; using CalamityMod.Systems.Collections; +using CalamityMod.Tiles.Furniture; 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; namespace CalamityMod.NPCs @@ -70,6 +75,18 @@ namespace CalamityMod.NPCs public int shopAlertAnimTimer = 0; /// public int shopAlertAnimFrame = 0; + /// + /// Controls how this Town NPC is being affected by The Gift.
+ /// If true, happiness is overriden with an extremely high value. If false, happiness is overriden with an extremely low value. If null, uses vanilla happiness. + ///
+ public bool? TheGiftStatus = null; + /// + /// Timer to track when to reset the effects of The Gift, which occurs after 24 hours.
+ /// When The Gift is applied, this is set to 0 then starts counting up. + ///
+ public double TheGiftReset = -1.0; + + public bool AffectedByTheMonument = false; public override bool InstancePerEntity => true; @@ -85,10 +102,29 @@ namespace CalamityMod.NPCs myClone.setNewName = setNewName; myClone.shopAlertAnimTimer = shopAlertAnimTimer; myClone.shopAlertAnimFrame = shopAlertAnimFrame; + myClone.TheGiftStatus = TheGiftStatus; + myClone.TheGiftReset = TheGiftReset; + myClone.AffectedByTheMonument = AffectedByTheMonument; 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 = [ @@ -96,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 = [ @@ -115,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 = [ @@ -155,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 = @@ -178,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 = [ @@ -193,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 = [ @@ -200,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 = [ @@ -211,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 = [ @@ -247,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 = [ @@ -258,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 = [ @@ -265,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 = [ @@ -281,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 = [ @@ -290,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 = [ @@ -306,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 = [ @@ -320,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 = [ @@ -330,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 = @@ -360,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 = [ @@ -370,6 +430,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogPitBullNames = [ "Splinter", // <@!320320801213775873> (kaimonick) + "Mack", // <@!427765391662514185> (dorkblaze01) ]; private static readonly string[] TownDogBeagleNames = [ @@ -384,6 +445,7 @@ namespace CalamityMod.NPCs [ "Yoshi", // <@!541127291426832384> (gregthespinarak) "Franklin", // <@!338315261352476682> (tyeski) + "Rocco", // <@!682411821067796480> (little_one777) ]; private const int TownCatSiameseVanillaNames = 12; @@ -400,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 = [ @@ -417,6 +481,7 @@ namespace CalamityMod.NPCs "Saffie", // <@!319753595161411584> (CDMusic) "Willow", // <@!319753595161411584> (CDMusic) "Maine", // <@!731141759484297226> (trianglepixel) + "Pluey", // <@!706732954079985745> (violet.prime) ]; private static readonly string[] TownCatOrangeTabbyNames = [ @@ -447,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; @@ -805,8 +873,38 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { SetPatreonTownNPCName(npc, Mod); + + // Reset The Gift after 24 hours + if (TheGiftReset >= 0.0) + { + TheGiftReset += Main.dayRate; + if (TheGiftReset >= Main.dayLength + Main.nightLength) + { + TheGiftReset = -1.0; + TheGiftStatus = null; + } + } + + // Search for The Monument, for the purposes of assigning higher taxes + AffectedByTheMonument = false; + SearchForTheMonument(npc); + return true; } + + public bool SearchForTheMonument(NPC npc) + { + Point tileCenter = npc.Center.ToTileCoordinates(); + Rectangle searchArea = new((int)(tileCenter.X - Main.buffScanAreaWidth / 2), (int)(tileCenter.Y - Main.buffScanAreaHeight / 2), Main.buffScanAreaWidth, Main.buffScanAreaHeight); + + if (TheMonumentTileEntity.IsInArea(searchArea)) + { + AffectedByTheMonument = true; + return true; + } + + return false; + } #endregion #region PreDraw @@ -960,7 +1058,7 @@ namespace CalamityMod.NPCs case NPCID.Cyborg: if (Main.rand.NextBool(5) && NPC.downedMoonlord) - chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MoonLordDefeated" + Main.rand.Next(1, 2 + 1)); + chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MoonLordDefeated"); else if (Main.rand.NextBool(10) && !DownedBossSystem.downedPlaguebringer && NPC.downedGolemBoss) chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MentionPlague"); else if (Main.rand.NextBool(10) && Main.raining) @@ -977,10 +1075,6 @@ namespace CalamityMod.NPCs case NPCID.Dryad: if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); - else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) - { - chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); - } else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneSulphur) chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.SulphurSea"); else if (Main.rand.NextBool(5) && Main.hardMode) @@ -1032,6 +1126,14 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.MerchantChat.Bandit"); break; + case NPCID.Nurse: + if (Main.rand.NextBool(4) && NPC.downedPlantBoss && thief != -1) + chat = CalamityUtils.GetTextValue("Vanilla.NurseChat.PlanteraDefeatedAndBanditPresent"); + else if (Main.rand.NextBool(4) && thief != -1) + chat = CalamityUtils.GetTextValue("Vanilla.NurseChat.Bandit"); + + break; + case NPCID.Painter: if (Main.rand.NextBool(4) && Main.LocalPlayer.ZoneCorrupt) chat = CalamityUtils.GetTextValue("Vanilla.PainterChat.Corruption"); @@ -1169,7 +1271,7 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (CalamityNPCTypeSets.BoundTownNPC[npc.type]) + if (CalamityNPCSets.BoundTownNPC[npc.type]) npc.dontTakeDamageFromHostiles = true; } @@ -1230,14 +1332,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) @@ -1319,8 +1419,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) @@ -1378,7 +1477,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) @@ -1387,7 +1485,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/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs index 2ee5de4bbc..b6fedbc21d 100644 --- a/NPCs/CalamityPierceResistance.cs +++ b/NPCs/CalamityPierceResistance.cs @@ -50,19 +50,15 @@ namespace CalamityMod.NPCs pierceResistNPC.Add(NPCID.TheDestroyerTail); // Specific vanilla projectile exemptions - exemptProjectiles.Add(ProjectileID.Arkhalis); exemptProjectiles.Add(ProjectileID.ChargedBlasterLaser); exemptProjectiles.Add(ProjectileID.ClingerStaff); exemptProjectiles.Add(ProjectileID.FinalFractal); exemptProjectiles.Add(ProjectileID.FlyingKnife); - exemptProjectiles.Add(ProjectileID.HallowJoustingLance); + exemptProjectiles.Add(ProjectileID.HallowJoustingLance); // "Why not make jousting lances exempt via AI style?" Because they use spear AI. Thanks vanilla! exemptProjectiles.Add(ProjectileID.JoustingLance); exemptProjectiles.Add(ProjectileID.LastPrismLaser); exemptProjectiles.Add(ProjectileType()); // Included here as it does not have a projectile - exemptProjectiles.Add(ProjectileID.MonkStaffT3); - exemptProjectiles.Add(ProjectileID.PiercingStarlight); exemptProjectiles.Add(ProjectileID.ShadowJoustingLance); - exemptProjectiles.Add(ProjectileID.Terragrim); // Specific vanilla projectile single hitbox exemptions singleHitboxExemptProjectiles[ProjectileID.NettleBurstEnd] = true; @@ -134,6 +130,11 @@ namespace CalamityMod.NPCs if (singleHitboxExemptProjectiles.TryGetValue(projectile.type, out bool isSingleHitboxExempt) && isSingleHitboxExempt && singleHitboxNPC.Contains(npc.type)) return; + // Skip specific vanilla AI styles, or if the projectile sets heldProj (meaning it's a holdout). + if (projectile.aiStyle == ProjAIStyleID.Flail || projectile.aiStyle == ProjAIStyleID.MechanicalPiranha || projectile.aiStyle == ProjAIStyleID.Yoyo || + Main.player[projectile.owner].heldProj == projectile.whoAmI) + return; + PierceResistGlobal(projectile, npc, ref modifiers); } @@ -150,8 +151,7 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= 1f - damageReduction; - bool aiStyleExempt = projectile.aiStyle == ProjAIStyleID.Flail || projectile.aiStyle == ProjAIStyleID.MechanicalPiranha || projectile.aiStyle == ProjAIStyleID.Yoyo; - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass() && !aiStyleExempt) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass()) projectile.Calamity().timesPierced++; } } diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index 65507bd0af..9b18e6fe5d 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -136,11 +136,9 @@ namespace CalamityMod.NPCs { Vector2 pulseVel = -safeVel; Particle pulse1 = new CustomSpark(npc.Center, pulseVel * 2, "CalamityMod/Particles/BloomCircle", false, (int)(23 * MathF.Pow(scale, 2)), 0.6f * MathF.Pow(scale, 2), Color.DodgerBlue, new Vector2(2f, 1f), shrinkSpeed: -0.1f / scale, noShrink: true, glowCenter: true, glowOpacity: 0.8f); - GeneralParticleHandler.SpawnParticle(pulse1); - pulse1.Pixelate = true; + GeneralParticleHandler.SpawnParticle(pulse1, true); Particle pulse2 = new CustomSpark(npc.Center, pulseVel, "CalamityMod/Particles/BloomRing", false, (int)(18 * MathF.Pow(scale, 2)), 0.5f * MathF.Pow(scale, 2), Color.Blue, new Vector2(4f, 0.7f), shrinkSpeed: -0.3f / scale, noShrink: true); - GeneralParticleHandler.SpawnParticle(pulse2); - pulse2.Pixelate = true; + GeneralParticleHandler.SpawnParticle(pulse2, true); } diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index 4cfd936e34..74dfb53f73 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Crags if (DownedBossSystem.downedProvidence) { NPC.damage = 80; - NPC.defense = 20; + NPC.defense = 40; NPC.lifeMax = 3500; } Banner = NPC.type; 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/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index a2befaa003..fc2faaee99 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.Cryogen NPC.width = 216; NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; - NPC.DR_NERD(0.4f); - NPC.LifeMaxNERB(2800, 3360, 33600); + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(2500, 3000, 30000); NPC.Opacity = 0f; NPC.HitSound = Cryogen.HitSound; NPC.DeathSound = BreakSound; diff --git a/NPCs/DesertScourge/DesertPestBody.png b/NPCs/DesertScourge/DesertPestBody.png deleted file mode 100644 index 79e052b362..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody2.png b/NPCs/DesertScourge/DesertPestBody2.png deleted file mode 100644 index f651238e84..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody2.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody3.png b/NPCs/DesertScourge/DesertPestBody3.png deleted file mode 100644 index 2307268ff8..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody3.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody4.png b/NPCs/DesertScourge/DesertPestBody4.png deleted file mode 100644 index 922b55b874..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody4.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestHead.png b/NPCs/DesertScourge/DesertPestHead.png deleted file mode 100644 index 4d24a8bb61..0000000000 Binary files a/NPCs/DesertScourge/DesertPestHead.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestTail.png b/NPCs/DesertScourge/DesertPestTail.png deleted file mode 100644 index f6f82765e0..0000000000 Binary files a/NPCs/DesertScourge/DesertPestTail.png and /dev/null differ diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 9b1d42e7e7..2d45fb0d1d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -249,12 +249,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int LaserWallDamage = 75; // 300 public static int LaserWallMiddleBeamDamage = 85; // 340 - public static int FireballDamage = 60; // 240 + public static int FireballDamage = 55; // 220 public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 250; // 500 + NPC.damage = 235; // 470 NPC.npcSlots = 5f; NPC.width = 104; NPC.height = 104; @@ -2678,6 +2678,9 @@ namespace CalamityMod.NPCs.DevourerofGods GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); } // Trophy (always directly from boss, never in bag) 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/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..931bab8b93 --- /dev/null +++ b/NPCs/NormalNPCs/DivineSwine.cs @@ -0,0 +1,985 @@ +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, + }; + + 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) + 3, Type); + } + + 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().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + } + + 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); + SoundEngine.PlaySound(IdleSound, NPC.Center); + if (SoundEngine.TryGetActiveSound(SwineSpeakSoundSlot, out var activeSound)) + activeSound.Stop(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Transform(ModContent.NPCType()); + NPC.netUpdate = true; + } + } + } + + 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); + } + + // 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); + SoundEngine.PlaySound(IdleSound, NPC.Center); + + 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) + { + 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 _)) + SwineSpeakSoundSlot = SoundEngine.PlaySound(SwineSpeakLoopingSound, 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..5d8522b4fe --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.AI.Transitionals.cs @@ -0,0 +1,550 @@ +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(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Transform(ModContent.NPCType()); + NPC.netUpdate = true; + } + } + + 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)); + 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..a91458e006 --- /dev/null +++ b/NPCs/NormalNPCs/HorribleHog/HorribleHog.cs @@ -0,0 +1,839 @@ +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 + }; + + 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 _)) + DevilsTongueSlot = SoundEngine.PlaySound(DevilsTongueLoopingSound, 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) + { + 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)); + 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/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index d0df599e78..86fc4b4116 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -1,56 +1,123 @@ 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 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 + }; + + 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 +130,380 @@ 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 (!SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + NearbySoundSlot = SoundEngine.PlaySound(DivineSwine_SwineSpeakLoopingSound, 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 && Main.netMode != NetmodeID.MultiplayerClient) + { + 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()); + NPC.netUpdate = true; + } + } + + public void MainBehavior_HorribleHogTransformation() + { + NPC.velocity.X *= 0.9f; + NPC.rotation = 0f; + if (!SoundEngine.TryGetActiveSound(NearbySoundSlot, out _)) + NearbySoundSlot = SoundEngine.PlaySound(HorribleHog_DevilsTongueLoopingSound, 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(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Transform(ModContent.NPCType()); + NPC.netUpdate = true; + } + } + } + + 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; + } + + 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); + 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); + 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 +512,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 +519,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 +540,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..de5acee1b0 --- /dev/null +++ b/NPCs/NormalNPCs/PiggyGold.cs @@ -0,0 +1,48 @@ +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.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PiggyGold : Piggy + { + public override void SetStaticDefaults() + { + NPCID.Sets.GoldCrittersCollection.Add(Type); + NPCID.Sets.NormalGoldCritterBestiaryPriority.Insert(NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(NPCID.GoldBunny) + 2, Type); + base.SetStaticDefaults(); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.rarity = 3; + NPC.catchItem = (short)ModContent.ItemType(); + Banner = 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/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index b3e68cefb3..9524b527c3 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -179,6 +180,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Leather, 1, 1, 2); // 100% chance of 1-2 leather + npcLoot.Add(ModContent.ItemType(), 12); // 8% chance to drop Tundra Leash LeadingConditionRule postCryo = npcLoot.DefineConditionalDropSet(DropHelper.PostCryo()); postCryo.Add(ModContent.ItemType()); } diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs index 0670a351ec..e0f308ab27 100644 --- a/NPCs/NormalNPCs/WildBumblebirb.cs +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -80,6 +80,8 @@ namespace CalamityMod.NPCs.NormalNPCs float rotationMult = 4f; float rotationAmt = 0.04f; + NPC.ai[3]++; + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) { if (NPC.timeLeft > 5) @@ -92,7 +94,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type && NPC.ai[3] >= 2) { Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) @@ -145,7 +147,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 1f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } else if (swarmerIdleTargetDist.Length() > 400f) { @@ -190,7 +191,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } NPC.ai[2] += 0.0166666675f; diff --git a/NPCs/Noxus/Noxus.png b/NPCs/Noxus/Noxus.png deleted file mode 100644 index 95ec42e62c..0000000000 Binary files a/NPCs/Noxus/Noxus.png and /dev/null differ 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/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index b35bc6f9c9..5e565e819d 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -337,26 +337,11 @@ namespace CalamityMod.NPCs.Perforator // This is possibly the best or worst idea ever conceived if (Main.zenithWorld) { - float laserOffset = 1500f; - float laserVelocity = 4f; - int type = ModContent.ProjectileType(); - int damage = LaserWallDamage; - NPC.Calamity().newAI[3]++; if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast { if (NPC.Calamity().newAI[3] % 60 == 59) - { - SoundEngine.PlaySound(SoundID.Item12, player.Center); - for (int i = -7; i < 8; i++) // 15 lasers - { - float laserGap = (i * 128f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center + Main.rand.NextVector2CircularEdge(600, 600), Vector2.Zero, ModContent.ProjectileType(), LaserWallDamage, 0, Main.myPlayer, 0.45f, 180, Main.rand.Next(5)); if (NPC.Calamity().newAI[3] >= 300f) NPC.Calamity().newAI[3] = -300f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 4699dddf4c..5b48c83dd6 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -162,9 +162,9 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; - bool spawnSmall = Main.getGoodWorld ? lifeRatio < 0.85f : lifeRatio < 0.75f; - bool spawnMedium = Main.getGoodWorld ? lifeRatio < 0.60f : lifeRatio < 0.50f; - bool spawnLarge = Main.getGoodWorld ? lifeRatio < 0.45f : lifeRatio < 0.25f; + bool spawnSmall = lifeRatio < 0.75f; + bool spawnMedium = lifeRatio < 0.50f; + bool spawnLarge = lifeRatio < 0.25f; if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || !(player.ZoneCrimson || BossRushEvent.BossRushActive)) { @@ -332,16 +332,6 @@ namespace CalamityMod.NPCs.Perforator GeneralParticleHandler.SpawnParticle(blood); } - - if (Main.getGoodWorld && lifeRatio < 0.5f && Main.netMode != NetmodeID.MultiplayerClient) - { - if (lifeRatio > 0.35f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.2f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.05f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - } if (wormType != -1) { squashTimer = squashInterval; // Start scaling animation diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index e9c9606af2..c81061ba3e 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - NPC.damage = 70; // 140 + NPC.damage = 60; // 120 NPC.width = 22; NPC.height = 22; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2e39de458b..1c1c256a20 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 80; // 160 + NPC.damage = 70; // 140 NPC.width = 42; NPC.height = 42; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0b9018bce2..ffe5aefd53 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -83,13 +83,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public static int StingerDamage = 28; // 112 - public static int NukeDamage = 35; // 140; Also applies to GFB Peanuts and Gauss Nukes + public static int StingerDamage = 25; // 100 + public static int NukeDamage = 30; // 120; Also applies to GFB Peanuts and Gauss Nukes public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 90; // 180 + NPC.damage = 75; // 150 NPC.npcSlots = 64f; NPC.width = 198; NPC.height = 198; @@ -1378,7 +1378,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath target.AddBuff(BuffID.Poisoned, 480); target.AddBuff(BuffID.Venom, 480); } - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 5005f77496..43ff5d3db8 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -32,6 +32,7 @@ using CalamityMod.Systems.Graphic; using CalamityMod.Tiles.Ores; using CalamityMod.Utilities; using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -98,6 +99,9 @@ namespace CalamityMod.NPCs.Providence public bool Dying = false; public int DeathAnimationTimer; public static float borderRadius = 3000f; + int spearDir = 1; + int starDir = 1; + public Vector2? borderPosition = null; // Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSpawn") { Volume = 1.2f }; @@ -324,6 +328,7 @@ namespace CalamityMod.NPCs.Providence writer.Write((Half)SoundWarningLevel); writer.Write(DeathAnimationTimer); writer.Write(borderRadius); + writer.WriteVector2(borderPosition ?? Vector2.Zero); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -353,6 +358,9 @@ namespace CalamityMod.NPCs.Providence SoundWarningLevel = (float)reader.ReadHalf(); DeathAnimationTimer = reader.ReadInt32(); borderRadius = reader.ReadSingle(); + borderPosition = reader.ReadVector2(); + if (borderPosition == Vector2.Zero) + borderPosition = null; for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); @@ -364,6 +372,10 @@ namespace CalamityMod.NPCs.Providence public override void AI() { + //ensure projectiles all despawn when she does + if (NPC.timeLeft == 1) + DespawnSpecificProjectiles(true); + // Set the border drawing to true if it isn't set to true // Can happen when another mod sets to false for a difficulty and that difficulty is then toggled off. shouldDrawInfernoBorder = true; @@ -798,9 +810,6 @@ 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)) { @@ -822,22 +831,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; @@ -862,14 +865,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; @@ -881,14 +878,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; + acceleration *= getFuckedAI ? 0.6f : 0.2f; + velocity *= getFuckedAI ? 0.6f : 0.2f; } if (Main.getGoodWorld) @@ -1180,10 +1171,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) @@ -1246,6 +1235,8 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.FlameCocoon: + borderPosition ??= NPC.Center; + borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f); Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30); if (!targetDead && !getFuckedAI) { @@ -1279,7 +1270,7 @@ namespace CalamityMod.NPCs.Providence Vector2 spinningPoint = normalSpread ? new Vector2(0f, -cocoonProjVelocity) : new Vector2(-velocityX, -cocoonProjVelocity); for (int i = 0; i < chains; i++) { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2])); + Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2]) * starDir); if (Main.rand.NextBool(healingStarChance) && !death) { @@ -1419,6 +1410,7 @@ namespace CalamityMod.NPCs.Providence } text = false; + starDir *= -1; AIState = (int)Phase.PhaseChange; NPC.localAI[2] = attackDelayAfterCocoon; NPC.TargetClosest(); @@ -1452,10 +1444,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) @@ -1515,6 +1505,10 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.SpearCocoon: + + borderPosition ??= NPC.Center; + borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f); + if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) @@ -1570,7 +1564,7 @@ namespace CalamityMod.NPCs.Providence spearRateIncrease = 1f; float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease); - calamityGlobalNPC.newAI[1] += radialOffset; + calamityGlobalNPC.newAI[1] += radialOffset * spearDir; } calamityGlobalNPC.newAI[2] += 1f; @@ -1596,7 +1590,9 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; if (NPC.ai[3] >= phaseTime) { + AIState = (int)Phase.PhaseChange; + spearDir *= -1; NPC.localAI[2] = attackDelayAfterCocoon; NPC.TargetClosest(); } @@ -1875,7 +1871,7 @@ namespace CalamityMod.NPCs.Providence public float CalculateBurnIntensity(float attackDelayAfterCocoon = 1f) { - float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center); + float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, borderPosition ?? NPC.Center); float aiTimer = NPC.ai[3]; // This bool is only relevant for non-Zenith enraged AI @@ -1884,7 +1880,7 @@ namespace CalamityMod.NPCs.Providence float baseDistance = 2800f; float shorterFlameCocoonDistance = (CalamityWorld.death || fullPower) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; float shorterSpearCocoonDistance = (CalamityWorld.death || fullPower) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; - float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; + float shorterDistance = baseDistance - (AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance); bool guardianAlive = false; if (CalamityGlobalNPC.holyBossAttacker != -1 && Main.npc[CalamityGlobalNPC.holyBossAttacker].active) @@ -1907,11 +1903,10 @@ namespace CalamityMod.NPCs.Providence // Distance does not get shorter if in GFB / Guardians are alive if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Rainbow) { - maxDistance = baseDistance; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) - maxDistance -= shorterDistance * shorterDistanceFade; + maxDistance = MathHelper.Lerp(baseDistance, shorterDistance, shorterDistanceFade); else if (attackDelayAfterCocoon > 1f) - maxDistance -= shorterDistance * (NPC.localAI[2] / attackDelayAfterCocoon); + maxDistance = MathHelper.Lerp(baseDistance, shorterDistance, (NPC.localAI[2] / attackDelayAfterCocoon)); } float drawFireDistanceStart = maxDistance - 800f; @@ -1930,7 +1925,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; @@ -2566,10 +2561,10 @@ namespace CalamityMod.NPCs.Providence shader.Parameters["colorMult"].SetValue(prov.hasBeenGivenFullPower ? 7.65f : 7.35f); //I want you to know it took considerable restraint to deliberately misspell colour. shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); shader.Parameters["radius"].SetValue(borderDistance); - shader.Parameters["anchorPoint"].SetValue(npc.Center); + shader.Parameters["anchorPoint"].SetValue(prov.borderPosition ?? npc.Center); shader.Parameters["screenPosition"].SetValue(Main.screenPosition); shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2()); - shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); + shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity*0.5f + 0.5f); shader.Parameters["playerPosition"].SetValue(target.Center); shader.Parameters["maxOpacity"].SetValue(maxOpacity); shader.Parameters["day"].SetValue(!prov.hasBeenGivenFullPower); @@ -2866,6 +2861,14 @@ 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..4981b94c3f 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,33 @@ 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.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.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 +98,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 +118,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,34 +147,53 @@ 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; @@ -355,11 +304,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 +316,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,7 +345,7 @@ 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; @@ -407,31 +356,29 @@ namespace CalamityMod.NPCs.SlimeGod 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) @@ -480,12 +427,11 @@ namespace CalamityMod.NPCs.SlimeGod // 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 +440,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 +462,161 @@ 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; + // Set damage + NPC.damage = NPC.defDamage; - if (distanceFromFlyDestination < chargeGateDistance) - NPC.ai[0] = chargeCooldown; + if (distanceFromFlyDestination < 200f) + NPC.ai[0] = 20f; - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.rotation += NPC.direction * 0.3f; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; - return; - } + NPC.rotation += NPC.direction * 0.3f; + + 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; 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..7d30a48077 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,33 +706,12 @@ 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 Color? GetAlpha(Color drawColor) { Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha); @@ -788,31 +719,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 +736,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 +758,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..20e145acd2 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,33 +747,12 @@ 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 Color? GetAlpha(Color drawColor) { Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha); @@ -813,31 +760,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 +777,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/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 70d85d9033..f8232470c8 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -63,11 +63,11 @@ namespace CalamityMod.NPCs.StormWeaver NPC.dontCountMe = true; if (CalamityWorld.death || BossRushEvent.BossRushActive) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) NPC.scale *= 1.15f; - else if (Main.expertMode) + else if (CalamityWorld.revenge) NPC.scale *= 1.1f; + else if (Main.expertMode) + NPC.scale *= 1.05f; if (Main.getGoodWorld) NPC.scale *= 0.7f; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 9c34dbc2f2..b87f6185ca 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -116,11 +116,11 @@ namespace CalamityMod.NPCs.StormWeaver NPC.netAlways = true; if (CalamityWorld.death || BossRushEvent.BossRushActive) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) NPC.scale *= 1.15f; - else if (Main.expertMode) + else if (CalamityWorld.revenge) NPC.scale *= 1.1f; + else if (Main.expertMode) + NPC.scale *= 1.05f; if (Main.getGoodWorld) NPC.scale *= 0.7f; @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.StormWeaver // Start calling down frost waves from the sky in sheets and stop firing lightning during the charge bool phase3 = lifeRatio < 0.55f; - // Lightning strike flash phase, stop charging and start summoning tornadoes + // Lightning strike flash phase, start summoning tornadoes bool phase4 = lifeRatio < 0.3f; // Update armored settings to naked settings @@ -336,33 +336,21 @@ namespace CalamityMod.NPCs.StormWeaver // Start charging at the player when in phase 2 if (phase2) { - if (!phase4) - { - calamityGlobalNPC.newAI[0] += 1f; - } - else - { - NPC.localAI[1] = 0f; - if (NPC.localAI[3] > 0f) - NPC.localAI[3] -= 1f; - - calamityGlobalNPC.newAI[0] = 0f; - } - + calamityGlobalNPC.newAI[0] += 1f; calamityGlobalNPC.newAI[2] += 1f; // Only use tornadoes in phase 4 and swap between using them or the frost waves bool useTornadoes = calamityGlobalNPC.newAI[3] % 2f != 0f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float attackGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) - chargePhaseGateValue *= 0.5f; + attackGateValue *= 0.5f; if (phase4 && expertMode) - chargePhaseGateValue *= 0.9f; + attackGateValue *= 0.9f; // Gate value for when Storm Weaver fires projectiles - float projectileGateValue = (int)(chargePhaseGateValue * 0.25f); + float resetGateValue = attackGateValue + 100f; // Call down frost waves from the sky if (phase3 && !useTornadoes) @@ -436,10 +424,8 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (calamityGlobalNPC.newAI[2] >= projectileGateValue) + if (calamityGlobalNPC.newAI[2] == attackGateValue) { - calamityGlobalNPC.newAI[2] = -projectileGateValue * 4f; - // Dictates whether Storm Weaver will use frost or tornadoes if (phase4) { @@ -471,14 +457,14 @@ namespace CalamityMod.NPCs.StormWeaver // Start fast at index 0, become slower as each projectile spawns and then become faster past the central wave int centralWave = totalWaves / 2; - float velocityY = 8f; + float velocityY = revenge ? 10f : expertMode ? 9f : 8f; int wavePatternType = revenge ? Main.rand.Next(3) : expertMode ? Main.rand.Next(2) + 1 : 2; - float delayBeforeFiring = -60f; + float delayBeforeFiring = -70f; // Note the actual delay is half of this number since frost waves have an extra update for (int x = 0; x < totalWaves; x++) { switch (wavePatternType) { - // Starts at 8, central point is 6 and the end is 8 + // Arrow shape case 0: if (x != 0) @@ -491,7 +477,7 @@ namespace CalamityMod.NPCs.StormWeaver break; - // Starts at 8 and alternates between 6 and 8 + // Alternating waves that arrive at different times case 1: if (x != 0) @@ -504,16 +490,13 @@ namespace CalamityMod.NPCs.StormWeaver break; - // Flat line of slower waves + // Flat line case 2: - - velocityY = 7f; - break; } // Telegraph is active for 60 frames - // Frost Waves start moving after 30 frames + // Frost Waves start moving after 35 frames // Frost Waves take 30 frames to reach full velocity Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnX, Main.player[NPC.target].Center.Y - 1600f, 0f, velocityY * 0.5f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, velocityY); Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnX, Main.player[NPC.target].Center.Y - 1600f, 0f, velocityY * 0.1f, type, FrostWaveDamage, 0f, Main.myPlayer, delayBeforeFiring, velocityY); @@ -526,95 +509,98 @@ namespace CalamityMod.NPCs.StormWeaver // Summon tornadoes if (useTornadoes) { - if (calamityGlobalNPC.newAI[2] >= projectileGateValue) + if (calamityGlobalNPC.newAI[2] == attackGateValue) { - calamityGlobalNPC.newAI[2] = -projectileGateValue * 4f; - // Dictates whether Storm Weaver will use frost or tornadoes calamityGlobalNPC.newAI[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ModContent.ProjectileType(); - int totalTornadoes = revenge ? 7 : expertMode ? 5 : 3; - float spawnDistance = revenge ? 750f : expertMode ? 900f : 1050f; - for (int i = 0; i < totalTornadoes; i++) + int totalTornadoes = death ? 10 : revenge ? 6 : expertMode ? 4 : 2; + float spawnDistance = revenge ? 720f : expertMode ? 800f : 880f; // Distance to first tornado from the center point, so actual space is twice this number + for (int i = -totalTornadoes / 2; i <= totalTornadoes / 2; i++) { - Vector2 spawnPosition = Main.player[NPC.target].Center + Vector2.UnitX * spawnDistance * (i - totalTornadoes / 2); + if (i == 0) + continue; + + Vector2 spawnPosition = Main.player[NPC.target].Center + Vector2.UnitX * (spawnDistance * Math.Sign(i) + (i - Math.Sign(i)) * spawnDistance * 0.4f); Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, 0, 0f, Main.myPlayer, TornadoDamage, 1f); } } } } + if (calamityGlobalNPC.newAI[2] >= resetGateValue) + calamityGlobalNPC.newAI[2] = 0f; + // Charge - if (!phase4) + if (calamityGlobalNPC.newAI[0] == attackGateValue - 70) { - if (calamityGlobalNPC.newAI[0] == chargePhaseGateValue - 70) + Vector2 soundCenter = Main.player[NPC.target].Center; + SoundStyle lightning = new("CalamityMod/Sounds/Custom/LightningTelegraph") { Volume = 0.7f }; + SoundEngine.PlaySound(lightning, soundCenter); + } + if (calamityGlobalNPC.newAI[0] >= attackGateValue) + { + NPC.localAI[3] = 60f; + + if (NPC.localAI[1] == 0f) + NPC.localAI[1] = 1f; + + if (calamityGlobalNPC.newAI[0] >= resetGateValue) { - Vector2 soundCenter = Main.player[NPC.target].Center; - SoundStyle lightning = new("CalamityMod/Sounds/Custom/LightningTelegraph") { Volume = 0.7f }; - SoundEngine.PlaySound(lightning, soundCenter); + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; } - if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue) + + if (NPC.localAI[1] == 2f) { - NPC.localAI[3] = 60f; + velocity += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (1f - (lifeRatio / 0.8f)); + acceleration += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.0001f * (1f - (lifeRatio / 0.8f)); + velocity *= 2f; + acceleration *= 0.85f; - if (NPC.localAI[1] == 0f) - NPC.localAI[1] = 1f; - - if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue + 100f) + float stopChargeDistance = 800f * NPC.localAI[2]; + if (stopChargeDistance < 0) { - NPC.TargetClosest(); - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - - if (NPC.localAI[1] == 2f) - { - velocity += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.01f * (1f - (lifeRatio / 0.8f)); - acceleration += Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) * 0.0001f * (1f - (lifeRatio / 0.8f)); - velocity *= 2f; - acceleration *= 0.85f; - - float stopChargeDistance = 800f * NPC.localAI[2]; - if (stopChargeDistance < 0) + if (NPC.Center.X < Main.player[NPC.target].Center.X + stopChargeDistance) { - if (NPC.Center.X < Main.player[NPC.target].Center.X + stopChargeDistance) - { - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } - else - { - if (NPC.Center.X > Main.player[NPC.target].Center.X + stopChargeDistance) - { - NPC.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } + NPC.localAI[1] = 0f; + // Prevent the timers from desyncing + calamityGlobalNPC.newAI[0] = calamityGlobalNPC.newAI[2] - resetGateValue; } } - - int dustAmt = 5; - for (int k = 0; k < dustAmt; k++) + else { - Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((k - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; - Vector2 randDustMovement = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int bluishDust = Dust.NewDust(dustRotation + randDustMovement, 0, 0, DustID.UnusedWhiteBluePurple, randDustMovement.X, randDustMovement.Y, 100, default, 3f); - Main.dust[bluishDust].noGravity = true; - Main.dust[bluishDust].noLight = true; - Main.dust[bluishDust].velocity /= 4f; - Main.dust[bluishDust].velocity -= NPC.velocity; + if (NPC.Center.X > Main.player[NPC.target].Center.X + stopChargeDistance) + { + NPC.localAI[1] = 0f; + // Prevent the timers from desyncing + calamityGlobalNPC.newAI[0] = calamityGlobalNPC.newAI[2] - resetGateValue; + } } } - else + + int dustAmt = 5; + for (int k = 0; k < dustAmt; k++) { - if (NPC.localAI[3] > 0f) - NPC.localAI[3] -= 1f; + Vector2 dustRotation = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((k - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + NPC.Center; + Vector2 randDustMovement = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int bluishDust = Dust.NewDust(dustRotation + randDustMovement, 0, 0, DustID.UnusedWhiteBluePurple, randDustMovement.X, randDustMovement.Y, 100, default, 3f); + Main.dust[bluishDust].noGravity = true; + Main.dust[bluishDust].noLight = true; + Main.dust[bluishDust].velocity /= 4f; + Main.dust[bluishDust].velocity -= NPC.velocity; } } + else + { + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + } } if (Main.getGoodWorld) @@ -640,7 +626,7 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (phase2 && !phase4) + if (phase2) { if (NPC.localAI[1] == 1f) { @@ -830,16 +816,19 @@ namespace CalamityMod.NPCs.StormWeaver bool phase2 = lifeRatio < 0.8f && !Main.zenithWorld; bool phase3 = lifeRatio < 0.55f; + bool phase4 = lifeRatio < 0.3f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float attackGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) - chargePhaseGateValue *= 0.5f; + attackGateValue *= 0.5f; + if (phase4 && expertMode) + attackGateValue *= 0.9f; Texture2D texture = phase2 ? Phase2Texture.Value : TextureAssets.Npc[Type].Value; Vector2 halfSizeTexture = new Vector2(texture.Width / 2, texture.Height / 2); float chargeTelegraphTime = 120f; - float chargeTelegraphGateValue = chargePhaseGateValue - chargeTelegraphTime; + float chargeTelegraphGateValue = attackGateValue - chargeTelegraphTime; Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; @@ -865,13 +854,16 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase3 = lifeRatio < 0.55f; + bool phase4 = lifeRatio < 0.3f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float attackGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) - chargePhaseGateValue *= 0.5f; + attackGateValue *= 0.5f; + if (phase4 && expertMode) + attackGateValue *= 0.9f; - int buffDuration = NPC.Calamity().newAI[0] >= chargePhaseGateValue ? 360 : 240; + int buffDuration = NPC.Calamity().newAI[0] >= attackGateValue ? 360 : 240; if (hurtInfo.Damage > 0) target.AddBuff(BuffID.Electrified, buffDuration); } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 3608b9cc4d..c0f5aef107 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -62,11 +62,11 @@ namespace CalamityMod.NPCs.StormWeaver NPC.dontCountMe = true; if (CalamityWorld.death || BossRushEvent.BossRushActive) - NPC.scale *= 1.2f; - else if (CalamityWorld.revenge) NPC.scale *= 1.15f; - else if (Main.expertMode) + else if (CalamityWorld.revenge) NPC.scale *= 1.1f; + else if (Main.expertMode) + NPC.scale *= 1.05f; if (Main.getGoodWorld) NPC.scale *= 0.7f; diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index dc21b19b4f..1cb25c3921 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 16; - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -34,7 +33,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 56; NPC.height = 42; NPC.defense = 22; diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 597eded883..a15fe0bf0c 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.SulphurousSea public const float CheckDistance = 480f; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 4; value.PortraitPositionYOverride = 24f; @@ -32,7 +31,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 54; NPC.height = 42; NPC.defense = 25; 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/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/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png index eba5d41efc..2bba092f4a 100644 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a5fcdec89a..01165da0e4 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -103,10 +103,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool IsAtHp_Acceptance => NPC.life < 2; public bool IsAtBrothers => IsAtHp_BH3 && FinishedBH3; - public bool IsAtSeekers => IsAtHp_BH4 && FinishedBH4; + public bool IsAtSeekers => lifeRatio <= 0.2f; public bool IsAtSep2 => IsAtHp_BH5 && FinishedBH5; - public const int PermafrostAbsoluteZeroDamage = 3725; + public const int PermafrostAbsoluteZeroDamage = 1400; private const float PermafrostPhotonRipperDashVelocity = 6f; private const float PermafrostPhotonRipperMinDistanceFromTarget = 64f; private const float PermafrostPhotonRipperDashAcceleration = 0.3f; @@ -119,20 +119,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool canDespawn = false; public bool despawnProj = false; public bool startText = false; - public bool startBattle = false; //100% - public bool hasSummonedSepulcher1 = false; //100% - public bool startSecondAttack = false; //80% - public bool startThirdAttack = false; //60% - public bool halfLife = false; //40% - public bool startFourthAttack = false; //30% - public bool secondStage = false; //20% - public bool startFifthAttack = false; //10% - public bool gettingTired = false; //8% - public bool hasSummonedSepulcher2 = false; //8% - public bool gettingTired2 = false; //6% - public bool gettingTired3 = false; //4% - public bool gettingTired4 = false; //2% - public bool gettingTired5 = false; //1% + public bool startBattle = false; + public bool hasSummonedSepulcher1 = false; + public bool startSecondAttack = false; + public bool startThirdAttack = false; + public bool halfLife = false; + public bool startFourthAttack = false; + public bool hasSummonedSeekers = false; + public bool startFifthAttack = false; + public bool gettingTired = false; + public bool hasSummonedSepulcher2 = false; + public bool gettingTired2 = false; + public bool gettingTired3 = false; + public bool gettingTired4 = false; + public bool gettingTired5 = false; public bool willCharge = false; public bool canFireSplitingFireball = true; public bool fireFireblastFirst = true; @@ -164,6 +164,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public int preventionPause = 15; // Helps prevent telefragging public int attackPause = 0; public bool respawnBro = true; // Master Mode change + public bool teleport = false; //Used to teleport SCal to the center of the arena at the start of each bullet hell public float shieldOpacity = 1f; public float shieldRotation = 0f; @@ -364,7 +365,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(startFourthAttack); writer.Write(startFifthAttack); writer.Write(halfLife); - writer.Write(secondStage); + writer.Write(hasSummonedSeekers); writer.Write(hasSummonedSepulcher2); writer.Write(gettingTired); writer.Write(gettingTired2); @@ -416,7 +417,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas startFourthAttack = reader.ReadBoolean(); startFifthAttack = reader.ReadBoolean(); halfLife = reader.ReadBoolean(); - secondStage = reader.ReadBoolean(); + hasSummonedSeekers = reader.ReadBoolean(); hasSummonedSepulcher2 = reader.ReadBoolean(); gettingTired = reader.ReadBoolean(); gettingTired2 = reader.ReadBoolean(); @@ -490,9 +491,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - // Used for Scal's teleport at the start of brothers phase - bool teleport = false; - // permafrost and zenith scal are mutually exclusive bool zenithAI = Main.zenithWorld && !permafrost; @@ -1046,7 +1044,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH2 if (bulletHellCounter2 == (SecondBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1073,6 +1081,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1177,7 +1187,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH3 if (bulletHellCounter2 == (ThirdBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1204,6 +1224,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1353,6 +1375,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH4 if (bulletHellCounter2 == (FourthBulletHellEndValue - 360)) @@ -1380,6 +1413,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1508,7 +1543,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH5 if (bulletHellCounter2 == (FifthBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1535,6 +1580,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + //Technically not needed but I wanted to be safe + teleport = false; } #endregion @@ -2070,7 +2118,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (IsAtSeekers) { - if (!secondStage) + if (!hasSummonedSeekers) { if (!BossRushEvent.BossRushActive) { @@ -2113,7 +2161,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); - secondStage = true; + hasSummonedSeekers = true; } } @@ -2134,37 +2182,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas enteredBrothersPhase = true; attackCastDelay = brothersSpawnCastTime; NPC.netUpdate = true; - if (!teleport) - { - Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) - Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); - NPC.velocity = Vector2.Zero; - NPC.Center = goalPos; - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); - GeneralParticleHandler.SpawnParticle(pulse); - 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; - } - } - } - teleport = true; - } } else { @@ -2743,13 +2760,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - NPC.velocity *= 0.98f; + NPC.velocity *= 0f; if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) NPC.velocity.X = 0f; if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) NPC.velocity.Y = 0f; } + FrameType = FrameAnimationType.Casting; } #endregion #region LastStage @@ -3458,6 +3476,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath2") with { Pitch = -0.2f }, catastropheSpawnPosition); hasSummonedBrothers = true; } + + NPC.velocity *= 0f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + + FrameType = FrameAnimationType.Casting; } public void ConnectAllBrimstoneHearts(List heartIndices) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 3e729e5486..82907f2312 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png index 0d99e8edfa..eae9fb6ec7 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png differ 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 8f4766b4cc..0398c06522 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"), @@ -314,6 +315,7 @@ namespace CalamityMod.NPCs.TownNPCs .Add(CalamityConditions.DownedCalamitasClone) .Add(Condition.DownedPlantera) .Add(Condition.DownedPlantera) + .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..184b471dde --- /dev/null +++ b/NPCs/TownNPCs/ShadySalesman.cs @@ -0,0 +1,738 @@ +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; + } + + 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) + { + string name = NPC.GivenName; + NPC.Transform(ModContent.NPCType()); + NPC.GivenName = name; + } + 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() + .Add(Condition.DownedGoblinArmy) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhases04) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhases15) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhases26) + .Add(Condition.DownedGoblinArmy, Condition.MoonPhases37) + .Add() + .Add() + .Add() + .Add() + .Add() + .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 + { + string name = Main.npc[petPig].GivenName; + Main.npc[petPig].Transform(ModContent.NPCType()); + Main.npc[petPig].GivenName = name; + + string fullName = Main.npc[petPig].FullName; + } + 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)) + { + 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 (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 new file mode 100644 index 0000000000..fe50e24b6d --- /dev/null +++ b/NPCs/TownNPCs/TownPiggy.cs @@ -0,0 +1,209 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class TownPiggy : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 13; + NPCID.Sets.ExtraFramesCount[Type] = 0; + NPCID.Sets.AttackFrameCount[Type] = 0; + NPCID.Sets.DangerDetectRange[Type] = 250; + NPCID.Sets.HatOffsetY[Type] = -4; + NPCID.Sets.ShimmerTownTransform[Type] = false; + NPCID.Sets.SpecificDebuffImmunity[Type][BuffID.Shimmer] = true; + NPCID.Sets.SpecificDebuffImmunity[Type][BuffID.Confused] = true; + NPCID.Sets.NPCFramingGroup[Type] = 8; + + NPCID.Sets.IsTownPet[Type] = true; + NPCID.Sets.CannotSitOnFurniture[Type] = false; + NPCID.Sets.TownNPCBestiaryPriority.Add(Type); + NPCID.Sets.PlayerDistanceWhilePetting[Type] = 32; + NPCID.Sets.IsPetSmallForPetting[Type] = true; + + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new() + { + Velocity = 0.25f, + }; + + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, drawModifiers); + } + + public override void SetDefaults() + { + NPC.townNPC = true; + NPC.friendly = true; + NPC.width = 20; + NPC.height = 20; + NPC.aiStyle = NPCAIStyleID.Passive; + AIType = NPCID.TownBunny; + NPC.damage = 0; + NPC.defense = 0; + 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) + { + bestiaryEntry.Info.AddRange( + [ + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.TownPiggy") + ]); + } + + public override bool CanTownNPCSpawn(int numTownNPCs) + { + if (CalamityWorld.unlockedTownPig && !NPC.AnyNPCs(ModContent.NPCType())) + { + return true; + } + return false; + } + + public override void AI() + { + NPC.spriteDirection = NPC.direction; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + // Put a gold crown on Techno + if (NPC.GivenName == this.GetLocalizedValue("Name.Techno") && !BirthdayParty.PartyIsUp) + { + int equipID = ArmorIDs.Head.GoldCrown; + Main.instance.LoadArmorHead(equipID); + Texture2D crown = TextureAssets.ArmorHead[equipID].Value; + Rectangle crownFrame = crown.Frame(1, 20, 0, 0); + int frameHeight = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; + int curFrame = NPC.frame.Y / frameHeight; + int sheetOff = curFrame switch + { + 0 => 0, + 1 => -2, + 2 => -6, + 3 => -6, + 4 => -2, + 5 => -4, + 6 => -6, + 7 => -2, + _ => 0 + }; + spriteBatch.Draw(crown, NPC.Center - screenPos + new Vector2(8 * NPC.spriteDirection, -2 + NPC.gfxOffY + sheetOff).RotatedBy(NPC.rotation), crownFrame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(crown.Width / 2, crown.Height / 40), NPC.scale, NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + } + + public override void FindFrame(int frameHeight) + { + // Sleep animation + if (NPC.ai[0] >= 20f && NPC.ai[0] <= 22f) + { + if (NPC.velocity.Y == 0) + { + if (NPC.ai[1] > 30f && (NPC.frame.Y < frameHeight * 8)) + { + NPC.frame.Y = frameHeight * 8; + } + if (NPC.frame.Y > 0) + { + NPC.frameCounter++; + } + if (NPC.frameCounter > 6) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > 12 * frameHeight) + { + NPC.frame.Y = frameHeight * 8; + } + } + } + else if (NPC.velocity.X == 0) + { + NPC.frame.Y = 0; + } + else + { + if (NPC.velocity.Y == 0) + { + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + } + if (NPC.frame.Y < frameHeight) + NPC.frame.Y = frameHeight; + if (NPC.frame.Y > frameHeight * 7) + NPC.frame.Y = frameHeight; + } + } + + public override List SetNPCNameList() => new List() + { + // Original names + this.GetLocalizedValue("Name.Curly"), + + // Reference names + this.GetLocalizedValue("Name.Oolong"), // Dragon Ball + this.GetLocalizedValue("Name.Napoleon"), // Animal Farm + this.GetLocalizedValue("Name.Waddles"), // Gravity Falls + this.GetLocalizedValue("Name.Crenando"), // Ganondorf + this.GetLocalizedValue("Name.Olivia"), // Olivia + this.GetLocalizedValue("Name.Wilbur"), // Charlotte's Web + this.GetLocalizedValue("Name.Pumbaa"), // The Lion King + this.GetLocalizedValue("Name.Peppa"), // Peppa Pig + this.GetLocalizedValue("Name.Conan"), // Conan the mighty pig + this.GetLocalizedValue("Name.Reuben"), // Minecraft: Story Mode + this.GetLocalizedValue("Name.Porky"), // Looney Tunes + this.GetLocalizedValue("Name.Hamm"), // Toy Story + this.GetLocalizedValue("Name.Runt"), // Chicken Little + this.GetLocalizedValue("Name.Roko"), // Roko's Basilisk + this.GetLocalizedValue("Name.RichardHam"), // Pig from Clarkson's Farm named after Richard Hammond + 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 + }; + + public override string GetChat() + { + WeightedRandom chat = new(); + + for (int i = 0; i <= 2; i++) + { + chat.Add(CalamityUtils.GetText("NPCs.TownPiggy.Chat." + i).Value); + } + + return chat; + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("UI.PetTheAnimal"); + } + } +} diff --git a/NPCs/TownNPCs/TownPiggy.png b/NPCs/TownNPCs/TownPiggy.png new file mode 100644 index 0000000000..ae68308cdf Binary files /dev/null and b/NPCs/TownNPCs/TownPiggy.png differ diff --git a/NPCs/TownNPCs/TownPiggy_Head.png b/NPCs/TownNPCs/TownPiggy_Head.png new file mode 100644 index 0000000000..a31c29b619 Binary files /dev/null and b/NPCs/TownNPCs/TownPiggy_Head.png differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 93f63dd357..b2f1cadca3 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -243,30 +243,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses attackType = 2; if (attackPatternLength % attackIncrement == phase1Attack2) - attackType = 6; - - if (attackPatternLength % attackIncrement == phase1Attack3) attackType = 8; + if (attackPatternLength % attackIncrement == phase1Attack3) + attackType = 6; + if (attackPatternLength % attackIncrement == phase1Attack4) - { - attackType = 4; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[3] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - NPC.SyncExtraAI(); - } + attackType = 8; if (attackPatternLength % attackIncrement == phase1Attack5) attackType = 5; if (attackPatternLength % attackIncrement == phase1Attack6) - attackType = 8; + attackType = 2; if (attackPatternLength % attackIncrement == phase1Attack7) - attackType = 2; + attackType = 8; if (attackPatternLength % attackIncrement == phase1Attack8) { @@ -319,28 +311,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (attackPatternLength % attackIncrement == phase2Attack3) attackType = 8; + if (attackPatternLength % attackIncrement == phase2Attack4) + attackType = 11; + if (attackPatternLength % attackIncrement == phase2Attack5) attackType = 5; if (attackPatternLength % attackIncrement == phase2Attack6) attackType = 2; - if (attackPatternLength % attackIncrement == phase2Attack7) - { - if (phase3) - { - attackType = 7; - - // Adjust the upcoming Ethereal Lance attack depending on what random variable is chosen here. - calamityGlobalNPC.newAI[2] = Main.rand.Next(2); - - // Sync the Calamity AI variables. - NPC.SyncExtraAI(); - } - else - attackType = 6; - } - if (attackPatternLength % attackIncrement == phase2Attack7) { if (phase3) @@ -371,9 +350,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (attackPatternLength % attackIncrement == phase2Attack9) attackType = 8; - if (attackPatternLength % attackIncrement == phase2Attack4) - attackType = 11; - if (attackPatternLength % attackIncrement == phase2Attack10) attackType = 12; } @@ -403,7 +379,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.ai[0] = attackType; NPC.ai[1] = 0f; - NPC.ai[2] += Main.rand.Next(2) + 1f; + NPC.ai[2] += 1f; NPC.netUpdate = true; break; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 870dd18391..972bc16f13 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -155,18 +155,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Start other phases; if arms are dead, start with spin phase if (phase2 || Main.getGoodWorld || allArmsDead) { - // Start spin phase after 1.5 seconds + // Start spin phase after 1.5 seconds if close enough; forced after 4.5 seconds NPC.ai[2] += phase3 ? 1.5f : 1f; if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f))) { - bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[NPC.target].position.Y - 320f && - Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 400f; + bool shouldSpinAround = NPC.ai[1] == 4f && ((NPC.position.Y < Main.player[NPC.target].position.Y - 320f && + Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 400f) || + NPC.ai[2] >= (270f - (death ? 15f * (1f - lifeRatio) : 0f))); if (shouldSpinAround || NPC.ai[1] != 4f) { if (shouldSpinAround) { - NPC.localAI[3] = 300f; + NPC.localAI[3] = 200f; NPC.localAI[1] = 0; NPC.SyncVanillaLocalAI(); } @@ -309,7 +310,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityUtils.CalamityTargeting(NPC, CalamityTargetingParameters.BossDefaults); NPC.ai[2] = 0f; - NPC.ai[1] = 4f; + // Fly overhead and spit missiles if on low health + NPC.ai[1] = phase3 ? 6f : 4f; NPC.localAI[0] = 0f; } @@ -475,7 +477,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning - float spinVelocity = 30f; + float spinVelocity = 25f; if (NPC.ai[2] == 2f) { // Play angry noise @@ -540,8 +542,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); - // Fly overhead and spit missiles if on low health - NPC.ai[1] = phase3 ? 6f : 1f; + NPC.ai[1] = 1f; NPC.ai[2] = 0f; NPC.localAI[3] = 0f; NPC.localAI[0] = 0f; @@ -590,8 +591,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.localAI[0] >= totalMissiles) { - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; + NPC.ai[1] = 4f; + NPC.ai[2] = -60f; NPC.localAI[3] = 0f; calamityGlobalNPC.newAI[0] = 0f; NPC.localAI[0] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index f30880b7a5..227077741e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = death ? 48f : 56f; + float delayBeforeChargingAgain = death ? 50f : 60f; if (NPC.ai[2] >= delayBeforeChargingAgain) { NPC.ai[3] += 1f; @@ -314,21 +314,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.rotation += NPC.ai[2]; NPC.ai[1] += 1f; - if (death && NPC.ai[2] >= 0.2f) - { - if (NPC.ai[1] % 10f == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.DeathLaser; - - Vector2 projectileVelocity = NPC.rotation.ToRotationVector2() * 7f; - float offset = 90f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projectileVelocity) * offset, projectileVelocity, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer); - } - } - } if (NPC.ai[1] == 100f) { @@ -620,7 +605,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (NPC.ai[1] == 4f) { float chargeLineUpDistance = spazAlive ? 600f : 500f; - float chargeSpeed = (death ? 20f : 18f) + (death ? 1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = death ? 5f : 3f; float chargeAcceleration = death ? 0.495f : 0.45f; if (spazAlive) @@ -844,7 +829,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = death ? 19.25f + (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 18f; + float chargeSpeed = 16f; + if (death) + chargeSpeed += (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -935,20 +922,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.rotation += NPC.ai[2]; NPC.ai[1] += 1f; - if (death && NPC.ai[2] >= 0.2f) - { - if (NPC.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = NPC.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer, 0f, 1f); - Main.projectile[proj].tileCollide = false; - } - } - } if (NPC.ai[1] == 100f) { @@ -1025,10 +998,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!NPC.IsMechQueenUp) { - // Boost speed if too far from target - if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); - if (Main.getGoodWorld) { maxVelocity *= 1.15f; 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/RevengeanceAndDeaths/PlantAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs index b2e0a13494..e3a7b04717 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs @@ -140,7 +140,7 @@ public static partial class RevengeanceAndDeathAI NPC.velocity.Y = -2f; } - if ((NPC.type == NPCID.GiantFungiBulb || NPC.type == NPCID.FungiBulb) && !Main.player[NPC.target].DeadOrGhost) + if (NPC.type == NPCID.GiantFungiBulb && !Main.player[NPC.target].DeadOrGhost) { if (NPC.localAI[0] > ((NPC.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? GiantFungiBulbSporeShootGateValue_Rev : GiantFungiBulbSporeShootGateValue) : FungiBulbSporeShootGateValue) - FungiBulbSporeTelegraphTime)) { 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/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index c554318e43..aa96266be8 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -845,6 +845,10 @@ namespace CalamityMod.NPCs.Yharon NPC.spriteDirection = -NPC.direction; } + // Play a roar sound before charging out of bullet hell + if (NPC.ai[2] == -45f) + RoarSoundSlot = SoundEngine.PlaySound(ShortRoarSound, NPC.Center); + NPC.ai[2] += 1f; if (NPC.ai[2] >= phaseSwitchTimer || slowChargeAfterBulletHell) { @@ -1211,6 +1215,10 @@ namespace CalamityMod.NPCs.Yharon NPC.spriteDirection = -NPC.direction; } + // Play a roar sound before charging out of bullet hell + if (NPC.ai[2] == -45f) + RoarSoundSlot = SoundEngine.PlaySound(ShortRoarSound, NPC.Center); + NPC.ai[2] += 1f; if (NPC.ai[2] >= phaseSwitchTimer || slowChargeAfterBulletHell) { 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/SyncTownPigLicensePacket.cs b/Packets/Entities/SyncTownPigLicensePacket.cs new file mode 100644 index 0000000000..4b5c3f865b --- /dev/null +++ b/Packets/Entities/SyncTownPigLicensePacket.cs @@ -0,0 +1,20 @@ +using System.IO; +using CalamityMod.Items.SummonItems.TownPets; +using CalamityMod.NPCs.Abyss; +using Terraria; + +namespace CalamityMod.Packets +{ + internal sealed class SyncTownPigLicensePacket : CalamityPacket + { + public static SyncTownPigLicensePacket Instance { get; private set; } + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) => TheHousingContract.SpawnPiggy(); + } +} 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 new file mode 100644 index 0000000000..d07339afa3 --- /dev/null +++ b/Packets/Players/TheElixirTeleportSyncPacket.cs @@ -0,0 +1,33 @@ +using System.IO; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Potions; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + internal class TheElixirTeleportSyncPacket : CalamityPacket + { + public static TheElixirTeleportSyncPacket Instance { get; private set; } + + public static void Send(Player player, int toClient = -1, int ignoreClient = -1) + { + if (player is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var player = packet.ReadPlayer(); + if (player is null) + return; + + 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/BrightFlash.png b/Particles/BrightFlash.png new file mode 100644 index 0000000000..fd2fad8d76 Binary files /dev/null and b/Particles/BrightFlash.png differ diff --git a/Particles/CustomPulsingSpark.cs b/Particles/CustomPulsingSpark.cs new file mode 100644 index 0000000000..6723387a75 --- /dev/null +++ b/Particles/CustomPulsingSpark.cs @@ -0,0 +1,156 @@ +using System; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomPulsingSpark : Particle + { + public Color InitialColor; + public Color BackColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public float GlowCenterScale = 1; + public float GlowOpacity = 1; + public Texture2D NewTexture; + public Texture2D NewTextureBack; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public bool FlipHorizontal = false; + public bool NoShrink = false; + public float Spin = 0; + public float ColorFadeSpeed = 0; + public int PulseRate; + public int randTimeAdd = 0; + + public float SineRate = 0; + public float SineIntensity = 0; + public float Sine = 0; + public float SineRotation = 0; + public float TurnRate = 0; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public CustomPulsingSpark(Vector2 relativePosition, Vector2 velocity, string frontTexture, string backTexture, bool affectedByGravity, int lifetime, float scale, Color color, Color backColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, int pulseRate = 10, float turnRate = 0, float sineRate = 1, float sineIntensity = 0, float sineRotation = 0, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3) + { + Position = relativePosition; + Velocity = velocity; + NewTexture ??= ModContent.Request(frontTexture).Value; + NewTextureBack ??= ModContent.Request(backTexture).Value; + ExtraRotation = extraRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + BackColor = backColor; + ShrinkSpeed = shrinkSpeed; + PulseRate = pulseRate; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + GlowCenterScale = glowCenterScale; + GlowOpacity = glowOpacity; + FlipHorizontal = flipHorizontal; + NoShrink = noShrink; + + FadeIn = fadeIn; + randTimeAdd = Main.rand.Next(0, 200 + 1); + SineRate = sineRate; + SineIntensity = sineIntensity; + SineRotation = sineRotation; + TurnRate = turnRate; + + if (FadeIn) + Scale = 0f; + Spin = spin; + ColorFadeSpeed = colorFadeSpeed; + } + + public override void Update() + { + if (!FadeIn) + { + if (!NoShrink) + Scale *= 0.95f; + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + ExtraRotation += Spin; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + + Sine = (float)Math.Sin(((Time + randTimeAdd) * SineRate) / MathHelper.Pi) * SineIntensity; + if (TurnRate != 0) + Velocity = Velocity.RotatedBy(TurnRate); + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float pulseScale = 1 + Utils.Remap(Time % PulseRate, 0, PulseRate, 0, 0.85f); + Vector2 adjustedSquash = new Vector2(Math.Max(Stretch.X - 0.4f, 0.1f), Math.Max(Stretch.Y + 0.4f, 0.1f)); + Vector2 scale = adjustedSquash * Scale * pulseScale; + + float scaleMult = 1; + Color col = Color; + Color backCol = BackColor; + + Vector2 drawPos = Position + Vector2.UnitX.RotatedBy(SineRotation) * Sine; + if (AffectedByLight) + { + col = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(Color); + backCol = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(BackColor); + } + + if (Pixelate) + { + PixelationManager.AddPixelatedDrawer((_) => + { + float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed)); + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f)); + spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + }, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null); + } + else + { + float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed)); + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f)); + spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + } + } +} diff --git a/NPCs/SunkenSea/StormlionSentryMandible.png b/Particles/FadeLine.png similarity index 86% rename from NPCs/SunkenSea/StormlionSentryMandible.png rename to Particles/FadeLine.png index 474cbbfaa0..29d0d315fd 100644 Binary files a/NPCs/SunkenSea/StormlionSentryMandible.png and b/Particles/FadeLine.png differ 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/HealingPlus.cs b/Particles/HealingPlus.cs index 4a4de6232b..fbb88cf9f1 100644 --- a/Particles/HealingPlus.cs +++ b/Particles/HealingPlus.cs @@ -12,11 +12,8 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player Owner; public Color StartColor; public Color EndColor; - public Vector2 OverridePosition; - public float Opacity; public HealingPlus(Vector2 position, float scale, Vector2 velocity, Color colorStart, Color colorEnd, int lifetime) { @@ -34,20 +31,15 @@ namespace CalamityMod.Particles { Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion); Lighting.AddLight(Position, Color.ToVector3() * 0.2f); - Opacity -= 0.5f; } public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(Texture).Value; - Vector2 Size = new Vector2(Scale); + Vector2 origin = new Vector2(tex.Width, tex.Height) * 0.5f; - Vector2 origin = new Vector2(tex.Width, tex.Height); - - Vector2 PositionAdjust = new Vector2(-16, -40); - - spriteBatch.Draw(tex, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, origin, Size, SpriteEffects.None, 0); + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, origin, Size, SpriteEffects.None, 0); } } diff --git a/Particles/LemonNadeExplode.png b/Particles/LemonNadeExplode.png new file mode 100644 index 0000000000..85a849c338 Binary files /dev/null and b/Particles/LemonNadeExplode.png differ 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/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/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs index 5a2128f08a..ba8fadb9d6 100644 --- a/Prefixes/AccessoryPrefix.cs +++ b/Prefixes/AccessoryPrefix.cs @@ -61,4 +61,33 @@ namespace CalamityMod.Prefixes return 20; } } + + public class Friendly : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Accessory"; + public override PrefixCategory Category => PrefixCategory.Accessory; + + public override void ApplyAccessoryEffects(Player player) + { + // give Minion + player.Calamity().friendlyMinions++; + } + public override void ModifyValue(ref float valueMult) + { + valueMult = 2.5f; + } + public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally + public override bool CanRoll(Item item) + { + return true; + } + public LocalizedText FriendlyTooltip => CalamityUtils.GetText($"{LocalizationCategory}.FriendlyTooltip"); + public override IEnumerable GetTooltipLines(Item item) + { + yield return new TooltipLine(Mod, "CalamityMod:PrefixFriendly", FriendlyTooltip.Format(1)) + { + IsModifier = true + }; + } + } } diff --git a/Prefixes/HorribleWeaponPrefix.cs b/Prefixes/HorribleWeaponPrefix.cs new file mode 100644 index 0000000000..8484b58f4f --- /dev/null +++ b/Prefixes/HorribleWeaponPrefix.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using CalamityMod.Items; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Prefixes +{ + + public class Horrible : HorribleWeaponPrefix + { + public override float damageMult => 0.66f; + public override float sizeMult => 2f; + } + public abstract class HorribleWeaponPrefix : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Weapon"; + + // Stats + public virtual float damageMult => 1f; + public virtual float sizeMult => 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 + public override bool CanRoll(Item item) + { + return item.DamageType != null && item.DamageType != DamageClass.Default; + } + // Applying normal weapon stats + public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) + { + damageMult = this.damageMult; + scaleMult = this.sizeMult; + } + public override void ModifyValue(ref float valueMult) + { + valueMult = 2.5f; + } + } +} diff --git a/Prefixes/ReforgeChange.cs b/Prefixes/ReforgeChange.cs index 5a42927f66..4ac43c710e 100644 --- a/Prefixes/ReforgeChange.cs +++ b/Prefixes/ReforgeChange.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; @@ -29,6 +30,14 @@ namespace CalamityMod.Prefixes public override int ChoosePrefix(Item item, UnifiedRandom rand) { + // Voucher override + if (VoucherReforgeSystem.ForcedPrefix != -1) + { + int forced = VoucherReforgeSystem.ForcedPrefix; + VoucherReforgeSystem.ForcedPrefix = -1; + return forced; + } + if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) { // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla @@ -194,7 +203,7 @@ namespace CalamityMod.Prefixes // MELEE (includes tools and whips) // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal - if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary) && !(item.type == ItemType())) + if ((item.CountsAsClass() || item.CountsAsClass() || item.type == ItemType()) && !(item.CountsAsClass() && !supportsLegendary) && !(item.type == ItemType())) { // Terrarian (has its own special "Legendary" for marketing reasons) // Other items that want to use Legendary2 are also compatible diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index aea1ac75f1..caf3411e63 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void OnSpawn(IEntitySource source) { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; } #region Fields @@ -47,12 +47,20 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual Player Owner => Main.player[Projectile.owner]; /// - /// The amount of pixels out the center of the projectile's hitbox is. + /// The amount of extra size added to the projectile's scale. + /// + public virtual float AdditionalScale => 0; + /// + /// If the projectile should auto scale to it's Projectile.scale to 1 (or greater if it is a melee item) + /// + public virtual bool IgnoreAutoScale => false; + /// + /// The amount of pixels out the center of the projectile's hitbox is. Scales with Projectile.scale. /// public virtual float HitboxOutset => 30; /// - /// The projectile's hitbox size in pixels. + /// The projectile's hitbox size in pixels. Scales with Projectile.scale. /// public virtual Vector2 HitboxSize => new Vector2(30, 30); @@ -177,7 +185,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { WhenSpawned(); whenSpawned = false; - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; Projectile.netUpdate = true; } @@ -191,6 +199,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner.Calamity().mouseWorldListener = true; Owner.Calamity().rightClickListener = true; + float finalScale = (Owner.HeldItem.CountsAsClass() ? Owner.GetMeleeScale() : Owner.HeldItem.scale) + AdditionalScale; + if (!IgnoreAutoScale) + Projectile.scale = MathHelper.Lerp(Projectile.scale, finalScale, 0.3f / Projectile.MaxUpdates); + if (ItemAnimationActive || IgnoreActiveAnimation) { Animation++; @@ -235,7 +247,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (Owner.itemAnimation == Owner.itemAnimationMax - 1) { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; OnBeginUse(); } @@ -263,8 +275,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void ModifyDamageHitbox(ref Rectangle hitbox) { - Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset); - hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); + Vector2 hitboxScale = HitboxSize * Projectile.scale; + Vector2 cen = Projectile.Center + new Vector2(HitboxOutset * Projectile.scale, 0).RotatedBy(FinalRotation + HitboxRotationOffset); + hitbox = new Rectangle((int)cen.X - (int)(hitboxScale.X / 2), (int)cen.Y - (int)(hitboxScale.Y / 2), (int)hitboxScale.X, (int)hitboxScale.Y); // Turn this on to show the hitbox, useful for testing if it's working how you want /*Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); 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 8c9a1641a9..81a55e025a 100644 --- a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -73,7 +72,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles } } - [PierceResistException] //Doze 24apr2025 - Not a child of BaseCustomUseStyleProjectile because this doesn't use any of it's functionality. Comes from my melee rework mod. public abstract class BaseSwordHoldoutProjectile : ModProjectile { @@ -118,7 +116,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// Whether or not this should get melee speed bonuses /// Defaults to TRUE /// - public virtual bool useMeleeSpeed { get; set; } = true; + public virtual bool useAttackSpeed { get; set; } = true; /// /// Whether or not this should get melee size bonuses (Titan Glove) @@ -334,9 +332,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles StartupTime *= Projectile.MaxUpdates; CooldownTime *= Projectile.MaxUpdates; swingTime *= Projectile.MaxUpdates; - if (useMeleeSpeed) + if (useAttackSpeed) { - var speed = Main.player[Projectile.owner].GetAttackSpeed(); + var speed = Main.player[Projectile.owner].GetTotalAttackSpeed(Projectile.DamageType); if (speed > 3f) speed = 3f; @@ -353,8 +351,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles } if (useMeleeSize) { - if (player.meleeScaleGlove) Projectile.scale *= 1.1f; - Projectile.scale *= player.HeldItem.scale; + Projectile.scale *= player.GetMeleeScale(); } baseScale = Projectile.scale; ExistsTime = swingTime + StartupTime + CooldownTime; 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/BloodScythe.cs b/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs index 93eef1ad99..083822adac 100644 --- a/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs +++ b/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs @@ -91,12 +91,9 @@ public class BloodScythe : ModProjectile, ILocalizedModType public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.SetBlendState(BlendState.Additive); Texture2D tex = TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition; - Color drawColor = Color.Red; - if (!ChildSafety.Disabled) - drawColor = Main.DiscoColor; + Color drawColor = (ChildSafety.Disabled ? Color.Red : Main.DiscoColor) with { A = 0 }; for (int i = 0; i < (CalamityClientConfig.Instance.Afterimages ? Projectile.oldPos.Length : 1); ++i) { @@ -107,11 +104,9 @@ public class BloodScythe : ModProjectile, ILocalizedModType // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.spriteBatch.Draw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None, 0f); + Main.EntitySpriteDraw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None); } - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - return 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/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs deleted file mode 100644 index 07d6295347..0000000000 --- a/Projectiles/Boss/DarkOrb.cs +++ /dev/null @@ -1,564 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class DarkOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/LightningProj"; - - private bool start = true; - private Vector2 center = Vector2.Zero; - private Vector2 velocity = Vector2.Zero; - private double[] distances = new double[4]; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 3600; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - writer.Write(Projectile.localAI[1]); - writer.Write(start); - writer.WriteVector2(center); - writer.Write(distances[0]); - writer.Write(distances[1]); - writer.Write(distances[2]); - writer.Write(distances[3]); - writer.WriteVector2(velocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); - Projectile.localAI[1] = reader.ReadSingle(); - start = reader.ReadBoolean(); - center = reader.ReadVector2(); - distances[0] = reader.ReadDouble(); - distances[1] = reader.ReadDouble(); - distances[2] = reader.ReadDouble(); - distances[3] = reader.ReadDouble(); - velocity = reader.ReadVector2(); - } - - public override void AI() - { - if (Projectile.ai[0] != 8f) - { - // Pulse in and out - if (Projectile.localAI[1] == 0f) - { - Projectile.scale -= 0.012f; - if (Projectile.scale <= 0.8f) - { - Projectile.scale = 0.8f; - Projectile.localAI[1] = 1f; - } - } - else - { - Projectile.scale += 0.012f; - if (Projectile.scale >= 1.2f) - { - Projectile.scale = 1.2f; - Projectile.localAI[1] = 0f; - } - } - } - - switch ((int)Projectile.ai[0]) - { - // No AI - case -1: - break; - - // Rotate around a point, spread outward and move - case 0: - case 1: - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * 2f; - start = false; - } - - center += velocity; - - double rad = MathHelper.ToRadians(Projectile.ai[1]); - - float amount = 1f - Projectile.localAI[0] / 360f; - if (amount < 0f) - amount = 0f; - - distances[0] += MathHelper.Lerp(1f, 6f, amount); - - if (Projectile.ai[0] == 0f) - { - Projectile.position.X = center.X - (int)(Math.Sin(rad) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distances[0]) - Projectile.height / 2; - } - else - { - Projectile.position.X = center.X - (int)(Math.Cos(rad) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distances[0]) - Projectile.height / 2; - } - - Projectile.ai[1] += 0.25f + amount; - Projectile.localAI[0] += 1f; - - break; - - // Lurch forward - case 2: - - LurchForward(0.05f, 0.95f, 1.05f); - - break; - - // Wavy motion - case 3: - case 4: - - bool useSin = Projectile.ai[0] == 3f; - - WavyMotion(0.1f, 0f, useSin, false); - - break; - - // Speed up then slow down on a timer - case 5: - case 16: - - float fastGateValue = Projectile.ai[0] == 5f ? 30f : 60f; - float maxVelocity = Projectile.ai[0] == 5f ? 12f : 6f; - - LurchForwardOnTimer(90f, fastGateValue, 3f, maxVelocity, 0.95f, 1.2f); - - break; - - // Split into 4 projectiles that can use any of the first 6 AIs - case 6: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 90f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); - } - } - - Projectile.Kill(); - } - - break; - - // Split into 8 projectiles that can use either of the first 2 AIs - case 7: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 120f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 8; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); - } - } - - Projectile.Kill(); - } - - break; - - // Split into 3 wavy projectiles multiple times - case 8: - - bool splitOnce = Projectile.timeLeft < 1800; - bool splitTwice = Projectile.timeLeft < 900; - bool splitThrice = Projectile.timeLeft < 450; - - if (splitOnce) - WavyMotion(0.05f, 2f, true, true); - - Projectile.localAI[0] += 1f; - - if (Projectile.localAI[0] >= 180f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 3; - float radians = MathHelper.TwoPi / totalProjectiles; - int spread = 8; - - if (splitOnce) - { - spread *= (splitTwice ? 3 : 0) + - (splitThrice ? 3 : 0); - } - - Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center; - vector.Normalize(); - vector *= 3f; - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = splitOnce ? Projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); - - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector + vector2, Projectile.type, Projectile.damage, 0f, Main.myPlayer, 8f, 0f); - - Main.projectile[proj].timeLeft = Projectile.timeLeft / 2; - if (Main.projectile[proj].timeLeft < 150) - Main.projectile[proj].timeLeft = 150; - - Main.projectile[proj].scale = Projectile.scale * 0.6f; - } - } - - Projectile.Kill(); - } - - break; - - // idk yet - case 9: - case 10: - - bool useSin2 = Projectile.ai[0] == 9f; - - OscillationMotion(0.05f, useSin2); - - break; - - // Homing - case 11: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 180f) - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] < 180f) - { - Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].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; - } - else if (Projectile.velocity.Length() < 18f) - Projectile.velocity *= 1.01f; - } - - break; - - // Rotate around a moving point and spread outward then inward in an oval pattern - case 12: - case 13: - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center); - start = false; - } - - center += velocity; - - float velocityGateValue3 = 240f; - float amount2 = 1f; - - bool flyOutward = Projectile.localAI[0] < velocityGateValue3; - - if (flyOutward) - amount2 -= Projectile.localAI[0] / velocityGateValue3; - else - amount2 = (Projectile.localAI[0] - velocityGateValue3) / velocityGateValue3; - - amount2 = MathHelper.Clamp(0f, 1f, amount2); - - double distanceVariable = MathHelper.Lerp(0f, 6f, amount2); - - distances[0] += flyOutward ? distanceVariable : -distanceVariable; - - double rad2 = MathHelper.ToRadians(Projectile.ai[1]); - - if (Projectile.ai[0] == 12f) - { - Projectile.position.X = center.X - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distances[0]) - Projectile.height / 2; - } - else - { - Projectile.position.X = center.X - (int)(Math.Cos(rad2) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.height / 2; - } - - Projectile.ai[1] += 0.25f + amount2; - Projectile.localAI[0] += 1f; - - break; - - // Spread out then drift inward after some time and then drift outward - case 14: - case 15: - - float velocityMult = 12f; - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * velocityMult; - start = false; - } - - center += velocity; - - float flyInwardGateValue = 240f; - - float amount3 = 1f - Projectile.localAI[0] / flyInwardGateValue; - if (amount3 < 0f) - amount3 = 0f; - - bool changeXPos = Projectile.ai[0] == 14f; - - float units = 6f; - - distances[0] += MathHelper.Lerp(1f, units, amount3); - - if (Projectile.localAI[0] > flyInwardGateValue) - { - distances[2] = changeXPos ? Math.Abs(center.X - Projectile.Center.X) : Math.Abs(center.Y - Projectile.Center.Y); - - if (distances[3] == 0D) - distances[3] = distances[2] - units * 10f; - - distances[3] += changeXPos ? velocity.X : velocity.Y; - - distances[1] -= distances[2] < (units * 10f) ? distances[2] * 0.1f : MathHelper.Lerp(units, units + 2f, (float)(distances[2] / distances[3])); - } - else - { - float slowDownGateValue = 30f; - - if (Projectile.localAI[0] > flyInwardGateValue - slowDownGateValue) - velocity *= 1f - velocityMult / slowDownGateValue; - - distances[1] = distances[0]; - } - - double distanceX = changeXPos ? distances[1] : distances[0]; - double distanceY = changeXPos ? distances[0] : distances[1]; - - double rad3 = MathHelper.ToRadians(Projectile.ai[1]); - - Projectile.position.X = center.X - (int)(Math.Sin(rad3) * distanceX) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad3) * distanceY) - Projectile.height / 2; - - Projectile.localAI[0] += 1f; - - if (Projectile.localAI[0] > 600f) - Projectile.Kill(); - - break; - } - } - - private void WavyMotion(float frequency, float amplitude, bool useSin, bool waveWithVelocity) - { - if (start) - { - velocity = Projectile.velocity; - start = false; - } - - Projectile.ai[1] += frequency; - - if (amplitude == 0f) - amplitude = velocity.Length(); - - float wavyVelocity = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); - - if (waveWithVelocity) - Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; - else - Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; - } - - private void LurchForward(float frequncy, float deceleration, float acceleration) - { - Projectile.ai[1] += frequncy; - - Projectile.velocity *= MathHelper.Lerp(deceleration, acceleration, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); - } - - private void LurchForwardOnTimer(float slowGateValue, float fastGateValue, float minVelocity, float maxVelocity, float deceleration, float acceleration) - { - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] <= slowGateValue) - { - if (Projectile.velocity.Length() > minVelocity) - Projectile.velocity *= deceleration; - } - else if (Projectile.ai[1] < slowGateValue + fastGateValue) - { - if (Projectile.velocity.Length() < maxVelocity) - Projectile.velocity *= acceleration; - } - else - Projectile.ai[1] = 0f; - } - - private void OscillationMotion(float frequncy, bool useSin) - { - Projectile.ai[1] += frequncy; - - float oscillation = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); - - if (start) - { - velocity = Projectile.velocity; - start = false; - } - else if (oscillation == 0f) - { - Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; - Vector2 vector = target.Center + target.velocity * 20f - Projectile.Center; - vector.Normalize(); - vector *= velocity.Length(); - Projectile.velocity = vector; - } - else - { - float amplitude = velocity.Length(); - - Projectile.velocity.Normalize(); - Projectile.velocity *= amplitude * oscillation; - } - } - - public override Color? GetAlpha(Color lightColor) - { - switch ((int)Projectile.ai[0]) - { - // No AI - case -1: - - return new Color(0, 100, 255, Projectile.alpha); - - // Rotate around a point, spread outward and move - case 0: - case 1: - - return new Color(0, 100, 255, Projectile.alpha); - - // Lurch forward - case 2: - - return new Color(255, 200, 0, Projectile.alpha); - - // Wavy motion - case 3: - case 4: - - return new Color(0, 255, 200, Projectile.alpha); - - // Speed up then slow down on a timer - case 5: - case 16: - - return new Color(0, 255, 100, Projectile.alpha); - - // Split into 4 projectiles that can use any of the first 6 AIs - case 6: - - return new Color(200, 0, 255, Projectile.alpha); - - // Split into 8 projectiles that can use either of the first 2 AIs - case 7: - - return new Color(255, 0, 150, Projectile.alpha); - - // Split into 3 wavy projectiles multiple times - case 8: - - return new Color(200, 0, 0, Projectile.alpha); - - // idk yet - case 9: - case 10: - - return new Color(255, 255, 0, Projectile.alpha); - - // Homing - case 11: - - return new Color(150, 0, 200, Projectile.alpha); - - // Rotate around a moving point and spread outward then inward in an oval pattern - case 12: - case 13: - - return new Color(0, 100, 255, Projectile.alpha); - - // Spread out then drift inward after some time and then drift outward - case 14: - case 15: - - return new Color(0, 100, 255, Projectile.alpha); - } - - return null; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 200); - //target.AddBuff(ModContent.BuffType(), 300, true); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs deleted file mode 100644 index 685c26d719..0000000000 --- a/Projectiles/Boss/DoGDeath.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGDeath : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - public float TelegraphDelay - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - public Vector2 OldVelocity; - public const float TelegraphTotalTime = 35f; - public const float TelegraphFadeTime = 5f; - public const float TelegraphWidth = 2400f; - public const float FadeTime = 20f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - } - - public override void SetDefaults() - { - Projectile.Calamity().DealsDefenseDamage = true; - Projectile.width = 10; - Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.Opacity = 0f; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(OldVelocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - OldVelocity = reader.ReadVector2(); - } - - public override void AI() - { - // Determine the relative opacities for each player based on their distance. - // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - Projectile.netUpdate = true; - } - - // Fade in after telegraphs have faded. - if (TelegraphDelay > TelegraphTotalTime) - { - if (Projectile.timeLeft < FadeTime) - { - Projectile.Opacity = Projectile.timeLeft / FadeTime; - } - else - { - if (Projectile.Opacity < 1f) - Projectile.Opacity += 0.05f; - if (Projectile.Opacity > 1f) - Projectile.Opacity = 1f; - } - - // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> - if (OldVelocity != Vector2.Zero) - { - Projectile.velocity = OldVelocity; - OldVelocity = Vector2.Zero; - Projectile.netUpdate = true; - } - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - - // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. - else if (OldVelocity == Vector2.Zero) - { - OldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Zero; - Projectile.netUpdate = true; - Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; - } - - TelegraphDelay++; - } - - public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f; - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - if (TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f) - target.AddBuff(ModContent.BuffType(), 120); - } - - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0) * Projectile.Opacity; - - public override bool PreDraw(ref Color lightColor) - { - if (TelegraphDelay >= TelegraphTotalTime) - return true; - - // for old times sake - if (Main.zenithWorld) - return false; - - Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam").Value; - - float yScale = 2f; - if (TelegraphDelay < TelegraphFadeTime) - yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / TelegraphFadeTime); - if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) - yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / TelegraphFadeTime); - - Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); - Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); - Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f); - - Color colorOuter = Color.Lerp(Color.Cyan, Color.Purple, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through purple and cyan once and then flash. - Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); - - colorOuter *= 0.7f; - colorInner *= 0.7f; - - Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0); - Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Boss/DoGDeath.png b/Projectiles/Boss/DoGDeath.png deleted file mode 100644 index c1e09b93b3..0000000000 Binary files a/Projectiles/Boss/DoGDeath.png and /dev/null differ diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index c3f0496bcf..1b9965b71d 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -88,6 +88,11 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 360); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs deleted file mode 100644 index 90435e7abf..0000000000 --- a/Projectiles/Boss/DyingSun.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DyingSun : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public ref float Time => ref Projectile.ai[0]; - public ref float Radius => ref Projectile.ai[1]; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - } - - public override void SetDefaults() - { - Projectile.width = 164; - Projectile.height = 164; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 100; - Projectile.MaxUpdates = 2; - Projectile.scale = 1f; - } - - public override void AI() - { - Projectile.scale += 0.08f; - Radius = Projectile.scale * 42f; - Projectile.Opacity = Utils.GetLerpValue(8f, 42f, Projectile.timeLeft, true); - - Time++; - } - - public float SunWidthFunction(float completionRatio, Vector2 vertexPos) => Radius * Projectile.scale * (float)Math.Sin(MathHelper.Pi * completionRatio); - - public Color SunColorFunction(float completionRatio, Vector2 vertexPos) - { - Color sunColor = Main.zenithWorld ? (new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.8f) : (Main.IsItDay() ? Color.Yellow : Color.Cyan); - return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * Projectile.Opacity; - } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.45f); - GameShaders.Misc["CalamityMod:Flame"].UseImage1("Images/Misc/Perlin"); - - List rotationPoints = new List(); - List drawPoints = new List(); - - for (float offsetAngle = -MathHelper.PiOver2; offsetAngle <= MathHelper.PiOver2; offsetAngle += MathHelper.Pi / 80f) - { - rotationPoints.Clear(); - drawPoints.Clear(); - - float adjustedAngle = offsetAngle + MathHelper.Pi * -0.2f; - Vector2 offsetDirection = adjustedAngle.ToRotationVector2(); - for (int i = 0; i < 16; i++) - { - rotationPoints.Add(adjustedAngle); - drawPoints.Add(Vector2.Lerp(Projectile.Center - offsetDirection * Radius / 2f, Projectile.Center + offsetDirection * Radius / 2f, i / 16f)); - } - PrimitiveRenderer.RenderTrail(drawPoints, new(SunWidthFunction, SunColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 24); - } - return false; - } - } -} 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 e1190825cb..3abbfc578f 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = TimeLeft; CooldownSlot = ImmunityCooldownID.Bosses; + Projectile.scale = 0; } public override void OnSpawn(IEntitySource source) @@ -66,6 +67,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (Projectile.scale < 1) + Projectile.scale += 0.05f; ProvUtils.ApplyGFBDamage(Projectile, 180, 20); Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); @@ -162,7 +165,7 @@ namespace CalamityMod.Projectiles.Boss totalProjectiles *= 2; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); float velocity = 5f; Vector2 spinningPoint = new Vector2(0f, -velocity); Vector2 additionalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f; diff --git a/Projectiles/Boss/HolyBlastFrags.cs b/Projectiles/Boss/HolyBlastFrags.cs new file mode 100644 index 0000000000..16c01fc3a1 --- /dev/null +++ b/Projectiles/Boss/HolyBlastFrags.cs @@ -0,0 +1,187 @@ +using System; +using System.Linq; +using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs.Providence; +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 Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyBlastFrags : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2"; + + public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 26; + Projectile.height = 26; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void AI() + { + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); + + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + float maxVelocity = Projectile.ai[0] == 0f ? 7f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; + if (Math.Abs(Projectile.velocity.X) < maxVelocity) + Projectile.velocity.X *= 1.05f; + + int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); + + Projectile.ai[1] += 1f; + if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f) + { + float projVelocityMult = Projectile.velocity.Length(); + Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; + playerDirection.Normalize(); + playerDirection *= projVelocityMult; + float inertia = !ProvUtils.StandardAI() ? 20f : 25f; + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; + Projectile.velocity.Normalize(); + Projectile.velocity *= projVelocityMult; + } + + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + if (Projectile.timeLeft % 3 == 0) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + + Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f)); + } + + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); + + public override bool PreDraw(ref Color lightColor) + { + + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(12).ToList(); + + list.Insert(0, Projectile.position + (Projectile.rotation+MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + int framing = texture.Height / Main.projFrames[Type]; + int y6 = framing * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + return false; + } + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 38f * 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); + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.position.X = Projectile.position.X + (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); + Projectile.width = 40; + Projectile.height = 40; + Projectile.position.X = Projectile.position.X - (Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + int dustType = ProvUtils.GetDustID(); + for (int i = 0; i < 5; i++) + { + int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 10; j++) + { + int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + // If the player is dodging, don't apply debuffs + if (info.Damage <= 0 || target.creativeGodMode) + return; + + ProvUtils.ApplyDebuffs(target, 120); + } + } +} diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 33bbb2ddf3..8222ad36d4 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; CooldownSlot = ImmunityCooldownID.Bosses; + Projectile.scale = 0; } public override void OnSpawn(IEntitySource source) @@ -46,6 +47,8 @@ namespace CalamityMod.Projectiles.Boss } public override void AI() { + if (Projectile.scale < 1) + Projectile.scale += 0.1f; ProvUtils.ApplyGFBDamage(Projectile, 120, 20); Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index cddfda4371..36404593ba 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,11 +1,18 @@ using System; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.Providence; using CalamityMod.Particles; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Newtonsoft.Json.Serialization; using Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +24,11 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { Projectile.localAI[1] = Main.rand.NextFloat(30f); @@ -24,11 +36,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; CooldownSlot = ImmunityCooldownID.Bosses; Projectile.penetrate = 1; Projectile.timeLeft = 200; Projectile.Calamity().DealsDefenseDamage = true; + Projectile.MaxUpdates = 4; } public override void AI() @@ -44,74 +56,90 @@ namespace CalamityMod.Projectiles.Boss started = true; } - if (Projectile.ai[0] < 240f) + if (Projectile.FinalExtraUpdate()) { - Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 240f) + { + Projectile.ai[0] += 1f; - if (Projectile.timeLeft < 160) - Projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; + } + + if (Main.getGoodWorld) + { + if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f) + { + Projectile.velocity *= 1.02f; + } + else + { + Projectile.ai[1] += 0.05f; + Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); + } + } + else if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; + + Projectile.localAI[1] += (Projectile.velocity.Length() / 20); } - if (Main.getGoodWorld) - { - if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f) - { - Projectile.velocity *= 1.02f; - } - else - { - Projectile.ai[1] += 0.05f; - Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); - } - } - else if (Projectile.velocity.Length() < 16f) - Projectile.velocity *= 1.01f; - - Projectile.localAI[1] += (Projectile.velocity.Length() / 20); - - Color col = ProvUtils.GetProjectileColor(255); - float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); - GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col); - GeneralParticleHandler.SpawnParticle(p); - //Trail for visibilty - GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center + Projectile.velocity, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(3f, 2f), Vector2.Zero.AngleFrom(Projectile.velocity), 1f, 0f, 3)); + Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1); } public override bool PreDraw(ref Color lightColor) { - float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[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); - + //drawn by the HolyBurnOrbDrawer system return false; } + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 32f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 pos) + { + Color mainColor = ProvUtils.GetProjectileColor(255) * 1.3f; + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public float FireCoreWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = Projectile.scale * 24; + float curveRatio = 0.25f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 pos) + { + Color mainColor = ProvUtils.GetProjectileColor(255); + Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); + return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; + } public override void OnKill(int timeLeft) { @@ -146,4 +174,190 @@ namespace CalamityMod.Projectiles.Boss ProvUtils.ApplyDebuffs(target, 120); } } + + + public class HolyBurnOrbDrawer : ModSystem + { + public override void Load() + { + On_Main.DrawProjectiles += DrawAll; + } + + private void DrawAll(On_Main.orig_DrawProjectiles orig, Main self) + { + orig(self); + + var device = Main.instance.GraphicsDevice; + + List burnToDraw = []; + List healToDraw = []; + + + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType()) + burnToDraw.Add(item); + + if (item.type == ModContent.ProjectileType()) + healToDraw.Add(item); + } + + if ((healToDraw.Count() + burnToDraw.Count()) < 1) + return; + + using (Main.spriteBatch.Scope()) + { + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + //Burn trails + using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) + { + foreach (var item in burnToDraw) + DrawBurnOrbTrail(item); + + } + Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + //Heal trail + using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) + { + foreach (var item in healToDraw) + DrawHealOrbTrail(item); + + } + Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + //Main orb + foreach (var item in burnToDraw) + DrawBurnOrb(item); + foreach (var item in healToDraw) + DrawHealOrb(item); + + //Additive orb + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + foreach (var item in burnToDraw) + DrawBurnOrbAdditive(item); + foreach (var item in healToDraw) + DrawHealOrbAdditive(item); + Main.spriteBatch.End(); + } + } + + void DrawBurnOrbTrail(Projectile Projectile) + { + if (Projectile.ModProjectile is HolyBurnOrb M) + { + var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); + var len = Math.Min(Projectile.oldPos.Length, 32); + for (var i = 0; i < len; i++) + { + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color = M.FireColorFunction(i / (float)len, Projectile.oldPos[i]); + var color2 = ProvUtils.GetProjectileColor(255, true); + float width = M.FireWidthFunction(i / (float)len, Projectile.oldPos[i]); + Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f); + } + } + } + void DrawBurnOrb(Projectile Projectile) + { + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; + Color baseColor2 = ProvUtils.GetProjectileColor(255); + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); + + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + } + + void DrawBurnOrbAdditive(Projectile Projectile) + { + var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, ProvUtils.GetProjectileColor(255), 0, texture.Size() * 0.5f, 1f, 0, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); + } + void DrawHealOrbTrail(Projectile Projectile) + { + if (Projectile.ModProjectile is HolyLight M) + { + var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); + var len = Math.Min(Projectile.oldPos.Length, 32); + for (var i = 0; i < len; i++) + { + Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color = M.FireCoreColorFunction(i / (float)len, Projectile.oldPos[i]); + var color2 = new Color(0, 25, 0); + float width = M.FireWidthFunction(i / (float)len, Projectile.oldPos[i]); + Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f); + } + } + } + void DrawHealOrb(Projectile Projectile) + { + float vel = Projectile.velocity.Length() / 8; + Projectile.localAI[1] += vel; + + 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, 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); + } + + void DrawHealOrbAdditive(Projectile Projectile) + { + var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, new Color(54, 209, 54), 0, texture.Size() * 0.5f, 1f, 0, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); + } + } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 8cfcd2206d..ca2de7a011 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,11 +1,16 @@ using System; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.Providence; 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 Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -30,10 +35,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.timeLeft = 600; CooldownSlot = ImmunityCooldownID.Bosses; + + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void AI() { + + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); @@ -68,7 +79,8 @@ namespace CalamityMod.Projectiles.Boss float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + if (Projectile.timeLeft % 3 == 0) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); if (Main.rand.NextBool()) GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); @@ -80,6 +92,30 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(8).ToList(); + + list.Insert(0, Projectile.position + (Projectile.rotation + MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; @@ -87,6 +123,31 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 16f * 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); + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index d59abcff35..71fcbfaa70 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,7 +1,11 @@ using System; +using System.Linq; using CalamityMod.Dusts; using CalamityMod.Enums; +using CalamityMod.NPCs.Providence; using CalamityMod.Particles; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,7 +20,11 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; - + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { Projectile.localAI[1] = Main.rand.NextFloat(30f); @@ -25,9 +33,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 200; + Projectile.MaxUpdates = 4; } public override void OnSpawn(IEntitySource source) @@ -46,17 +54,21 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); - - if (Projectile.ai[0] < 240f) + if (Projectile.FinalExtraUpdate()) { - Projectile.ai[0] += 1f; + if (Projectile.ai[0] < 240f) + { + Projectile.ai[0] += 1f; - if (Projectile.timeLeft < 160) - Projectile.timeLeft = 160; + if (Projectile.timeLeft < 160) + Projectile.timeLeft = 160; + } + + if (Projectile.velocity.Length() < 16f) + Projectile.velocity *= 1.01f; } - if (Projectile.velocity.Length() < 16f) - Projectile.velocity *= 1.01f; + Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1); int index = Player.FindClosest(Projectile.position, Projectile.width, Projectile.height); Player player = Main.player[index]; @@ -71,54 +83,68 @@ namespace CalamityMod.Projectiles.Boss NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); Projectile.Kill(); } - - Color col = new Color(54, 209, 54); - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f, col * 0.85f, new Vector2(1, 0.3f), true, false, 1.5f); - GeneralParticleHandler.SpawnParticle(spark); } public override bool PreDraw(ref Color lightColor) { - 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); - + //drawn by the HolyBurnOrbDrawer system return false; } + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 32f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 pos) + { + Color mainColor = new Color(54, 209, 54) * 1.3f; + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity; + } + + public float FireCoreWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = Projectile.scale * 24; + float curveRatio = 0.25f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 pos) + { + Color mainColor = new Color(54, 209, 54); + Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion); + return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; + } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center); SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center); - Color particleColor = new Color(54, 209, 54); + Color particleColor = new Color(54, 209, 54); Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f); Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18); GeneralParticleHandler.SpawnParticle(pulse); diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 3ba0c09874..c5a137939a 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -161,10 +161,11 @@ namespace CalamityMod.Projectiles.Boss int blobAmt = !ProvUtils.StandardAI() ? 9 : 6; if (Projectile.owner == Main.myPlayer) { - Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y); + Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); for (int b = 0; b < blobAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; + velocity.Y = -Math.Abs(velocity.Y); if (Main.getGoodWorld) velocity *= 2f; diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index e74a89430b..8a3f8a176c 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 12; Projectile.hostile = true; Projectile.penetrate = -1; - Projectile.timeLeft = 900; + Projectile.timeLeft = 120; Projectile.scale = 1.5f; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -65,9 +65,6 @@ namespace CalamityMod.Projectiles.Boss { if (!inLava) { - if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y = 0f; - Projectile.velocity.Y += 0.15f; } } 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/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs deleted file mode 100644 index 7e8efe47f6..0000000000 --- a/Projectiles/Boss/SkyFlare.cs +++ /dev/null @@ -1,126 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class SkyFlare : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public int blowTimer = 0; - - public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.hostile = true; - Projectile.penetrate = 1; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void AI() - { - Projectile.velocity *= 0.9995f; - int addStuff = Main.rand.Next(5); - blowTimer += addStuff; - if (blowTimer >= 900) - { - Projectile.Kill(); - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 5) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 4) - { - Projectile.frame = 0; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, Projectile.alpha); - } - - 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.spriteBatch.Draw(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 void OnKill(int timeLeft) - { - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(FlareSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) - { - Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 dustDirection = dustRotate - Projectile.Center; - int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.CopperCoin, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[flareDust].noGravity = true; - Main.dust[flareDust].noLight = true; - Main.dust[flareDust].velocity = dustDirection; - } - if (Projectile.owner == Main.myPlayer) - { - int projTileX = (int)(Projectile.Center.Y / 16f); - int projTileY = (int)(Projectile.Center.X / 16f); - if (projTileY < 10) - { - projTileY = 10; - } - if (projTileY > Main.maxTilesX - 10) - { - projTileY = Main.maxTilesX - 10; - } - if (projTileX < 10) - { - projTileX = 10; - } - if (projTileX > Main.maxTilesY - 110) - { - projTileX = Main.maxTilesY - 110; - } - for (int j = projTileX; j < projTileX + 100; j++) - { - Tile tile = Main.tile[projTileY, j]; - if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) - { - projTileX = j; - break; - } - } - int tornadoType = Main.rand.Next(6); - if (tornadoType < 5) - { - int nadoDamage = Main.expertMode ? 180 : 300; //720 - int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); - Main.projectile[nadoSpawn].netUpdate = true; - } - else - { - int nadoDamage = Main.expertMode ? 230 : 400; //920 - int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); - Main.projectile[nadoSpawn].netUpdate = true; - } - } - } - } -} diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 0856f46a52..6263e74b06 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class SkyFlareRevenge : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Boss/SkyFlare"; public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); diff --git a/Projectiles/Boss/SkyFlare.png b/Projectiles/Boss/SkyFlareRevenge.png similarity index 100% rename from Projectiles/Boss/SkyFlare.png rename to Projectiles/Boss/SkyFlareRevenge.png diff --git a/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs b/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs index 8682e81876..a9af58188f 100644 --- a/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs +++ b/Projectiles/Boss/StormWeaverFrostWaveTelegraph.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.tileCollide = false; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 3; Projectile.Opacity = 1f; } 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 5aea36abe3..e5e566d25d 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; @@ -16,6 +17,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; @@ -34,6 +36,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; using CalamityMod.Tiles.Abyss; @@ -58,6 +61,7 @@ using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; + namespace CalamityMod.Projectiles { public partial class CalamityGlobalProjectile : GlobalProjectile @@ -89,6 +93,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; @@ -146,6 +151,11 @@ namespace CalamityMod.Projectiles ///
public bool fireBullet = false; /// + /// If true, allows projectiles to track damage scaling.
+ /// Used by Megalodon and Voidragon. + ///
+ public bool sharkBullets = false; + /// /// If true, adds an ice trail to the projectile, and makes it inflict Frostbite.
/// Used by Thermocline Blaster. ///
@@ -201,12 +211,27 @@ namespace CalamityMod.Projectiles ///
public bool grapeBeer = false; + /// + /// How strong grape beer homing is on this. It speeds up the longer the target is targeted. + /// + public float grapeBeerHomingPower = 0.01f; + /// + /// ID of last target from grapebeer + /// + public int grapeBeerHomingTarget = -1; + /// /// Variable used for storing the actual amount of extra updates a projectile has.
/// This is NOT set automatically, and must be set whenever it is needed. ///
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. @@ -251,6 +276,10 @@ namespace CalamityMod.Projectiles /// If true, this projectile is from a rogue stealth strike. The primary variable responsible for triggering stealth strike effects. public bool stealthStrike = false; /// + /// If true, this projectile is spawned from a stealth strike, but is not a primary projectile. Used to avoid proccing things like Raiders Talisman. + /// + public bool stealthStrikeSubProjectile = false; + /// /// Number of times this stealth strike projectile has pierced an enemy.
/// Used to limit the number of times a projectile can proc certain effects from rogue accessories. ///
@@ -292,7 +321,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; @@ -300,6 +329,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. /// @@ -319,15 +350,13 @@ 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; - } void ApplyGrapeBeer() { grapeBeer = true; - conditionalHomingRange = 600; + var ivDripPlayer = Main.player[projectile.owner].GetModPlayer(); + conditionalHomingRange = ivDripPlayer.HasAlcohol(AlcoholType.GrapeBeer) ? 800 : 300; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; //Calamity adds a hybrid iframe system when both local and static are set to true, so this works fine for both global and static projectiles. @@ -367,6 +396,9 @@ namespace CalamityMod.Projectiles grapeBeer = true; } + // Apply some parent information to children + if (parent.Calamity().ParentNPCIndex != -1) + ParentNPCIndex = parent.Calamity().ParentNPCIndex; if (parent.Calamity().IgnoreBoCIllusions) IgnoreBoCIllusions = true; @@ -398,9 +430,24 @@ namespace CalamityMod.Projectiles if (e.Context == "SetBonus_GhostHurt") projectile.damage /= 2; } + + if (source is EntitySource_Parent { Entity: Projectile proj }) + { + if (proj.Calamity().stealthStrike || proj.Calamity().stealthStrikeSubProjectile) + stealthStrikeSubProjectile = true; + } + + } + 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(); } - public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) => binaryWriter.Write(ParentNPCIndex); - public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) => ParentNPCIndex = binaryReader.ReadInt32(); #endregion On Spawn #region Set Defaults @@ -420,6 +467,10 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.ZapinatorLaser) projectile.originalDamage = projectile.damage; + // Make Piranha Gun have dynamic stat tweaking + if (projectile.type == ProjectileID.MechanicalPiranha) + projectile.ContinuouslyUpdateDamageStats = true; + // Apply Calamity Global Projectile Tweaks. SetDefaults_ApplyTweaks(projectile); } @@ -433,17 +484,19 @@ 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 - // - // MINION AI CHANGES: - // + // + // MINION AI CHANGES: + // - // Hornet Staff's minion changes. + // Hornet Staff's minion changes. if (projectile.type == ProjectileID.Hornet) return HornetMinionAI.DoHornetMinionAI(projectile); @@ -471,37 +524,16 @@ namespace CalamityMod.Projectiles if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == ProjAIStyleID.Yoyo) { // Store damage on first frame - if (projectile.ai[2] == 0f) - projectile.ai[2] = projectile.damage; + if (storedYoyoDamage == 0f) + storedYoyoDamage = projectile.damage; - // Find the first yoyo projectile owned by the corresponding player - // Limited lifespan yoyos are horrendous so it had to be this way - // EDIT: ownedProjectileCounts does not work what the fuck - int MainYoyo = -1; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.type == projectile.type && proj.owner == projectile.owner) - { - MainYoyo = x; - break; - } - } + 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.ai[2] * 0.5f); + projectile.damage = (int)(storedYoyoDamage * 0.5f); else - projectile.damage = (int)projectile.ai[2]; - } - - // This code fixes the wacky close-up burst damage bug which occurs with double yoyos and local iframes. - // Oh my good friends, do not ask me how or why this works, for I do not know! - // That being said, PLEASE DON'T REMOVE THIS, unless you think The Microwave killing Provi in 2 seconds with no effort is okay. - if (projectile.aiStyle == ProjAIStyleID.Yoyo) - { - if (projectile.ai[0] == -1) - projectile.Kill(); + projectile.damage = storedYoyoDamage; } if (projectile.minion && ExplosiveEnchantCountdown > 0) @@ -776,6 +808,12 @@ namespace CalamityMod.Projectiles return false; } + // This has extra updates but increments lifespan through AI slots, so we need to offset that + else if (projectile.type == ProjectileID.WeatherPainShot) + { + if (!projectile.FinalExtraUpdate()) + projectile.ai[1]--; + } else if (projectile.type == ProjectileID.BloodShot) { @@ -2551,7 +2589,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= scaleFactor2; projectile.velocity *= 0.99f; - + if (projectile.ai[0] % (death ? 20f : 30f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); @@ -2919,17 +2957,15 @@ namespace CalamityMod.Projectiles public float PersistentFishingData = -1; /// public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) { var owner = Main.player[projectile.owner]; var cplayer = owner.Calamity(); + owner.Fishing_GetBait(out Item baitItem); + 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) { @@ -3052,9 +3088,10 @@ namespace CalamityMod.Projectiles //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. + switch (owner.Calamity().SelectedFishingMinigame) { - case CalamityPlayer.FishingMinigames.ScrapBobber: + case CalamityPlayer.FishingMinigames.WulfrumBobber: { if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) { @@ -3174,7 +3211,7 @@ namespace CalamityMod.Projectiles } - case CalamityPlayer.FishingMinigames.ScoriaBobber: + case CalamityPlayer.FishingMinigames.VolcanicSinker: { if (PersistentFishingData == -1) { @@ -3273,7 +3310,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)); } @@ -3299,7 +3336,7 @@ namespace CalamityMod.Projectiles } - case CalamityPlayer.FishingMinigames.PerennialBobber: + case CalamityPlayer.FishingMinigames.FeralBobber: if (projectile.ai[0] == 0) { if (projectile.wet) //Fishing in water @@ -3327,7 +3364,6 @@ namespace CalamityMod.Projectiles if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) { owner.lifeRegenCount -= 600; // -5 health per 10 ticks - owner.Fishing_GetBait(out Item baitItem); // Diminishing returns on bait power beyond 75 int baitPower = baitItem?.bait ?? 0; @@ -3388,7 +3424,7 @@ namespace CalamityMod.Projectiles break; - case CalamityPlayer.FishingMinigames.NavystoneBobber: + case CalamityPlayer.FishingMinigames.SunkenSinker: { if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) { @@ -3529,7 +3565,7 @@ namespace CalamityMod.Projectiles if (owner.HasBuff(BuffID.WellFed2)) { var bIndex = owner.FindBuffIndex(BuffID.WellFed2); - if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) { owner.buffTime[bIndex] += 300; } @@ -3558,7 +3594,7 @@ namespace CalamityMod.Projectiles return false; - case CalamityPlayer.FishingMinigames.SkylineBobber: + case CalamityPlayer.FishingMinigames.AcrobaticBobber: { if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) { @@ -3668,7 +3704,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)); } @@ -3698,6 +3734,61 @@ namespace CalamityMod.Projectiles } } + + bool alreadyJunk = projectile.ai[1] == ItemID.OldShoe || projectile.ai[1] == ItemID.FishingSeaweed || projectile.ai[1] == ItemID.TinCan; + // When using rage bait, gives a chance that your items turn to junk + if (baitItem?.type == ModContent.ItemType() && reelingIn && !alreadyJunk && Main.rand.NextBool(RageBait.junkChance.Item1, RageBait.junkChance.Item2) && projectile.localAI[1] != 0) + { + var junk = Main.rand.Next(3) switch + { + 0 => ItemID.OldShoe, + 1 => ItemID.FishingSeaweed, + _ => ItemID.TinCan, + }; + + SoundStyle epicFail = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(epicFail with { Volume = 0.9f, Pitch = 0.3f }, projectile.Center); + if (CalamityWorld.revenge) + owner.Calamity().rage += 25; + + for (int i = 0; i < 12; i++) + { + Particle spray = new CustomSpark(projectile.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10), -Vector2.UnitY * Main.rand.NextFloat(3, 8), "CalamityMod/Particles/BloomCircle", true, Main.rand.Next(18, 24) * 5, Main.rand.NextFloat(0.3f, 0.5f), Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0, 0.7f)) * 0.3f, new Vector2(0.8f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spray); + + if (i % 2 == 0) + { + Particle rage = new CustomSpark(owner.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) + -Vector2.UnitY * 7.5f, -Vector2.UnitY * Main.rand.NextFloat(0.5f, 2f), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(12, 18) * 4, Main.rand.NextFloat(0.3f, 0.5f), Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat(0, 0.7f)) * 0.7f, new Vector2(0.7f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(rage); + } + } + + projectile.ai[1] = junk; + return false; + } + + 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; + 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) + + 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 @@ -3710,6 +3801,9 @@ namespace CalamityMod.Projectiles if (!frameOneHacksExecuted) { + if (extraUpdatesToSync > 0) + projectile.extraUpdates = extraUpdatesToSync; + if (projectile.hostile) { // Reduce Nail damage from Nailheads because they're stupid @@ -3783,17 +3877,6 @@ namespace CalamityMod.Projectiles projectile.damage += 15; } - if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) - { - if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 - { - if (player.HeldItem.type == ItemID.BeesKnees) - projectile.DamageType = DamageClass.Ranged; - } - } - else if (projectile.type == ProjectileID.SoulDrain) - projectile.DamageType = DamageClass.Magic; - frameOneHacksExecuted = true; } @@ -3868,20 +3951,14 @@ namespace CalamityMod.Projectiles } #region Flail Extendo Hacks - // Very hacky solution for making Dao of Pow's flail throw travel farther and faster + // Very hacky solution for making Dao of Pow's flail throw travel faster if (projectile.type == ProjectileID.TheDaoofPow) { // Guide to ai[0]: // 0: Spinning. 1: Being thrown. 2: Return after throw. 6: Dropped on ground. 4: Return after being dropped. if (projectile.ai[0] == 1f) { - if (projectile.ai[1] > 0f) - { - projectile.ai[2]++; - if (projectile.ai[2] <= 11f) // When ai[1] reaches 14, it starts returning, so this makes it take an extra 11 frames to return - projectile.ai[1]--; - } - else + if (projectile.ai[1] == 0f) projectile.velocity *= 1.33f; } } @@ -3903,22 +3980,13 @@ namespace CalamityMod.Projectiles { if (projectile.ai[0] == 1f) { - if (projectile.ai[1] > 0f) - { - projectile.ai[2]++; - if (projectile.ai[2] <= 5f) // When ai[1] reaches 12, it starts returning, so this makes it take an extra 5 frames to return - projectile.ai[1]--; - } - else - projectile.velocity *= 1.33f; + if (projectile.ai[1] == 0f) + projectile.velocity *= 1.25f; } + // Return speed is also increased using an IL edit, because why does it have a slower return speed than Dao of Pow??? } #endregion - // Starfury stars never collide with tiles - if (projectile.type == ProjectileID.Starfury) - projectile.tileCollide = false; - // True Night's Edge projectiles instantly start with max velocity if (projectile.type == ProjectileID.TrueNightsEdge) { @@ -4291,16 +4359,45 @@ namespace CalamityMod.Projectiles // Grape beer-specific homing. If the projectile is aligned a certain amount to the direction to the target, it will home in. else if (conditionalHomingRange > 0f && Main.player[projectile.owner].heldProj != projectile.whoAmI && projectile.aiStyle != ProjAIStyleID.HeldProjectile && grapeBeer) { - NPC target = projectile.Center.ClosestNPCAt(conditionalHomingRange); + float npcDistCompare = 25000f; // Initializing the value to a large number so the first entry is basically guaranteed to replace it. + NPC target = null; + foreach (NPC n in Main.ActiveNPCs) + { + float extraDistance = (n.width / 2) + (n.height / 2); + if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, conditionalHomingRange + extraDistance) || ((projectile.localNPCImmunity[n.whoAmI] > 0 || projectile.localNPCImmunity[n.whoAmI] == -1 || n.immune[projectile.owner] > 0))) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, projectile.Center); + if (Projectile.perIDStaticNPCImmunity[projectile.type][n.whoAmI] > Main.GameUpdateCount) + currentNPCDist += 1600; //Prioritize things that don't currently have iframes, but still home in on stuff that has static iframes if needed. + if ((currentNPCDist < npcDistCompare) && (!projectile.tileCollide || Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + target = n; + } + } + if (target is not null) { + if (grapeBeerHomingTarget == target.whoAmI) + { + grapeBeerHomingPower += 0.004f; + } + else + { + grapeBeerHomingPower = 0.015f; + } + + HomingTarget = grapeBeerHomingTarget = target.whoAmI; Vector2 targetDirection = projectile.SafeDirectionTo(target.Center); - float trackingSpeed = Vector2.Dot(targetDirection, projectile.velocity.SafeNormalize(Vector2.UnitX)) > 0.835f ? 0.01325f : 0f; // Delicate values, please test changes you make to them + float trackingSpeed = grapeBeerHomingPower; - Vector2 currVelocity = projectile.velocity; + var currVelocity = projectile.velocity.Length(); + if (currVelocity < 8) + currVelocity += grapeBeerHomingPower; - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(targetDirection.ToRotation(), trackingSpeed).ToRotationVector2() * currVelocity.Length(); + projectile.velocity = projectile.velocity.ToRotation().AngleTowards(targetDirection.ToRotation(), trackingSpeed).ToRotationVector2() * currVelocity; } } @@ -4530,8 +4627,8 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 8; i++) { - Particle floweyFromHitGameUndertale = new CustomSpark(player.Center, Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f), - "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(65, 78 + 1), Main.rand.NextFloat(1.8f, 2.8f), + Particle floweyFromHitGameUndertale = new CustomSpark(player.Center, Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f), + "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(65, 78 + 1), Main.rand.NextFloat(1.8f, 2.8f), Color.Lerp(Color.HotPink, Color.Plum, Main.rand.NextFloat(0, 0.65f)), new Vector2(1f, 1f), true, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); GeneralParticleHandler.SpawnParticle(floweyFromHitGameUndertale); @@ -4547,15 +4644,15 @@ namespace CalamityMod.Projectiles } public override void GrapplePullSpeed(Projectile projectile, Player player, ref float speed) { + if (player.Calamity().bloomStone) + speed += 6f; float mult = 1f; if (player.Calamity().reaverSpeed) mult += ReaverHeadMobility.SetBonusHookBoost; if (player.Calamity().tungstenArmorHookBoost) mult += TungstenArmorSetChange.HookBoost; - if (player.Calamity().bloomStone) - mult += 0.5f; - speed *= mult; + speed *= mult; if (player.velocity.Length() > 2f) { player.Calamity().hookPullVisuals = 60; @@ -4563,13 +4660,13 @@ namespace CalamityMod.Projectiles } public override void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed) { + if (player.Calamity().bloomStone) + speed += 6f; float mult = 1f; if (player.Calamity().reaverSpeed) mult += ReaverHeadMobility.SetBonusHookBoost; if (player.Calamity().tungstenArmorHookBoost) mult += TungstenArmorSetChange.HookBoost; - if (player.Calamity().bloomStone) - mult += 0.5f; speed *= mult; } #endregion @@ -4580,29 +4677,37 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (grapeBeer) + { + Vector2 pointToCheck = Vector2.Clamp(player.Center, target.TopLeft, target.BottomRight); + float remap = Utils.Remap(Utils.Distance(player.Center, pointToCheck), GrapeBeer.CloseRangeDistance, GrapeBeer.LongRangeDistance, GrapeBeer.CloseRangeDamage, GrapeBeer.LongRangeDamage); + modifiers.SourceDamage *= remap; + } + // Old Fashioned buffs (or debuffs) apply if the player has Old Fashioned - // IV Drip on the Rocks inherits the same logic as Old Fashioned if (modPlayer.oldFashioned && buffedByOldFashioned.HasValue) modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; - if (modPlayer.ivDrip && buffedByOldFashioned.HasValue) - modifiers.SourceDamage *= buffedByOldFashioned.Value ? IVDripOnTheRocks.DamageBoostMultiplier : IVDripOnTheRocks.DamageReductionMultiplier; - if (modPlayer.rum && projectile.DamageType.CountsAsClass(DamageClass.Summon)) + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) && buffedByOldFashioned.HasValue) + modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; + + if ((modPlayer.rum || dripPlayer.HasAlcohol(AlcoholType.Rum)) && projectile.DamageType.CountsAsClass(DamageClass.Summon)) { if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type]) - { - modifiers.SourceDamage *= Rum.MinionBoost; - } + modifiers.SourceDamage *= (modPlayer.rum ? Rum.MinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.MinionBoost : 1f); else - modifiers.SourceDamage *= Rum.NonMinionBoost; + modifiers.SourceDamage *= (modPlayer.rum ? Rum.NonMinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.NonMinionBoost : 1f); } - if (modPlayer.moscowMule || modPlayer.bloodyMary) + + if (modPlayer.moscowMule || modPlayer.bloodyMary || dripPlayer.HasAlcohol(AlcoholType.MoscowMule) || dripPlayer.HasAlcohol(AlcoholType.BloodyMary)) { if (projectile.DamageType == DamageClass.Summon || (PierceResistNPC.exemptProjectiles.Contains(projectile.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(projectile.type) && PierceResistNPC.singleHitboxExemptProjectiles[projectile.type]))) { - modifiers.SourceDamage *= ((modPlayer.moscowMule ? 0.7f : 1f) * (modPlayer.bloodyMary ? 0.33f : 1f)); + modifiers.SourceDamage *= ((modPlayer.moscowMule ? MoscowMule.PierceDamageMultiplier : 1f) * (modPlayer.bloodyMary ? BloodyMary.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? MoscowMule.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? BloodyMary.PierceDamageMultiplier : 1f)); } } + if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula @@ -4647,9 +4752,7 @@ namespace CalamityMod.Projectiles else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) { target.AddBuff(BuffType(), VampiricTalisman.ArmorCrunchDebuffTime); - - if (!modPlayer.nanotech) - target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); + target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); } if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) @@ -4680,6 +4783,10 @@ namespace CalamityMod.Projectiles modifiers.SourceDamage /= 1.5f; } + // Debuff infliction must be placed here as opposed to a more common hook like OnHitNPCWithProj because its on-hit logic breaks the loop before it reaches that hook + if (projectile.type == ProjectileID.InfluxWaver) + target.AddBuff(BuffID.Electrified, 180); + // Create sparks on hit to hammer in the defense shredding. if (deepcoreBullet) { @@ -4699,25 +4806,51 @@ namespace CalamityMod.Projectiles } // Scuttler's Jewel projectiles can spawn either on-hit or on-kill, but only spawn once per projectile. - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned) + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && !CannotProc) { - int damage = (int)player.GetTotalDamage().ApplyTo(16); + if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned) + { + int damage = (int)player.GetTotalDamage().ApplyTo(16); - int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); - Main.projectile[spike].frame = 4; - if (spike.WithinBounds(Main.maxProjectiles)) - Main.projectile[spike].DamageType = DamageClass.Generic; - modPlayer.scuttlerCooldown = 30; - JewelSpikeSpawned = true; + int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + JewelSpikeSpawned = true; + } + if (modPlayer.etherealExtorter && extorterBoost && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + + int damage = (int)player.GetTotalDamage().ApplyTo(EtherealExtorter.soulDamage); + + int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); + Main.projectile[soul].tileCollide = false; + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + Main.projectile[soul].ArmorPenetration = 20; + } + extorterBoost = false; + } } + + } #endregion #region Modify Hit Player public override void ModifyHitPlayer(Projectile projectile, Player target, ref Player.HurtModifiers modifiers) - { + { modifiers.FinalDamage.Flat -= flatDR; modifiers.FinalDamage *= 1f - multiplicativeDR; + + // Reduce projectile damage if the enemy is inflicted with Whispering Death + if (ParentNPCIndex != -1) + { + NPC npc = Main.npc[(int)ParentNPCIndex]; + if (npc.active && npc.Calamity().whisperingDeath) + modifiers.FinalDamage *= 1f - WhisperingDeath.EnemyDamageReduction; + } } #endregion @@ -4737,7 +4870,8 @@ namespace CalamityMod.Projectiles { var player = Main.player[projectile.owner]; float burnRatio = (-player.statMana / 100) * ChaosStone.DamageMultPer100Mana; - target.Calamity().manaBurn += damageDone * burnRatio * (player.Calamity().oldFashioned ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().ivDrip ? IVDripOnTheRocks.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1+Vodka.DebuffBoost : 1); + var dripPlayer = player.GetModPlayer(); + target.Calamity().manaBurn += damageDone * burnRatio * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1 + Vodka.DebuffBoost : 1); target.Calamity().playerManaBurnIntensity = -player.statMana / (float)player.statManaMax2; if (Main.netMode != NetmodeID.SinglePlayer) ManaBurnSyncPacket.Send(target); @@ -4957,8 +5091,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) { @@ -5185,17 +5318,18 @@ namespace CalamityMod.Projectiles { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(EtherealExtorter.soulDamage); int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); Main.projectile[soul].tileCollide = false; if (soul.WithinBounds(Main.maxProjectiles)) Main.projectile[soul].DamageType = DamageClass.Generic; } + extorterBoost = false; } // Make sure the spike doesn't spawn again if it's already been spawned by on-hit. - if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned) + if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned && !CannotProc) { int damage = (int)player.GetTotalDamage().ApplyTo(16); @@ -5203,7 +5337,6 @@ namespace CalamityMod.Projectiles Main.projectile[spike].frame = 4; if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].DamageType = DamageClass.Generic; - modPlayer.scuttlerCooldown = 30; } } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 3bdf1d4a51..072e1ddb65 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles { ProjectileID.HiveFive, RebalanceYoyo(24f, 320f, 20f, 0, 15) }, // original: 8s lifetime | 215px range | 13px/f top speed | 0 extra updates - { ProjectileID.JungleYoyo, RebalanceYoyo(20f, 288f, 17f, 0, 20) }, // Amazon + { ProjectileID.JungleYoyo, RebalanceYoyo(24f, 320f, 20f, 0, 20) }, // Amazon // original: INF lifetime | 340px range | 16px/f top speed | 0 extra updates { ProjectileID.Kraken, RebalanceYoyo(-1f, 480f, 54f, 2) }, @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, { ProjectileID.Bullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.BulletHighVelocity, Do(ExtraUpdatesDelta(+2), LocalIFrames(-1)) }, - { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(7), ScaleExact(1.5f)) }, + { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(10), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, { ProjectileID.ChlorophyteDrill, standardDrillTweaks }, { ProjectileID.ChlorophyteJackhammer, standardDrillTweaks }, @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ExplosiveBullet, Do(ExtraUpdatesDelta(+2), IDStaticIFrames(5), SingleHitImmunity) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150), DefaultIDStaticIFrames) }, - { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, + { ProjectileID.Flamarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, @@ -188,6 +188,7 @@ namespace CalamityMod.Projectiles { ProjectileID.PalladiumDrill, standardDrillTweaks }, { ProjectileID.PartyBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.PurpleCounterweight, counterweightTweaks }, + { ProjectileID.PurpleLaser, Do(LocalIFrames(10 * 5)) }, // Laser Rifle, accounting for extra updates { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, { ProjectileID.QueenSlimeMinionPinkBall, Do(NoPiercing) }, { ProjectileID.RedCounterweight, counterweightTweaks }, @@ -199,12 +200,11 @@ namespace CalamityMod.Projectiles { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.SolarFlareDrill, standardDrillTweaks }, { ProjectileID.StardustDrill, standardDrillTweaks }, - { ProjectileID.Starfury, Do(TimeLeftExact(75), DefaultIDStaticIFrames) }, { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, // Beam Sword projectile { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes - { ProjectileID.ThunderStaffShot, Do(PiercingExact(3), DefaultIDStaticIFrames) }, //Thunder Zapper projectile + { ProjectileID.ThunderStaffShot, Do(PiercingExact(2), DefaultIDStaticIFrames) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomSpider, Do( ExtraUpdatesExact(2), LocalIFrames(90)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, - { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3), TimeLeftExact(1920)) }, + { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion @@ -237,6 +237,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ShadowJoustingLance, trueMelee }, { ProjectileID.SilverShortswordStab, trueMelee }, { ProjectileID.SolarFlareChainsaw, trueMeleeNoSpeed }, + { ProjectileID.Spark, trueMeleeNoSpeed }, { ProjectileID.Spear, trueMelee }, { ProjectileID.StardustChainsaw, trueMeleeNoSpeed }, { ProjectileID.Swordfish, trueMelee }, @@ -490,7 +491,6 @@ namespace CalamityMod.Projectiles { ProjectileID.PulseBolt, defaultIFrames }, { ProjectileID.PureSpray, defaultIFrames }, { ProjectileID.PurificationPowder, defaultIFrames }, - { ProjectileID.PurpleLaser, defaultIFrames }, { ProjectileID.PygmySpear, defaultIFrames }, { ProjectileID.QuarterNote, defaultIFrames }, { ProjectileID.RainbowFlare, defaultIFrames }, @@ -554,6 +554,7 @@ namespace CalamityMod.Projectiles { ProjectileID.Stake, defaultIFrames }, { ProjectileID.StarAnise, defaultIFrames }, { ProjectileID.StarCannonStar, defaultIFrames }, + { ProjectileID.Starfury, defaultIFrames }, { ProjectileID.StardustCellMinion, defaultIFrames }, { ProjectileID.StardustGuardianExplosion, defaultIFrames }, { ProjectileID.StickyBomb, defaultIFrames }, diff --git a/Projectiles/DraedonsArsenal/AugerHoldout.cs b/Projectiles/DraedonsArsenal/AugerHoldout.cs index 0322389e2f..d8740597d0 100644 --- a/Projectiles/DraedonsArsenal/AugerHoldout.cs +++ b/Projectiles/DraedonsArsenal/AugerHoldout.cs @@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (!Owner.CantUseHoldout(false)) Projectile.timeLeft = 5; + Projectile.scale = MathHelper.Lerp(Projectile.scale, Owner.GetMeleeScale(), 0.3f / Projectile.MaxUpdates); + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()); Positioning(toMouse); @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (attackTimer > fireRate && makeHitbox) { - Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, 0, 0, 0); + Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, Projectile.scale, 0, 0); SoundStyle pull = new("CalamityMod/Sounds/Item/AugerPull"); SoundEngine.PlaySound(pull with { Volume = 0.9f, Pitch = 0 }, Owner.ClampedMouseWorld()); @@ -213,7 +215,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Owner.SetScreenshake(5f); damage = (int)(damage * 2.5f); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0); + Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0); + slash.localAI[0] = Projectile.scale; makeHitbox = false; } } @@ -232,7 +235,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Texture2D blade = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); float randSize = Main.rand.NextFloat(0.8f, 1f); Color drawColor = Projectile.GetAlpha(lightColor); @@ -261,9 +264,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } Vector2 placeAdjust = (drawRotation + MathHelper.PiOver2).ToRotationVector2() * 2.5f; - Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The holdout + // Spesifically doesn't scale with melee size, but the actual energy blade does + Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, 1, flipSprite); // The holdout - Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The glow + Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, 1, flipSprite); // The glow return false; } diff --git a/Projectiles/DraedonsArsenal/AugerPull.cs b/Projectiles/DraedonsArsenal/AugerPull.cs index 4abb72e134..a4d042d200 100644 --- a/Projectiles/DraedonsArsenal/AugerPull.cs +++ b/Projectiles/DraedonsArsenal/AugerPull.cs @@ -32,13 +32,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { + Projectile.scale = Projectile.ai[0]; if (strongTimer == 0) { - Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f, 0.7f, 30); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f * Projectile.scale, 0.7f * Projectile.scale, 30); GeneralParticleHandler.SpawnParticle(bolt2); for (int i = 0; i < 20; i++) { - Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f); + Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f) * Projectile.scale; Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 360, ModContent.DustType(), -dustVel2 * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.8f)); dust2.noGravity = true; dust2.fadeIn = 0.3f; @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < Main.maxNPCs; i++) { NPC target = Main.npc[i]; - if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650) + if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650 * Projectile.scale) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); target.velocity = moveDir; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f); + Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f) * Projectile.scale; Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, Effects.ArsenalEffects.ArsenalGaussDust, -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f)); dust.noGravity = true; dust.fadeIn = 0.05f; @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC target = Main.npc[i]; if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1)) { - if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 300) + if (Vector2.Distance(target.Center, Projectile.Center) > 15 * Projectile.scale && Vector2.Distance(target.Center, Projectile.Center) < 300 * Projectile.scale) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); target.velocity = Vector2.Lerp(target.velocity, moveDir * 5, 0.12f); @@ -100,8 +101,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSquareParticleBig").Value; Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade; - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0); - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2) * Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/DraedonsArsenal/AugerSlash.cs b/Projectiles/DraedonsArsenal/AugerSlash.cs index 8d57ef5c26..4010a6be88 100644 --- a/Projectiles/DraedonsArsenal/AugerSlash.cs +++ b/Projectiles/DraedonsArsenal/AugerSlash.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { Player Owner = Main.player[Projectile.owner]; + Projectile.scale = Projectile.localAI[0]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); fade = (float)Math.Pow(Utils.GetLerpValue(lifetime * 0.1f, lifetime * 0.5f, Projectile.timeLeft, true), 4); if (Projectile.velocity.Length() > 0.1f) @@ -48,15 +49,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float rotScaling = 1 - Math.Abs(rot); Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (70 / scaleFx + 80 * (float)Math.Pow(rotScaling, 1.5f) * Main.rand.NextFloat(0.85f, 1f)) * scaleFx; Vector2 finalDustVel = (vel * (float)Math.Pow(rotScaling, 1.5f) + (vel.RotatedBy(-MathHelper.PiOver2 * rot) * 1.5f)) * 0.03f; - Dust s = Dust.NewDustPerfect(Projectile.Center + vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx, ModContent.DustType(), finalDustVel / scaleFx); - s.scale = scale * scaleFx; + Dust s = Dust.NewDustPerfect(Projectile.Center + (vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx) * Projectile.scale, ModContent.DustType(), finalDustVel / scaleFx); + s.scale = scale * scaleFx * Projectile.scale; s.noGravity = true; s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Math.Max(0, swingDirScale - 0.35f)); - s.fadeIn = 0.1f + swingDirScale; + s.fadeIn = 0.1f + swingDirScale * Projectile.scale; } } - Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f); + Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f * Projectile.scale); time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float length = 135 * scale; float size = 135 * scale; float _ = float.NaN; - bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); + bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length * Projectile.scale, size * Projectile.scale, ref _); return (hit); } public override bool PreDraw(ref Color lightColor) @@ -154,7 +155,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float sizeLerp = (float)Math.Pow((Utils.GetLerpValue(lifetime, lifetime * 0.2f, time, true)), 5f); Vector2 squash = new Vector2(1 + lerp * 0.5f, 1.25f - lerp * 1.1f) * 0.08f * sizeLerp; Vector2 rotationPoint = new Vector2(proj.Width * 0.85f, proj.Height / 2); - Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105 * Projectile.scale; SpriteEffects spfx = (Projectile.ai[1] != 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); if (Projectile.direction == -1) diff --git a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs index aae9fd3773..1411585c5f 100644 --- a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs +++ b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs @@ -17,7 +17,6 @@ using static Terraria.Player; namespace CalamityMod.Projectiles.DraedonsArsenal { - [PierceResistException] public class CountermeasureMittHoldout : BaseGunHoldoutProjectile { public new string LocalizationCategory => "Projectiles.Misc"; @@ -74,7 +73,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float alteredRotationRot = 0.7f; // Alteration to the holdout rotation so it's not directly to the mouse, changes with the attack cycle public float alteredRotation => Projectile.rotation + (f2r * alteredRotationRot * -Projectile.direction); public Vector2 palmBlastPos => Owner.Center + alteredRotation.ToRotationVector2() * 55 * Projectile.scale; - public int palmManaCost => HeldItem.mana * 30; + public int palmManaCost => HeldItem.mana * 15; public int hitTimer = 0; public override void SetDefaults() { diff --git a/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs index b94a6f39b0..5bbc67511d 100644 --- a/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs +++ b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs @@ -51,6 +51,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal time++; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player player = Main.player[Projectile.owner]; + int manaGained = 250; + player.statMana += manaGained; + if (Main.myPlayer == player.whoAmI) + player.ManaEffect(manaGained); + + if (player.statMana > player.statManaMax2) + player.statMana = player.statManaMax2; + } + public override bool? CanHitNPC(NPC target) => (target == targeted) ? null : false; public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs index a8a735cb03..73f63de8c1 100644 --- a/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs +++ b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs @@ -62,8 +62,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal spamDelay--; // Fire if the owner stops channeling or otherwise cannot use the weapon. bool autoSpam = (Owner.Calamity().mouseRight && !Main.mouseLeft); - bool chargeSpam = (Owner.Calamity().mouseRight && Main.mouseLeft && ChargeLV1 && spamDelay == 0); - if ((!Main.mouseLeft || autoSpam || chargeSpam) && downtime == 0 && time >= 1) + if ((!Main.mouseLeft || autoSpam) && downtime == 0 && time >= 1) { KeepRefreshingLifetime = false; diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs index 2bebbdd2fb..9453efdd6d 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.ArmorPenetration = 15; + Projectile.Calamity().CannotProc = true; } public override bool ShouldUpdatePosition() => (time < 120); public override void AI() @@ -79,12 +80,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (time == 250 || Utils.Distance(Projectile.Center, Owner.Center) < 10) { - if (Projectile.ai[2] == 0 && Owner.HeldItem.type == ModContent.ItemType()) + if (Projectile.ai[2] == 0 && Owner.HeldItem.type == ModContent.ItemType() && Owner.controlUseItem) { - Projectile reformGrenade = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), goal, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0); + Projectile reformGrenade = Projectile.NewProjectileDirect(Owner.GetSource_ItemUse(Owner.HeldItem), goal, Vector2.Zero, ModContent.ProjectileType(), (int)Owner.GetTotalDamage().ApplyTo(Owner.HeldItem.damage), 0f, Owner.whoAmI, 0); reformGrenade.ai[1] = 5; reformGrenade.ai[0] = Owner.HeldItem.useTime * 0.7f; reformGrenade.Opacity = 0; + //Doze Apr 15 2026 - Because this isn't being spawnwed from the shoot, these bools break. Manually fixing here. + reformGrenade.Calamity().extorterBoost = true; + reformGrenade.Calamity().stealthStrikeSubProjectile = false; SoundStyle grab = new("CalamityMod/Sounds/Item/LightCatch"); SoundEngine.PlaySound(grab with { Volume = 1f, Pitch = 0 }, Projectile.Center); diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs index 2349a8ebe1..688343a936 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.Center = Owner.Center; Projectile.extraUpdates = (Projectile.Calamity().stealthStrike ? 22 : 5); Projectile.rotation += Main.rand.NextFloat(-4, 4); - Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 9; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 9 * Owner.Calamity().rogueVelocity; Projectile.velocity = velocity; if (Projectile.Calamity().stealthStrike) @@ -300,11 +300,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Do NOT change the damage of these here, do it on the on hit Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 7f).RotatedBy(MathHelper.PiOver4 / 2), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, spin, i); - orb.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; if (Projectile.Calamity().stealthStrike) { Projectile orb2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 10f), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, -spin, i + 1); - orb2.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } } @@ -338,15 +336,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float fade = 1; float reformMult = Utils.GetLerpValue(1, 0, Projectile.Opacity) * 3.5f; Texture2D tex = pullPin ? ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenade").Value : ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseGrenadeNoPin").Value; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + + ((!flung || catching) ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); for (int i = 0; i < 15; i++) { Color auraColor = col with { A = 0 } * 0.25f * fade * fxScale; Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 2 * Math.Max(fxScale, reformMult); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(tex, baseDrawPos + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade * Projectile.Opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, baseDrawPos, null, lightColor * fade * Projectile.Opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White * fade * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow").Value, baseDrawPos, null, Color.White * fade * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs index ff1bf55236..f9a5e01839 100644 --- a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs +++ b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.timeLeft = 300; Projectile.extraUpdates = 3; Projectile.penetrate = -1; - Projectile.ArmorPenetration = 15; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } 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/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/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 8c637f4aeb..25879d7ed9 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Enemy } Projectile.velocity = Vector2.Zero; Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] == (Projectile.ai[1] == 1f ? 15f : 60f) && Projectile.owner == Main.myPlayer) { int projectileDamage = Projectile.ai[0] != 0f ? (int)Projectile.ai[0] : Main.masterMode ? 21 : Main.expertMode ? 25 : 40; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 3f, Projectile.owner, 0f, Projectile.ai[1]); 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 002c255f37..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; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - float projTimer = Projectile.ai[1] == 1f ? 900f : 600f; + float projTimer = Projectile.ai[1] == 1f ? 795f : 600f; if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; @@ -40,8 +41,8 @@ namespace CalamityMod.Projectiles.Enemy { Projectile.Kill(); } - float expandSizeX = Projectile.ai[1] == 1f ? 90f : 15f; - float expandSizeY = Projectile.ai[1] == 1f ? 90f : 15f; + float expandSizeX = Projectile.ai[1] == 1f ? 150f : 15f; + float expandSizeY = Projectile.ai[1] == 1f ? 150f : 15f; Point projCenterTile = Projectile.Center.ToTileCoordinates(); int sizeMod; int sizeMod2; @@ -101,13 +102,19 @@ namespace CalamityMod.Projectiles.Enemy } } - public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 60f && Projectile.ai[0] <= (Projectile.ai[1] == 1f ? 840f : 540f); + 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 ? 900f : 600f; - float expandSizeX2 = Projectile.ai[1] == 1f ? 90f : 15f; - float expandSizeY2 = Projectile.ai[1] == 1f ? 90f : 15f; + float aiTrackCheck = Projectile.ai[1] == 1f ? 795f : 600f; + float expandSizeX2 = Projectile.ai[1] == 1f ? 150f : 15f; + float expandSizeY2 = Projectile.ai[1] == 1f ? 150f : 15f; float aiTracker = Projectile.ai[0]; float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); if (aiTracker > aiTrackCheck - 60f) diff --git a/Projectiles/Environment/MurkySteam.cs b/Projectiles/Environment/MurkySteam.cs index 7a08be9d5c..d98779f782 100644 --- a/Projectiles/Environment/MurkySteam.cs +++ b/Projectiles/Environment/MurkySteam.cs @@ -42,7 +42,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (info.Damage <= 0) + // CIT 23MAY2026: Vanilla's logic for granting "Burning immunity" is incredibly stupid because Player.fireWalk actually just prevents running hot tile touch code. + // Thus we must add a manual check for Player.fireWalk here too. + if (info.Damage <= 0 || target.fireWalk) return; target.AddBuff(BuffID.Burning, 180); diff --git a/Projectiles/Environment/ThermalSteam.cs b/Projectiles/Environment/ThermalSteam.cs index 4539d420a9..84c4fdeeb2 100644 --- a/Projectiles/Environment/ThermalSteam.cs +++ b/Projectiles/Environment/ThermalSteam.cs @@ -42,7 +42,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (info.Damage <= 0) + // CIT 23MAY2026: Vanilla's logic for granting "Burning immunity" is incredibly stupid because Player.fireWalk actually just prevents running hot tile touch code. + // Thus we must add a manual check for Player.fireWalk here too. + if (info.Damage <= 0 || target.fireWalk) return; target.AddBuff(BuffID.Burning, 180); diff --git a/Projectiles/Magic/AcidGunStream.cs b/Projectiles/Magic/AcidGunStream.cs index 14d510b68c..36e9e66da0 100644 --- a/Projectiles/Magic/AcidGunStream.cs +++ b/Projectiles/Magic/AcidGunStream.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.extraUpdates = 2; Projectile.tileCollide = false; Projectile.usesIDStaticNPCImmunity = true; diff --git a/Projectiles/Magic/AerSigil.cs b/Projectiles/Magic/AerSigil.cs index 5af08db9b2..84d5bdc46a 100644 --- a/Projectiles/Magic/AerSigil.cs +++ b/Projectiles/Magic/AerSigil.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX); spawnedProjectile = true; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 48f, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 36f, ModContent.ProjectileType(), Projectile.damage * 3, Projectile.knockBack, Projectile.owner); } if (Projectile.localAI[0] >= 50) diff --git a/Projectiles/Magic/AerSigilMissile.cs b/Projectiles/Magic/AerSigilMissile.cs index a97417bf7b..b75cdb3981 100644 --- a/Projectiles/Magic/AerSigilMissile.cs +++ b/Projectiles/Magic/AerSigilMissile.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; Projectile.alpha = 255; Projectile.timeLeft = 420; - Projectile.usesLocalNPCImmunity = true; + Projectile.MaxUpdates = 2; // Makes trail draw right away for (int i = 0; i < Projectile.oldPos.Length; i++) @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.owner == Main.myPlayer) { - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4.25f), Projectile.knockBack * 6, Projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 6, Projectile.owner); explosion.ai[1] = 600f; explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate explosion.netUpdate = true; diff --git a/Projectiles/Magic/AquaSigil.cs b/Projectiles/Magic/AquaSigil.cs index 45a03ce786..e1cfeafec8 100644 --- a/Projectiles/Magic/AquaSigil.cs +++ b/Projectiles/Magic/AquaSigil.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX); spawnedProjectile = true; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 29f, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 32f, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); } if (Projectile.localAI[0] >= 50) diff --git a/Projectiles/Magic/AquaSigilWaterball.cs b/Projectiles/Magic/AquaSigilWaterball.cs index 3b37d92670..12df9f41e4 100644 --- a/Projectiles/Magic/AquaSigilWaterball.cs +++ b/Projectiles/Magic/AquaSigilWaterball.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.owner == Main.myPlayer) { - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 3.85f), Projectile.knockBack, Projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 3.5f), Projectile.knockBack, Projectile.owner); explosion.ai[1] = 260f;                 explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate                 explosion.netUpdate = true; 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/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 88b9ed5af2..ca54e8abe0 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Magic int attackType = ModContent.ProjectileType(); if (Owner.ownedProjectileCounts[attackType] == 0) { - if (Projectile.ai[0] >= 0f && Owner.CheckMana(Owner.HeldItem, -1, true, false)) + if (Projectile.ai[0] >= 1f && Owner.CheckMana(Owner.HeldItem, -1, true, false)) { SoundEngine.PlaySound(ArtAttack.UseSound, Owner.Center); Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.ai[0] = -24f; + Projectile.ai[0] -= Owner.HeldItem.useAnimation; } else Projectile.ai[0]++; diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index a69ca4e9c8..0d87884419 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = end - 1; i >= start; i--) { float distanceFromStar = Vector2.Distance(Projectile.position, Projectile.oldPos[i]); - if (distanceFromStar < (distanceTraveled * 0.7f + 30f)) + if (distanceFromStar < (distanceTraveled * 0.7f + 20f)) { shapeIsComplete = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic averageDistanceFromStar /= end - start; // Cancel out intersection "completions" if the velocity is slow enough to be rebounding or the shape is relatively small. - if (averageDistanceFromStar < distanceTraveled + 70f) + if (averageDistanceFromStar < distanceTraveled + 100f) shapeIsComplete = false; } @@ -182,6 +182,10 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, n.whoAmI); + + damage /= 2; + if (damage < 1) + damage = 1; } } } diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 80d7385459..6fdecf2031 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.extraUpdates = 3; Projectile.timeLeft = 120; Projectile.usesIDStaticNPCImmunity = true; diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index f1edf2171f..d129b88402 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -58,8 +58,7 @@ namespace CalamityMod.Projectiles.Magic Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f * scaler, 0f, 4, false); GeneralParticleHandler.SpawnParticle(blastRing); Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing2, false, GeneralDrawLayer.AfterEverything); } Projectile.velocity *= 0.96f; if (time == 3) @@ -90,8 +89,7 @@ namespace CalamityMod.Projectiles.Magic Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 12, 0.07f * scaling, Color.Black * 0.85f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2), false); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.75f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2)); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (Main.rand.NextBool(6)) { @@ -113,8 +111,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 2; i++) { Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing2, false, GeneralDrawLayer.AfterEverything); } Projectile.velocity = Vector2.Zero; } 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/FleshTotemMinion.cs b/Projectiles/Magic/FleshTotemMinion.cs index 065e405317..392cdbc545 100644 --- a/Projectiles/Magic/FleshTotemMinion.cs +++ b/Projectiles/Magic/FleshTotemMinion.cs @@ -76,15 +76,14 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = 0f; } - //Pulses happen every 6 seconds, divided by how much mana the totem has stored - int pulseMax = 360; - pulseMax = 360 - (modPlayer.fleshTotemManaStorage / 2); + //Pulses happen every 4 seconds, divided by how much mana the totem has stored + float pulseMax = Utils.Remap(modPlayer.fleshTotemManaStorage, 0, FleshTotem.manaStorageMax, FleshTotem.MaxDelay, FleshTotem.MinDelay); //Ensure the pulse timer can never go below 1 second if (pulseMax < 60) { pulseMax = 60; } - //When the timer reaches max, pulse and restore 20 mana + //When the timer reaches max, pulse and restore 25 mana if (pulseTimer >= pulseMax) { if (visuals) @@ -114,7 +113,7 @@ namespace CalamityMod.Projectiles.Magic } } } - int manaGained = 20; + int manaGained = 25; player.statMana += manaGained; if (Main.myPlayer == player.whoAmI) player.ManaEffect(manaGained); diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index d0d7bb0ca4..551012e2a7 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -1,4 +1,5 @@ using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -130,6 +131,7 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.ApplyScalingForcedCrit(Projectile); if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.85f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/IgnisSigil.cs b/Projectiles/Magic/IgnisSigil.cs index c3d022a7f5..e12591bd45 100644 --- a/Projectiles/Magic/IgnisSigil.cs +++ b/Projectiles/Magic/IgnisSigil.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX); spawnedProjectile = true; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 34f, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 50f, ModContent.ProjectileType(), Projectile.damage * 5, Projectile.knockBack, Projectile.owner); } if (Projectile.localAI[0] >= 50) diff --git a/Projectiles/Magic/IgnisSigilFireball.cs b/Projectiles/Magic/IgnisSigilFireball.cs index c3187cd90c..dc23785024 100644 --- a/Projectiles/Magic/IgnisSigilFireball.cs +++ b/Projectiles/Magic/IgnisSigilFireball.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.owner == Main.myPlayer) { - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType(), (int) (Projectile.damage * 3.35f), Projectile.knockBack, Projectile.owner); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + (new Vector2(-26, 0).RotatedBy(Projectile.rotation - MathHelper.PiOver2)), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); explosion.ai[1] = 145f; explosion.localAI[1] = Main.rand.NextFloat(0.1f, 0.2f); // Interpolate                 explosion.netUpdate = true; diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs index eee796c453..30bdd882b4 100644 --- a/Projectiles/Magic/IncineratingFireball.cs +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 10; Projectile.hide = true; } @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic } // Can only deal damage while not fizzling out. - public override bool? CanDamage() => !Released; + public override bool? CanDamage() => !Released && Timer % Projectile.localNPCHitCooldown == 0; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -160,6 +160,9 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(Burn, target.Center); target.AddBuff(ModContent.BuffType(), 180); + if (damageDone > 2 && !target.Calamity().IsArmored()) + Projectile.damage = (int)(Projectile.damage * 0.7f); + // Whoa buddy no smoking allowed for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 9352beef41..ab93bc31bf 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.ArmorPenetration = 40; } public override void AI() @@ -105,7 +104,6 @@ namespace CalamityMod.Projectiles.Magic Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.timeLeft = 10; blast.DamageType = DamageClass.Magic; - blast.ArmorPenetration = 40; } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index 4640f39b2c..45f7cc3bf3 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic Owner.RemoveAllGrapplingHooks(); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 14f; + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 12f; Owner.velocity = Projectile.velocity; Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index 200e4d1f14..970630819f 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic int intendedDamage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += intendedDamage * (Main.masterMode ? 2.4f : Main.expertMode ? 1.6f : 1f); + modifiers.SourceDamage.Flat += intendedDamage.ScaleWithDifficulty(); if (Projectile.ai[0] == 1f) modifiers.SourceDamage.Flat /= 2; } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic int intendedDamage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += intendedDamage * (Main.masterMode ? 2.4f : Main.expertMode ? 1.6f : 1f); + modifiers.SourceDamage.Flat += intendedDamage.ScaleWithDifficulty(); if (Projectile.ai[0] == 1f) modifiers.SourceDamage.Flat /= 2; } 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/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs index 6e2173aa5c..2d0d52dad9 100644 --- a/Projectiles/Magic/OmicronWingman.cs +++ b/Projectiles/Magic/OmicronWingman.cs @@ -250,7 +250,7 @@ namespace CalamityMod.Projectiles.Magic texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingmanAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; diff --git a/Projectiles/Magic/OrdoSigil.cs b/Projectiles/Magic/OrdoSigil.cs index 27717cd24b..6391564561 100644 --- a/Projectiles/Magic/OrdoSigil.cs +++ b/Projectiles/Magic/OrdoSigil.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX); spawnedProjectile = true; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 18f, ModContent.ProjectileType(), (int) (Projectile.damage * 4.5f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 18f, ModContent.ProjectileType(), Projectile.damage * 6, Projectile.knockBack, Projectile.owner); } if (Projectile.localAI[0] >= 50) diff --git a/Projectiles/Magic/PerditoSigilShotCreator.cs b/Projectiles/Magic/PerditoSigilShotCreator.cs index e04665bd0c..e4f72837da 100644 --- a/Projectiles/Magic/PerditoSigilShotCreator.cs +++ b/Projectiles/Magic/PerditoSigilShotCreator.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Magic public ref float FiringTimer => ref Projectile.ai[0]; public ref float ShotsFiredCount => ref Projectile.ai[1]; - private const int TotalShots = 13; - private const int DelayBetweenShots = 4; + private const int TotalShots = 18; + private const int DelayBetweenShots = 3; private const float ShotSpeed = 17f; private const float SpawnRadius = 150f; // Radius around the cursor where shots spawn @@ -61,5 +61,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); } } + + 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/PurgeGuzzlerHoldout.cs b/Projectiles/Magic/PurgeGuzzlerHoldout.cs index a465def812..1a04bce268 100644 --- a/Projectiles/Magic/PurgeGuzzlerHoldout.cs +++ b/Projectiles/Magic/PurgeGuzzlerHoldout.cs @@ -58,6 +58,15 @@ namespace CalamityMod.Projectiles.Magic return; } + if ((shootingTimer >= 10 && revFrames < 150) || (revFrames >= 150 && !isOnCooldown)) + { + if (!Owner.CheckMana(Owner.HeldItem, -1, true)) + { + Projectile.Kill(); + return; + } + } + revSpeed = Utils.Remap(revFrames, 0, 150, 1, 3, true); if (shootingTimer >= 10 && revFrames < 150) { 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/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 2858155357..caf48208a1 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -133,6 +133,16 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.FinalExtraUpdate()) Time++; + if (Time % 12f == 11f) + { + if (!Owner.CheckMana(Owner.HeldItem, -1, true)) + { + DeathCounter = 1f; + Projectile.netUpdate = true; + return; + } + } + // Set the hover offset to a zero vector after enough time has passed and the projectile is powerful/tame enough. bool tame = CurrentPower > 0.97f; if (tame) 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/TerraSigil.cs b/Projectiles/Magic/TerraSigil.cs index 578d0d49f9..e9838cd000 100644 --- a/Projectiles/Magic/TerraSigil.cs +++ b/Projectiles/Magic/TerraSigil.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 targetDirection = Projectile.Center.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX); spawnedProjectile = true; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 32f, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetDirection * 32f, ModContent.ProjectileType(), Projectile.damage * 3, Projectile.knockBack, Projectile.owner); } if (Projectile.localAI[0] >= 50) diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index 406697d659..e188baaf9b 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -16,7 +16,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - [PierceResistException] public class Teslabeam : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/UnstableCastersGauntletHoldout.cs b/Projectiles/Magic/UnstableCastersGauntletHoldout.cs index 5c2a940d07..e54fd5f2bc 100644 --- a/Projectiles/Magic/UnstableCastersGauntletHoldout.cs +++ b/Projectiles/Magic/UnstableCastersGauntletHoldout.cs @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Magic // Spawn needle if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * 35f).RotatedBy(Main.rand.NextFloat(-0.07f, 0.07f)), ModContent.ProjectileType(), (int) (Projectile.damage * 0.8f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * 35f).RotatedBy(Main.rand.NextFloat(-0.07f, 0.07f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); shootingTimer = 0f; } else 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/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 7e270ed227..b8220ff855 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,4 +1,5 @@ using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -78,6 +79,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.ApplyScalingForcedCrit(Projectile); + } + public override void OnKill(int timeLeft) { if (explode) diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 131d9f4eb6..a1f4663222 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,7 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.ApplyScalingForcedCrit(Projectile); if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.88f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 8a061d7cf4..a37f329c4f 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -109,6 +110,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Daybreak, 180); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.ApplyScalingForcedCrit(Projectile); + } + public override void OnKill(int timeLeft) { if (Projectile.owner != Main.myPlayer) diff --git a/Projectiles/Magic/WarpSigil.cs b/Projectiles/Magic/WarpSigil.cs index 191ff61d2e..20555dd70f 100644 --- a/Projectiles/Magic/WarpSigil.cs +++ b/Projectiles/Magic/WarpSigil.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] >= 25 && !spawnedProjectile) { // ai[1] and ai[2] will inherit this sigil's position and timeLeft as its own - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.whoAmI, Projectile.timeLeft); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, Projectile.whoAmI, Projectile.timeLeft); spawnedProjectile = true; } 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/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs index 9b83bbff90..91908a5fc2 100644 --- a/Projectiles/Magic/WingmanHoldout.cs +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -265,7 +265,7 @@ namespace CalamityMod.Projectiles.Magic else texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/WingmanAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; 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..dc4167d4af 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() @@ -70,6 +69,7 @@ namespace CalamityMod.Projectiles.Melee } else if (homeTracker == 1) { + int inc; Projectile.rotation -= MathHelper.Pi / 30f; Vector2 projCenter = Projectile.Center; float homingRange = 150f; @@ -140,8 +140,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/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index ed61618cec..89be812015 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -147,9 +147,9 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; } - //Reduce the projectile's damage by 160 for a second. - if (proj.Calamity().flatDR < 160) - proj.Calamity().flatDR = 160; + //Reduce the projectile's damage by 120 for a second. + if (proj.Calamity().flatDR < 120) + proj.Calamity().flatDR = 120; if (proj.Calamity().flatDRTimer < 60) proj.Calamity().flatDRTimer = 60; break; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 65c40923ae..61b280bfe1 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -146,9 +146,9 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; } - //Reduce the projectile's damage by 100 for a second. - if (proj.Calamity().flatDR < 100) - proj.Calamity().flatDR = 100; + //Reduce the projectile's damage by 60 for a second. + if (proj.Calamity().flatDR < 60) + proj.Calamity().flatDR = 60; if (proj.Calamity().flatDRTimer < 60) proj.Calamity().flatDRTimer = 60; break; diff --git a/Projectiles/Melee/BalefulHarvesterHoldout.cs b/Projectiles/Melee/BalefulHarvesterHoldout.cs index 19382f94d0..7f505a7c99 100644 --- a/Projectiles/Melee/BalefulHarvesterHoldout.cs +++ b/Projectiles/Melee/BalefulHarvesterHoldout.cs @@ -19,10 +19,11 @@ namespace CalamityMod.Projectiles.Melee public override int AssignedItemID => ModContent.ItemType(); public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/BalefulHarvester"; - public override float HitboxOutset => 90; - public override Vector2 HitboxSize => new Vector2(140, 140); + public int size = 106; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 96); public Vector2 mousePos; public Vector2 aimVel; @@ -44,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -161,8 +161,8 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) { Vector2 sparkVel = Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * (3.5f * Owner.direction); - Vector2 sparkPos = Owner.Center + Vector2.UnitX.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Main.rand.Next(80, 140); - CustomSprite critSpark = new(sparkPos, sparkVel, 15, "CalamityMod/Particles/CritSpark", 1f, Color.Orange, frameCount: 4, frame: Main.rand.Next(4)); + Vector2 sparkPos = Owner.Center + Vector2.UnitX.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Main.rand.Next(80, 140) * Projectile.scale; + CustomSprite critSpark = new(sparkPos, sparkVel, 15, "CalamityMod/Particles/CritSpark", 1f * Projectile.scale, Color.Orange, frameCount: 4, frame: Main.rand.Next(4)); GeneralParticleHandler.SpawnParticle(critSpark); } } @@ -220,16 +220,16 @@ namespace CalamityMod.Projectiles.Melee Rectangle vanillaSmearFrame = vanillaSmear.Frame(1, 4, 0, 0); Asset smear = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); float smearOpacity = CalamityUtils.Convert01To010(time / timeMax); - Main.EntitySpriteDraw(vanillaSmear.Value, Projectile.Center - Main.screenPosition, vanillaSmearFrame, new Color(193, 83, 43) * smearOpacity * 0.75f, FinalRotation - MathHelper.PiOver2, vanillaSmearFrame.Size() / 2f, 1.25f, SpriteEffects.None); - Main.EntitySpriteDraw(smear.Value, Projectile.Center - Main.screenPosition, null, new Color(247, 115, 0) * smearOpacity, FinalRotation, smear.Size() / 2f, 1.8f, SpriteEffects.None); + Main.EntitySpriteDraw(vanillaSmear.Value, Projectile.Center - Main.screenPosition, vanillaSmearFrame, new Color(193, 83, 43) * smearOpacity * 0.75f, FinalRotation - MathHelper.PiOver2, vanillaSmearFrame.Size() / 2f, 1.25f * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, Projectile.Center - Main.screenPosition, null, new Color(247, 115, 0) * smearOpacity, FinalRotation, smear.Size() / 2f, 1.8f * Projectile.scale, SpriteEffects.None); if (smearOpacity > 0.65f) { Vector2 sparklePos = Projectile.Center - Main.screenPosition - (Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.PiOver4 * Owner.direction) * 120f); Asset bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); - Main.EntitySpriteDraw(bloom.Value, sparklePos, null, Color.White * 0.75f, 0f, bloom.Size() / 2f, 0.2f, SpriteEffects.None); + Main.EntitySpriteDraw(bloom.Value, sparklePos, null, Color.White * 0.75f, 0f, bloom.Size() / 2f, 0.2f * Projectile.scale, SpriteEffects.None); Asset sparkle = ModContent.Request("CalamityMod/Particles/FullStar"); - Main.EntitySpriteDraw(sparkle.Value, sparklePos, null, Color.Orange, 0f, sparkle.Size() / 2f, 2f, SpriteEffects.None); + Main.EntitySpriteDraw(sparkle.Value, sparklePos, null, Color.Orange, 0f, sparkle.Size() / 2f, 2f * Projectile.scale, SpriteEffects.None); } } Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); 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/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index 3428fbe1dc..0b18cbdea0 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -16,7 +16,6 @@ using static Terraria.Player; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class BasherHoldout : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -265,7 +264,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearThin").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + ((Owner.direction == -1) ? MathHelper.Pi - MathHelper.PiOver4 : MathHelper.PiOver4); diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs index 500a311afe..9b7ff2326a 100644 --- a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs +++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs @@ -89,6 +89,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + Projectile.scale = Owner.GetMeleeScale(); if ((CurrentState & State.HasSpawned) == 0) { Projectile.timeLeft = Lifetime + ChargeupTime; @@ -99,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee { foreach (var target in Main.ActiveNPCs) { - if ((CurrentState & State.LeftTarget) == 0 && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), target.getRect())) + if ((CurrentState & State.LeftTarget) == 0 && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1) * Projectile.scale, target.getRect())) { SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); @@ -166,7 +168,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.Center = Owner.MountedCenter + toMouse * 12f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; CurrentState |= State.Thrown; time = 0; @@ -242,17 +244,18 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { Dust dust = Dust.NewDustPerfect( - Projectile.Center + safeVel.RotatedBy((CurrentState & State.LeftTarget) != 0 ? Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45) : 0) * ((CurrentState & State.LeftTarget) != 0 ? 45 : 60), - ModContent.DustType(), + Projectile.Center + safeVel.RotatedBy((CurrentState & State.LeftTarget) != 0 ? Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45) : 0) * ((CurrentState & State.LeftTarget) != 0 ? 45 : 60) * Projectile.scale, + ModContent.DustType(), dustVel, 0, default, - ((CurrentState & State.LeftTarget) != 0 ? 1.5f : 1) * Main.rand.NextFloat(0.8f, 0.9f)); + ((CurrentState & State.LeftTarget) != 0 ? 1.5f : 1) * Main.rand.NextFloat(0.8f, 0.9f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; + dust.fadeIn = Projectile.scale - 1; } } if (Main.rand.NextBool(5)) @@ -263,7 +266,7 @@ namespace CalamityMod.Projectiles.Melee texture: "CalamityMod/Particles/DemonSigilParticle", affectedByGravity: false, lifetime: 17, - scale: Main.rand.NextFloat(0.2f, 0.3f), + scale: Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, color: Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat(0, 0.7f)) * 0.6f, stretch: new Vector2(1f, 1f), extraRotation: Main.rand.NextFloat(-1f, 1f)); @@ -297,13 +300,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } @@ -318,7 +322,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -394,7 +398,7 @@ namespace CalamityMod.Projectiles.Melee // After exiting a target, the hitbox is larger public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - => (Projectile.numHits <= 0 || (CurrentState & State.LeftTarget) != 0) && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), targetHitbox); + => (Projectile.numHits <= 0 || (CurrentState & State.LeftTarget) != 0) && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1) * Projectile.scale, targetHitbox); public override bool PreDraw(ref Color lightColor) { 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_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index 8205cb5f9a..28d47d91e0 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -150,13 +150,11 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != Owner.whoAmI) return; - // Get lifted up + if (PogoCooldown <= 0) { SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); // Sizzle Shred += 62; // Augment the shred speed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; // Get "stuck" into the enemy partly // 17APR2024: Ozzatron: Broken Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. 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/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index 31e478ef7c..20d403c4a6 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -48,6 +50,12 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + if (Owner.HeldItem.ModItem is not BrokenBiomeBlade || (Owner.HeldItem.ModItem as BrokenBiomeBlade).mainAttunement != AttunementSystem.FindOrNull(AttunementID.Default)) + { + Projectile.Kill(); + return; + } + if (CanHit || postSwing) mousePos = Owner.Center - aimPos; else diff --git a/Projectiles/Melee/BurningHolyBlast.cs b/Projectiles/Melee/BurningHolyBlast.cs index bf2e0d5981..5837114826 100644 --- a/Projectiles/Melee/BurningHolyBlast.cs +++ b/Projectiles/Melee/BurningHolyBlast.cs @@ -35,6 +35,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.damage = 1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0], targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0] * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 61dafb5b13..2499c312b7 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -31,7 +31,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 180; Projectile.ignoreWater = true; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { int randomToSubtract = Main.rand.Next(1, 4); diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index 08ff873084..31284e82c0 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/CometQuasher"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(110, 110); + public int size = 94; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(-4, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 96); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -45,7 +44,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning @@ -159,20 +157,20 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (i % 2 == 0) { - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } else { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f), 0.75f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.75f, 0, true)); } } - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; @@ -221,7 +219,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + meteor.scale = Projectile.scale; spawnBoom = false; } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index 6627821de0..c5ed0d8f22 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Melee { if (time % 11 == 0) { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); + GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20) * Projectile.scale - Projectile.velocity * 2, -Projectile.velocity * 2, false, 11, 0.025f * Projectile.scale, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); GeneralParticleHandler.SpawnParticle(orb); } if (time % 4 == 0) - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f) * Projectile.scale, 0.65f, 0, true)); } if (Main.rand.NextBool(13)) { @@ -120,7 +120,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[2] > 0) { Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (Projectile.owner == Main.myPlayer) @@ -132,13 +133,16 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 13; i++) { - Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); + Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f) * Projectile.scale, Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); GeneralParticleHandler.SpawnParticle(spark3); } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } 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/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 093afc45b2..acb46b317d 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -29,15 +29,14 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; - public float hitboxMult = 1.3f; public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); public SlotId SoundSlot; - public override float HitboxOutset => 335; - - public override Vector2 HitboxSize => new Vector2(395, 395) * hitboxMult; + public int size = 118 + 285; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 285); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 118); + public override float AdditionalScale => 0.15f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -78,7 +77,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -284,8 +282,8 @@ namespace CalamityMod.Projectiles.Melee float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; float randRot = Main.rand.NextFloat(-30, 30); Vector2 dustVel = -Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)).RotatedByRandom(0.3f) * Main.rand.NextFloat(7, 17) - Owner.velocity * 0.8f; - Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); + Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10 * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); } if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active) { @@ -348,16 +346,17 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 8; i++) { float randRot = Main.rand.NextFloat(-20, -100); - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(520 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-20, -100); Vector2 dustVel = (new Vector2(0, 11 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); + Vector2 placement = Owner.Center + (new Vector2(520, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); } } } @@ -480,27 +479,29 @@ namespace CalamityMod.Projectiles.Melee if (true) { Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomLineAngled"); - int draws = 30; + int draws = 60; for (int i = 0; i < draws; i++) { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 25 + i * 6); + float newSine = 0.3f + (0.7f - sine * 0.25f) * Utils.Remap(i, 0, draws, 0.8f, 0.6f); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); - Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (willDie ? deathFade : 1); - Vector2 drawOffset = -offsetDir * 10 * deathFade * i; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(18, 18), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.02f) * 0.06f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + float jitter = Utils.Remap(i, 0, draws / 2, 10, 0f) * deathFade; + Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (Utils.Remap(jitter, 0, 10, 1, 3.5f)) * (willDie ? deathFade : 1); + Vector2 drawOffset = -offsetDir * 5 * deathFade * i * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 30 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(jitter, jitter), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation.ToRotationVector2().RotatedByRandom(jitter * 0.085f).ToRotation() + RotationOffset + r, new Vector2(FlipAsSword ? tex2.Width() : 0, tex2.Height()), Vector2.One * (1f - i * 0.01f) * 0.06f * Projectile.scale * newSine * Utils.Remap(jitter, 0, 10, 1, 0.3f), spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } } for (int i = 0; i < 20; i++) { Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : 1); - Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 7 * (willDie ? (1 - deathFade) * 3 : 2); - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(7, 7), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 2 * (willDie ? (1 - deathFade) * 3 : 2); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(4, 4), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } if ((useAnim > 0 || DrawUnconditionally)) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.9f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.2f * hitboxMult, SpriteEffects.None); - + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.3f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.75f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs index 2daec84626..abc143e1bb 100644 --- a/Projectiles/Melee/DevilsDevastationThrownBlade.cs +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; + Projectile.scale = Owner.GetMeleeScale(); } } @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 30f; + Projectile.Center = Owner.MountedCenter + toMouse * 30f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -211,32 +212,28 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f * Projectile.scale, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark2); } float rot = Projectile.rotation + (MathHelper.TwoPi * i); Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); if (exitedTarget && i == 0) { - //Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 60, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); - //dust.noGravity = true; - //dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; - - - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * Projectile.scale).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); dust2.noGravity = (dust2.type == 278 ? false : true); - dust2.scale = dust2.type == 278 ? 0.75f : 0.9f; + dust2.scale = (dust2.type == 278 ? 0.75f : 0.9f) * Projectile.scale; dust2.color = Main.rand.NextBool() ? Color.BlueViolet : clr; dust2.velocity = (vel * 2).RotatedByRandom(0.4f); + dust2.fadeIn = (dust2.type == 278 ? 0 : Projectile.scale - 1); } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -274,13 +271,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void ThrowAnimation(float chargeProgress) @@ -294,7 +292,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -391,7 +389,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/DevilsDevastation").Value; @@ -409,9 +407,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f), Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 9fdf15536d..08a801efe8 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -12,7 +12,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class DevilsSunriseProj : ModProjectile { public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 0.8f }; diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 40ea618ffa..d0ed429bd5 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -31,15 +31,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = lifeTime; Projectile.DamageType = DamageClass.Melee; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * Projectile.scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { if (Projectile.ai[0] == 0f) { - Projectile.ai[0] = Main.rand.NextFloat(40f, 70f); + Projectile.ai[0] = Main.rand.NextFloat(20f, 40f); Projectile.ai[1] = Main.rand.NextFloat(35f, 55f); } - target = Projectile.Center.ClosestNPCAt(1200f); + if (target != null && !target.CanBeChasedBy()) + target = null; + if (target is null) + target = GetTargetInRange(1200f); Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -62,6 +69,29 @@ namespace CalamityMod.Projectiles.Melee } } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + NPC gotTarget = null; + int currentHP = -1; + float distance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && ((myDistance < range && currentHP < npc.life) || (myDistance < distance && currentHP <= npc.life))) + { + distance = myDistance; + currentHP = npc.life; + gotTarget = npc; + } + } + return gotTarget; + + } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) @@ -76,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(80); + Projectile.ExpandHitboxBy(80 * Projectile.scale); for (int d = 0; d < 5; d++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); @@ -145,6 +175,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.Damage(); } + public override bool? CanHitNPC(NPC target) + { + if (this.target != null && target.whoAmI != this.target.whoAmI) + return false; + return base.CanHitNPC(target); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 5286f392d9..71926dabb9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -14,7 +14,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class DragonRageStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -30,13 +29,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.hide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = -1; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { Player player = Main.player[Projectile.owner]; float spinCycleTime = 50f; + Projectile.scale = 0.85f * player.GetMeleeScale(); // If the player is dead, destroy the projectile if (player.dead || !player.channel) @@ -70,6 +71,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; Projectile.netUpdate = true; } + + if (Projectile.ai[0] % 5 == 0) + { + Projectile.numHits = 0; + Projectile.ResetLocalNPCHitImmunity(); + } SpawnDust(player, direction); PositionAndRotation(player); VisibilityAndLight(); @@ -143,9 +150,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (target.Calamity().IsArmored()) + Projectile.numHits--; //don't pierce falloff on targets it can't really damage target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(target.Center); } @@ -160,14 +168,12 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); - modPlayer.dragonRageHits++; - if (modPlayer.dragonRageHits >= 10 && modPlayer.dragonRageCooldown <= 0) + if (modPlayer.dragonRageCooldown <= 0) { SpawnFireballs(); - modPlayer.dragonRageHits = 0; } - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (1 - (0.25f * Projectile.numHits))*0.25f) , Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].DamageType = DamageClass.Melee; } } @@ -183,13 +189,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 velocity = new Vector2(0f, speed); velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); + Projectile fire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 3f, Projectile.owner); + fire.scale = Projectile.scale; } - Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; + Main.player[Projectile.owner].Calamity().dragonRageCooldown = 120; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.SourceDamage *= 1 - (0.25f * Projectile.numHits); Player player = Main.player[Projectile.owner]; Rectangle myRect = Projectile.Hitbox; if (Projectile.owner == Main.myPlayer) @@ -238,12 +246,14 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + Vector2 newSize = new Point(projHitbox.Width, projHitbox.Height).ToVector2() * Projectile.scale; + projHitbox = new Rectangle(projHitbox.X - (int)((newSize.X - projHitbox.Width) / 2f), projHitbox.Y - (int)((newSize.Y - projHitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); if (projHitbox.Intersects(targetHitbox)) { return true; } float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); - float staffRadiusHit = 110f; + float staffRadiusHit = 110f * Projectile.scale; float useless = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref useless)) { diff --git a/Projectiles/Melee/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs index baf5c2aef5..1fd4fb8a29 100644 --- a/Projectiles/Melee/DragoonBigBolt.cs +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -52,21 +52,21 @@ namespace CalamityMod.Projectiles.Melee if (time < 120) { float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3 * sizeMult); - Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); + Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult * Projectile.scale, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); GeneralParticleHandler.SpawnParticle(spark3); sizeMult *= 0.97f; } - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(10)) { - Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true); + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult * Projectile.scale, usedColor, new Vector2(1, 4), true, true); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -80,9 +80,9 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 1.48f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 0.925f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1); + float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1) * Projectile.scale; Player Owner = Main.player[Projectile.owner]; if (time <= 1 && Projectile.ai[1] != 0.5f) { diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs index d230a95b11..66e1f1a513 100644 --- a/Projectiles/Melee/DragoonSmallBolt.cs +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 pos = Projectile.Center; if (Projectile.timeLeft % 3 == 0) { - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Melee if (time <= 1) { float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25 * Projectile.scale, ref _); } else - return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * Projectile.scale, targetHitbox); } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/EarthBoom.cs b/Projectiles/Melee/EarthBoom.cs index b71021e706..b0080b8a33 100644 --- a/Projectiles/Melee/EarthBoom.cs +++ b/Projectiles/Melee/EarthBoom.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = Projectile.height = 500; + Projectile.width = Projectile.height = 620; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -26,6 +26,6 @@ namespace CalamityMod.Projectiles.Melee { } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index c51b91ec44..c91ce030e4 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -22,11 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; - public override float HitboxOutset => 135; - public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); + public int size = 186 + 30; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size) * (1 + bladeFade * 1.25f); + public override Vector2 SpriteOrigin => new(0, size - 30); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -52,7 +54,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning @@ -195,22 +196,21 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f), mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f) * Projectile.scale, mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); } for (int i = 0; i < 6; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (Main.rand.NextBool(3)) { - Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f) * Projectile.scale, mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } else { - GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); - //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, Main.rand.NextFloat(-0.1f, 0.1f), true)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); } } } @@ -237,10 +237,10 @@ namespace CalamityMod.Projectiles.Melee float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f) * Projectile.scale, 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, DustID.FireworksRGB, dustVel); dust2.scale = Main.rand.NextFloat(0.65f, 1.05f); dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); @@ -294,7 +294,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = chosenTarget.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + meteor.scale = Projectile.scale; } spawnBoom = false; @@ -349,7 +350,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. - float spriteMult = 1.13f; if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); @@ -370,26 +370,27 @@ namespace CalamityMod.Projectiles.Melee { if (swingCount % 2 != 0) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.FlipVertically); } else - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f * 1.6f / 4, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.423f, SpriteEffects.None); } Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); - int draws = 24; + int draws = 45; for (int i = 0; i < draws; i++) { bool swordTip = i > draws * 0.73f; - float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; + float swordTipScale = (swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); - Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; - Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.3f * bladeFade; + Vector2 drawOffset = -offsetDir * 5 * i * bladeFade * Projectile.scale; + float bladeHiltMult = (MathHelper.Lerp(1.55f, 1, 1 - MathF.Pow(Utils.GetLerpValue(i > draws * 0.08f ? draws * 0.55f : 0, draws * 0.04f, i, true), 5))); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale * MathF.Pow(bladeHiltMult, 0.6f), 0.5f / bladeHiltMult) * (0.75f * swordTipScale) * 0.9f * bladeFade * bladeHiltMult * Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs index 8acfbb5dd5..3b5754c090 100644 --- a/Projectiles/Melee/EarthMeteor.cs +++ b/Projectiles/Melee/EarthMeteor.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); NPC targeted = Projectile.ai[1] == 0 ? Owner.ClampedMouseWorld().ClosestNPCAt(1000) : Main.npc[(int)Projectile.ai[1]]; - Projectile.scale = 1.2f; randomColor = Main.rand.Next(3) switch { 0 => Color.OrangeRed, @@ -90,7 +89,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = targeted.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (time == fallTime) { @@ -120,26 +120,29 @@ namespace CalamityMod.Projectiles.Melee // Spawn in a helix-style pattern float sine = (float)Math.Sin(Projectile.timeLeft * 0.475f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn); + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn) * Projectile.scale; if (targetDist < 1400f && time % 2 == 0) { - CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb); - CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb2); } } else { - float randSize = Main.rand.NextFloat(0.8f, 1.2f); - for (int i = 0; i < 2; i++) + float randSize = Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale; + if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom); + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom3); } - Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom3); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -149,10 +152,12 @@ namespace CalamityMod.Projectiles.Melee Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); if (time <= fallTime) return false; - - for (int i = 0; i < 10; i++) + if (!CalamityClientConfig.Instance.Photosensitivity) { - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + for (int i = 0; i < 10; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } } return false; @@ -169,7 +174,8 @@ namespace CalamityMod.Projectiles.Melee { Player Owner = Main.player[Projectile.owner]; Owner.SetScreenshake(4.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + Projectile boom = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + boom.scale = Projectile.scale; for (int i = 0; i < 15; i++) { randomColor = Main.rand.Next(3) switch @@ -183,29 +189,30 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = false; dust2.color = Color.Lerp(Color.White, randomColor, 0.5f); - Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f) * Projectile.scale, randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } - - for (int i = 0; i < 3; i++) - { - string tex = "CalamityMod/Particles/ShatteredExplosion"; - Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, 0.5f - i * 0.08f, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt1); - Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, 0.4f - i * 0.08f, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, 0.35f - i * 0.08f, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt3); - } SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center); if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); + for (int i = 0; i < 3; i++) + { + string tex = "CalamityMod/Particles/ShatteredExplosion"; + Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, (0.5f - i * 0.08f) * Projectile.scale, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt1); + Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, (0.4f - i * 0.08f) * Projectile.scale, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, (0.35f - i * 0.08f) * Projectile.scale, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt3); + + } + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f * Projectile.scale, 3f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f * Projectile.scale, 2f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing2); } } 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 f7182884f2..958db0e7f4 100644 --- a/Projectiles/Melee/EvilSmasherProjectile.cs +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -1,18 +1,12 @@ using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Sounds; -using Humanizer; 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; @@ -30,9 +24,11 @@ namespace CalamityMod.Projectiles.Melee public override int OffsetDistance => 50; public override int CooldownTime { get; set; } public override bool AlternateSwings => false; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override SoundStyle? UseSound => SoundID.DD2_MonkStaffSwing with {Volume = 1f}; + public ref float CurrentChargeMult => ref Projectile.ai[0]; + bool hasSmashedTile = false; bool playedChargeSound = false; bool firstEnemyHit = true; @@ -45,6 +41,7 @@ namespace CalamityMod.Projectiles.Melee RotateInStartup = 0; Projectile.width = 64; Projectile.height = 66; + Projectile.DamageType = AllClassDamageClass.Instance; } public override void Spawn() @@ -58,15 +55,14 @@ namespace CalamityMod.Projectiles.Melee modplayer.swingNum = 0; Projectile.timeLeft = 600; Projectile.scale *= 1.25f; - Projectile.originalDamage = Projectile.damage; } public override void AdditionalAI() { if (inStartup) { - Projectile.damage = (int)(Projectile.originalDamage * (timer / (float)(StartupTime-1))); - Owner.velocity.X *= 0.97f; + CurrentChargeMult = timer / (float)(StartupTime-1); + Owner.velocity.X *= CurrentChargeMult < 1 ? 0.98f : 0.995f; } if (inStartup && !Owner.channel && timer > 30) { @@ -76,8 +72,10 @@ namespace CalamityMod.Projectiles.Melee { Projectile.timeLeft++; timer--; - if (!playedChargeSound) { - SoundEngine.PlaySound(SoundID.Item178,Projectile.Center); + if (!playedChargeSound) + { + SoundEngine.PlaySound(SoundID.DeerclopsStep with { Volume = 2f, Pitch = 0.5f }, Projectile.Center); + SoundEngine.PlaySound(Murasama.InorganicHit with { Pitch = -0.5f }, Projectile.Center); playedChargeSound = true; for (int i = 0; i < 5; i++) { @@ -102,31 +100,33 @@ namespace CalamityMod.Projectiles.Melee { Owner.velocity *= 0.15f; - Owner.velocity -= adjustedAngle.RotatedBy(MathHelper.PiOver2) * angle.X * MathHelper.Lerp(7.5f,16f,Projectile.damage / (float)Projectile.originalDamage); + 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 + Projectile.damage / (float)Projectile.originalDamage), 15)); - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.2f, 0.75f * (2 + Projectile.damage / (float)Projectile.originalDamage), 30)); - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.1f, 0.5f * (2 + Projectile.damage / (float)Projectile.originalDamage), 30)); - int radius = (int)(4 * Projectile.damage / (float)Projectile.originalDamage); + 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)); + GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.1f, 0.5f * (2 + CurrentChargeMult), 30)); + int radius = (int)(4 * CurrentChargeMult); Point scanAreaStart = HammerFrontPos.ToTileCoordinates() + new Point(-radius, -radius); Point scanAreaEnd = HammerFrontPos.ToTileCoordinates() + new Point(radius, radius); - Projectile.CreateImpactExplosion((int)(10 * Projectile.damage / (float)Projectile.originalDamage), Projectile.Center, ref scanAreaStart, ref scanAreaEnd, Projectile.width, out bool causedShockwaves); + Projectile.CreateImpactExplosion((int)(10 * CurrentChargeMult), Projectile.Center, ref scanAreaStart, ref scanAreaEnd, Projectile.width, out bool causedShockwaves); hasSmashedTile = true; timer = StartupTime + swingTime; angle = adjustedAngle; var pos = Projectile.Center; - Projectile.Size *= 2 + Projectile.damage / (float)Projectile.originalDamage; + Projectile.Size *= 2 + CurrentChargeMult; Projectile.Center = HammerFrontPos; Projectile.Damage(); - Projectile.Size /= 2 + Projectile.damage / (float)Projectile.originalDamage; + Projectile.Size /= 2 + CurrentChargeMult; Projectile.Center = pos; - if ((Projectile.damage / (float)Projectile.originalDamage) >= 1) + if (CurrentChargeMult >= 1) SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with {VariantsWeights = new ReadOnlySpan(new float[] { 1, 0, 0 })}); SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact); } } + if (CooldownTimer == 1) + Owner.Calamity().ConsumeStealthByAttacking(); Owner.heldProj = Projectile.whoAmI; } @@ -141,9 +141,13 @@ namespace CalamityMod.Projectiles.Melee return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * .66f, (swingWidth * 0.33f), SwingCompletion)); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= CurrentChargeMult; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (firstEnemyHit && Main.rand.NextFloat() < (Projectile.damage / (float)Projectile.originalDamage)) + if (firstEnemyHit && Main.rand.NextFloat() < CurrentChargeMult) { string text = ""; if (target.life > 0) @@ -161,7 +165,7 @@ namespace CalamityMod.Projectiles.Melee CombatText.NewText(Projectile.Hitbox, Color.Lerp(Color.DarkGray,Color.Gold, intense ? 0.25f: 0.1f), text, intense); firstEnemyHit = false; } - if (!hasSmashedTile && (Projectile.damage / (float)Projectile.originalDamage) >= 1) + if (!hasSmashedTile && CurrentChargeMult >= 1) { for (int i = 0; i < 16; i++) { @@ -184,8 +188,9 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item69 with { Volume = 1f, LimitsArePerVariant = false, MaxInstances = 1 }); } - target.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, Projectile.damage / (float)Projectile.originalDamage)); - Owner.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, Projectile.damage / (float)Projectile.originalDamage)); + + 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) @@ -193,7 +198,7 @@ namespace CalamityMod.Projectiles.Melee if (!inCooldown) { var tex = ModContent.Request(Texture + "Glow").Value; - float outlineWidth = (int)(4 * (Projectile.damage / (float)Projectile.originalDamage)) * 0.5f; + float outlineWidth = (int)(4 * CurrentChargeMult) * 0.5f; if (inSwing) { outlineWidth *= 1 - SwingCompletion; diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 279b825edd..f51c6b8198 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ExaltedOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 70; - - public override Vector2 HitboxSize => new Vector2(155, 155) * hitboxMult; + public int size = 88 + 20; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 20); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 88); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -218,14 +217,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); + Vector2 placement = Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } } @@ -336,7 +336,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.35f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.455f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index 2e35aee3ab..b50aac643e 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + Projectile.scale = Owner.GetMeleeScale(); float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.spriteDirection = Projectile.direction; @@ -153,20 +155,21 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); GeneralParticleHandler.SpawnParticle(spark); } if (exitedTarget && i == 0 && Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -196,13 +199,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation() @@ -215,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -338,7 +342,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExaltedOathblade").Value; @@ -356,8 +360,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f, SpriteEffects.None); + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f * Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index ba2800c800..c3f9e30adc 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(120, 120) * hitboxMult; + public int size = 74 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 74); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -274,13 +273,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 placement = Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } @@ -383,7 +383,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.29f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.377f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs index 3f80950563..87501574ab 100644 --- a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.scale = Owner.GetMeleeScale(); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; } @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.Center = Owner.MountedCenter + toMouse * 12f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -197,16 +198,17 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(90 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4); if (!exitedTarget && Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60 * Projectile.scale, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 50; + dust.fadeIn = Projectile.scale - 1; } if (exitedTarget && i == 0) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; } @@ -214,7 +216,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -252,13 +254,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation(float chargeProgress) @@ -272,7 +275,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -395,7 +398,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ForbiddenOathblade").Value; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 630fa6b82b..3a9fdc0eeb 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -256,7 +256,7 @@ namespace CalamityMod.Projectiles.Melee float distanceToTiles = -100; bool canBeLaunched = false; - bool lowEnoughToExecute = target.life <= Projectile.damage * 15; + bool lowEnoughToExecute = target.life <= Projectile.damage * 5; bool jared = target.type == ModContent.NPCType(); Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); Vector2 launchVel = lowEnoughToExecute ? toMouse : Utils.DirectionTo(Owner.Center, target.Center); @@ -274,7 +274,7 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); } - int heal = (int)(MathHelper.Clamp(18 - Projectile.numHits * 13, 1, 20)); + int heal = Projectile.numHits == 0 ? 14 : 0; if (Projectile.numHits < 10) { Owner.Calamity().grandDadHealPool += heal; @@ -316,12 +316,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Particle spark = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark2", false, (int)(16 - Projectile.numHits * 3), 0.145f - Projectile.numHits * 0.015f, Color.Black, new Vector2(2f, 1f), false, shrinkSpeed: 1f, colorFadeSpeed: 10); - GeneralParticleHandler.SpawnParticle(spark); - spark.Pixelate = true; + GeneralParticleHandler.SpawnParticle(spark, true); Particle spark2 = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark", false, (int)(16 - Projectile.numHits * 3), 0.105f - Projectile.numHits * 0.015f, Color.Lerp(Color.Blue, Color.DodgerBlue, 0.65f), new Vector2(2f, 1f), true, false, shrinkSpeed: 1f, colorFadeSpeed: 10); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.Pixelate = true; - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, true, GeneralDrawLayer.AfterEverything); } for (int i = 0; i < 25 - Projectile.numHits * 3; i++) @@ -369,7 +366,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D swoosh = ModContent.Request("CalamityMod/Particles/CircularSmearLarge").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + ((Owner.direction == -1) ? MathHelper.Pi - MathHelper.PiOver4 : MathHelper.PiOver4); diff --git a/Projectiles/Melee/GrandGuardianBoom.cs b/Projectiles/Melee/GrandGuardianBoom.cs index 271653a439..e3f7991409 100644 --- a/Projectiles/Melee/GrandGuardianBoom.cs +++ b/Projectiles/Melee/GrandGuardianBoom.cs @@ -28,23 +28,24 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + Projectile.scale = Projectile.ai[0]; if (mainColor == Color.White) { mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; - Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 35); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * Projectile.scale, 35); GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f, 15); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(bolt3); for (int i = 0; i < 25; i++) { Vector2 dustVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * 1; - Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9 * Projectile.scale, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f)); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9 * Projectile.scale, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f) * Projectile.scale, 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); } } @@ -55,6 +56,6 @@ namespace CalamityMod.Projectiles.Melee } time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 6ab245f9cd..49e9347310 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; - public override float HitboxOutset => 112; - - public override Vector2 HitboxSize => new Vector2(180, 180); + public int size = 130 + 15; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 15); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(-3, 130); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles @@ -151,8 +150,8 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f) * Projectile.scale, Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue)); } } else @@ -171,10 +170,10 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(198, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(198 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f) * Projectile.scale, 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; @@ -198,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner, Projectile.scale); spawnBoom = false; } diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 7a185698b5..7b5e9eb869 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/Hellkite"; public override float HitboxOutset => 100; - public override Vector2 HitboxSize => new Vector2(185, 185) * Projectile.scale; + public override Vector2 HitboxSize => new Vector2(185, 185); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(-3, 124); @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee { CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles @@ -119,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; Vector2 bladePos = new Vector2(60, 0); - Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Projectile.scale; if (Projectile.ai[2] == 5) { @@ -157,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee } if (chargeTimer == chargeTimerMax) { - particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Projectile.scale; SoundEngine.PlaySound(Hellkite.FullChargeSound with { Volume = 0.9f, PitchVariance = 0.2f }, Projectile.Center); chargedSwing = true; useAnim = storedUseAnim / 3; @@ -165,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { - Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed); + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark2); Dust dust2 = Dust.NewDustPerfect(particlePos, DustID.RainbowMk2, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); dust2.scale = Main.rand.NextFloat(0.65f, 1.15f) * fadeIn; @@ -212,7 +211,6 @@ namespace CalamityMod.Projectiles.Melee postSwing = false; if (AnimationProgress == 0) { - Projectile.scale = 1; Animation = 0; doSwing = false; chargeTimer = 0; @@ -248,13 +246,13 @@ namespace CalamityMod.Projectiles.Melee CanHit = true; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (chargedSwing) { for (int i = 0; i < 3; i++) { particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; GeneralParticleHandler.SpawnParticle(new AltSparkParticle(particlePos, -particleVel.RotatedByRandom(0.4f), false, 24, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.OrangeRed : Color.DarkRed)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f), Main.rand.NextBool(4) ? Color.Red : Color.DarkRed, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f) * 2, Main.rand.NextBool(4) ? Color.Crimson : Color.Red, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true)); @@ -287,13 +285,13 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-10, -45); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new PointParticle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), false, Main.rand.Next(15, 18 + 1), Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed) * 0.8f)); + GeneralParticleHandler.SpawnParticle(new PointParticle(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), false, Main.rand.Next(15, 18 + 1), Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed) * 0.8f)); } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.3f, 0.9f)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.3f, 0.9f)); dust2.scale = Main.rand.NextFloat(0.65f, 0.95f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; @@ -305,7 +303,7 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 959a2e1553..3b7847423b 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -25,12 +25,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/HolyCollider"; - public override float HitboxOutset => 100; - - public override Vector2 HitboxSize => new Vector2(200, 200) * Projectile.scale; + public int size = 146; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(0, 146); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = false; @@ -61,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning @@ -121,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee else Owner.direction = 1; FlipAsSword = Owner.direction == -1 ? true : false; - Vector2 bladePos = new Vector2(76, 0); + Vector2 bladePos = new Vector2(76 * Projectile.scale, 0); Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45) - 0.1f * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]); if (Projectile.ai[2] == 5) @@ -137,14 +135,15 @@ namespace CalamityMod.Projectiles.Melee if (chargeTimer < chargeTimerMax && !chargedSwing) chargeTimer++; - Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9; + Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9 * Projectile.scale; - Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * fadeIn; + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.5f, 1.4f)); + dust2.scale = Main.rand.NextFloat(1.45f, 1.95f) * fadeIn * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale * 1.5f; - Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.9f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn, Main.rand.NextBool(3) ? mainColor2 : mainColor1); + Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.6f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn * Projectile.scale, Main.rand.NextBool(3) ? mainColor2 : mainColor1); GeneralParticleHandler.SpawnParticle(spark3); if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying) @@ -172,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { - Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? mainColor2 : mainColor1); + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(3) ? mainColor2 : mainColor1); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -216,7 +215,6 @@ namespace CalamityMod.Projectiles.Melee postSwing = false; if (AnimationProgress == 0) { - Projectile.scale = 1; Animation = 0; doSwing = false; chargeTimer = 0; @@ -251,28 +249,29 @@ namespace CalamityMod.Projectiles.Melee } playSwingSound = false; } - if ( time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) + if (time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) { CanHit = true; Vector2 particleVel = new Vector2(0, 2 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170) * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); if (!chargedSwing) { for (int i = 0; i < 3; i++) { particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170) * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); if (i < 2) { - Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale - 1; } else { - Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f) * Projectile.scale, Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } } @@ -299,10 +298,10 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-10, -45); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f) * Projectile.scale, (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); if (i % 3 == 0) { - Particle spark = new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f) * Projectile.scale, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } } @@ -310,10 +309,11 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 35 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 0.9f)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.2f, 0.6f)); + dust2.scale = Main.rand.NextFloat(1.35f, 1.85f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale * 0.3f; } } else @@ -322,10 +322,11 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = -(new Vector2(0, 25 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); - dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale - 1; } } @@ -340,12 +341,13 @@ namespace CalamityMod.Projectiles.Melee projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()); bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) || isProviProj; - if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 * Projectile.scale + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) { if (isProviProj) { Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projectile.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f, ModContent.ProjectileType(), (int)((Projectile.damage * 0.1) + projectile.damage), Projectile.knockBack, Projectile.owner, 0, 15, 5); - Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + proj.localAI[0] = Projectile.scale; + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f * Projectile.scale, 11); GeneralParticleHandler.SpawnParticle(orb2); if (projectile.type == ModContent.ProjectileType()) projectile.active = false; @@ -366,13 +368,13 @@ namespace CalamityMod.Projectiles.Melee { Projectile projectile = Main.projectile[x]; bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10); - if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 * Projectile.scale + Math.Max(projectile.width, projectile.height) && isAFireball) { Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; projectile.velocity += launch; projectile.timeLeft = 300; projectile.owner = Owner.whoAmI; - Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f * Projectile.scale, 11); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -411,6 +413,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile fadedFire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -11).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.01), Projectile.knockBack, Projectile.owner, 10, target.whoAmI); fadedFire.timeLeft = Main.rand.Next(40, 55 + 1); + fadedFire.localAI[0] = Projectile.scale; } } } @@ -427,12 +430,13 @@ namespace CalamityMod.Projectiles.Melee Dust chargefull = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 4f; - Particle pulse = new CustomSpark(target.Center, vel, "CalamityMod/Particles/BloomCircle", false, 12, 1.2f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, shrinkSpeed: 0.95f); + Particle pulse = new CustomSpark(target.Center, vel, "CalamityMod/Particles/BloomCircle", false, 12, 1.2f * Projectile.scale, Color.Orange, new Vector2(3.2f, 0.9f), true, true, shrinkSpeed: 0.95f); GeneralParticleHandler.SpawnParticle(pulse); } for (int i = 0; i < 4; i++) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0); + proj.localAI[0] = Projectile.scale; } } } @@ -454,7 +458,6 @@ namespace CalamityMod.Projectiles.Melee { Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HolyColliderGlow"); - Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); bool flipAsSword = (swingCount % 2 == 0 ? !FlipAsSword : FlipAsSword); float r = flipAsSword ? MathHelper.ToRadians(90) : 0f; Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 85a8a361da..3fb9c19dba 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Projectiles.Melee public bool setStats = true; public static int statMax = 8; public int setStatTimer = statMax; + public ref float scale => ref Projectile.localAI[0]; public ref float time => ref Projectile.ai[1]; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; - ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee Dust chargefull = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; - Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f * scale, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); GeneralParticleHandler.SpawnParticle(pulse); } } @@ -100,20 +100,21 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80), ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(1.85f, 2.45f); + dust.scale = Main.rand.NextFloat(1.85f, 2.45f) * scale; dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Goldenrod; dust.noLightEmittence = true; + dust.fadeIn = scale - 1; } if (Main.rand.NextBool()) { - Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f * scale, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); GeneralParticleHandler.SpawnParticle(spark); } else { - Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f) * scale, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } @@ -123,11 +124,12 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.85f, 1.45f) * Projectile.scale; dust.color = Color.Goldenrod; dust.noLightEmittence = true; + dust.fadeIn = scale - 1; } if (Projectile.velocity.Length() > 8) @@ -147,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, isLaunched ? 100 : 20, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (isLaunched ? 100 : 20) * scale, targetHitbox); public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); @@ -163,25 +165,29 @@ namespace CalamityMod.Projectiles.Melee SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center); - for (int g = 0; g < 3; g++) + if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1), 1.7f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1), 1.3f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - } - for (int i = 0; i < 5; i++) - { - Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.11f + i * 0.05f, 18); - GeneralParticleHandler.SpawnParticle(orb1); + for (int g = 0; g < 3; g++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1) * scale, 1.7f * scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1) * scale, 1.3f * scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 5; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, (0.11f + i * 0.05f) * scale, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } } for (int i = 0; i < 25; i++) { - Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); + Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f * scale, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); + blast.scale = scale; } } public override bool PreDraw(ref Color lightColor) @@ -196,8 +202,8 @@ namespace CalamityMod.Projectiles.Melee // The back glow float power = !setStats ? 2.4f : 0.6f; float randSize = Main.rand.NextFloat(0.8f, 1.1f); - Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale * scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale * scale, SpriteEffects.None, 0); Texture2D usedTex = (!setStats ? bigTexture : smallTexture); Rectangle frame = usedTex.Frame(1, 4, 0, Projectile.frame); @@ -206,7 +212,7 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = Projectile.rotation; if (setStatTimer == statMax || !setStats) - Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale * scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 6f80d0ed85..4d4580b19f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137 * Projectile.ai[1]; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137 * Projectile.ai[1]; if (time == 0) { @@ -52,7 +52,8 @@ namespace CalamityMod.Projectiles.Melee // Spawn 2 if (time % 85 == 0 && time > 10) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); + star.scale = Projectile.ai[1]; } } else @@ -68,30 +69,31 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft % 4 == 0) { - SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f, mainColor * 0.25f); + SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f * Projectile.ai[1], mainColor * 0.25f); GeneralParticleHandler.SpawnParticle(spark); } if (Projectile.timeLeft % 4 == 0) { - SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f, mainColor * 0.25f); + SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f * Projectile.ai[1], mainColor * 0.25f); GeneralParticleHandler.SpawnParticle(spark); } } if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) * Projectile.ai[1] - Projectile.velocity * 2 * Projectile.ai[1], ModContent.DustType()); + trailDust.scale = (Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f)) * Projectile.ai[1]; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; trailDust.noGravity = true; + trailDust.fadeIn = Projectile.ai[1] - 1; } if (Main.rand.NextBool(12)) { - GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f) * Projectile.ai[1], mainColor, true, true); GeneralParticleHandler.SpawnParticle(orb); - GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f) * Projectile.ai[1], mainColor, true, true); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = ModContent.Request(Texture).Value; float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); for (int i = 0; i < 5; i++) - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale * Projectile.ai[1], SpriteEffects.None, 0); return false; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -113,6 +115,6 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.damage < 1) Projectile.damage = 1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize * Projectile.ai[1], targetHitbox); } } diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index 546b3f3247..f7a5b243a0 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -28,7 +28,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { // Go where the player is going @@ -68,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(energyLeak); } - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Melee/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs index 074be3fa64..4560a28a28 100644 --- a/Projectiles/Melee/LightspeedHoldout.cs +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee public Vector2 innateOffset = new(23f, -0.1f); public Vector2 handPos; public float bladeRot = 0; + public float baseScale = 1; // Primary public int primaryStabfireRate => 2; @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.TwoPi * 0.75f; } - Projectile.Center = handPos; + Projectile.Center = handPos + toMouse * Projectile.scale; Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -173,8 +174,8 @@ namespace CalamityMod.Projectiles.Melee { var player = Main.player[Projectile.owner]; var modPlayer = player.GetModPlayer(); - - Projectile.scale = 0.6f; + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale(), 0.3f / Projectile.MaxUpdates); + Projectile.scale = baseScale; if (!Owner.channel && DashState == 0) { @@ -225,18 +226,18 @@ namespace CalamityMod.Projectiles.Melee Vector2 stabDir = toMouse.RotatedBy(offset); Vector2 stabOrigin = Projectile.Center; - Vector2 stabTip = stabOrigin + stabDir * 62f; + Vector2 stabTip = stabOrigin + stabDir * 62f * Projectile.scale; for (int i = 0; i < 4; i++) { - Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f); + Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f) * Projectile.scale; Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f); - Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); + Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Projectile.scale * Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); 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), Projectile.scale * 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); + 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); GeneralParticleHandler.SpawnParticle(afterImage); // Make blade randomly vibrate @@ -260,7 +261,8 @@ namespace CalamityMod.Projectiles.Melee } // Spawn the hitbox - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * Projectile.scale, toMouse, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + attack.scale = Projectile.scale; } private void UseSecondary() @@ -276,7 +278,7 @@ namespace CalamityMod.Projectiles.Melee Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; if (!firstSecondaryIteration) { @@ -354,7 +356,8 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Owner.hurtCooldowns.Length; k++) Owner.hurtCooldowns[k] = Owner.immuneTime; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + Projectile dash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + dash.scale = Projectile.scale; } } @@ -369,7 +372,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= DashAcceleration; - Projectile.scale = MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -403,7 +406,7 @@ namespace CalamityMod.Projectiles.Melee 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, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, 0.6f, spriteEffects, 0); DrawPierceTrail(); @@ -443,7 +446,7 @@ namespace CalamityMod.Projectiles.Melee { DashState = 0; DashTimer = 0; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; } } } diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs index 3e27b0a648..aad114d70e 100644 --- a/Projectiles/Melee/LightspeedM1Hitbox.cs +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 84; - Projectile.height = 64; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -31,7 +31,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 4; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = float.NaN; + float hitboxSize = Projectile.width * Projectile.scale; + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10; + Vector2 start = (Projectile.timeLeft == 6 ? Main.player[Projectile.owner].Center : Projectile.Center - vel); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, Projectile.Center + vel, hitboxSize * Projectile.scale, ref _); + } public override void AI() { Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); @@ -39,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = toMouse.ToRotation(); Projectile.rotation = rotation; - Projectile.velocity = toMouse * 34; + Projectile.velocity = toMouse * 34 * Projectile.scale; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/LucreciaBolt.cs b/Projectiles/Melee/LucreciaBolt.cs index 44d4c3f279..7c08cf0be9 100644 --- a/Projectiles/Melee/LucreciaBolt.cs +++ b/Projectiles/Melee/LucreciaBolt.cs @@ -46,7 +46,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.ai[2]; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { // Little bit of ambient lighting as it travels @@ -54,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.velocity *= 1.01f; - Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true) * Projectile.ai[2]; if (Projectile.FinalExtraUpdate()) Time++; @@ -103,7 +107,9 @@ namespace CalamityMod.Projectiles.Melee public float TrailWidth(float completionRatio, Vector2 vertexPos) { - float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completionRatio * 6); + float newSine = 0.7f - sine * 0.3f; + float width = newSine * (completionRatio < 0.4f ? 1 - MathF.Pow(Utils.GetLerpValue(0.4f, 0f, completionRatio, true), 3) : Utils.GetLerpValue(1f, 0.4f, completionRatio, true)) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))) * MathF.Pow(Projectile.ai[2], 0.4f); width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); @@ -123,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee return baseColor * Projectile.Opacity; } - public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f; + public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f * Projectile.ai[2]; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs index 09f3bb6b96..6c44e8285d 100644 --- a/Projectiles/Melee/LucreciaDNATrailCreator.cs +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player owner = Main.player[Projectile.owner]; @@ -70,9 +74,9 @@ namespace CalamityMod.Projectiles.Melee middleStreakTimer = 6; // Spawn the main trail - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark2); } @@ -83,8 +87,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 purpleTrailOrigin = Projectile.Center + offsetLeft; Vector2 blueTrailOrigin = Projectile.Center + offsetRight; - Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); - Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); + Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); + Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); GeneralParticleHandler.SpawnParticle(blueLightEmission); GeneralParticleHandler.SpawnParticle(purpleLightEmission); @@ -100,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee private float WidthFunction(float completionRatio, Vector2 vertexPos) { - return MathHelper.Lerp(12f, 0f, completionRatio); + return MathHelper.Lerp(12f * Projectile.scale, 0f, completionRatio); } @@ -126,8 +130,8 @@ namespace CalamityMod.Projectiles.Melee trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); // Use the separate color functions for each trail - PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); - PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); return false; } } diff --git a/Projectiles/Melee/LucreciaHoldout.cs b/Projectiles/Melee/LucreciaHoldout.cs index 222b21699d..b30430df04 100644 --- a/Projectiles/Melee/LucreciaHoldout.cs +++ b/Projectiles/Melee/LucreciaHoldout.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee public class LucreciaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 310; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override int CooldownTime { get; set; } public override int swingTime { get; set; } public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } - public override float lineCollisionLength => 225; + public override float lineCollisionLength => 155; public bool helixFired = false; public bool gotEnergyThisSwing = false; @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup Projectile.width = Projectile.height = 54; - Projectile.scale = 1.25f; } public override void Spawn() @@ -107,6 +106,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale() + 0.25f, 0.3f / Projectile.MaxUpdates); if (IsAlternateThrust) { @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (timer % 8 == 0) { Vector2 pos = player.MountedCenter + Projectile.rotation.ToRotationVector2() * 60f; - Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); + Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f * Projectile.scale, 12, 0.3f, 1.2f); GeneralParticleHandler.SpawnParticle(sparkle); } Particle smear = new CircularSmearVFX(player.MountedCenter, Color.CornflowerBlue * 0.35f, Projectile.rotation, Projectile.scale * 1.25f); @@ -185,8 +185,10 @@ namespace CalamityMod.Projectiles.Melee if (!trailFXTriggered) { if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); - + { + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); + attack.scale = baseScale; + } SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); SoundEngine.PlaySound(swish with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); @@ -203,7 +205,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 particleOrigin = Projectile.Center; Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); - Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f) * Projectile.scale, Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); GeneralParticleHandler.SpawnParticle(sparks); } particlesSpawned = true; @@ -240,14 +242,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 shootDir = player.MountedCenter.DirectionTo(mousePosition) * 10f; int dir = -Math.Sign(mousePosition.X); float scale = lineCollisionLength / 550f; - Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4 * Projectile.scale, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale * Projectile.scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); var fireDirection = Vector2.Normalize(mousePosition - player.MountedCenter); var helixSpeed = 12f; var helixVelocity = fireDirection * helixSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + attack.ai[2] = Projectile.scale; + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); } diff --git a/Projectiles/Melee/MaceFlails/BallOFuguProj.cs b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs index 75fda7e3a0..623ec31bbe 100644 --- a/Projectiles/Melee/MaceFlails/BallOFuguProj.cs +++ b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails { Vector2 velocity = Projectile.DirectionFrom(Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(4.5f, 6.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner); - SpikeTimer = MaxSpikeTime + Main.rand.Next(5); + SpikeTimer = MaxSpikeTime + Main.rand.Next((int)SpikeRate - 3); } base.SpinAI(launchSpeed); } diff --git a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 477271b0b2..a50d3fac7e 100644 --- a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.Particles; @@ -13,7 +14,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.MaceFlails { - [PierceResistException] public class UrchinMaceProj : BaseMaceFlailProjectile { // The entire chain is on the mace sprite, in which the player swings @@ -118,6 +118,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 300); for (int i = 0; i < 3; i++) { float angle = Main.rand.NextFloat(MathHelper.TwoPi); diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index b10a3a2a49..03e7ec6d95 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/MajesticGuard"; - public override float HitboxOutset => 105; - - public override Vector2 HitboxSize => new Vector2(140, 140); + public int size = 100 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 100); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -46,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles @@ -148,8 +146,8 @@ namespace CalamityMod.Projectiles.Melee CanHit = true; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); } else CanHit = false; @@ -166,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 72d110327a..f0ed376d31 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 SpriteOrigin => new(0, 20); public override int AssignedItemID => ModContent.ItemType(); + public override bool IgnoreAutoScale => true; public float ClawOpenness = MathHelper.ToRadians(80); public float BubbleSize = 0f; @@ -39,6 +40,8 @@ namespace CalamityMod.Projectiles.Melee } public override void ResetStyle() { + if (Projectile.scale < 0.8f && m2KillTimer <= 0) + Projectile.active = false; if (AnimationCooldown) { if (NumberOfAnimations % 5 <= BlastChargeUses) @@ -137,6 +140,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 2f, Owner.whoAmI); slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); + slash.localAI[0] = Owner.GetMeleeScale(); } SlashTimer++; diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index a0783efbce..a89a09ccf7 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Particles/SlashSmear"; + public float maxScale = 0; private const int TimerCap = 20; Color startColor; Color endColor; @@ -35,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnSpawn(IEntitySource source) { Projectile.scale = 0f; + Projectile.ai[2] = Main.rand.NextFloat(0.5f, 1.25f); if (Main.rand.NextBool(2)) dir = -1; @@ -53,14 +56,21 @@ namespace CalamityMod.Projectiles.Melee startColor = ColorList[Main.rand.Next(ColorList.Count)]; endColor = ColorList[Main.rand.Next(ColorList.Count)]; } - - public override void ModifyDamageHitbox(ref Rectangle hitbox) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - hitbox = new Rectangle((int)Projectile.Center.X - 65, (int)Projectile.Center.Y - 65, 130, 130); + int size = 60; + int scale = (int)(size * Math.Max(Projectile.ai[2], 1)); + Vector2 position = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * size / 2; + return CalamityUtils.CircularHitboxCollision(position, scale, targetHitbox); } public override void AI() { + if (maxScale == 0) + { + maxScale = Projectile.localAI[0]; + Projectile.ai[2] *= maxScale; + } Projectile.velocity *= 0.9f; if (Projectile.timeLeft > (TimerCap / 2)) @@ -88,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0; i < 1; i += 0.33f) { Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)), - Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Math.Min(Projectile.scale, maxScale), dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); } return false; } diff --git a/Projectiles/Melee/MawOfInfinityHoldout.cs b/Projectiles/Melee/MawOfInfinityHoldout.cs index cf7bf97d01..48323eefee 100644 --- a/Projectiles/Melee/MawOfInfinityHoldout.cs +++ b/Projectiles/Melee/MawOfInfinityHoldout.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class MawOfInfinityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => true; public override int swingWidth => 270; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 73a23e9dfd..04a227f3c3 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -1,9 +1,11 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -60,6 +62,12 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + if (Owner.HeldItem.ModItem is not TrueBiomeBlade || (Owner.HeldItem.ModItem as TrueBiomeBlade).mainAttunement != AttunementSystem.FindOrNull(AttunementID.TrueDefault)) + { + Projectile.Kill(); + return; + } + // If the player stops using the weapon after hitting with it three times, switch to lunge. if (Owner.CantUseHoldout()) { diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs index 56cca4d246..fad5e53fa5 100644 --- a/Projectiles/Melee/MirrorBladeProjectile.cs +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override bool AlternateSwings => false; public bool SpawnShards = true; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 276bc0972a..4f5895fc64 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -71,38 +72,69 @@ namespace CalamityMod.Projectiles.Melee } return base.CanHitNPC(target); } - public override void AI() + + void SpawnLogic() { - player.Calamity().mouseWorldListener = true; - if (!hasSpawned) + Projectile.netUpdate = true; + //This is used when spawned by Evolution. + //Set here instead of on spawn so it all syncs in MP + if (Projectile.ai[0] != 0) { - Projectile.netUpdate = true; - if (Projectile.ai[0] != 0) + //Setting AP so high guarantees we get the full dmg of the projectile + //We also want to guarantee the proj doesn't crit ever + Projectile.ArmorPenetration = 1000; + Projectile.DamageType = DamageClass.Generic; + Projectile.CritChance = 0; + + //When not holding Mirror Blade, shards launch instantly + if (Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType()) { - //This is used when spawned by Evolution. - //Setting AP so high guarantees we get the full dmg of the projectile. - Projectile.ArmorPenetration = 1000; + shardShield = 10; hasSpawned = true; shardShield = 0; isShard = false; Projectile.timeLeft = 1200; Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; - Projectile.DamageType = DamageClass.Generic; - Projectile.CritChance = 0; return; } - shardNum = player.ownedProjectileCounts[Projectile.type]; - hasSpawned = true; - shardNum = 0; - foreach (var proj in Main.projectile) + //When holding Mirror Blade, the shards orbit the player like the blade shards. + //Evoultion shards insert themselves at the *end* of the shard list. This means they will launch themselves before any Mirror Blade shards are launched + //This is done because Evolution shards don't get the 2/3x dmg from shattering the mirror shield, so they're less valuable to be stored. + else { - if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) { - (proj.ModProjectile as MirrorBlast).shardNum++; - proj.netUpdate = true; + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner && proj.ModProjectile().shardNum > -1) + { + shardNum++; + } } + return; } } + + //If not from The Evolution, run normal spawn logic + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + { + (proj.ModProjectile as MirrorBlast).shardNum++; + proj.netUpdate = true; + } + } + } + public override void AI() + { + player.Calamity().mouseWorldListener = true; + if (!hasSpawned) + SpawnLogic(); if (isShield) { if (shardNum > 10 || Projectile.timeLeft < 2) diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index a6dd1f7b10..4e2c3c3295 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -23,7 +23,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 26; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; + Projectile.penetrate = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 600; Projectile.alpha = 255; Projectile.tileCollide = false; @@ -59,38 +61,33 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { - int npcTracker = (int)Projectile.ai[0]; - if (Main.npc[npcTracker].active) - { - Vector2 projPos = Projectile.Center; - float npcXDist = Main.npc[npcTracker].position.X - projPos.X; - float npcYDist = Main.npc[npcTracker].position.Y - projPos.Y; - float npcDistance = (float)Math.Sqrt((double)(npcXDist * npcXDist + npcYDist * npcYDist)); - npcDistance = 8f / npcDistance; - npcXDist *= npcDistance; - npcYDist *= npcDistance; - Projectile.velocity.X = (Projectile.velocity.X * 14f + npcXDist) / 15f; - Projectile.velocity.Y = (Projectile.velocity.Y * 14f + npcYDist) / 15f; - } + NPC potentialTarget = null; + if (Main.npc[(int)Projectile.ai[0]].active && Projectile.localNPCImmunity[(int)Projectile.ai[0]] == 0) + potentialTarget = Main.npc[(int)Projectile.ai[0]]; else { - float homingRange = 1000f; - foreach (NPC n in Main.ActiveNPCs) + float range = 1600f; + foreach (NPC target in Main.ActiveNPCs) { - if (n.CanBeChasedBy(Projectile, false)) + if (target.CanBeChasedBy(Projectile) && Projectile.localNPCImmunity[target.whoAmI] == 0) { - float targetX = n.position.X + (float)(n.width / 2); - float targetY = n.position.Y + (float)(n.height / 2); - float targetDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - targetX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - targetY); - if (targetDist < homingRange && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, n.position, n.width, n.height)) + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range) { - homingRange = targetDist; - Projectile.ai[0] = (float)n.whoAmI; + range = distance; + potentialTarget = target; } } } } + if (potentialTarget != null) + { + Projectile.alpha = 0; + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 18f; + Projectile.velocity = (Projectile.velocity * 14f + idealVelocity) / 15f; + } + if (Projectile.velocity.X < 0f) { Projectile.spriteDirection = -1; @@ -154,7 +151,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); - if (Projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer && Projectile.numHits == 0) { for (int k = 0; k < 2; k++) { diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 62c19d5938..79ca99264c 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -11,7 +11,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class MurasamaSlash : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -60,9 +59,10 @@ namespace CalamityMod.Projectiles.Melee { if (time == 0) { + Projectile.scale = Owner.GetMeleeScale(); if (Main.zenithWorld) { - Projectile.scale = 2; + Projectile.scale *= 2; Projectile.damage = (int)(Projectile.damage * 2); } Projectile.frame = Main.zenithWorld ? 6 : 10; @@ -94,15 +94,6 @@ namespace CalamityMod.Projectiles.Melee else Slashing = false; - if (Projectile.frame == 5 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 2); - } - if (Projectile.frame == 7 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 0.5f); - } - //Frames and crap Projectile.frameCounter++; if (Projectile.frameCounter % 3 == 0) @@ -180,6 +171,11 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Main.player[Projectile.owner].Center, lineEnd, lineWidth, ref _); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Slash3) + modifiers.SourceDamage *= 2f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (target.Organic()) @@ -230,6 +226,6 @@ namespace CalamityMod.Projectiles.Melee } public override Color? GetAlpha(Color lightColor) => new Color(100, 0, 0, 0); - public override bool? CanDamage() => Slashing == false ? false : null; + public override bool? CanDamage() => Slashing ? null : false; } } diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index cf3264b909..71afbafc72 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -22,13 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult; + public int size = 76; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 70); + public override float AdditionalScale => 0.2f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -50,7 +49,6 @@ namespace CalamityMod.Projectiles.Melee { CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -167,14 +165,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Orange :Color.OrangeRed; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); } } } @@ -247,8 +246,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - //Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * (float)Math.Pow(fadeIn, 20) * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(-Projectile.ai[1] * 95 * fadeIn) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.25f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.325f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index e884f6f0ba..4c2405c290 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using Microsoft.Xna.Framework; @@ -8,7 +9,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class OmnibladeSwing : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -31,11 +31,17 @@ namespace CalamityMod.Projectiles.Melee Projectile.ContinuouslyUpdateDamageStats = true; Projectile.ownerHitCheck = true; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 3; + Projectile.idStaticNPCHitCooldown = 5; + } + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + float scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); } - public override void AI() { + Projectile.scale = Owner.GetMeleeScale(); Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 3; if (Projectile.frame >= Main.projFrames[Type]) @@ -52,16 +58,8 @@ namespace CalamityMod.Projectiles.Melee // Rotation and directioning. Projectile.rotation = Owner.gravDir == -1f ? MathHelper.Pi : 0f; - Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - - // Sprite and player directioning. - Projectile.spriteDirection = Projectile.direction * (int)(Owner.gravDir); - if (Projectile.direction == 1) - Projectile.Left = Owner.MountedCenter; - else - Projectile.Right = Owner.MountedCenter; - Projectile.position.X += (Projectile.spriteDirection == 1 ? -92f : 96f) * Owner.gravDir; - Projectile.position.Y -= 80f * Owner.gravDir; + Projectile.direction = Projectile.spriteDirection = MathF.Sign(Owner.Center.DirectionTo(Owner.ClampedMouseWorld()).X); + Projectile.Center = Owner.MountedCenter + new Vector2(Projectile.width * 0.1f * Projectile.scale * Projectile.direction, -Projectile.height * 0.5f * Projectile.scale); Owner.ChangeDir(Projectile.direction); // Prevents the projectile from dying diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index c184e5faaf..96fa3fea63 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; @@ -46,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + 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); } time++; diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index c75a37a4ae..14f1a81d43 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Melee public float hitboxSize = 10; public Color mainColor; public float fade = 1; - public float damageMult = 1; public float fadeOut = 1; public override void SetDefaults() { @@ -36,8 +35,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190 * Projectile.ai[1]; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190 * Projectile.ai[1]; Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; @@ -66,26 +65,26 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f)* Projectile.ai[1] - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25 * Projectile.ai[1], ModContent.DustType()); + trailDust.scale = (Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f)) * Projectile.ai[1]; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = mainColor; trailDust.noGravity = true; - trailDust.fadeIn = 2f; + trailDust.fadeIn = 2f * Projectile.ai[1]; } if (time % 9 == 0 && time < 200) { - Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(12)) { - Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb3); - Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb4); } } @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee float waveFade = (float)Math.Pow(Utils.GetLerpValue(0, 250, Projectile.timeLeft, true), 2); float waveFade2 = (float)Math.Pow(Utils.GetLerpValue(0, 80, Projectile.timeLeft, true), 2); for (int i = 1; i < 15; i++) // Weird for loop because of squash code - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f * Projectile.ai[1], SpriteEffects.None, 0); return false; } @@ -107,12 +106,6 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Deal more damage on pierce - modifiers.SourceDamage *= damageMult; - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize * Projectile.ai[1], targetHitbox); } } diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 2208750278..e50e1eeff4 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public Player Owner => Main.player[Projectile.owner]; public const float ZeroChargeDamageRatio = 0.36f; - public const float ToothDamageRatio = 0.1666667f; + public const float ToothDamageRatio = 0.5f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. public const int ChargeUpTime = 150; public ref float Time => ref Projectile.ai[0]; @@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. Projectile.damage = Owner.HeldItem is null ? 0 : Owner.GetWeaponDamage(Owner.HeldItem); + Projectile.scale = Owner.GetMeleeScale(); DetermineDamage(); PlayChainsawSounds(); @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; // Positioning close to the player's arm. - Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f * Projectile.scale; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. @@ -191,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f; + Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f * Projectile.scale; // Spawn the dust a little bit on the chainsaw. X variance is less than Y variance to ensure that dust does not // spawn too far from the blade. @@ -235,7 +236,8 @@ namespace CalamityMod.Projectiles.Melee shootReach = 72f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + Projectile prismTooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + prismTooth.scale = Projectile.scale; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -243,9 +245,9 @@ namespace CalamityMod.Projectiles.Melee // Collision is done as a line to bypass the fact that hitboxes cannot rotate and that // this projectile is notably flat in terms of sprite shape. float _ = 0f; - float width = Projectile.scale * 36f; + float width = Projectile.scale * 36f * Projectile.scale; Vector2 start = Projectile.Center; - Vector2 end = Projectile.Center + Projectile.velocity * 70f; + Vector2 end = Projectile.Center + Projectile.velocity * 70f * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) 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/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index aca73d5124..354b132918 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -28,14 +28,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 40; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.timeLeft = 30; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - Projectile.velocity *= 0.97f; + Projectile.velocity *= 0.93f; Projectile.rotation += MathHelper.PiOver4 / 2.4f * Math.Sign(Projectile.velocity.X); int dustCount = Main.rand.Next(4); @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee Dust dust = Dust.NewDustPerfect(offset + dustDirection, DustID.DungeonWater, Vector2.Zero, 100, default, 1.4f); dust.noGravity = true; dust.noLight = true; - dust.velocity = dustDirection; + dust.velocity = dustDirection * 0.5f; } } } 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/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs new file mode 100644 index 0000000000..e779042974 --- /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 = 600; + + 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/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index 4f12c74fe9..21b08711b2 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override bool drawSwordTrail => false; public override bool AlternateSwings => false; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 686133e319..43171a0be7 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon"; - public override float HitboxOutset => 245; - - public override Vector2 HitboxSize => new Vector2(40, 40); // long thin hitbox for a spear is done in collision, the X here determines hitbox width + public int size = 140; + public override float HitboxOutset => size * 1.45f; + public override Vector2 HitboxSize => new Vector2(30, 30); // Has custom collision + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 135); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; mousePos = Owner.Calamity().mouseWorld; @@ -151,18 +150,19 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f); - Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(1f, 4f); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f) * Projectile.scale); dust.noGravity = true; dust.color = color; + dust.fadeIn = Projectile.scale - 1; - Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); + Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f) * Projectile.scale, color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); GeneralParticleHandler.SpawnParticle(spark2); if (i % 2 == 0) { - Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1)); + Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f * Projectile.scale, color * 0.75f, new Vector2(1f, 1)); GeneralParticleHandler.SpawnParticle(orb); } } @@ -222,7 +222,8 @@ namespace CalamityMod.Projectiles.Melee 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); - proj.timeLeft = 45; + proj.timeLeft = (int)(45 / Projectile.scale); + proj.scale = Projectile.scale; swingCount = 0; attackPower = 6; } @@ -233,7 +234,8 @@ 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, 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(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + proj.scale = Projectile.scale; swingCount = -1; attackPower = 0; } @@ -243,7 +245,8 @@ namespace CalamityMod.Projectiles.Melee { float rot = (0.1f * attackPower * i / 6f); Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7; - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + proj.scale = Projectile.scale; } attackPower--; } @@ -267,12 +270,17 @@ namespace CalamityMod.Projectiles.Melee { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); float bonus = (1 - (7 / (attackPower + 1))) * 0.3f; - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f); - Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); - dust.noGravity = !(dust.type == 278); + Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? DustID.FireworksRGB : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); + dust.noGravity = dust.type != DustID.FireworksRGB; dust.color = color; dust.scale += bonus; + if (dust.type != DustID.FireworksRGB) + { + dust.scale *= Projectile.scale; + dust.fadeIn = Projectile.scale - 1; + } } } } @@ -285,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee { // Perform an AABB line collision check to check the whole spear. float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset, HitboxSize.X * Projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + ((Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset) * Projectile.scale, HitboxSize.X * Projectile.scale, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -342,15 +350,15 @@ namespace CalamityMod.Projectiles.Melee { // While not super visible here, this hitbox extention effect looks great and I'll use it on stuff like Terra Lance later Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn; - Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); - Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f) * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130 * Projectile.scale, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); } for (int i = 0; i < 6; i++) { // the electric orb at the tip Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f; - Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2; - Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2 * Projectile.scale; + Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 188 * Projectile.scale + tipOutset * Projectile.scale, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); } } return false; 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/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 5f67f8f6be..1293a2915c 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class GildedProboscisProj : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override bool useMeleeSize => false; public override int swingWidth => 360; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 1f02d2c570..672789f03f 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -71,6 +71,6 @@ namespace CalamityMod.Projectiles.Melee.Spears Main.dust[idx].velocity = Vector2.Zero; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index b370747d9f..ba2e6a8a1b 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailCacheLength[Type] = 12; ProjectileID.Sets.TrailingMode[Type] = 2; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void SetDefaults() { Projectile.width = 44; @@ -40,7 +45,8 @@ namespace CalamityMod.Projectiles.Melee if (time == 0) { mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); + if (Projectile.numHits == 0) + Projectile.scale *= (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { Projectile.localNPCHitCooldown = -1; @@ -60,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]); if (time % 2 == 0) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } } @@ -70,10 +76,11 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.scale = Main.rand.NextFloat(0.9f, 1.05f) * Projectile.scale; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; trailDust.noGravity = true; + trailDust.fadeIn = Projectile.scale - 1; } } diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs index 958b843c75..8a794b9401 100644 --- a/Projectiles/Melee/StarofOrder.cs +++ b/Projectiles/Melee/StarofOrder.cs @@ -35,14 +35,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 7; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; - if (time == 0) + if (time == 0 && Projectile.numHits == 0) { - Projectile.scale = Main.rand.NextFloat(0.65f, 0.8f); + Projectile.scale *= Main.rand.NextFloat(0.65f, 0.8f); } float sine = (float)Math.Sin(time * 0.575f * Projectile.scale / MathHelper.Pi); @@ -59,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee } if (time % 2 == 0 && Projectile.numHits < 1) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } @@ -107,10 +111,10 @@ namespace CalamityMod.Projectiles.Melee { Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2, ModContent.DustType(), velocity * 8); - dust.scale = 3.5f; + dust.scale = 3.5f * Projectile.scale; dust.color = mainColor; dust.noGravity = true; - dust.fadeIn = 6f; + dust.fadeIn = 6f * Projectile.scale; } } } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 77226c9bd1..4cb93bac62 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.netUpdate = true; int numFlares = EmpoweredHammer + 1; - int flareDamage = (int)(0.1f * Projectile.damage); + int flareDamage = (int)(0.05f * Projectile.damage); float flareKB = 4f; for (int i = 0; i < numFlares; ++i) { diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index d06ba14221..75277743b9 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -22,12 +22,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarStriker"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(130, 130); + public int size = 118; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(0, 118); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -47,7 +46,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning @@ -161,24 +159,24 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f), 0.2f, 23); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f), Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); + Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f) * Projectile.scale, Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); GeneralParticleHandler.SpawnParticle(spark2); } } else if (Main.rand.NextBool(3)) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 23, Main.rand.NextFloat(0.2f, 0.6f), 0.65f, 0, true)); @@ -220,7 +218,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + meteor.scale = Projectile.scale; spawnBoom = false; } diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs index 0cfc50fec9..e187bb142b 100644 --- a/Projectiles/Melee/StellarStrikerMeteor.cs +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -67,28 +68,25 @@ namespace CalamityMod.Projectiles.Melee if (targetDist < 1400f) { - if (time % 11 == 0) - { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); - GeneralParticleHandler.SpawnParticle(orb); - } if (time % 4 == 0) { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.65f, 0, true)); } } - if (time % 2 == 0) - { - // Spawn in a helix-style pattern - float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset * direction, DustID.RainbowMk2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.3f)); - dust.scale = Main.rand.NextFloat(0.85f, 0.95f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 2, ModContent.DustType(), (Projectile.timeLeft % 2 == 0 ? -Projectile.velocity * 2 : offset * direction * 0.5f)); + dust.scale = Main.rand.NextFloat(1.15f, 1.25f) * Projectile.scale; + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + dust.fadeIn = Projectile.scale * 1.25f; + dust.noLight = true; + dust.noLightEmittence = true; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -97,7 +95,8 @@ namespace CalamityMod.Projectiles.Melee { spawnMet = false; Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } } @@ -106,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); + CalamityUtils.DrawProjectileWithBackglow(Projectile, Color.Turquoise with { A = 0 }, lightColor, 4 * Projectile.scale); return false; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 6; i++) { - Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); + Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); GeneralParticleHandler.SpawnParticle(spark3); } for (int i = 0; i < 18; i++) @@ -149,10 +149,13 @@ namespace CalamityMod.Projectiles.Melee c.noGravity = true; c.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } 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/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 5741b0bd64..95aff6781f 100644 --- a/Projectiles/Melee/TriactisHammerExplosion.cs +++ b/Projectiles/Melee/TriactisHammerExplosion.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,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) @@ -84,6 +85,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.ApplyScalingForcedCrit(Projectile); modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); modifiers.SourceDamage *= Utils.Remap(Projectile.numHits, 0, 10, 1f, 0.1f, true); } diff --git a/Projectiles/Melee/TriactisHammerFlare.cs b/Projectiles/Melee/TriactisHammerFlare.cs index 70af4b6ee0..2fed916b9e 100644 --- a/Projectiles/Melee/TriactisHammerFlare.cs +++ b/Projectiles/Melee/TriactisHammerFlare.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -50,8 +51,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); return; } + // You may swap weapons and keep the flares, but only for a short time + if (Owner.HeldItem.type == ModContent.ItemType()) + Projectile.timeLeft = 180; - Projectile.timeLeft = 2; float rotation = Main.GlobalTimeWrappedHourly * 2f + MathHelper.ToRadians(120f) * FlareType; // Transform into smashy hammers @@ -95,6 +98,12 @@ namespace CalamityMod.Projectiles.Melee } } + public override void OnKill(int timeLeft) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, GetColor(FlareType), Vector2.One, 0f, 0.1f, 0.8f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + } + // Hue-shifted version of the base colours public static Color GetColor(float type) { diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index e455e9aff9..1b314721e8 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -124,8 +124,6 @@ namespace CalamityMod.Projectiles.Melee Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, currentColor, 1f * scale, 24, 0.1f, 2.5f * scale); GeneralParticleHandler.SpawnParticle(sparkle); } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, currentColor, Vector2.One, 0f, 0.1f, 0.8f, 10); - GeneralParticleHandler.SpawnParticle(pulse); } if (OrbitRadius > 792f) diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 0f208bdc5b..32fbc7def3 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -128,9 +128,9 @@ namespace CalamityMod.Projectiles.Melee { GeneralParryEffects(); - //Reduce the projectile's damage by 80 for a second. - if (proj.Calamity().flatDR < 80) - proj.Calamity().flatDR = 80; + //Reduce the projectile's damage by 30 for a second. + if (proj.Calamity().flatDR < 30) + proj.Calamity().flatDR = 30; if (proj.Calamity().flatDRTimer < 60) proj.Calamity().flatDRTimer = 60; diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index b62d82e9dd..f418a91a2b 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -28,7 +28,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.timeLeft = 300; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { Projectile.frameCounter++; @@ -95,9 +101,9 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X -= (float)(Projectile.width / 2); - Projectile.position.Y -= (float)(Projectile.height / 2); + Projectile.width *= (int)(2 * Projectile.scale); Projectile.height *= (int)(2 * Projectile.scale); + Projectile.position.X -= (float)(Projectile.width / (int)(2 * Projectile.scale)); + Projectile.position.Y -= (float)(Projectile.height / (int)(2 * Projectile.scale)); for (int i = 0; i < 2; i++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 17cf90d7a2..6a4b295669 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -11,7 +11,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - [PierceResistException] public class TyphonsGreedStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -41,6 +40,7 @@ namespace CalamityMod.Projectiles.Melee float rotationSpeed = -0.7853982f; Vector2 actualPosition = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 rotationPoint = Vector2.Zero; + Projectile.scale = player.GetMeleeScale(); if (player.dead) { @@ -142,6 +142,7 @@ namespace CalamityMod.Projectiles.Melee var source = Projectile.GetSource_FromThis(); Projectile bubble = CalamityUtils.ProjectileBarrage(source, Projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack * 0.5f, Projectile.owner, true); bubble.ai[1] = Main.rand.NextFloat() + 0.5f; + bubble.scale = Projectile.scale; } } } @@ -162,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee } float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); float rotationFactor = 0f; - float collisionRadius = 110f; + float collisionRadius = 110f * Projectile.scale; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -collisionRadius, Projectile.Center + f.ToRotationVector2() * collisionRadius, 23f * Projectile.scale, ref rotationFactor)) { return true; diff --git a/Projectiles/Melee/UHFMurasama.png b/Projectiles/Melee/UHFMurasama.png deleted file mode 100644 index 26800e8920..0000000000 Binary files a/Projectiles/Melee/UHFMurasama.png and /dev/null differ diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 36866784f2..d17af1ef6e 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -28,7 +28,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.alpha = 255; - Projectile.penetrate = 1; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 90; Projectile.noEnchantments = true; } @@ -39,7 +41,21 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.alpha = (int)Utils.Remap(Time, 0f, 12f, 255f, 0f); - NPC potentialTarget = Projectile.Center.ClosestNPCAt(256f); + NPC potentialTarget = null; + float range = 256f; + foreach (NPC target in Main.ActiveNPCs) + { + if (target.CanBeChasedBy(Projectile) && Projectile.localNPCImmunity[target.whoAmI] == 0) + { + float distance = Vector2.Distance(target.Center, Projectile.Center); + if (distance < range) + { + range = distance; + potentialTarget = target; + } + } + } + if (potentialTarget != null && Time >= 12f) { Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 12f; diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 52d4a597c0..c14a4dc8c7 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[idx].scale = scale; } - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 30); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 104bca3d8a..7e4b87d2cd 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; - Projectile.scale = 1.2f; } public override void AI() diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 6b82d56b3d..15b24a242b 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (EndLag == 0) //Initialization { EndLag = (float)Math.Max(Owner.HeldItem.useTime - MaxTime, 1); @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation Projectile.Center = Owner.MountedCenter + OffsetFromPlayer; - Projectile.scale = 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER + Projectile.scale = Owner.GetMeleeScale() * 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER //Make the owner look like theyre holding the sword bla bla Owner.heldProj = Projectile.whoAmI; @@ -222,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee Rectangle frame = new Rectangle(0, (smearTex.Height / 3) * frameCount, smearTex.Width, smearTex.Height / 3); float opacity = 1 - (float)Math.Pow(LifetimeCompletion / 0.6f, 0.5f); - Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f, 0, 0); + Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f * Projectile.scale - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f * Projectile.scale, 0, 0); } return false; } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 3c7a6de762..8dc9e0ec37 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; @@ -20,12 +21,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public class ObliteratorYoyo : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - private static int DashStartup => 60; - private static int DashCooldown => 15; + private static int DashStartup => 90; + private static int DashCooldown => 30; public SlotId GFB; public int GFBCounter = 0; public int time = 0; + public int DashQueue = 0; + int dashTimer = 0; + int timerToStartDash = 0; public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; @@ -48,20 +52,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.localNPCHitCooldown = 7 * Projectile.MaxUpdates; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(DashQueue); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + DashQueue = reader.ReadInt32(); + } + public override bool PreAI() { if (Projectile.FinalExtraUpdate()) { - if (Projectile.localAI[1] != DashStartup) - Projectile.localAI[1]++; - if (Projectile.localAI[1] > DashStartup + DashCooldown) - Projectile.localAI[1] = 0; + timerToStartDash++; + if (timerToStartDash % DashStartup == DashStartup - 1) + DashQueue++; } - if (Projectile.localAI[1] <= DashStartup) + if (dashTimer <= 0) return true; Projectile.aiStyle = -1; Projectile.timeLeft++; + dashTimer--; return true; } @@ -94,8 +108,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.FinalExtraUpdate()) { - if (Projectile.localAI[1] == DashStartup) + if (DashQueue > 0 && dashTimer <= 0) { + DashQueue--; + List targets = new List(); float laserRange = 600f; foreach (NPC n in Main.ActiveNPCs) @@ -139,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); } - Projectile.localAI[1]++; + dashTimer = DashCooldown; Projectile.ResetLocalNPCHitImmunity(); } } @@ -158,7 +174,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 origin = new Vector2(10f, 10f); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); - if (Projectile.localAI[1] <= DashStartup) + if (dashTimer <= 0) return; var tex = ModContent.Request("CalamityMod/Particles/Jaws").Value; Main.spriteBatch.SetBlendState(BlendState.Additive); @@ -176,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.localAI[1] > DashStartup) + if (dashTimer > 0) { modifiers.SourceDamage *= 6; } @@ -186,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.localAI[1] > DashStartup) { - Projectile.localAI[1] = 0; + dashTimer = 0; target.AddBuff(ModContent.BuffType(), 180); for (int i = 0; i < 10; i++) { diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index 7c0eba0a05..dc542b50b9 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,12 +14,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public class PandemicYoyo : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public const int MaxUpdates = 2; + + List hitNPCs = []; public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = Pandemic.Lifetime * 2f; ProjectileID.Sets.YoyosMaximumRange[Type] = Pandemic.Reach; - ProjectileID.Sets.YoyosTopSpeed[Type] = Pandemic.Speed / MaxUpdates; + ProjectileID.Sets.YoyosTopSpeed[Type] = Pandemic.Speed / 2f; } public override void SetDefaults() @@ -27,21 +30,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; - Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * MaxUpdates; + Projectile.localNPCHitCooldown = 20; + Projectile.MaxUpdates = 2; } public override void AI() { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); + Projectile.scale = Pandemic.SizeMultiplier(hitNPCs.Count); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= Pandemic.DamageMultiplier(hitNPCs.Count); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + if (target.HasBuff(ModContent.BuffType())) + { + target.AddBuff(ModContent.BuffType(), 300); //Pandemic hits refresh Plague to 5 seconds + if (!hitNPCs.Contains(target)) + { + hitNPCs.Add(target); + Projectile.localAI[0] = 0; + + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green, Vector2.One, 0, 0f, 0.5f, 30); + GeneralParticleHandler.SpawnParticle(pulse); + } + } } public override bool PreDraw(ref Color lightColor) 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/DesertScourgeBabyBody.png b/Projectiles/Pets/DesertScourgeBabyBody.png deleted file mode 100644 index a79304c9bf..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody2.png b/Projectiles/Pets/DesertScourgeBabyBody2.png deleted file mode 100644 index ad1ed7cc10..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody2.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody3.png b/Projectiles/Pets/DesertScourgeBabyBody3.png deleted file mode 100644 index 308ac4e880..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody3.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyHead.png b/Projectiles/Pets/DesertScourgeBabyHead.png deleted file mode 100644 index b9d4646498..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyHead.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyTail.png b/Projectiles/Pets/DesertScourgeBabyTail.png deleted file mode 100644 index 55d51f6c73..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyTail.png and /dev/null differ diff --git a/Projectiles/Pets/StarSwallowerPet.cs b/Projectiles/Pets/StarSwallowerPet.cs new file mode 100644 index 0000000000..7292b421c4 --- /dev/null +++ b/Projectiles/Pets/StarSwallowerPet.cs @@ -0,0 +1,359 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Particles; +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.Pets +{ + public class StarSwallowerPet : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Pets"; + private int playerStill = 0; + private bool idleAnimation = false; + private bool fly = false; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 14; + Main.projPet[Projectile.type] = true; + + ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(1, 8, 6) + .WithOffset(-18f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0); + } + + public override void SetDefaults() + { + Projectile.netImportant = true; + Projectile.width = 54; + Projectile.height = 48; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 scale = Vector2.One; + if (fly) + { + float animRate = Main.GlobalTimeWrappedHourly * 20; + float scaleMod = 0.2f; + scale += new Vector2(MathF.Cos(animRate), MathF.Sin(animRate)) * scaleMod; + } + SpriteEffects fx = fly ? (SpriteEffects.FlipVertically | (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None)) : Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2 / Main.projFrames[Type]), Projectile.scale * scale, fx, 0); + + return false; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + Player player = Main.player[Projectile.owner]; + float heightDif = player.Center.Y - Projectile.Center.Y; + fallThrough = fly || heightDif >= 160f; + return true; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (!player.active) + { + Projectile.active = false; + return; + } + + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.starSwallowerPetFroge = false; + } + if (modPlayer.starSwallowerPetFroge) + { + Projectile.timeLeft = 2; + } + + Vector2 projPos = Projectile.position; + Vector2 mouthPos = Projectile.Center + new Vector2(-20 * Projectile.spriteDirection, -6f).RotatedBy(Projectile.rotation); + if (!fly) + { + Projectile.rotation = 0; + Vector2 projCenter = Projectile.Center; + Vector2 playerDirection = player.Center - projCenter; + float playerDistance = playerDirection.Length(); + if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X))) + { + Projectile.velocity.Y = -8f; + } + Projectile.velocity.Y += 0.35f; + if (Projectile.velocity.Y > 15f) + { + Projectile.velocity.Y = 15f; + } + if (playerDistance > 480f) + { + fly = true; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + } + if (playerDistance > 100f) + { + if (player.position.X - Projectile.position.X > 0f) + { + Projectile.velocity.X += 0.125f; + if (Projectile.velocity.X > 6.75f) + { + Projectile.velocity.X = 6.75f; + } + } + else + { + Projectile.velocity.X -= 0.125f; + if (Projectile.velocity.X < -6.75f) + { + Projectile.velocity.X = -6.75f; + } + } + } + if (playerDistance < 100f) + { + if (Projectile.velocity.X != 0f) + { + if (Projectile.velocity.X > 0.8f) + { + Projectile.velocity.X -= 0.25f; + } + else if (Projectile.velocity.X < -0.8f) + { + Projectile.velocity.X += 0.25f; + } + else if (Projectile.velocity.X < 0.8f && Projectile.velocity.X > -0.8f) + { + Projectile.velocity.X = 0f; + } + } + } + if (playerDistance < 70f) + { + Projectile.velocity.X *= 0.5f; + } + + //set frames when idle + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) + { + // Idle animation where it opens its mouth and lets out some plasma mist + if (Main.rand.NextBool(600) && !idleAnimation) + { + idleAnimation = true; + Projectile.frame = 8; + Projectile.frameCounter = 0; + } + + if (idleAnimation) + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frame += (Projectile.ai[0] != -1).ToDirectionInt(); + Projectile.frameCounter = 0; + } + if (Projectile.ai[0] != -1) + { + if (Projectile.frame >= 12) + { + Projectile.ai[0] = -1; + Projectile.frame = 11; + } + } + else + { + if (Projectile.frame <= 7) + { + Projectile.ai[0] = 0; + Projectile.frame = 0; + idleAnimation = false; + } + } + if (Projectile.frame > 8) + { + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(mouthPos, (Vector2.UnitX * -Projectile.spriteDirection).RotatedByRandom(MathHelper.ToRadians(10)) * Main.rand.NextFloat(4, 8), new Color(201, 234, 71), new Color(115, 192, 58), Main.rand.NextFloat(0.8f, 1.1f), 170f, Main.rand.NextFloat(0.1f, 0.2f) * Main.rand.NextFloatDirection())); + } + } + else + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + } + //falling frame + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) + { + Projectile.frame = 7; + Projectile.frameCounter = 0; + } + else if (Projectile.velocity.X != 0) + { + //moving animation + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + } + + if (Projectile.velocity.X > 0.8f) + { + Projectile.spriteDirection = -1; + } + else if (Projectile.velocity.X < -0.8f) + { + Projectile.spriteDirection = 1; + } + } + else if (fly) + { + idleAnimation = false; + Projectile.ai[0] = 0; + float flySpeed = 0.5f; + Projectile.tileCollide = false; + Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)player.direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 1200f) + { + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + flySpeed = 0.5f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 10 && Projectile.Center.Y <= player.Center.Y && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + fly = false; + Projectile.velocity *= 0.2f; + Projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) + { + Projectile.velocity *= 0.90f; + } + flySpeed = 0.02f; + } + else + { + if (playerDistance < 100f) + { + flySpeed = 0.35f; + } + if (playerDistance > 300f) + { + flySpeed = 1f; + } + playerDistance = 18f / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } + if (Projectile.velocity.X <= horiPos) + { + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X < 0f) + { + Projectile.velocity.X = Projectile.velocity.X + flySpeed; + } + } + if (Projectile.velocity.X > horiPos) + { + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.X > 0f) + { + Projectile.velocity.X = Projectile.velocity.X - flySpeed; + } + } + if (Projectile.velocity.Y <= vertiPos) + { + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y < 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f; + } + } + if (Projectile.velocity.Y > vertiPos) + { + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed; + if (flySpeed > 0.05f && Projectile.velocity.Y > 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0); + + if (Projectile.Center.X < Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = -1; + } + else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = 1; + } + + Projectile.frame = 12; + + // fly anim particles + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(mouthPos, mouthPos.DirectionTo(Projectile.oldPosition).RotatedByRandom(MathHelper.ToRadians(20)).RotatedBy(MathHelper.ToRadians(10 * Projectile.spriteDirection)) * Main.rand.NextFloat(4, 8), new Color(201, 234, 71), new Color(115, 192, 58), Main.rand.NextFloat(0.7f, 1f), 200f, Main.rand.NextFloat(0.1f, 0.2f) * Main.rand.NextFloatDirection())); + } + } + + private bool HoleBelow() + { + int tileWidth = 4; + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].HasTile && (Main.tile[x - 1, y].HasTile || Main.tile[x + 1, y].HasTile)) + { + return false; + } + } + } + return true; + } + } +} diff --git a/Projectiles/Pets/StarSwallowerPet.png b/Projectiles/Pets/StarSwallowerPet.png new file mode 100644 index 0000000000..d3812caa71 Binary files /dev/null and b/Projectiles/Pets/StarSwallowerPet.png differ 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 new file mode 100644 index 0000000000..039a95a092 --- /dev/null +++ b/Projectiles/Ranged/AbyssalFire.cs @@ -0,0 +1,242 @@ +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; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; + +namespace CalamityMod.Projectiles.Ranged +{ + [PierceResistException] + public class AbyssalFire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public Vector2[] ControlPoints; + + public static int MaxLaserControlPoints => 32; + + public static int MaxLaserLength => 3330; + + public static int MaxLaserWidth => 90; + + public Player Owner => Main.player[Projectile.owner]; + + public Projectile VoidragonHoldout => Main.projectile[(int)Projectile.ai[0]]; + + public ref float LaserLength => ref Projectile.ai[1]; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + + public override void SetDefaults() + { + Projectile.width = Projectile.height = MaxLaserWidth; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + LaserLength = 0.05f; + } + + public override void AI() + { + // If the owner is no longer able to cast the beam, kill it. + if (Owner.CantUseHoldout() || VoidragonHoldout is null) + { + Projectile.Kill(); + return; + } + + // Decide where to position the laserbeam. + Vector2 circlePointDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.Center = VoidragonHoldout.ModProjectile().GunTipPosition - ((Projectile.velocity * 12f).RotatedBy(-0.02f * Projectile.direction)); + + int beamTimer = VoidragonHoldout.ModProjectile().beamTimer; + float beamWidthInterpolant = Utils.GetLerpValue(0, 25, beamTimer, true); + + // Set the control points for the primitive drawing. + ControlPoints ??= new Vector2[MaxLaserControlPoints]; + for (int i = 0; i < MaxLaserControlPoints; i++) + ControlPoints[i] = Projectile.Center + Projectile.velocity * i / (ControlPoints.Length - 1f) * MaxLaserLength; + + // Grow and shrink depending on how long left the laser has to remain active. + Projectile.scale = MathHelper.Lerp(0f, 1f, CalamityUtils.ExpOutEasing(beamWidthInterpolant, 2)); + LaserLength = MathHelper.Lerp(LaserLength, 1f, 0.032f); + + // Update aim. + UpdateAim(); + + // Spawn a bunch of particles along the length of the laser. + if (Projectile.scale >= 0.25f) + { + BezierCurve curve = new(ControlPoints); + float tipRatio = 0.042f; + for (int i = 0; i < 10; i++) + { + Vector2 tipSpawnPosition = curve.Evaluate(Main.rand.NextFloat(0f, tipRatio)); + Vector2 bodySpawnPosition = curve.Evaluate(Main.rand.NextFloat(tipRatio, 1f)); + Vector2 fireVelocity = Owner.SafeDirectionTo(Main.MouseWorld).RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(25f, 30f); + + Color fireColorBackground = Color.Lerp(Color.DarkViolet, Color.Black, 0.25f); + + int fireLifetime = Main.rand.Next(45, 60); + float fireScale = Main.rand.NextFloat(1.75f, 2.25f) * Projectile.scale; + float fireOpacity = Main.rand.NextFloat(0.65f, 0.95f); + + HeavySmokeParticle abyssalFlamesBodyBackground = new(bodySpawnPosition, fireVelocity, fireColorBackground, fireLifetime, fireScale, 1f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), false); + GeneralParticleHandler.SpawnParticle(abyssalFlamesBodyBackground, true, GeneralDrawLayer.BeforeProjectiles); + + HeavySmokeParticle abyssalFlamesBodyForeground = new(bodySpawnPosition, fireVelocity, Main.rand.NextBool(4) ? Color.White : Color.Purple, fireLifetime, fireScale * 0.6f, 0.8f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true); + GeneralParticleHandler.SpawnParticle(abyssalFlamesBodyForeground, true, GeneralDrawLayer.AfterProjectiles); + + HeavySmokeParticle abyssFlamesTip = new(tipSpawnPosition, fireVelocity, Color.White, fireLifetime, fireScale * 0.52f, 0.3f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true); + GeneralParticleHandler.SpawnParticle(abyssFlamesTip, true, GeneralDrawLayer.AfterProjectiles); + } + + for (int i = 0; i < 3; i++) + { + Vector2 fireVelocity = Owner.SafeDirectionTo(Main.MouseWorld).RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(15f, 20f); + HeavySmokeParticle whiteFlames = new(Projectile.Center - Projectile.velocity * 8f, fireVelocity, Color.White, Main.rand.Next(15, 20), 0.64f, 0.7f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true); + GeneralParticleHandler.SpawnParticle(whiteFlames, true, GeneralDrawLayer.AfterDusts); + } + } + + // Shake the screen slightly. + if (Owner.Calamity().GeneralScreenShakePower < 1.15f) + Owner.Calamity().GeneralScreenShakePower = MathHelper.Lerp(0f, 1.15f, Projectile.scale / 2f); + + // Make the beam cast light along its length. The brightness of the light is reliant on the scale of the beam. + DelegateMethods.v3_1 = Color.DarkViolet.ToVector3() * Projectile.scale * 0.4f; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * MaxLaserLength, Projectile.width * Projectile.scale, DelegateMethods.CastLight); + } + + public void UpdateAim() + { + // Only execute the aiming code for the owner. + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 newAimDirection = VoidragonHoldout.velocity.SafeNormalize(Vector2.UnitY); + + // Sync if the direction is different from the old one. + // Spam caps are ignored due to the frequency of this happening. + if (newAimDirection != Projectile.velocity) + { + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + + Projectile.velocity = newAimDirection; + } + 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); + } + + private Color PrimitiveColorFunction(float completionRatio, Vector2 vertexPos) + { + + return Color.White * Projectile.Opacity; + } + + public override bool PreDraw(ref Color lightColor) + { + Asset mainStreakTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise"); + int beamTimer = VoidragonHoldout.ModProjectile().beamTimer; + float beamWidthInterpolant = Utils.GetLerpValue(500, 460, beamTimer, true); + + if (ControlPoints is null) + return false; + + Main.spriteBatch.End(out var snapshot); + + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + + using (lease.Scope(clearColor: Color.Transparent)) + { + MiscShaderData shader = GameShaders.Misc["CalamityMod:AbyssalFire"]; + shader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + shader.Shader.Parameters["glowPower"].SetValue(0.8f); + shader.Shader.Parameters["overallColorStrength"].SetValue(1f - beamWidthInterpolant); + shader.Shader.Parameters["edgeFadeoutThreshold"].SetValue(0.46f); + shader.Shader.Parameters["noiseScale"].SetValue(new Vector2(4f, 0.5f)); + shader.Shader.Parameters["innerColor"].SetValue(Color.DarkViolet.ToVector3()); + shader.Shader.Parameters["outerColor"].SetValue(Color.Black.ToVector3()); + shader.Shader.Parameters["overallColor"].SetValue(Color.White.ToVector3()); + shader.Shader.Parameters["tipColor"].SetValue(Color.White.ToVector3()); + + device.Textures[1] = mainStreakTexture.Value; + + PrimitiveRenderer.RenderTrail(ControlPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: shader, useUnscaledMatrices: true, capStyle: PrimitiveCapStyle.Flat), ControlPoints.Length); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(snapshot); + + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * MaxLaserLength); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + target.AddBuff(ModContent.BuffType(), 180); + int bonusDamage = 200 * Owner.Calamity().sharkGunDamageScaling; + if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage) + { + target.Calamity().demonicFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 180); + // Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC + if (Main.netMode != NetmodeID.SinglePlayer) + DemonicFlamesSyncPacket.Send(target); + } + } + + public override bool ShouldUpdatePosition() => false; + } +} 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/ArcherfishHoldout.cs b/Projectiles/Ranged/ArcherfishHoldout.cs new file mode 100644 index 0000000000..d239529cfa --- /dev/null +++ b/Projectiles/Ranged/ArcherfishHoldout.cs @@ -0,0 +1,149 @@ +using CalamityMod.Items.Weapons.Ranged; +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.ModLoader; +using Terraria.ID; +using CalamityMod.Projectiles.Melee; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ArcherfishHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + public bool PostVolley = false; + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || !PostVolley && HeldItem.type != Owner.HeldItem.type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Set the scaling to 0 as soon as the holdout spawns + if (Time == 1) + { + Owner.Calamity().sharkGunDamageScaling = 0; + } + if (Time >= 10) + { + if (framesBetweenShots == 0 && shotCounter <= 25) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15; + #region Debug Text Display + //Main.NewText(shotCounter); + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #endregion + #region Visuals and Sounds + SoundEngine.PlaySound(SoundID.Item85, Projectile.Center); + #endregion + + //How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate + framesBetweenShots = 6; + OffsetLengthFromArm -= 3f; + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + shotCounter++; + //Frame time is much longer due to Archerfish working differently, and handling both the shot and the "reload" on the same step + if (shotCounter == 25) + framesBetweenShots = 100; + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + if (shotCounter == 25 && framesBetweenShots > 0) + { + //Holdout cannot be killed during the final shot and cooldown + PostVolley = true; + Owner.channel = true; + //If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the final shot doing 0 damage + if (Owner.Calamity().sharkGunDamageScaling == 0) + { + Owner.Calamity().sharkGunDamageScaling++; + } + //Pauses before triggering the final water blast. This allows extra water streams time to hit. Increasing this number reduces the delay, but may also cause the gun to become inconsistent + if (framesBetweenShots == 80) + { + SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), Owner.Center); + SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), Owner.Center); + //Fires the water jet. Damage is 20% of base, multiplied by how many shots hit. + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner); + } + #region Post Firing Visuals and Sounds + //After the water blast is fired, make the fish "sweat" during the reload + //I don't think this is how science works + if (framesBetweenShots % 6 == 0 && framesBetweenShots <= 80) + { + for (int i = 0; i < 2; ++i) + { + int bloodLifetime = Main.rand.Next(12, 15); + float bloodScale = Main.rand.NextFloat(0.4f, 0.6f); + Color bloodColor = Color.Lerp(Color.LightBlue * 0.7f, Color.LightBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 1.5f; + + float randomSpeedMultiplier = Main.rand.NextFloat(0.8f, 1.5f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 3f; + BloodParticle blood = new BloodParticle(Projectile.Center + (Projectile.velocity * 14f).RotatedBy(-0.8f * Projectile.direction), bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + //Takes a heavy breath every 25 frames after the final shot is fired + if (framesBetweenShots % 25 == 0 && framesBetweenShots <= 75) + { + for (int i = 0; i < 4; i++) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4; + Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.White, Main.rand.Next(20, 40 + 1), Main.rand.NextFloat(0.2f, 0.3f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + SoundEngine.PlaySound(SoundID.Item111 with { Pitch = 0.05f, PitchVariance = 0.25f, MaxInstances = -1 }, Projectile.Center); + OffsetLengthFromArm -= 4.5f; + } + #endregion + + } + if (shotCounter == 25 && framesBetweenShots == 0) + { + if (framesBetweenShots == 0) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.Center); + //After firing the water blast, kill the projectile to allow left click to be held down + Projectile.Kill(); + } + } + Time++; + } + 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; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Ranged/BlahajBlast.cs b/Projectiles/Ranged/BlahajBlast.cs new file mode 100644 index 0000000000..95aa8fe572 --- /dev/null +++ b/Projectiles/Ranged/BlahajBlast.cs @@ -0,0 +1,143 @@ +using System.Composition.Hosting.Core; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlahajBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static int Lifetime = 600; + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.alpha = 255; + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.tileCollide = false; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + if (Projectile.timeLeft <= Lifetime - 4) + { + if (Projectile.ai[0] == 0) + { + Particle transspark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1.1f, Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.DeepSkyBlue : Color.White) : Color.DeepPink); + GeneralParticleHandler.SpawnParticle(transspark); + } + else + { + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1.1f, Color.Aquamarine); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(8)) + { + MediumMistParticle smoke = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(25, 25), -Projectile.velocity * 0.05f, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Color.DarkBlue, 0.5f, 180, 3f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + if (Projectile.timeLeft <= Lifetime - 8) + { + if (Main.rand.NextBool(2)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), ModContent.DustType(), -Projectile.velocity); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.1f); + dust.color = Main.rand.NextBool() ? Color.DarkBlue : Color.DarkBlue * 0.5f; + + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 30, Main.rand.NextFloat(0.4f, 0.6f), Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(trail); + } + } + } + + public override void OnKill(int timeLeft) + { + // Bubbles + for (int i = 0; i < 10; i++) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + //Only spawn rocket on the first hit + if (Projectile.numHits == 0 && Main.myPlayer == Projectile.owner) + { + Player Owner = Main.player[Projectile.owner]; + Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + fishy.ai[2] = ((Owner.Calamity().sharkGunDamageScaling + 1) * 0.02f) + 0.1f; + } + OnHitEffects(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + { + target.AddBuff(ModContent.BuffType(), 60); + //Only spawn rocket on the first hit + if (Projectile.numHits == 0 && Main.myPlayer == Projectile.owner) + { + Player Owner = Main.player[Projectile.owner]; + Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + fishy.ai[2] = ((Owner.Calamity().sharkGunDamageScaling + 1) * 0.02f) + 0.1f; + } + OnHitEffects(); + } + } + + private void OnHitEffects() + { + for (int i = 0; i < 4; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } +} diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index 63e38eac06..cd9a71eb7d 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt(); if (Main.myPlayer == Projectile.owner) { - float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. + float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower); int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower); Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.HeldItem.shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel); @@ -179,13 +179,16 @@ namespace CalamityMod.Projectiles.Ranged } // The holdout can deal damage; you're literally spinning up a buzzsaw at the end, after all. - public override bool? CanDamage() => !NoSawOnHoldout; + public override bool? CanDamage() => !NoSawOnHoldout && Time % Projectile.localNPCHitCooldown == 0; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 240); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition); + if (damageDone > 2 && !target.Calamity().IsArmored()) + Projectile.damage = (int)(Projectile.damage * 0.8f); + int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt(); int bloodCount = 4 + 3 * SawLevel; for (int p = 0; p < bloodCount; p++) diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 5913c8504c..34655082c4 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -52,10 +52,6 @@ namespace CalamityMod.Projectiles.Ranged baseColor = Color.MediumOrchid; } baseVel = Projectile.velocity; - if (Svant) - Projectile.ArmorPenetration = 200; - if (Infinity) - Projectile.ArmorPenetration = 20; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft == 2) diff --git a/Projectiles/Ranged/ChargedBlastSplit.cs b/Projectiles/Ranged/ChargedBlastSplit.cs index 6aafc4fdff..a9f615012a 100644 --- a/Projectiles/Ranged/ChargedBlastSplit.cs +++ b/Projectiles/Ranged/ChargedBlastSplit.cs @@ -53,15 +53,9 @@ namespace CalamityMod.Projectiles.Ranged baseColor = Color.MediumOrchid; startVel = Projectile.velocity; if (Infinity) - { Projectile.timeLeft = 340; - Projectile.ArmorPenetration = 20; - } if (Svant) - { Projectile.timeLeft = 640; - Projectile.ArmorPenetration = 200; - } direction = Main.rand.NextBool(); homeSpeed = Main.rand.NextFloat(5, 8); } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 6105c72c87..989ceead5a 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -60,8 +60,7 @@ namespace CalamityMod.Projectiles.Ranged Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 17, 0.052f, Color.Black, new Vector2(0.6f, 1.3f), false); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (Time == 9f) @@ -111,8 +110,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 3; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f, 0.52f, 38); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } float numberOfDusts = 10; @@ -124,8 +122,6 @@ namespace CalamityMod.Projectiles.Ranged dust.scale = Main.rand.NextFloat(1.6f, 2.2f); dust.color = InnerColor; } - //Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0f, 0.1f, 15); - //GeneralParticleHandler.SpawnParticle(pulse); if (BounceHits == 0f) SoundEngine.PlaySound(DeadSunsWind.Ricochet, Projectile.Center); 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/DeadSunExplosion.cs b/Projectiles/Ranged/DeadSunExplosion.cs index 18d952eb85..06872fddbf 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -33,8 +33,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, color1, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0065f + 0.1f, Main.rand.Next(15, 22)); - GeneralParticleHandler.SpawnParticle(explosion); - explosion.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(explosion, false, GeneralDrawLayer.AfterEverything); Particle explosion2 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0045f + 0.1f, Main.rand.Next(15, 22), false); GeneralParticleHandler.SpawnParticle(explosion2); Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false); @@ -43,8 +42,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 4; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } float numberOfDusts = ExplosionRadius * 0.1f + 10; diff --git a/Projectiles/Ranged/DryadsTearMain.cs b/Projectiles/Ranged/DryadsTearMain.cs index b014d84d92..25268fe87a 100644 --- a/Projectiles/Ranged/DryadsTearMain.cs +++ b/Projectiles/Ranged/DryadsTearMain.cs @@ -330,13 +330,13 @@ namespace CalamityMod.Projectiles.Ranged 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(Owner.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); blast.timeLeft = 8; blast.DamageType = DamageClass.Ranged; blast.ArmorPenetration = Projectile.ArmorPenetration; } if (damageMult >= 0.75f) - Owner.SetScreenshake(6f * damageMult); + Owner.SetScreenshake(3f * damageMult); } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -351,7 +351,6 @@ namespace CalamityMod.Projectiles.Ranged } if (damageMult >= 0.75f) { - Owner.SetScreenshake(4f * damageMult); float angle = Main.rand.NextFloat(0, MathHelper.TwoPi); for (int i = -6; i <= 6; i++) // 12 { @@ -380,7 +379,7 @@ namespace CalamityMod.Projectiles.Ranged modifiers.SourceDamage *= damageMult; } - public override bool? CanHitNPC(NPC target) => time > 1 && Projectile.numHits == 0; + public override bool? CanHitNPC(NPC target) => ((time > 1) ? null : false && Projectile.numHits == 0); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float hitboxSize = 20 * Projectile.scale * damageMult; diff --git a/Projectiles/Ranged/FetidEmesisHoldout.cs b/Projectiles/Ranged/FetidEmesisHoldout.cs index c712407bed..0cd504db1b 100644 --- a/Projectiles/Ranged/FetidEmesisHoldout.cs +++ b/Projectiles/Ranged/FetidEmesisHoldout.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged revFrames++; shineScale *= 0.77f; - if ((revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) && Owner.whoAmI == Main.myPlayer) + if (revFrames >= maxFrames && !isTired && Owner.whoAmI == Main.myPlayer) { Owner.SetScreenshake(6.5f); OffsetLengthFromArm -= 35f; 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/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs index e4380d6c83..a81a01cb47 100644 --- a/Projectiles/Ranged/HellbornHoldout.cs +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -13,7 +13,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - [PierceResistException] public class HellbornHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index bb2953d0f9..f49e952770 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -117,6 +117,9 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (falling) + modifiers.SourceDamage *= 0.75f; + if (Projectile.numHits > 1 && falling) Projectile.damage = (int)(Projectile.damage * 0.5f); if (Projectile.damage < 1) diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index ca668b7d03..f4cdb22e3e 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 22; Projectile.friendly = true; Projectile.aiStyle = ProjAIStyleID.MechanicalPiranha; + Projectile.ContinuouslyUpdateDamageStats = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Ranged/MegalodonHoldout.cs b/Projectiles/Ranged/MegalodonHoldout.cs new file mode 100644 index 0000000000..f6034ee9d6 --- /dev/null +++ b/Projectiles/Ranged/MegalodonHoldout.cs @@ -0,0 +1,172 @@ +using CalamityMod.Items.Weapons.Ranged; +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.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MegalodonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 50).RotatedBy(0.13f * Projectile.direction); + + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + public bool swapType = false; + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Pause to give the effect of reloading + if (Time == 30) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "MegalodonMag"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + //Set the scaling to 0 whenever it reloads + Owner.Calamity().sharkGunDamageScaling = 0; + } + if (Time >= 90) + { + if (framesBetweenShots == 0 && shotCounter <= 31) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Debug Text Display + //Main.NewText(shotCounter); + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #endregion + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny"); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.4f, PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center); + Particle sparker = new CritSpark(GunTipPosition, Vector2.Zero, Color.Gold, Color.LightGoldenrodYellow, 1.7f, 3, 0.5f, 3f); + GeneralParticleHandler.SpawnParticle(sparker); + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + #endregion + + //How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate + framesBetweenShots = 4; + OffsetLengthFromArm -= 3f; + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + //Alternate between shooting bullets and water streams. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier + if (Main.myPlayer == Projectile.owner) + { + if (!swapType) + { + Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + CalamityGlobalProjectile cgp = scalingShot.Calamity(); + cgp.sharkBullets = true; + //Only eject casings from the gun if bullets are fired, preventing too many at once + if (Main.netMode != NetmodeID.Server) + { + string goreType = "MegalodonCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + } + if (swapType) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + swapType = !swapType; + } + shotCounter++; + //Allow a pause before firing the rocket. This allows the final bullet a chance to hit before the rocket is fired. Lowering this number reduces the delay, but may also cause the gun to become inconsistent + if (shotCounter == 30) + framesBetweenShots = 18; + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + if (shotCounter == 30 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30; + //Debug Text + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0.2f }, Projectile.Center); + for (int i = 0; i <= 13; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.1f), 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.8f)); + 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)); + } + for (int i = 0; i < 14; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.RoyalBlue, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + float rotation = Projectile.velocity.ToRotation(); + Particle pulse = new DirectionalPulseRing(GunTipPosition, shootVelocity / 4, Color.Gray, new Vector2(1f, 2.5f), rotation, 0.03f, 0.3f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + //Extra sound and muzzle flash if the scaling is at max + if (Owner.Calamity().sharkGunDamageScaling == 30) + { + SoundStyle fireperfect = new("CalamityMod/Sounds/Item/ShadowboltReflect"); + SoundEngine.PlaySound(fireperfect with { Volume = 0.6f, Pitch = 0f }, GunTipPosition); + GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 10, 2f, 2.68f); + GeneralParticleHandler.SpawnParticle(sparker); + } + #endregion + + //If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the rocket doing 0 damage + if (Owner.Calamity().sharkGunDamageScaling == 0) + { + Owner.Calamity().sharkGunDamageScaling++; + } + //Fire the rocket. Damage is 50% of base, multiplied by how many shots the player hits + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner); + + //After firing the rocket, reset all variables to allow left click to be held down + Time = 2; + shotCounter = 0; + } + Time++; + } + 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; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Ranged/MegalodonRocket.cs b/Projectiles/Ranged/MegalodonRocket.cs new file mode 100644 index 0000000000..8f1afbfe1a --- /dev/null +++ b/Projectiles/Ranged/MegalodonRocket.cs @@ -0,0 +1,107 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MegalodonRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public static int Lifetime = 600; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 46; + Projectile.height = 38; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 600; + AIType = ProjectileID.Bullet; + } + + public override void AI() + { + //Rotation + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) * Projectile.direction; + + Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); + if (Projectile.timeLeft <= Lifetime - 6) + { + AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.Gold * 0.1f); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(3)) + { + SparkParticle spark2 = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + } + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Torch, Projectile.velocity, 500, default, 0.5f); + dust.scale = Main.rand.NextFloat(0.7f, 1.5f); + dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3); + dust.noGravity = true; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, DustID.Smoke, Projectile.velocity, 500, default, 0.5f); + dust2.scale = Main.rand.NextFloat(0.7f, 1.5f); + dust2.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3); + dust2.noGravity = true; + } + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f); + } + + public override bool PreDraw(ref Color lightColor) + { + 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(), 240); + } + + public override void OnKill(int timeLeft) + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MegalodonMissileMax") with { Volume = 1.5f }, Projectile.position); + } + else + { + SoundEngine.PlaySound(AbyssGravel.MineSound, Projectile.position); + SoundEngine.PlaySound(GiantClam.SlamSound, Projectile.position); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.5f), Projectile.position); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Volume = 0.6f, Pitch = 0.8f }, Projectile.position); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 1f, 0f, 25)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 0.5f, 0f, 15)); + + for (int i = 0; i < 8; i++) GeneralParticleHandler.SpawnParticle(new BloodParticle2(Projectile.Center, new Vector2(Main.rand.NextFloat(6, 12), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), 12, Main.rand.NextFloat(0.3f, 0.4f), Color.DarkGoldenrod * 0.8f)); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RoyalBlue * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.CornflowerBlue, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.07f, 15); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 10; i++) + { + Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.5f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.6f, 1.5f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + } +} diff --git a/Projectiles/Ranged/MegalodonRocket.png b/Projectiles/Ranged/MegalodonRocket.png new file mode 100644 index 0000000000..790f4a2feb Binary files /dev/null and b/Projectiles/Ranged/MegalodonRocket.png differ diff --git a/Projectiles/Ranged/MegalodonShot.cs b/Projectiles/Ranged/MegalodonShot.cs index f6589a5697..12989d8278 100644 --- a/Projectiles/Ranged/MegalodonShot.cs +++ b/Projectiles/Ranged/MegalodonShot.cs @@ -1,7 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static int Lifetime = 600; + public override void SetDefaults() { Projectile.width = 8; @@ -20,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.penetrate = 2; Projectile.alpha = 255; - Projectile.timeLeft = 600; + Projectile.timeLeft = Lifetime; Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -28,7 +31,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - // Bubbles if (Main.rand.NextBool()) { Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); @@ -36,15 +38,25 @@ namespace CalamityMod.Projectiles.Ranged bubble.scale = Main.rand.NextFloat(0.6f, 1f); bubble.type = Main.rand.NextBool(3) ? 412 : 411; } - - // Water trail - for (int i = 0; i < 6; i++) + if (Projectile.timeLeft <= Lifetime - 4) { - Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Wet, 0f, 0f, 100); - water.noGravity = true; - water.velocity = Projectile.velocity * 0.5f; + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1f, Color.RoyalBlue * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 45 : 56, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.01f, 0.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.5f, 0.9f); + } } } + //We use TileCollide and Onhit instead of OnKill due to it having pierce + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + OnHitEffects(); + return true; + } public override void OnKill(int timeLeft) { @@ -57,7 +69,55 @@ namespace CalamityMod.Projectiles.Ranged bubble.type = Main.rand.NextBool(3) ? 412 : 411; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + //Only increase damage of the rocket on the first hit + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().sharkGunDamageScaling++; + } + OnHitEffects(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + { + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().sharkGunDamageScaling++; + } + target.AddBuff(ModContent.BuffType(), 60); + OnHitEffects(); + } + } + + private void OnHitEffects() + { + for (int i = 0; i < 4; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark2); + } + } } } 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/OmniGrenade.cs b/Projectiles/Ranged/OmniGrenade.cs new file mode 100644 index 0000000000..2873b4aea4 --- /dev/null +++ b/Projectiles/Ranged/OmniGrenade.cs @@ -0,0 +1,111 @@ +using System.Runtime.CompilerServices; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +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.Ranged +{ + public class OmniGrenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 1800; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += 0.3f; + int fire = Dust.NewDust(Projectile.position, Projectile.width, (int)(Projectile.height * 0.1f), DustID.Torch, 0f, 0f, 100, default); + Main.dust[fire].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[fire].scale = 0.3f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + + Projectile.rotation = Projectile.velocity.ToRotation(); + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 7f }, Projectile.Center); + Projectile.ExpandHitboxBy(250); + Projectile.Damage(); + Player Owner = Main.player[Projectile.owner]; + Owner.SetScreenshake(3f); + for (int i = 0; i < 2; i++) + { + Particle center = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 11, 0.95f, Color.OrangeRed * 0.8f, new Vector2(1f, 1f), true, true, glowOpacity: 0.9f); + GeneralParticleHandler.SpawnParticle(center); + } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.15f, 21, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.07f, 21); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.1f, 21, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/RoarPulse", new Vector2(1f, 1f), 0, 0.01f, 0.4f, 15, true); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/SmallBloomRing", new Vector2(1f, 1f), 0, 0.01f, 4f, 15, true, 0.8f); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 12; i++) + { + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, Main.rand.Next(10, 15), Main.rand.NextFloat(1f, 1.2f), Main.rand.NextBool() ? Color.OrangeRed : Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 1; i < 21; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(9f, 14f); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Gold; + } + for (int j = 0; j < 25; j++) + { + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 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.Torch, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; + } + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + if (target == Owner) + { + modifiers.SourceDamage *= 0f; + if (Main.masterMode) modifiers.SourceDamage.Flat += 240f; + else if (Main.expertMode) modifiers.SourceDamage.Flat += 180f; + else modifiers.SourceDamage.Flat += 120f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniGrenade.png b/Projectiles/Ranged/OmniGrenade.png new file mode 100644 index 0000000000..408648ebb0 Binary files /dev/null and b/Projectiles/Ranged/OmniGrenade.png differ diff --git a/Projectiles/Ranged/OmniGunHoldout.cs b/Projectiles/Ranged/OmniGunHoldout.cs new file mode 100644 index 0000000000..db17fe5d03 --- /dev/null +++ b/Projectiles/Ranged/OmniGunHoldout.cs @@ -0,0 +1,234 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +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.Projectiles.Ranged +{ + public class OmniGunHoldout : BaseGunHoldoutProjectile + { + + public static Asset MuzzleFlash; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 51); + public override float RecoilResolveSpeed => CurrentRecoilResolveSpeed; + + public float CurrentRecoilResolveSpeed = 0; + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + private float flashVariant; + public override void Load() + { + MuzzleFlash = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad); + } + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Pause to give the effect of reloading + if (Time == 20) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + } + if (Time >= 70) + { + if (framesBetweenShots == 0) + { + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + #region Sniper Shot + if (shotCounter == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotBig") with { Volume = 1f, Pitch = -0.1f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotHeavy") with { Volume = 0.35f, Pitch = -0.15f }, Projectile.Center); + + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniSniperCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + // "Smoke" ring + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18); + GeneralParticleHandler.SpawnParticle(shootPulse); + #endregion + OffsetLengthFromArm -= 20f; + CurrentRecoilResolveSpeed = 0.14f; + + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), (int)(Projectile.damage * 6f), Projectile.knockBack, Projectile.owner); + shotCounter++; + framesBetweenShots = 40; + } + #endregion + #region AR Burst + if (shotCounter >= 1 && shotCounter <= 10 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmallAlt"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = 0.1f}, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniARCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + // Direct smoke + for (int i = 0; i < 2; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + #endregion + framesBetweenShots = 8; + OffsetLengthFromArm -= 3f; + CurrentRecoilResolveSpeed = 0.3f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + shotCounter++; + if (shotCounter > 10) + framesBetweenShots = 30; + } + #endregion + #region Shotgun Blast + if (shotCounter == 11 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra"); + SoundEngine.PlaySound(FireSound with { Volume = 0.7f }, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniShotgunShell"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + // Direct smoke + for (int i = 0; i < 16; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + // "Smoke" ring + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18); + GeneralParticleHandler.SpawnParticle(shootPulse); + #endregion + framesBetweenShots = 8; + OffsetLengthFromArm -= 20f; + CurrentRecoilResolveSpeed = 0.12f; + + // Propel the owner backward + Owner.velocity += -Projectile.velocity * 7f; + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < 8; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 1.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 3f), Projectile.knockBack, Projectile.owner); + } + shotCounter++; + if (shotCounter > 11) + framesBetweenShots = 30; + } + #endregion + #region Grenade + if (shotCounter == 12 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30; + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, PitchVariance = 0.1f }, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniGrenadeShell"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + for (int i = 0; i <= 13; i++) + { + 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, 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)); + } + ; + #endregion + OffsetLengthFromArm -= 24f; + CurrentRecoilResolveSpeed = 0.15f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 9f), Projectile.knockBack, Projectile.owner); + Time = 0; + shotCounter = 0; + } + #endregion + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + Time++; + } + 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); + float scale = Projectile.scale * Owner.gravDir; + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + // Flash + if (Time == 70 || shotCounter == 11 && framesBetweenShots == 0) + { + Texture2D flashTex = MuzzleFlash.Value; + int flashFrameY = (int)flashVariant; + Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.4f - Main.screenPosition; + Rectangle flashFrame = flashTex.Frame(verticalFrames: 3, frameY: flashFrameY); + Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale * 0.8f, flipSprite); + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, scale, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniShotgunShot.cs b/Projectiles/Ranged/OmniShotgunShot.cs new file mode 100644 index 0000000000..814c889888 --- /dev/null +++ b/Projectiles/Ranged/OmniShotgunShot.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OmniShotgunShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.BulletHighVelocity; + Projectile.extraUpdates = 3; + Projectile.penetrate = 1; + Projectile.timeLeft = 15; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + return false; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.ExpandHitboxBy(32); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + } + for (int d = 0; d < 10; d++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; + } + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + } +} diff --git a/Projectiles/Ranged/OmniShotgunShot.png b/Projectiles/Ranged/OmniShotgunShot.png new file mode 100644 index 0000000000..bc8355e36c Binary files /dev/null and b/Projectiles/Ranged/OmniShotgunShot.png differ diff --git a/Projectiles/Ranged/OmniSniperShot.cs b/Projectiles/Ranged/OmniSniperShot.cs new file mode 100644 index 0000000000..6d7b7f76f1 --- /dev/null +++ b/Projectiles/Ranged/OmniSniperShot.cs @@ -0,0 +1,110 @@ +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OmniSniperShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public const int DoubleDamageTime = 90; + public static int Lifetime = 600; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 6; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 7; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.BulletHighVelocity; + Projectile.penetrate = 5; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.damage += Projectile.originalDamage / DoubleDamageTime; + if (Projectile.timeLeft == Lifetime - 2) + { + for (int i = 0; i <= 4; i++) //Dragon's Breath shot particles my beloved + { + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f); + SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f); + SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (Projectile.timeLeft < Lifetime - 3 && Projectile.timeLeft > Lifetime - 150) + { + SparkParticle spark = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 9, 1.2f, Color.Coral * 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + return true; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Always critically strikes + modifiers.SetCrit(); + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold); + GeneralParticleHandler.SpawnParticle(spark2); + } + + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniSniperShot.png b/Projectiles/Ranged/OmniSniperShot.png new file mode 100644 index 0000000000..5961f68208 Binary files /dev/null and b/Projectiles/Ranged/OmniSniperShot.png differ diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index 6490f6fa34..bf2fc16015 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = true; - Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 876f0a59a8..9a9a0820d6 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public Color FogColor = Color.Orchid; public float FogRotation = 0; public int boomTime = PristineFury.boomTime; + public int fullDamageHitCooldown = 0; public bool Ignited = false; @@ -34,8 +35,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 230; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.ArmorPenetration = 30; } public override void AI() @@ -46,12 +48,14 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.ai[2] == boomTime) { - // Xyk: "This is probably too much lol" - // Yeah I'd say 7x base damage is a bit much - // Xyk: Follow up, the inital damage is nerfed AND it has a "cooldown" 7x should now be fine... - Projectile.damage *= (int)7; + Projectile.damage = (int)(Projectile.damage * 7.2f); FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); + Projectile.localNPCHitCooldown = -1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + fullDamageHitCooldown = 0; + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); SoundEngine.PlaySound(ignite with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, Projectile.Center); } @@ -78,6 +82,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= Main.rand.NextFloat(0.95f, 0.99f); Projectile.Opacity = Utils.GetLerpValue(280f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + if (fullDamageHitCooldown > 0) + fullDamageHitCooldown--; + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. if (Main.dedServ) return; @@ -120,8 +127,15 @@ namespace CalamityMod.Projectiles.Ranged public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.Opacity < 0.3f ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (fullDamageHitCooldown == 0 && !target.Calamity().IsArmored()) // Deal full damage + { + fullDamageHitCooldown = Projectile.localNPCHitCooldown; + } + else // Deal partial damage + modifiers.SourceDamage *= 0.06f; + if (Ignited) { 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/RicoshotCoin.cs b/Projectiles/Ranged/RicoshotCoin.cs index f8f2a35d1e..d8471f6b5e 100644 --- a/Projectiles/Ranged/RicoshotCoin.cs +++ b/Projectiles/Ranged/RicoshotCoin.cs @@ -34,21 +34,22 @@ namespace CalamityMod.Projectiles.Ranged // Because ricoshots have slight frame delays for dramatic effect, setting this too high will make them miss hilariously. public static float SuperpredictionRatio = 0.1f; - // The first copper coin struck adds +70% damage. Copper coins beyond the first add +20% damage. - // Maximum: 4 copper coins = +130% + // The first copper coin struck adds +125% damage. Copper coins beyond the first add +25% damage. + // Maximum: 4 copper coins = +200% // - // The copper numbers are intentionally significantly lower because Crackshot Colt is pre-boss. - // That, and the mechanic will always be available because they're dirt cheap. Killing a single enemy lets you perform dozens more ricoshots. - public static float CopperBonus = 0.7f; - public static float CopperMulticoinBonus = 0.2f; + // Cost is virtually unaccounted for as even in early game, 4 copper coins is dirt cheap. + // Despite this, the gimmick exclusively used for early game Crackshot Colt needs to not be outperformed by just firing normally. + // Therefore, its bonuses cannot drop much lower than this despite being significantly cheaper. + public static float CopperBonus = 1.25f; + public static float CopperMulticoinBonus = 0.25f; - // The first silver coin struck adds +150% damage. Silver coins beyond the first add +50% damage. - // Maximum: 4 silver coins = +300% + // The first silver coin struck adds +175% damage. Silver coins beyond the first add +50% damage. + // Maximum: 4 silver coins = +325% // // Midas Prime uses coins from the piggy bank, so you will almost always be using gold. // Silver is not much worse than gold, because if you're broke and can't use gold you shouldn't be significantly penalized. // However, spending multiple silver on a multi-ricoshot is not too expensive, so the multicoin bonus is much lower. - public static float SilverBonus = 1.5f; + public static float SilverBonus = 1.75f; public static float SilverMulticoinBonus = 0.5f; // The first gold coin struck adds +200% damage. Gold coins beyond the first add +85% damage. 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/SeaDragonMuzzleBlast.cs b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs deleted file mode 100644 index f8279c2f1d..0000000000 --- a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - - -namespace CalamityMod.Projectiles.Ranged -{ - public class SeaDragonMuzzleBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 80; - Projectile.height = 80; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft = 8; - Projectile.MaxUpdates = 4; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - // Belching smoke and flames copied from Handheld Tank with a few edits (lasts 8 frames, but all happens at once due to extra updates) - for (int i = 0; i < 30; ++i) - { - // Pick a random type of fire (there's a little water mixed in) - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 170; - break; - case 1: - case 2: - dustID = 174; - break; - default: - dustID = 33; - break; - } - - // Choose a random speed and angle to belch out the fire - float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); - float angleRandom = 0.07f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the fire particle - float scale = Main.rand.NextFloat(0.7f, 1.8f); - - // Actually spawn the fire - int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 240); - } - } -} diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 570618b113..40aae90c70 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,117 +1,205 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static tModPorter.ProgressUpdate; namespace CalamityMod.Projectiles.Ranged { public class SeaDragonRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + public ref float time => ref Projectile.ai[0]; + private bool beginStretchAnim = false; + private float progress = -1; + public bool attacking => Projectile.ai[1] == 5; // If the missile is launched at the enemy + public ref float moveSpeed => ref Projectile.ai[2]; // Some speed variation applied to the missiles based on spawn order public override void SetDefaults() { Projectile.width = 18; Projectile.height = 18; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 95; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.scale = 0.25f; } public override void AI() { - if (Projectile.ai[1] == 0f) - { - for (int i = 0; i < 5; i++) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[fire].scale = 0.5f; - Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - Projectile.ai[1] = 1f; - } + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.5f); + Player Owner = Main.player[Projectile.owner]; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3) + + if (attacking) // Fly at the enemy { - Projectile.tileCollide = false; - Projectile.ai[1] = 0f; - Projectile.alpha = 255; - Projectile.position.X = Projectile.Center.X; - Projectile.position.Y = Projectile.Center.Y; - Projectile.width = 200; - Projectile.height = 200; - Projectile.position.X -= (float)(Projectile.width / 2); - Projectile.position.Y -= (float)(Projectile.height / 2); - Projectile.knockBack = 10f; + NPC chosenTarget = Projectile.Center.ClosestNPCAt(600); + CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 1.4f + moveSpeed, 25, 0.985f); + if (chosenTarget != null) + Projectile.timeLeft++; // Don't die if you have a target to home in on } - else + else // Swarm around the player until ready to be fired { - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) + Vector2 circle = Owner.Center + new Vector2(0, -195 + moveSpeed * 25).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 12) + Projectile.velocity = Projectile.velocity * 0.97f + moveToEnemy * moveSpeed; + else + Projectile.velocity *= 0.9f; + if (time % 2 == 0) + Projectile.netUpdate = true; + } + if (Main.rand.NextBool(10)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); + trailDust.color = Main.rand.NextBool() ? Color.AliceBlue : Color.SkyBlue; + trailDust.noGravity = true; + if (attacking) { - for (int j = 0; j < 2; j++) - { - float halfX = 0f; - float halfY = 0f; - if (j == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[explosion].velocity *= 0.2f; - Main.dust[explosion].noGravity = true; - explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Water, 0f, 0f, 100, default, 0.5f); - Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[explosion].velocity *= 0.05f; - } + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue); + GeneralParticleHandler.SpawnParticle(trail); } } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + if (Main.rand.NextBool(8) && !attacking) + { + Particle Star = new CritSpark(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f), Color.SkyBlue, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Main.rand.NextFloat(0.4f, 0.7f), 30, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); + } + + if (progress >= 0f && progress < 1f) // For spawn animation + progress += 0.04f; + + if (Projectile.scale < 1f) + Projectile.scale += 0.05f; + + time++; + + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !attacking) // If no holdout exists and not attacking then die + Projectile.Kill(); + } + + public override void OnSpawn(IEntitySource source) + { + for (int i = 0; i < 15; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 3f; + Dust ring = Dust.NewDustPerfect(Projectile.Center, 66, velocity); + ring.noGravity = true; + ring.scale = Main.rand.NextFloat(0.5f, 0.7f); + ring.color = Color.CornflowerBlue; + } + beginStretchAnim = true; } public override void OnKill(int timeLeft) { - Projectile.ExpandHitboxBy(192); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item110, Projectile.position); - for (int i = 0; i < 15; i++) + // Explode on kill if attacking, else just poof out + if (attacking) { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f); - Main.dust[smoke].velocity *= 3f; - if (Main.rand.NextBool()) + SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); + SoundStyle hitSound2 = new("CalamityMod/Sounds/NPCHit/AnahitaHit", 3); + SoundEngine.PlaySound(hitSound2 with { Volume = 1.1f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.8f) with { Volume = 1.1f , MaxInstances = 2}, Projectile.position); + for (int i = 0; i < 3; i++) { - Main.dust[smoke].scale = 0.5f; - Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Particle Star = new CritSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 5), Color.SkyBlue, Main.rand.NextBool() ? Color.HotPink : Color.SeaGreen, Main.rand.NextFloat(0.6f, 0.9f), 30, 0.4f, 3f); + GeneralParticleHandler.SpawnParticle(Star); + } + int points = 4; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + Color useColor = Main.rand.NextBool() ? Color.SkyBlue : Color.HotPink; + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new GlowSparkParticle((Projectile.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.03f, useColor, new Vector2(1f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); } } - for (int j = 0; j < 25; j++) + else { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - } - int projAmt = Main.rand.Next(2, 4); - if (Projectile.owner == Main.myPlayer) - { - for (int k = 0; k < projAmt; k++) + for (int i = 0; i < 7; i++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33), 0f, Projectile.owner); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 6)); + dust.noGravity = false; + dust.scale = 0.8f; + dust.color = Color.AliceBlue; + dust.noLightEmittence = true; } } } + public override bool? CanDamage() => (attacking ? null : false); // Can't hit if not attacking + + + public override bool PreDraw(ref Color lightColor) + { + if (beginStretchAnim) + { + progress = 0f; + beginStretchAnim = false; + } + + if (progress >= 0f) // Squash n' stretch on spawn + { + float stretchFactorX, stretchFactorY; + + if (progress < 0.5f) // Stretch + { + float completion = progress / 0.5f; + stretchFactorX = MathHelper.Lerp(1.6f, 0.7f, completion); + stretchFactorY = MathHelper.Lerp(0.7f, 1.6f, completion); + } + else // Squash + { + float completion = (progress - 0.5f) / 0.5f; + stretchFactorX = MathHelper.Lerp(0.7f, 1f, completion); + stretchFactorY = MathHelper.Lerp(1.6f, 1f, completion); + } + + if (progress >= 1f) + { + stretchFactorX = 1f; + stretchFactorY = 1f; + progress = -1f; + } + + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + Vector2 finalScale = new Vector2(stretchFactorX, stretchFactorY) * Projectile.scale; + Vector2 finalPos = Projectile.Center - Main.screenPosition; + + Main.spriteBatch.Draw(texture, finalPos, null, lightColor, Projectile.rotation, origin, finalScale, SpriteEffects.None, 0f); + + return false; + } + + Texture2D mainTexture = ModContent.Request(Texture).Value; + SpriteEffects spriteEffects = SpriteEffects.None; + Vector2 drawOrigin = mainTexture.Size() / 2f; + float drawScale = Projectile.scale; + float drawRotation = Projectile.rotation; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + Main.spriteBatch.Draw(mainTexture, drawPosition, null, lightColor * (1f - Projectile.alpha / 255f), drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + + return false; + } + + } } diff --git a/Projectiles/Ranged/SeadragonHoldout.cs b/Projectiles/Ranged/SeadragonHoldout.cs new file mode 100644 index 0000000000..5e3cd47998 --- /dev/null +++ b/Projectiles/Ranged/SeadragonHoldout.cs @@ -0,0 +1,194 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using static Terraria.ModLoader.ModContent; +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.Ranged +{ + public class SeadragonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + public bool swapType = false; + public bool transEffects = false; + + public override Vector2 GunTipPosition => Projectile.Center - Vector2.UnitY + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.5f; + + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Pause to give the effect of reloading + if (Time == 30) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "SeadragonMag"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + //Set the scaling to 0 whenever it reloads + Owner.Calamity().sharkGunDamageScaling = 0; + //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) + { + if (framesBetweenShots == 0 && shotCounter <= 51) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30; + #region Debug Text Display + //Main.NewText(shotCounter); + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #endregion + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny"); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.25f , PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center); + Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 5, true, 0.8f); + GeneralParticleHandler.SpawnParticle(sparker); + GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.SeaShell : Color.Silver * 0.9f, Color.HotPink, Main.rand.NextFloat(0.8f, 1.2f), 2, 0, 2.68f); + GeneralParticleHandler.SpawnParticle(sparker2); + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + #endregion + + //How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate + framesBetweenShots = 3; + OffsetLengthFromArm -= 2f; + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + //Alternate between shooting bullets and water streams. Despite not having damage scaling, the fish gain movement speed based on the scaling, so we still need a Global Projectile + if (Main.myPlayer == Projectile.owner) + { + if (!swapType) + { + Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + CalamityGlobalProjectile cgp = scalingShot.Calamity(); + cgp.sharkBullets = true; + //Only eject casings from the gun if bullets are fired, preventing too many at once + if (Main.netMode != NetmodeID.Server) + { + string goreType = "SeadragonCasing"; + Vector2 spawnOffset = new Vector2(0, -11f); + Vector2 spawnPosition = Projectile.Center + (-Projectile.velocity * 5) + spawnOffset; + Gore.NewGore(Projectile.GetSource_FromAI(), spawnPosition, -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + } + if (swapType) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, transEffects ? 0f : 1f); + } + swapType = !swapType; + } + shotCounter++; + //Allow a pause before unleashing the fish. This allows the final bullet a chance to hit before the fish are unleashed. Lowering this number reduces the delay, but may also cause the gun to become inconsistent + if (shotCounter == 50) + framesBetweenShots = 18; + if (Main.zenithWorld && shotCounter == 35) + { + SoundStyle joke = new("CalamityMod/Sounds/Custom/GFB/YouKnowWhatThatMeans"); + SoundEngine.PlaySound(joke with { Volume = 1f }, Projectile.Center); + } + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + if (shotCounter == 50 && framesBetweenShots == 0) + { + //Reset all variables to allow left click to be held down + Time = 2; + shotCounter = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + //Activate all fish to rush at the cursor and home in on the nearest enemy + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] < 5) + { + projectile.ai[1] = 5; + projectile.velocity = Utils.DirectionTo(projectile.Center, Owner.Calamity().mouseWorld) * 12; + } + if (Main.zenithWorld) + { + SoundStyle joke = new("CalamityMod/Sounds/Custom/GFB/FISH"); + SoundEngine.PlaySound(joke with { Volume = 0.35f, MaxInstances = -1 }, projectile.Center); + } + } + } + //If any fish projectiles are present, create an eye shine effect as they rush the enemy + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + if (Time == 3) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); + SoundEngine.PlaySound(hitSound with { Volume = 0.5f, Pitch = 0.8f }, Projectile.Center); + for (int b = 0; b < 12; b++) + { + int star = 4; + for (int i = 0; i < star; i++) + { + float power = Main.rand.NextFloat(0.2f, 1f); + Vector2 vel = (MathHelper.TwoPi * i / star).ToRotationVector2().RotatedBy(Projectile.rotation) * 6f; + float size = (0.6f) * Main.rand.NextFloat(0.9f, 1.1f) * (1.1f - power); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(GunTipPosition + (-Projectile.velocity.RotatedBy(0.1 * Projectile.direction) * 29f), dustStyle); + dust.scale = size; + dust.velocity = vel * power * (0.7f); + dust.noGravity = true; + dust.color = Color.Lerp(Color.Goldenrod, Color.OrangeRed, 0.5f) with { A = 1 }; + + if (b == 0) + { + Particle aura = new CustomSpark(GunTipPosition + (-Projectile.velocity.RotatedBy(0.1 * Projectile.direction) * 29f), Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 13, 0.2f, Color.Lerp(Color.Goldenrod, Color.OrangeRed, 0.5f) with { A = 1 }, new Vector2(0.65f, 1f), glowCenter: true, glowOpacity: 0.8f, glowCenterScale: 0.85f, extraRotation: Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(aura); + } + } + } + } + } + Time++; + } + 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; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} 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/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 4d2b48ff8e..af5cd9e286 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -81,12 +81,12 @@ namespace CalamityMod.Projectiles.Ranged Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); - // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) + // Throws a lingering saw at the cursor that deals 2x damage (since the holdout already deals 1.5x) if (Main.myPlayer == Projectile.owner) { float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); float adjustedMouseDist = clampedMouseDist / 21f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 4f / 3f), Projectile.knockBack, Projectile.owner); } // End animation early @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle ShootSound = new("CalamityMod/Sounds/Item/SawShot", 2) { PitchVariance = 0.1f, Volume = 0.4f + SawPower * 0.5f }; SoundEngine.PlaySound(ShootSound, GunTipPosition); - float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 2f; // The damage must be divided by 2 to offset the holdout having 2x base damage. + float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. int sawPierce = (int)MathHelper.Lerp(2f, 7f, SawPower); int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt(); @@ -240,7 +240,7 @@ namespace CalamityMod.Projectiles.Ranged } // The holdout can deal damage; you're literally spinning up a buzzsaw at the end, after all. - public override bool? CanDamage() => !NoSawOnHoldout; + public override bool? CanDamage() => !NoSawOnHoldout && Time % Projectile.localNPCHitCooldown == 0; public override void ModifyDamageHitbox(ref Rectangle hitbox) { @@ -258,6 +258,9 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 150); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition); + if (damageDone > 2 && !target.Calamity().IsArmored()) + Projectile.damage = (int)(Projectile.damage * 0.8f); + // EPIC AND COOL RAINBOW PARTICLES WOOOO int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt(); int onHitSparkAmount = 4 + 4 * SawLevel; 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/Ranged/VoidBlast.cs b/Projectiles/Ranged/VoidBlast.cs new file mode 100644 index 0000000000..ffe4724727 --- /dev/null +++ b/Projectiles/Ranged/VoidBlast.cs @@ -0,0 +1,133 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class VoidBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Melee/GalaxiaBolt"; + public int time = 0; + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ignoreWater = true; + } + + public override void AI() + { + 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; + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); + + if (Projectile.timeLeft <= 597f) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * 0.5f, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 20, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, false, 0, true); + GeneralParticleHandler.SpawnParticle(smoke); + if (Main.rand.NextBool(2)) + { + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * 0.5f, Color.DarkOrchid, 20, Main.rand.NextFloat(0.4f, 0.8f) * Projectile.scale, 0.3f, 0, true, 0.005f, true); + GeneralParticleHandler.SpawnParticle(smokeGlow); + } + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 5, 0.052f, Color.Black, new Vector2(0.6f, 1.3f), false); + GeneralParticleHandler.SpawnParticle(spark2); + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3.5f, Projectile.velocity * 0.01f, false, 5, 1.2f * Projectile.scale, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark); + spark.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + } + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().sharkGunDamageScaling++; + } + } + + public override void OnKill(int timeLeft) + { + float blastSize = 170; + 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 * 0.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 fire = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center); + + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.2f, 15, false); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + for (float k = 0; k < 3; k++) + { + float colorRando = Main.rand.NextFloat(0, 1); + int partLifetime = Main.rand.Next(13, 15 + 1); + float scale = Main.rand.NextFloat(0.10f, 0.16f); + Vector2 spawnPos = Projectile.Center + (Main.rand.NextVector2Circular(20, 20) * (k + 1)); + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, Color.Lerp(Color.DarkOrchid, Color.Indigo, colorRando) * 0.6f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime); + GeneralParticleHandler.SpawnParticle(blastRing); + blastRing.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + } + + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.03f, 1f, 24, true); + GeneralParticleHandler.SpawnParticle(innerGlow); + innerGlow.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2(); + Particle cross = new GlowSparkParticle(Projectile.Center, velocity, false, 12, 0.4f, Color.BlueViolet * 0.7f, new Vector2(0.07f, 0.08f), true, false); + GeneralParticleHandler.SpawnParticle(cross); + cross.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + } + for (float k = 0; k < 10; k++) + { + Particle spark = new CustomSpark(Projectile.Center, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(2f, 4f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.1f, 1.3f), Color.Lerp(Color.MediumPurple, Color.Indigo, Main.rand.NextFloat(0.5f, 0.7f)), new Vector2(0.6f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.35f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + spark.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + } + + #endregion + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + Main.EntitySpriteDraw(texture, drawPosition, null, Color.Indigo with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.025f * Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Ranged/Voidragon.png b/Projectiles/Ranged/VoidBlast.png similarity index 100% rename from Projectiles/Ranged/Voidragon.png rename to Projectiles/Ranged/VoidBlast.png diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs deleted file mode 100644 index ada7f27283..0000000000 --- a/Projectiles/Ranged/Voidragon.cs +++ /dev/null @@ -1,117 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Voidragon : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.alpha = 150; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.ignoreWater = true; - } - - public override void AI() - { - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 150 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item92, Projectile.position); - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 12f) - { - Projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - dustVel = dustVel.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int shadowDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 1f); - Main.dust[shadowDust].scale = 1.1f; - Main.dust[shadowDust].noGravity = true; - Main.dust[shadowDust].position = Projectile.Center + dustVel; - Main.dust[shadowDust].velocity = Projectile.velocity * 0.1f; - Main.dust[shadowDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[shadowDust].position) * 1.25f; - } - } - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - alphaControl = 0; - } - if (Projectile.alpha < alphaControl) - { - Projectile.alpha = alphaControl; - } - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[extraDust].velocity = value3 * 0.66f; - Main.dust[extraDust].position = Projectile.Center + value3 * 12f; - } - if (Main.rand.NextBool(48) && !Main.dedServ) - { - int voidGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[voidGore].velocity *= 0.66f; - Main.gore[voidGore].velocity += Projectile.velocity * 0.3f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && !Main.dedServ) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); - } - - public override bool PreDraw(ref Color lightColor) - { - 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 OnKill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - } -} diff --git a/Projectiles/Ranged/VoidragonHoldout.cs b/Projectiles/Ranged/VoidragonHoldout.cs new file mode 100644 index 0000000000..2d9c76aa10 --- /dev/null +++ b/Projectiles/Ranged/VoidragonHoldout.cs @@ -0,0 +1,289 @@ +using System; +using System.Runtime.InteropServices; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class VoidragonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 40f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 55).RotatedBy(-0.09f * Projectile.direction); + public const float LaserAimLag = 0.92f; // Last Prism-esque aim lag. Higher = Slower. Last Prism is 0.92f. + + public int Time = 0; + public int beamTimer = 500; + public int shotCounter = 0; + public int framesBetweenShots = 0; + public bool swapType = false; + public bool firingBeam = false; + public float chargeVisTimer = 0; + public float maxChargeSpeed = 2; + public float chargePulseTimer = 0; + public bool playChargeSound = true; + + public SlotId soundSlot; + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID) + Projectile.Kill(); + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + public override void HoldoutAI() + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + //Spawn dust on the holdout's eyes based on the amount of damage scaling. + for (int i = 0; i < 2; i++) + { + int dustType = ModContent.DustType(); + float rotMulti = Main.rand.NextFloat(0.3f, 1f); + Dust dust = Dust.NewDustPerfect(GunTipPosition + (-Projectile.velocity.RotatedBy(0.15 * Projectile.direction) * 50), dustType); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (Owner.Calamity().sharkGunDamageScaling * 0.02f) - rotMulti * 0.1f; + dust.noGravity = true; + dust.velocity = new Vector2(-1.2f, -2).RotatedBy(Projectile.rotation + (Projectile.direction == -1 ? MathHelper.TwoPi * 0.75f : 0)).RotatedByRandom(rotMulti * 0.8f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (Owner.Calamity().sharkGunDamageScaling * 0.015f); + dust.alpha = Main.rand.Next(90, 150); + dust.color = Main.rand.NextBool() ? Color.Indigo : Color.DarkBlue; + } + //Smoothly scale down the gun visuals before reloading + if (Time < 30) + { + if (Owner.Calamity().sharkGunDamageScaling > 0) + Owner.Calamity().sharkGunDamageScaling--; + } + //Pause to give the effect of reloading + if (Time == 30) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "VoidragonMag"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + //Set the scaling to 0 whenever it reloads + Owner.Calamity().sharkGunDamageScaling = 0; + } + if (Time >= 90) + { + if (framesBetweenShots == 0 && shotCounter <= 50) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 28; + #region Debug Text Display + //Main.NewText(shotCounter); + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #endregion + //Do not look in here if you value your sanity + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.1f, PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center); + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Black : Color.Indigo * 0.6f, 10, 0.85f, 1.1f, 5f, false, 0, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i <= 2; i++) + { + Particle spark = new VoidSparkParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(1.2f, 1.5f), false, 25, 0.1f, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark); + } + Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Purple, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 2, true, 0.8f); + GeneralParticleHandler.SpawnParticle(sparker); + sparker.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet * 0.9f, Color.Indigo, Main.rand.NextFloat(1.4f, 1.6f), 2, 0, 2.22f); + GeneralParticleHandler.SpawnParticle(sparker2); + sparker2.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + GenericSparkle sparker3 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet * 0.9f, Color.Indigo, Main.rand.NextFloat(2.5f, 2.6f), 2, 0, 2.68f); + GeneralParticleHandler.SpawnParticle(sparker3); + Particle center = new SnowflakeSparkle(GunTipPosition, Vector2.Zero, Color.GhostWhite, Color.Indigo, 0.8f, 2, Main.rand.NextFloat(-10, 10), 0.5f, 7); + GeneralParticleHandler.SpawnParticle(center); + center.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + sparker3.DrawLayer = Enums.GeneralDrawLayer.AfterEverything; + #endregion + + //How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate + framesBetweenShots = 3; + OffsetLengthFromArm -= 2.5f; + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + //Alternate between shooting bullets and void blasts. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier + if (Main.myPlayer == Projectile.owner) + { + if (!swapType) + { + Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + CalamityGlobalProjectile cgp = scalingShot.Calamity(); + cgp.sharkBullets = true; + //Only eject casings from the gun if bullets are fired, preventing too many at once + if (Main.netMode != NetmodeID.Server) + { + string goreType = "VoidragonCasing"; + Vector2 spawnOffset = new Vector2(0, -13f); + Vector2 spawnPosition = Projectile.Center + (-Projectile.velocity * 18) + spawnOffset; + Gore.NewGore(Projectile.GetSource_FromAI(), spawnPosition, -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + } + if (swapType) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + swapType = !swapType; + } + shotCounter++; + //Allow a pause before firing the laser. The long delay lets the laser's charge sound play in full + if (shotCounter == 50) + { + framesBetweenShots = 150; + shotCounter++; + } + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + if (shotCounter == 51 && !firingBeam) //Charging + { + SoundStyle charge = new("CalamityMod/Sounds/Item/VoidragonCharge"); + if (playChargeSound) + soundSlot = SoundEngine.PlaySound(charge with { Volume = 0.7f, IsLooped = true, pitch = -0.5f }, Projectile.Center); + playChargeSound = false; + float chargeCompletion = Utils.GetLerpValue(150, 0, framesBetweenShots, true); + chargeVisTimer = MathHelper.Lerp(0, maxChargeSpeed, chargeCompletion); + chargePulseTimer += 0.6f + MathHelper.Lerp(0, maxChargeSpeed, MathF.Pow(chargeCompletion, 2.5f)); + + if (SoundEngine.TryGetActiveSound(soundSlot, out var sSound) && sSound.IsPlaying) + sSound.Pitch = -0.85f + 1.5f * chargeCompletion; + } + else + { + chargePulseTimer = 0; + chargeVisTimer = MathHelper.Lerp(chargeVisTimer, 0, 0.12f); + } + if (shotCounter == 51 && framesBetweenShots == 0) + { + //Main.NewText(beamTimer); + float beamCompletion = Utils.GetLerpValue(500, 0, beamTimer, true); + if (!firingBeam) + { + Owner.Calamity().GeneralScreenShakePower = 10f; + if (SoundEngine.TryGetActiveSound(soundSlot, out var cSound)) + cSound?.Stop(); + SoundStyle start = new("CalamityMod/Sounds/Item/VoidragonStrongStart"); + SoundStyle start2 = new("CalamityMod/Sounds/Item/MagnaCannonShot"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound((i > 0 ? start2 : start) with { Volume = 1f, pitch = 0f - 0.5f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Item/VoidragonLaser"); + soundSlot = SoundEngine.PlaySound(fire with { Volume = 1f, IsLooped = true, pitch = 0f }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(soundSlot, out var sSound) && sSound.IsPlaying) + { + sSound.Pitch = 1f - 1.5f * MathF.Pow(beamCompletion, 10f) + 0.6f * beamCompletion; + sSound.Volume = 1f - 1 * MathF.Pow(beamCompletion, 10f); + } + firingBeam = true; + if (firingBeam && beamTimer > 0) + { + //If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the laser doing 0 damage + if (Owner.Calamity().sharkGunDamageScaling == 0) + { + Owner.Calamity().sharkGunDamageScaling++; + } + //Spawn the laser only once at the start of the timer. Change beamTimer to edit its lifetime + //I fucking hate this laser by the way + if (Main.myPlayer == Projectile.owner && beamTimer == 500) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5, ModContent.ProjectileType(), (int)(Projectile.damage * 0.05f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner, Projectile.whoAmI); + beamTimer--; + } + else + { + firingBeam = false; + Projectile.Kill(); + } + } + Time++; + } + public override void ManageHoldout() + { + Vector2 storedVelocity = Projectile.velocity; + base.ManageHoldout(); + + if (firingBeam) + { + Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY); + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(storedVelocity), LaserAimLag)); + + if (aimVector != storedVelocity) + Projectile.netUpdate = true; + Projectile.velocity = aimVector; + + Projectile.rotation = Projectile.velocity.ToRotation(); + } + } + public override bool PreDraw(ref Color lightColor) + { + if (Time < 2) + return false; + Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D texture3 = ModContent.Request("CalamityMod/Particles/RoarPulse").Value; + Texture2D texture4 = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; + Texture2D sparkle = ModContent.Request("CalamityMod/Particles/HalfStar").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; + Vector2 shake = Main.rand.NextVector2Circular(6, 6); + + float chargeVisual = MathF.Pow(Utils.GetLerpValue(0, maxChargeSpeed / 1.5f, chargeVisTimer, true), 1.5f); + float finalChargeVisual = MathF.Pow(Utils.GetLerpValue(maxChargeSpeed / 1.5f, maxChargeSpeed, chargeVisTimer, true), 3f); + + int max = 30; + float ringScaling = MathF.Pow(1 - Utils.GetLerpValue(0, max, chargePulseTimer % max, true), 1.15f); + float ringOpacity = 1 - MathF.Abs(Utils.GetLerpValue(0.5f, 1, ringScaling, false)); + + for (int i = 0; i < 22; i++) + { + Color auraColor = Color.Lerp(Color.Indigo, Color.BlueViolet, i * 0.01f) with { A = 0 } * 0.6f; + Vector2 drawOffset = ((MathHelper.TwoPi * i / 22f).ToRotationVector2() * 5) + Main.rand.NextVector2Circular(7, 7); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale * Main.rand.NextFloat(0.02f, 0.025f) * Owner.Calamity().sharkGunDamageScaling, flipSprite); + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + //Black aura + for (int i = 0; i < 15; i++) + Main.EntitySpriteDraw(texture4, GunTipPosition - Main.screenPosition, null, Color.Lerp(Color.Black, Color.Indigo with { A = 0 }, finalChargeVisual) * (0.35f + ringOpacity * 0.65f), drawRotation + Main.rand.NextFloat(-4f, 4f), texture4.Size() / 2, new Vector2(0.85f + i * 0.065f, 0.85f - i * 0.065f) * (Projectile.scale + finalChargeVisual * 1.8f) * Owner.gravDir * chargeVisual * (4.25f - ringScaling * 2.5f), flipSprite); + + for (int i = 0; i < 3; i ++) //Glow aura + Main.EntitySpriteDraw(texture2, GunTipPosition - Main.screenPosition, null, Color.Lerp(Color.BlueViolet, Color.White, (i == 0 ? 0.8f : 0)) with { A = 0 }, drawRotation + Main.rand.NextFloat(-4f, 4f), texture2.Size() / 2, (Projectile.scale + finalChargeVisual * 1.8f) * Owner.gravDir * chargeVisual * 0.5f * (i == 0 ? 0.75f : 1), flipSprite); + + //Pulse Rings + Main.EntitySpriteDraw(texture3, GunTipPosition - Main.screenPosition, null, Color.BlueViolet with { A = 0 } * ringOpacity * 0.5f, drawRotation + Main.rand.NextFloat(-4f, 4f), texture3.Size() / 2, Projectile.scale * Owner.gravDir * chargeVisual * ringScaling * 0.5f, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs deleted file mode 100644 index d0978a16c4..0000000000 --- a/Projectiles/Ranged/VoidragonTentacle.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class VoidragonTentacle : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.ignoreWater = true; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; - Projectile.MaxUpdates = 3; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - Projectile.localAI[1]++; - if (Projectile.velocity.X != Projectile.velocity.X) - { - if (Math.Abs(Projectile.velocity.X) < 1f) - { - Projectile.velocity.X = -Projectile.velocity.X; - } - else - { - Projectile.Kill(); - } - } - if (Projectile.velocity.Y != Projectile.velocity.Y) - { - if (Math.Abs(Projectile.velocity.Y) < 1f) - { - Projectile.velocity.Y = -Projectile.velocity.Y; - } - else - { - Projectile.Kill(); - } - } - Vector2 center10 = Projectile.Center; - Projectile.scale = 1f - Projectile.localAI[0]; - Projectile.width = (int)(20f * Projectile.scale); - Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); - if (Projectile.localAI[0] < 0.1f) - { - Projectile.localAI[0] += 0.01f; - } - else - { - Projectile.localAI[0] += 0.025f; - } - if (Projectile.localAI[0] >= 0.95f) - { - Projectile.Kill(); - } - Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; - Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; - if (Projectile.velocity.Length() > 16f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 16f; - } - Projectile.ai[0] *= 1.05f; - Projectile.ai[1] *= 1.05f; - if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) - { - int dustAmount = 0; - while ((float)dustAmount < Projectile.scale * 10f) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.3f); - Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f; - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.1f; - Main.dust[dust].velocity -= Projectile.velocity * (1.1f - Projectile.scale); - Main.dust[dust].fadeIn = (float)(125 + Projectile.owner); - Main.dust[dust].scale += Projectile.scale * 0.75f; - dustAmount++; - } - } - } - } -} diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index d35823a7da..120b2934d0 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -109,8 +109,7 @@ namespace CalamityMod.Projectiles.Rogue Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 1.2f, Color.Black); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike) { Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); @@ -127,8 +126,7 @@ namespace CalamityMod.Projectiles.Rogue Particle spark = new AltSparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { @@ -221,8 +219,7 @@ namespace CalamityMod.Projectiles.Rogue } Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18); - GeneralParticleHandler.SpawnParticle(bolt2); - bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt2, false, GeneralDrawLayer.AfterEverything); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index d5dd26b9c3..087f55c3ab 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -47,11 +47,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(4)) { - Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(70, 70), Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(70, 70), Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner,0,0,Projectile.Calamity().stealthStrike ? 1 : 0); if (bubble.whoAmI.WithinBounds(Main.maxProjectiles)) { - //We mark it as a stealth strike to change its dust - bubble.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; bubble.DamageType = RogueDamageClass.Instance; bubble.timeLeft = 45; } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index fbf4344802..45e56915f2 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.damage = (int)(Projectile.damage * 0.9f); + Projectile.damage = (int)(Projectile.damage * 0.8f); if (Projectile.Calamity().stealthStrike) { if (!hasHit) @@ -123,6 +123,7 @@ namespace CalamityMod.Projectiles.Rogue } Projectile.ResetLocalNPCHitImmunity(); Ricochet(); + Projectile.damage = (int)(Projectile.damage * 0.8f); if (Projectile.penetrate > 0) Projectile.penetrate--; return false; diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index ce32ce7a81..8a5ecd429c 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -24,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(); @@ -32,5 +34,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 21c1045017..c285d8f872 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -28,13 +28,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 +41,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 +62,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/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index d7f5e1c37c..9b6affec5e 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -106,8 +106,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 2; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } } else diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index f8aff95cac..7a12927668 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -157,11 +157,9 @@ namespace CalamityMod.Projectiles.Rogue float bigExplosionDamage = 3f; Player Owner = Main.player[Projectile.owner]; Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); - GeneralParticleHandler.SpawnParticle(orb); - orb.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb, false, GeneralDrawLayer.AfterEverything); Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); - GeneralParticleHandler.SpawnParticle(orb2); - orb2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb2, false, GeneralDrawLayer.AfterEverything); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); @@ -187,16 +185,13 @@ namespace CalamityMod.Projectiles.Rogue } Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); - GeneralParticleHandler.SpawnParticle(bolt2); - bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt2, false, GeneralDrawLayer.AfterEverything); Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30); - GeneralParticleHandler.SpawnParticle(bolt3); - bolt3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt3, false, GeneralDrawLayer.AfterEverything); Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30); - GeneralParticleHandler.SpawnParticle(bolt4); - bolt4.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt4, false, GeneralDrawLayer.AfterEverything); for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index 7f049480b7..9f43df61b9 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -137,12 +137,17 @@ namespace CalamityMod.Projectiles.Rogue float speedMult = (float)Math.Pow(Utils.GetLerpValue(1, 4, charge, true), 2) + 0.05f; float arcValue = hasReachedFullCharge ? 0 : (float)Math.Pow(Utils.Remap(speedMult, 0, 1f, 1f, 0.8f), 4); Projectile.ai[1] = arcValue; - Projectile.velocity = velocity * 9 * speedMult; + Projectile.velocity = velocity * 9 * speedMult * Owner.Calamity().rogueVelocity; SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); SoundEngine.PlaySound(w with { Volume = 1f, Pitch = 0.2f, MaxInstances = 6 }, Projectile.Center); if (hasReachedFullCharge) { + if (Owner.Calamity().StealthStrikeAvailable()) + { + Projectile.Calamity().stealthStrike = true; + Owner.Calamity().ConsumeStealthByAttacking(); + } rotSpeed *= 2; SoundStyle w2 = new("CalamityMod/Sounds/Item/SwooshMid"); SoundEngine.PlaySound(w2 with { Volume = 1f, Pitch = -0.4f, MaxInstances = 6 }, Projectile.Center); @@ -150,11 +155,7 @@ namespace CalamityMod.Projectiles.Rogue else Owner.Calamity().ConsumeStealthByAttacking(); - if (Owner.Calamity().StealthStrikeAvailable() && hasReachedFullCharge) - { - Projectile.Calamity().stealthStrike = true; - Owner.Calamity().ConsumeStealthByAttacking(); - } + Projectile.tileCollide = true; flung = true; @@ -427,15 +428,16 @@ namespace CalamityMod.Projectiles.Rogue Color glowColor = Color.Lerp(mainColor, Color.Red, Utils.GetLerpValue(60, 18, (stealthPenaltyTimer >= 18 ? stealthPenaltyTimer : 60))); float fade = Utils.GetLerpValue(0, 300, Projectile.timeLeft, true); Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + (!flung ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); for (int i = 0; i < 25; i++) { Color auraColor = glowColor with { A = 0 } * 0.35f * fade; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * (hasReachedFullCharge ? 7 : 3f) * Projectile.Opacity; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(4, 4), null, auraColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None); + Main.EntitySpriteDraw(tex, baseDrawPos + drawOffset + Main.rand.NextVector2Circular(4, 4), null, auraColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None); } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, baseDrawPos, null, lightColor * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value, Projectile.Center - Main.screenPosition, null, glowColor * Projectile.Opacity * fade, Projectile.rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value, baseDrawPos, null, glowColor * Projectile.Opacity * fade, Projectile.rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); return false; } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 40e64aea72..bf00a4951a 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,62 +1,67 @@ -using Terraria; +using System; +using System.Net.Http.Headers; +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistExceptionAttribute] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => Main.projFrames[Type] = 4; public override void SetDefaults() { - Projectile.width = 38; - Projectile.height = 14; + Projectile.width = 128; + Projectile.height = 128; Projectile.friendly = true; Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Generic; + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; + Projectile.penetrate = -1; } + Color color = Color.White; + + public static Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return Color.SandyBrown; + case 1: return new Color(164, 118, 78); + case 2: return new Color(210, 183, 126); + case 3: return new Color(151, 130, 103); + } + return Color.White; + } + } public override void AI() { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (color == Color.White) { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - Projectile.velocity *= 0.995f; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 120f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - else if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } - } - else if (Projectile.alpha > 80) - { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - { - Projectile.alpha = 80; - } + color = RandomColor; } + Projectile.velocity *= 0.97f; + Projectile.rotation += 0.05f; + Projectile.Opacity = (1- MathF.Pow(1-Projectile.timeLeft / 180f,2)) * 0.5f; + if (Projectile.timeLeft % 5 == 0) + Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(32,32), ModContent.DustType(),newColor: RandomColor, Scale: 0.75f).customData = Projectile.Opacity; + } + public override bool PreDraw(ref Color lightColor) + { + lightColor = color; + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center-Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; } } } diff --git a/Projectiles/Rogue/DuststormCloud.png b/Projectiles/Rogue/DuststormCloud.png index b3ef97ca5a..f238522679 100644 Binary files a/Projectiles/Rogue/DuststormCloud.png and b/Projectiles/Rogue/DuststormCloud.png differ diff --git a/Projectiles/Rogue/DuststormCloudExplosion.cs b/Projectiles/Rogue/DuststormCloudExplosion.cs new file mode 100644 index 0000000000..bf6fa64f98 --- /dev/null +++ b/Projectiles/Rogue/DuststormCloudExplosion.cs @@ -0,0 +1,59 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormCloudExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public override string Texture => "CalamityMod/Projectiles/Rogue/DuststormCloud"; + public override void SetDefaults() + { + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; + } + + Color color = Color.White; + public override void AI() + { + if (color == Color.White) + { + color = DuststormCloud.RandomColor; + } + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact); + for (var i = 0; i < 80; i++) { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(8, 8) * Main.rand.NextFloat(0.2f,1.2f), newColor: DuststormCloud.RandomColor, Scale: 0.75f); + d.customData = 0.75f; + } + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.1f; + } + public override bool PreDraw(ref Color lightColor) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, color * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); + } +} diff --git a/Projectiles/Rogue/DuststormCloudHitbox.cs b/Projectiles/Rogue/DuststormCloudHitbox.cs deleted file mode 100644 index a8e02d7678..0000000000 --- a/Projectiles/Rogue/DuststormCloudHitbox.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - [PierceResistExceptionAttribute(true)] - public class DuststormCloudHitbox : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = DuststormInABottle.CloudLifetime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 12; - } - - public override void AI() - { - if (Projectile.scale < (Projectile.ai[1] == 1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) - { - Projectile.scale += Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate; - Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate)); - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); - } -} diff --git a/Projectiles/Rogue/DuststormInABottleHoldout.cs b/Projectiles/Rogue/DuststormInABottleHoldout.cs new file mode 100644 index 0000000000..194a525056 --- /dev/null +++ b/Projectiles/Rogue/DuststormInABottleHoldout.cs @@ -0,0 +1,126 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormInABottleHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + bool isChannelable = false; + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.1f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, -1).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -12.5f * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 61d51c1462..c6ce288920 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -1,9 +1,7 @@ -using System; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; +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.Rogue @@ -11,66 +9,103 @@ 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() + { + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 24; + Projectile.height = 24; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.timeLeft = 180; - AIType = ProjectileID.ThrowingKnife; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + ref float Timer => ref Projectile.ai[0]; + ref float TimerMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + + int gravTimer = 0; + bool Stealth => Projectile.Calamity().stealthStrike; + + public override void AI() + { + Timer++; + gravTimer++; + + Projectile.rotation += 0.075f * Projectile.direction * Projectile.velocity.Length(); + if (gravTimer > 20) + { + Projectile.velocity.Y += 0.22f; + } + + if (AIState == 1) + { + if (Timer % 10 == 0 && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(5, 5), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); + } + } + if (Timer > TimerMax && AIState == 0) + { + if (!Stealth) + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; + } + AIState = 1; + Timer = 0; + Projectile.timeLeft = lifetime; + } + } + public override bool PreDraw(ref Color lightColor) + { + 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; } - public override void OnKill(int timeLeft) + public override bool? CanHitNPC(NPC target) { - bool stealth = Projectile.Calamity().stealthStrike; - SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - double cloudAmt = Main.rand.Next(40, 50); - if (stealth) + return Projectile.velocity.Length() > 1f; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Stealth) { - //DUST STORM - for (int dustexplode = 0; dustexplode < 180; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); - - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); - - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(5) ? 32 : 85, dustd.X, dustd.Y, 50, default, 2f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= Main.rand.NextFloat(0.25f, 1f); - Main.dust[d].scale *= Main.rand.NextFloat(0.5f, 0.8f); - } - cloudAmt *= 2.75; - cloudAmt = Math.Round(cloudAmt); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; } - else + if (Projectile.numHits == 0) { - //DUST STORM but smaller - for (int dustexplode = 0; dustexplode < 120; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius - 2).RotatedBy(MathHelper.ToRadians(dustexplode * 3)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + return; + } - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); - } - } - if (Projectile.owner == Main.myPlayer) - { - for (int index = 0; index < cloudAmt; index++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity * 1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); - } - int hitbox = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); - if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag - Main.projectile[hitbox].ai[1] = 1; - } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + if (gravTimer > 25) + fallThrough = false; + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity *= 0.95f; + 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/EclipseStealthBoom.cs b/Projectiles/Rogue/EclipseStealthBoom.cs deleted file mode 100644 index d258de5353..0000000000 --- a/Projectiles/Rogue/EclipseStealthBoom.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipseStealthBoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - - public const int Lifetime = 35; // 7 animation frames, 12 FPS - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 102; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5; - - if (Projectile.frameCounter > Lifetime) - Projectile.Kill(); - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs deleted file mode 100644 index acae2f710c..0000000000 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ /dev/null @@ -1,78 +0,0 @@ -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipsesFallMain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; - - // these also affect KB - public static float RainDamageMult = 0.4f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.3f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(5)) - { - Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); - float trailScale = Main.rand.NextFloat(0.8f, 1.2f); - Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; - Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); - GeneralParticleHandler.SpawnParticle(eclipseTrail); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSpears(target); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSpears(target); - - private void SpawnSpears(Entity target) - { - int spearAmt = Main.rand.Next(3, 4 + 1); // 3 or 4 spears - for (int n = 0; n < spearAmt; n++) - { - Vector2 spawnPos = target.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); - Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, target, 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, ModContent.ProjectileType(), (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipseStealthBoom.png b/Projectiles/Rogue/EclipsesFall_LightExplosion.png similarity index 100% rename from Projectiles/Rogue/EclipseStealthBoom.png rename to Projectiles/Rogue/EclipsesFall_LightExplosion.png diff --git a/Projectiles/Rogue/EclipseStealthBoomGlow.png b/Projectiles/Rogue/EclipsesFall_LightExplosionGlow.png similarity index 100% rename from Projectiles/Rogue/EclipseStealthBoomGlow.png rename to Projectiles/Rogue/EclipsesFall_LightExplosionGlow.png diff --git a/Projectiles/Rogue/EclipsesFall_LightFragment.png b/Projectiles/Rogue/EclipsesFall_LightFragment.png new file mode 100644 index 0000000000..fc489108d0 Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_LightFragment.png differ diff --git a/Projectiles/Rogue/EclipsesFall_StealthSpear.png b/Projectiles/Rogue/EclipsesFall_StealthSpear.png new file mode 100644 index 0000000000..fe72281fb5 Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_StealthSpear.png differ diff --git a/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png b/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png new file mode 100644 index 0000000000..58635d492a Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png differ diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs deleted file mode 100644 index f9831d85bc..0000000000 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipsesSmol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = Projectile.height = 24; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.timeLeft = 75 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.5f, 0.4f, 0.15f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 16f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipsesSmol.png b/Projectiles/Rogue/EclipsesSmol.png deleted file mode 100644 index 96e05053b1..0000000000 Binary files a/Projectiles/Rogue/EclipsesSmol.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesSmolGlow.png b/Projectiles/Rogue/EclipsesSmolGlow.png deleted file mode 100644 index 0539d70e64..0000000000 Binary files a/Projectiles/Rogue/EclipsesSmolGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs deleted file mode 100644 index bdf017b9f2..0000000000 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ /dev/null @@ -1,129 +0,0 @@ -using CalamityMod.NPCs; -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.Rogue -{ - [PierceResistException] - public class EclipsesStealth : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; - - // these also affect KB - public const float RainDamageMult = 0.2f; - public const float ExplosionDamageMult = 0.5f; - - private bool changedTimeLeft = false; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - // Uses localAI[1] to decide how many frames until the next spear drops. - public override void AI() - { - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.3f); - // Behavior when not sticking to anything - if (Projectile.ai[0] == 0f) - { - // Keep the spear oriented in the correct direction - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(5)) - { - Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); - float trailScale = Main.rand.NextFloat(0.8f, 1.2f); - Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; - Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); - GeneralParticleHandler.SpawnParticle(eclipseTrail); - } - } - - // Behavior when having impaled a target - else - { - // Eclipse's Fall is guaranteed to impale for 10 seconds, no more, no less - if (!changedTimeLeft) - { - Projectile.MaxUpdates = 1; - Projectile.timeLeft = 600; - changedTimeLeft = true; - } - - // Spawn spears. As this uses local AI, it's done client-side only. - if (Projectile.owner == Main.myPlayer) - { - Projectile.localAI[1] -= 1f; - if (Projectile.localAI[1] <= 0f) - { - // Set up the spear counter for next time. Used to be every 5 frames there was a 50% chance; now it's more reliable but slower. - Projectile.localAI[1] = Main.rand.Next(8, 10+1); // 8 to 10 frames between each spearfall - - int type = ModContent.ProjectileType(); - Vector2 spawnPos = Projectile.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); - Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, Main.npc[(int)Projectile.ai[1]], 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, type, (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); - } - } - } - - // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. - Projectile.StickyProjAI(10); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(1); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - - public override bool? CanHitNPC(NPC target) => Projectile.ai[0] == 1f ? false : base.CanHitNPC(target); - - public override bool CanHitPvp(Player target) => Projectile.ai[0] != 1f; - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageMult), Projectile.knockBack * ExplosionDamageMult, Projectile.owner); - } - } -} diff --git a/Projectiles/Rogue/ElephantKillerElephant.cs b/Projectiles/Rogue/ElephantKillerElephant.cs new file mode 100644 index 0000000000..b090fd4479 --- /dev/null +++ b/Projectiles/Rogue/ElephantKillerElephant.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ElephantKillerElephant : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public SlotId soundSlot; + public float rumble = 0; + public float displace = 0; + public ref float holeSize => ref Projectile.localAI[1]; + public ref float time => ref Projectile.ai[0]; + public Color clr = Color.CornflowerBlue; + public static Asset ElephantTexture { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + ElephantTexture = Terraria.GameContent.TextureAssets.Projectile[Type]; + } + public override void SetDefaults() + { + Projectile.scale = 2f; + Projectile.width = 135; + Projectile.height = 90; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 4600; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.CornflowerBlue, + Color.SkyBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + clr = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + + if (time == 0) + { + Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); + } + float sine = MathF.Sin((time * 0.05f) / MathHelper.Pi); + if (time < 70) + { + Projectile.velocity *= 0.93f; + } + else + { + Projectile.extraUpdates = 1; + Projectile.velocity = Vector2.Zero; + Projectile.Center += Vector2.UnitY * sine * 0.1f; + } + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.spriteDirection == -1 ? MathHelper.Pi : 0, 0.04f); + + if (time == 90) + { + soundSlot = SoundEngine.PlaySound(ElephantKiller.ElephantSound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); + rumble = 30; + } + + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound.Position = Projectile.Center; + + Projectile.Opacity = 1 - MathF.Pow(Utils.GetLerpValue(230, 0, Projectile.timeLeft, true), 6); + rumble = MathHelper.Lerp(rumble, 0, 0.03f); + time += Utils.Remap(Projectile.Opacity, 1, 0, 1, 10); + holeSize = MathHelper.Lerp(holeSize, 0, 0.04f); + + Lighting.AddLight(Projectile.Center, clr.ToVector3() * 1.2f * Projectile.Opacity * MathF.Pow(Utils.GetLerpValue(0, 35, time, true), 3)); + } + public override bool? CanDamage() + { + return false; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 generalDrawPos = Projectile.Center + Main.rand.NextVector2Circular(rumble, rumble) + Vector2.UnitY * 25; + + SpriteEffects spriteFx = SpriteEffects.FlipHorizontally; + if (Projectile.spriteDirection == -1) + spriteFx |= SpriteEffects.FlipVertically; + + float deathFade = 1 - Projectile.Opacity; + float lerp = MathF.Pow(Utils.GetLerpValue(0, 35, time, true), 3); + float scale = (0.5f + 0.5f * lerp); + + float lerpFade = (1 - MathF.Pow(Utils.GetLerpValue(1f, 0, deathFade, true), 5)); + int frameDivis = 2; + int framesY = tex.Height / frameDivis; + int framesX = tex.Width / frameDivis; + float directionRot = Projectile.rotation; + Color usedColor = clr; + for (int i = 1; i <= framesY; i++) + { + + float sine = MathF.Sin((time * 0.15f + i * frameDivis) / MathHelper.Pi); + float frameLerp = Utils.GetLerpValue(framesY, 1, i, true); + float frameFade = Math.Max(MathF.Pow(frameLerp, 4), deathFade); + float colorFade = MathF.Pow(1 - frameLerp, 1.5f); + + float rate = Main.GlobalTimeWrappedHourly * 4 + i * 0.03f; + List eColors = new List() + { + Color.CornflowerBlue, + Color.SkyBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + + for (int x = 1; x <= framesX; x++) + { + Rectangle frame = tex.Frame(framesX, framesY, framesX - x, framesY - i); + + Vector2 xPos = Vector2.UnitX.RotatedBy(Projectile.spriteDirection == -1 ? directionRot + MathHelper.Pi : directionRot) * frame.Width * x * 2 * Projectile.spriteDirection; + + Vector2 frameMovement = generalDrawPos + (xPos + -Vector2.UnitY.RotatedBy(directionRot) * framesY * (Projectile.spriteDirection == 1 ? -2 * frameDivis : 0f) + -Vector2.UnitY.RotatedBy(directionRot) * frame.Height * 2 * i * Projectile.spriteDirection) * scale + + Vector2.UnitX.RotatedBy(directionRot) * (25 + (295 * Utils.GetLerpValue(tex.Height / 2, 0, Math.Abs(tex.Height / 2 - i), true) * lerpFade)) * sine * frameFade; + + Vector2 pixelPlace = frameMovement; + + Vector2 holePlace = new Vector2(Projectile.ai[1], Projectile.ai[2]) + (Projectile.spriteDirection * tex.Size()); + float distFromHole = pixelPlace.Distance(holePlace); + Vector2 holeAdjust = pixelPlace.DirectionFrom(holePlace) * MathHelper.Lerp(0, 25, MathF.Pow(Utils.GetLerpValue(80, 0, distFromHole, true), 2f)) * holeSize; + + Vector2 linePlace = holePlace + Projectile.localAI[0].ToRotationVector2() * distFromHole; + Vector2 lineAdjust = pixelPlace.DirectionFrom(linePlace) * MathHelper.Lerp(0, 25, MathF.Pow(Utils.GetLerpValue(80, 0, pixelPlace.Distance(linePlace), true), 2f)) * (holeSize / (8 - 7 * MathF.Pow(Utils.GetLerpValue(420, 0, distFromHole, true), 1.5f))); + + Main.EntitySpriteDraw(tex, frameMovement + holeAdjust + lineAdjust - Main.screenPosition, frame, usedColor with { A = 0 } * (colorFade) * Projectile.Opacity, Projectile.rotation, tex.Size() / 2, Projectile.scale * scale, spriteFx, 0); + } + } + + return false; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound?.Stop(); + } + } +} diff --git a/Projectiles/Rogue/ElephantKillerElephant.png b/Projectiles/Rogue/ElephantKillerElephant.png new file mode 100644 index 0000000000..f4f89409e5 Binary files /dev/null and b/Projectiles/Rogue/ElephantKillerElephant.png differ diff --git a/Projectiles/Rogue/ElephantKillerFlash.png b/Projectiles/Rogue/ElephantKillerFlash.png new file mode 100644 index 0000000000..2143f03e60 Binary files /dev/null and b/Projectiles/Rogue/ElephantKillerFlash.png differ diff --git a/Projectiles/Rogue/ElephantKillerThrown.cs b/Projectiles/Rogue/ElephantKillerThrown.cs new file mode 100644 index 0000000000..e2dcbb4116 --- /dev/null +++ b/Projectiles/Rogue/ElephantKillerThrown.cs @@ -0,0 +1,756 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Graphic.PixelationSystem; +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.Projectiles.Rogue +{ + public class ElephantKillerThrown : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public new string LocalizationCategory => "Projectiles.Rogue"; + public Player Owner => Main.player[Projectile.owner]; + public ref float time => ref Projectile.ai[0]; + public ref float rightClicking => ref Projectile.ai[1]; + public int initialDirection = 0; + public float throwSpeed = 0; // The speed at which the gun is thrown and returns + public int animationTimeMax = 0; + public int returnTime = 0; + public float holdoutOffset = 0; // Placement adjustments used for "recoil" + public bool tryShooting = true; // Used in the holding mode, is used in inverse for stealth strikes + public bool soundToss = true; + public bool soundCatch = true; + public bool resetIframes = true; + + public bool spinFxOn = false; // Fades in spin effects if on, otherwise fades them out + public float spinFx = 0; + public bool doingFireAnimation = false; + public bool hasFiredBulletEver = false; + public int firingEffectDisableTimer = 0; // Timer to track the firing animation and disable it when completed + public int disableTimerMax = 4; + public bool resetAll = false; + public bool shouldDie = false; + public Vector2 aimedTargetPos; + + public float recoilRotation = 0; // Rotation adjustments used for "recoil" + public int recoilLifetime = 0; + public int recoilLifetimeMax = 30; + + public float shineProgress = 0; + public float shineOpacity = 0; + public bool shineSound = true; + + public float rumble = 0; // Shake effect for stealth strikes and thrown impacts + public int hitStop = 0; // A few frames where the projectile pauses on impact + public int tileHits = 0; + public bool setReturnTime = false; + + public List<(NPC, float, bool)> hitNPCs = new List<(NPC, float, bool)>(); + public static Asset Gun { get; private set; } + public static Asset GunFlash { get; private set; } + public static Asset Smear { get; private set; } + public static Asset Bloom { get; private set; } + public static Asset BloomLine { get; private set; } + public static Asset Shine { get; private set; } + + public override void Load() + { + if (Main.dedServ) + return; + + Gun = ModContent.Request("CalamityMod/Items/Weapons/Rogue/ElephantKiller"); + GunFlash = ModContent.Request("CalamityMod/Projectiles/Rogue/ElephantKillerFlash"); + Smear = ModContent.Request("CalamityMod/Particles/CircularSmearLarge"); + Bloom = ModContent.Request("CalamityMod/Particles/BrightFlash"); + BloomLine = ModContent.Request("CalamityMod/Particles/BloomLineFade"); + Shine = ModContent.Request("CalamityMod/Particles/FullStar"); + } + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + Projectile.noEnchantmentVisuals = true; + } + public enum gunState + { + NotThrown, + Thrown, + Returning, + Shooting, + Rebounding, + Stealth + } + public gunState mode; + public override bool ShouldUpdatePosition() + { + return !(mode == gunState.NotThrown || mode == gunState.Stealth || doingFireAnimation || hitStop > 0); + } + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (mode == gunState.NotThrown || mode == gunState.Stealth || doingFireAnimation || hitStop > 0) + return false; + + return null; + } + public void Thrown(Vector2 toMouse, int returnTime, int animationTimeMax) + { + if (mode == gunState.Thrown || mode == gunState.Returning) + { + if (time < animationTimeMax * 1.65f) + { + Owner.ChangeDir(MathF.Sign(toMouse.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi * 1.5f + toMouse.ToRotation()); + } + if (!doingFireAnimation) + Projectile.rotation += 0.55f * initialDirection; + + if (time > returnTime && mode != gunState.Returning) + { + mode = gunState.Returning; + } + } + + if (mode == gunState.Returning) + { + if (setReturnTime) + { time = returnTime; setReturnTime = false; } + if (time > returnTime * 1.2f && resetIframes) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + resetIframes = false; + Projectile.tileCollide = false; + } + // Aim back at the player + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.Center.DirectionTo(Owner.Center) * throwSpeed, 0.03f * (1 + 2 * Utils.GetLerpValue(returnTime, returnTime * 2, time))); + + bool afterHit = (Projectile.numHits > 0 || tileHits > 0); + + if (afterHit && time > returnTime && !hasFiredBulletEver) + Projectile.velocity *= 0.93f; + + if (afterHit && time > returnTime * 1.4f && (!hasFiredBulletEver || (hasFiredBulletEver && doingFireAnimation))) + { + NPC attemptTarget = !hasFiredBulletEver ? Projectile.Center.ClosestNPCAt(1000, true) : null; + if (aimedTargetPos == Vector2.Zero && attemptTarget != null) + aimedTargetPos = attemptTarget.Center; + + Vector2 shootVel = aimedTargetPos == Vector2.Zero ? Projectile.rotation.ToRotationVector2() : Projectile.Center.DirectionTo(aimedTargetPos); + if (aimedTargetPos != Vector2.Zero) + { + if (!hasFiredBulletEver) + { + Projectile.extraUpdates = 0; + spinFxOn = false; + disableTimerMax = (int)(disableTimerMax * 1.5f); + FireShot(shootVel); + } + spinFx = 0; + Projectile.rotation = shootVel.ToRotation(); + Projectile.Center += -shootVel * holdoutOffset * 2.3f; + Projectile.velocity = -shootVel * 20; + time--; + } + } + else + { + if (Projectile.extraUpdates == 0) + { + spinFxOn = true; + Projectile.extraUpdates = 1; + } + } + + if ((Projectile.Center - Owner.MountedCenter).Length() < 24f && time > returnTime * 1.5f) + { + Projectile.Kill(); + } + } + } + public void Held(Vector2 toMouse, int returnTime, int animationTimeMax) + { + if (mode == gunState.NotThrown || mode == gunState.Stealth) // The throw animation + { + float throwAnimLerp = Utils.GetLerpValue(0, animationTimeMax, time); + float dudFireEndPoint = 0.4f; float throwStartPoint = 0.5f; float throwCutPoint = 0.75f; float maxRotation = -MathHelper.PiOver2; float startRotation = MathHelper.PiOver2; + + Owner.ChangeDir(MathF.Sign(toMouse.X)); + initialDirection = MathF.Sign(toMouse.X); + Owner.heldProj = Projectile.whoAmI; + if (recoilLifetime < recoilLifetimeMax - 7) + Owner.itemTime = Owner.itemAnimation = 5; + if (mode == gunState.Stealth) + { + Owner.itemTime = Owner.itemAnimation = 5; + if (!tryShooting) + rumble = MathHelper.Lerp(rumble, 11, 0.08f); + } + + // The attempted fire at the start of the use animation + if (throwAnimLerp >= dudFireEndPoint / 2 && ((mode != gunState.Stealth && tryShooting) || (mode == gunState.Stealth && !tryShooting))) + { + float roundedStealth = MathF.Round(Owner.Calamity().rogueStealth, 2); + float stealthAmount = MathF.Round(Owner.Calamity().rogueStealthMax * ElephantKiller.stealthCostToShoot, 2); + bool fires = mode == gunState.Stealth || (Owner.Calamity().rogueStealthMax > 0 && rightClicking == 1 && roundedStealth >= stealthAmount); + if (fires) + { + if (mode == gunState.Stealth) + { + Owner.Calamity().ConsumeStealthByAttacking(); + recoilLifetime++; + } + else + { + Owner.Calamity().rogueStealth -= MathF.Round(stealthAmount, 2); + } + CheckStealth(); + FireShot(toMouse, true, ElephantKiller.stealthShotDamageMult, mode == gunState.Stealth); + } + else + { + holdoutOffset = 8; + } + SoundEngine.PlaySound(ElephantKiller.ShotFail with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + tryShooting = mode == gunState.Stealth; + } + if (throwAnimLerp >= dudFireEndPoint) + { + if (recoilLifetime < recoilLifetimeMax && mode == gunState.Stealth && recoilLifetime > 0) + time--; + else if (hasFiredBulletEver) + { + if (mode == gunState.Stealth) + { Projectile.Kill(); return; } + if (Owner.Calamity().mouseRight) + { Reset(); return; } + else + shouldDie = true; + } + } + + if (throwAnimLerp >= throwStartPoint && soundToss) + { + SoundEngine.PlaySound(ElephantKiller.Throw with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.3f, -0.2f) }, Projectile.Center); + spinFx = 0.5f; + spinFxOn = true; + soundToss = false; + } + if (throwAnimLerp >= throwCutPoint && soundCatch) + { + soundCatch = false; + spinFxOn = false; + SoundEngine.PlaySound(ElephantKiller.Catch with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + + float prepThrowLerp = Utils.Remap(throwAnimLerp, dudFireEndPoint, throwStartPoint, 0, 1); + float aim = MathHelper.PiOver2 + MathHelper.PiOver4 * (prepThrowLerp < 0.5f ? (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 0, prepThrowLerp, true), 1f)) : (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 1, prepThrowLerp, true), 2.5f))); + float pullbackLerp = CalamityUtils.EaseInOutExp(Utils.Remap(throwAnimLerp, throwStartPoint, throwCutPoint, 0, 1), 2, 4); float pullback = MathHelper.Lerp(startRotation, maxRotation, pullbackLerp); + float throwForward = MathHelper.Lerp(startRotation, maxRotation, 1 - MathF.Pow(Utils.Remap(throwAnimLerp, throwCutPoint, 1, 0, 1), mode == gunState.Stealth ? 5 : 8.5f)); + + float baseRotation = (recoilLifetime > 0 ? MathHelper.PiOver2 : (throwAnimLerp > throwStartPoint ? throwAnimLerp > throwCutPoint ? throwForward : pullback : aim)) + recoilRotation; + float finalRotation = toMouse.ToRotation() + baseRotation * Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0); + float armRotation = finalRotation; + + float jumpLerp = Utils.Remap(throwAnimLerp, throwStartPoint, throwCutPoint, 0, 1); + float jumpMult = (jumpLerp < 0.5f ? (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 0, jumpLerp, true), 6)) : (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 1, jumpLerp, true), 6))); + if (jumpMult == 0) + spinFx = 0; + Vector2 jump = Vector2.UnitY * -90 * (jumpMult); + Projectile.Center = jump + Owner.MountedCenter + (Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * (-31f + holdoutOffset) * Owner.gravDir + Vector2.UnitY.RotatedBy(armRotation + MathHelper.PiOver2 * initialDirection) * 3.5f) * Projectile.scale; + + float rotMult = 1.25f; + if (throwAnimLerp <= throwCutPoint && throwAnimLerp >= throwStartPoint) + Projectile.rotation -= 0.85f * initialDirection * (jumpMult); + else + Projectile.rotation = (toMouse.ToRotation() + -MathHelper.PiOver2 + ((baseRotation - MathHelper.PiOver2) * rotMult + MathHelper.PiOver2) * Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0)) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + if (mode == gunState.Stealth) + { + float shineLerp = Utils.Remap(throwAnimLerp, 0, dudFireEndPoint, 0, 1); + shineProgress = CalamityUtils.EaseInOutExp(shineLerp, 6, 6); + shineOpacity = soundToss ? (1 - MathF.Pow(shineLerp, 3)) : 0; + if (shineProgress > 0 && shineSound) + { + SoundEngine.PlaySound(ElephantKiller.Shine with { Volume = 0.6f, Pitch = 0f }, Projectile.Center); + shineSound = false; + } + } + + if (throwAnimLerp > 1) + { + if (mode == gunState.Stealth) + { + time = 0; + tryShooting = false; + return; + } + mode = gunState.Thrown; + Projectile.Center = Owner.MountedCenter; + Projectile.extraUpdates = 1; + spinFxOn = true; + Projectile.tileCollide = true; + Projectile.velocity = toMouse * throwSpeed; + SoundEngine.PlaySound(ElephantKiller.Throw with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + } + } + public void Reset() + { + resetAll = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mode = gunState.NotThrown; + Projectile.extraUpdates = 0; + Projectile.numHits = 0; + doingFireAnimation = false; + hasFiredBulletEver = false; + firingEffectDisableTimer = 0; + throwSpeed = 0; + holdoutOffset = 0; + tryShooting = true; + soundToss = true; + resetIframes = true; + Owner.itemTime = Owner.itemAnimation = 0; + time = 0; + } + public override void AI() + { + if (hitStop > 0) + { + Projectile.timeLeft++; hitStop--; + if (hitStop == 0) { Projectile.extraUpdates = 2; } + Projectile.rotation += 0.75f * initialDirection; + return; + + } + + if (Owner.Calamity().mouseRight || rightClicking == 1) + rightClicking = 1; + else + rightClicking = 0; + if (time == 0) // On spawn + { + if (!Owner.Calamity().heldElephantKillerLastFrame) + Owner.Calamity().rogueStealth = 0; + + resetAll = false; + bool canStealth = Owner.Calamity().StealthStrikeAvailable(); + if (canStealth) + Projectile.Calamity().stealthStrike = true; + mode = (canStealth && rightClicking == 0) ? gunState.Stealth : gunState.NotThrown; + throwSpeed = Owner.HeldItem.shootSpeed * Owner.Calamity().rogueVelocity; + animationTimeMax = (int)((Owner.HeldItem.useAnimation * 2) / Owner.GetTotalAttackSpeed()); + returnTime = 30 + animationTimeMax; + } + if (doingFireAnimation && firingEffectDisableTimer < disableTimerMax) + { + firingEffectDisableTimer++; + spinFx = 0; + Lighting.AddLight(Projectile.Center, Color.Khaki.ToVector3() * 0.9f); + } + if (firingEffectDisableTimer >= disableTimerMax) + { + doingFireAnimation = false; + if (mode == gunState.Stealth) + recoilRotation = 0.001f; + else + recoilRotation = -MathHelper.PiOver4 / 2; + firingEffectDisableTimer = 0; + } + + Vector2 toMouse = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + + Held(toMouse, returnTime, animationTimeMax); + + Thrown(toMouse, returnTime, animationTimeMax); + + if (resetAll) + return; + + if (Projectile.soundDelay <= 0 && spinFx > 0.3f) // Spin sounds + { + SoundEngine.PlaySound(ElephantKiller.Woosh with { Volume = 0.3f, MaxInstances = -1, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.soundDelay = 4 * Projectile.MaxUpdates; + } + + holdoutOffset = MathHelper.Lerp(holdoutOffset, 0, 0.185f); + if (recoilRotation != 0) + recoilRotation = MathHelper.Lerp(recoilRotation, mode == gunState.Stealth ? (-MathHelper.PiOver4 * (1.3f + 0.03f * recoilLifetime)) : 0, 0.245f); + if (!doingFireAnimation) + spinFx = MathHelper.Lerp(spinFx, spinFxOn ? 1 : 0, 0.28f); + Projectile.scale = MathHelper.Lerp(Projectile.scale, shouldDie ? 0 : 1, 0.28f); + if (recoilLifetime > 0) + rumble = MathHelper.Lerp(rumble, 0, 0.06f); + if (shouldDie) + { + if (Projectile.scale <= 0.05f) + { Projectile.Kill(); return; } + time--; + } + if (tileHits >= 3) + Projectile.tileCollide = false; + + Projectile.timeLeft++; + if (recoilLifetime > 0) + recoilLifetime++; + time++; + } + public void FireShot(Vector2 velocity, bool recoil = false, float damageMult = 1, bool elephant = false) + { + holdoutOffset = 15; + Owner.SetScreenshake(3.5f + damageMult); + doingFireAnimation = true; + hasFiredBulletEver = true; + + SoundEngine.PlaySound(ElephantKiller.Shot with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - (elephant ? 0.6f : 0), MaxInstances = 3 }, Projectile.Center); + if (elephant) + SoundEngine.PlaySound(ElephantKiller.Shot with { Volume = 0.9f, Pitch = 0.4f, MaxInstances = 3 }, Projectile.Center); + if (recoil) + Owner.velocity -= velocity * 2.25f * damageMult * (elephant ? 1.5f : 1); + + if (elephant) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.timeLeft = 90; + } + } + Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, velocity * Owner.HeldItem.shootSpeed * 2, ModContent.ProjectileType(), 0, 0, Owner.whoAmI); + } + else + { + float elephantDistance = 0; + bool elephantBoosted = false; + Vector2 redirectPoint = Vector2.Zero; + Vector2 redirectVelocity = Vector2.Zero; + + // Check if you shot an elephant + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType()) + { + float _ = float.NaN; + bool elephantCollide = Collision.CheckAABBvLineCollision(projectile.Hitbox.TopLeft(), projectile.Hitbox.Size(), Projectile.Center, Projectile.Center + velocity * 2500, 10 * Projectile.scale, ref _); + if (Projectile.Hitbox.Intersects(projectile.Hitbox)) + { + elephantCollide = true; + _ = Projectile.width; + } + if (elephantCollide) + { + elephantDistance = _; + Vector2 hitPoint = Projectile.Center + velocity * _; + elephantBoosted = true; + Vector2 adjustedHitPoint = hitPoint + velocity * 15; + projectile.ai[1] = adjustedHitPoint.X; + projectile.ai[2] = adjustedHitPoint.Y; + projectile.localAI[1] = 0.5f + damageMult; + + redirectPoint = hitPoint; + NPC redirectTarget = hitPoint.ClosestNPCAt(2500, true); + redirectVelocity = redirectTarget == null ? velocity : hitPoint.DirectionTo(redirectTarget.Center); + + projectile.localAI[0] = redirectVelocity.ToRotation(); + + makeHitEffects(velocity, 2, hitPoint, projectile.whoAmI, false, 1, redirectVelocity.ToRotation()); + } + } + } + + for (int y = 0; y < (elephantBoosted ? 2 : 1); y++) + { + bool redirected = y == 1; + Vector2 lineCheckVelocity = (!redirected ? velocity : redirectVelocity); + Vector2 startPoint = (!redirected ? Projectile.Center : redirectPoint); + Vector2 endPoint = (elephantBoosted && !redirected) ? redirectPoint : (startPoint + lineCheckVelocity * 2500); + + for (int index = 0; index < Main.npc.Length; index++) + { + NPC target = Main.npc[index]; + if (!target.dontTakeDamage && target.active && target.life > 0 && !target.townNPC) + { + float _ = float.NaN; + bool collides = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), startPoint, endPoint, 10 * Projectile.scale, ref _); + if (Projectile.Hitbox.Intersects(target.Hitbox)) + { + collides = true; + _ = Projectile.width; + } + if (collides) + hitNPCs.Add((target, ((!redirected ? 0 : elephantDistance) + _), redirected)); + } + } + } + bool resetHits = false; + hitNPCs = hitNPCs.OrderBy(x => x.Item2).ToList(); // Order hit NPCs by distance to hit them in order + for (int index = 0; index < hitNPCs.Count(); index++) + { + NPC target = hitNPCs.ElementAt(index).Item1; + float distance = hitNPCs.ElementAt(index).Item2; + bool isAfterElephantHit = hitNPCs.ElementAt(index).Item3; + + if (isAfterElephantHit && !resetHits) // Getting the redirect resets num hits + { resetHits = true; Projectile.numHits = 0; } + + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageFalloff = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float adjustedDamageMult = damageMult * damageFalloff; + + Vector2 vel = (isAfterElephantHit ? redirectVelocity : velocity); + + Vector2 hitPoint = (isAfterElephantHit ? redirectPoint : Projectile.Center) + vel * (distance - (isAfterElephantHit ? elephantDistance : 0)); // maybe here? + + int damage = (int)((Projectile.damage / 2) * (isAfterElephantHit ? ElephantKiller.elephantBoostedShotDamageMult * adjustedDamageMult : adjustedDamageMult)); // Bullets deal half of gun damage, but always crit + Projectile bullet = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Owner.whoAmI, target.whoAmI); + bullet.DamageType = RogueDamageClass.Instance; + bullet.Calamity().stealthStrike = isAfterElephantHit; // Turn bullets shot through the Elephant into stealth strikes + + makeHitEffects(vel, adjustedDamageMult, hitPoint, elephantBoosted: isAfterElephantHit, effectMult: damageFalloff); + + Projectile.numHits++; + } + hitNPCs.Clear(); + } + } + public void makeHitEffects(Vector2 velocity, float damageMult, Vector2 hitPoint, int shotElephantID = -50, bool elephantBoosted = false, float effectMult = 1, float exitAngle = -1000) + { + bool shotElephant = shotElephantID != -50; + bool blue = (shotElephant || !ChildSafety.Disabled); + Color flashColor = (elephantBoosted || shotElephant) ? Color.CornflowerBlue : Color.Khaki; + if (elephantBoosted) + { + velocity *= 1.3f; + Owner.SetScreenshake(6f); + + for (int i = 0; i < (damageMult == ElephantKiller.stealthShotDamageMult ? 2 : 1); i++) + SoundEngine.PlaySound(ElephantKiller.BoostedShotHit with { Volume = 0.2f + 0.8f * effectMult, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - 0.5f * (1 - effectMult), MaxInstances = -1 }, hitPoint); + } + for (int y = 0; y < ((shotElephant || elephantBoosted) ? 2 : 1); y++) + { + if (y == 1 && shotElephant) + { + velocity = exitAngle.ToRotationVector2(); + if (!elephantBoosted) + { + float lastCollisionDistance = float.NaN; + Projectile elephant = Main.projectile[shotElephantID]; + Vector2 lineStartPoint = hitPoint + velocity.SafeNormalize(Vector2.UnitX) * 600; + bool collides = Collision.CheckAABBvLineCollision(elephant.Hitbox.TopLeft(), elephant.Hitbox.Size(), lineStartPoint, hitPoint, 10 * Projectile.scale, ref lastCollisionDistance); + + hitPoint = lineStartPoint - velocity.SafeNormalize(Vector2.UnitX) * lastCollisionDistance; + } + velocity *= -1; + } + Vector2 displayHitPoint = hitPoint; + if (y == 0) + { + Particle bloom = new CustomSpark(displayHitPoint - velocity * 8, Vector2.Zero, "CalamityMod/Particles/BrightFlash", false, Main.rand.Next(7, 8 + 1), Main.rand.NextFloat(0.3f, 0.35f) * 1.5f * damageMult, flashColor, new Vector2(1f, 1f), true, true, glowOpacity: 0.7f, colorFadeSpeed: 10, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(bloom, true); + } + if (elephantBoosted && y == 0) + { + Vector2 spawnPoint = displayHitPoint - velocity.SafeNormalize(Vector2.UnitX) * 16; + float spins = Main.rand.NextFloat(0.02f, 0.06f) * (Main.rand.NextBool() ? 1 : -1); + for (int i = 0; i <= 1; i++) // twice + { + Particle bloom2 = new CustomSpark(spawnPoint, Vector2.Zero, "CalamityMod/Particles/HalfStar", false, 10, 4f * damageMult, flashColor, new Vector2(1.5f, 0.4f), true, true, glowOpacity: 0.7f, colorFadeSpeed: 10, shrinkSpeed: 1.5f, extraRotation: MathHelper.PiOver2 * i, spin: spins); + GeneralParticleHandler.SpawnParticle(bloom2, true); + } + float scale = 0.01f; + Particle pulse = new CustomPulse(spawnPoint, Vector2.Zero, flashColor, "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, damageMult * scale, 4f * damageMult * scale, 35); + GeneralParticleHandler.SpawnParticle(pulse, true); + Particle pulse2 = new CustomPulse(spawnPoint, Vector2.Zero, Color.SkyBlue, "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, damageMult * scale, 6f * damageMult * scale, 22); + GeneralParticleHandler.SpawnParticle(pulse2, true); + } + + if ((!shotElephant && y == 0) || (y == 1 && !elephantBoosted)) + { + for (int i = 0; i < (int)(12 * damageMult); i++) + { + Vector2 bloodVel = !shotElephant ? velocity : -velocity; + Color clr = blue ? (Main.rand.NextBool(3) ? Color.SkyBlue : Color.CornflowerBlue) : (Main.rand.NextBool(3) ? Color.DarkRed : Color.Maroon); + + int dustType = blue ? ModContent.DustType() : DustID.Blood; + bool spread = Main.rand.NextBool(); + Vector2 dustVel = bloodVel.RotatedBy(spread ? ((Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.2f, 0.6f)) : 0) * Main.rand.NextFloat(8.5f, 18.5f) * damageMult * (spread ? 0.6f : 1); + Dust dust = Dust.NewDustPerfect(displayHitPoint + (spread? Vector2.Zero : Main.rand.NextVector2Circular(6, 6)) * damageMult, dustType, dustVel, Main.rand.Next(10, 120), default, Main.rand.NextFloat(0.9f, 1.4f) * damageMult); + dust.noGravity = true; + if (blue) + { + dust.alpha = 200; + dust.scale *= 0.75f; + dust.fadeIn = 2.5f; + dust.color = clr; + dust.noLight = true; + dust.noLightEmittence = true; + } + float speedMult = Main.rand.NextFloat(0, 1f); + + Particle spark = new CustomSpark(displayHitPoint, bloodVel.RotateRandom((1 - speedMult) * 0.12f) * 10 * (speedMult + 0.25f) * damageMult, "CalamityMod/Particles/" + (Main.rand.NextBool() ? "FadeLine" : "GlowOrbParticle"), false, Main.rand.Next(7, 11 + 1), Main.rand.NextFloat(0.2f, 0.4f) * 2f * damageMult, clr, new Vector2(1.5f, 1f), blue, shrinkSpeed: 0.6f, colorFadeSpeed: 10, affectedByLight: !blue); + GeneralParticleHandler.SpawnParticle(spark, true); + } + } + + int effects = 4; + for (int i = -effects; i <= effects; i++) + { + if (i == 0) i++; + bool glow = MathF.Abs(i) == 2; + Color clr = shotElephant ? (Main.rand.NextBool(3, 4) ? Color.DodgerBlue : Color.CornflowerBlue) : (Main.rand.NextBool(3, 4) ? new Color(114, 112, 116) : new Color(216, 216, 216)); + Vector2 vel = -velocity.RotatedBy(MathHelper.PiOver2 * (elephantBoosted ? 0.1f : 0.4f) * (y == 1 ? 0.25f : 1) * Math.Sign(i)).RotatedByRandom(glow ? 0 : 0.35f) * Main.rand.NextFloat(5, 14); + Particle spark = new CustomSpark(displayHitPoint + vel * (glow ? 5f : 3f) * damageMult, vel * (y == 1 ? 1.5f : 1), "CalamityMod/Particles/" + (!glow ? "FadeLine" : "ForwardSmear"), false, (int)(Main.rand.Next(29, 35 + 1) * (glow ? 0.3f : 1)), + Main.rand.NextFloat(0.2f, 0.3f) * (glow ? 0.3f : 2f) * damageMult, glow ? flashColor : clr, new Vector2(glow ? 1.5f : 0.6f, 1f), glow || shotElephant, shrinkSpeed: glow ? 0.7f : 0.35f, colorFadeSpeed: 10); + GeneralParticleHandler.SpawnParticle(spark, true); + } + } + } + public void CheckStealth() + { + if (Owner.Calamity().rogueStealth > Owner.Calamity().rogueStealthMax) + Owner.Calamity().rogueStealth = Owner.Calamity().rogueStealthMax; + if (Owner.Calamity().rogueStealth < 0) + Owner.Calamity().rogueStealth = 0; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + if (tileHits == 0) + { + throwCollideEffects(); + Projectile.extraUpdates = 0; + setReturnTime = true; + mode = gunState.Returning; + Projectile.velocity = new Vector2(-Math.Sign(Projectile.Center.DirectionTo(target.Center).X) * Projectile.velocity.Length() / 2, -18 * Math.Sign(Projectile.Center.DirectionTo(target.Center).Y)); + } + Owner.Calamity().rogueStealth += MathF.Round(Owner.Calamity().rogueStealthMax * ElephantKiller.stealthGainOnThrowHit, 2); // Give stealth on hit + CheckStealth(); + } + } + public void throwCollideEffects() + { + hitStop = Math.Max(6 - tileHits * 2, 0); + if (hitStop >= 2) + { + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(114, 112, 116), "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, 0.04f, 0.05f, hitStop, false); + GeneralParticleHandler.SpawnParticle(pulse, true); + } + + SoundEngine.PlaySound(ElephantKiller.Hit with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) + tileHits * 0.1f, MaxInstances = -1 }, Projectile.Center); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + throwCollideEffects(); + tileHits++; + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = MathHelper.Clamp(Utils.GetLerpValue(8, 1, Projectile.numHits), 0.4f, 1); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = doingFireAnimation ? GunFlash : Gun; + Asset smear = Smear; + Asset flash = Bloom; + Asset flashTip = BloomLine; + Asset shineTip = Shine; + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + Main.rand.NextVector2Circular(rumble, rumble) + + ((mode == gunState.NotThrown || mode == gunState.Stealth) ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + PixelationManager.AddPixelatedDrawer((_) => // The spinnging smear when thrown + { + if (spinFx > 0.001f) + { + float scale = 0.19f; + Color dark = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(24, 20, 37)); + Color light = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(114, 112, 116)); + Color shine = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(216, 216, 216)); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, light * spinFx, Projectile.rotation * Main.rand.NextFloat(3.9f, 4.2f), smear.Size() * 0.5f, Projectile.scale * 0.55f * scale * Main.rand.NextFloat(0.95f, 1.05f), SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, shine * spinFx, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), smear.Size() * 0.5f, Projectile.scale * 0.45f * scale, SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, dark * spinFx, Projectile.rotation * Main.rand.NextFloat(0.7f, 0.8f), smear.Size() * 0.5f, Projectile.scale * 0.4f * scale * Main.rand.NextFloat(0.95f, 1.05f), SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.BeforeProjectiles, BlendState.NonPremultiplied); + + Main.EntitySpriteDraw(tex.Value, generalDrawPos + Main.rand.NextVector2Circular(hitStop * 2, hitStop * 2), null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, initialDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + + if (doingFireAnimation) // The muzzle flash effect when firing + { + PixelationManager.AddPixelatedDrawer((_) => + { + float scale = (0.35f + firingEffectDisableTimer * 0.22f) * (mode == gunState.Stealth ? 2 : 1); + float flashFade = !doingFireAnimation ? 0 : MathF.Pow(Utils.GetLerpValue(disableTimerMax, 0, firingEffectDisableTimer, true), 3); + float flashMult = Utils.GetLerpValue(0, disableTimerMax, firingEffectDisableTimer, true) * 5; + + Vector2 vel = Projectile.rotation.ToRotationVector2(); + Vector2 gunTipPostion = generalDrawPos + vel * (30 + flashMult * 4.5f) - vel.RotatedBy(MathHelper.PiOver2 * initialDirection) * 5; + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(flash.Value, gunTipPostion, null, Color.Khaki with { A = 0 } * 0.8f * Utils.GetLerpValue(disableTimerMax, 0, firingEffectDisableTimer, true), Projectile.rotation, flash.Size() * 0.5f, Projectile.scale * scale * (i == 0 ? 1 : 0.75f), SpriteEffects.None); + for (int i = -1; i <= 1; i++) // 3 + { + Vector2 squash = new Vector2(0.9f * flashFade, 0.9f + 0.9f * (1 - flashFade) - Math.Abs(i) * 0.45f) * 0.15f; + Main.EntitySpriteDraw(flashTip.Value, gunTipPostion, null, Color.Khaki with { A = 0 } * (0.6f - 0.15f * flashMult), Projectile.rotation + MathHelper.PiOver2 + MathHelper.PiOver4 * i * flashFade, new Vector2(flashTip.Width() / 2, flashTip.Height()), squash * Projectile.scale * scale, SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.AfterProjectiles, default); + } + if (mode == gunState.Stealth) // The shine effect that occurs before firing an elephant + { + PixelationManager.AddPixelatedDrawer((_) => + { + float scale = 0.5f + 1.3f * shineProgress; + + Vector2 vel = Projectile.rotation.ToRotationVector2(); + Vector2 gunTipPostion = generalDrawPos + vel * (MathHelper.Lerp(-15, 30, shineProgress)) - vel.RotatedBy(MathHelper.PiOver2 * initialDirection) * 9; + + for (int i = -1; i <= 1; i++) + { + Vector2 squash = new Vector2(1f - 0.7f * i * shineProgress, 1 + 0.7f * i * shineProgress) * scale; + Main.EntitySpriteDraw(shineTip.Value, gunTipPostion, null, (i == 0 ? Color.White : new Color(216, 216, 216)) with { A = 0 } * 0.8f * shineOpacity, Projectile.rotation + MathHelper.Pi * shineProgress, shineTip.Size() * 0.5f, squash * Projectile.scale * (i == 0 ? 0.5f : 1f), SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.AfterEverything, default); + } + + return false; + } + } +} diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 6ea396fde9..b6b8a1e678 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -439,6 +439,8 @@ namespace CalamityMod.Projectiles.Rogue Asset glowBottom = ModContent.Request("CalamityMod/Particles/SquareRotated"); Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + Vector2 drawAdjust = -Main.screenPosition + (!flung ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + if (hitTiles || falling || stealth) { for (int i = 0; i < 25; i++) @@ -446,7 +448,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 drawPos = Projectile.Center; Color auraColor = glowColor with { A = 0 } * 0.05f * glowUp; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * glowUp * 2; - Main.EntitySpriteDraw(tex, drawPos - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex, drawPos + drawAdjust + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } } if (stealth) @@ -458,19 +460,19 @@ namespace CalamityMod.Projectiles.Rogue if (i == 0 && Projectile.timeLeft > 240) { - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center + drawAdjust, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center + drawAdjust, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); } for (int y = 0; y < 2; y++) - Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowBlade.Value, fxPos + drawAdjust, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); float softGlowUp = (float)Math.Pow(glowUp, 0.15f); for (int y = 0; y < 3; y++) - Main.EntitySpriteDraw(glowBottom.Value, fxPos - Main.screenPosition - fxVel * 0.55f, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.1f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBottom.Size() / 2f, new Vector2(1f * (y != 0 ? 0.65f : 1f) * softGlowUp, 1.7f * throwCompletion * softGlowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * (y == 2 ? 0.3f : 0.25f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowBottom.Value, fxPos + drawAdjust - fxVel * 0.55f, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.1f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBottom.Size() / 2f, new Vector2(1f * (y != 0 ? 0.65f : 1f) * softGlowUp, 1.7f * throwCompletion * softGlowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * (y == 2 ? 0.3f : 0.25f), SpriteEffects.None, 0); } } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center + drawAdjust, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index dc34689d70..7ba53c3140 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +16,39 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.timeLeft = 90; - AIType = ProjectileID.WoodenArrowFriendly; + Projectile.penetrate = 3; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.timeLeft = 600; + AIType = ProjectileID.SpikyBall; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = 15; + Projectile.usesLocalNPCImmunity = true; } - public override void AI() + public override bool PreAI() { - Projectile.rotation += Projectile.velocity.Y; - Projectile.velocity.Y *= 1.05f; + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = SpearofPaleolith.ShardBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + + Projectile.velocity.X *= 0.975f; + var tile = Main.tile[(Projectile.Bottom + Vector2.UnitY).ToTileCoordinates()]; + if (tile.HasUnactuatedTile && tile.TileType == TileID.ConveyorBeltLeft) + { + Projectile.velocity.X = 2; + } + else if (tile.HasUnactuatedTile && tile.TileType == TileID.ConveyorBeltRight) + { + Projectile.velocity.X = -2; + } + return true; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); 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/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index eb0ba1a84b..889f1f140f 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -73,13 +73,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Frozen, 150); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 987c2786bd..4da315507f 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -59,8 +59,6 @@ namespace CalamityMod.Projectiles.Rogue 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 < 3; k++) diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index c30a3b9955..85c92357cc 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 8; i++) { Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack, Projectile.owner); } } } 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/LemonNadeHoldout.cs b/Projectiles/Rogue/LemonNadeHoldout.cs new file mode 100644 index 0000000000..29dc08f584 --- /dev/null +++ b/Projectiles/Rogue/LemonNadeHoldout.cs @@ -0,0 +1,153 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LemonNadeHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LemonNade"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 0.5f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var stealthTime = CalamityUtils.SecondsToFrames(2) / avgStealth; + var explodeTimeGoal = stealthTime + 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (timer == 1) + { + + + if (!Main.dedServ) + { + SoundEngine.PlaySound(SoundID.DD2_JavelinThrowersAttack with { pitch = 1f }); + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.UnitY * -8 + angle, Mod.Find("LemonNadePin").Type, 1); + } + } + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + // Code copied from Violence / Chalice. + float bloodVelMult = 1; + if (Main.rand.NextFloat() < explodeTimer / explodeTimeGoal && Projectile.Opacity > 0 && Projectile.FinalExtraUpdate()) + { + int bloodLifetime = Main.rand.Next(5, 15); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * bloodVelMult * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity.RotatedBy(Projectile.rotation + MathHelper.PiOver4 * Projectile.spriteDirection), bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer - 25, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + Projectile.rotation += MathHelper.PiOver2 * Projectile.spriteDirection; + } + + public override float SwingFunction() + { + if (inStartup) + { + return swingWidth * -0.5f + (MathF.Sin(Main.GlobalTimeWrappedHourly * 30) * 0.2f); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/LemonNadeProjectile.cs b/Projectiles/Rogue/LemonNadeProjectile.cs new file mode 100644 index 0000000000..b34e7dceb8 --- /dev/null +++ b/Projectiles/Rogue/LemonNadeProjectile.cs @@ -0,0 +1,167 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LemonNadeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LemonNade"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + ref float ExplodeTimer => ref Projectile.ai[0]; + ref float ExplodeTimeMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + + public override void AI() + { + if (AIState == 1) + { + Projectile.idStaticNPCHitCooldown = 2; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.damage = 0; + } + + Projectile.rotation += 0.175f * Projectile.direction; + + if (Projectile.timeLeft < 280 && AIState != 1) + Projectile.velocity.Y += 0.22f; + + ExplodeTimer++; + //Copied from violence/chalice + if (Main.rand.NextFloat() < ExplodeTimer / ExplodeTimeMax && Projectile.FinalExtraUpdate()) + { + int bloodLifetime = Main.rand.Next(5, 15); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity.RotatedBy(Projectile.rotation + MathHelper.PiOver4 * Projectile.spriteDirection), bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + + if (ExplodeTimer > ExplodeTimeMax || Projectile.timeLeft == 2) + { + if (AIState == 1) + Projectile.damage = Projectile.originalDamage; + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) + { + var frags = 6f; + for (var i = 0; i < frags; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedBy(i / frags * MathHelper.TwoPi) * -10, ModContent.ProjectileType(), Projectile.damage/2, Projectile.knockBack, Projectile.owner, 0, 20, 1); + } + Projectile.Resize(360, 360); + Projectile.ResetLocalNPCHitImmunity(); + Projectile.Damage(); + + for (var i = 0; i < 40; i++) + { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.75f, 1.25f)); + } + var exactBloodCount = 10; + // Code copied from Violence/chalice. + float bloodVelMult = 6; + for (int i = 0; i < exactBloodCount; ++i) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 1.2f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * bloodVelMult * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + + SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center); + Projectile.Kill(); + + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (AIState == 1) + { + Main.instance.LoadItem(ItemID.PumpkinSeed); + var tex = TextureAssets.Item[ItemID.PumpkinSeed]; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.velocity.ToRotation() - MathHelper.PiOver2, tex.Size() * 0.5f, Projectile.scale, 0); + return false; + } + return true; + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.33f; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.width < 100) + modifiers.SourceDamage *= 0.1f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.velocity.X *= -0.65f; + Projectile.velocity.Y = -3f; + if (ExplodeTimeMax - ExplodeTimer < 30) + ExplodeTimer += 15; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + //Only make noises and particles if not an explosion + if (Projectile.width < 100) + { + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + } + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.velocity *= 0.75f; + return false; + } + } + +} diff --git a/Projectiles/Rogue/LeviathanToothStealth.cs b/Projectiles/Rogue/LeviathanToothStealth.cs index 90da6945bf..e4527c2ca3 100644 --- a/Projectiles/Rogue/LeviathanToothStealth.cs +++ b/Projectiles/Rogue/LeviathanToothStealth.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue if (hitTimer != 0) damageMult = 0.2f; bool jawsJustSlammed = (time >= jawSlamTime && time <= jawSlamTime + 8); - modifiers.SourceDamage *= (jawsJustSlammed ? 12 : 1) * damageMult; + modifiers.SourceDamage *= (jawsJustSlammed ? 4 : 1) * damageMult; if (hitTimer == 0) hitTimer = Projectile.localNPCHitCooldown; diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 7d5cb2ecae..9c7f1acc8b 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center); velocity *= Main.rand.NextFloat(4.5f, 6.5f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default); - int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); - if (spike.WithinBounds(Main.maxProjectiles)) - Main.projectile[spike].DamageType = RogueDamageClass.Instance; + Projectile spike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); + spike.DamageType = RogueDamageClass.Instance; + spike.penetrate = 1; } } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index dab49da486..4c0c259b7b 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.timeLeft = 360; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PaleoShatterExplosion.cs b/Projectiles/Rogue/PaleoShatterExplosion.cs new file mode 100644 index 0000000000..d9366c8580 --- /dev/null +++ b/Projectiles/Rogue/PaleoShatterExplosion.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class PaleoShatterExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 152; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (Projectile.timeLeft == 60) + Projectile.Bottom = Projectile.Center + new Vector2(0,16); + if (Projectile.timeLeft % 3f == 2f) + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.Kill(); + } + } +} diff --git a/Projectiles/Rogue/PaleoShatterExplosion.png b/Projectiles/Rogue/PaleoShatterExplosion.png new file mode 100644 index 0000000000..7740b1ff36 Binary files /dev/null and b/Projectiles/Rogue/PaleoShatterExplosion.png differ diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index ff48cd70d1..55b2aa78cd 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; //Stealth strike behavior - if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.ai[2] >= 2) + if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.ai[2] > 0) return; Projectile.localAI[0]++; - if (Projectile.localAI[0] >= 12f) + if (Projectile.localAI[0] == 12f) { Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) @@ -47,14 +47,12 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Palladium, 0f, 0f, 0, default, 1f); } - int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); - int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); + int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: 1); + int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: 1); if (javelin.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin].Calamity().stealthStrike = true; if (javelin2.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin2].Calamity().stealthStrike = true; - - Projectile.Kill(); } } diff --git a/Projectiles/Rogue/ProfanedPartisanFlare.cs b/Projectiles/Rogue/ProfanedPartisanFlare.cs new file mode 100644 index 0000000000..67c7ae2fd4 --- /dev/null +++ b/Projectiles/Rogue/ProfanedPartisanFlare.cs @@ -0,0 +1,234 @@ +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ProfanedPartisanFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public int timer = 0; + public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + public override void SetDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + NPC target = null; + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.frame = 0; + + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = ProfanedPartisan.StarBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + if (target != null && Projectile.localNPCImmunity[target.whoAmI] <= 0 && target.active && !target.dontTakeDamage) + { + Projectile.Calamity().HomingTarget = target.whoAmI; + var dis = Projectile.Distance(target.Center); + Projectile.velocity = Projectile.velocity.ToRotation().AngleLerp(Projectile.DirectionTo(target.Center).ToRotation(), (Projectile.Distance(target.Center) < 160 ? 0.1f + (1 - dis / 160) * 0.4f : 0.1f)).ToRotationVector2() * Projectile.velocity.Length(); + } + else + { + target = GetTargetInRange(2000); + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnKill(int timeLeft) + { + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + Projectile.Opacity = 1; + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var trailLease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + //Everything is drawn to this lease, which then is drawn to screen with the desired opacity. + //This is used to allow projectile opacity to scale nicely + using var mainLease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth, + Main.screenHeight, + RenderTargetDescriptor.Default + ); + + using (mainLease.Scope(clearColor: Color.Transparent)) + { + using (trailLease.Scope(clearColor: Color.Transparent)) + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos.Take(5).ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + Main.spriteBatch.Draw(trailLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 2f, 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[ModContent.ProjectileType()].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = Color.Lerp(hiColor, loColor, 0.5f); + Color baseColor2 = hiColor; + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f) * 1.2f * Projectile.scale; + + 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(mainLease.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 = 16f * 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(255, 155, 25, 255); + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + { + NPC gotTarget = null; + float currentDistance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && myDistance < currentDistance) + { + currentDistance = myDistance; + gotTarget = npc; + } + } + return gotTarget; + } + } + } +} diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index b7c056a4ad..dbdfc2fb40 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -1,8 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -13,10 +17,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/ProfanedPartisan"; + + public static int Lifetime => 600; + public int ExplodeTime => 60 * Projectile.MaxUpdates; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 24; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -24,47 +31,91 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 9; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + } + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } } public override void AI() { - if (Projectile.ai[0] < 0.4f) + Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); + if (StuckEnemyID > 0) { - Projectile.ai[0] += 0.1f; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.tileCollide = true; + Projectile.timeLeft = ExplodeTime; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - else + else if (Projectile.damage == 0) //after running out of penetrate hits, if not impaled or dead { - Projectile.tileCollide = true; + Projectile.velocity *= 0.975f; + float intensity = 1 - Projectile.timeLeft / (float)ExplodeTime; + Projectile.position += Main.rand.NextVector2CircularEdge(intensity, intensity); + + if (Projectile.timeLeft == 1) + { + + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + for (var i = 0; i < 3; i++) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i - 1) * 0.25f + Main.rand.NextFloat(-0.1f, 0.1f)) * 24f, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } + return; } - //Backwards projectile fix - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == 1) - { - Projectile.rotation += MathHelper.ToRadians(45f); - DrawOffsetX = -26; - DrawOriginOffsetX = 13; - DrawOriginOffsetY = 2; - } - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == -1) - { - Projectile.rotation -= MathHelper.ToRadians(45f); - DrawOffsetX = 2; - DrawOriginOffsetX = -13; - DrawOriginOffsetY = 2; - } + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 45)*Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Main.rand.NextBool(3)) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); @@ -72,20 +123,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[d].velocity *= 0.3f; Main.dust[d].velocity += Projectile.velocity * 0.85f; } - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); - - if (Projectile.Calamity().stealthStrike) //Stealth strike - { - Vector2 spearPosition = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); - Vector2 spearSpeed = Projectile.velocity; - if (Projectile.timeLeft % 18 == 0) - { - int projID = ModContent.ProjectileType(); - int spearDamage = (int)(Projectile.damage * 0.4f); - float spearKB = 1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spearPosition, spearSpeed, projID, spearDamage, spearKB, Projectile.owner); - } - } } public override void OnKill(int timeLeft) @@ -95,20 +132,48 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default, 2.6f); } SoundEngine.PlaySound(SoundID.Item45, Projectile.position); - - int projID = ModContent.ProjectileType(); - int explosionDamage = (int)(Projectile.damage * 0.8f); - float explosionKB = 8f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, Projectile.owner); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + + for (var i = 0; i < ProjectileID.Sets.TrailCacheLength[Type]; i += 3) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition, null, lightColor * Projectile.Opacity * (i > 0 ? (1 - i / (float)ProjectileID.Sets.TrailCacheLength[Type]) * 0.25f : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + } + + float glowIntensity = Projectile.damage == 0 && StuckEnemyID == 0 ? 4f * (1-(Projectile.timeLeft/(float)ExplodeTime)) : 0f; + Projectile.DrawProjectileWithBackglow(Color.Yellow, lightColor, glowIntensity); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.tileCollide = false; + if (Projectile.Calamity().stealthStrike) + { + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + else + { + Projectile.timeLeft = ExplodeTime; + } + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + if (!strongSplit) + for (var i = 0; i < 3; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i-1)*0.25f + Main.rand.NextFloat(-0.1f,0.1f)) * 10, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0f, 0f); + p.localNPCImmunity[target.whoAmI] = 60; + } + target.AddBuff(ModContent.BuffType(), 180); + if (!strongSplit) + { + Projectile.Kill(); + } + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 0f9ab63c40..ae6f980748 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,88 +11,81 @@ namespace CalamityMod.Projectiles.Rogue public class ProfanedPartisanSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int timer = 0; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; + Projectile.penetrate = 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 600; + Projectile.tileCollide = false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[1] != 1f) - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); - } - - private void OnHitEffects() - { - if (Projectile.ai[1] != 1f) - { - Projectile.velocity.X *= -1f; - Projectile.velocity.Y *= -1f; - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - if (Projectile.ai[0] == 1f) - timer++; - if (timer >= 5) - Projectile.penetrate = 1; - if (timer >= 10) + if (Projectile.originalDamage == 0) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 7f, 20f); + Projectile.originalDamage = ProfanedPartisan.SpearBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; } + + float timeGateValue = 30f; + if (Projectile.ai[0] <= 0f) //Copied from HolySpear.cs + { + Projectile.ai[1] += 1f; + + float slowGateValue = 25f; + float fastGateValue = 10f; + float minVelocity = 2f; + float maxVelocity = minVelocity * 5f; + float extremeVelocity = maxVelocity * 2f; + float deceleration = 0.9f; + float acceleration = 2f; + + if (Projectile.localAI[1] >= timeGateValue) + { + if (Projectile.velocity.Length() < extremeVelocity) + Projectile.velocity *= acceleration; + } + else + { + if (Projectile.ai[1] <= slowGateValue) + { + if (Projectile.velocity.Length() > minVelocity) + Projectile.velocity *= deceleration; + } + else if (Projectile.ai[1] < slowGateValue + fastGateValue) + { + if (Projectile.velocity.Length() < maxVelocity) + Projectile.velocity *= acceleration; + } + else + Projectile.ai[1] = 0f; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, Color.White); return false; } } diff --git a/Projectiles/Rogue/PumpkaboomBig.cs b/Projectiles/Rogue/PumpkaboomBig.cs index 310ecffa27..dad826b9be 100644 --- a/Projectiles/Rogue/PumpkaboomBig.cs +++ b/Projectiles/Rogue/PumpkaboomBig.cs @@ -254,8 +254,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] = 5; // Reset firing state if (flungState != -1f) { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.5f }, Projectile.Center); if (Main.myPlayer == Projectile.owner) { @@ -384,7 +384,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); - drawPosition = grenadePos - Main.screenPosition; + drawPosition = grenadePos - Main.screenPosition + new Vector2(0, Owner.gfxOffY); drawRotation = grenadeRot + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); } diff --git a/Projectiles/Rogue/PumpkaboomSmall.cs b/Projectiles/Rogue/PumpkaboomSmall.cs index 759714363a..8ad1266778 100644 --- a/Projectiles/Rogue/PumpkaboomSmall.cs +++ b/Projectiles/Rogue/PumpkaboomSmall.cs @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Rogue if (flungState != -1f) { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.4f }, Projectile.Center); if (Main.myPlayer == Projectile.owner) @@ -352,7 +352,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); - drawPosition = grenadePos - Main.screenPosition; + drawPosition = grenadePos - Main.screenPosition + new Vector2(0, Owner.gfxOffY); drawRotation = grenadeRot + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); } diff --git a/Projectiles/Rogue/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs index 5938658b73..7a7740025e 100644 --- a/Projectiles/Rogue/RadiationRain.cs +++ b/Projectiles/Rogue/RadiationRain.cs @@ -45,18 +45,15 @@ namespace CalamityMod.Projectiles.Rogue Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor * 0.7f, "CalamityMod/ExtraTextures/GreyscaleVortex", new Vector2(1, 1), Projectile.ai[2] * 0.45f, orbScale, orbScale * 1.1f, 12, false); GeneralParticleHandler.SpawnParticle(orb); Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 18); - GeneralParticleHandler.SpawnParticle(orb3); - orb3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb3, false, GeneralDrawLayer.AfterEverything); Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.2f, 18); - GeneralParticleHandler.SpawnParticle(orb2); - orb2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb2, false, GeneralDrawLayer.AfterEverything); for (int i = 0; i < 2; i++) { int dir = (i == 0 ? 1 : -1); Particle pulse3 = new GlowSparkParticle(Projectile.Center + new Vector2(20 * dir, 0), new Vector2(10 * dir, 0), false, 12, 0.087f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true, true, 0.8f); - GeneralParticleHandler.SpawnParticle(pulse3); - pulse3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(pulse3, false, GeneralDrawLayer.AfterEverything); } for (int i = 0; i < 3; i++) diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 98bd094a7b..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; @@ -269,7 +269,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Vector2 drawPos = Projectile.Center - Main.screenPosition; + Vector2 drawPos = Projectile.Center - Main.screenPosition + (!spinning ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); Asset tex = ModContent.Request(Texture); Main.EntitySpriteDraw(tex.Value, drawPos, null, spinning ? Color.White : Color.Lerp(lightColor, Color.White, Utils.GetLerpValue(0, ChargeupTime, time, true)), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index 94be412dca..b2e33bb877 100644 --- a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 5; Projectile.ArmorPenetration = 20; + Projectile.Calamity().CannotProc = true; } public override void AI() 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/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 336cacc18b..609b6cc694 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -24,20 +24,24 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 45; Projectile.width = 108; Projectile.height = 108; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (Projectile.timeLeft == 300 && Projectile.Calamity().stealthStrike) + Projectile.penetrate = 1; + Lighting.AddLight(Projectile.Center, 0.55f, 0.25f, 0f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -52,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike && Projectile.oldPos.Length != 6) Projectile.oldPos = new Vector2[6]; - if ((ShootTimer %= 5f) == 0f && !Projectile.Calamity().stealthStrike) + if ((ShootTimer %= 4f) == 0f && !Projectile.Calamity().stealthStrike) { if (Projectile.owner == Main.myPlayer) GenerateSideBullets(2, MathHelper.ToRadians(15f)); @@ -66,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 perturbedSpeed = new Vector2(-Projectile.velocity.X / 3, -Projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotationalOffset, rotationalOffset, i / (totalBullets - 1))); for (int j = 0; j < 2; j++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.03), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.035), 0f, Projectile.owner, 0f, 0f); perturbedSpeed *= 1.05f; } } @@ -97,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; Vector2 start = angle.ToRotationVector2(); Vector2 end = nextAngle.ToRotationVector2(); - int pointsOnStarSegment = 18; + int pointsOnStarSegment = 12; for (int j = 0; j < pointsOnStarSegment; j++) { Vector2 shootVelocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * starSpeed; @@ -122,7 +126,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.ExpandHitboxBy(150); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (Projectile.numHits == 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (!Projectile.Calamity().stealthStrike) return; 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/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs deleted file mode 100644 index 2ca31c17bd..0000000000 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ /dev/null @@ -1,100 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.NPCs.NormalNPCs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SealedSingularityBlackhole : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); - return false; - } - - public override void AI() - { - // Update animation - if (Projectile.timeLeft % 5 == 0) - { - Projectile.frame++; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - - //Succcc - float projCenX = Projectile.Center.X; - float projCenY = Projectile.Center.Y; - float maxDistance = Projectile.Calamity().stealthStrike ? 1000f : 500f; - float succPower = Projectile.Calamity().stealthStrike ? 0.25f : 0.1f; - for (int index = 0; index < Main.maxNPCs; index++) - { - NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1)) - { - if (CalamityGlobalNPC.ShouldAffectNPC(npc) || npc.type == ModContent.NPCType()) - { - float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) - { - if (npc.position.X < projCenX) - { - npc.velocity.X += succPower; - } - else - { - npc.velocity.X -= succPower; - } - if (npc.position.Y < projCenY) - { - npc.velocity.Y += succPower; - } - else - { - npc.velocity.Y -= succPower; - } - } - } - } - } - - Projectile.ai[0]++; - if (Projectile.ai[0] > 300f) - { - Projectile.scale *= 0.95f; - Projectile.Opacity *= 0.95f; - Projectile.height = (int)(Projectile.height * Projectile.scale); - Projectile.width = (int)(Projectile.width * Projectile.scale); - } - if (Projectile.scale <= 0.05f) - { - Projectile.Kill(); - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Blackout, 300); - } -} diff --git a/Projectiles/Rogue/SealedSingularityHoldout.cs b/Projectiles/Rogue/SealedSingularityHoldout.cs new file mode 100644 index 0000000000..69a975c80d --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityHoldout.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.2f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, 1).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -15 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer - 30, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs deleted file mode 100644 index 559f9d3a3f..0000000000 --- a/Projectiles/Rogue/SealedSingularityProj.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SealedSingularityProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] >= 70f) - { - Projectile.velocity *= 0.96f; - } - else - { - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - } - - public override void OnKill(int timeLeft) - { - if (Projectile.owner != Main.myPlayer) - return; - - //glass-pot break sound - SoundEngine.PlaySound(SoundID.Shatter, Projectile.position); - - int blackhole = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.Calamity().stealthStrike ? -180f : 0f, 0f); - if (blackhole.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[blackhole].Center = Projectile.Center; - Main.projectile[blackhole].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; - } - - for (int index = 0; index < 3; ++index) - { - float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, index, 0f); - } - } - } -} diff --git a/Projectiles/Rogue/SealedSingularityProjectile.cs b/Projectiles/Rogue/SealedSingularityProjectile.cs new file mode 100644 index 0000000000..5f21fa8eb0 --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityProjectile.cs @@ -0,0 +1,386 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +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; + +namespace CalamityMod.Projectiles.Rogue +{ + [PierceResistException] + public class SealedSingularityProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; + + //Trans flag colors with name containing "girlswag" or having a gender change pot in inventory at donor request + public static bool DonorColor => Main.LocalPlayer.name.Contains("girlswag") || Main.LocalPlayer.HasItemInAnyInventory(ItemID.GenderChangePotion); + public static Color BorderColor => DonorColor ? Color.Lerp(Color.Pink, Color.LightBlue, (MathF.Sin(Main.GlobalTimeWrappedHourly * 3) + 1) * 0.5f) : new Color(59, 2, 120); + + public static Color RandomColor + { + get + { + if (DonorColor) + { + switch (Main.rand.Next(3)) + { + case 0: return Color.Pink; + case 1: return Color.LightBlue; + case 2: return Color.White; + } + } + + switch (Main.rand.Next(4)) + { + case 0: return new Color(91, 47, 113); + case 1: return new Color(119, 74, 165); + case 2: return new Color(58, 58, 58); + case 3: return new Color(123, 115, 142); + } + return Color.White; + } + } + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + OutlineTexVoid = null; //this ensures the outline tex is gotten properly + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + int targetID = -1; + + NPC target => Main.npc[targetID]; + ref float Timer => ref Projectile.ai[0]; + ref float TimerMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + bool Stealth => Projectile.Calamity().stealthStrike; + + int bounceCooldown = 0; + public override void AI() + { + if (AIState == 1) + Lighting.AddLight(Projectile.Center, BorderColor.ToVector3() * (Stealth ? 4 : 2) * Timer / TimerMax); + else if (AIState == 2) + Lighting.AddLight(Projectile.Center, BorderColor.ToVector3() * (Stealth ? 4 : 2)); + Timer++; + bounceCooldown--; + + if (AIState == 0) + { + Projectile.rotation += 0.175f * Projectile.direction; + if (Projectile.timeLeft < 280) + Projectile.velocity.Y += 0.22f; + + if (TimerMax - Timer < 30) + Projectile.velocity *= 0.925f; + } + if (AIState == 1) + { + if (Timer % 30 == 0) //reset hit immunity every 30 frames & reset the pierce falloff too + { + Projectile.ResetLocalNPCHitImmunity(); + Projectile.numHits = 0; + } + Projectile.timeLeft++; + Projectile.rotation += 0.175f * Projectile.direction; + Projectile.velocity = new Vector2( + MathF.Sin(Timer), + MathF.Sin(Timer * 0.7f) + ); + if (Stealth) + { + Projectile.velocity *= 1 + Math.Clamp(Timer / TimerMax, 0f, 1f) * 2f; + } + if (Timer % 10 == 0 && Main.myPlayer == Projectile.owner && Timer < TimerMax - (Stealth ? 120 : 90)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, Projectile.whoAmI); + var v = new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi); + Dust.NewDustPerfect(Projectile.Center + v, DustID.Clentaminator_Purple, -v / 100f); + } + if (TimerMax - Timer == 330) + { + SoundEngine.PlaySound(CeaselessVoid.BuildupSound with { pitch = 0.75f, MaxInstances = 10, Volume = 0.2f }, Projectile.Center); + } + + } + + if (AIState == 2) + { + if (targetID == -1 || !target.active || !target.CanBeChasedBy()) + { + Timer = TimerMax; + } + else + { + Projectile.velocity = Projectile.DirectionTo(target.Center) * MathHelper.Clamp(MathF.Pow((Timer - 30) / 8f, 2), 0f, 32f) * (Timer - 30).DirectionalSign(); + } + } + + if (Timer > TimerMax && AIState == 0) + { + var sizee = Stealth ? 900 : 600; + Projectile.tileCollide = false; + Timer = 0; + TimerMax = Stealth ? 600 : 300; + Projectile.timeLeft += 180; + AIState = 1; + } + if (Timer > TimerMax && AIState == 1) + { + AIState = 2; + Timer = 0; + TimerMax = 300; + Projectile.ResetLocalNPCHitImmunity(); + Projectile.numHits = 0; + if (Main.myPlayer == Projectile.owner) + for (int index = 0; index < 3; ++index) + { + float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), 20, 0f, Projectile.owner, index, 0f); + } + Projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(CeaselessVoid.DeathSound with { pitch = 1f, Volume = Stealth ? 0.5f : 0.2f }, Projectile.Center); + } + + if (Timer >= TimerMax && AIState == 2) + { + Projectile.Resize(300, 300); + Projectile.numHits = 0; + Projectile.ResetLocalNPCHitImmunity(); + Projectile.Damage(); + + for (var i = 0; i < (Stealth ? 80 : 40); i++) + { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, Stealth ? 1.5f : 1f), Scale: Main.rand.NextFloat(0.5f, 1.5f), newColor: RandomColor); + } + var ringTimer = Stealth ? 50 : 35; + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.1f, 0.85f), MathHelper.PiOver2, -4f, 4f, ringTimer)); + if (Stealth) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.2f, 0.7f), MathHelper.PiOver4, -4f, 4f, ringTimer - 15)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.2f, 0.7f), -MathHelper.PiOver4, -4f, 4f, ringTimer - 15)); + } + + SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center); + + Projectile.Kill(); + } + } + + private static Texture2D OutlineTex + { + get + { + if (field == null) + { + var texture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } + + private static Texture2D OutlineTexVoid + { + get + { + if (field == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityBlackhole", AssetRequestMode.ImmediateLoad).Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } + private static Asset VoidTex => field ??= ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityBlackhole"); + public override bool PreDraw(ref Color lightColor) + { + if (AIState == 1) + { + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + var pos = Projectile.Center - Main.screenPosition; + float rot = Projectile.rotation; + var frame = TextureAssets.Projectile[Type].Frame(1, 1, 0, 0); + float scale = 1f; + float borderOp = MathF.Pow(Projectile.Opacity, 2); + Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(6 * Timer / TimerMax, 0).RotatedBy(i), frame, BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + } + PixelationManager.AddPixelatedDrawer((matrix) => DrawAuraOutside(this, matrix), Enums.GeneralDrawLayer.AfterNPCs); + } + if (AIState == 2) + { + var frame = VoidTex.Frame(1, 7, 0, (int)(Timer * 0.2f % 7)); + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + Main.EntitySpriteDraw(OutlineTexVoid, Projectile.Center - Main.screenPosition + new Vector2(2, 0).RotatedBy(i), frame, BorderColor, 0, frame.Size() * 0.5f, Projectile.scale, 0); + } + Main.EntitySpriteDraw(VoidTex.Value, Projectile.Center - Main.screenPosition, frame, Color.White, 0, frame.Size() * 0.5f, Projectile.scale, 0); + return false; + } + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + return false; + } + private static void DrawAuraOutside(SealedSingularityProjectile mproj, Matrix matrix) + { + + Vector2 drawPosition = mproj.Projectile.Center - Main.screenPosition; + + //Draw the outer particles + Main.spriteBatch.EnterShaderRegion(matrix: matrix); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity((mproj.Stealth ? 4 : 2) * (mproj.Timer / mproj.TimerMax)); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.1f); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply(); + Texture2D telegraphBase = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.White * mproj.Projectile.Opacity * 0.25f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, BorderColor * mproj.Projectile.Opacity * 0.5f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0); + Main.spriteBatch.ExitShaderRegion(matrix: matrix); + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.044f; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + switch (AIState) + { + case 0: + { + if (bounceCooldown <= 0) + { + Projectile.velocity *= -1f; + bounceCooldown = 5; + } + if (TimerMax - Timer > 30) + Timer = TimerMax - 30; + goto case 1; + } + case 1: + { + if (target.Calamity().IsArmored()) + return; + if (targetID == -1 || !this.target.active || !this.target.CanBeChasedBy()) + { + targetID = target.whoAmI; + } + else + { + if (this.target.life < target.life) + { + targetID = target.whoAmI; + } + } + if (AIState == 1) + { + target.MoveNPC(target.DirectionTo(Projectile.Center), Stealth ? 18 : 4, true); + } + return; + } + case 2: + { + if (targetID == target.whoAmI) + Timer = TimerMax; + return; + } + } + return; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + switch (AIState) + { + case 1: + modifiers.SourceDamage /= Stealth ? 2 : 16; + modifiers.SourceDamage *= MathF.Pow(1 - SealedSingularity.FalloffPerTargetHitByAura, Projectile.numHits); + return; + case 2: + modifiers.SourceDamage *= Stealth ? 5 : 2; + modifiers.SourceDamage *= MathF.Pow(1 - SealedSingularity.FallofPerTargetHitByBomb, Projectile.numHits); + return; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (AIState == 1) + { + return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), (Stealth ? 900 : 600) * 0.4f, targetHitbox); + } + return base.Colliding(projHitbox, targetHitbox); + } + + // Make it bounce on tiles. + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.width < 100) + { + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + } + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.velocity *= 0.75f; + return false; + } + } + +} diff --git a/Projectiles/Rogue/SealedSingularityRock.cs b/Projectiles/Rogue/SealedSingularityRock.cs new file mode 100644 index 0000000000..5d3acd74db --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityRock.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using CalamityMod.NPCs; +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; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityRock : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.Opacity = 0; + Projectile.hide = true; + Projectile.scale = 0.75f; + } + private static Texture2D OutlineTex + { + get + { + if (field == null) + { + var texture = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile].Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } = null; + + public override bool PreDraw(ref Color lightColor) + { + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + + var tex = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile]; + var pos = Projectile.Center - Main.screenPosition; + float rot = Projectile.rotation; + var frame = tex.Frame(3, 4, 0, 1); + float scale = Projectile.scale; + float borderOp = MathF.Pow(Projectile.Opacity, 2); + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(2, 0).RotatedBy(i), frame, SealedSingularityProjectile.BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + + } + Main.spriteBatch.Draw(tex.Value, pos, frame, Lighting.GetColor(Projectile.Center.ToTileCoordinates()) * Projectile.Opacity, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.spriteBatch.End(); + } + return false; + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + } + + Vector2? goaloffset; + public override void AI() + { + var goal = Main.projectile[(int)Projectile.ai[0]]; + goaloffset ??= Projectile.Center - goal.Center; + + Projectile.Opacity += 0.1f; + if (Projectile.Opacity >= 1f) + { + Projectile.velocity += Projectile.DirectionTo(goal.Center) * 0.4f; + } + Projectile.rotation += 0.1f; + + if (Projectile.Distance(goal.Center) < 16) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/OtherworldlyHit") with { PitchVariance = 0.4f, Volume = 0.2f, MaxInstances = 1 }, Projectile.Center); + Projectile.Kill(); + } + } + } +} 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/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/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 1ddf1453bf..a6f3267548 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -1,6 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,14 +16,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SpearofPaleolith"; - private bool stealthInit = false; + public static int Lifetime => 600; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 24; + ProjectileID.Sets.TrailingMode[Type] = 2; } - public override void SetDefaults() { Projectile.width = 12; @@ -26,50 +30,115 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.StickProjectile; - Projectile.timeLeft = 600; - AIType = ProjectileID.BoneJavelin; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } - + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } + } public override void AI() { - if (Projectile.Calamity().stealthStrike && !stealthInit) + if (StuckEnemyID > 0) { - Projectile.velocity *= 0.5f; - Projectile.timeLeft = 1800; - stealthInit = true; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.velocity = -Vector2.UnitY.RotatedByRandom(0.25f) * Main.rand.NextFloat(0, 1f); + Projectile.tileCollide = true; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - if (Main.rand.NextBool(4)) + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 25) * Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(20)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (Projectile.timeLeft % 3 == 0) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + for (var i = 0; i < ProjectileID.Sets.TrailCacheLength[Type]; i += 3) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition, null, lightColor * Projectile.Opacity * (i>0 ? (1 - i / (float)ProjectileID.Sets.TrailCacheLength[Type]) * 0.25f : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + } return false; } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 10; i++) + for (int i = 0; i <= 5; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X*2.5f, Projectile.oldVelocity.Y*2.5f); } } - 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) + { + if (Projectile.Calamity().stealthStrike) + { + Projectile.stopsDealingDamageAfterPenetrateHits = true; + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + int shardCount = strongSplit ? SpearofPaleolith.ImpaledShardCount : SpearofPaleolith.NormalShardCount; + for (var i = 0; i < shardCount; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0,-1).RotatedByRandom(1) * (strongSplit ? 10 : 7.5f) * Main.rand.NextFloat(0.9f,1.1f), ModContent.ProjectileType(), 0 /*Shard dmg is set in its AI*/, Projectile.knockBack, Projectile.owner, 0f, 0f); + p.localNPCImmunity[target.whoAmI] = 30; + } + if (strongSplit) + { + + SoundEngine.PlaySound(SoundID.DeerclopsRubbleAttack with { PitchVariance = 0.5f}, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + else + { + for (int i = 0; i < shardCount; i++) + { + int sparkLifetime = Main.rand.Next(8, 22); + float sparkScale = Main.rand.NextFloat(0.5f, 1f); + var sparkColor = Main.rand.NextBool() ? Color.DarkGoldenrod : Color.SandyBrown; + + if (Main.rand.NextBool(5)) + sparkScale *= 1.4f; + + Vector2 sparkVelocity = Vector2.UnitY.RotatedByRandom(1) * MathHelper.Lerp(-7.5f, -15, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(target.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + SoundEngine.PlaySound(SoundID.DeerclopsStep with { Pitch = 0.5f, PitchVariance = 0.5f, Volume = 1f, }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact with { Pitch = -0.5f, PitchVariance = 0.5f, Volume = 1f, }, Projectile.Center); + + target.AddBuff(ModContent.BuffType(), 120); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Rogue/SupernovaHoldout.cs b/Projectiles/Rogue/SupernovaHoldout.cs new file mode 100644 index 0000000000..534df7e545 --- /dev/null +++ b/Projectiles/Rogue/SupernovaHoldout.cs @@ -0,0 +1,130 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SupernovaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 106; + Projectile.height = 112; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + + public Color randomColor => Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 50; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 48; + modplayer.swingNum = 0; + RotateInStartup = 1; + Projectile.scale = 0.4f; + } + + public override void AdditionalAI() + { + Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1)); + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.3f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(Supernova.StealthTimeInSeconds) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + + if (timer >= StartupTime - 1) + { + if (Projectile.FinalExtraUpdate() && explodeTimer < explodeTimeGoal) + explodeTimer++; + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -16 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} 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/VegaStar.cs b/Projectiles/Rogue/VegaStar.cs index 4c2240f9f7..0986d31102 100644 --- a/Projectiles/Rogue/VegaStar.cs +++ b/Projectiles/Rogue/VegaStar.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public class VegaStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public static int lifetime = 300; + public static int lifetime => 600; public override void SetStaticDefaults() { @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 5; - lifetime = 600; Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 20f; 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/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index bc9ba0db92..b931e2f6fe 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = 125; Projectile.DamageType = DamageClass.Summon; + Projectile.MaxUpdates = 4; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 3abb483622..5e2d56923e 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -134,9 +134,9 @@ namespace CalamityMod.Projectiles.Summon { if (target != null && Main.myPlayer == Projectile.owner) { - if (TimerForShooting == 80f) + if (TimerForShooting == 60f) { - Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 35f); + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, target, 25f, 4); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } - if (TimerForShooting < 80f) + if (TimerForShooting < 60f) TimerForShooting++; } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 93d42c501c..ccddc0d234 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -258,7 +258,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1]++; } //Set the minion to be ready for attack - if (Projectile.ai[1] > 85f) + if (Projectile.ai[1] > 60f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index 7e7c5355f6..190e23a20c 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Summon public class CausticStaffProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public ref float MinionCount => ref Projectile.ai[0]; public override void SetStaticDefaults() { ProjectileID.Sets.MinionShot[Type] = true; @@ -18,68 +19,55 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 10; Projectile.friendly = true; Projectile.ignoreWater = true; + Projectile.MaxUpdates = 3; Projectile.penetrate = 3; - Projectile.timeLeft = 360; + Projectile.timeLeft = 45 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.extraUpdates = 1; + Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 0.5f); - Dust dust = Main.dust[fire]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, GetDust(MinionCount), 0f, 0f, 0, default, 0.5f); dust.velocity *= 0.1f; dust.scale = 1.3f; dust.noGravity = true; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity.X *= 0.99f; - if (Projectile.velocity.Y < 9f) - Projectile.velocity.Y += 0.085f; } public override void OnKill(int timeLeft) { for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Torch); + Dust dust = Dust.NewDustPerfect(Projectile.Center, GetDust(MinionCount)); dust.noGravity = true; dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f); } } + + public static int GetDust(float type) + { + if (type >= 4f && Main.rand.NextBool(5)) + return DustID.IchorTorch; + if (type >= 3f && Main.rand.NextBool(4)) + return DustID.VenomStaff; + if (type >= 2f && Main.rand.NextBool(3)) + return DustID.CursedTorch; + return DustID.Torch; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Projectile.owner]; - Item heldItem = player.HeldItem; - if (!CalamityUtils.ShouldTriggerSummonPenalty(player, heldItem)) + target.AddBuff(BuffID.OnFire3, 60); + + if (MinionCount >= 2f) + target.AddBuff(BuffID.CursedInferno, 60); + if (MinionCount >= 3f) + target.AddBuff(BuffID.Venom, 60); + if (MinionCount >= 4f) { - int duration = Main.rand.Next(60, 181); // Anywhere between 1 and 3 seconds - switch ((int)Projectile.ai[0]) - { - case 0: - if (target.Calamity().markedForDeath) - target.AddBuff(ModContent.BuffType(), duration); - break; - case 1: - if (!target.ichor) - target.AddBuff(BuffID.Ichor, duration); - break; - case 2: - if (!target.venom) - target.AddBuff(BuffID.Venom, duration); - break; - case 3: - if (!target.onFire2) - target.AddBuff(BuffID.CursedInferno, duration); - break; - case 4: - if (!target.onFire3) - target.AddBuff(BuffID.OnFire3, duration); - break; - default: - break; - } + target.AddBuff(BuffID.Ichor, 60); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 501472f410..300d9a1f3c 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; public bool initialized = false; - private float debuffToInflict = 0f; public override void SetStaticDefaults() { @@ -227,7 +226,8 @@ namespace CalamityMod.Projectiles.Summon } //Occasionally spawn fiery dust - if (Main.rand.NextBool(6)) + int minionCount = player.ownedProjectileCounts[Type]; + if (Main.rand.NextBool(15)) { int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, new Color(), 2f); Main.dust[fire].velocity *= 0.3f; @@ -245,11 +245,23 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] > 0f) { Projectile.ai[1] += Main.rand.Next(1, 4); - if (Main.rand.NextBool(3)) - ++Projectile.ai[1]; + + // Faster depending on minion count + // Calculated average firing rate: + // 1.23 attacks per second at 1 minion + // 1.67 attacks per second at 2 minions + // 1.9 attacks per second at 3 minions + // 2 attacks per second at 4+ minions + if (minionCount - Main.rand.Next(2) > 0) + Projectile.ai[1]++; + if (minionCount - Main.rand.Next(3) > 0) + Projectile.ai[1]++; + if (minionCount - Main.rand.Next(4) > 0) + Projectile.ai[1]++; } + //Determine if it should shoot - if (Projectile.ai[1] > 90f) + if (Projectile.ai[1] > 150f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -277,10 +289,7 @@ namespace CalamityMod.Projectiles.Summon float speedMult = 16f; targetVec.Normalize(); targetVec *= speedMult; - int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, debuffToInflict, 0f); - debuffToInflict++; - if (debuffToInflict >= 5f) - debuffToInflict = 0f; + int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, minionCount); Main.projectile[spike].netUpdate = true; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 336fbb5feb..4346b826ea 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; @@ -142,6 +143,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]; diff --git a/Projectiles/Summon/CosmilampBeam.cs b/Projectiles/Summon/CosmilampBeam.cs index 4c97013286..36b9c5cd24 100644 --- a/Projectiles/Summon/CosmilampBeam.cs +++ b/Projectiles/Summon/CosmilampBeam.cs @@ -105,8 +105,6 @@ namespace CalamityMod.Projectiles.Summon return MathHelper.Lerp(0f, maxWidth, expansionCompletion); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); - public override bool PreDraw(ref Color lightColor) { Projectile.localAI[0] = 0f; 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/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/DoGWeaponTeleportRift.cs b/Projectiles/Summon/DoGWeaponTeleportRift.cs index 2e8bbed414..1ca8c9ccb2 100644 --- a/Projectiles/Summon/DoGWeaponTeleportRift.cs +++ b/Projectiles/Summon/DoGWeaponTeleportRift.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Projectile.scale = Projectile.ai[1]; + if (Projectile.ai[1] != 0) + Projectile.scale = Projectile.ai[1]; if (Projectile.ai[0] == 0f) Projectile.ai[0] = 45f; 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/EndoHydraRay.cs b/Projectiles/Summon/EndoHydraRay.cs index afc80011de..4493110678 100644 --- a/Projectiles/Summon/EndoHydraRay.cs +++ b/Projectiles/Summon/EndoHydraRay.cs @@ -46,9 +46,5 @@ namespace CalamityMod.Projectiles.Summon } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } } } diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 2574c58132..ed411b6930 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -37,7 +37,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 9; - Projectile.minionSlots = 5f; + if (!Main.gameMenu && Main.player[Projectile.owner].Calamity().fadedIdolatry) + Projectile.minionSlots = 4f; + else + Projectile.minionSlots = 5f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -64,6 +67,12 @@ namespace CalamityMod.Projectiles.Summon // Perform minion checks. PerformMinionChecks(); + //Update slots to match Faded Idolatry equip state + if (Main.player[Projectile.owner].Calamity().fadedIdolatry) + Projectile.minionSlots = 4f; + else + Projectile.minionSlots = 5f; + // Handle frame logic. if (Projectile.FinalExtraUpdate()) Projectile.frameCounter++; 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/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/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/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/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 408e4982e2..aa69a548bf 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.rareSandElemental && !modPlayer.allElementals && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.oasisElemental && !modPlayer.allElementals && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.rareSandEleBuff = false; + modPlayer.oasisEleBuff = false; } - if (modPlayer.rareSandEleBuff) + if (modPlayer.oasisEleBuff) { Projectile.timeLeft = 2; } @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = -Projectile.direction; } - if (!modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] += 1f; } - if (Projectile.ai[0] == 0f && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (Projectile.ai[0] == 0f && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { int healProj = ModContent.ProjectileType(); if (Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rareSandElementalVanity || modPlayer.allElementalsVanity) + if (modPlayer.oasisElementalVanity || modPlayer.allElementalsVanity) { return false; } diff --git a/Projectiles/Summon/SarosEclipseBeam.cs b/Projectiles/Summon/SarosEclipseBeam.cs index 430ead2ec3..b9442ce2e6 100644 --- a/Projectiles/Summon/SarosEclipseBeam.cs +++ b/Projectiles/Summon/SarosEclipseBeam.cs @@ -55,6 +55,8 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft == 5 && Owner.channel) Projectile.timeLeft++; Owner.Calamity().sarosEclipseBeamUsage += 2; + if (Owner.itemTime <= 1) + Owner.itemTime++; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) 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/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index be18d29396..3e3ef793e6 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -428,7 +428,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.buffImmune[ModContent.BuffType()] = target.Calamity().DR >= 0.99f; target.AddBuff(ModContent.BuffType(), 600000); } diff --git a/Projectiles/Summon/Shroomling.png b/Projectiles/Summon/Shroomling.png deleted file mode 100644 index d9155ae927..0000000000 Binary files a/Projectiles/Summon/Shroomling.png and /dev/null differ diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs index 1637fc380c..5b90e55e62 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms bool hoveringOverAnySlot = false; bool clickedAnIconOnPanel = false; - bool sufficientSlots = Main.LocalPlayer.maxMinions > AresExoskeleton.MinionSlotsPerCannon; + bool sufficientSlots = Main.LocalPlayer.maxMinions >= AresExoskeleton.MinionSlotsPerCannon; // Draw icon and handle hover behaviors. // If an arm needs to be destroyed or spawned, it will happen on the next frame in the AI update loop. 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/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/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7e07cc5f9a..ec1669addd 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Tools; using CalamityMod.NPCs; 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.Typeless @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float time => ref Projectile.ai[0]; - public bool orbiting => Projectile.ai[1] == 0; + public bool orbiting => (Projectile.ai[1] == 0 || (Projectile.ai[1] == 1 && burstTimer > 0)); public Player Owner => Main.player[Projectile.owner]; public Vector2 goalPosition; @@ -31,53 +33,90 @@ namespace CalamityMod.Projectiles.Typeless public float speedMult = 1; public float placementMult = 1; public float orbitRot = 0; - public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); + public float shardNumMult = 1; + public Vector2 lastPos; + public Color bColor = Color.Sienna; + public ref float debuffMult => ref Projectile.localAI[0]; + public bool isAttacking => (burstTimer <= 0 && !orbiting && Projectile.ai[1] != -1); + public override void SetStaticDefaults() // remove this + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 3; + } public override void SetDefaults() { Projectile.width = 50; Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 3; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { + float orbitMult = Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType()], + 0, 30, 0.8f, 1.35f, false); + float attackMult = MathF.Pow(1 + (Projectile.ai[1] == 1 ? (MathF.Pow(1 - Utils.GetLerpValue(0, 280, burstTimer, true), 4)) : 0) * 5, 2); + float orbit = Projectile.ai[1] == 1 ? (1 - MathF.Pow(Utils.GetLerpValue(280, 0, burstTimer, true), 4)) : 1; + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); - float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + // Sine number three, surely we need a third sine. You will not regret a third sine + float angleDisplacementSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * attackMult + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + + float rate = time * 0.004f; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); - float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); + float goalMult = (Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * orbitMult); + shardNumMult = MathHelper.Lerp(shardNumMult, goalMult, 0.01f); - float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + float displace = new Vector2(25, 0).RotatedBy(angleDisplacementSine * 0.5f).ToRotation(); orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); - goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult * orbit, (125 * orbitSine - 45) * shardNumMult * placementMult * orbit)).RotatedBy(orbitRot); Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - burstTimer = 120; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Projectile.type && projectile.owner == Owner.whoAmI && projectile.localAI[0] == 0) + { + projectile.localAI[0] = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, 1, 8, true); + } + } + Owner.Calamity().rOfResilienceEffect = 0; + burstTimer = 280; Projectile.ai[1] = 1; Projectile.netUpdate = true; } - if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + if ((Owner.Calamity().rOfResilienceEffect == 0 || (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax && Owner.HeldItem.type != ModContent.ItemType())) && Projectile.ai[1] == 0) { Projectile.ai[1] = -1; - Projectile.timeLeft = 95; Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); } if (time == 0) { + lastPos = Projectile.Center; relicType = Main.rand.Next(1, 6 + 1); - speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + speedMult = Main.rand.NextFloat(0.8f, 1.2f); placementMult = Main.rand.NextFloat(0.75f, 1.15f); } @@ -107,63 +146,55 @@ namespace CalamityMod.Projectiles.Typeless Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); if (Projectile.ai[1] == -1) { + if (Projectile.timeLeft > 95) + Projectile.timeLeft = 95; Projectile.velocity *= 0.98f; } else { - if (burstTimer > 0) + if (burstTimer == 0) { - Projectile.extraUpdates = 1; - Projectile.velocity *= 0.9f; - if (Utils.Distance(Projectile.Center, Owner.Center) < 15) + Projectile.Opacity = 1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()]; + + Projectile.velocity = (((MathHelper.TwoPi / projNum) * Projectile.ai[2]).ToRotationVector2()) * 15 * speedMult * Main.rand.NextFloat(0.6f, 1.2f); + Owner.SetScreenshake(5f); + + if (Projectile.ai[2] == 1) { - behind = true; - Projectile.Center = Owner.Center; + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); } - else + for (int i = 0; i < 3; i++) { - Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); - if (time % 8 == 0) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); - GeneralParticleHandler.SpawnParticle(spark); - } + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } burstTimer--; - if (burstTimer == 0) - { - Projectile.Opacity = 1; - - int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; - - Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; - Owner.SetScreenshake(5f); - - if (Projectile.ai[2] == 1) - { - SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); - SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); - SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); - SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); - } - for (int i = 0; i < 3; i++) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); - GeneralParticleHandler.SpawnParticle(spark); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); - dust.noGravity = Main.rand.NextBool(); - dust.scale = Main.rand.NextFloat(1.35f, 2.8f); - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; - } - } - } - else - { - Projectile.velocity *= 0.97f; } + Projectile.velocity *= 0.97f; } } + + Vector2 vel = lastPos.DirectionTo(Projectile.Center); + float trailMult = MathF.Pow(Utils.GetLerpValue(15, 60, Owner.ownedProjectileCounts[ModContent.ProjectileType()], false), 0.5f); + if (trailMult > 0 && Projectile.timeLeft > 130) + { + Particle spark = new CustomSpark(Projectile.Center, vel * 3, "CalamityMod/Particles/BloomCircle", false, 5, 0.365f * Projectile.scale * trailMult, bColor * Projectile.Opacity * MathF.Min(trailMult, 1), new Vector2(1f, 1f), true, true, colorFadeSpeed: 10, glowCenterScale: 0.6f, glowOpacity: 0.8f * Projectile.Opacity * trailMult, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + spark.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; + } + if (isAttacking && Main.rand.NextBool(4)) { Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); @@ -171,8 +202,11 @@ namespace CalamityMod.Projectiles.Typeless dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; } - - time++; + if (Projectile.FinalExtraUpdate()) + lastPos = Projectile.Center; + if (burstTimer > 0) + burstTimer--; + time += 1f * orbitMult * attackMult; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { @@ -180,13 +214,11 @@ namespace CalamityMod.Projectiles.Typeless if (crit) modifiers.SetCrit(); - modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + float damageMultBase = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, RelicOfResilience.orbitDamageMult / 2, RelicOfResilience.orbitDamageMult); + modifiers.SourceDamage *= (isAttacking ? 1 : damageMultBase); + int baseDebuffTime = 150; if (isAttacking) - target.AddBuff(ModContent.BuffType(), 520); - } - public override void OnKill(int timeLeft) - { - + target.AddBuff(ModContent.BuffType(), (int)(baseDebuffTime * debuffMult)); } public override bool PreDraw(ref Color lightColor) { @@ -200,9 +232,9 @@ namespace CalamityMod.Projectiles.Typeless _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value }; if (isAttacking) - Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); else - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -213,7 +245,7 @@ namespace CalamityMod.Projectiles.Typeless else overPlayers.Add(index); } - public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; + public override bool? CanDamage() => (Projectile.ai[1] == -1) ? false : null; public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Typeless/BasicBurst.cs b/Projectiles/Typeless/BasicBurst.cs index 0633d2b71e..10feff399b 100644 --- a/Projectiles/Typeless/BasicBurst.cs +++ b/Projectiles/Typeless/BasicBurst.cs @@ -72,14 +72,6 @@ namespace CalamityMod.Projectiles.Typeless if (customKnockback != 0) target.MoveNPC(pushVelocity, customKnockback, hasStongDisplacement, Main.player[Projectile.owner]); - - if (Projectile.owner != -1) - { - Player Owner = Main.player[Projectile.owner]; - bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); - if (crit) - modifiers.SetCrit(); - } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Typeless/DebuffSpreadEffect.cs b/Projectiles/Typeless/DebuffSpreadEffect.cs index 8ab5c80f30..7412cefad9 100644 --- a/Projectiles/Typeless/DebuffSpreadEffect.cs +++ b/Projectiles/Typeless/DebuffSpreadEffect.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Typeless for (int index = 0; index < npc.buffType.Length; index++) { int type = npc.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; // Calculate the Bane damage to see if the debuffs can be transfered int bDamage = Math.Max((int)(Bane.debuffData.EnemyLostRegen * bestDamage), (int)Bane.debuffData.EnemyLostRegen); diff --git a/Projectiles/Typeless/Elumphant.cs b/Projectiles/Typeless/Elumphant.cs new file mode 100644 index 0000000000..2d8d370cf1 --- /dev/null +++ b/Projectiles/Typeless/Elumphant.cs @@ -0,0 +1,787 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Elumphant : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public static Color color1 = new Color(60, 103, 207); + public static Color color2 = new Color(103, 188, 214); + public Color usedColor = Color.White; + public ref float time => ref Projectile.ai[0]; + public float squashTimerX = 0; public float squashTimerY = 0; // Adjusts the X and Y centric squash effects + public float fallTimer = 0; // How long the Elumphant has been falling + public int maxFallTimer = 120; + public int lastHighestFallTimer = 0; + public ref float attackTimer => ref Projectile.ai[1]; // Timer for cycling between attack and cooldown phases + public ref float mistShootTimer => ref Projectile.ai[2]; // Timer for the frames that it fires mist + + public float fxFade = 0; // The glow visuals multiplier + + public float verticalSquash = 0; public float horizontalSquash = 0; // The Elumphant's current X and Y squash + + public float trunkRotation = 0; // Rotation for the trunk, and also the direction that it's mist will be fired in + public bool dashing = false; // If the Elumphant is performing its jumping bonk attack + public NPC targeted; // The currently targeted NPC for either of it's attacks + public bool hitHead = true; // If the Elumphant has landed on its back when falling back to the player's head + public int blinkTime = 1; public int cryTime = 1; // Timers for doing its idle animations + public bool mammothFlip = false; // If the Elumphant is spinning as it falls back to the player + public bool mammothOops = false; // If the Elumphant is doing its mistake animation after bonking the player's head + public int hopTimer = 0; // Timer for the little hop after bonking its head + public bool attackedThisFrame = false; + public int attackDirection = 1; + public int attacksDone = 0; + public bool recoiling = false; // If the Elumphant has finished bonking enemies and is returning to the player + public float maxTargetingDistance = 0; + public float maxTrunkRot => -MathHelper.PiOver2 * 1.1f; + public int attackTime => (int)(FrozenCube.baseAttackSpeed); + public int attackTimeAdjusted = 0; // Attack speed adjusted for the slam attack + public float damageScaling = 0; // The damage scaling on the mist and slam attacks + public int cooldownTime = 0; // The cooldown between attacks + public List hitNPCs = new List(); + public Vector2 lastHitNPCPos; + public Vector2 lastProjPos; + public bool spawnJumpDusts = true; + public float frozenCubePower = 0; // The base power boost gained from defense before scaling adjustments + public bool vis => Owner.Calamity().frozenCubeVisuals; + + Vector2 goalPosition; + public SlotId soundSlot; + public static Asset TrunkTexture { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + TrunkTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/ElumphantTrunk"); + } + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + Main.projFrames[Type] = 3; + } + public override void SetDefaults() + { + Projectile.width = 46; + Projectile.height = 34; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Generic; + } + public float WidthFunction(float completion, Vector2 _) + { + float width; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6); + float newSine = 0.7f - sine * 0.1f; + float cutPoint = 0.1f; + float baseFade = (MathF.Pow((1 - completion), 2)); + float compFade = completion > cutPoint ? baseFade : baseFade * (1 - MathF.Pow((Utils.GetLerpValue(cutPoint, 0, completion)), 3)); + width = (completion == 0 ? 0 : 45 * newSine * compFade); + + return width; + } + public Color ColorFunction(float completion, Vector2 _) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6); + Color clr = Color.Lerp(usedColor, Color.DodgerBlue, 0.6f + 0.2f * sine); + Color tipColor = Color.Lerp(clr, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(clr, tipColor, completion) * fxFade; + } + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) + { + if (vis) + { + // Render the main trail + string shader = "CalamityMod:TrailStreak"; + Vector2[] length = Projectile.oldPos.Take((int)(Math.Max(10 - Projectile.numHits, 5))).ToArray(); + GameShaders.Misc[shader].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/DoubleTrail")); + PrimitiveRenderer.RenderTrail(length, new(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, true, true, GameShaders.Misc[shader]), length.Length * 6); + } + } + public void SetStats() + { + maxTargetingDistance = (float)(500 * GetPower(0.3f)); + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f))); + damageScaling = (float)GetPower(1.35f, (1 + frozenCubePower * 0.2f)); + cooldownTime = (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f)); + } + 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); + + // Defense investment softcaps at 110 (aka player has 330 defense) + float defenseCap = 110; + if (usedDefense > defenseCap) + { + float ratio = usedDefense / defenseCap; + usedDefense = (int)(defenseCap * MathF.Pow(ratio, 0.15f)); + } + + frozenCubePower = usedDefense * 0.05f; // 1 point of defense = 5% effectiveness + + float power = (float)(GetPower(0.8f, (1 + frozenCubePower * 0.2f)) - 1); + Owner.Calamity().frozenCubeDebuffBoost = power; + Owner.Calamity().frozenCubeElumphantBoost = damageScaling - 1; + Owner.Calamity().ColdDebuffMultiplier += power; // Boost cold debuff damage + } + public double GetPower(float efficiency, float intenseScaling = 1) + { + double defensePower = frozenCubePower; + return Math.Pow(1 + defensePower * efficiency, intenseScaling); + } + + public void GetColor() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + color1, + color2 + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + } + public void ManageSquash() + { + float resolutionSpeed = 0.02f / Projectile.MaxUpdates; + verticalSquash = MathHelper.Lerp(verticalSquash, 0, resolutionSpeed); + horizontalSquash = MathHelper.Lerp(horizontalSquash, 0, resolutionSpeed); + } + public void SetDirection(int newDirection) + { + if (newDirection == 0) + { + Projectile.spriteDirection = Owner.direction; + return; + } + if (Projectile.spriteDirection != newDirection) + { + trunkRotation *= -1; + Projectile.rotation *= -1; + } + Projectile.spriteDirection = newDirection; + } + public void GetTarget(bool excludeHitNPCs, float distanceMult = 1, bool leaveBossesLast = false) // Target closest NPC to mouse, unless they're too far, then do closest to Elumphant + { + if (excludeHitNPCs) + { + NPC chosenTarget = null; + float distance = 0; + if (leaveBossesLast && targeted != null) + targeted = null; + + for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++) + { + bool ignoreBosses = (u == 0) && leaveBossesLast; + + for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit + { + NPC searchedTarget = Main.npc[index]; + bool bossCheck = !(searchedTarget.boss && ignoreBosses); + if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.HasBuff(FrozenCube.debuff) && !hitNPCs.Contains(searchedTarget) && searchedTarget.active && searchedTarget.life > 0 && bossCheck) + { + float targetDistance = Projectile.Center.Distance(new Vector2(searchedTarget.Center.X, Projectile.Center.Y)); + if (targetDistance > distance) + { + distance = targetDistance; + chosenTarget = searchedTarget; + } + } + } + targeted = chosenTarget; + } + } + else + { + bool targetFar = (distanceMult != -1); + + NPC chosenTarget = null; + if (leaveBossesLast && targeted != null) + targeted = null; + float distance = (targetFar ? 0 : maxTargetingDistance); + + for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++) + { + bool ignoreBosses = (u == 0) && leaveBossesLast; + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.active && searchedTarget.life > 0) + { + bool canHit = Collision.CanHit(Owner.Center, 1, 1, searchedTarget.Center, 1, 1); + + float targetDistance = Owner.Center.Distance(new Vector2(searchedTarget.Center.X, Owner.Center.Y)); + // Checks most distant target first, then closest if that fails + bool inRange = (targetFar ? (targetDistance > distance) : (targetDistance < distance)); + bool bossCheck = !(searchedTarget.boss && ignoreBosses); + if (inRange && canHit && targetDistance < maxTargetingDistance && bossCheck) + { + distance = targetDistance; + chosenTarget = searchedTarget; + } + } + } + if (chosenTarget != null) + targeted = chosenTarget; + } + + if (!ValidDistance()) + targeted = null; + } + } + public void ScaleOpacity(float endAt) + { + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, endAt, 0.12f); + } + public bool ValidDistance(float distanceCheckMult = 1) => (targeted != null && targeted.Distance(Owner.Center) < (maxTargetingDistance * distanceCheckMult)); + public void HopAttack(Vector2 originalPosition) + { + if (!vis) + ScaleOpacity(0.4f); + + float attackLerp = Utils.GetLerpValue((int)(Math.Max(attackTimeAdjusted, 2) / 2), Math.Max(attackTimeAdjusted, 2), attackTimer, true); + + if (attackTimer == 0 && Projectile.numHits == 0) + { + GetTarget(true, 10, true); + } + + if (targeted == null || (targeted != null && (targeted.life <= 0 || !targeted.active))) + { + if (attackLerp > 0 && !recoiling) + { + lastHitNPCPos = Projectile.Center; + attackTimer = attackTimeAdjusted; + } + recoiling = true; + targeted = null; + } + + if (attacksDone != 0) + Projectile.frame = 2; + if (recoiling) + { + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / GetPower(0.5f)); + if (Projectile.numHits > 1) + attackTimer = attackTimeAdjusted; + Projectile.numHits = 1; + } + + + int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction); + if (!recoiling) + fxFade = (attackLerp <= 0.2f ? 0 : Math.Max(attackLerp, MathHelper.Lerp(fxFade, 1, 0.15f))); + else + fxFade = MathHelper.Lerp(0f, 1, MathF.Pow(attackLerp, 4)); + + Vector2 basePosition = recoiling ? originalPosition : Projectile.numHits == 0 ? originalPosition : (lastHitNPCPos); + Vector2 targetPos = recoiling ? lastHitNPCPos : targeted.Center - (Vector2.UnitY * targeted.height / 2); + + float jumpHeight = 250;// Math.Max(250 - Projectile.numHits * 10, recoiling ? 250 : 60); + float jumpLerp = attackLerp > 0.5f ? 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 1f, attackLerp), 4)) : 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 0f, attackLerp), 2)); + float jumpOffsetY = MathHelper.Lerp(basePosition.Y, targetPos.Y, attackLerp) - jumpHeight * jumpLerp; + float jumpOffsetX = MathHelper.Lerp(basePosition.X, targetPos.X, attackLerp); + goalPosition = new Vector2(jumpOffsetX, jumpOffsetY); + + Projectile.Center = goalPosition; + + if (attackLerp > 0f && spawnJumpDusts && vis) + { + bool clrChoose = Main.rand.NextBool(); + int halfDusts = 14; + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 1.8f); + Vector2 dustPos = Owner.Center + Vector2.UnitY * -(Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel.RotatedByRandom(0.55f) * (Math.Abs(i) * 0.2f) * (Main.rand.NextBool(5) ? 3 : 1), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 2.5f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.7f; + + if (i == -1) + i = 1; + } + spawnJumpDusts = false; + } + + float goalAngle = (attackLerp > 0.5f ? basePosition.DirectionTo(Projectile.Center) : Projectile.Center.DirectionTo(targetPos)).ToRotation() + (attackLerp > 0.5f ? MathHelper.PiOver2 : -MathHelper.PiOver2); + if (!recoiling) + Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, -MathHelper.PiOver2 * Projectile.spriteDirection, MathHelper.PiOver2 * Projectile.spriteDirection)) * (1 - MathF.Pow(1 - attackLerp, 3)); + else + Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, MathHelper.TwoPi * 2 * Projectile.spriteDirection, 0)); + trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f); + + 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; + hitNPCs.Clear(); + Projectile.velocity = Vector2.Zero; + recoiling = false; + dashing = false; + Projectile.numHits = 0; + attackTimer = (int)(cooldownTime / 2); + attacksDone = 0; + spawnJumpDusts = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + GetTarget(true); + } + } + public void MistAttack(float fallLerp) + { + Projectile.frame = 1; + float angleSweep = MathF.Sin(attackTimer * 0.085f) * attackDirection; + float goalAngle = Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2; + if (attackTimer == cooldownTime + 1) // Make start attack sound + { + if (vis) + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center); + + Projectile.soundDelay = 0; + Projectile.frameCounter = 1; + } + SetDirection(Math.Sign(Projectile.Center.DirectionTo(targeted.Center).X)); + horizontalSquash = 0.5f; + Projectile.rotation = Projectile.rotation.AngleLerp((goalAngle + MathHelper.PiOver2 * Projectile.spriteDirection), 0.07f) * MathF.Pow(fallLerp, 0.2f); + float angleMax = MathHelper.PiOver4 * 0.75f * Utils.GetLerpValue(maxTargetingDistance, 30, Projectile.Center.Distance(targeted.Center), true); + if (hopTimer <= 0) + trunkRotation = trunkRotation.AngleLerp(goalAngle - Projectile.rotation - angleMax * angleSweep, 0.23f); + + if (attackTimer > (cooldownTime * 1.1f)) + { + if (!vis) + ScaleOpacity(0.4f); + if (mistShootTimer == 0 && Main.myPlayer == Projectile.owner) + { + Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); + int damage = (int)Owner.GetTotalDamage().ApplyTo((float)(FrozenCube.mistBaseDamage * damageScaling)); + int projectile = ModContent.ProjectileType(); + 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)); + if (mistShootTimer >= 2f) + mistShootTimer = 0; + } + mammothFlip = false; + + attackedThisFrame = true; + if (!ValidDistance()) + { + GetTarget(false, -1); + if (!ValidDistance()) + { + attackTimer = cooldownTime + attackTime; + targeted = null; + } + } + if (attackTimer == cooldownTime + attackTime) + { + attackDirection *= -1; + Projectile.frame = 0; + attacksDone++; + if (attacksDone >= 2) // Every 2 attacks, do a dash slam + { + dashing = true; + attackTimer = -1; + } + } + } + public void Idle() + { + if (!vis) + ScaleOpacity(0); + targeted = null; + if (Owner.StandingStill()) // If standing still, let the player mess with the mammoth squash for fun + { + if (Owner.controlDown) + horizontalSquash = 0.5f; + if (Owner.controlUp) + verticalSquash = 0.5f; + } + if (Math.Abs(Owner.velocity.X) > 4 && fallTimer == 0) + verticalSquash = 0.25f * Utils.GetLerpValue(4, 10, Math.Abs(Owner.velocity.X)); + if (targeted == null && attackTimer > cooldownTime) // If can attack but there is no target, wait to decrease the timer until a target is found + attackTimer--; + int cryStart = (int)(cryTime - 65); + if (Projectile.soundDelay >= cryStart) + { + if (Projectile.soundDelay == cryStart) // Sound + { + verticalSquash = 0.3f; + if (vis) + 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); + } + else if (hopTimer <= 0) + trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f); + if (Projectile.soundDelay >= cryTime) + { + SetRandCry(); + } + + if (Projectile.frameCounter >= blinkTime) + { + Projectile.frame = 1; + Projectile.frameCounter = -6; + } + if (Projectile.frameCounter == 0) + { + Projectile.frame = 0; + SetRandBlink(); + } + if (vis) + { + Projectile.frameCounter++; + Projectile.soundDelay += 2; // Naturally decreases by 1, so to make it count up, increases it by 2 + } + } + public override void AI() + { + if (time == 0) + { + lastHitNPCPos = lastProjPos = Owner.Center; + Projectile.Opacity = 0; + } + if (vis && Projectile.Opacity < 1) + ScaleOpacity(1); + Projectile.timeLeft++; + GetColor(); + 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; + + float sine = MathF.Sin(time * 0.04f); + float sine2 = MathF.Sin(time * 0.08f); + float sine3 = MathF.Sin(time * 0.1f); + float fallLerp = Utils.GetLerpValue(0, maxFallTimer, fallTimer, true); + + int hopTimerMax = 16; + float hop = 1 + (mammothOops ? 1 - MathF.Pow(Utils.GetLerpValue(hopTimerMax, 0, hopTimer, true), 2.5f) : MathF.Pow(Utils.GetLerpValue(0, hopTimerMax, hopTimer, true), 1.0f)) * 1.55f; + if (hopTimer >= hopTimerMax) + mammothOops = false; + else if (mammothOops) + Projectile.rotation = Projectile.rotation.AngleLerp(0, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true)); + else if (hopTimer > 0) + trunkRotation = MathHelper.WrapAngle(MathHelper.Lerp(0, maxTrunkRot * Projectile.spriteDirection - Projectile.rotation, MathF.Pow(Utils.GetLerpValue(0, hopTimerMax / 2, hopTimer, true), mammothOops ? 1f : 1f))); + + Vector2 offsetY = -Vector2.UnitY * (Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) * (1 + 0.4f * sine2 * fallLerp + 5 * CalamityUtils.EaseInOutExp(fallLerp, 2f, 2f)) * hop; + Vector2 offsetX = Vector2.UnitX * ((3 * Projectile.spriteDirection) + 17 * sine3 * fallLerp) * Projectile.scale; + goalPosition = Owner.Center + offsetX + offsetY; + + if (dashing) // Hop Attack + { + HopAttack(goalPosition); + } + else + { + Projectile.Center = goalPosition; + if (Owner.Calamity().frozenCubeVanity) + { + targeted = null; + attackTimer = 0; + } + else if (targeted == null) + GetTarget(false); + + if (attackTimer > cooldownTime && targeted != null) // Mist Attack + { + MistAttack(fallLerp); + } + else // Idle + { + int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : Owner.direction; + if (fallTimer == 0) + SetDirection(direction); + Idle(); + } + + if (hopTimer <= 0 && !attackedThisFrame) + { + if (mammothFlip) + { + Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation - 0.11f * Projectile.spriteDirection * fallLerp); + } + else + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2 * 0.7f * sine * fallLerp, 0.015f); + } + } + + if (Owner.velocity.Y > 8 && !dashing && vis) // If the player is falling at close to max normal downward velocity + { + if (fallTimer == 0) + mammothFlip = Main.rand.NextBool(3); + hitHead = false; + SetRandCry(); + SetRandBlink(); + if (fallTimer < maxFallTimer) + fallTimer++; + } + else if (fallTimer > 0) + fallTimer -= 7 - Math.Min(Owner.velocity.Y, 0); if (fallTimer < 0) fallTimer = 0; + if (fallTimer <= 0 && !hitHead) + { + float landPower = (Utils.GetLerpValue(0, maxFallTimer, lastHighestFallTimer, true)); + verticalSquash = 1f * landPower; + lastHighestFallTimer = 0; + hitHead = true; + float rotation = MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi); + if (mammothFlip && rotation < MathHelper.PiOver2 && rotation > -MathHelper.PiOver2 && landPower > 0.2f) + { + int halfDusts = 7; + Projectile.frame = 1; + SetRandBlink(); + if (vis) + { + Owner.SetScreenshake(2); + SoundEngine.PlaySound(FrozenCube.jokeBonk with { Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = Vector2.UnitX.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.6f, 1.8f); + Vector2 dustPos = Owner.Center - (Vector2.UnitY * Owner.height / 2) + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 3); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.4f; + if (i == -1) + i = 1; + } + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(0.4f, 0.6f), volume = 0.6f }, Projectile.Center); + CombatText.NewText(Projectile.Hitbox, usedColor, "!"); + } + + trunkRotation = maxTrunkRot * Projectile.spriteDirection; + verticalSquash = 1.5f * landPower; + mammothOops = true; + } + else + { + Projectile.rotation = 0; + } + mammothFlip = false; + } + + if (fxFade > 0 && vis) + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.6f * fxFade); + + if (fallTimer > lastHighestFallTimer) + lastHighestFallTimer = (int)fallTimer; + + if (attackTimer >= attackTime + cooldownTime) + attackTimer = 0; + + attackTimer += recoiling ? -0.75f : 1 + 0.4f * Projectile.numHits; + time++; + if (mammothOops) + hopTimer++; + else if (hopTimer > 0) + hopTimer--; + + squashTimerX += 0.1f + horizontalSquash; + squashTimerY += 0.1f + verticalSquash; + + attackedThisFrame = false; + + lastProjPos = Projectile.Center; + + if (!Owner.Calamity().frozenCube && !Owner.Calamity().frozenCubeVanity) + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound2) && sound2.IsPlaying) + sound2?.Stop(); + Projectile.Kill(); + return; + } + } + public void SetRandBlink() + { + Projectile.frameCounter = Projectile.frameCounter > 0 ? 1 : 0; + blinkTime = Main.rand.Next(55, 90 + 1); + } + public void SetRandCry() + { + Projectile.soundDelay = 0; + cryTime = Main.rand.Next(800, 1200 + 1); + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Asset tex = ModContent.Request(Texture); + Texture2D trunk = TrunkTexture.Value; + + Color bodyColor = lightColor * Projectile.Opacity; + Rectangle frame = tex.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + + float squashSineV = MathF.Sin(squashTimerY * 0.55f) * verticalSquash; + float squashSineH = -MathF.Sin(squashTimerX * 0.55f) * horizontalSquash; + float power = 0.35f; + float squashX = 1 - power * squashSineV + power * 1.25f * squashSineH; + float squashY = 1 + power * 1.25f * squashSineV - power * squashSineH; + Vector2 elumphantSquash = new Vector2(squashX, squashY); + Vector2 elumphantLocation = new Vector2(Projectile.Center.X, Projectile.Center.Y + ((tex.Height() / 5) * (1 - squashY))) + new Vector2(0f, Owner.gfxOffY); + + float trunkDistX = 10; + float trunkPosX = (trunkDistX - trunkDistX * (1 - squashX)) * Projectile.spriteDirection; + Vector2 trunkPos = new Vector2(trunkPosX * Projectile.scale, 0); + + if (vis) + { + for (int i = 0; i < 18; i++) // Backglow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 4 * fxFade; + Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition + drawOffset, frame, usedColor with { A = 0 } * 0.2f * fxFade, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, usedColor with { A = 0 } * 0.2f * fxFade * Projectile.Opacity, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + } + + // Main body + Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition, frame, bodyColor, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, bodyColor, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (dashing) + { + float attackMult = (float)(0.7f * GetPower(0.5f)); + target.MoveNPC(Vector2.UnitY, 8, false, Owner); + + Projectile.numHits--; + AfterLanding(target); + + bool lastHit = false; + if (targeted == null) + { + attackMult *= 1.25f; + if (vis) + Owner.SetScreenshake(3 * attackMult); + lastHit = true; + modifiers.SourceDamage *= (float)(1.5f * damageScaling); + } + else + { + float minMult = 0.25f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (float)(damageMult * damageScaling); + } + + if (lastHit && vis) + { + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = -0.5f, volume = 0.8f }, Projectile.Center); + } + verticalSquash = lastHit ? 0.85f : 0.5f; + + if (vis) + { + SoundEngine.PlaySound(FrozenCube.hit with { Pitch = -0.2f + 0.05f * Projectile.numHits, volume = 1f, MaxInstances = -1 }, Projectile.Center); + int halfDusts = (int)((lastHit ? 12 : 8) * attackMult); + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = Vector2.UnitX * Main.rand.NextFloat(0.6f, 1.8f) * attackMult; + Vector2 dustPos = Projectile.Center + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel.RotatedByRandom(0.35f) * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * (lastHit ? 5 : 3.5f) * attackMult); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.4f / attackMult; + + float opacity = 0.7f; + if (i % 2 == 0) + { + bool clrChoose = Main.rand.NextBool(); + Particle smoke = new CustomColorChangeSpark(dustPos, dustVel.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 0.45f) * i * (lastHit ? 2 : 1), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(22, 27), Main.rand.NextFloat(0.45f, 0.65f) * Projectile.scale * (lastHit ? 2 : 1) * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity, new Vector2(0.25f, 1.2f)); + GeneralParticleHandler.SpawnParticle(smoke, true); + } + + if (lastHit) + { + bool clrChoose = Main.rand.NextBool(); + float velMult = Main.rand.NextFloat(1.2f, 1.35f) * i; + Vector2 velocity = dustVel.RotatedByRandom(0.3f) * velMult; + Particle mist = new CustomPulsingSpark(dustPos, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 55, Main.rand.NextFloat(1.05f, 1.45f) * Projectile.scale * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: 0, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.0028f, 0.0035f) * velMult, + sineRate: Main.rand.NextFloat(0.09f, 0.12f), sineIntensity: (int)(4 + Main.rand.Next(15, 20 + 1)) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation()); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + + if (i == -1) + i = 1; + } + } + } + } + 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 * 20, targetHitbox); + } + public override bool? CanHitNPC(NPC target) + { + if (targeted == null) + return false; + // 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; + } + } +} diff --git a/Projectiles/Typeless/Elumphant.png b/Projectiles/Typeless/Elumphant.png new file mode 100644 index 0000000000..b6c7ca8cd2 Binary files /dev/null and b/Projectiles/Typeless/Elumphant.png differ diff --git a/Projectiles/Typeless/ElumphantMist.cs b/Projectiles/Typeless/ElumphantMist.cs new file mode 100644 index 0000000000..9cf18c4ac7 --- /dev/null +++ b/Projectiles/Typeless/ElumphantMist.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Renderers; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ElumphantMist : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float time => ref Projectile.ai[0]; + public int textureChoice = 0; + public float fade = 1; + public int lifetime = 90; + public float originalScale = 0; + public Color mistColor = Color.White; + public bool vis => Owner.Calamity().frozenCubeVisuals; + public static Asset SmokeTexture1 { get; private set; } + public static Asset SmokeTexture2 { get; private set; } + public static Asset SmokeTexture3 { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + SmokeTexture1 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff1"); + SmokeTexture2 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff2"); + SmokeTexture3 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff3"); + } + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 38; + Projectile.ignoreWater = true; + Projectile.timeLeft = lifetime; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Generic; + } + public override void AI() + { + if (time == 0) + { + textureChoice = (int)Projectile.ai[1]; + originalScale = Main.rand.NextFloat(0.7f, 1.1f); + mistColor = Main.rand.NextBool() ? Elumphant.color1 : Elumphant.color2; + } + Projectile.velocity *= 0.96f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + fade = 1 - MathF.Pow(Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true), 3 / Projectile.ai[2]); + Projectile.scale = (1 + (1 - fade) * Projectile.ai[2]) * originalScale; + + float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true); + float opacity = 0.4f * fade * (1.2f - inverseFade); + if (Main.rand.NextBool(3) && vis) // Effects + { + Particle trail = new CustomColorChangeSpark(Projectile.Center + Main.rand.NextVector2Circular(40, 40) * Projectile.scale * (1 - fade) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * (-35 + 65 * inverseFade) * Projectile.scale, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(3, 4), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.75f, 1f) * Projectile.scale, (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity, new Vector2(0.15f + 0.85f * inverseFade, 1.4f - 0.4f * inverseFade)); + GeneralParticleHandler.SpawnParticle(trail, true); + } + if (Main.rand.NextBool(12) && vis) + { + float rotation = 0; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(7f, 14f); + Particle mist = new CustomPulsingSpark(Projectile.Center, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 35, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(Projectile.scale, 0.3f), (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: rotation, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.06f, 0.085f), + sineRate: Main.rand.NextFloat(0.15f, 0.35f), sineIntensity: (int)(8 + Main.rand.Next(35, 55 + 1) * inverseFade) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation()); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + + Lighting.AddLight(Projectile.Center, mistColor.ToVector3() * 0.3f * Projectile.scale); + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(FrozenCube.debuff, (int)(300 * Projectile.ai[2])); + float minMult = 0.25f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15 * Projectile.scale, 50 * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Texture2D bTexture = (textureChoice == 0 ? SmokeTexture1.Value : textureChoice == 1 ? SmokeTexture2.Value : SmokeTexture3.Value); + float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true); + + PixelationManager.AddPixelatedDrawer((_) => + { + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, mistColor with { A = 0 } * fade * (vis ? 1 : 0.5f), Projectile.rotation, new Vector2(bTexture.Width / 2, bTexture.Height * (MathHelper.Lerp(0.7f, 0.4f, inverseFade))), new Vector2(0.3f + 0.7f * inverseFade, 1.4f - 0.4f * inverseFade) * Projectile.scale, SpriteEffects.None); + }, Enums.GeneralDrawLayer.AfterProjectiles, default); + return false; + } + public override bool? CanDamage() => null; + } +} diff --git a/Projectiles/Typeless/ElumphantTrunk.png b/Projectiles/Typeless/ElumphantTrunk.png new file mode 100644 index 0000000000..b62b97c0b3 Binary files /dev/null and b/Projectiles/Typeless/ElumphantTrunk.png differ diff --git a/Projectiles/Typeless/EmpyreanGlob.cs b/Projectiles/Typeless/EmpyreanGlob.cs deleted file mode 100644 index 56e03ac2c9..0000000000 --- a/Projectiles/Typeless/EmpyreanGlob.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class EmpyreanGlob : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 200; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 1f); - Main.dust[ourpleDust].noGravity = true; - Main.dust[ourpleDust].velocity *= 0f; - } - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 8f, 20f); - } - } -} diff --git a/Projectiles/Typeless/EmpyreanGlob.png b/Projectiles/Typeless/EmpyreanGlob.png deleted file mode 100644 index 1c0aafc145..0000000000 Binary files a/Projectiles/Typeless/EmpyreanGlob.png and /dev/null differ diff --git a/Projectiles/Typeless/Gunshot.cs b/Projectiles/Typeless/Gunshot.cs new file mode 100644 index 0000000000..d285b5d0c3 --- /dev/null +++ b/Projectiles/Typeless/Gunshot.cs @@ -0,0 +1,17 @@ +using CalamityMod.Utilities; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Gunshot : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.ApplyScalingForcedCrit(Projectile); + } + + } +} diff --git a/Projectiles/Typeless/JewelSpike.cs b/Projectiles/Typeless/JewelSpike.cs index aec3719911..5fcbe77d02 100644 --- a/Projectiles/Typeless/JewelSpike.cs +++ b/Projectiles/Typeless/JewelSpike.cs @@ -6,9 +6,6 @@ namespace CalamityMod.Projectiles.Typeless public class JewelSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public ref float RealPenetrate => ref Projectile.ai[0]; - public const int MaxPenetrate = 2; - public override void SetStaticDefaults() { Main.projFrames[Type] = 5; @@ -19,12 +16,14 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = 36; Projectile.height = 44; Projectile.friendly = true; - Projectile.penetrate = -1; // For the animation, only hits up to 3 times though + Projectile.penetrate = 3; Projectile.tileCollide = false; Projectile.timeLeft = 80; Projectile.DamageType = DamageClass.Generic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.appliesImmunityTimeOnSingleHits = true; } public override void AI() @@ -47,10 +46,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame = 0; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => RealPenetrate++; - - public override bool? CanHitNPC(NPC target) => RealPenetrate > MaxPenetrate - 1f ? false : (bool?)null; - public override void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index 8df2d4245f..11971b2105 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -114,9 +114,13 @@ namespace CalamityMod.Projectiles.Typeless target.AddBuff(ModContent.BuffType(), 480); Player player = Main.player[Projectile.owner]; - player.statMana += 25; - player.ManaEffect(25); Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), (int)Math.Round(hit.Damage * 0.1), 0.75f); + int manaHeal = Math.Clamp(player.statManaMax2 - player.statMana, 0, 20); + if (manaHeal > 0) + { + player.statMana += manaHeal; + player.ManaEffect(manaHeal); + } } public override void OnKill(int timeLeft) diff --git a/Projectiles/Typeless/Pigion.cs b/Projectiles/Typeless/Pigion.cs new file mode 100644 index 0000000000..f2863be666 --- /dev/null +++ b/Projectiles/Typeless/Pigion.cs @@ -0,0 +1,352 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +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.Typeless +{ + public class Pigion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color cl1 = Color.Gold; + public Color cl2 = Color.Goldenrod; + public int hopTimer = 0; + public static int hopMax = 100; + public bool hitGround = false; + public bool hitWall = false; + public Vector2 lastUnmodVel; + public Vector2 mousePos; + public int thrownTimer = 0; // Timer set when grabbed, fades out faster at low velocity, allowing gravity to take effect sooner + public static int thrownTimerMax = 300; + public static int lowestSpeed = 4; + public static int highestSpeed = 20; + public bool deadPig = false; // if Pigion hit a wall at high enough speed to explode + public ref float time => ref Projectile.ai[0]; + public ref float minionNumber => ref Projectile.ai[1]; + public bool pigGrabbed => Projectile.ai[2] == 5; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 28; + Projectile.friendly = true; + 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() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 6 * Projectile.MaxUpdates) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= 2) + Projectile.frame = 0; + } + public override void AI() + { + mousePos = Owner.ClampedMouseWorld(); + if (time == 0) + { + time = Main.rand.Next(1, 800 + 1); + Projectile.spriteDirection = Main.rand.NextBool() ? -1 : 1; + lastUnmodVel = Projectile.velocity; + } + + Frames(); + + // Make an idle sound + if (Main.rand.NextBool(280) && Projectile.soundDelay == 0) + { + SoundStyle oink = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(oink with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.3f, 0.5f), MaxInstances = 5 }, Projectile.Center); + Projectile.soundDelay = 180; + } + + // Teleport back to player if too far away + if (Projectile.Center.Distance(Owner.Center) > 1500) + { + Projectile.velocity = new Vector2(0, -16).RotatedByRandom(MathHelper.Pi / 2); + Projectile.Center = Owner.Center; + } + + // Check if being clicked and no other Pigions are being clicked + if (Owner.controlUseItem && Projectile.Center.Distance(mousePos) <= 60 && !pigGrabbed && Projectile.ai[2] == 0) + SetGrab(true); + + // Push away enemies it touches based on the Pigions velocity + Vector2 toNPC = Vector2.Zero; + NPC npc = Projectile.Center.ClosestNPCAt(300, false); + if (npc != null && !pigGrabbed && Projectile.Hitbox.Intersects(npc.Hitbox)) + { + toNPC = Projectile.Center.DirectionTo(npc.Center); + npc.MoveNPC(Utils.DirectionTo(Projectile.Center, npc.Center), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed * 1.5f, 4, 30), true); + } + + float hitboxSizeMult = 0.45f; + bool touchingWall = Collision.SolidCollision(Vector2.Lerp(Projectile.TopLeft, Projectile.Left, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Projectile.TopRight, Projectile.Right, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult)); + if (touchingWall) + { + FlipDirection(-Projectile.spriteDirection); + Projectile.velocity.X += Projectile.spriteDirection; + } + if (!pigGrabbed) // Check if hitting tiles or enemies, and if so rebound the Pigion or kill them + Slam(touchingWall, hitboxSizeMult, toNPC); + else + thrownTimer = thrownTimerMax; + lastUnmodVel = Projectile.velocity; + + Movement(); + + thrownTimer -= 1 + (int)(20 * (Utils.GetLerpValue(highestSpeed, lowestSpeed * 2, Projectile.velocity.Length(), true))); + if (thrownTimer < 0) + thrownTimer = 0; + hopTimer--; + time++; + Projectile.timeLeft++; + if (moddedOwner.friendlyMinions < minionNumber || Owner.dead || deadPig) + { + Projectile.Kill(); + return; + } + } + public void Slam(bool touchingWall, float hitboxSizeMult, Vector2 touchNPCVel) + { + bool onPlatform = false; + float thrownMult = Utils.Remap(thrownTimer, 0, thrownTimerMax, 0.6f, 1f); + if (Projectile.velocity.Y > 0) // If moving down, check for platforms + { + for (int i = 4; i < 8; i++) + { + Point bottom = (Projectile.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType]) + { + onPlatform = true; + } + } + } + float velX = MathF.Abs(lastUnmodVel.X); + float velY = MathF.Abs(lastUnmodVel.Y); + bool hitNPC = touchNPCVel != Vector2.Zero; + bool hitDownWall = (Collision.SolidCollision(Projectile.Bottom + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1) || onPlatform); + bool hitUpWall = Collision.SolidCollision(Projectile.Top + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1); + bool hitDown = velY > lowestSpeed && hitDownWall; + bool hitUp = velY > lowestSpeed && hitUpWall; + bool hitSide = velX > lowestSpeed && touchingWall; + bool hardHit = Projectile.velocity.Length() >= highestSpeed * 1.5f; // The velocity a Pigion must be going to explode on impact + float volumeMult = Utils.GetLerpValue(lowestSpeed - 2, highestSpeed, Projectile.velocity.Length(), true); // Sounds are quieter at low velocity + + bool hitAnything = false; + if (hitDown || hitUp) + { + if (!hitGround) + { + hitAnything = true; + if (hardHit) + { + deadPig = true; + return; + } + Projectile.velocity.Y = -lastUnmodVel.Y * thrownMult; + MakeDustAndSound(volumeMult); + hitGround = true; + } + } + else + hitGround = false; + + if (hitSide) + { + hitAnything = true; + if (!hitWall) + { + if (hardHit) + { + deadPig = true; + return; + } + Projectile.velocity.X = -lastUnmodVel.X * thrownMult; + MakeDustAndSound(volumeMult); + hitWall = true; + } + } + else + hitWall = false; + + if (hitNPC && Projectile.velocity.Length() >= lowestSpeed) + { + hitAnything = true; + if (hardHit) + { + deadPig = true; + return; + } + Vector2 npcBounceVel = -lastUnmodVel * thrownMult; + Projectile.Center += npcBounceVel; + Projectile.velocity = npcBounceVel; + MakeDustAndSound(volumeMult); + } + + if (hitAnything) + { + FlipDirection(MathF.Sign(Projectile.velocity.X)); + } + } + public void MakeDustAndSound(float volumeMult) + { + SoundStyle splat = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + SoundEngine.PlaySound(splat with { Volume = 0.8f * volumeMult, Pitch = Main.rand.NextFloat(0.3f, 0.4f) - volumeMult * 0.3f }, Projectile.Center); + + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float power = 0.2f + Utils.GetLerpValue(0, 40, Projectile.velocity.Length()); + for (int i = 0; i < (int)(12 * power); i++) + { + float variance = Main.rand.NextFloat(-0.8f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), + vel.RotatedBy(variance).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(15.0f, 18.0f) * MathF.Pow((1 - MathF.Abs(variance)), 2), 0, default, power * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance)); + dust.noGravity = Main.rand.NextBool(2, 3); + dust.color = Main.rand.NextBool() ? cl1 : cl2; + dust.customData = new Vector2(0.8f, 1.1f); + dust.fadeIn = 3.5f * power; + } + } + public void FlipDirection(int newDirection) + { + Projectile.spriteDirection = newDirection; + time = 1; + } + public void SetGrab(bool isGrabbed) => Projectile.ai[2] = (isGrabbed ? 5 : 0); + public void Movement() + { + // Flip movement direction every once in a while + if (time % 900 == 0) + FlipDirection(-Projectile.spriteDirection); + + // Slowing down over time + if (thrownTimer <= thrownTimerMax / 2) + Projectile.velocity.X *= 0.97f; + + // Move Pigion to mouse if grabbed, otherwise ungrab them if player isn't holding M1 anymore + if (pigGrabbed) + { + FlipDirection(MathF.Sign(Projectile.Center.DirectionTo(mousePos).X)); + Vector2 goalVel = (mousePos - Projectile.Center) / (18); + Projectile.velocity = goalVel; + } + if (!Owner.controlUseItem) + SetGrab(false); + + // Falling + if (Projectile.velocity.Y < 14 && thrownTimer <= thrownTimerMax / 2) + Projectile.velocity.Y += 0.3f * Utils.GetLerpValue(100, 0, hopTimer, true); + + int walkRate = 90; // Walk along slowly + if (!pigGrabbed && time % walkRate == 0) + { + Projectile.velocity.X += 1 * Projectile.spriteDirection; + } + + // lil hops when near other Pigions + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + bool validPig = projectile.active && projectile.type == Projectile.type && projectile != Projectile; + float distance = Vector2.Distance(Projectile.Center, projectile.Center); + if (validPig) + { + if (pigGrabbed) + projectile.ai[2] = 1; // set all other Pigions to be counted as not grabable + if (distance <= 80 && distance != 0 && hopTimer <= 0 && thrownTimer == 0) + { + int directionOfJump = -MathF.Sign(Projectile.Center.DirectionTo(projectile.Center).X); + Projectile.velocity += new Vector2(Main.rand.NextFloat(-2.5f, -4) * directionOfJump, -2); + FlipDirection(-directionOfJump); + hopTimer = 100; + } + } + } + + // Rotate based on velocity and direction + float goalRot = Utils.AngleLerp(0, Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0), Utils.GetLerpValue(lowestSpeed, highestSpeed, Projectile.velocity.Length(), true)); + Projectile.rotation = goalRot; + } + public override void OnKill(int timeLeft) + { + if (deadPig) // Only spawn explosion if death is from collision + { + int pigNum = Owner.ownedProjectileCounts[Projectile.type]; + float blastSize = 100; + float minMultiplier = 0.1f; + int hitsToMinMult = 4; + 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 = 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); + SoundStyle die = new("CalamityMod/Sounds/Item/PigionSqueal"); + SoundEngine.PlaySound(die with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.2f, 0.4f), MaxInstances = 7 }, Projectile.Center); + SoundStyle die2 = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + SoundEngine.PlaySound(die2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + for (int i = 0; i < 24; i++) + { + Vector2 dustVel = (Vector2.One * 6).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = Main.rand.NextBool(2, 3); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.color = Color.Red; + dust.noLightEmittence = true; + dust.fadeIn = -0.4f; + + if (i % 2 == 0) + { + Particle pulse1 = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1, 6), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(20, 35 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.Red * 0.55f, new Vector2(1f, 1f), noShrink: true); + GeneralParticleHandler.SpawnParticle(pulse1); + pulse1.Pixelate = true; + } + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + return false; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = pigGrabbed; + return true; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, 2, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 2), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 0.5f)); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, squash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + return false; + } + public override bool? CanDamage() => false; + public override bool? CanCutTiles() => false; + } +} diff --git a/NPCs/SunkenSea/StormlionSentryBody.png b/Projectiles/Typeless/Pigion.png similarity index 76% rename from NPCs/SunkenSea/StormlionSentryBody.png rename to Projectiles/Typeless/Pigion.png index 0e8b945f4d..36858f908c 100644 Binary files a/NPCs/SunkenSea/StormlionSentryBody.png and b/Projectiles/Typeless/Pigion.png differ diff --git a/Projectiles/Typeless/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs index f12b5ee889..a80392ccd3 100644 --- a/Projectiles/Typeless/RelicGuard.cs +++ b/Projectiles/Typeless/RelicGuard.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -23,6 +24,10 @@ namespace CalamityMod.Projectiles.Typeless public float rot2 = 0; public Vector2 aimVel; public float xLerp = 0; + public bool fullPower = false; + public bool maxPower = false; + public Vector2 goalPos; + public float chargeScaling = 1; public override void SetDefaults() { Projectile.width = Projectile.height = 1; @@ -36,6 +41,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.13f / 2 / MathHelper.Pi); float rate = Main.GlobalTimeWrappedHourly * 2; List eColors = new List() { @@ -49,22 +55,41 @@ namespace CalamityMod.Projectiles.Typeless bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); - Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Vector2 startPos = new Vector2(xLerp, -25 + 12 * sine); + Vector2 endPos = new Vector2(40 * sine, -125 + 40 * sine2); + goalPos = Vector2.Lerp(goalPos, fullPower ? endPos : startPos, 0.03f); + Projectile.Center = Owner.MountedCenter + goalPos; Owner.direction = Math.Sign(aimVel.X); - if (Owner.HeldItem.type == ModContent.ItemType()) + if (!Owner.dead && (Owner.HeldItem.type == ModContent.ItemType() || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax))) Projectile.timeLeft++; else + { Projectile.Kill(); - if (Owner.dead) - Projectile.Kill(); + return; + } + + if ((!fullPower && Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax) || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.maxPowerTime && !maxPower)) + { + if (fullPower) + maxPower = true; + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(sound with { Volume = 0.85f, Pitch = maxPower ? 0.8f : 0.6f }, Projectile.Center); + fullPower = true; + } + else if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax) + fullPower = false; + if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime) + maxPower = false; + + chargeScaling = MathHelper.Lerp(chargeScaling, maxPower ? 1.4f : fullPower ? 1.2f : 1, 0.02f); // Emit some light Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; - if (time % 2 == 0 && false) + if (time % 2 == 0 && maxPower) { Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); @@ -79,10 +104,12 @@ namespace CalamityMod.Projectiles.Typeless float adjustedRot = aimVel.ToRotation(); Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); - float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); - + if (!fullPower || Owner.HeldItem.type == ModContent.ItemType()) + { + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + } time++; } public override bool PreDraw(ref Color lightColor) @@ -91,14 +118,16 @@ namespace CalamityMod.Projectiles.Typeless Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Color drawColor = bColor; float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + float overPowerScale = Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, Owner.Calamity().rOfResilienceEffect, true); + float bScale2 = 0.35f * (chargeScaling + overPowerScale * 0.5f); - for (int i = 0; i < 2; i++) + Vector2 drawPos = Projectile.Center + new Vector2(0, Owner.gfxOffY); + for (int i = 0; i < (maxPower ? 6 : fullPower ? 4 : 2); i++) { - float bScale2 = 0.55f; - Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, drawPos - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, MathHelper.PiOver4 * (i % 2 == 0 ? 1 : -1), bTexture.Size() * 0.5f, new Vector2(1 - 0.4f * overPowerScale * (1 + i * 0.3f), 1 + 0.7f * overPowerScale * (1 + i * 0.3f)) * bScale2 * rot2 * CDScale, SpriteEffects.None, 0); } - Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale * bScale2, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); return false; } public override bool? CanDamage() => false; 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/SmokePuff1.png b/Projectiles/Typeless/SmokePuff1.png new file mode 100644 index 0000000000..af5fa26c40 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff1.png differ diff --git a/Projectiles/Typeless/SmokePuff2.png b/Projectiles/Typeless/SmokePuff2.png new file mode 100644 index 0000000000..abaa344582 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff2.png differ diff --git a/Projectiles/Typeless/SmokePuff3.png b/Projectiles/Typeless/SmokePuff3.png new file mode 100644 index 0000000000..409d98bb81 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff3.png differ diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index cbbd158e99..3af9fac9fc 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.alpha = 255; Projectile.timeLeft = 360; Projectile.penetrate = 1; + Projectile.Calamity().CannotProc = true; } public override void AI() @@ -137,7 +138,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int inc; //For use with Contaminated Bile's Stealth Strike - if (Projectile.Calamity().stealthStrike) + if (Projectile.ai[2] > 0) { for (int k = 0; k < 15; k++) { diff --git a/Projectiles/Typeless/TransformerAura.cs b/Projectiles/Typeless/TransformerAura.cs index ded29e11c5..695a1caa17 100644 --- a/Projectiles/Typeless/TransformerAura.cs +++ b/Projectiles/Typeless/TransformerAura.cs @@ -90,19 +90,20 @@ namespace CalamityMod.Projectiles.Typeless Texture2D b2Texture = ModContent.Request("CalamityMod/Particles/Light").Value; Color drawColor = bColor; float deathLerp = (float)Math.Pow(Utils.GetLerpValue(10, 300, Projectile.timeLeft), 2); + Vector2 baseDrawPos = Owner.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); float bScale2 = 0.95f; - Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * deathLerp, 0, bTexture.Size() * 0.5f, (bScale2 * rot2 * Projectile.scale * deathLerp) + 2.5f * (fullChargeMult - 1), SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, drawColor with { A = 0 } * deathLerp, 0, bTexture.Size() * 0.5f, (bScale2 * rot2 * Projectile.scale * deathLerp) + 2.5f * (fullChargeMult - 1), SpriteEffects.None, 0); - Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, new Color(30, 30, 30) * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 1.2f * rot2, SpriteEffects.None, 0); - Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, Color.Black * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 0.8f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(b2Texture, baseDrawPos, null, new Color(30, 30, 30) * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 1.2f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(b2Texture, baseDrawPos, null, Color.Black * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 0.8f * rot2, SpriteEffects.None, 0); for (int i = 0; i < 2; i++) { float subsine = rot2; float rot = (MathHelper.TwoPi * i / 3f) + Main.GlobalTimeWrappedHourly; - Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.16f * deathLerp * fullChargeMult, SpriteEffects.None, 0); - Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot * 2 + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.157f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + Main.EntitySpriteDraw(vTexture, baseDrawPos, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.16f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + Main.EntitySpriteDraw(vTexture, baseDrawPos, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot * 2 + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.157f * deathLerp * fullChargeMult, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs index c9fa8c8bdc..0c0ec12e24 100644 --- a/Projectiles/Typeless/TransformerBlob.cs +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -269,22 +269,25 @@ namespace CalamityMod.Projectiles.Typeless Rectangle frame = orbTexture.Frame(1, 16, 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + + (poweredTimer != 0 ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + if (powered) { Color auraColor = cl1 with { A = 0 } * poweredLerp * visualMult; for (int i = 0; i < 2; i++) { float bScale2 = 0.25f; - Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, cl2 with { A = 0 } * Utils.GetLerpValue(poweredTimerMax, 180, poweredTimer, true) * visualMult, Projectile.rotation, bTexture.Size() * 0.5f, Vector2.Lerp(new Vector2(0.6f, 1.4f), Vector2.One, MathHelper.Min(Utils.GetLerpValue(8, 15, Projectile.frame, true), Utils.GetLerpValue(8, 0, Projectile.frame, true))) * bScale2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, cl2 with { A = 0 } * Utils.GetLerpValue(poweredTimerMax, 180, poweredTimer, true) * visualMult, Projectile.rotation, bTexture.Size() * 0.5f, Vector2.Lerp(new Vector2(0.6f, 1.4f), Vector2.One, MathHelper.Min(Utils.GetLerpValue(8, 15, Projectile.frame, true), Utils.GetLerpValue(8, 0, Projectile.frame, true))) * bScale2 * Projectile.scale, SpriteEffects.None, 0); } } - Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition, frame, Color.White * visualMult, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(orbTexture, baseDrawPos, frame, Color.White * visualMult, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); for (int i = 0; i < 10; i++) { Color auraColor = cl1 with { A = 0 } * (powered ? (float)Math.Pow(Utils.GetLerpValue(poweredTimerMax, 20, poweredTimer, true), 3) : sine) * 0.6f * visualMult; Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4; - Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition + drawOffset, frame, auraColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(orbTexture, baseDrawPos + drawOffset, frame, auraColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); } return false; } diff --git a/Projectiles/Typeless/TrustyOldBobber.cs b/Projectiles/Typeless/TrustyOldBobber.cs new file mode 100644 index 0000000000..fb1077d924 --- /dev/null +++ b/Projectiles/Typeless/TrustyOldBobber.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class TrustyOldBobber : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = ProjAIStyleID.Bobber; + Projectile.bobber = true; + } + } +} diff --git a/Projectiles/Typeless/TrustyOldBobber.png b/Projectiles/Typeless/TrustyOldBobber.png new file mode 100644 index 0000000000..996e575a18 Binary files /dev/null and b/Projectiles/Typeless/TrustyOldBobber.png differ diff --git a/Projectiles/Typeless/V8000SoulVisual.cs b/Projectiles/Typeless/V8000SoulVisual.cs index 76d526cd24..0507db89f3 100644 --- a/Projectiles/Typeless/V8000SoulVisual.cs +++ b/Projectiles/Typeless/V8000SoulVisual.cs @@ -13,8 +13,9 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class V8000SoulVisual : ModProjectile, IPixelatedPrimitiveRenderer + public class V8000SoulVisual : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { + public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() 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 71c2dedb7d..0000000000 --- a/Projectiles/Typeless/VictideBobber.cs +++ /dev/null @@ -1,177 +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 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(40)) - { - 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 6b64564581..0000000000 --- a/Projectiles/Typeless/VictideSpirit.cs +++ /dev/null @@ -1,320 +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; - - // 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/Projectiles/Typeless/WarbannerLight.cs b/Projectiles/Typeless/WarbannerLight.cs index e2909c78cb..49db4bfa84 100644 --- a/Projectiles/Typeless/WarbannerLight.cs +++ b/Projectiles/Typeless/WarbannerLight.cs @@ -74,15 +74,16 @@ namespace CalamityMod.Projectiles.Typeless Texture2D rTexture = ModContent.Request("CalamityMod/Particles/ShatteredExplosion").Value; Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Color drawColor = bColor; + Vector2 baseDrawPos = Owner.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); for (int i = 0; i < 5; i++) { float bScale2 = 0.75f; - Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); } - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, baseDrawPos, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, baseDrawPos, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); return false; } public override bool? CanDamage() => false; diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index 2cf9792eb1..e261415dfa 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -292,27 +292,27 @@ namespace CalamityMod.Projectiles.Typeless Vector2 scale = new Vector2(width, height * spawnFadePow) * 0.12f * Projectile.scale; Vector2 scaleBack = new Vector2(width * 1.5f, height * 0.7f * spawnFadePow) * 0.07f * Projectile.scale; - + Vector2 baseDrawPos = -Main.screenPosition + new Vector2(0, Owner.gfxOffY); if (dashfx > 0) { for (int i = 0; i < 4; i++) { - Main.EntitySpriteDraw(glow, expectedWingPosition1 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.7f : 1) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); - Main.EntitySpriteDraw(glow, expectedWingPosition2 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, backWingRot + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.3f : 0.6f) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glow, expectedWingPosition1 + baseDrawPos, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.7f : 1) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glow, expectedWingPosition2 + baseDrawPos, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, backWingRot + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.3f : 0.6f) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); } int draws = 12; for (int i = 0; i < draws; i++) { Vector2 addedPos = ((MathHelper.TwoPi * i / draws).ToRotationVector2() * 2.5f + Main.rand.NextVector2Circular(2, 2)) * dashfx; - Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(tex, expectedWingPosition1 + baseDrawPos + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(tex, expectedWingPosition2 + baseDrawPos + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); } } - Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(tex, expectedWingPosition1 + baseDrawPos, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(tex, expectedWingPosition2 + baseDrawPos, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); return false; } public int checkActiveWings() diff --git a/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs new file mode 100644 index 0000000000..0d26e280e9 --- /dev/null +++ b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.ILEditing; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Yoyos; +using MonoMod; +using MonoMod.Cil; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.VanillaProjectileOverrides +{ + public class CounterweightEffects : GlobalProjectile + { + public override bool InstancePerEntity => true; + bool runInitialization = false; + public override bool AppliesToEntity(Projectile entity, bool lateInstantiation) + { + //All counterweights fall within this range. + if (entity.type >= ProjectileID.BlackCounterweight && entity.type <= ProjectileID.YellowCounterweight) + return true; + return false; + } + + public override bool PreAI(Projectile projectile) + { + var player = Main.player[projectile.owner]; + int id = player.HeldItem.type; + + if (!runInitialization) + { + if (id == ModContent.ItemType()) + projectile.MaxUpdates++; + runInitialization = true; + } + return true; + } + + public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) + { + var player = Main.player[projectile.owner]; + int id = player.HeldItem.type; + if ( id == ModContent.ItemType()) + target.AddBuff(ModContent.BuffType(), 300); + if (id == ModContent.ItemType()) + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.owner == player.whoAmI && item.ModProjectile is ObliteratorYoyo o) + { + o.DashQueue++; + item.netUpdate = true; + } + } + } + } + } +} 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/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/BadGiftBuzzer.ogg b/Sounds/Custom/BadGiftBuzzer.ogg new file mode 100644 index 0000000000..16cb4134e4 Binary files /dev/null and b/Sounds/Custom/BadGiftBuzzer.ogg differ 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/GFB/FISH.ogg b/Sounds/Custom/GFB/FISH.ogg new file mode 100644 index 0000000000..448f3e3924 Binary files /dev/null and b/Sounds/Custom/GFB/FISH.ogg differ diff --git a/Sounds/Custom/GFB/YouKnowWhatThatMeans.ogg b/Sounds/Custom/GFB/YouKnowWhatThatMeans.ogg new file mode 100644 index 0000000000..a56c7d5305 Binary files /dev/null and b/Sounds/Custom/GFB/YouKnowWhatThatMeans.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/BaconOilBounce.ogg b/Sounds/Item/BaconOilBounce.ogg new file mode 100644 index 0000000000..542fcf680a Binary files /dev/null and b/Sounds/Item/BaconOilBounce.ogg differ diff --git a/Sounds/Item/Bonk.ogg b/Sounds/Item/Bonk.ogg new file mode 100644 index 0000000000..c915c274ac Binary files /dev/null and b/Sounds/Item/Bonk.ogg differ diff --git a/Sounds/Item/ElephantKillerBoostedShotHit.ogg b/Sounds/Item/ElephantKillerBoostedShotHit.ogg new file mode 100644 index 0000000000..87430b68b4 Binary files /dev/null and b/Sounds/Item/ElephantKillerBoostedShotHit.ogg differ diff --git a/Sounds/Item/ElephantKillerCatch.ogg b/Sounds/Item/ElephantKillerCatch.ogg new file mode 100644 index 0000000000..f34720ab13 Binary files /dev/null and b/Sounds/Item/ElephantKillerCatch.ogg differ diff --git a/Sounds/Item/ElephantKillerElephant.ogg b/Sounds/Item/ElephantKillerElephant.ogg new file mode 100644 index 0000000000..7871a03329 Binary files /dev/null and b/Sounds/Item/ElephantKillerElephant.ogg differ diff --git a/Sounds/Item/ElephantKillerHit.ogg b/Sounds/Item/ElephantKillerHit.ogg new file mode 100644 index 0000000000..3d6ffc7fd0 Binary files /dev/null and b/Sounds/Item/ElephantKillerHit.ogg differ diff --git a/Sounds/Item/ElephantKillerShine.ogg b/Sounds/Item/ElephantKillerShine.ogg new file mode 100644 index 0000000000..36407eaa87 Binary files /dev/null and b/Sounds/Item/ElephantKillerShine.ogg differ diff --git a/Sounds/Item/ElephantKillerShot.ogg b/Sounds/Item/ElephantKillerShot.ogg new file mode 100644 index 0000000000..8844b50f92 Binary files /dev/null and b/Sounds/Item/ElephantKillerShot.ogg differ diff --git a/Sounds/Item/ElephantKillerShotFail.ogg b/Sounds/Item/ElephantKillerShotFail.ogg new file mode 100644 index 0000000000..c52804336c Binary files /dev/null and b/Sounds/Item/ElephantKillerShotFail.ogg differ diff --git a/Sounds/Item/ElephantKillerThrow.ogg b/Sounds/Item/ElephantKillerThrow.ogg new file mode 100644 index 0000000000..562f022019 Binary files /dev/null and b/Sounds/Item/ElephantKillerThrow.ogg differ diff --git a/Sounds/Item/ElephantKillerWoosh.ogg b/Sounds/Item/ElephantKillerWoosh.ogg new file mode 100644 index 0000000000..2c8a5c2fda Binary files /dev/null and b/Sounds/Item/ElephantKillerWoosh.ogg differ diff --git a/Sounds/Item/ElumphantBop.ogg b/Sounds/Item/ElumphantBop.ogg new file mode 100644 index 0000000000..5f5cc86872 Binary files /dev/null and b/Sounds/Item/ElumphantBop.ogg differ diff --git a/Sounds/Item/ElumphantCry.ogg b/Sounds/Item/ElumphantCry.ogg new file mode 100644 index 0000000000..685de9abef Binary files /dev/null and b/Sounds/Item/ElumphantCry.ogg differ diff --git a/Sounds/Item/ElumphantSound.ogg b/Sounds/Item/ElumphantSound.ogg new file mode 100644 index 0000000000..f2aaf9ae5e Binary files /dev/null and b/Sounds/Item/ElumphantSound.ogg differ diff --git a/Sounds/Item/GunShotTiny.ogg b/Sounds/Item/GunShotTiny.ogg new file mode 100644 index 0000000000..f7fc4b89c1 Binary files /dev/null and b/Sounds/Item/GunShotTiny.ogg differ diff --git a/Sounds/Item/MegalodonMissileMax.ogg b/Sounds/Item/MegalodonMissileMax.ogg new file mode 100644 index 0000000000..f9c5f95d43 Binary files /dev/null and b/Sounds/Item/MegalodonMissileMax.ogg differ diff --git a/Sounds/Item/PigionSqueal.ogg b/Sounds/Item/PigionSqueal.ogg new file mode 100644 index 0000000000..bbea056193 Binary files /dev/null and b/Sounds/Item/PigionSqueal.ogg differ diff --git a/Sounds/Item/RocketSmall.ogg b/Sounds/Item/RocketSmall.ogg new file mode 100644 index 0000000000..0399e3bd88 Binary files /dev/null and b/Sounds/Item/RocketSmall.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/SwinesWrathProc.ogg b/Sounds/Item/SwinesWrathProc.ogg new file mode 100644 index 0000000000..2afe99efa7 Binary files /dev/null and b/Sounds/Item/SwinesWrathProc.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/Item/VoidragonCharge.ogg b/Sounds/Item/VoidragonCharge.ogg new file mode 100644 index 0000000000..2482c3cbbe Binary files /dev/null and b/Sounds/Item/VoidragonCharge.ogg differ diff --git a/Sounds/Item/VoidragonLaser.ogg b/Sounds/Item/VoidragonLaser.ogg new file mode 100644 index 0000000000..32fbabd3fd Binary files /dev/null and b/Sounds/Item/VoidragonLaser.ogg differ diff --git a/Sounds/Item/VoidragonStrongStart.ogg b/Sounds/Item/VoidragonStrongStart.ogg new file mode 100644 index 0000000000..e4acc4fbca Binary files /dev/null and b/Sounds/Item/VoidragonStrongStart.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 54496b4e70..4880709a05 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -1,13 +1,14 @@ -using System.Collections.Generic; -using CalamityMod.Buffs; +using CalamityMod.Buffs; using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.DataStructures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Summon; using ReLogic.Reflection; using Terraria.ID; using Terraria.ModLoader; @@ -18,24 +19,25 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityBuffSets { - public static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search); - public 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.
/// Also used to remove buffs when contacting the Whispering Maelstrom in the Get fixed boi seed.
/// Defaults to . ///
- public static bool[] BuffedByAmalgam = Factory.CreateBoolSet(BuffID.ObsidianSkin, BuffID.Regeneration, BuffID.Swiftness, BuffID.Gills, BuffID.Ironskin, BuffID.ManaRegeneration, - BuffID.MagicPower, BuffID.Featherfall, BuffID.Spelunker, BuffID.Invisibility, BuffID.Shine, BuffID.NightOwl, BuffID.Battle, BuffID.Thorns, BuffID.WaterWalking, - BuffID.Archery, BuffID.Hunter, BuffID.Gravitation, BuffID.Tipsy, BuffID.WellFed, BuffID.WellFed2, BuffID.WellFed3, BuffID.Honey, BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison, BuffID.Lucky, BuffID.Mining, BuffID.Heartreach, BuffID.Calm, BuffID.Builder, BuffID.Titan, BuffID.Flipper, BuffID.Summoning, BuffID.Dangersense, - BuffID.AmmoReservation, BuffID.Lifeforce, BuffID.Endurance, BuffID.Rage, BuffID.Inferno, BuffID.Wrath, BuffID.Lovestruck, BuffID.Stinky, BuffID.Fishing, BuffID.Sonar, - BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + public static bool[] BuffedByAmalgam = Factory.CreateNamedSet("BuffedByAmalgam") + .Description("Allows this buff to have its duration extended with The Amalgam equipped. Also used to remove buffs when contacting the Whispering Maelstrom in Get fixed boi.") + .RegisterBoolSet(BuffID.ObsidianSkin, BuffID.Regeneration, BuffID.Swiftness, BuffID.Gills, BuffID.Ironskin, BuffID.ManaRegeneration, BuffID.MagicPower, BuffID.Featherfall, + BuffID.Spelunker, BuffID.Invisibility, BuffID.Shine, BuffID.NightOwl, BuffID.Battle, BuffID.Thorns, BuffID.WaterWalking, BuffID.Archery, BuffID.Hunter, BuffID.Gravitation, + BuffID.Tipsy, BuffID.WellFed, BuffID.WellFed2, BuffID.WellFed3, BuffID.Honey, BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffID.Lucky, BuffID.Mining, + BuffID.Heartreach, BuffID.Calm, BuffID.Builder, BuffID.Titan, BuffID.Flipper, BuffID.Summoning, BuffID.Dangersense, BuffID.AmmoReservation, BuffID.Lifeforce, BuffID.Endurance, + BuffID.Rage, BuffID.Inferno, BuffID.Wrath, BuffID.Lovestruck, BuffID.Stinky, BuffID.Fishing, BuffID.Sonar, BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); @@ -45,83 +47,146 @@ namespace CalamityMod.Systems.Collections /// Used by The Amalgam to prevent removing their persistence when the accessory is unequipped.
/// Defaults to . ///
- public static bool[] IsPersistentBuff = Factory.CreateBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); + public static bool[] IsPersistentBuff = Factory.CreateNamedSet("IsPersistentBuff") + .Description("Prevents persistent buffs from having their persistence removed by The Amalgam when it is unequipped.") + .RegisterBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, + BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); /// /// If for a buff type, then that buff is considered to be a debuff.
- /// This general-purpose set has several different uses, including reducing buff duration with Radiance, Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
+ /// This general-purpose set has several different uses, including Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
/// Defaults to . ///
- public static bool[] IsDebuff = Factory.CreateBoolSet(BuffID.Poisoned, BuffID.Darkness, BuffID.Cursed, BuffID.OnFire, BuffID.Bleeding, BuffID.Confused, BuffID.Slow, BuffID.Weak, - BuffID.Silenced, BuffID.BrokenArmor, BuffID.CursedInferno, BuffID.Frostburn, BuffID.Chilled, BuffID.Frozen, BuffID.Burning, BuffID.Suffocation, BuffID.Ichor, - BuffID.Venom, BuffID.Blackout, BuffID.Electrified, BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, BuffID.ShadowFlame, - BuffID.OgreSpit, BuffID.BetsysCurse, BuffID.Wet, BuffID.Slimed, BuffID.OnFire3, BuffID.Frostburn2, BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType()); + public static bool[] IsDebuff = Factory.CreateNamedSet("IsDebuff") + .Description("General-purpose set with several different uses, including Crown Jewel line regen, removal via Cleansing Jelly line aura, etc.") + .RegisterBoolSet(BuffID.Poisoned, BuffID.Darkness, BuffID.Cursed, BuffID.OnFire, BuffID.Bleeding, BuffID.Confused, BuffID.Slow, BuffID.Weak, BuffID.Silenced, BuffID.BrokenArmor, + BuffID.CursedInferno, BuffID.Frostburn, BuffID.Chilled, BuffID.Frozen, BuffID.Burning, BuffID.Suffocation, BuffID.Ichor, BuffID.Venom, BuffID.Blackout, BuffID.Electrified, + BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, BuffID.ShadowFlame, BuffID.OgreSpit, BuffID.BetsysCurse, + BuffID.Wet, BuffID.Slimed, BuffID.OnFire3, BuffID.Frostburn2, BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); /// /// If for a buff type, then that buff is a whip tag buff on the player.
/// Used to prevent "whip stacking", the ability to grant the player multiple whip buff effects at once.
/// Defaults to . ///
- public static bool[] IsSummonTagBuff = Factory.CreateBoolSet(BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, BuffID.ThornWhipPlayerBuff, BuffType()); + public static bool[] IsSummonTagBuff = Factory.CreateNamedSet("IsSummonTagBuff") + .Description("Whip tag buffs for the player, used to prevent whip stacking.") + .RegisterBoolSet(BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, BuffID.ThornWhipPlayerBuff, BuffType()); /// /// Associates a buff type with its structure. If a buff type is not a key in this dictionary, then it has no associated .
/// Used for several different effects, such as applying tag effects to NPCs, preventing "whip stacking" on NPCs, and drawing the tag effect icon below the NPC. ///
- public static Dictionary SummonTagDebuff = new Dictionary - { - { BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip }, - { BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap }, - { BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip }, - { BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker }, - { BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar }, - { BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope }, - { BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest }, - { BuffID.SwordWhipNPCDebuff, SummonTag.Durendal }, - { BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn }, - { BuffType(), ProfanedSoulCrystal.SummonTag } - }; + public static SummonTag[] SummonTagDebuff = Factory.CreateNamedSet("SummonTagDebuff") + .Description("Associates a buff type with its SummonTag structure. Used for several different effects, such as applying tag effects to NPCs, preventing whip stacking on NPCs, and drawing the tag effect icon below the NPC.") + .RegisterCustomSet(null, + BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip, + BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap, + BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip, + BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker, + BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar, + BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope, + BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest, + BuffID.SwordWhipNPCDebuff, SummonTag.Durendal , + BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn, + BuffType(), Cnidarian.summonTag, + BuffType(), ForbiddenCirclet.summonTag, + BuffType(), ProfanedSoulCrystal.SummonTag, + BuffType(), VoidConcentrationStaff.summonTag + ); + private static DebuffData Alch(int level) => new DebuffData() { AlcoholLevel = level }; /// - /// Associates a buff type with its alcohol poison level. Used for the Alcohol Poisoning mechanic.
- /// If a buff type is not a key in this dictionary, then it does not increase alcohol poison 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 Dictionary AlcoholStrength = new Dictionary + public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") + .Description("Associates a buff with its DebuffData, which stores information about that buff.") + .RegisterCustomSet(null, + BuffID.OnFire, DebuffData.OnFire, + BuffID.OnFire3, DebuffData.Hellfire, + BuffID.CursedInferno, DebuffData.CursedInferno, + BuffID.ShadowFlame, DebuffData.Shadowflame, + BuffID.Daybreak, DebuffData.Daybroken, + BuffID.Burning, DebuffData.Burning, + BuffID.Frostburn, DebuffData.Frostburn, + BuffID.Frostburn2, DebuffData.Frostbite, + BuffID.Poisoned, DebuffData.Poisoned, + BuffID.Venom, DebuffData.AcidVenom, + BuffID.Electrified, DebuffData.Electrified, + BuffID.Oiled, DebuffData.Oiled, + + BuffID.Tipsy, Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + + BuffType(), Alch(2), + BuffType(), Alch(3) + ); + public static int GetBuffIDFromAlcoholType(AlcoholType type) { - { BuffID.Tipsy, 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 2 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 } - }; + return type switch + { + AlcoholType.BaconOil => BuffType(), + AlcoholType.BloodyMary => BuffType(), + AlcoholType.CaribbeanRum => BuffType(), + AlcoholType.CinnamonRoll => BuffType(), + AlcoholType.Everclear => BuffType(), + AlcoholType.EvergreenGin => BuffType(), + AlcoholType.Fireball => BuffType(), + AlcoholType.GrapeBeer => BuffType(), + AlcoholType.Manhattan => BuffType(), + AlcoholType.Margarita => BuffType(), + AlcoholType.Moonshine => BuffType(), + AlcoholType.MoscowMule => BuffType(), + AlcoholType.OldFashioned => BuffType(), + AlcoholType.PurpleHaze => BuffType(), + AlcoholType.RedWine => BuffType(), + AlcoholType.Rum => BuffType(), + AlcoholType.Screwdriver => BuffType(), + AlcoholType.StarBeamRye => BuffType(), + AlcoholType.Tequila => BuffType(), + AlcoholType.TequilaSunrise => BuffType(), + AlcoholType.Vodka => BuffType(), + AlcoholType.Whiskey => BuffType(), + AlcoholType.WhiteWine => BuffType(), + + // Vanilla treats both Ale and Sake as the "Tipsy" buff + AlcoholType.Ale => BuffID.Tipsy, + AlcoholType.Sake => BuffID.Tipsy, + + _ => -1 + }; + } } } diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 7cd1742e0d..5abf9646f5 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -1,23 +1,19 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.FishingRods; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Furniture.BossRelics; -using CalamityMod.Items.Placeables.Furniture.Monoliths; -using CalamityMod.Items.Placeables.Furniture.Paintings; -using CalamityMod.Items.Placeables.Furniture.Trophies; +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.TreasureBags; 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 CalamityMod.Items.Weapons.Summon; -using ReLogic.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,71 +24,75 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityItemSets { - public static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search); - public 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.
/// Defaults to . ///
- public static bool[] WeaponWithToolPowerAffectedBySummonPenalty = Factory.CreateBoolSet(ItemID.ButchersChainsaw, ItemID.LucyTheAxe, ItemID.Rockfish, - ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + 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()); /// /// If for an item type, manually disables Calamity's summon damage penalty mechanic while that item type is held.
/// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
/// Defaults to . ///
- public static bool[] ItemWhichDisablesSummonerNerf = Factory.CreateBoolSet(); + public static bool[] ItemWhichDisablesSummonerNerf = Factory.CreateNamedSet("ItemWhichDisablesSummonerNerf") + .Description("Makes holding this item manually disable the summon damage penalty.") + .RegisterBoolSet(); /// /// If for an item type, holding the item sets to true, preventing fishing lines from breaking.
/// Should only be set on fishing poles.
/// Defaults to . ///
- public static bool[] FishingPoleThatNeverBreaks = Factory.CreateBoolSet(ItemID.GoldenFishingRod, ItemType(), ItemType()); - - /// - /// If for an item type, forces a dropped item of this type to remain within the bounds of the world if it is spawned outside of it.
- /// Set this for items which are dropped by enemies or bosses which spawn on the edges of the world.
- /// Defaults to . - ///
- public static bool[] ItemForcedInsideWorld = Factory.CreateBoolSet(ItemID.FishronWings, ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, ItemID.FishronBossBag, ItemID.GreaterHealingPotion, ItemID.SoulofFlight, 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(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] FishingPoleThatNeverBreaks = Factory.CreateNamedSet("FishingPoleThatNeverBreaks") + .Description("Makes holding this item set Player.accFishingLine, preventing fishing lines from breaking.") + .RegisterBoolSet(ItemID.GoldenFishingRod, ItemType(), ItemType()); /// /// If for an item type, prevents this rogue weapon from triggering Venerated Locket's clone projectile effect when used.
/// Primarily used for weapons which shoot short-distance projectiles.
/// Defaults to . ///
- public static bool[] DisablesVeneratedLocketEffect = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType()); + public static bool[] DisablesVeneratedLocketEffect = Factory.CreateNamedSet("DisablesVeneratedLocketEffect") + .Description("Prevents this item from triggering Venerated Locket's clone projectiles.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a magic gun.
/// Used for applying Calamity's reworked Meteor armor set bonus.
/// Defaults to . ///
- public static bool[] MagicGun = Factory.CreateBoolSet(ItemID.BeeGun, ItemID.BubbleGun, ItemID.ChargedBlasterCannon, ItemID.HeatRay, ItemID.LaserMachinegun, ItemID.LaserRifle, - ItemID.LeafBlower, ItemID.RainbowGun, ItemID.SpaceGun, ItemID.WaspGun, ItemID.ZapinatorGray, ItemID.ZapinatorOrange, ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] MagicGun = Factory.CreateNamedSet("MagicGun") + .Description("Labels this item as a magic gun, for Meteor armor's set bonus.") + .RegisterBoolSet(ItemID.BeeGun, ItemID.BubbleGun, ItemID.ChargedBlasterCannon, ItemID.HeatRay, ItemID.LaserMachinegun, ItemID.LaserRifle, ItemID.LeafBlower, ItemID.RainbowGun, + ItemID.SpaceGun, ItemID.WaspGun, ItemID.ZapinatorGray, ItemID.ZapinatorOrange, 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 guaranteed to critically strike and converts critical strike chance boosts into extra damage.
+ /// Used to replace the item's critical strike chance tooltip line with one about critical damage.
+ /// Defaults to . + ///
+ 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(), ItemType()); /// /// If for an item type, this item is considered to be a rogue bomb.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueBomb = Factory.CreateNamedSet("RogueBomb") + .Description("Labels this item as a rogue bomb, only exists for objective classification.") + .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()); @@ -101,8 +101,10 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueBoomerang = Factory.CreateNamedSet("RogueBoomerang") + .Description("Labels this item as a rogue boomerang, only exists for objective classification.") + .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()); @@ -111,11 +113,13 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueDagger = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueDagger = Factory.CreateNamedSet("RogueDagger") + .Description("Labels this item as a rogue dagger, only exists for objective classification.") + .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(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// @@ -123,22 +127,46 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType()); + public static bool[] RogueJavelin = Factory.CreateNamedSet("RogueJavelin") + .Description("Labels this item as a rogue javelin, only exists for objective classification.") + .RegisterBoolSet(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 considered to be a rogue spiky ball.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueSpikyBall = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType()); + 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()); - public static bool[] ShowScalingCritDamageTooltip = Factory - .CreateNamedSet("ShowScalingCritDamageTooltip") - .Description("Replaces Crit Chance tooltip line with Crit Damage, getting 2% crit dmg per 1% crit chance") - .RegisterBoolSet(); + /// + /// 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()); } } diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index b6d5a71376..76fd562898 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -48,95 +48,111 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCSets { - public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = NPCID.Sets.Factory; /// /// If for an NPC type, makes this NPC be susceptible to .
/// Defaults to . ///
- public static bool[] CalamityNPCNotImmuneToConfused = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType()); + public static bool[] CalamityNPCNotImmuneToConfused = Factory.CreateNamedSet("CalamityNPCNotImmuneToConfused") + .Description("Makes this NPC be susceptible to Confused.") + .RegisterBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); /// /// If for an NPC type, forces this NPC to draw Calamity's debuff display, even if it is not a boss.
/// Defaults to . ///
- public static bool[] ForceDrawDebuffDisplay = Factory.CreateBoolSet(NPCID.TargetDummy, NPCID.WallofFleshEye, NPCType()); + public static bool[] ForceDrawDebuffDisplay = Factory.CreateNamedSet("ForceDrawDebuffDisplay") + .Description("Allows drawing Calamity's debuff display, even if not a boss.") + .RegisterBoolSet(NPCID.TargetDummy, NPCID.WallofFleshEye, NPCType()); + + /// + /// If for an NPC type, then that NPC is a bound Town NPC.
+ /// Used to make them immune to enemy damage.
+ /// Defaults to . + ///
+ public static bool[] BoundTownNPC = Factory.CreateNamedSet("BoundTownNPC") + .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.
/// Defaults to . ///
- public static bool[] BossSegmentThatDoesNotGenerateRageFaster = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType()); + public static bool[] BossSegmentThatDoesNotGenerateRageFaster = Factory.CreateNamedSet("BossSegmentThatDoesNotGenerateRageFaster") + .Description("Prevent this boss NPC from generating Rage faster.") + .RegisterBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); /// /// If for an NPC type, allows the NPC to scale its health based on the Boss Health Boost Percentage config option, even if it is not a boss.
/// Also allows the NPC to receive health scaling from having multiple players in Expert+.
/// Defaults to . ///
- public static bool[] ScalesHealthLikeBoss = Factory.CreateBoolSet(NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.SkeletronHand, - NPCID.WallofFleshEye, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.PrimeSaw, NPCID.GolemHead, - NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.Sharkron, NPCID.Sharkron2, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType()); + public static bool[] ScalesHealthLikeBoss = Factory.CreateNamedSet("ScalesHealthLikeBoss") + .Description("Allows scaling health from vanilla Expert+ multiplayer scaling and Boss Health Boost Percentage config, even if not a boss.") + .RegisterBoolSet(NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.SkeletronHand, NPCID.WallofFleshEye, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, + NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.PrimeSaw, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.Sharkron, + NPCID.Sharkron2, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType()); /// /// If for an NPC type, then that NPC will have its contact damage set to 0.
/// Defaults to . ///
- public static bool[] DealsZeroContactDamage = Factory.CreateBoolSet(NPCID.Harpy, NPCID.Salamander, NPCID.Salamander2, NPCID.Salamander3, NPCID.Salamander4, NPCID.Salamander5, - NPCID.Salamander6, NPCID.Salamander7, NPCID.Salamander8, NPCID.Salamander9, NPCID.GiantCursedSkull, NPCID.FungiBulb, NPCID.GiantFungiBulb, NPCID.IcyMerman, - NPCID.AngryNimbus, NPCID.SandElemental, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.CultistArcherBlue, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, - NPCID.Gastropod, NPCID.IceElemental, NPCID.IchorSticker, NPCID.Necromancer, NPCID.NecromancerArmored, NPCID.RaggedCaster, NPCID.RaggedCasterOpenCoat, NPCID.RuneWizard, - NPCID.SkeletonArcher, NPCID.SkeletonCommando, NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.Clown, NPCID.GoblinArcher, NPCID.GoblinSorcerer, NPCID.GoblinSummoner, - NPCID.PirateCrossbower, NPCID.PirateDeadeye, NPCID.PirateCaptain, NPCID.SnowmanGangsta, NPCID.SnowBalla, NPCID.DrManFly, NPCID.Eyezor, NPCID.Nailhead, NPCID.BrainScrambler, - NPCID.GigaZapper, NPCID.RayGunner, NPCID.ScutlixRider, NPCID.MartianWalker, NPCID.MartianTurret, NPCID.ElfCopter, NPCID.ElfArcher, NPCID.NebulaBrain, NPCID.NebulaSoldier, - NPCID.StardustCellSmall, NPCID.StardustJellyfishBig, NPCID.StardustSoldier, NPCID.StardustSpiderBig, NPCID.VortexHornetQueen, NPCID.VortexRifleman, NPCID.VortexSoldier, + public static bool[] DealsZeroContactDamage = Factory.CreateNamedSet("DealsZeroContactDamage") + .Description("Makes this NPC deal 0 contact damage.") + .RegisterBoolSet(NPCID.AngryNimbus, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, + NPCID.Necromancer, NPCID.NecromancerArmored, NPCID.RaggedCaster, NPCID.RaggedCasterOpenCoat, NPCID.RuneWizard, NPCID.GoblinSorcerer, NPCID.GoblinSummoner, NPCID.NebulaBrain, NPCID.PirateShipCannon, NPCID.MartianSaucer, NPCID.MartianSaucerCannon, NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.Probe, NPCID.CultistBoss, NPCID.GolemHead, - NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, NPCID.Dandelion, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2OgreT2, - NPCID.DD2OgreT3, NPCID.DD2GoblinBomberT1, NPCID.DD2GoblinBomberT2, NPCID.DD2GoblinBomberT3, NPCID.DD2JavelinstT1, NPCID.DD2JavelinstT2, NPCID.DD2JavelinstT3, - NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldFlyerT2, NPCID.DD2KoboldFlyerT3, NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, NPCID.DD2LightningBugT3, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); + NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); /// /// If for an NPC type, then that NPC will have its damage reduced by 25% if the world is in Hardmode.
/// Defaults to . ///
- public static bool[] NerfDamageInHardmode = Factory.CreateBoolSet(NPCID.AnglerFish, NPCID.AngryTrapper, NPCID.Arapaima, NPCID.BlackRecluse, NPCID.BlackRecluseWall, - NPCID.BloodJelly, NPCID.FungoFish, NPCID.GreenJellyfish, NPCID.Clinger, NPCID.ArmoredSkeleton, NPCID.ArmoredViking, NPCID.Mummy, NPCID.DarkMummy, NPCID.LightMummy, - NPCID.BloodFeeder, NPCID.DesertBeast, NPCID.ChaosElemental, NPCID.BloodMummy, NPCID.CorruptSlime, NPCID.Corruptor, NPCID.Crimslime, NPCID.CrimsonAxe, NPCID.CursedHammer, - NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, - NPCID.EnchantedSword, NPCID.FloatyGross, NPCID.GiantBat, NPCID.GiantFlyingFox, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, - NPCID.IlluminantBat, NPCID.IlluminantSlime, NPCID.JungleCreeper, NPCID.JungleCreeperWall, NPCID.DesertLamiaDark, NPCID.DesertLamiaLight, NPCID.MossHornet, NPCID.Moth, - NPCID.PigronCorruption, NPCID.PigronCrimson, NPCID.PigronHallow, NPCID.Pixie, NPCID.PossessedArmor, NPCID.RockGolem, NPCID.DesertScorpionWalk, NPCID.DesertScorpionWall, - NPCID.Slimer, NPCID.ToxicSludge, NPCID.Unicorn, NPCID.WanderingEye, NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, NPCID.Wraith, NPCID.ChatteringTeethBomb, NPCID.IceGolem, - NPCID.RainbowSlime, NPCID.SandShark, NPCID.SandsharkCorrupt, NPCID.SandsharkCrimson, NPCID.SandsharkHallow, NPCID.ShadowFlameApparition, NPCID.Parrot, NPCID.PirateCorsair, - NPCID.PirateDeckhand, NPCID.PirateGhost, NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBonesSword, NPCID.BoneLee, NPCID.DungeonSpirit, NPCID.FlyingSnake, NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBonesSword, NPCID.MisterStabby, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, NPCID.Frankenstein, - NPCID.Fritz, NPCID.Psycho, NPCID.Reaper, NPCID.SwampThing, NPCID.ThePossessed, NPCID.Vampire, NPCID.VampireBat, NPCID.HeadlessHorseman, NPCID.Hellhound, NPCID.Poltergeist, - NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, - NPCID.Splinterling, NPCID.Flocko, NPCID.GingerbreadMan, NPCID.Krampus, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.PresentMimic, NPCID.Yeti, NPCID.ZombieElf, NPCID.ZombieElfBeard, + public static bool[] NerfDamageInHardmode = Factory.CreateNamedSet("NerfDamageInHardmode") + .Description("Makes this NPC have its contact damage reduced by 25% if the world is in Hardmode.") + .RegisterBoolSet(NPCID.AnglerFish, NPCID.AngryTrapper, NPCID.Arapaima, NPCID.BlackRecluse, NPCID.BlackRecluseWall, NPCID.BloodJelly, NPCID.FungoFish, NPCID.GreenJellyfish, + NPCID.Clinger, NPCID.ArmoredSkeleton, NPCID.ArmoredViking, NPCID.Mummy, NPCID.DarkMummy, NPCID.LightMummy, NPCID.BloodFeeder, NPCID.DesertBeast, NPCID.ChaosElemental, + NPCID.BloodMummy, NPCID.CorruptSlime, NPCID.Corruptor, NPCID.Crimslime, NPCID.CrimsonAxe, NPCID.CursedHammer, NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, + NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, NPCID.EnchantedSword, NPCID.FloatyGross, + NPCID.GiantBat, NPCID.GiantFlyingFox, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, NPCID.IlluminantBat, NPCID.IlluminantSlime, + NPCID.JungleCreeper, NPCID.JungleCreeperWall, NPCID.DesertLamiaDark, NPCID.DesertLamiaLight, NPCID.MossHornet, NPCID.Moth, NPCID.PigronCorruption, NPCID.PigronCrimson, + NPCID.PigronHallow, NPCID.Pixie, NPCID.PossessedArmor, NPCID.RockGolem, NPCID.DesertScorpionWalk, NPCID.DesertScorpionWall, NPCID.Slimer, NPCID.ToxicSludge, NPCID.Unicorn, + NPCID.WanderingEye, NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, NPCID.Wraith, NPCID.ChatteringTeethBomb, NPCID.IceGolem, NPCID.RainbowSlime, NPCID.SandShark, + NPCID.SandsharkCorrupt, NPCID.SandsharkCrimson, NPCID.SandsharkHallow, NPCID.ShadowFlameApparition, NPCID.Parrot, NPCID.PirateCorsair, NPCID.PirateDeckhand, NPCID.PirateGhost, + NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBonesSword, NPCID.BoneLee, NPCID.DungeonSpirit, NPCID.FlyingSnake, NPCID.HellArmoredBones, NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBonesSword, NPCID.MisterStabby, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, NPCID.Frankenstein, NPCID.Fritz, NPCID.Psycho, NPCID.Reaper, + NPCID.SwampThing, NPCID.ThePossessed, NPCID.Vampire, NPCID.VampireBat, NPCID.HeadlessHorseman, NPCID.Hellhound, NPCID.Poltergeist, NPCID.Scarecrow1, NPCID.Scarecrow2, + NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, NPCID.Splinterling, + NPCID.Flocko, NPCID.GingerbreadMan, NPCID.Krampus, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.PresentMimic, NPCID.Yeti, NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.BloodEelHead, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman); /// @@ -145,52 +161,59 @@ namespace CalamityMod.Systems.Collections /// Second, it multiplies their max health by 2.5x and increases their damage by a flat 30 if Moon Lord has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedDungeonEnemy = Factory.CreateBoolSet(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, NPCID.RustyArmoredBonesSwordNoArmor, NPCID.RustyArmoredBonesSword, NPCID.RustyArmoredBonesFlail, NPCID.RustyArmoredBonesAxe); + 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.") + .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, + NPCID.RustyArmoredBonesSwordNoArmor, NPCID.RustyArmoredBonesSword, NPCID.RustyArmoredBonesFlail, NPCID.RustyArmoredBonesAxe); /// /// If for an NPC type, then that NPC is spawned in the Pumpkin Moon.
/// This will multiply their max health by 3.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedPumpkinMoonEnemy = Factory.CreateBoolSet(NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, - NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, NPCID.HeadlessHorseman, NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, - NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist); + public static bool[] IsBuffedPumpkinMoonEnemy = Factory.CreateNamedSet("IsBuffedPumpkinMoonEnemy") + .Description("Makes this Pumpkin Moon enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, + NPCID.Scarecrow10, NPCID.HeadlessHorseman, NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist); /// /// If for an NPC type, then that NPC is spawned in the Frost Moon.
/// This will multiply their max health by 2.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedFrostMoonEnemy = Factory.CreateBoolSet(NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.PresentMimic, NPCID.GingerbreadMan, - NPCID.Yeti, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.ElfCopter, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.ElfArcher, NPCID.Krampus, NPCID.Flocko); + public static bool[] IsBuffedFrostMoonEnemy = Factory.CreateNamedSet("IsBuffedFrostMoonEnemy") + .Description("Makes this Frost Moon enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.PresentMimic, NPCID.GingerbreadMan, NPCID.Yeti, NPCID.Everscream, NPCID.IceQueen, + NPCID.SantaNK1, NPCID.ElfCopter, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.ElfArcher, NPCID.Krampus, NPCID.Flocko); /// /// If for an NPC type, then that NPC is spawned in the Solar Eclipse.
/// This will multiply their max health by 5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedSolarEclipseEnemy = Factory.CreateBoolSet(NPCID.Eyezor, NPCID.Reaper, NPCID.Frankenstein, NPCID.SwampThing, NPCID.Vampire, NPCID.VampireBat, - NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, - NPCID.MothronEgg, NPCID.MothronSpawn); + public static bool[] IsBuffedSolarEclipseEnemy = Factory.CreateNamedSet("IsBuffedSolarEclipseEnemy") + .Description("Makes this Solar Eclipse enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.Eyezor, NPCID.Reaper, NPCID.Frankenstein, NPCID.SwampThing, NPCID.Vampire, NPCID.VampireBat, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, + NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, NPCID.MothronEgg, NPCID.MothronSpawn); /// /// If for an NPC type, then the NPC will not be affected by slowing debuffs.
/// Also used to prevent weapon pulling effects and Anarchy Blade's ability to instantly kill enemies that are below 50% health.
/// Defaults to . ///
- public static bool[] ImmuneToSlowsAndOtherSpecialEffects = Factory.CreateBoolSet(NPCID.KingSlime, NPCType(), - NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, - NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, - NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.Plantera, - NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, NPCID.Pumpking, NPCID.Mothron, - NPCID.Golem, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MartianSaucerCore, NPCID.MartianSaucerCannon, NPCID.MartianSaucerTurret, - NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, NPCID.DD2WyvernT1, NPCID.DD2WyvernT2, NPCID.DD2WyvernT3, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2SkeletonT1, NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, NPCID.DD2WitherBeastT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2KoboldFlyerT2, + public static bool[] ImmuneToSlowsAndOtherSpecialEffects = Factory.CreateNamedSet("ImmuneToSlowsAndOtherSpecialEffects") + .Description("Makes this NPC immune to slowing debuffs and specific weapon effects.") + .RegisterBoolSet(NPCID.KingSlime, NPCType(), NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, NPCID.Creeper, NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, + NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, + NPCID.PrimeVice, NPCID.Plantera, NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, + NPCID.Pumpking, NPCID.Mothron, NPCID.Golem, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MartianSaucerCore, NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.MoonLordHead, NPCID.MoonLordHand, + NPCID.MoonLordCore, NPCID.MoonLordFreeEye, NPCID.DD2WyvernT1, NPCID.DD2WyvernT2, NPCID.DD2WyvernT3, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2SkeletonT1, + NPCID.DD2SkeletonT3, NPCID.DD2WitherBeastT2, NPCID.DD2WitherBeastT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2KoboldFlyerT2, NPCID.DD2KoboldFlyerT3, NPCID.DD2OgreT2, NPCID.DD2OgreT3, NPCID.DD2Betsy, NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), @@ -204,15 +227,116 @@ 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.CreateBoolSet(NPCType(), NPCType()); + public static bool[] DoCheckDeadRegardlessRealLife = Factory.CreateNamedSet("DoCheckDeadRegardlessRealLife") + .Description("Makes this NPC always call CheckDead, even if it sets realLife.") + .RegisterBoolSet(NPCType(), NPCType()); /// /// If for an NPC type, will not count this NPC as an enemy.
/// Defaults to . ///
- public static bool[] DontCountAsEnemy = Factory.CreateBoolSet(NPCID.TargetDummy, NPCType()); + public static bool[] DontCountAsEnemy = Factory.CreateNamedSet("DontCountAsEnemy") + .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.
diff --git a/Systems/Collections/CalamityNPCTypeSets.cs b/Systems/Collections/CalamityNPCTypeSets.cs index 3985e71ee1..09517fad07 100644 --- a/Systems/Collections/CalamityNPCTypeSets.cs +++ b/Systems/Collections/CalamityNPCTypeSets.cs @@ -20,23 +20,19 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCTypeSets { - public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search); - public static IdDictionary Search = IdDictionary.Create(); - - public static bool[] AngryBones = Factory.CreateBoolSet(NPCID.AngryBones, NPCID.AngryBonesBig, NPCID.AngryBonesBigMuscle, NPCID.AngryBonesBigHelmet); - - public static bool[] BoundTownNPC = Factory.CreateBoolSet(NPCID.BoundGoblin, NPCID.BoundWizard, NPCID.BoundMechanic, NPCID.SleepingAngler, NPCID.BartenderUnconscious, - NPCID.WebbedStylist, NPCID.GolferRescue); - - public static bool[] Hornet = Factory.CreateBoolSet(NPCID.Hornet, NPCID.HornetFatty, NPCID.HornetHoney, NPCID.HornetLeafy, NPCID.HornetSpikey, NPCID.HornetStingy); + 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.CreateBoolSet(NPCID.Skeleton, NPCID.HeadacheSkeleton, NPCID.MisassembledSkeleton, NPCID.PantlessSkeleton, NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, NPCID.BoneThrowingSkeleton3, NPCID.BoneThrowingSkeleton4, NPCID.SkeletonTopHat, NPCID.SkeletonAstonaut, NPCID.SkeletonAlien, - NPCID.ArmoredSkeleton, NPCID.SkeletonArcher, NPCID.GreekSkeleton, NPCID.SporeSkeleton); + public static bool[] Skeleton = Factory.CreateNamedSet("Skeleton") + .Description("Contains different IDs from vanilla's Skeleton set. Used for dropping Ancient Bone Dust.") + .RegisterBoolSet(NPCID.Skeleton, NPCID.HeadacheSkeleton, NPCID.MisassembledSkeleton, NPCID.PantlessSkeleton, NPCID.BoneThrowingSkeleton, NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, NPCID.BoneThrowingSkeleton4, NPCID.SkeletonTopHat, NPCID.SkeletonAstonaut, NPCID.SkeletonAlien, NPCID.ArmoredSkeleton, NPCID.SkeletonArcher, + NPCID.GreekSkeleton, NPCID.SporeSkeleton); // Unused, though is more restrictive than the vanilla Zombie NPCID set - public static bool[] Zombie = Factory.CreateBoolSet(NPCID.Zombie, NPCID.ArmedZombie, NPCID.BaldZombie, NPCID.PincushionZombie, NPCID.ArmedZombiePincussion, NPCID.SlimedZombie, + public static bool[] Zombie = Factory.CreateNamedSet("Zombie") + .Description("Contains different IDs from vanilla's Zombie set. Unused.") + .RegisterBoolSet(NPCID.Zombie, NPCID.ArmedZombie, NPCID.BaldZombie, NPCID.PincushionZombie, NPCID.ArmedZombiePincussion, NPCID.SlimedZombie, NPCID.ArmedZombieSlimed, NPCID.SwampZombie, NPCID.ArmedZombieSwamp, NPCID.TwiggyZombie, NPCID.ArmedZombieTwiggy, NPCID.FemaleZombie, NPCID.ArmedZombieCenx, NPCID.ZombieRaincoat, NPCID.ZombieEskimo, NPCID.ArmedZombieEskimo, NPCID.MaggotZombie, NPCType()); diff --git a/Systems/Collections/CalamityProjectileSets.cs b/Systems/Collections/CalamityProjectileSets.cs index bd3eb44325..33f4565204 100644 --- a/Systems/Collections/CalamityProjectileSets.cs +++ b/Systems/Collections/CalamityProjectileSets.cs @@ -14,40 +14,46 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityProjectileSets { - public static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search); - public 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.
/// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
/// Defaults to . ///
- public static bool[] MinionWhichIgnoresSummonerNerf = Factory.CreateBoolSet(); + public static bool[] MinionWhichIgnoresSummonerNerf = Factory.CreateNamedSet("MinionWhichIgnoresSummonerNerf") + .Description("Makes this minion ignore the summon damage penalty.") + .RegisterBoolSet(); /// /// 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.CreateBoolSet(ProjectileID.PaladinsHammerHostile, ProjectileID.ShadowBeamHostile, ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, ProjectileID.LostSoulHostile, ProjectileID.SniperBullet, ProjectileID.RocketSkeleton, ProjectileID.BulletDeadeye, ProjectileID.Shadowflames); + public static bool[] IsBuffedDungeonProjectile = Factory.CreateNamedSet("IsBuffedDungeonProjectile") + .Description("Makes this Dungeon projectile get a damage buff after defeating Moon Lord.") + .RegisterBoolSet(ProjectileID.PaladinsHammerHostile, ProjectileID.ShadowBeamHostile, ProjectileID.InfernoHostileBolt, ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, ProjectileID.SniperBullet, ProjectileID.RocketSkeleton, ProjectileID.BulletDeadeye, ProjectileID.Shadowflames); /// /// 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.CreateBoolSet(ProjectileID.FlamingWood, ProjectileID.GreekFire1, ProjectileID.GreekFire2, ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, ProjectileID.FlamingArrow, ProjectileID.PineNeedleHostile, ProjectileID.OrnamentHostile, ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, ProjectileID.FrostShard, ProjectileID.Missile, ProjectileID.Present, ProjectileID.Spike, ProjectileID.BulletDeadeye, ProjectileID.EyeLaser, - ProjectileID.Nail, ProjectileID.DrManFlyFlask); + public static bool[] IsBuffedEventProjectile = Factory.CreateNamedSet("IsBuffedEventProjectile") + .Description("Makes this Pumpkin Moon, Frost Moon, or Solar Eclipse projectile get a damage buff after defeating Devourer of Gods.") + .RegisterBoolSet(ProjectileID.FlamingWood, ProjectileID.GreekFire1, ProjectileID.GreekFire2, ProjectileID.GreekFire3, ProjectileID.FlamingScythe, ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, ProjectileID.OrnamentHostile, ProjectileID.OrnamentHostileShrapnel, ProjectileID.FrostWave, ProjectileID.FrostShard, ProjectileID.Missile, + ProjectileID.Present, ProjectileID.Spike, ProjectileID.BulletDeadeye, ProjectileID.EyeLaser, ProjectileID.Nail, ProjectileID.DrManFlyFlask); /// /// If for a projectile type, then that projectile is considered a friendly bee.
/// Used to allow the projectile to inflict Plague while wearing the Plaguebringer armor.
/// Defaults to . ///
- public static bool[] IsFriendlyBeeProjectile = Factory.CreateBoolSet(ProjectileID.GiantBee, ProjectileID.Bee, ProjectileID.Wasp, ProjectileID.Hornet,ProjectileID.HornetStinger, ProjectileType(), + public static bool[] IsFriendlyBeeProjectile = Factory.CreateNamedSet("IsFriendlyBeeProjectile") + .Description("Labels this projectile as a friendly bee, used to make it inflict Plague with Plaguebringer armor.") + .RegisterBoolSet(ProjectileID.GiantBee, ProjectileID.Bee, ProjectileID.Wasp, ProjectileID.Hornet,ProjectileID.HornetStinger, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()); /// @@ -55,9 +61,11 @@ namespace CalamityMod.Systems.Collections /// Used to provide early-game worm bosses a resistance to their explosive damage.
/// Defaults to . ///
- public static bool[] ResistedExplosiveProjectile = Factory.CreateBoolSet(ProjectileID.Grenade, ProjectileID.StickyGrenade, ProjectileID.BouncyGrenade, ProjectileID.Bomb, - ProjectileID.StickyBomb, ProjectileID.BouncyBomb, ProjectileID.Dynamite, ProjectileID.StickyDynamite, ProjectileID.BouncyDynamite, ProjectileID.Explosives, - ProjectileID.ExplosiveBunny, ProjectileID.PartyGirlGrenade, ProjectileID.BombFish, ProjectileID.ScarabBomb, ProjectileID.TNTBarrel, ProjectileType()); + public static bool[] ResistedExplosiveProjectile = Factory.CreateNamedSet("ResistedExplosiveProjectile") + .Description("Makes this grenade/bomb/dynamite projectile be resisted by earlygame worm bosses.") + .RegisterBoolSet(ProjectileID.Grenade, ProjectileID.StickyGrenade, ProjectileID.BouncyGrenade, ProjectileID.Bomb, ProjectileID.StickyBomb, ProjectileID.BouncyBomb, + ProjectileID.Dynamite, ProjectileID.StickyDynamite, ProjectileID.BouncyDynamite, ProjectileID.Explosives, ProjectileID.ExplosiveBunny, ProjectileID.PartyGirlGrenade, + ProjectileID.BombFish, ProjectileID.ScarabBomb, ProjectileID.TNTBarrel, ProjectileType()); /// /// If for a projectile type, then that projectile will never be reflected by armor or accessory effects.
@@ -65,23 +73,38 @@ namespace CalamityMod.Systems.Collections /// Only needs to be set for hostile projectiles, as these effects already have a check to ensure they never trigger in PvP.
/// Defaults to . ///
- public static bool[] ShouldNotBeReflected = Factory.CreateBoolSet(ProjectileID.SaucerDeathray, ProjectileID.PhantasmalDeathray, ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType()); + public static bool[] ShouldNotBeReflected = Factory.CreateNamedSet("ShouldNotBeReflected") + .Description("Prevents this projectile from being reflected by armor or accessory effects.") + .RegisterBoolSet(ProjectileID.SaucerDeathray, ProjectileID.PhantasmalDeathray, ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType()); /// /// If for a projectile type, then that projectile will be blacklisted from receiving the homing effect of Grape Beer.
/// Defaults to . ///
- public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateBoolSet(ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()); + public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateNamedSet("DoesNotGetHomingWithGrapeBeer") + .Description("Prevents this projectile from receiving homing from Grape Beer.") + .RegisterBoolSet(ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType()); + + /// + /// If for a projectile type, then that projectile will be unable to trigger Daawnlight Spirit Origin's bullseyes.
+ /// Defaults to . + ///
+ public static bool[] DaawnlightBlacklist = Factory.CreateNamedSet("DaawnlightBlacklist") + .Description("Prevents this projectile from triggering Daawnlight Spirit Origin's bullseyes.") + .RegisterBoolSet(ProjectileType(), ProjectileType(), ProjectileType()); /// /// Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.
/// Each "set" of projectile which shares immunity frames is registered to point to the same ID reference, usually the first projectile in the set. If a projectile with this reference hits an NPC, all other projectiles with that reference also have their ID-static immunity cooldown set for that NPC. ///
- public static int[] SharedIDStaticIFrames = Factory.CreateIntSet(-1, + public static int[] SharedIDStaticIFrames = Factory.CreateNamedSet("SharedIDStaticIFrames") + .Description("Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.") + .RegisterIntSet(-1, // Vanilla bees ProjectileID.Bee, ProjectileID.Bee, ProjectileID.GiantBee, ProjectileID.Bee, diff --git a/Systems/Collections/CalamityTileSets.cs b/Systems/Collections/CalamityTileSets.cs index 2000210565..b4336e4360 100644 --- a/Systems/Collections/CalamityTileSets.cs +++ b/Systems/Collections/CalamityTileSets.cs @@ -11,26 +11,33 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityTileSets { - public static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search); - public 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.
- /// Unused by Calamity itself, and is only used for external mods to add to through reflection.
+ /// Unused by Calamity itself, and is only used for external mods.
/// Defaults to . ///
- public static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateBoolSet(); + internal static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateNamedSet("CanBeReplacedByAbyssGeneration") + .Description("Allows the tile to be replaced by the Abyss during world generation.") + .RegisterBoolSet(); /// /// If for a tile type, it will not perform its BlendMerge in the PostDraw hook, and instead will be drawn after every solid tile has been drawn to the screen.
/// Defaults to . ///
- public static bool[] DrawBlendMergeAfterSolidTile = Factory.CreateBoolSet(TileType()); + internal static bool[] DrawBlendMergeAfterSolidTile = Factory.CreateNamedSet("DrawBlendMergeAfterSolidTile") + .Description("Causes this tile to have blending be drawn after all solid tiles.") + .RegisterBoolSet(TileType()); /// - /// If for a tile type, it will be considered an Abyss background wall for various effects. - /// Defaults to + /// If for a tile type, it will be considered an Abyss background wall.
+ /// Used for spawning water when breaking Abyss tiles, discouraging Teleportation Potion teleporting, and spawning Primordial Wyrm when using Potion of Return.
+ /// Defaults to . ///
- public static bool[] IsAbyssWall = Factory.CreateBoolSet(WallType(), WallType(), WallType(), WallType(), WallType(), WallType()); + internal static bool[] IsAbyssWall = Factory.CreateNamedSet("IsAbyssWall") + .Description("Labels this wall as an Abyss wall.") + .RegisterBoolSet(WallType(), WallType(), WallType(), WallType(), + WallType(), WallType()); } } 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 741a5fe91b..cbbcf7e4d8 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -739,13 +739,12 @@ namespace CalamityMod.Systems { { Vanilla(ItemID.MiniNukeI), Disable }, { Vanilla(ItemID.MiniNukeII), Disable }, + { Vanilla(ItemID.ReconScope), Disable }, // Make various things cheaper (sorted by progression) { 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) }, @@ -794,9 +793,6 @@ namespace CalamityMod.Systems // Add 20 Souls of Flight to vanilla Luminite wings { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), LunarWingsRecipeEdits }, - - // Berserker's Glove recipe change now that it doesn't provide melee speed - { Vanilla(ItemID.BerserkerGlove), ReplaceIngredient(ItemID.PowerGlove, ItemID.TitanGlove) }, }; // Apply all recipe changes. @@ -846,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); @@ -1231,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(); @@ -1240,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); @@ -1277,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); @@ -1320,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(); @@ -1385,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(); @@ -1547,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 @@ -1616,7 +1554,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Silk, 10); r.AddIngredient(ItemID.AntlionMandible, 2); r.AddIngredient(5); - r.AddTile(TileID.Anvils); + r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); @@ -1728,6 +1666,13 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Tiershift Recon Scope to post Plantera. + r = Recipe.Create(ItemID.ReconScope); + r.AddIngredient(ItemID.RifleScope); + r.AddIngredient(ItemID.PutridScent); + r.AddTile(TileID.TinkerersWorkbench); + r.Register(); + // Tiershift Mini Nuke 1s to post Moon Lord. r = Recipe.Create(ItemID.MiniNukeI, 333); r.AddIngredient(ItemID.RocketIII, 333); diff --git a/Systems/Mechanic/TrustyOldRodEnemySystem.cs b/Systems/Mechanic/TrustyOldRodEnemySystem.cs new file mode 100644 index 0000000000..dacc8fdc69 --- /dev/null +++ b/Systems/Mechanic/TrustyOldRodEnemySystem.cs @@ -0,0 +1,700 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.Deconstructors; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Walls.DraedonStructures; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public sealed class TrustyOldRodEnemySystem : ModSystem + { + // Spawning for Trusty Old Rod NPCs, each biome has spawns of different rarity and sometimes style + // 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.FirstOrDefault(p => p.identity == bobberWhoAmI); + bool common = rarity == 1; + bool rare = rarity == 2; + bool ultraRare = rarity == 3; + bool hardmode = Main.hardMode; + bool postML = NPC.downedMoonlord; + int fallbackNPC = NPCID.Ghost; // If all biome checks fail, spawn a ghost + + bool night = !Main.dayTime; + bool rain = Main.raining; + bool underground = owner.ZoneDirtLayerHeight || owner.ZoneRockLayerHeight; + // 1/3 chance to use preHM spawnpool in hardmode + bool useHardmode = hardmode && Main.rand.NextBool(2, 3); + + // ReduceEnemyDrops is used for some reels that pull crazy numbers of enemies by making 1/3rd of them not drop loot + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsCommon = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsRare = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsUltraRare = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + + Tile backWall = Framing.GetTileSafely((int)(owner.Center.X / 16), (int)(owner.Center.Y / 16)); + + #region GetSpawns + + if (!Honey && !Lava) + { + if (Main.bloodMoon && !underground) + { + // 5 Dripplers + if (common) { npcIDsCommon.Add((NPCID.Drippler, 5, false)); } // Common NPC/s + // 10 Blood Zombies + else if (rare) { npcIDsRare.Add((NPCID.BloodZombie, 10, false)); } // Rare NPC/s + // 1 Ravager + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + if (Main.eclipse && !underground) // Eclipse takes priority over surface spawns + { + // 1/3 chance to use the pre Plant pool instead + bool postPlant = NPC.downedPlantBoss && Main.rand.NextBool(2, 3); + bool downedMechs = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; + // 5 Creatures from the Eclipse, some tierlocked + int pickCommonEclipse = Main.rand.Next((downedMechs ? 0 : 1), (NPC.downedPlantBoss ? 7 : 3)) switch + { + 0 => NPCID.Reaper, // Only available post 3 mechs + + 1 => NPCID.CreatureFromTheDeep, + 2 => NPCID.ThePossessed, + + 3 => NPCID.DeadlySphere, // Only available post Plant + 4 => NPCID.DrManFly, + 5 => NPCID.Psycho, + _ => NPCID.Butcher + }; + + if (common) { npcIDsCommon.Add((pickCommonEclipse, 5, false)); } // Common NPC/s + // 8 Nailheads post Plant, otherwise 8 Vampires + else if (rare) { npcIDsRare.Add((postPlant ? NPCID.Nailhead : NPCID.Vampire, 8, false)); } // Rare NPC/s + // 5 Eyezors, 5 Mothrons post Plant + else if (ultraRare) { npcIDsUltraRare.Add((postPlant ? NPCID.Mothron : NPCID.Eyezor, 5, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneForest) + { + bool wulfrum = !night && Main.rand.NextBool(3); + int tooManyZombies = Main.rand.Next(15) switch + { + 0 => NPCID.Zombie, + 1 => NPCID.BaldZombie, + 2 => NPCID.PincushionZombie, + 3 => NPCID.SlimedZombie, + 4 => NPCID.SwampZombie, + 5 => NPCID.TwiggyZombie, + 6 => NPCID.FemaleZombie, + 7 => NPCID.TorchZombie, + 8 => NPCID.ArmedZombie, + 9 => NPCID.ArmedZombiePincussion, + 10 => NPCID.ArmedZombieSlimed, + 11 => NPCID.ArmedZombieSwamp, + 12 => NPCID.ArmedZombieTwiggy, + 13 => NPCID.ArmedZombieCenx, + _ => NPCID.ArmedTorchZombie, + }; + + // All spawns are in groups of 2 + // hardmode: Wraith or Wandering Eye, or Purple Slime if daytime + // nonHM pool: Zombie or Raincoat Zombie if raining, either Blue Slime or Green Slime if daytime or 1/3 chance for either Wulfrum Rover or Wulfrom Drone + int pickCommonForest = useHardmode ? (night ? Main.rand.NextBool() ? NPCID.Wraith : NPCID.WanderingEye : NPCID.PurpleSlime) : + (wulfrum ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : + night ? rain ? NPCID.ZombieRaincoat : tooManyZombies : + Main.rand.NextBool() ? NPCID.BlueSlime : NPCID.GreenSlime); + // If hardmode and night, 1 Mimic. + // nonHM pool: 1/3 chance for 1 Wulfrum Amplifier, else if raining 1 Fearless Goldfish Warrior, otherwise 8 Zombies if night or 3 Clad Crabs if daytime + int pickRareForest = useHardmode && night ? NPCID.Mimic : + (wulfrum ? ModContent.NPCType() : rain ? ModContent.NPCType() : + night ? tooManyZombies : ModContent.NPCType()); + int pickRareForestEnemyCount = useHardmode && night ? 1 : + (night && !rain && !wulfrum) ? 8 : wulfrum || rain ? 1 : 3; + // if hardmode, 20 Mimics at night or 20 Pinkys at daytime + // nonHM pool: Eye of Cthulhu if night or King Slime if daytime, 5 if hardmode and 15 if postML + int pickUltraRareForest = useHardmode ? night ? NPCID.Mimic : NPCID.Pinky : + (night ? NPCID.EyeofCthulhu : NPCID.KingSlime); + + if (common) { npcIDsCommon.Add((pickCommonForest, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareForest, pickRareForestEnemyCount, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareForest, useHardmode ? 20 : 1, useHardmode)); } // Ultra Rare NPC/s + } + if (owner.ZoneCorrupt) + { + if (underground && hardmode) // if preHM, use the surface pool for underground + { + // 1 World Feeder + if (common) { npcIDsCommon.Add((NPCID.SeekerHead, 1, false)); } // Common NPC/s + // 3 Cursed Hammers + else if (rare) { npcIDsRare.Add((NPCID.CursedHammer, 3, false)); } // Rare NPC/s + // 20 Corrupt Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicCorruption, 20, true)); } // Ultra Rare NPC/s + } + else + { + // 1 Devourer or 3 Corruptors if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.Corruptor : NPCID.DevourerHead, useHardmode ? 3 : 1, false)); } // Common NPC/s + // 8 Eater of Souls or 8 Slimers if hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.Slimer : NPCID.EaterofSouls, 8, false)); } // Rare NPC/s + // 1 Hive Mind + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneCrimson) + { + if (underground && hardmode) // if preHM, use the surface pool for underground + { + // 2 Ichor Stickers + if (common) { npcIDsCommon.Add((NPCID.IchorSticker, 2, false)); } // Common NPC/s + // 3 Crimson Axes + else if (rare) { npcIDsRare.Add((NPCID.CrimsonAxe, 3, false)); } // Rare NPC/s + // 20 Crimson Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicCrimson, 20, true)); } // Ultra Rare NPC/s + } + else + { + // 3 Crimeras or 3 Herplings if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.Herpling : NPCID.Crimera, 3, false)); } // Common NPC/s + // 8 Face Monsters or 8 Crimslimes if hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.Crimslime : NPCID.FaceMonster, 8, false)); } // Rare NPC/s + // 1 Perforator Hive + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneHallow) + { + if (underground) + { + // 2 Chaos Elementals + if (common) { npcIDsCommon.Add((NPCID.ChaosElemental, 2, false)); } // Common NPC/s + // 3 Enchanted Swords + else if (rare) { npcIDsRare.Add((NPCID.EnchantedSword, 3, false)); } // Rare NPC/s + // 20 Hallowed Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicHallow, 20, true)); } // Ultra Rare NPC/s + } + else + { + bool profaned = postML && Main.rand.NextBool(4); + // 3 Pixies at daytime, 3 Gastropods at night + if (common) { npcIDsCommon.Add((profaned ? ModContent.NPCType() : night ? NPCID.Gastropod : NPCID.Pixie, profaned ? 5 : 3, false)); } // Common NPC/s + // 3 Unicorns or 3 Rainbow Slimes if raining + else if (rare) { npcIDsRare.Add((profaned ? ModContent.NPCType() : rain ? NPCID.RainbowSlime : NPCID.Unicorn, 3, false)); } // Rare NPC/s + // 1 Queen Slime or 2/3 for 1 Empress if post Plant + else if (ultraRare) { npcIDsUltraRare.Add((profaned ? ModContent.NPCType() : NPC.downedPlantBoss && Main.rand.NextBool(2, 3) ? NPCID.HallowBoss : NPCID.QueenSlimeBoss, 1, false)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneSnow) + { + if (underground) + { + bool flinx = Main.rand.NextBool(3); + int pigron = owner.ZoneHallow ? NPCID.PigronHallow : owner.ZoneCrimson ? NPCID.PigronCrimson : owner.ZoneCorrupt ? NPCID.PigronCorruption : 0; + // 2 Undead Vikings, if hardmode 2 Ice Claspers or 2 Ice Tortoises. 2 Pigrons if also in Hallow/Corruption/Crimson + int pickRareUGSnow = (pigron != 0 && hardmode) ? pigron : (useHardmode ? (Main.rand.NextBool() ? ModContent.NPCType() : NPCID.IceTortoise) : NPCID.UndeadViking); + + // 3 Ice Bat or 1/3 for 2 Snow Flinx + if (common) { npcIDsCommon.Add((flinx ? NPCID.SnowFlinx : NPCID.IceBat, flinx ? 2 : 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGSnow, 2, false)); } // Rare NPC/s + // 3 Ice Mimics if hardmode, otherwise 50 Ice bats + else if (ultraRare) { npcIDsUltraRare.Add((!hardmode ? NPCID.IceBat : NPCID.IceMimic, !hardmode ? 50 : 3, !hardmode)); } // Ultra Rare NPC/s + } + else + { + // If hardmode 2 Ice Elementals if night or 2 Aurora Spirits if day, otherwise 2 Frozen Zombies if night or 2 Ice Slimes if day + int pickCommonSnow = useHardmode ? (night ? NPCID.IceElemental : ModContent.NPCType()) : night ? NPCID.ZombieEskimo : NPCID.IceSlime; + // If hardmode and blizzard 1 Ice Golem, otherwise 3 Cryons if hardmode or 3 Rimehounds in preHM + int pickRareSnow = hardmode && rain ? NPCID.IceGolem : useHardmode ? ModContent.NPCType() : ModContent.NPCType(); + + if (common) { npcIDsCommon.Add((pickCommonSnow, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareSnow, (hardmode && rain) ? 1 : 3, false)); } // Rare NPC/s + // 50 Snow Flinx preHM, 1 Cryogen in harmdode + else if (ultraRare) { npcIDsUltraRare.Add((useHardmode ? ModContent.NPCType() : NPCID.SnowFlinx, useHardmode ? 1 : 50, (!postML && !useHardmode))); } // Ultra Rare NPC/s + } + } + if (owner.ZoneUndergroundDesert) + { + bool golferCheck = !NPC.savedGolfer && !NPC.AnyNPCs(NPCID.GolferRescue); + int ghoul = owner.ZoneHallow ? NPCID.DesertGhoulHallow : owner.ZoneCrimson ? NPCID.DesertGhoulCrimson : owner.ZoneCorrupt ? NPCID.DesertGhoulCorruption : NPCID.DesertGhoul; + + // 1/4 for 10 Antlion Larva, otherwise either 2 Antlion Swarmers, 2 Antlion Chargers, or 2 Stormlions + bool larva = Main.rand.NextBool(4); + int pickCommonUGDesert = larva ? NPCID.LarvaeAntlion : Main.rand.Next(3) switch + { + 0 => NPCID.GiantWalkingAntlion, + 1 => NPCID.GiantFlyingAntlion, + _ => ModContent.NPCType() + }; + // Golfer if he hasn't been saved, either 2 Ghouls (sub-biome dependant) or 2 Lamias (sub-biome dependant) if hardmode, otherwise Tomb Crawler + int pickRareUGDesert = golferCheck ? NPCID.GolferRescue : !useHardmode ? NPCID.TombCrawlerHead : + Main.rand.NextBool() ? ghoul : ((owner.ZoneCorrupt || owner.ZoneCrimson) ? NPCID.DesertLamiaDark : NPCID.DesertLamiaLight); + + if (common) { npcIDsCommon.Add((pickCommonUGDesert, larva ? 10 : 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGDesert, golferCheck || !useHardmode ? 1 : 2, false)); } // Rare NPC/s + // 1 Desert Scourge + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneDesert) + { + bool sandstorm = Sandstorm.Happening; + int mummy = owner.ZoneHallow ? NPCID.LightMummy : owner.ZoneCrimson ? NPCID.BloodMummy : owner.ZoneCorrupt ? NPCID.DarkMummy : NPCID.Mummy; + int sandShark = owner.Calamity().ZoneAstral ? ModContent.NPCType() : owner.ZoneHallow ? NPCID.SandsharkHallow : owner.ZoneCrimson ? NPCID.SandsharkCrimson : owner.ZoneCorrupt ? NPCID.SandsharkCorrupt : NPCID.SandShark; + // 2 Sand Sharks if hardmode sandstorm (sub-biome dependant), otherwise 2 Angry Tumblers. + // If no sandstorm 2 Mummys (sub-biome dependant) in hardmode, otherwise 2 Vultures (Hadarians if in Astral) + int pickCommonDesert = sandstorm ? (useHardmode ? sandShark : NPCID.Tumbleweed) : + useHardmode ? mummy : owner.Calamity().ZoneAstral ? ModContent.NPCType() : NPCID.Vulture; + // Sand Elemental if hardmode sandstorm, otherwise 5 Angry Tumblers. If no sandstorm 5 Antlion Chargers or 5 Antlion Swarmers + int pickRareDesert = sandstorm ? (hardmode ? NPCID.SandElemental : NPCID.Tumbleweed) : + Main.rand.NextBool() ? NPCID.WalkingAntlion : NPCID.FlyingAntlion; + + if (common) { npcIDsCommon.Add((pickCommonDesert, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareDesert, sandstorm && hardmode ? 1 : 5, false)); } // Rare NPC/s + // 3 Cnidrions or 3 Great Sand Sharks if post Plant + else if (ultraRare) { npcIDsUltraRare.Add((NPC.downedPlantBoss ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneBeach && !owner.Calamity().ZoneSulphur) + { + // 2 Squid, Sea Snails, or Sharks. Can also be Mantis Shrimp post Plant + int pickRareOcean = Main.rand.Next(3 + (hardmode ? 1 : 0)) switch + { + 0 => NPCID.Squid, + 1 => NPCID.SeaSnail, + 2 => NPCID.Shark, + _ => ModContent.NPCType() + }; + // 2 Pink Jellyfish or Crabs + if (common) { npcIDsCommon.Add((Main.rand.NextBool() ? NPCID.PinkJellyfish : NPCID.Crab, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareOcean, 2, false)); } // Rare NPC/s + // 1 Anahita + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.Calamity().ZoneSulphur) + { + bool acidRain = AcidRainEvent.AcidRainEventIsOngoing; + bool tier3 = DownedBossSystem.downedPolterghast; + bool tier2 = tier3 || DownedBossSystem.downedAquaticScourge; + // In Acid Rain 1/3 for 3 Gamma Slimes if tier 3, else pulls from the tier 2 enemy list and then tier 1. + // If no Acid Rain, spawns 3 Trashers, Gnashers, or Aquatic Urchins + int pickCommonSulphor = Main.rand.Next(3) switch + { + 0 => acidRain ? (tier3 ? ModContent.NPCType() : tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + 1 => acidRain ? (tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + _ => acidRain ? (tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + }; + // 50% chance to use an abyss pool instead for rare pulls (when not acid rain) + bool abyssSpawns = Main.rand.NextBool(); + // In Acid Rain if tier 3 pulls 1 Mauler or Nuclear Terror. If tier 2, pulls 1 Cragmaw Mire, or Acid Eel if tier 1 + // If no Acid Rain either Anthozoan Crab or Belching Coral if post Aquatic Scourge, otherwise either Viperfish or Giant Squid + int pickRareSulphor = acidRain ? (tier3 ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : + tier2 ? ModContent.NPCType() : ModContent.NPCType()) : + (tier2 ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : ModContent.NPCType()); + // Post Polter 1/3 chance for Reaper Shark or Eidolon Wyrm, else 1/2 chance for 3 Devil Fish or 3 Chaotic Puffer, else 3 Viperfish or 3 Cuttlefish + bool bigAbyssSpawn = Main.rand.NextBool(3); + int pickRareSulphorAbyss = tier3 && bigAbyssSpawn ? (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()) : + tier2 && Main.rand.NextBool() ? (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()) : + (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()); + + bool spawnSingular = (acidRain && (tier2 || tier3)) || (bigAbyssSpawn && abyssSpawns); + if (common) { npcIDsCommon.Add((pickCommonSulphor, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add(((abyssSpawns && !acidRain) ? pickRareSulphorAbyss : pickRareSulphor, spawnSingular ? 1 : 3, false)); } // Rare NPC/s + // Primordial Wyrm + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneDungeon) + { + bool postPlantDungeon = NPC.downedPlantBoss && Main.rand.NextBool(3, 4); + bool tileWall = backWall.WallType == WallID.PinkDungeonTileUnsafe || backWall.WallType == WallID.GreenDungeonTileUnsafe || backWall.WallType == WallID.BlueDungeonTileUnsafe; + bool slabWall = backWall.WallType == WallID.PinkDungeonSlabUnsafe || backWall.WallType == WallID.GreenDungeonSlabUnsafe || backWall.WallType == WallID.BlueDungeonSlabUnsafe; + bool brickWall = backWall.WallType == WallID.PinkDungeonUnsafe || backWall.WallType == WallID.GreenDungeonUnsafe || backWall.WallType == WallID.BlueDungeonUnsafe; + + int tooManyAngryBones = Main.rand.Next(4) switch + { + 0 => NPCID.AngryBones, + 1 => NPCID.AngryBonesBig, + 2 => NPCID.AngryBonesBigMuscle, + _ => NPCID.AngryBonesBigHelmet, + }; + int tooManyBlueBones = Main.rand.Next(4) switch + { + 0 => NPCID.BlueArmoredBones, + 1 => NPCID.BlueArmoredBonesMace, + 2 => NPCID.BlueArmoredBonesNoPants, + _ => NPCID.BlueArmoredBonesSword, + }; + int tooManyHellBones = Main.rand.Next(4) switch + { + 0 => NPCID.HellArmoredBones, + 1 => NPCID.HellArmoredBonesMace, + 2 => NPCID.HellArmoredBonesSpikeShield, + _ => NPCID.HellArmoredBonesSword, + }; + int tooManyRustyBones = Main.rand.Next(4) switch + { + 0 => NPCID.RustyArmoredBonesAxe, + 1 => NPCID.RustyArmoredBonesFlail, + 2 => NPCID.RustyArmoredBonesSword, + _ => NPCID.RustyArmoredBonesSwordNoArmor, + }; + + // 3 of the basic "Bones" type enemy for the dungeon wall type. 3 Angry bones pre Plant (or if somehow another wall type) + int pickCommonDungeon = !postPlantDungeon ? tooManyAngryBones : + brickWall ? tooManyBlueBones : tileWall ? tooManyHellBones : slabWall ? tooManyRustyBones : tooManyAngryBones; + // 2 Dark Casters or Cursed Skulls, if post Plant instead get either a 2 "Skeleton Mages" or 2 "Skeleton Rangers" based on background wall + bool getMage = Main.rand.NextBool(); + int pickRareDungeon = !postPlantDungeon ? (Main.rand.NextBool() ? NPCID.DarkCaster : NPCID.CursedSkull) : !getMage ? (tileWall ? NPCID.TacticalSkeleton : slabWall ? NPCID.SkeletonSniper : brickWall ? NPCID.SkeletonCommando : tooManyAngryBones) : + (tileWall ? Main.rand.NextBool() ? NPCID.DiabolistWhite : NPCID.DiabolistRed : + slabWall ? Main.rand.NextBool() ? NPCID.RaggedCaster : NPCID.RaggedCasterOpenCoat : + brickWall ? Main.rand.NextBool() ? NPCID.Necromancer : NPCID.NecromancerArmored : tooManyAngryBones); + // 10 Dungeon Slimes pre Plant, 1 Cultist post Plant, 1 Polterghast postML + int pickUltraRareDungeon = postML ? ModContent.NPCType() : postPlantDungeon ? NPCID.CultistBoss : NPCID.DungeonSlime; + + if (common) { npcIDsCommon.Add((pickCommonDungeon, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareDungeon, 2, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareDungeon, (postML || postPlantDungeon) ? 1 : 10, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneSkyHeight) + { + bool probe = NPC.downedGolemBoss && Main.rand.NextBool(10); + bool shuttle = hardmode && Main.rand.NextBool(4); + // 1/10 to be Martian Probe post Golem, otherwise if hardmode a 1/4 to be 3 Shockstorm Shuttles, otherwise 1 Wyvern or 1 Cloud Elemental if it's also raining. 7 Harpys if preHM + int pickRareSky = probe ? NPCID.MartianProbe : hardmode ? Main.raining ? ModContent.NPCType() : + shuttle ? ModContent.NPCType() : NPCID.WyvernHead : NPCID.Harpy; + + // 1/4 to be 3 Harpys, otherwise 3 Sunskaters + if (common) { npcIDsCommon.Add((Main.rand.NextBool(4) ? NPCID.Harpy : ModContent.NPCType(), 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareSky, ((hardmode && !shuttle) || (hardmode && Main.raining) || probe) ? 1 : shuttle ? 3 : 7, false)); } // Rare NPC/s + // 100 Sunskaters + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 100, true)); } // Ultra Rare NPC/s + } + if (backWall.WallType == WallID.SpiderUnsafe && underground) // Spider caves (Priority over Caverns and Mushroom and Granite/Marble) + { + bool stylistCheck = !NPC.savedStylist && !NPC.AnyNPCs(NPCID.WebbedStylist); + // Astralachnea/Blood Crawlers always take the place of normal spiders if in Astral/Crimson + int pickASpider = owner.Calamity().ZoneAstral ? ModContent.NPCType() : owner.ZoneCrimson ? NPCID.BloodCrawler : useHardmode ? NPCID.BlackRecluse : NPCID.WallCreeper; + // 2 Wall Creepers/Black Recluses (HM) + if (common) { npcIDsCommon.Add((pickASpider, 2, false)); }// Common NPC/s + // Stylist if she hasn't been saved, otherwise 10 Wall Creepers/Black Recluses (HM) + else if (rare) { npcIDsRare.Add((stylistCheck ? NPCID.WebbedStylist : pickASpider, stylistCheck ? 1 : 10, false)); } // Rare NPC/s + // 100 Wall Creepers/Black Recluses (HM), always Black Recluses in hardmode + else if (ultraRare) { npcIDsUltraRare.Add((owner.Calamity().ZoneAstral ? ModContent.NPCType() : hardmode ? NPCID.BlackRecluse : NPCID.WallCreeper, 100, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneGlowshroom) // (Priority over Caverns and Granite/Marble) + { + // 3 Spore Bats + if (common) { npcIDsCommon.Add((NPCID.SporeBat, 3, false)); } // Common NPC/s + // 1/10 for 2 Truffle Worms, 9/10 for 2 Anomura Fungus + else if (rare) { npcIDsRare.Add(Main.rand.NextBool(10) ? (NPCID.TruffleWorm, 2, false) : (NPCID.AnomuraFungus, 2, false)); } // Rare NPC/s + // 1 Crabulon + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneGranite || owner.ZoneMarble) // (Priority over Caverns) + { + if (owner.ZoneGranite) + { + // 3 Granite Elementals + if (common) { npcIDsCommon.Add((NPCID.GraniteFlyer, 3, false)); } // Common NPC/s + // 4 Granite Golems + else if (rare) { npcIDsRare.Add((NPCID.GraniteGolem, 4, false)); } // Rare NPC/s + // 25 Diamond Crawlers + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 25, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneMarble) + { + // 2 Hoplites + if (common) { npcIDsCommon.Add((NPCID.GreekSkeleton, 2, false)); } // Common NPC/s + // 15 Hoplites, in hardmode 2 Medusas instead + else if (rare) { npcIDsRare.Add(useHardmode ? (NPCID.Medusa, 2, false) : (NPCID.GreekSkeleton, 15, true)); } // Rare NPC/s + // 25 Diamond Crawlers + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 25, true)); } // Ultra Rare NPC/s + } + } + else if (owner.ZoneNormalCaverns) + { + bool goblinCheck = NPC.downedGoblins && !NPC.savedGoblin && !NPC.AnyNPCs(NPCID.BoundGoblin); + bool wizardCheck = hardmode && !NPC.savedWizard && !NPC.AnyNPCs(NPCID.BoundWizard); + int tooManyLizards = Main.rand.Next(9) switch + { + 0 => NPCID.Salamander, + 1 => NPCID.Salamander2, + 2 => NPCID.Salamander3, + 3 => NPCID.Salamander4, + 4 => NPCID.Salamander5, + 5 => NPCID.Salamander6, + 6 => NPCID.Salamander7, + 7 => NPCID.Salamander8, + _ => NPCID.Salamander9 + }; + int tooManySkeletons = Main.rand.Next(8) switch + { + 0 => NPCID.Skeleton, + 1 => NPCID.HeadacheSkeleton, + 2 => NPCID.MisassembledSkeleton, + 3 => NPCID.PantlessSkeleton, + 4 => NPCID.BoneThrowingSkeleton, + 5 => NPCID.BoneThrowingSkeleton2, + 6 => NPCID.BoneThrowingSkeleton3, + _ => NPCID.BoneThrowingSkeleton4 + }; + // 2/3 for 3 Cave Bats (3 Giant Bats in HM), otherwise a singular Shelly, Crawdad, Salamander, or Skeleton + bool bats = Main.rand.NextBool(2, 3); + int pickCommonCaverns = Main.rand.Next(4) switch + { + 0 => Main.rand.NextBool() ? NPCID.GiantShelly : NPCID.GiantShelly2, + 1 => tooManyLizards, // One of the 9 Salamander variants + 2 => Main.rand.NextBool() ? NPCID.Crawdad : NPCID.Crawdad2, + _ => tooManySkeletons, // One of the many Skeletons (does not include the small/big variants, but does include bone throwing variants) + }; + // Gobin if he hasn't been saved and the invasion has been cleared or Wizard if hardmode, + // otherwise an Undead Miner, Tim, or Nymph (Most often Undead Miner (70%), otherwise can be a Tim or Nymph (15% each)) + int randNum = Main.rand.Next(1, 100 + 1); + int pickRareCaverns = (randNum > 30 ? NPCID.UndeadMiner : randNum <= 15 ? NPCID.Nymph : NPCID.Tim); + // 15 Mother Slimes, or if harmode either 35 Armored or Archer Skeletons, 2/3 chance postML for 35 Overloaded Soldiers + int pickUltraRareCaverns = postML && Main.rand.NextBool(2, 3) ? ModContent.NPCType() : hardmode ? Main.rand.NextBool() ? NPCID.ArmoredSkeleton : NPCID.SkeletonArcher : NPCID.MotherSlime; + + if (common) { npcIDsCommon.Add((bats ? (useHardmode ? NPCID.GiantBat : NPCID.CaveBat) : pickCommonCaverns, bats ? 3 : 1, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((goblinCheck ? NPCID.BoundGoblin : wizardCheck ? NPCID.BoundWizard : pickRareCaverns, 1, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareCaverns, (!hardmode && !postML) ? 15 : 35, true)); } // Ultra Rare NPC/s + + } + else if (owner.ZoneNormalUnderground) + { + // Giant Worm or Digger if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.DiggerHead : NPCID.GiantWormHead, 1, true)); } // Common NPC/s + // 1/2 for 7 Red Slimes, otherwise 7 Yellow Slimes, 7 Toxic Sludge instead in Hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.ToxicSludge : Main.rand.NextBool() ? NPCID.RedSlime : NPCID.YellowSlime, 7, false)); } // Rare NPC/s + // 1/3 for 50 Green Jellyfish, otherwise 50 Blue Jellyfish + else if (ultraRare) { npcIDsUltraRare.Add((Main.rand.NextBool(3) ? NPCID.GreenJellyfish : NPCID.BlueJellyfish, 50, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneLihzhardTemple) // (Priority over Jungle) + { + // 3 Lihzahrds + if (common) { npcIDsCommon.Add((NPCID.Lihzahrd, 3, false)); } // Common NPC/s + // 5 Flying Snakes or Bohldohrs + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? NPCID.FlyingSnake : ModContent.NPCType(), 5, false)); } // Rare NPC/s + // 1 Golem + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.Golem, 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneJungle) + { + bool plagueSpawns = NPC.downedGolemBoss && Main.rand.NextBool(2, 3); + // Underground Jungle + if (underground) + { + int tooManyHornets = Main.rand.Next(6) switch + { + 0 => NPCID.Hornet, + 1 => NPCID.HornetFatty, + 2 => NPCID.HornetHoney, + 3 => NPCID.HornetLeafy, + 4 => NPCID.HornetSpikey, + _ => NPCID.HornetStingy, + }; + bool hornets = Main.rand.NextBool(4); + // 2 Giant Tortoises or Jungle Creeper if hardmode, 2 Jungle Slimes if not. Chance to be 2 Plagueshells if plague + int pickCommonUGJungle = plagueSpawns ? ModContent.NPCType() : useHardmode ? Main.rand.NextBool() ? NPCID.GiantTortoise : NPCID.JungleCreeper : NPCID.JungleSlime; + // 1/4 chance to be 22 Hornets (Moss Hornets if hardmode, chance for Plague Chargers if plague), otherwise a Moth in hardmode or 5 Spiked Jungle slimes if not + int pickRareUGJungle = hornets ? (plagueSpawns ? ModContent.NPCType() : useHardmode ? NPCID.MossHornet : tooManyHornets) : useHardmode ? NPCID.Moth : NPCID.SpikedJungleSlime; + // Plantera, or chance for PBG if plague + int pickUltraRareUGJungle = plagueSpawns ? ModContent.NPCType() : NPCID.Plantera; + if (common) { npcIDsCommon.Add((pickCommonUGJungle, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGJungle, hornets ? 22 : useHardmode ? 1 : 5, hornets)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareUGJungle, 1, false)); } // Ultra Rare NPC/s + } + else // Surface Jungle + { + // 3 Jungle Bats or Giant Flying Foxes if hardmode, sometimes Melters if plague + int pickCommonJungle = plagueSpawns ? ModContent.NPCType() : useHardmode ? NPCID.GiantFlyingFox : NPCID.JungleBat; + // 10 Piranhas or Arapaimas if hardmode, 50% chance to be 3 Derplings instead or Virulings if plague + bool noFish = Main.rand.NextBool(); + int pickRareJungle = plagueSpawns && noFish ? ModContent.NPCType() : useHardmode ? noFish ? NPCID.Derpling : NPCID.Arapaima : NPCID.Piranha; + // 50 Jungle Bats or Giant Flying Foxes if hardmode, or Draconic Swarmers if postML + int pickUltraRareJungle = postML ? ModContent.NPCType() : hardmode ? NPCID.GiantFlyingFox : NPCID.JungleBat; + if (common) { npcIDsCommon.Add((pickCommonJungle, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareJungle, useHardmode ? 3 : 10, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareJungle, 50, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneGraveyard) + { + // 2 Maggot Zombies + if (common) { npcIDsCommon.Add((NPCID.MaggotZombie, 2, false)); } // Common NPC/s + // Either 3 Rotdogs or 3 Bucket Zombies + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Rare NPC/s + // Either 2 Grooms or 2 Brides + else if (ultraRare) { npcIDsUltraRare.Add((Main.rand.NextBool() ? NPCID.TheBride : NPCID.TheGroom, 2, false)); } // Ultra Rare NPC/s + } + if (owner.Calamity().ZoneAstral) + { + if (underground) + { + bool glomers = Main.rand.NextBool(4); + // 2 Stellar Culex or 1/4 for 15 Glomerlings + if (common) { npcIDsCommon.Add((glomers ? ModContent.NPCType() : ModContent.NPCType(), glomers ? 15 : 2, false)); } // Common NPC/s + // Either 5 Astralachnea or 5 Astraglomerates + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 5, false)); } // Rare NPC/s + // 1 Astrum Aureus + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else + { + // Either 2 Aries or 2 Nova + if (common) { npcIDsCommon.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 2, false)); } // Common NPC/s + // Either 3 Atlas or 3 Mantis + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Rare NPC/s + // 1 Astrum Deus + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + } + if (owner.Calamity().ZoneSunkenSea) + { + bool clams = Main.rand.NextBool(3); + bool downedDS = DownedBossSystem.downedDesertScourge; + // 2 Ghost Bells + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 2, false)); } // Common NPC/s + // 1/3 for 8 Clams, otherwise 3 Prism Backs + else if (rare) { npcIDsRare.Add((clams ? ModContent.NPCType() : ModContent.NPCType(), clams ? 8 : 3, false)); } // Rare NPC/s + // postDS 3 Giant Clams or 10 postML, otherwise 50 Sea Floaties + else if (ultraRare) { npcIDsUltraRare.Add((downedDS ? ModContent.NPCType() : ModContent.NPCType(), downedDS ? postML ? 10 : 3 : 50, !downedDS)); } // Ultra Rare NPC/s + } + // Arsenal Labs + if ((backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType()) && + BiomeTileCounterSystem.ArsenalLabTiles > 150) + { + // 5 Broken Nanodroids + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 5, false)); } // Common NPC/s + // 1 Androomba + else if (rare) { npcIDsRare.Add((ModContent.NPCType(), 1, false)); } // Rare NPC/s + // The Burrower + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + } + else if (Honey) + { + // 15 Small Bees + if (common) { npcIDsCommon.Add((NPCID.BeeSmall, 15, false)); } // Common NPC/s + // 25 Bees + else if (rare) { npcIDsRare.Add((NPCID.Bee, 25, false)); } // Rare NPC/s + // 1 Queen Bee + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.QueenBee, 1, false)); } // Ultra Rare NPC/s + } + else if (Lava) + { + if (owner.Calamity().ZoneCalamity) + { + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((ModContent.NPCType(), 7, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((useHardmode ? ModContent.NPCType() : ModContent.NPCType(), 50, true)); } // Ultra Rare NPC/s + } + else + { + // If not in hell, underworld enemies are replaced with some Heat Spirits (Common: 2, Rare: 10, UltraRare: 50) + bool notInHell = !owner.ZoneUnderworldHeight; + bool profaned = postML && Main.rand.NextBool(4); + int nonHellEnemy = ModContent.NPCType(); + bool snake = Main.rand.NextBool(4); + // 5 Hellbats or Lavabats if hardmode, 25% chance to be one Bone Serpent instead, or chance for Impious Immolator + int pickCommonHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : snake ? NPCID.BoneSerpentHead : (useHardmode ? NPCID.Lavabat : NPCID.Hellbat); + // 3 Demons or Red Devils if hardmode, or chance for Scorn Eater + int pickRareHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : (useHardmode ? NPCID.RedDevil : NPCID.Demon); + // Wall of Flesh, or chance for Providence if postML + int pickUltraRareHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : NPCID.WallofFlesh; + if (common) { npcIDsCommon.Add((pickCommonHell, notInHell ? 2 : snake ? 1 : 5, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareHell, notInHell ? 10 : 3, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareHell, notInHell ? 50 : 1, notInHell)); } // Ultra Rare NPC/s + } + } + #endregion + + #region NPC spawn + // Spawn the npc/s + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npcIDsCommon.Count + npcIDsRare.Count + npcIDsUltraRare.Count == 0) + { + npcIDsCommon.Add((fallbackNPC, 1, false)); + common = true; + } + // Get a random NPC type and count from the list of npcs within the rarity + (int, int, bool) finalNPCstats = common ? npcIDsCommon.ElementAt(Main.rand.Next(0, npcIDsCommon.Count)) : + rare ? npcIDsRare.ElementAt(Main.rand.Next(0, npcIDsRare.Count)) : + npcIDsUltraRare.ElementAt(Main.rand.Next(0, npcIDsUltraRare.Count)); + // Spawn the actual NPC/s + for (int i = 0; i < finalNPCstats.Item2; i++) + { + float baseSpeed = 2.5f; + NPC catched = Main.npc[(int)NPC.NewNPC(owner.GetSource_FromThis(), (int)bobber.Center.X, (int)bobber.Center.Y, finalNPCstats.Item1)]; + // If there's more than one, send in random directions, otherwise pull them upwards + catched.velocity = Vector2.UnitY * -baseSpeed + (finalNPCstats.Item2 == 1 ? Vector2.Zero : -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(baseSpeed / 2, baseSpeed * 2 * MathF.Pow(finalNPCstats.Item2, 0.5f))); + catched.Calamity().preventDrops = (finalNPCstats.Item3 ? Main.rand.NextBool(3) : false); + } + + } + #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++) + { + Color liquidColor = Lava ? Color.OrangeRed : Honey ? Color.Gold : Color.DodgerBlue; + if (i % 4 == 0) + { + Particle sprayParticle = new CustomSpark(bobber.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) * scale, -Vector2.UnitY.RotatedByRandom(0.2f * MathF.Pow(scale, 1)) * Main.rand.NextFloat(1, 7) * scale, "CalamityMod/Particles/BloomCircle", true, (int)(Main.rand.Next(18, 24) * 5 * scale), Main.rand.NextFloat(0.3f, 0.5f) * scale, Color.Lerp(Color.Gray, liquidColor, Main.rand.NextFloat(0.5f, 1f)) * 0.4f, new Vector2(0.8f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(sprayParticle); + } + + Vector2 sprayPos = bobber.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) * scale; + Dust spray = Dust.NewDustPerfect(sprayPos, ModContent.DustType()); + spray.noGravity = false; + spray.scale = Main.rand.NextFloat(1.3f, 1.5f) * scale; + spray.velocity = -Vector2.UnitY.RotatedByRandom(0.2f * MathF.Pow(scale, 1)) * Main.rand.NextFloat(5, 14) * scale; + spray.color = Color.Lerp(Color.Gray, liquidColor, Main.rand.NextFloat(0.3f, 0.8f)) * 0.2f; + spray.noLight = true; + spray.noLightEmittence = true; + spray.fadeIn = 2 + scale; + } + owner.SetScreenshake(2f * scale); + 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); + } + } +} diff --git a/Systems/ProgressionAndEvent/DownedBossSystem.cs b/Systems/ProgressionAndEvent/DownedBossSystem.cs index d8e5081616..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; @@ -563,9 +576,9 @@ namespace CalamityMod downedBossRush = false; } - public override void OnWorldLoad() => ResetAllFlags(); + //public override void OnWorldLoad() => ResetAllFlags(); - public override void OnWorldUnload() => ResetAllFlags(); + //public override void OnWorldUnload() => ResetAllFlags(); public override void SaveWorldData(TagCompound tag) { @@ -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/UIManagementSystem.cs b/Systems/UIManagementSystem.cs index 337623ac94..3d5fe5e27d 100644 --- a/Systems/UIManagementSystem.cs +++ b/Systems/UIManagementSystem.cs @@ -43,6 +43,12 @@ namespace CalamityMod.Systems // For these layers, InterfaceScaleType.Game tells the game that this UI should take zoom into account. // These must be separate layers or they will malfunction when hovering one at non-100% zoom. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Fish Stocks", () => + { + FishStocksUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charging Station UI", () => { ChargingStationUI.Draw(Main.spriteBatch); diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index ba62fb4ff6..e0b0d26647 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -56,6 +56,7 @@ namespace CalamityMod spawnedBandit = false; foundHomePermafrost = false; + unlockedTownPig = false; catName = false; dogName = false; @@ -69,6 +70,7 @@ namespace CalamityMod AcidRainEvent.CountdownUntilForcedAcidRain = 0; HasGeneratedLuminitePlanetoids = false; //Allow generating planetoids in other worlds + DownedBossSystem.ResetAllFlags(); } #endregion @@ -92,6 +94,8 @@ namespace CalamityMod downed.Add("bandit"); if (foundHomePermafrost) downed.Add("archmageHome"); + if (unlockedTownPig) + downed.Add("townPig"); #region Save Pet Names if (catName) @@ -143,6 +147,7 @@ namespace CalamityMod AcidRainEvent.AcidRainEventIsOngoing = downed.Contains("acidRain"); spawnedBandit = downed.Contains("bandit"); foundHomePermafrost = downed.Contains("archmageHome"); + unlockedTownPig = downed.Contains("townPig"); #region Load Pet Names catName = downed.Contains("catName"); @@ -295,6 +300,8 @@ namespace CalamityMod flags12[2] = downedNuclearTerror; flags12[3] = downedBossRush; flags12[4] = DraedonMechdusa; + flags12[5] = unlockedTownPig; + flags12[5] = downedHorribleHog; writer.Write(flags); writer.Write(flags2); @@ -449,6 +456,8 @@ namespace CalamityMod downedNuclearTerror = flags12[2]; 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 5399d037a4..7cd974f5e0 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -12,6 +12,7 @@ using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.WorldBuilding; using static CalamityMod.World.CalamityWorld; @@ -19,10 +20,28 @@ namespace CalamityMod.Systems { public class WorldgenManagementSystem : ModSystem { + #region StructurePosStoring + public static Point DungeonArchivePos = Point.Zero; + + public override void SaveWorldData(TagCompound tag) + { + tag["DungeonArchivePos"] = DungeonArchivePos; + } + + public override void LoadWorldData(TagCompound tag) + { + if (tag.ContainsKey("DungeonArchivePos")) + DungeonArchivePos = tag.Get("DungeonArchivePos"); + else + DungeonArchivePos = Point.Zero; + } + #endregion + #region PreWorldGen public override void PreWorldGen() { Abyss.TotalPlacedIslandsSoFar = 0; + DungeonArchivePos = Point.Zero; //roxShrinePlaced = false; // This will only be applied at world-gen time to new worlds. @@ -34,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) => { @@ -209,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); })); } @@ -399,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/TileEntities/TEHostileFireTurret.cs b/TileEntities/TEHostileFireTurret.cs index 33ae21e7c2..18813caf5c 100644 --- a/TileEntities/TEHostileFireTurret.cs +++ b/TileEntities/TEHostileFireTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostileIceTurret.cs b/TileEntities/TEHostileIceTurret.cs index d1ebcd8a6d..64fbd80707 100644 --- a/TileEntities/TEHostileIceTurret.cs +++ b/TileEntities/TEHostileIceTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostileLabTurret.cs b/TileEntities/TEHostileLabTurret.cs index d74b9474a4..b1e8dbd9f4 100644 --- a/TileEntities/TEHostileLabTurret.cs +++ b/TileEntities/TEHostileLabTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostileLaserTurret.cs b/TileEntities/TEHostileLaserTurret.cs index f34b471781..732524ac75 100644 --- a/TileEntities/TEHostileLaserTurret.cs +++ b/TileEntities/TEHostileLaserTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostileOnyxTurret.cs b/TileEntities/TEHostileOnyxTurret.cs index 78a7fd87e9..a3467c083d 100644 --- a/TileEntities/TEHostileOnyxTurret.cs +++ b/TileEntities/TEHostileOnyxTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostilePlagueTurret.cs b/TileEntities/TEHostilePlagueTurret.cs index 05cca39c47..0a74b7f4df 100644 --- a/TileEntities/TEHostilePlagueTurret.cs +++ b/TileEntities/TEHostilePlagueTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEHostileWaterTurret.cs b/TileEntities/TEHostileWaterTurret.cs index 2b2f0a8923..ba768e59ff 100644 --- a/TileEntities/TEHostileWaterTurret.cs +++ b/TileEntities/TEHostileWaterTurret.cs @@ -66,8 +66,8 @@ namespace CalamityMod.TileEntities { Player p = Main.player[PlayerTargetIndex]; - // If they don't exist, or are dead, then unmark them as a target and search for a new one. - if (!p.active || p.dead) + // If they don't exist, are dead, or are using an invis pot then unmark them as a target and search for a new one. + if (!p.active || p.dead || p.invis) indexToSet = -1; else { @@ -87,7 +87,7 @@ namespace CalamityMod.TileEntities foreach (Player p in Main.ActivePlayers) { - if (p.dead) + if (p.dead || p.invis) continue; float distSQ = p.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerFireTurret.cs b/TileEntities/TEPlayerFireTurret.cs index 10feeedd45..e87a6910ff 100644 --- a/TileEntities/TEPlayerFireTurret.cs +++ b/TileEntities/TEPlayerFireTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerIceTurret.cs b/TileEntities/TEPlayerIceTurret.cs index 2678aa9196..9d943ab40e 100644 --- a/TileEntities/TEPlayerIceTurret.cs +++ b/TileEntities/TEPlayerIceTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerLabTurret.cs b/TileEntities/TEPlayerLabTurret.cs index 4e0bb773f1..310497ba0f 100644 --- a/TileEntities/TEPlayerLabTurret.cs +++ b/TileEntities/TEPlayerLabTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerLaserTurret .cs b/TileEntities/TEPlayerLaserTurret .cs index e7f7655804..6b95c1ae71 100644 --- a/TileEntities/TEPlayerLaserTurret .cs +++ b/TileEntities/TEPlayerLaserTurret .cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerOnyxTurret.cs b/TileEntities/TEPlayerOnyxTurret.cs index 7cbcd7ae3a..fb0a2707e5 100644 --- a/TileEntities/TEPlayerOnyxTurret.cs +++ b/TileEntities/TEPlayerOnyxTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerPlagueTurret.cs b/TileEntities/TEPlayerPlagueTurret.cs index 7836915e60..37da61016a 100644 --- a/TileEntities/TEPlayerPlagueTurret.cs +++ b/TileEntities/TEPlayerPlagueTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -71,7 +72,7 @@ namespace CalamityMod.TileEntities //This turret can switch targets at any time foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/TileEntities/TEPlayerWaterTurret.cs b/TileEntities/TEPlayerWaterTurret.cs index 3e389b070b..44c232290f 100644 --- a/TileEntities/TEPlayerWaterTurret.cs +++ b/TileEntities/TEPlayerWaterTurret.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Turret; using CalamityMod.Tiles.PlayerTurrets; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities @@ -90,7 +91,7 @@ namespace CalamityMod.TileEntities foreach (NPC npc in Main.ActiveNPCs) { - if (npc.friendly || npc.CountsAsACritter) + if (npc.friendly || npc.CountsAsACritter || NPCID.Sets.CountsAsCritter[npc.type]) continue; float distSQ = npc.DistanceSQ(targetingCenter); diff --git a/Tiles/BloodOrangePlant.cs b/Tiles/BloodOrangePlant.cs deleted file mode 100644 index 6810ed1226..0000000000 --- a/Tiles/BloodOrangePlant.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.PermanentBoosters; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class BloodOrangePlant : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileObsidianKill[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - - DustType = DustID.Torch; - - AddMapEntry(new Color(250, 142, 4)); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); - } - - 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 NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 4; - } - } -} diff --git a/Tiles/BloodOrangePlant.png b/Tiles/BloodOrangePlant.png deleted file mode 100644 index c954393284..0000000000 Binary files a/Tiles/BloodOrangePlant.png and /dev/null differ 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/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index 9475eadbcd..416eb1ea39 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/BlueCandle.png b/Tiles/Furniture/BlueCandle.png index 5fe20f8f8b..0e1b6c7678 100644 Binary files a/Tiles/Furniture/BlueCandle.png and b/Tiles/Furniture/BlueCandle.png differ diff --git a/Tiles/Furniture/BlueCandle_Highlight.png b/Tiles/Furniture/BlueCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/BlueCandle_Highlight.png and b/Tiles/Furniture/BlueCandle_Highlight.png differ 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 4389f81731..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 00449db10a..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 new file mode 100644 index 0000000000..086cd0b507 --- /dev/null +++ b/Tiles/Furniture/GluttonyBlender.cs @@ -0,0 +1,260 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class GluttonyBlenderTile : ModTile + { + public const int Width = 2; + public const int Height = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.CoordinateHeights = [16, 16, 18]; + ModTileEntity entity = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(entity.Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(128, 128, 128), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) => false; + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + if (TileEntity.TryGet(new(i, j), out var entity)) + { + frameXOffset = 36 * entity.CurrentFrame; + } + } + + public override void MouseOver(int i, int j) + { + Player p = Main.LocalPlayer; + // You shouldn't be able to put the slop or something better than it back into the blender + if (BuffID.Sets.IsWellFed[p.HeldItem.buffType] && !(p.HeldItem.buffType == BuffID.WellFed3 && p.HeldItem.buffTime >= CalamityUtils.MinutesToFrames(30))) + { + p.noThrow = 2; + p.cursorItemIconEnabled = true; + p.cursorItemIconID = p.HeldItem.type; + } + } + } + + public class GluttonyBlenderTE : ModTileEntity + { + public Vector2 BlenderTop => Position.ToWorldCoordinates(8 * GluttonyBlenderTile.Width, 0f); + public int CurrentFrame = 0; + private ushort FrameCounter = 0; + private const ushort TotalAnimFrames = 6; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + public override void NetSend(BinaryWriter writer) + { + writer.Write(CurrentFrame); + writer.Write(FrameCounter); + } + public override void NetReceive(BinaryReader reader) + { + CurrentFrame = reader.ReadInt32(); + FrameCounter = reader.ReadUInt16(); + } + + public override void Update() + { + bool blenderAnim = Main.projectile.Any(i => i.active && i.type == ModContent.ProjectileType() && + i.ai[1] >= GluttonyBlenderAnimation.TimeToReachBlender && Vector2.DistanceSquared(BlenderTop, i.Center) < 256f); + if (blenderAnim) + { + if (CurrentFrame < 1) + CurrentFrame = 1; + FrameCounter++; + if (FrameCounter >= 4) + { + FrameCounter = 0; + CurrentFrame++; + if (CurrentFrame > TotalAnimFrames) + CurrentFrame = 1; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + else + { + if (CurrentFrame > 0) + { + CurrentFrame = 0; + FrameCounter = 0; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + } + } + + public class GluttonyBlenderGlobalItem : GlobalItem + { + public override bool InstancePerEntity => true; + + internal bool FromGluttonyBlender = false; + + public override bool CanUseItem(Item item, Player player) + { + // Exit early if anyone of the following are true: + // * Running on client that is not the local player + // * The item is not a food, is not consumable, or is Quality Slop/better than Quality Slop (you cannot feed the slop back into the blender) + // * The Gluttony Blender tile entity doesn't exist for some reason + // * The player isn't within the tile's interaction range + if (Main.LocalPlayer.whoAmI != player.whoAmI) + return true; + if (!BuffID.Sets.IsWellFed[item.buffType] || !item.consumable || (item.buffType == BuffID.WellFed3 && item.buffTime >= CalamityUtils.MinutesToFrames(30))) + return true; + + Point mouseTile = Main.MouseWorld.ToTileCoordinates(); + GluttonyBlenderTE entity = CalamityUtils.FindTileEntity(mouseTile.X, mouseTile.Y, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + if (entity == null) + return true; + if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) + return true; + + // Spawns a projectile to handle the visual animation of the food moving into the blender and the conversion to slop + // The projectile doesn't use velocity, so the top of the blender tile is passed in as the velocity + Projectile.NewProjectile(player.GetSource_TileInteraction(mouseTile.X, mouseTile.Y), player.Center, entity.BlenderTop, ModContent.ProjectileType(), + 0, 0f, player.whoAmI, item.type); + if (ItemLoader.ConsumeItem(item, player)) + { + item.stack--; + if (player.selectedItem == 58) + Main.mouseItem.stack--; + if (item.stack <= 0) + item.TurnToAir(); + } + return false; + } + + public override bool CanStackInWorld(Item destination, Item source) + { + return !destination.GetGlobalItem().FromGluttonyBlender || !destination.GetGlobalItem().FromGluttonyBlender; + } + } + + public class GluttonyBlenderAnimation : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int Lifetime = 120; + public const int TimeToReachBlender = 60; + private int ItemType => (int)Projectile.ai[0]; + private ref float Timer => ref Projectile.ai[1]; + private ref float ArcVelocity => ref Projectile.ai[2]; + private Vector2 Start; + private Vector2 Destination => Projectile.velocity; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.scale = 0f; + } + + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + // Initialization + if (Timer == 0) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Start = Projectile.Center; + ArcVelocity = Main.rand.NextFloat(2.2f, 4.4f); + } + + if (Timer < TimeToReachBlender) + { + Vector2 moveDistBeforeArc = Destination - Start; + // The second half of this applies an arcing motion as the projectile moves + Projectile.Center += (moveDistBeforeArc / (float)TimeToReachBlender) - Vector2.UnitY * (ArcVelocity - (ArcVelocity / 30f * Timer)); + Projectile.rotation = moveDistBeforeArc.X * 0.005f; + + if (Timer < 4) + Projectile.scale += 0.25f; + if (Timer >= TimeToReachBlender - 4) + Projectile.scale -= 0.25f; + } + else + { + Projectile.Center = Destination; + if (Timer == TimeToReachBlender) + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); + + Color[] dustArray = ItemID.Sets.FoodParticleColors[ItemType]; + if (dustArray == null || dustArray.Length == 0) + dustArray = ItemID.Sets.DrinkParticleColors[ItemType]; + if (dustArray != null && dustArray.Length != 0 && Main.rand.NextBool(4)) + { + Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 5f) * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FoodPiece, dustVel, 0, dustArray[Main.rand.Next(dustArray.Length)], Main.rand.NextFloat(1.3f, 1.75f)); + dust.fadeIn = 0f; + } + } + + if (Projectile.timeLeft == 1 && Main.netMode != NetmodeID.MultiplayerClient) + { + Item dummy = new Item(); + dummy.SetDefaults(ItemType); + // 0.1% per minute of duration, multiplied by 1.5x for T2 food and 2x for T3 food + float goodPercent = dummy.buffTime * (dummy.buffType == BuffID.WellFed3 ? 2f : dummy.buffType == BuffID.WellFed2 ? 1.5f : 1f) / 3600f / 10f; + + 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; + } + Timer++; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Timer >= TimeToReachBlender) + return false; + + Texture2D tex = TextureAssets.Item[ItemType].Value; + Rectangle frame = tex.Frame(1, Main.itemAnimations[ItemType].FrameCount, 0, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Tiles/Furniture/GluttonyBlenderTile.png b/Tiles/Furniture/GluttonyBlenderTile.png new file mode 100644 index 0000000000..c296b47ccc Binary files /dev/null and b/Tiles/Furniture/GluttonyBlenderTile.png differ 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/PiggyCageGoldTile.cs b/Tiles/Furniture/PiggyCageGoldTile.cs new file mode 100644 index 0000000000..ae48755468 --- /dev/null +++ b/Tiles/Furniture/PiggyCageGoldTile.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class PiggyCageGoldTile : ModTile + { + public override void SetStaticDefaults() + { + 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(BabyFlakCrabCageTile.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..a60cd8511d 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/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index f2b8f483c8..5c356fc82e 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/PinkCandle.png b/Tiles/Furniture/PinkCandle.png index e22cef9737..7a3873cfc3 100644 Binary files a/Tiles/Furniture/PinkCandle.png and b/Tiles/Furniture/PinkCandle.png differ diff --git a/Tiles/Furniture/PinkCandle_Highlight.png b/Tiles/Furniture/PinkCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/PinkCandle_Highlight.png and b/Tiles/Furniture/PinkCandle_Highlight.png differ diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index dd2a5e9886..d9dba7ab79 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/PurpleCandle.png b/Tiles/Furniture/PurpleCandle.png index 41e2f749a3..0b4b460a3b 100644 Binary files a/Tiles/Furniture/PurpleCandle.png and b/Tiles/Furniture/PurpleCandle.png differ diff --git a/Tiles/Furniture/PurpleCandle_Highlight.png b/Tiles/Furniture/PurpleCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/PurpleCandle_Highlight.png and b/Tiles/Furniture/PurpleCandle_Highlight.png differ diff --git a/Tiles/Furniture/ShroombleCageTile.cs b/Tiles/Furniture/ShroombleCageTile.cs new file mode 100644 index 0000000000..52c6d36633 --- /dev/null +++ b/Tiles/Furniture/ShroombleCageTile.cs @@ -0,0 +1,98 @@ +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 ShroombleCageTile : ModTile + { + public static Asset topTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + topTexture = ModContent.Request("CalamityMod/Tiles/Furniture/TransparentCageTile_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 = 39; + frameCounter++; + if (frameCounter >= 6) + { + 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(tile.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/ShroombleCageTile.png b/Tiles/Furniture/ShroombleCageTile.png new file mode 100644 index 0000000000..a826b6f099 Binary files /dev/null and b/Tiles/Furniture/ShroombleCageTile.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 new file mode 100644 index 0000000000..8bba424081 --- /dev/null +++ b/Tiles/Furniture/TheMonumentTile.cs @@ -0,0 +1,140 @@ +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.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 = 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/TheMonumentTile.png b/Tiles/Furniture/TheMonumentTile.png new file mode 100644 index 0000000000..79c67d6ac4 Binary files /dev/null and b/Tiles/Furniture/TheMonumentTile.png differ diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index d9780550bc..e43f389700 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/YellowCandle.png b/Tiles/Furniture/YellowCandle.png index 74f2a263aa..1ccebda4e8 100644 Binary files a/Tiles/Furniture/YellowCandle.png and b/Tiles/Furniture/YellowCandle.png differ diff --git a/Tiles/Furniture/YellowCandle_Highlight.png b/Tiles/Furniture/YellowCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/YellowCandle_Highlight.png and b/Tiles/Furniture/YellowCandle_Highlight.png differ diff --git a/Tiles/FurnitureAuric/AuricToiletTile.cs b/Tiles/FurnitureAuric/AuricToiletTile.cs index ab4dd204e9..194b950492 100644 --- a/Tiles/FurnitureAuric/AuricToiletTile.cs +++ b/Tiles/FurnitureAuric/AuricToiletTile.cs @@ -1,7 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.FurnitureAuric; +using CalamityMod.Items.Placeables.FurnitureExo; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -11,6 +15,7 @@ namespace CalamityMod.Tiles.FurnitureAuric { public class AuricToiletTile : ModTile { + public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -36,11 +41,38 @@ namespace CalamityMod.Tiles.FurnitureAuric // Toilets count as chairs AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; TileID.Sets.DisableSmartCursor[Type] = true; AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Toilet")); AdjTiles = new int[] { TileID.Chairs }; } + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); + + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - (tile.TileFrameY % NextStyleHeight) / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/GreedPotTile.cs b/Tiles/GreedPotTile.cs new file mode 100644 index 0000000000..ea6b14db63 --- /dev/null +++ b/Tiles/GreedPotTile.cs @@ -0,0 +1,456 @@ +using System; +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; +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.ObjectData; + +namespace CalamityMod.Tiles +{ + public class GreedPotTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + + DustType = DustID.Iron; + + AddMapEntry(new Color(250, 142, 4)); + } + + public override void MouseOver(int i, int j) + { + List availableOres = GreedTransmutation.GreedChain.Where(p => p.Value.Availability.Invoke()).Select(p => p.Key).ToList(); + + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + 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; + } + } + + public class GreedPotTE : ModTileEntity + { + internal bool Activated = false; + internal ushort TimeSinceActivation = 0; + private ushort FrameTime = 0; + private byte CurrentFrame = 0; + public int MyFrame => (int)CurrentFrame; + + private const byte FullActiveFrame = 4; + private const byte FrameRate = 3; + private const byte FrameTotal = 8; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + + if (!tile.HasTile || tile.TileType != ModContent.TileType()) + return false; + + int style = 0, alt = 0; + TileObjectData.GetTileInfo(tile, ref style, ref alt); + TileObjectData data = TileObjectData.GetTileData(tile.TileType, style, alt); + + if (data == null) + return false; + + int sheetSquare = 16 + data.CoordinatePadding; + int FrameX = tile.TileFrameX / sheetSquare % data.Width; + int FrameY = tile.TileFrameY / sheetSquare % data.Height; + + return tile.HasTile && tile.TileType == ModContent.TileType() && FrameX == 0 && FrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 3, 3); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + public void UpdateOnAllClients() + { + if (Activated) + { + if (CurrentFrame != 3) + { + FrameTime++; + if (FrameTime % FrameRate == 0) + { + FrameTime = 0; + CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); + } + } + + if (TimeSinceActivation >= 150) + { + Activated = false; + TimeSinceActivation = 0; + return; + } + + TimeSinceActivation++; + } + else + { + if (CurrentFrame != 0) + { + FrameTime++; + if (FrameTime % FrameRate == 0) + { + FrameTime = 0; + CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); + } + } + } + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(Activated); + writer.Write(FrameTime); + writer.Write(TimeSinceActivation); + writer.Write(CurrentFrame); + } + public override void NetReceive(BinaryReader reader) + { + Activated = reader.ReadBoolean(); + FrameTime = reader.ReadUInt16(); + TimeSinceActivation = reader.ReadUInt16(); + CurrentFrame = reader.ReadByte(); + } + } + + //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"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + static bool twoMechsDowned() => + NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3 || + NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1 || + NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2 || + NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; + + GreedChain = new() + { + { ItemID.CopperOre, (ItemID.IronOre, () => true) }, + { ItemID.IronOre, (ItemID.SilverOre, () => true) }, + { ItemID.SilverOre, (ItemID.GoldOre, () => true) }, + { ItemID.TinOre, (ItemID.LeadOre, () => true) }, + { ItemID.LeadOre, (ItemID.TungstenOre, () => true) }, + { ItemID.TungstenOre, (ItemID.PlatinumOre, () => true) }, + { ItemID.GoldOre, (ModContent.ItemType(), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator) }, + { ItemID.PlatinumOre, (ModContent.ItemType(), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator) }, + { ModContent.ItemType(), (ItemID.PalladiumOre, () => Main.hardMode) }, + { ItemID.CobaltOre, (ItemID.MythrilOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBossAny : Main.hardMode) }, + { ItemID.MythrilOre, (ItemID.AdamantiteOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? twoMechsDowned() : Main.hardMode) }, + { ItemID.PalladiumOre, (ItemID.OrichalcumOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBossAny : Main.hardMode) }, + { ItemID.OrichalcumOre, (ItemID.TitaniumOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? twoMechsDowned() : Main.hardMode) }, + { ItemID.AdamantiteOre, (ModContent.ItemType(), () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 : NPC.downedMechBossAny) }, + { ItemID.TitaniumOre, (ModContent.ItemType(), () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 : NPC.downedMechBossAny) }, + { ModContent.ItemType(), (ItemID.ChlorophyteOre, () => NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) }, + { ItemID.ChlorophyteOre, (ModContent.ItemType(), () => NPC.downedPlantBoss) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => NPC.downedAncientCultist) }, + { ModContent.ItemType(), (ItemID.LunarOre, () => NPC.downedMoonlord) }, + { ItemID.LunarOre, (ModContent.ItemType(), () => NPC.downedMoonlord) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => DownedBossSystem.downedProvidence) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => DownedBossSystem.downedCalamitas || DownedBossSystem.downedExoMechs) }, + }; + } + + internal static Dictionary Availability)> GreedChain; + + private int InputItemType => (int)Projectile.ai[0]; + private int SuccessOutputItemType => (int)Projectile.ai[1]; + + private Vector2 PotPosition = Vector2.Zero; + private Vector2 StartPosition = Vector2.Zero; + + BezierCurve path = null; + private bool Success = false; + + private int random = -1; + + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + } + + public override void OnSpawn(IEntitySource source) + { + StartPosition = Projectile.Center; + PotPosition = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Success = Main.rand.NextBool(3); + 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) + { + Vector2 startPoint = StartPosition; + Vector2 endPoint = PotPosition - Vector2.UnitY * 64; + + Vector2 direction = endPoint - startPoint; + float curveIntensity = Main.rand.NextFloat(0.2f, 0.4f); + Vector2 perpindicular = direction.RotatedBy(MathHelper.PiOver2); + if (direction.X > 0) + curveIntensity *= -1; + + Vector2 controlPoint1 = startPoint + (direction * 0.25f) + (perpindicular * curveIntensity); + Vector2 controlPoint2 = startPoint + (direction * 0.75f) + (perpindicular * curveIntensity); + + path = new BezierCurve(startPoint, controlPoint1, controlPoint2, endPoint); + } + + float lerp = 1 - MathHelper.Clamp(((Projectile.timeLeft - 60) / 60f), 0f, 1f); + + Projectile.Center = path.Evaluate(CalamityUtils.CircOutEasing(lerp, 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); + 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) + { + int animTime = 120 - Projectile.timeLeft; + bool beforeDarken = animTime < 50; + bool darken = animTime < 90; + bool transform = animTime < 110; + + 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 + random) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + } + else if (darken) + { + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + Main.spriteBatch.Begin(newSnap); + + float glowLerp = MathHelper.Clamp((animTime - 45) / 10f, 0f, 1f); + 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 + 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); + + float darkenLerp = MathHelper.Clamp((animTime - 50) / 10f, 0f, 1f); + 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 + random) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + } + else if(transform) + { + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + 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 + random) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(snap); + + Texture2D inputTex = TextureAssets.Item[InputItemType].Value; + Texture2D outputTex = TextureAssets.Item[Success ? SuccessOutputItemType : ItemID.StoneBlock].Value; + 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 + 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 + { + float undarkenLerp = MathHelper.Clamp((animTime - 110) / 10f, 0f, 1f); + undarkenLerp = CalamityUtils.SineOutEasing(undarkenLerp, 1); + + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + 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 + 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 + 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 + { + public override bool InstancePerEntity => true; + + internal bool FromGreedPot = false; + + public override bool? UseItem(Item item, Player player) + { + if (!GreedTransmutation.GreedChain.TryGetValue(item.type, out var transmutation)) + return null; + + if (!transmutation.Availability()) + return null; + + Point mouseTile = Main.MouseWorld.ToTileCoordinates(); + + GreedPotTE greedPotTE = CalamityUtils.FindTileEntity(mouseTile.X, mouseTile.Y, 3, 3, 18); + if (greedPotTE == null) + return null; + + if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) + return null; + + 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; + } + + 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/GreedPotTile.png b/Tiles/GreedPotTile.png new file mode 100644 index 0000000000..1e8745c33a Binary files /dev/null and b/Tiles/GreedPotTile.png differ 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/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 435b3b19fd..b5413ddaa0 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Tiles.Ores { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 690; diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index a26a343c5f..8e6a090e63 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.Ores { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 710; Main.tileShine[Type] = 2500; @@ -38,10 +37,6 @@ namespace CalamityMod.Tiles.Ores this.RegisterBlendMergeWith(TileID.Mud); } - - - - public override bool CanExplode(int i, int j) { return false; diff --git a/Tiles/Pylons/CragsPylonTile.cs b/Tiles/Pylons/CragsPylonTile.cs index 834768a28d..496e5368dc 100644 --- a/Tiles/Pylons/CragsPylonTile.cs +++ b/Tiles/Pylons/CragsPylonTile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Pylons public override NPCShop.Entry GetNPCShopEntry() { - return new NPCShop.Entry(AssociatedItem, CalamityConditions.InCrag); + return null; } //Doesnt require npcs to function diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index c015c371b2..359ab48c4e 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -32,10 +32,7 @@ namespace CalamityMod.Tiles.SunkenSea TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); TileID.Sets.Suffocate[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - TileID.Sets.Conversion.Sand[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/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 297c26c2bd..c55a2abf39 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -198,6 +198,7 @@ namespace CalamityMod.UI.CalamitasEnchants float y = costDrawPositionTopLeft.Y + 54f * Main.UIScale; for (int i = 0; i < 4; i++) { + Main.instance.LoadItem(ItemID.PlatinumCoin - i); Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + (ChatManager.GetStringSize(FontAssets.MouseText.Value, costText, Vector2.One, -1f).X + ((24 * i) - 24f)) * Main.UIScale, y); spriteBatch.Draw(TextureAssets.Item[ItemID.PlatinumCoin - i].Value, drawPosition, null, Color.White, 0f, TextureAssets.Item[ItemID.PlatinumCoin - i].Size() * 0.5f, Main.UIScale, SpriteEffects.None, 0f); Utils.DrawBorderStringFourWay(spriteBatch, FontAssets.ItemStack.Value, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f * Main.UIScale); diff --git a/UI/FishStocks/FishStocksGraphOverlay.png b/UI/FishStocks/FishStocksGraphOverlay.png new file mode 100644 index 0000000000..43308b867b Binary files /dev/null and b/UI/FishStocks/FishStocksGraphOverlay.png differ diff --git a/UI/FishStocks/FishStocksOverlay.png b/UI/FishStocks/FishStocksOverlay.png new file mode 100644 index 0000000000..f4391b9a9b Binary files /dev/null and b/UI/FishStocks/FishStocksOverlay.png differ diff --git a/UI/FishStocks/FishStocksOverlayBorder.png b/UI/FishStocks/FishStocksOverlayBorder.png new file mode 100644 index 0000000000..9dad4f9229 Binary files /dev/null and b/UI/FishStocks/FishStocksOverlayBorder.png differ diff --git a/UI/FishStocks/FishStocksScreenOverlay.png b/UI/FishStocks/FishStocksScreenOverlay.png new file mode 100644 index 0000000000..82da43ba00 Binary files /dev/null and b/UI/FishStocks/FishStocksScreenOverlay.png differ diff --git a/UI/FishStocks/FishStocksUI.cs b/UI/FishStocks/FishStocksUI.cs new file mode 100644 index 0000000000..0bad391d92 --- /dev/null +++ b/UI/FishStocks/FishStocksUI.cs @@ -0,0 +1,187 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Graphic.PixelationSystem; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Build.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities.Terraria.Utilities; + +namespace CalamityMod.UI +{ + public class FishStocksUI : ModSystem + { + private static Asset lineTex, overlayGraphTex, overlayTex, overlayBorderTex, screenTex, fishyPoint1Tex, fishyPoint2Tex, fishyHappy1Tex, fishyHappy2Tex, fishyPanic1Tex, fishyPanic2Tex, fishyBye1Tex, fishyBye2Tex, fishyWhatTex; + private static int time = 0; + + private static RenderTargetLease PixelationLease; + + private static Color normalColor => Color.Cyan; + private static Color goodColor => Color.Lime; + private static Color badColor => Color.Red; + private static Color shiftColor = goodColor; + private static float jumpMult = 0; + private static float shakeMult = 0; + private static float screenFlicker = 1; + private static bool waving = true; + + public override void OnModLoad() + { + if (Main.dedServ) + return; + + string folder = "CalamityMod/UI/FishStocks/"; + lineTex = ModContent.Request("CalamityMod/Particles/LineThick"); + overlayGraphTex = ModContent.Request(folder + "FishStocksGraphOverlay"); + overlayTex = ModContent.Request(folder + "FishStocksOverlay"); + overlayBorderTex = ModContent.Request(folder + "FishStocksOverlayBorder"); + screenTex = ModContent.Request(folder + "FishStocksScreenOverlay"); + fishyPoint1Tex = ModContent.Request(folder + "FishyPoint1"); + fishyPoint2Tex = ModContent.Request(folder + "FishyPoint2"); + fishyHappy1Tex = ModContent.Request(folder + "FishyHappy1"); + fishyHappy2Tex = ModContent.Request(folder + "FishyHappy2"); + fishyPanic1Tex = ModContent.Request(folder + "FishyPanic1"); + fishyPanic2Tex = ModContent.Request(folder + "FishyPanic2"); + fishyBye1Tex = ModContent.Request(folder + "FishyBye1"); + fishyBye2Tex = ModContent.Request(folder + "FishyBye2"); + fishyWhatTex = ModContent.Request(folder + "FishyWhat"); + + Main.QueueMainThreadAction(() => PixelationLease = ScreenspaceTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, (width, height) => (width / 2, height / 2))); + } + + public override void UpdateUI(GameTime gameTime) + { + Player player = Main.LocalPlayer; + time++; + float power = Math.Clamp(MathF.Pow((Math.Abs(player.Calamity().fishStockSlidingPower) / 2), 1.8f), 0, 1); + + bool dead = player.dead; + + Color attemptColor = dead ? Color.Gray : (player.Calamity().fishStockSlidingPower >= 0 ? Color.Lerp(normalColor, goodColor, power) : Color.Lerp(normalColor, badColor, power)); + shiftColor = Color.Lerp(shiftColor, attemptColor, 0.03f); + + bool doingBad = player.Calamity().fishStockPower <= -1; + if (time % 60 < 10 && !doingBad && !waving && !dead) + jumpMult = MathHelper.Lerp(jumpMult, player.Calamity().fishStockPower >= 1 ? 2.5f : 1, 0.17f); + if (jumpMult > 0) + jumpMult = MathHelper.Lerp(jumpMult, 0, 0.09f); + + shakeMult = MathHelper.Lerp(shakeMult, (doingBad && !dead) ? 1 : 0, 0.08f); + + screenFlicker = MathHelper.Lerp(0.6f, 1f, MathF.Abs(MathF.Sin(time * 0.0125f))); + } + + public static void Draw(SpriteBatch spriteBatch, Player player) + { + if (Main.hideUI || Main.gameMenu || Main.playerInventory || player.Calamity().fishStockVisual <= 0.001f) + return; + + // Fishy waves at the screen if the UI is entering or leaving. + float fishStocksSlideValue = MathF.Pow(1 - player.Calamity().fishStockVisual, player.Calamity().fishStocks ? 1.2f : 20); + waving = (!player.Calamity().fishStocks && player.Calamity().fishStockPower >= 0) || fishStocksSlideValue > 0.002f; + + float baseScale = 0.65f; + float fishStocksUIScale = baseScale * Main.UIScale; + + Vector2 screenPos = new Vector2(Main.screenWidth / 1920, Main.screenHeight / 1080) * fishStocksUIScale; + Vector2 baseUIPosition = (screenPos + new Vector2(overlayBorderTex.Width() * 0.342f * Main.UIScale - (1000 * fishStocksSlideValue), overlayBorderTex.Height() * 0.566f * MathHelper.Lerp(Main.UIScale, 1, 0.5f) + 54 * MathF.Ceiling(player.CountBuffs() / 11f))); + Vector2 fishyDrawPos = baseUIPosition + new Vector2(112, 40) * fishStocksUIScale; + Vector2 leftEdgePos = baseUIPosition - Vector2.UnitX * overlayTex.Width(); + Vector2 rightEdgePos = baseUIPosition - Vector2.UnitX * overlayTex.Width() / 2.7f; + float fullDist = leftEdgePos.Distance(rightEdgePos) * 0.748f * fishStocksUIScale; + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, Main.UIScaleMatrix); + + // Overlay + spriteBatch.Draw(overlayTex.Value, baseUIPosition, null, shiftColor, 0f, overlayTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // The stock graph. + Vector2 xAdjust = (-Vector2.UnitX * overlayTex.Width() / 2.565f) * fishStocksUIScale; + float yAdjust = (overlayTex.Height() / 4.4f) * fishStocksUIScale; + int backgroundLines = 12; + float scroll = (time * 0.23f) % ((fullDist / backgroundLines)); + for (int i = 1; i <= backgroundLines; i++) // background grid + { + Vector2 start = new Vector2(15 * fishStocksUIScale + (fullDist / backgroundLines * (i - 1)) - scroll, -yAdjust); + Vector2 end = new Vector2(15 * fishStocksUIScale + (fullDist / backgroundLines * i) - scroll, yAdjust); + Vector2 scale = new Vector2(0.1f * fishStocksUIScale, 0.0103f * start.Distance(end)) * 0.05f; + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust + start, null, shiftColor * 0.2f, 0, new Vector2(lineTex.Width() / 2, 0), scale, SpriteEffects.None, 0f); + } + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust, null, shiftColor * 0.3f, -MathHelper.PiOver2, new Vector2(lineTex.Width() / 2, 0), new Vector2(0.15f * fishStocksUIScale, 0.0103f * fullDist * 0.99f) * 0.05f, SpriteEffects.None, 0f); + + // Graph overlay + spriteBatch.Draw(overlayGraphTex.Value, baseUIPosition, null, shiftColor, 0f, overlayGraphTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // Draw Fishy and the stcok graph line to a downscaled render target so that it can be redrawn at 2x for a pixelated effect. + spriteBatch.End(); + using (PixelationLease.Scope(clearColor: Color.Transparent)) + { + Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f); + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, pixelationMatrix); + + int lines = 5; + for (int i = 1; i <= lines; i++) // The stock graph + { + float maxHeight = 36f * fishStocksUIScale; + Vector2 start = new Vector2((fullDist / lines) * (i - 1), maxHeight * GetHeight(i - 1, player)); + Vector2 end = new Vector2((fullDist / lines) * i, maxHeight * GetHeight(i, player)); + Vector2 scale = new Vector2(0.2f * fishStocksUIScale, 0.0103f * start.Distance(end)) * 0.05f; + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust + start - Vector2.UnitY * 1f, null, shiftColor, start.DirectionTo(end).ToRotation() - MathHelper.PiOver2, new Vector2(lineTex.Width() / 2, 0), scale, SpriteEffects.None, 0f); + } + + // Fishy :D + Vector2 positionOffset = new Vector2(4 * MathF.Sin(time * 0.65f) * shakeMult, -25 * jumpMult) * fishStocksUIScale; + float fishyScale = 1.45f * fishStocksUIScale; + Texture2D fishyTexture = GetFishyTexture(player); + spriteBatch.Draw(fishyTexture, fishyDrawPos + positionOffset, null, Color.Lerp(shiftColor, Color.White, 0.35f), 0f, fishyTexture.Size() / 2, fishyScale, SpriteEffects.None, 0f); + + spriteBatch.End(); + } + + // Redraw the now-pixelated target. + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, Main.UIScaleMatrix); + spriteBatch.Draw(PixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + + string fishStocksPower = (player.Calamity().fishStockPower > -0 ? "+" : "") + Math.Round(player.Calamity().fishStockPower, 2).ToString() + "x"; + Vector2 textPos = baseUIPosition + new Vector2(-148 - (3.5f * fishStocksPower.Length), -118.5f) * fishStocksUIScale; + + // Text + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, fishStocksPower, textPos, Color.Lerp(shiftColor, Color.White, 0.35f), Color.Black, 1.4f * fishStocksUIScale); + + // Screen overlay + if (!CalamityClientConfig.Instance.Photosensitivity) + spriteBatch.Draw(screenTex.Value, baseUIPosition, null, shiftColor * 0.166f * screenFlicker, 0f, screenTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // Overlay Border + spriteBatch.Draw(overlayBorderTex.Value, baseUIPosition, null, Color.White, 0f, overlayBorderTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + } + + private static Texture2D GetFishyTexture(Player player) + { + float stockPower = player.Calamity().fishStockPower; + bool panic = stockPower <= -1f; + bool happy = stockPower >= 1f; + bool frame2 = time % 60 < 30; + Texture2D fishyTexture = player.dead ? fishyWhatTex.Value : (waving ? frame2 ? fishyBye2Tex.Value : fishyBye1Tex.Value : happy ? frame2 ? fishyHappy2Tex.Value : fishyHappy1Tex.Value : + panic ? frame2 ? fishyPanic2Tex.Value : fishyPanic1Tex.Value : frame2 ? fishyPoint2Tex.Value : fishyPoint1Tex.Value); + + return fishyTexture; + } + + public static float GetHeight(int point, Player player) + { + (float, float, float, float, float) oldHeights = player.Calamity().fishStockOldPower; + float height = point == 0 ? oldHeights.Item5 : + point == 1 ? oldHeights.Item4 : point == 2 ? oldHeights.Item3 : + point == 3 ? oldHeights.Item2 : point == 4 ? oldHeights.Item1 : player.Calamity().fishStockSlidingPower; + return -height; + } + } +} diff --git a/UI/FishStocks/FishyBye1.png b/UI/FishStocks/FishyBye1.png new file mode 100644 index 0000000000..f4e10ac69b Binary files /dev/null and b/UI/FishStocks/FishyBye1.png differ diff --git a/UI/FishStocks/FishyBye2.png b/UI/FishStocks/FishyBye2.png new file mode 100644 index 0000000000..88892c42da Binary files /dev/null and b/UI/FishStocks/FishyBye2.png differ diff --git a/UI/FishStocks/FishyHappy1.png b/UI/FishStocks/FishyHappy1.png new file mode 100644 index 0000000000..f4accf38e9 Binary files /dev/null and b/UI/FishStocks/FishyHappy1.png differ diff --git a/UI/FishStocks/FishyHappy2.png b/UI/FishStocks/FishyHappy2.png new file mode 100644 index 0000000000..a9973a11ee Binary files /dev/null and b/UI/FishStocks/FishyHappy2.png differ diff --git a/UI/FishStocks/FishyPanic1.png b/UI/FishStocks/FishyPanic1.png new file mode 100644 index 0000000000..74fa4d6080 Binary files /dev/null and b/UI/FishStocks/FishyPanic1.png differ diff --git a/UI/FishStocks/FishyPanic2.png b/UI/FishStocks/FishyPanic2.png new file mode 100644 index 0000000000..eb49b8d4d1 Binary files /dev/null and b/UI/FishStocks/FishyPanic2.png differ diff --git a/UI/FishStocks/FishyPoint1.png b/UI/FishStocks/FishyPoint1.png new file mode 100644 index 0000000000..06bea79a18 Binary files /dev/null and b/UI/FishStocks/FishyPoint1.png differ diff --git a/UI/FishStocks/FishyPoint2.png b/UI/FishStocks/FishyPoint2.png new file mode 100644 index 0000000000..80fd156f85 Binary files /dev/null and b/UI/FishStocks/FishyPoint2.png differ diff --git a/UI/FishStocks/FishyWhat.png b/UI/FishStocks/FishyWhat.png new file mode 100644 index 0000000000..eb121329b9 Binary files /dev/null and b/UI/FishStocks/FishyWhat.png differ 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..ee239e25e2 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -275,7 +275,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 +888,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/DustExtensions.cs b/Utilities/DustExtensions.cs index 93df499dfb..3688285a1f 100644 --- a/Utilities/DustExtensions.cs +++ b/Utilities/DustExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using Terraria; namespace CalamityMod.Utilities @@ -7,6 +8,13 @@ namespace CalamityMod.Utilities { extension(Dust dust) { + public float dataAsFloat + { + get => (float)dust.customData; + set => dust.customData = value; + } + + [Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")] public static Dust BetterCloneDust(Dust rf) { diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 7ad793f3ad..848c00118a 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod { @@ -160,17 +161,17 @@ namespace CalamityMod // Color debuffs based on their element type in the vulnerability and resistance system // If a debuff has multiple types, the colors are mixed // If a debuff is typeless, is gets the typeless color - else if (BuffDatasets.DebuffDataset[debuffId] is not null) + else if (CalamityBuffSets.DebuffDataset[debuffId] is not null) { if (!debuffColorWeightsCache.TryGetValue(debuffId, out var weights)) { weights = [ - (SicknessDebuffColor, BuffDatasets.DebuffDataset[debuffId].SicknessDebuffScaling), - (FireDebuffColor, BuffDatasets.DebuffDataset[debuffId].HeatDebuffScaling), - (WaterDebuffColor, BuffDatasets.DebuffDataset[debuffId].WaterDebuffScaling), - (ElectricDebuffColor, BuffDatasets.DebuffDataset[debuffId].ElectricDebuffScaling), - (ColdDebuffColor, BuffDatasets.DebuffDataset[debuffId].ColdDebuffScaling), + (SicknessDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].SicknessDebuffScaling), + (FireDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].HeatDebuffScaling), + (WaterDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].WaterDebuffScaling), + (ElectricDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].ElectricDebuffScaling), + (ColdDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].ColdDebuffScaling), ]; } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index aacef829b0..487ee4a02a 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -279,7 +279,7 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.OnFire, ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.OnFire, ModContent.BuffType(), ModContent.BuffType() }) }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, @@ -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/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0db89dd408..8d3a4e0e50 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -147,10 +147,10 @@ namespace CalamityMod // Xyk 3MARCH2026: Will be implemented better by Doze eventually if (addHeldItemScale) baseScale += (player.HeldItem.scale - 1); - if (player.HasBuff(BuffID.Tipsy)) - baseScale += 0.15f; - + baseScale += 0.25f; + if (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake)) + baseScale += 0.25f; return baseScale; } diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 7ced2c3c3b..c44848f481 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -161,7 +161,6 @@ namespace CalamityMod projectile.tileCollide = true; } } - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia, bool respectIFrames = false) { if (!projectile.friendly) 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/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/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/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 267115e3f5..358282396c 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Waters { if (Main.dayTime && !Main.raining) { - float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); - if (j > 580) - brightness *= 1f - (j - 580) / 100f; + float brightness = MathHelper.Clamp(0.2f - (j / ((int)Main.worldSurface + 120)), 0f, 0.2f); + if (j > (int)Main.worldSurface + 20) + brightness *= 1f - (j - ((int)Main.worldSurface + 20)) / 100f; float time = Main.GameUpdateCount; float waveScale1 = time * 0.014f; @@ -83,9 +83,9 @@ namespace CalamityMod.Waters if (!Main.dayTime && !Main.raining) { - float brightness = MathHelper.Clamp(0.17f - (j / 680), 0f, 0.17f); - if (j > 580) - brightness *= 1f - (j - 580) / 100f; + float brightness = MathHelper.Clamp(0.17f - (j / ((int)Main.worldSurface + 120)), 0f, 0.17f); + if (j > ((int)Main.worldSurface + 20)) + brightness *= 1f - (j - ((int)Main.worldSurface + 20)) / 100f; float waveScale1 = Main.GameUpdateCount * 0.014f; float waveScale2 = Main.GameUpdateCount * 0.1f; @@ -106,9 +106,9 @@ namespace CalamityMod.Waters if (Main.raining) { - float brightness = MathHelper.Clamp(1f - (j / 680), 0f, 1f); - if (j > 580) - brightness *= 1f - (j - 580) / 100f; + float brightness = MathHelper.Clamp(1f - (j / ((int)Main.worldSurface + 120)), 0f, 1f); + if (j > ((int)Main.worldSurface + 20)) + brightness *= 1f - (j - ((int)Main.worldSurface + 20)) / 100f; outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); outputColor *= brightness; diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 8a789c3fd0..3ffb533837 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -79,6 +79,8 @@ namespace CalamityMod.World public static bool spawnedBandit = false; /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; + /// If true, the Town Pig is able to move in. + public static bool unlockedTownPig = false; /// Used for allowing custom Town Cat patreon names. public static bool catName = false; 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/DungeonArchive.cs b/World/DungeonArchive.cs index a1958e2331..59fd429795 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using CalamityMod.Schematics; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -72,6 +73,8 @@ namespace CalamityMod.World if (placedArchive) { + WorldgenManagementSystem.DungeonArchivePos = new Point(i, j); + bool firstItem = false; if (dungeonArchiveColor == 0) diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index a1e3b2c1b4..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; @@ -537,7 +538,7 @@ namespace CalamityMod.World public static void GenerateAuricLandMines() { int landMineID = ModContent.TileType(); - int landMineChance = Main.zenithWorld ? 150 : 300; + int landMineChance = Main.zenithWorld ? 125 : 300; float maxDepth = Main.maxTilesY * (Main.zenithWorld ? 0.75f : 0.5f); // depth increased in gfb due to the evil columns that extend further downward for (int x = 0; x < Main.maxTilesX; x++) { @@ -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/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index fccaf54011..d735d0c0b2 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -70,7 +70,7 @@ namespace CalamityMod.World.Planets // Create walls. WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] { - new Actions.PlaceWall(WallID.Stone) + new Actions.PlaceWall(WallID.RocksUnsafe1) })); // Place an inner luminite core. diff --git a/World/Planets/LuminitePlanet2.cs b/World/Planets/LuminitePlanet2.cs index e9cd5f9204..6a6323c1cb 100644 --- a/World/Planets/LuminitePlanet2.cs +++ b/World/Planets/LuminitePlanet2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.World.Planets // Create walls. WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] { - new Actions.PlaceWall(WallID.Stone) + new Actions.PlaceWall(WallID.RocksUnsafe1) })); // Place an inner luminite core. diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 5359115d0b..786fcb8bf9 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,826 @@ 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; + public Vector2 Position; + + public Hub(Vector2 position) + { + Position = position; + } + + public Hub(float x, float y) + { + Position = new Vector2(x, y); + } } - static bool IsAirOrDecor(int x, int y) + + private class Cluster : List { - if (y <= 0 || y >= Main.maxTilesY - 1 || x <= 0 || x >= Main.maxTilesX - 1) - return true; // out-of-bounds above counts as clear + } + + private class ClusterGroup : List + { + public int Width; + + public int Height; + + private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) + { + pointCluster.Add(new Point(x, y)); + hubMap[x, y] = false; + level--; + if (level == -1) + { + return; + } + 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); + } + } + + private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster + { + int clusterPos = clusterIndexMap[x, y]; + if (clusterPos != -1 && clusterPos != index) + { + int clusterHeight = (WorldGen.genRand.NextBool(2)) ? -1 : index; + foreach (Point current in pointClusters[clusterPos]) + { + 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)) + { + List list2 = new List(); + SearchForCluster(array, list2, k, l, 2); + if (list2.Count > 2) + { + 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; + + public static bool Place(Point origin) + { + for (int y = origin.Y; y >= (int)Main.worldSurface; y--) + { + //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; + } + } + + 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); - 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++) - { - 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) + public static void PlaceTit(int x, int y, ushort type = 165) { - FasterParallel.For(fromInclusive, toExclusive, (start, end, _) => + if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y + 1].HasTile) { - 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) + if (Main.tile[x, y - 1].TileType == (ushort)ModContent.TileType()) { - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Rectangle(20, 20), Actions.Chain(new GenAction[] + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].HasTile) { - 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[] + int num2 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num2; + Main.tile[x, y].TileFrameY = 72; + } + else { - // 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()) - })) - ; + int num3 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num3; + Main.tile[x, y].TileFrameY = 0; + Main.tile[x, y + 1].TileType = type; + Main.tile[x, y + 1].Get().HasTile = true; + Main.tile[x, y + 1].TileFrameX = (short)num3; + Main.tile[x, y + 1].TileFrameY = 18; } } - } - ); - - //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) => + else { - for (int WaterY = startY + 37; WaterY <= startY + 60; WaterY++) + if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile) { - 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[] + if (Main.tile[x, y + 1].TileType == (ushort)ModContent.TileType()) { - 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)) + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].HasTile) { - 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; + int num13 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num13; + Main.tile[x, y].TileFrameY = 90; } 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; - } - } - } - } - - // 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, 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); - } - } - } - } - - // Middle of the sunken sea (polyp forest) - public static void PlacePolypForest(int startPosX, int startPosY) - { - - 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) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.ClamDenX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.ClamDenY; - - 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++) - { - 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); + int num14 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y - 1].TileType = type; + Main.tile[x, y - 1].Get().HasTile = true; + Main.tile[x, y - 1].TileFrameX = (short)num14; + Main.tile[x, y - 1].TileFrameY = 36; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num14; + Main.tile[x, y].TileFrameY = 54; } } } } } - - - //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)) - { - return; - } - - points.Add(p); - - getAttachedPoints(x + 1, y, points); - getAttachedPoints(x - 1, y, points); - getAttachedPoints(x, y + 1, points); - getAttachedPoints(x, y - 1, points); - } - - for (int x = 20; x < Main.maxTilesX - 20; x += 1) - { - for (int y = 20; y < Main.maxTilesY - 20; y++) - { - List chunkPoints = new(); - getAttachedPoints(x, y, chunkPoints); - - int cutoffLimit = 75; - if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) - { - foreach (Point p in chunkPoints) - { - WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(true), - new Actions.ClearWall(true) - })); - } - } - } - } - } - - - //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) - { - Vector2 point = tile.ToWorldCoordinates(); - - if (collapse) - { - float distY = center.Y - point.Y; - point.Y -= distY * 4f; - } - 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; - } + */ } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 2ecd592b96..92f106df70 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -430,29 +430,27 @@ namespace CalamityMod.World #region Ice Shrine public static void FillIceShrineChest(Chest chest) { - int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); List contents = new List() { - new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 10 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(foodType, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(ItemID.IceCream, WorldGen.genRand.Next(10, 12 + 1)), }; if (Main.zenithWorld) { contents = new List() { - new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), 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